New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No syntax highlighting if XDG_DATA_DIRS is too long #4961
Comments
what maximum do you suggest? |
I'm not sure why you need a maximum. On the nixpkgs issue someone pointed out that vim's runtimepath internal variable handles a very long search path just fine. |
That could be an accident of the fact that Vim doesn't use snprintf in many cases when working |
@luispedro Why do you think that it is length of XDG_DATA_DIRS that is responsible for the problem and not something else? @justinmk I did not hardcode maximum size of any kind, and do not think that adding one is a good idea. |
@justinmk If |
@luispedro What is the longest single path in |
Because if I manually trim XDG_DATA_DIRS down, nvim works as expected. If it's one character above 2955, it stops working. Because of the way that NixOS works, you will end up with XDG_DATA_DIRS contains many many paths, but each individual one is a valid unix path. |
I see where is the problem: while I did not code maximum, option is then passed through Actually there are two bugs:
|
It is a wrong thing to do, this makes valid variable values be treated incorrectly: in XDG_DATA_HOME='/home/$foo/.local/share' `$foo` should be treated literally and not expanded to `foo` environment variable value. Also makes option_expand not try to expand too long strings even if these too long strings are default values. Previously it thought that default values should always be expanded. Also does not try to expand NULL should it be the default value just in case. Fixes neovim#4961
It is a wrong thing to do, this makes valid variable values be treated incorrectly: in XDG_DATA_HOME='/home/$foo/.local/share' `$foo` should be treated literally and not expanded to `foo` environment variable value. Also makes option_expand not try to expand too long strings even if these too long strings are default values. Previously it thought that default values should always be expanded. Also does not try to expand NULL should it be the default value just in case. Fixes neovim#4961
It is a wrong thing to do, this makes valid variable values be treated incorrectly: in XDG_DATA_HOME='/home/$foo/.local/share' `$foo` should be treated literally and not expanded to `foo` environment variable value. Also makes option_expand not try to expand too long strings even if these too long strings are default values. Previously it thought that default values should always be expanded. Also does not try to expand NULL should it be the default value just in case. Fixes neovim#4961
It is a wrong thing to do, this makes valid variable values be treated incorrectly: in XDG_DATA_HOME='/home/$foo/.local/share' `$foo` should be treated literally and not expanded to `foo` environment variable value. Also makes option_expand not try to expand too long strings even if these too long strings are default values. Previously it thought that default values should always be expanded. Also does not try to expand NULL should it be the default value just in case. Fixes neovim#4961
It is a wrong thing to do, this makes valid variable values be treated incorrectly: in XDG_DATA_HOME='/home/$foo/.local/share' `$foo` should be treated literally and not expanded to `foo` environment variable value. Also makes option_expand not try to expand too long strings even if these too long strings are default values. Previously it thought that default values should always be expanded. Also does not try to expand NULL should it be the default value just in case. Fixes neovim#4961
It is a wrong thing to do, this makes valid variable values be treated incorrectly: in XDG_DATA_HOME='/home/$foo/.local/share' `$foo` should be treated literally and not expanded to `foo` environment variable value. Also makes option_expand not try to expand too long strings even if these too long strings are default values. Previously it thought that default values should always be expanded. Also does not try to expand NULL should it be the default value just in case. Fixes neovim#4961
It is a wrong thing to do, this makes valid variable values be treated incorrectly: in XDG_DATA_HOME='/home/$foo/.local/share' `$foo` should be treated literally and not expanded to `foo` environment variable value. Also makes option_expand not try to expand too long strings even if these too long strings are default values. Previously it thought that default values should always be expanded. Also does not try to expand NULL should it be the default value just in case. Fixes neovim#4961
nvim --version
:NVIM 0.1.4
Build type: Release
Compilation: /nix/store/6rfvkcxwglqxq08kh7w8a08p533m39gj-gcc-wrapper-5.3.0/bin/gcc -Wconversion -O2 -DNDEBUG -DDISABLE_LOG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -DHAVE_CONFIG_H -D_GNU_SOURCE -I/tmp/nix-build-neovim-0.1.4.drv-0/neovim-v0.1.4-src/build/config -I/tmp/nix-build-neovim-0.1.4.drv-0/neovim-v0.1.4-src/src -I/nix/store/g45z22w8gy423l28a16qqbpyjc6h8mc1-libuv-1.9.1/include -I/nix/store/r9f075g92jf3i69z7zngk4fn6kxsmdyc-libmsgpack-1.1.0/include -I/nix/store/wq0pql3gpiqj5y6j7gdigbsmkajp8gra-luajit-2.1.0-beta1/include -I/nix/store/qbhlz2b5m9z6xv2nmqz903qxiw82srcb-unibilium-1.2.0/include -I/nix/store/v6wlaxwik8j64xsx8pqw5c259kzk1g6l-libtermkey-0.18/include -I/nix/store/qibb1yiwqydp7w04mwgzb6w7qm1zadvj-neovim-libvterm-2015-11-06/include -I/nix/store/m9hvah4ccnih51ikgy9chprnq3ljsvna-jemalloc-4.1.1/include -I/nix/store/zj5k6nandjij75093g2q3f2191hvf1xi-glibc-2.23-dev/include -I/tmp/nix-build-neovim-0.1.4.drv-0/neovim-v0.1.4-src/build/src/nvim/auto -I/tmp/nix-build-neovim-0.1.4.drv-0/neovim-v0.1.4-src/build/include
Compiled by nixbld
Optional features included (+) or not (-): +acl +iconv +jemalloc
For differences from Vim, see :help vim-differences
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "
/nix/store/b8sqcgs4im2ya3hkmjd1vbyg01chivbh-neovim-0.1.4/share/nvim"
Yes
NixOS 16.03
konsole
$TERM
:xterm
Actual behaviour
No syntax highlighting if the XDG_DATA_DIRS env variable is too long (on my system it seems to be 2955).
Using
:syntax on
triggers an error:Error detected while processing /nix/store/b8sqcgs4im2ya3hkmjd1vbyg01chivbh-neovim-0.1.4/share/nvim/runtime/syntax/syntax.vim:
line 42:
E216: No such group or event: filetypedetect BufRead
This was reported as a NixOS bug: NixOS/nixpkgs#15805
Expected behaviour
Syntax highlighting
Steps to reproduce using
nvim -u NORC
The text was updated successfully, but these errors were encountered: