Opened 3 years ago

Closed 2 years ago

Last modified 7 months ago

#2276 closed defect (fixed)

VIM syntax file errors with vim 8

Reported by: susnux@… Owned by:
Priority: minor Milestone:
Component: other Version:
Keywords: vim, syntax Cc:
uname -a: Linux HOSTNAME 5.14.14-1-default #1 SMP Thu Oct 21 05:05:03 UTC 2021 (2b5383f) x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.21.3
built by gcc 11.2.1 20210816 [revision 056e324ce46a7924b5cf10f61010cf9dd2ca10e9] (SUSE Linux)
built with OpenSSL 1.1.1l 24 Aug 2021
TLS SNI support enabled
configure arguments: --prefix=/usr/ --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/run/ --lock-path=/run/nginx.lock --http-client-body-temp-path=/var/lib/nginx/tmp/ --http-proxy-temp-path=/var/lib/nginx/proxy/ --http-fastcgi-temp-path=/var/lib/nginx/fastcgi/ --http-uwsgi-temp-path=/var/lib/nginx/uwsgi/ --http-scgi-temp-path=/var/lib/nginx/scgi/ --user=nginx --group=nginx --without-select_module --without-poll_module --with-threads --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-perl=/usr/bin/perl --with-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module --with-stream_ssl_preread_module --with-pcre --with-pcre-jit --with-cc-opt='-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -fPIC -D_GNU_SOURCE' --with-ld-opt='-Wl,-z,relro,-z,now -pie' --with-compat


When upgrading vim to version 8 the syntax file does not work anymore:

line 16:
E10: \ should be followed by /, ? or &

I attached a file with the error log.

So the line continuation does not work, as vim is, no idea why, reading syntax files now in vi-compatible mode.
By looking inside other syntax files I noticed this is commonly handled by setting the nocompatible mode manually for that syntax file.

I attached also a patch fixing this issue.

Attachments (2)

error.log (2.1 KB ) - added by susnux@… 3 years ago.
VIM error log
fix-nginx-syntax.patch (516 bytes ) - added by susnux@… 3 years ago.
Patch fixing the syntax file

Download all attachments as: .zip

Change History (5)

by susnux@…, 3 years ago

Attachment: error.log added

VIM error log

by susnux@…, 3 years ago

Attachment: fix-nginx-syntax.patch added

Patch fixing the syntax file

comment:1 by Maxim Dounin, 3 years ago

Works fine here at least with the following vim's:

  • 8.0.670 on FreeBSD 12.2
  • 8.2.2029 as in macOS 11.6
  • 8.2.2434 as in Ubuntu 21.04

I can reproduce the logs provided with cpo manually set to vi-compatible mode or with C option added, but it works flawlessly out of the box.

It looks like in your particular setup cpo is garbled somewhere, might be in some other syntax file or in the configuration (compatible set?). Could you please check if it is indeed what happens?

It probably make sense to save cpo anyway, but I'm curios what actually causes the issue here.

comment:2 by Maxim Dounin <mdounin@…>, 2 years ago

In 7996:5d88e2bf92b3/nginx:

Contrib: vim syntax adjusted to save cpoptions (ticket #2276).

Line continuation as used in the syntax file might be broken if "compatible"
is set or "C" is added to cpoptions. Fix is to set the "cpoptions" option
to vim default value at script start and restore it later, see
":help use-cpo-save".

comment:3 by Maxim Dounin, 2 years ago

Resolution: fixed
Status: newclosed

Fix committed, thanks for reporting this.

Note: See TracTickets for help on using tickets.