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

Francesco Poli invernomuto at paranoici.org
Fri Feb 24 18:10:41 UTC 2017


On Mon, 19 Dec 2016 14:34:54 +0100 Bas Zoetekouw wrote:

> Hi,
> 
> On 19/12/16 14:02, James McCoy wrote:
> > On Mon, Dec 19, 2016 at 11:55:50AM +0100, Bas Zoetekouw wrote:
> >> 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.
> > 
> > Not that I can see.
> 
> I've just tried this with a clean strecht system (no ~/.vim* present):
> screenshot is attached.  The $(foo) is clearly marked as an error there
> (inverse colors in this color scheme), in the same way as real bashisms
> like $'' and ${foo%bar}.

Hello,
I am another user bitten by this bug.

Indeed, $(foo) does not appear to be a bashism, yet it's incorrectly
marked as an error by vim, when found in a POSIX shell script.

$'foo' is an actual bashism, so marking it as an error in a POSIX shell
script is OK.

On the other hand, substring processing (${FOO%bar}, ${FOO%%bar},
${FOO#bar}, ${FOO##bar}) is not a bashism: the man page for dash(1)
states that it is supported and checkbashism does not complain...

Hence, I think vim should not mark it as an error.
Actually vim-runtime/2:7.4.488-7+deb8u2 (which is in jessie) correctly
highlights substring processing, as shown in the first attached
screenshot.
Unfortunately, vim-runtime/2:8.0.0197-2 (which is in stretch) wrongly
considers it as a syntax error in POSIX shell scripts, as shown in the
second attached screenshot.

The two screenshots were obtained (on jessie and stretch, respectively)
with

  $ view -u NONE test.sh

followed by

 :syn on 
 :set bg=dark


I am under the impression that this misbehavior is caused by the same
bug reported by Bas.
Dear Debian Vim Maintainers, would you like me to file a separate bug
report for this?
Please let me know.

At any rate, please fix the bug(s) and/or forward the report(s)
upstream, as appropriate.

Thanks for your time!
Bye.


-- 
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jessie_vim-syntaxPOSIXshell.png
Type: image/png
Size: 855 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20170224/dbe8b844/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stretch_vim-syntaxPOSIXshell.png
Type: image/png
Size: 891 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20170224/dbe8b844/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20170224/dbe8b844/attachment.sig>


More information about the pkg-vim-maintainers mailing list