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

bash: rmdir dir/ (trailing slash) does not work #2686

Closed
nfeske opened this issue Feb 20, 2018 · 4 comments
Closed

bash: rmdir dir/ (trailing slash) does not work #2686

nfeske opened this issue Feb 20, 2018 · 4 comments

Comments

@nfeske
Copy link
Member

nfeske commented Feb 20, 2018

When using bash's tab completion on a directory, the completed name has a trailing slash. However, rmdir stumbles over an directory argument with a trailing slash and refuses to delete the specified directory. It works after manually removing the trailing slash though.

As a possible solution, the libc could strip trailing slashes of the rmdir argument. Maybe, a similar issue exists for other file/path operations?

@nfeske nfeske added the bug label Feb 20, 2018
@NobodyIII
Copy link
Contributor

This is probably related to "rm -r dir/" failing to delete the directory itself. I would love to see this fixed.

It sounds like our libc was designed for a less strict VFS implementation that allowed trailing slashes in paths. We probably need to remove trailing slashes from all libc file path strings in order to get the standard unix behavior.

@chelmuth
Copy link
Member

chelmuth commented Mar 8, 2018

It seems the libc could expect the kernel to strip the slash as strace rmdir /tmp/delme/ shows on Linux.

rmdir("/tmp/delme/")                    = 0

So, we have to strip trailing slashes in libc/file_operations.cc rmdir().

@nfeske nfeske changed the title Noux: rmdir dir/ (trailing slash) does not work bash: rmdir dir/ (trailing slash) does not work Apr 23, 2020
@nfeske
Copy link
Member Author

nfeske commented Apr 23, 2020

Removed noux from the title. As far as I know, the problem still exists when using bash.

@nfeske
Copy link
Member Author

nfeske commented May 4, 2020

Commit eb0a333 finally addresses this issue.

@nfeske nfeske added the fixed label May 5, 2020
@nfeske nfeske closed this as completed in eb0a333 May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants