Repository navigation
chmod: report the real error for files below the -R operand - #15935
eylulseyit wants to merge 2 commits into
Conversation
|
The failing checks look unrelated to this change. Code Coverage and GNU (SELinux) failed during setup, before any tests ran. MinRustV failed on test_nohup_replaced_stdin_is_not_readable, which happens on ubuntu-26.04 runners; I opened #15937 for the underlying cat bug. Could someone re-run the setup failures? |
|
thanks for looking into this! |
|
a bunch of jobs are failing |
| @@ -843,13 +843,7 @@ impl Chmoder { | |||
| ); | |||
There was a problem hiding this comment.
the issue also covers this -v line: no old mode / symbolic form, and printed before the error
could you please fix it too, or not close #15934 with this PR? thanks
There was a problem hiding this comment.
Done, I fixed the -v line in this PR, it now matches GNU.
| fn test_chmod_recursive_reports_real_error_below_operand() { | ||
| use rustix::process::geteuid; | ||
|
|
||
| // A file found while recursing that the user does not own must be |
There was a problem hiding this comment.
could you please make this comment shorter? :)
|
The EPERM path now matches GNU 9.12, but the entry name is still lost when GNU: In Smaller gap in the same area: with |
When chmod could not change the mode of a file found while recursing, every error except EROFS was reported as "cannot access ... Permission denied", even EPERM for a file the user doesn't own. Now the error from chmod is shown as is, the same way change_file() already does for the operand.
Show the old and new mode, drop the extra 'file' word for the operand, and print the line after the error, as GNU does.
4ba6487 to
ce166e9
Compare
With -R, if chmod couldn't change the mode of a file below the operand, every error except EROFS was shown as "cannot access ... Permission denied". For a file the user doesn't own, that's wrong: the real error is EPERM, and GNU prints "changing permissions of 'X': Operation not permitted".
safe_chmod_file() now reports the error from chmod as is, like change_file() does for the operand. The test uses -R -L with a symlink to /etc/passwd to get EPERM below the operand without root.
Closes #15934