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: Default ACLs ignored when adding new file #1369
Comments
Yes indeed, the file permission for new files are hardcoded. I'm not very familiar with ACL but is there a way to access the value in lua (especially neovim lua)? @cseickel |
Does it matter in this case? It doesn't seem like there is a bug to fix regarding creating new files on Windows. Regarding the ACL, I wonder if we even need to set the ACL at all. What happens if we don't set it explicitly? |
Just did a bit of digging and it seems that neo-tree.nvim/lua/neo-tree/sources/filesystem/lib/fs_actions.lua Lines 393 to 396 in 230e938
I think maybe we could just use local file = io.open("foo.txt", "w")
if file then
file:close()
end |
@cseickel
@bwpge Does it work when parent directories do not exist? I mean if we still need to call |
Ah ok yes I see, right above my linked section LOL. No |
Did some quick experimenting on WSL, I was able to reproduce the issue with the steps as documented with Using
@Ian2020 can you confirm if this is the expected behavior we want? The default ACL was set with |
I think the dir
From https://www.howtogeek.com/how-to-use-filesystem-acl-on-linux/ If I use the normal systems tools to make another dir in
...so the nested dir does get group:write permissions, on my system at least. However when I use A quick look at calls to os_file_mkdir in the neovim codebase shows hardcoded
So I could raise a bug with neovim to respect ACLs on intermediate dirs if that will ultimately make it easier to fix here? |
You know, it occurs to me that maybe we should attempt to use shell commands to create files and folders instead of libuv. We do that with
|
Just throwing my two cents in for whatever it's worth: For file creation, I would not want to rely on shell commands. Windows usually defaults most stuff to UTF-16 encoding unless you go out of your way to deal with it, which can get super annoying. Lua's From @Ian2020's findings, I wouldn't hold my breath for Neovim to change the directory creation behavior anytime soon.. so maybe relying on the OS commands to make directories is the right approach if we really want to get it right. As with all things, Windows can do somewhat the same as POSIX style |
Did you check docs and existing issues?
Neovim Version (nvim -v)
0.9.5
Operating System / Version
Fedora 38
Describe the Bug
When I use neo-tree to create a file in a directory with a default access control list (ACL) the permissions of the new file do not respect that ACL. If I create/write a file using plain vim i.e.
:w file
then the file does respect the ACL.It looks like permissions on new files are hard-code here(?): https://github.com/nvim-neo-tree/neo-tree.nvim/blob/main/lua/neo-tree/sources/filesystem/lib/fs_actions.lua#L396
Screenshots, Traceback
No response
Steps to Reproduce
mkdir /tmp/blah
setfacl -dm g::rw- /tmp/blah
ls -al /tmp/blah
- observe the new file is missing group:rw. Contrast with permissions of a file created withtouch /tmp/blah/new
or by:w /tmp/blah/new
in nvim.Expected Behavior
It would be great if neo-tree let the filesystem decide the correct permissions so if a user has custom ACLs etc they are respected.
Your Configuration
The text was updated successfully, but these errors were encountered: