Commit: patch 9.2.0560: filetype: busybox shebang lines are not recognized

2 views
Skip to first unread message

Christian Brabandt

unread,
May 29, 2026, 2:45:13 PM (yesterday) May 29
to vim...@googlegroups.com
patch 9.2.0560: filetype: busybox shebang lines are not recognized

Commit: https://github.com/vim/vim/commit/69f402e97f9f8e5dbf17549c4813cf932c91a4ee
Author: Christoffer Aasted <dez...@gmail.com>
Date: Fri May 29 18:31:35 2026 +0000

patch 9.2.0560: filetype: busybox shebang lines are not recognized

Problem: filetype: busybox shebang lines are not recognized
Solution: Add filetype detection pattern for #!busybox sh, detect
ash as shell in the shebang lines (Christoffer Aasted).

closes: #20358

Signed-off-by: Christoffer Aasted <dez...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/autoload/dist/script.vim b/runtime/autoload/dist/script.vim
index 0106900f8..3f9a5acfd 100644
--- a/runtime/autoload/dist/script.vim
+++ b/runtime/autoload/dist/script.vim
@@ -45,6 +45,8 @@ def DetectFromHashBang(firstline: string)
name = substitute(line1, '^#!.*\<env\>\s\+\(\i\+\).*', ' ', '')
elseif line1 =~ '^#!\s*[^/\ ]*\>\([^/\]\|$\)'
name = substitute(line1, '^#!\s*\([^/\ ]*\>\).*', ' ', '')
+ elseif line1 =~ '^#!.*\<busybox\>'
+ name = substitute(line1, '^#!.*\<busybox\>\s\+\(\i\+\).*', ' ', '')
else
name = substitute(line1, '^#!\s*\S*[/\]\( \+\).*', ' ', '')
endif
@@ -67,7 +69,7 @@ enddef
# Returns an empty string when not recognized.
export def Exe2filetype(name: string, line1: string): string
# Bourne-like shell scripts: bash bash2 dash ksh ksh93 sh
- if name =~ '^\(bash\d*\|dash\|ksh\d*\|sh\)\>'
+ if name =~ '^\(bash\d*\|d\?ash\|ksh\d*\|sh\)\>'
return dist#ft#SetFileTypeSH(line1, false)

# csh scripts
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index 3e6a538a8..f4fd2002a 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -1089,7 +1089,10 @@ def s:GetScriptChecks(): dict<list<list<string>>>
['#!/path/bash2'],
['#!/path/dash'],
['#!/path/ksh'],
- ['#!/path/ksh93']],
+ ['#!/path/ksh93'],
+ ['#!/path/ash'],
+ ['#!/path/busybox ash'],
+ ['#!/path/busybox sh']],
csh: [['#!/path/csh']],
tcsh: [['#!/path/tcsh']],
zsh: [['#!/path/zsh']],
diff --git a/src/version.c b/src/version.c
index f77ed07b9..cb845499e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 560,
/**/
559,
/**/
Reply all
Reply to author
Forward
0 new messages