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

Moving a file in MemoryFS doesn't update its name and causes issues with walk #509

Closed
althonos opened this issue Dec 13, 2021 · 0 comments · Fixed by #510
Closed

Moving a file in MemoryFS doesn't update its name and causes issues with walk #509

althonos opened this issue Dec 13, 2021 · 0 comments · Fixed by #510
Assignees
Labels
Milestone

Comments

@althonos
Copy link
Member

This is on Python 3.10, master branch.

It seems that MemoryFS.move does not update the name of entries being moved, only updating the name in the parent entry (the directory). If an entry is being renamed, this will cause issues for walkers and scandir, but not for listdir.

Steps to reproduce:

import fs
with fs.open_fs("mem://") as mem:
    mem.makedir("foo").writetext("test.txt", "Hello, World")
    mem.move("foo/test.txt", "foo/test2.txt")
    print(mem.listdir("/foo"))
    mem.tree()

Expected output:

['test2.txt']
└── foo
    └── test2.txt

Actual output:

['test2.txt']
└── foo
    └── test.txt
@althonos althonos added the bug label Dec 13, 2021
@althonos althonos added this to the v2.4.15 milestone Dec 13, 2021
@althonos althonos self-assigned this Dec 13, 2021
@althonos althonos linked a pull request Dec 13, 2021 that will close this issue
4 tasks
althonos added a commit to althonos/fs.archive that referenced this issue Dec 14, 2021
althonos added a commit to althonos/fs.archive that referenced this issue Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant