Skip to content
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

[mini.bracketed] oldfiles hangs neovim when mounted directory is not available #1321

Open
3 tasks done
ThomasFeher opened this issue Nov 1, 2024 · 3 comments
Open
3 tasks done
Labels
bug Something isn't working mini.bracketed

Comments

@ThomasFeher
Copy link

Contributing guidelines

Module(s)

bracketed

Description

I have a mounted remote location via NFS (Linux).
Whenever I disconnect Ethernet or Wifi without unmounting, Neovim is not starting anymore.

The issue is the first part of line 1751 in bracketed.lua (function H.oldfile_ensure_initialized) which is executed during startup of Neovim:

    if vim.fn.filereadable(path) == 1 then recency[path] = n - i + 1 end

vim.fn.filereadable() hangs until the connection is reestablished, which is the normal behaviour of NFS mounts, because I have file paths of that remote location in my v:oldfiles.

I know this is not a very common use case, and it is the users fault if the mounted location is not available, but if that leads to infinite hangs although the location is not used by the user, this becomes an annoyance.
Would it be possible to implement an configurable option to simply remove that check? I could try to create a PR for that.

Neovim version

0.10.2

Steps to reproduce

  1. mount remote location to /mnt/mymount
  2. nvim -nu minimal.lua needs to only load mini.bracketed
  3. :e /mnt/mymount/myfile.txt this should add the file path to v:oldfiles
  4. :q
  5. disconnect network connection without unmounting
  6. nvim -nu minimal.lua (this hangs infinitely)

Expected behavior

Neovim should start normally at 5. above.

Actual behavior

Neovim hangs infinitely at 5.

@ThomasFeher ThomasFeher added the bug Something isn't working label Nov 1, 2024
@echasnovski
Copy link
Owner

Thanks for the issue!

I don't have the means to reproduce this, so I'd have to ask for your help to find the best fix.
Could you, please, try replacing both instances of vim.fn.filereadable(path) == 1 (this and this) with vim.loop.fs_stat(path) ~= nil and see if it fixes the hanging issue?


As a side note, I'd also suggest creating an issue in vim/vim repo about this behavior of filereadable(). I don't think it should ever hang.

@ThomasFeher
Copy link
Author

Applying the changes as suggested does not fix the issue, it still hangs.

@echasnovski
Copy link
Owner

Hmm... Then there is either a complete redo of the tracking logic or declaring this as a known limitation. I'll take a closer look to try and reproduce this locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mini.bracketed
Projects
None yet
Development

No branches or pull requests

2 participants