Bug#848663: vim: sh syntax highlighting of command substitution $() is wrong

Bas Zoetekouw bas at debian.org
Mon Dec 19 10:55:50 UTC 2016


Package: vim
Version: 2:8.0.0095-1
Severity: normal
Tags: patch

Vim's currenr behaviour for syntax highlighting of shell scripts (with
#!/bin/sh and /bin/sh pointing to dash) is to mark command
substititions using the $(foo) construction as an error.
This is incorrect, as POSIX sh alllows this construction.

Because vim's syntaxt hightlighting script correctly identifies
/bin/sh-->/bin/dash as a POSIX shell, and sets b:is_posix, ths fix is
simple:

--- sh.vim      2016-11-22 19:23:07.000000000 +0100
+++ /tmp/1      2016-12-19 11:51:16.151529633 +0100
@@ -291,7 +291,7 @@
 " (ie. Posix compliant shell).  /bin/ksh should work for those
 " systems too, however, so the following syntax will flag $(..) as
 " an Error under /bin/sh.  By consensus of vimdev'ers!
-if exists("b:is_kornshell") || exists("b:is_bash")
+if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix")
  syn region shCommandSub matchgroup=shCmdSubRegion start="\$("  skip='\\\\\|\\.' end=")"  contains=@shCommandSubList
  syn region shArithmetic matchgroup=shArithRegion  start="\$((" skip='\\\\\|\\.' end="))" contains=@shArithList
  syn region shArithmetic matchgroup=shArithRegion  start="\$\[" skip='\\\\\|\\.' end="\]" contains=@shArithList




-- Package-specific info:

--- real paths of main Vim binaries ---
/usr/bin/vi is /usr/bin/vim.gtk
/usr/bin/vim is /usr/bin/vim.gtk
/usr/bin/gvim is /usr/bin/vim.gtk

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages vim depends on:
ii  libacl1      2.2.52-3
ii  libc6        2.24-8
ii  libgpm2      1.20.4-6.2
ii  libselinux1  2.6-3
ii  libtinfo5    6.0+20161126-1
ii  vim-common   2:8.0.0095-1
ii  vim-runtime  2:8.0.0095-1

vim recommends no packages.

Versions of packages vim suggests:
pn  ctags        <none>
pn  vim-doc      <none>
pn  vim-scripts  <none>

-- no debconf information



More information about the pkg-vim-maintainers mailing list