From: Christoffer Aasted Date: Fri, 29 May 2026 18:31:35 +0000 (+0000) Subject: patch 9.2.0560: filetype: busybox shebang lines are not recognized X-Git-Tag: v9.2.0560^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=69f402e97f9f8e5dbf17549c4813cf932c91a4ee;p=thirdparty%2Fvim.git 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 Signed-off-by: Christian Brabandt --- diff --git a/runtime/autoload/dist/script.vim b/runtime/autoload/dist/script.vim index 0106900f8f..3f9a5acfd0 100644 --- a/runtime/autoload/dist/script.vim +++ b/runtime/autoload/dist/script.vim @@ -45,6 +45,8 @@ def DetectFromHashBang(firstline: string) name = substitute(line1, '^#!.*\\s\+\(\i\+\).*', '\1', '') elseif line1 =~ '^#!\s*[^/\\ ]*\>\([^/\\]\|$\)' name = substitute(line1, '^#!\s*\([^/\\ ]*\>\).*', '\1', '') + elseif line1 =~ '^#!.*\' + name = substitute(line1, '^#!.*\\s\+\(\i\+\).*', '\1', '') else name = substitute(line1, '^#!\s*\S*[/\\]\(\f\+\).*', '\1', '') 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 3e6a538a82..f4fd2002a1 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -1089,7 +1089,10 @@ def s:GetScriptChecks(): dict>> ['#!/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 f77ed07b9b..cb845499e4 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, /**/