coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

chmod: -R with dangling symlink does not error

Open creativecoder opened this issue 9 months ago • 2 comments

Does not show error when running chmod -R with an empty symlink.

Fixes #7214

creativecoder avatar Mar 15 '25 02:03 creativecoder

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

github-actions[bot] avatar Mar 15 '25 06:03 github-actions[bot]

Thanks for your PR!

I think it is only a partial solution: while uutils chmod no longer shows an error message it still fails whereas GNU chmod doesn't:

$ ln -s non_existing dangling_symlink
$ chmod 755 --no-dereference -R -P dangling_symlink
$ echo $?
0
$ cargo run --features=unix -q chmod 755 --no-dereference -R -P dangling_symlink
$ echo $?
1

Plus the test passes even without applying the changes to chmod.rs.

My suggestion is to start with a failing test and then make it pass with a fix.

cakebaker avatar Mar 17 '25 09:03 cakebaker