-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
safe traversal: adjust chmod & chgrp to use it #8632
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
Conversation
|
based on this PR: #8626 |
|
GNU testsuite comparison: |
2bcba37 to
21b334e
Compare
|
GNU testsuite comparison: |
src/uu/chmod/src/chmod.rs
Outdated
| let entry_path = dir_path.join(&entry_name); | ||
|
|
||
| // Get metadata for the entry | ||
| let follow = self.traverse_symlinks == TraverseSymlinks::All; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct? What about TraverseSymlinks::First?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you think otherwise ? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because in walk_dir_with_context you use the following approach to determine whether to follow symlinks:
let should_follow_symlink = match self.traverse_symlinks {
TraverseSymlinks::All => true,
TraverseSymlinks::First => is_command_line_arg, // Only follow symlinks that are command line args
TraverseSymlinks::None => false,
};There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)
|
GNU testsuite comparison: |
a291ff0 to
b02315a
Compare
|
GNU testsuite comparison: |
b02315a to
8252cb1
Compare
CodSpeed Performance ReportMerging #8632 will create unknown performance changesComparing Summary
|
|
GNU testsuite comparison: |
src/uu/chmod/src/chmod.rs
Outdated
| let should_follow_symlink = match self.traverse_symlinks { | ||
| TraverseSymlinks::All => true, | ||
| TraverseSymlinks::First => false, // Only follow symlinks that are command line args | ||
| TraverseSymlinks::None => false, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I'm still struggling with this snippet. If line 502 is correct, then your previous approach with if is cleaner. Anyway, in both cases you can define should_follow_symlink outside of the for loop as its value doesn't depend on entry_name.
Co-authored-by: Daniel Hofstetter <[email protected]>
8252cb1 to
a00d7d7
Compare
|
GNU testsuite comparison: |
No description provided.