nvim-neo-tree/neo-tree.nvim

BUG: Default ACLs ignored when adding new file

Open

#1369 opened on Feb 29, 2024

View on GitHub
 (10 comments) (1 reaction) (0 assignees)Lua (5,436 stars) (291 forks)batch import
bughelp wantedwaiting-for-response

Description

Did you check docs and existing issues?

  • I have read all the docs.
  • I have searched the existing issues.
  • I have searched the existing discussions.

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

  1. mkdir /tmp/blah
  2. Give groups rw perms by default on new files: setfacl -dm g::rw- /tmp/blah
  3. Use neo-tree to create a file in /tmp/blah
  4. ls -al /tmp/blah - observe the new file is missing group:rw. Contrast with permissions of a file created with touch /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

-- DO NOT change the paths and don't remove the colorscheme
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

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  -- add any other plugins here
}

local neotree_config = {
  "nvim-neo-tree/neo-tree.nvim",
  dependencies = { "MunifTanjim/nui.nvim", "nvim-tree/nvim-web-devicons", "nvim-lua/plenary.nvim" },
  cmd = { "Neotree" },
  keys = {
    { "<Leader>e", "<Cmd>Neotree<CR>" }, -- change or remove this line if relevant.
  },
  opts = {
    -- Your config here
    -- ...
  },
}

table.insert(plugins, neotree_config)
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Contributor guide