Closed seblj closed 1 year ago
The issue was too long so will post the output of the log file here
I noticed that the result from git_run is okay, but there was not any stdout.
If the result is ok then there should be stdout.
I noticed that the result from git_run is okay, but there was not any stdout.
If the result is ok then there should be stdout.
Stdout is empty
It shouldn't be. Or at least I don't know how it could if the exit code was 0.
What was the command? git rev-parse --short HEAD
?
What was the command?
git rev-parse --short HEAD
?
Yes
I've added a nil check so the function will error is stdout is empty. Not sure what the actual issue is though.
Okay, my bad, it is FETCH_HEAD
that fails. So when getting the new rev
Can you run the command locally?
Can you run the command locally?
It outputs the current commit like it should. Really weird as this changes on which plugins it affects from each time I run PackerSync
Ok, probably something funky in jobs.tl
or async.tl
.
Ok, probably something funky in
jobs.tl
orasync.tl
.
Yeah probably. Just let me know if there is anything else I can do to help pin down the issue with testing something
just and print messages in places. jobs.tl
is only 189 LOC and just wraps vim.loop.spawn
.
Hmm, I can't seem to figure out why it happens. Stdout and stderr is both empty. It's probably something weird in either jobs.tl
or async.tl
like you said. Running the commands locally always works, and the cwd, args and cmd all seem to be good, so I guess the job is not able to finish or something :man_shrugging:
Did you try logging everything that came out of https://github.com/wbthomason/packer.nvim/blob/main/teal/packer/jobs.tl#L107 ?
No not before now, but now I can see that it reports an error that it failed to get a new revision, then later it logs that it found it. So it probably returns before it is able to return the result or something like that
Here is a small output from the log with the extra trace I added. If you see the first two lines, it logs that it failed to get the new revision. Then there is some unrelated job logs, but the last line in the log shows that it successfully got the new revision, but then it is too late
[DEBUG 14:11:20 1507561570] ...k/packer/opt/packer.nvim/lua/packer/plugin_types/git.lua:286: vimtex: $s: failed getting new revision
[DEBUG 14:11:20 1507590993] .../site/pack/packer/opt/packer.nvim/lua/packer/actions.lua:239: Failed to update vimtex: 'git rev-parse --short FETCH_HEAD' did not return a result
[TRACE 14:11:20 1507943864] ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:35: Running job: cmd = git, args = { "rev-parse", "--short", "FETCH_HEAD" }, cwd = /home/sebastian/.local/share/nvim/site/pack/packer/opt/formatter.nvim
[TRACE 14:11:20 1509139419] ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:35: Running job: cmd = git, args = { "rev-parse", "--short", "FETCH_HEAD" }, cwd = /home/sebastian/.local/share/nvim/site/pack/packer/opt/gitsigns.nvim
[TRACE 14:11:20 1510342122] ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:35: Running job: cmd = git, args = { "rev-parse", "--short", "FETCH_HEAD" }, cwd = /home/sebastian/.local/share/nvim/site/pack/packer/opt/vim-dadbod
[TRACE 14:11:20 1511562252] ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:35: Running job: cmd = git, args = { "rev-parse", "--short", "FETCH_HEAD" }, cwd = /home/sebastian/.local/share/nvim/site/pack/packer/opt/vim-startuptime
[TRACE 14:11:20 1512749457] ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:35: Running job: cmd = git, args = { "rev-parse", "--short", "FETCH_HEAD" }, cwd = /home/sebastian/.local/share/nvim/site/pack/packer/opt/tabular
[TRACE 14:11:20 1513994213] ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:35: Running job: cmd = git, args = { "rev-parse", "--short", "FETCH_HEAD" }, cwd = /home/sebastian/.local/share/nvim/site/pack/packer/opt/markdown-preview.nvim
[TRACE 14:11:20 1515314985] ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:35: Running job: cmd = git, args = { "rev-parse", "--short", "FETCH_HEAD" }, cwd = /home/sebastian/.local/share/nvim/site/pack/packer/opt/playground
[TRACE 14:11:20 1516539261] ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:35: Running job: cmd = git, args = { "rev-parse", "--short", "FETCH_HEAD" }, cwd = /home/sebastian/.local/share/nvim/site/pack/packer/opt/nvim-tree.lua
[TRACE 14:11:20 1517726949] ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:35: Running job: cmd = git, args = { "rev-parse", "--short", "FETCH_HEAD" }, cwd = /home/sebastian/.local/share/nvim/site/pack/packer/opt/feline.nvim
[TRACE 14:11:20 1518925131] ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:35: Running job: cmd = git, args = { "rev-parse", "--short", "FETCH_HEAD" }, cwd = /home/sebastian/.local/share/nvim/site/pack/packer/opt/plenary.nvim
[TRACE 14:11:20 1520104837] ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:35: Running job: cmd = git, args = { "rev-parse", "--short", "FETCH_HEAD" }, cwd = /home/sebastian/.local/share/nvim/site/pack/packer/opt/rest.nvim
[TRACE 14:11:20 1521281379] ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:35: Running job: cmd = git, args = { "rev-parse", "--short", "FETCH_HEAD" }, cwd = /home/sebastian/.local/share/nvim/site/pack/packer/opt/vim-surround
[TRACE 14:11:20 1522513231] ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:35: Running job: cmd = git, args = { "rev-parse", "--short", "FETCH_HEAD" }, cwd = /home/sebastian/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons
[TRACE 14:11:20 1523861600] ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:108: in setup_pipe, data: 7a887028
, err: nil, kind: stdout, task: { "git", "rev-parse", "--short", "FETCH_HEAD" }, cwd: /home/sebastian/.local/share/nvim/site/pack/packer/opt/vimtex
One quick thing to rule out. What version of Lua are you running and are you running any 5.2 features?
What's the output of :lua=coroutine.running()
?
Another thing, in jobs.tl
change:
for kind, pipe in pairs({ stdout = stdout, stderr = stderr } as {StdioType:vim.loop.Pipe}) do
if pipe and callbacks[kind] then
pipe:read_start(function(err: string, data: string)
if data then
callbacks[kind](err, data)
else
pipe:read_stop()
pipe:close()
end
end)
end
end
to
for kind, pipe in pairs({ stdout = stdout, stderr = stderr } as {StdioType:vim.loop.Pipe}) do
if pipe and callbacks[kind] then
pipe:read_start(function(err: string, data: string)
callbacks[kind](err, data)
if err then
pipe:read_stop()
pipe:close()
end
end)
end
end
One quick thing to rule out. What version of Lua are you running and are you running any 5.2 features?
Running nvim --version
says that it uses LuaJIT 2.1.0-beta3
. I am pretty sure I am not running any 5.2 features. How could I check this?
What's the output of
:lua=coroutine.running()
?
The output is: nil
Another thing, in
jobs.tl
change:for kind, pipe in pairs({ stdout = stdout, stderr = stderr } as {StdioType:vim.loop.Pipe}) do if pipe and callbacks[kind] then pipe:read_start(function(err: string, data: string) if data then callbacks[kind](err, data) else pipe:read_stop() pipe:close() end end) end end
to
for kind, pipe in pairs({ stdout = stdout, stderr = stderr } as {StdioType:vim.loop.Pipe}) do if pipe and callbacks[kind] then pipe:read_start(function(err: string, data: string) callbacks[kind](err, data) if err then pipe:read_stop() pipe:close() end end) end end
This unfortunately didn't change anything. Still the same issue.
However, It seems like your latest commit 6ed8fd9 actually fixes this! However, if I also change what you suggested here, the command doesn't run at all
I can't reproduce this error anymore after your latest commit! Thank you very much!
Hmm, that's quite peculiar. I can't imagine why closing the pipes would fix this. Oh well :shrug:.
Please let me know if you see anything like this again as it appears to be an issue with fairly low level code and fundamental to how the project runs.
nvim --version
: v0.9.0-dev-361+g126ef65e5git --version
: 2.34.1packer
commit: 05807f1Observed behaviour
Every time I run
PackerSync
orPackerUpdate
I get an error:I unfortunately can't reproduce this error consistently on a specific plugin, and it also didn't happen on my mac yesterday. It does however happen on like every
PackerSync
or everyPackerUpdate
I do now, and it seems to be random on which plugin it happens with.Expected behaviour
Should not error
Steps to reproduce
Step 1: Install packer as an opt-plugin.
Step 2: Use the provided config in
Plugin specification table
Step 3: Install all the plugins
Step 4: Run
PackerSync
orPackerUpdate
.This produces the error for me every time with at least one plugin. See the video provided:
Screencast from 09. des. 2022 kl. 09.32 +0100.webm
More info
I have tried to track the error down, and I noticed that it comes from
get_ref
insidepacker.nvim/teal/packer/plugins_types.git.tl
. I noticed that the result fromgit_run
is okay, but there was not any stdout.This will make
current_commit
benil
in theupdate
function, which makesplugin.revs[1]
be nil. This will fail later down in theupdate
function.If you need med to try out anything more, please let me know, and I will gladly help to track down why this happens occasionally
packer files
Plugin specification table
```lua vim.opt.termguicolors = true local setup = function(name, config) return not config and string.format([[require('%s').setup()]], name) or string.format([[require('%s').setup(%s)]], name, vim.inspect(config or {})) end local conf = function(name) return string.format([[require('config.%s')]], name) end vim.cmd.packadd('packer.nvim') require('packer').add({ { 'lewis6991/packer.nvim', branch = 'main' }, -- Telescope { 'nvim-telescope/telescope.nvim', config = conf('telescope') }, { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }, { 'nvim-telescope/telescope-file-browser.nvim' }, { 'nvim-lua/plenary.nvim' }, -- Treesitter { 'nvim-treesitter/nvim-treesitter', config = conf('treesitter'), run = ':TSUpdate