Skip to content

BUG: Attempts to recursively copy directory into child of itself #1846

@Artemis21

Description

@Artemis21

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)

NVIM v0.10.4

Operating System / Version

Fedora 41

Describe the Bug

If you copy a/ to a/b/, Neotree correctly refuses the command. However, if you copy a/ to a/b/c/, Neotree attempts to comply, resulting in recursion that ends in a filesystem error and a deeply nested file tree.

Related: #795

Screenshots, Traceback

Image

Steps to Reproduce

  1. Create a directory.
  2. With the cursor over the directory in neotree, press c for copy.
  3. In the resulting popup, enter b/c

Alternatively:

  1. Create a directory a/ with a subdirectory a/b/.
  2. With the cursor over a/, press y for yank.
  3. With the cursor over a/b/, press p for paste.

Expected Behavior

Neotree refuses to copy a directory into itself or any descendants.

Your Configuration

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    {
      "nvim-neo-tree/neo-tree.nvim",
      branch = "v3.x",
      dependencies = {
        "nvim-lua/plenary.nvim",
        "nvim-tree/nvim-web-devicons",
        "MunifTanjim/nui.nvim",
      },
      lazy = false,
      opts = {},
    }
  },
})
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>e", "<Cmd>Neotree<CR>")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions