-
Notifications
You must be signed in to change notification settings - Fork 337
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
bug: Lazy on linux fails to load plugins when git config --global core.autocrlf
is true
#1025
Comments
Hello @JL102, I think this might be a bug in upstream I created a Everything works fine when the global Repro-- test with:
-- git config --global core.autocrlf false
-- git config --global core.autocrlf true
--
-- clean after testing:
-- rm -rf pack .repro
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
local plugins = {
{
"tokyonight.nvim",
"https://github.com/folke/tokyonight.nvim.git",
},
{
"nui.nvim",
"https://github.com/MunifTanjim/nui.nvim.git",
},
{ --has a plugin folder, containing: plenary.vim
"plenary.nvim",
"https://github.com/nvim-lua/plenary.nvim.git",
},
{ -- has a plugin folder, containing: nvim-web-devicons.vim
"nvim-web-devicons",
"https://github.com/nvim-tree/nvim-web-devicons.git",
},
{ -- has a plugin folder, containing: neo-tree.vim
"neotree.nvim",
"https://github.com/nvim-neo-tree/neo-tree.nvim.git",
},
}
local packpath = root .. "/../pack/plugins/opt"
if not vim.loop.fs_stat(packpath) then
vim.fn.system({ "mkdir", packpath })
end
-- for each plugin: git clone
for _, plugin in pairs(plugins) do
local pluginpath = packpath .. "/" .. plugin[1]
if not vim.loop.fs_stat(pluginpath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", plugin[2], pluginpath })
end
end
-- for each plugin: packadd
for _, plugin in pairs(plugins) do
vim.cmd("packadd " .. plugin[1])
end
vim.cmd.colorscheme("tokyonight")
-- When core.autocrlf is true: Crashes on the first packadd command, when a plugin contains a vim file inside its plugin folder.
--[[
Error detected while processing /home/abeldekat/.config/nvim/minimal_packadd.lua:
E5113: Error while calling lua chunk: vim/_editor.lua:0: /home/abeldekat/.config/nvim/minimal_packadd.lua..nvim_exec2() called at /home/abeldekat/.config/nvim/minimal_packadd.lua:0
../home/abeldekat/.config/nvim/pack/plugins/opt/plenary.nvim/plugin/plenary.vim, line 1: Vim:E492: Not an editor command:
stack traceback:
[C]: in function 'nvim_exec2'
vim/_editor.lua: in function 'cmd'
/home/abeldekat/.config/nvim/minimal_packadd.lua:53: in main chunk
Error detected while processing /home/abeldekat/.config/nvim/pack/plugins/opt/plenary.nvim/plugin/plenary.vim:
line 1:
E492: Not an editor command: ^M
line 3:
E182: Invalid command name
line 5:
E492: Not an editor command: ^M
line 6:
E182: Invalid command name
line 8:
E492: Not an editor command: ^M
--]] Best regards! |
Thanks for the response!
Are you using the same version of nvim as me? (0.9.2) |
Hello @JL102, My nvim config is in |
@abeldekat hmm. Still doesn't work for me after removing both folders. In any case, though, I see you wrote After looking, I see that |
Actually, after some cursory testing, it seems like the native Windows build of Neovim doesn't care if the plugins' files are LF or CRLF. In other words, if Windows is the only OS supported by Neovim that uses CRLF, then I think it should be safe to just override |
Which OS are you using for the test? Your issue only mentions linux:
The point of my code snippet is to proof that stock neovim also crashes in the same manner as described in your "steps to reproduce", but without using lazy.nvim. In doing so I was hoping to discover if this issue is indeed a bug in lazy.nvim. I was also hoping to narrow the issue down a bit. I tested autocrlf for both false and true, on arch linux, setting the autocrlf manually in the terminal.
The provided snippet is intended to mimic the When testing on
In the second case, when autocrlf is on, I expect the snippet to fail. If the first case still is not working on your system, could you provide the details of the error? Are there any plugins in the pack folder? Is your neovim folder Best regards! Note: It can take a couple of seconds to git clone the plugins... |
@abeldekat Sorry, I'm not super used to neovim, so I don't understand exactly what you mean by "in the folder that contains your I'm primarily using AstroNvim, so normally my I'll respond to everything else you said after I can correctly reproduce your |
@JL102 no worries! Thanks for persisting! Inside Before running with |
@abeldekat
I'm currently running a Windows desktop and using WSL. When I first noticed the issue, I was on a laptop with Pop OS, but then when testing Ubuntu 22.04 and OpenSUSE Tumbleweed, I was using WSL.
It was only right before I wrote this comment when I downloaded the native Windows build of nvim and tested it. I ran my repro script both with
I think you have been focusing on suggestion # 1, while I have been focusing on # 2. After using your example, I understand what you were saying about # 1 being an issue with the runtime. In fact, it looks like it's a "bug" inside both vim AND vi. Neovim doesn't seem to have any issues loading lua files (that's why Lazy ran fine), and the error seems to only pop up when loading a In VS Code, because I can use it to easily control the line ending style, I created a file let name = "John"
echo "Hello, " . name When the file has LF endings, running
Maybe the devs of Neovim will be open to fixing it, but I suspect it'll be non trivial, considering we may be dealing with many-decades-old code. I wrote "bug" in quotes, now, after realizing it's present in both vim and vi, because it may actually be intended behavior to expect all files to have LF endings. After this discovery, I feel more strongly now that it would be simpler to adjust Lazy's Since the Windows version of nvim doesn't care if a *I don't have |
We are totally on the same page now! I indeed focused on your first suggestion, in order to find out if Best regards! |
This is not really a lazy issue as you found. Report it upstream or dont set that global config |
Hi folke, Sometimes it's necessary to have I'm grateful of your development of Lazy, as it's an excellent and very useful plugin. I respect your time so instead of arguing to get you to fix it for me, I've made a fork and added what I believe is a reasonable implementation of the requested feature and will submit a PR after posting this. Thanks! |
Did you check docs and existing issues?
Neovim version (nvim -v)
0.9.2
Operating system/version
Tested on Ubuntu 22.04, Pop OS 22.04, and OpenSUSE Tumbleweed
Describe the bug
I was having this issue on AstroNvim and it took me a long time to figure out the true cause of the problem. This was my original post on the AstroNvim discord help forum: https://discord.com/channels/939594913560031363/1128010315217506444
If
git config --global core.autocrlf
is true, then when Lazy.nvim downloads plugins and attempts to load them, you get errors like this:Steps To Reproduce
To reproduce issue:
git config --global core.autocrlf true
rm -rf
the.repro
foldernvim -u repro.lua repro.lua
(Opening the repro.lua file in the editor just so that we have some file open)The plugin I included in repro.lua, in this case neo-tree, fails to load because of an unexpected
^M
characterTo prove that it's
core.autocrlf true
that is the problem:git config --global core.autocrlf false
rm -rf
the.repro
folder to force lazy to re-download the pluginsnvim -u repro.lua repro.lua
Everything works as expected
Expected Behavior
I'd expect either of two things:
CRLF
newlines without crashingor
core.autocrlf
to be true or false depending on the system.I am guessing that #2 is the simpler option.
Repro
The text was updated successfully, but these errors were encountered: