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

Fix --preserve-root #1004

Open
Arcterus opened this issue Nov 30, 2016 · 3 comments
Open

Fix --preserve-root #1004

Arcterus opened this issue Nov 30, 2016 · 3 comments

Comments

@Arcterus
Copy link
Collaborator

I'm fairly certain that if the --preserve-root in chgrp was wrong, it is wrong in other utilities as well.

@wimh
Copy link
Contributor

wimh commented Dec 4, 2016

chgrp will still follow a bind mount to root and continue:

mkdir /root/root
mount -o bind / /root/root
chgrp --preserve-root -R root /root -v

The same applies to a symbolic link (with -H).

ln -s / /root/root
./target/debug/deps/chgrp --preserve-root -R root /root -v -H

Though it will detect a file system loop if a symbolic link is pointing to a parent directory other than the root directory (ln -s /tmp /tmp/tmp).

@Arcterus
Copy link
Collaborator Author

Arcterus commented Dec 5, 2016

I'm pretty sure the problem right now is because we are only checking if it's a bind mount to root or a symbolic link to root in traverse(), which is only called once. The WalkDir in dive_into() doesn't check for either of these cases, so it just keeps going unless you specifically give a bind mount to root or a symbolic link on the command-line.

@stale
Copy link

stale bot commented Mar 27, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants