coreutils-9.0-1: chmod -R silently returns failure if dir contains a symlink (regression)
Brian Inglis
Brian.Inglis@SystematicSW.ab.ca
Sun Feb 9 18:26:36 GMT 2025
On 2025年02月09日 08:01, Christian Franke via Cygwin wrote:
> Testcase:
>> $ uname -r
> 3.5.7-1.x86_64
>> $ cygcheck -f /bin/chmod
> coreutils-9.0-1
>> $ mkdir dir
>> $ touch dir/file
>> $ chmod -R -v g-w dir; echo $?
> mode of 'dir' retained as 0755 (rwxr-xr-x)
> mode of 'dir/file' retained as 0644 (rw-r--r--)
> 0
>> $ ln -s file dir/link
>> $ chmod -R -v g-w dir; echo $?
> mode of 'dir' retained as 0755 (rwxr-xr-x)
> mode of 'dir/file' retained as 0644 (rw-r--r--)
> neither symbolic link 'dir/link' nor referent has been changed
> 1
>> $ chmod -R g-w dir; echo $?
> 1
>> $ chmod -v g-w dir dir/file dir/link; echo $?
> mode of 'dir' retained as 0755 (rwxr-xr-x)
> mode of 'dir/file' retained as 0644 (rw-r--r--)
> mode of 'dir/link' retained as 0644 (rw-r--r--)
> 0
>> $ chmod -R -v g+w dir; echo $?
> mode of 'dir' changed from 0755 (rwxr-xr-x) to 0775 (rwxrwxr-x)
> mode of 'dir/file' changed from 0644 (rw-r--r--) to 0664 (rw-rw-r--)
> neither symbolic link 'dir/link' nor referent has been changed
> 1
>> $ chmod -R g-w dir; echo $?
> 1
>> Exit status 1 does not occur with chmod from coreutils 8.32-1.
A major change in coreutils 9 was to use the f...at() directory relative
functions, so the error may be related to that symlink, unreported due to a bug
(in our/my patches, underlying, or upstream):
EOPNOTSUPP The AT_SYMLINK_NOFOLLOW bit is set in the flag argument, path names
a symbolic link, and the system does not support changing the mode of a symbolic
link.
Appears that it is a known bug and should have been fixed upstream; see the test
release announcement for many chmod fixes and changes including more options:
https://cygwin.com/pipermail/cygwin-announce/2025-January/012042.html
"...
2022年04月15日 9.1
Bug fixes
- chmod -R no longer exits with error status when encountering symlinks.
All files would be processed correctly, but the exit status was incorrect.
[bug introduced in coreutils-9.0]
..."
If you can, please check again with coreutils test 9.5.
I am working on updating to 9.6, will recheck as part of that, and fix or report
a regression, if an issue.
--
Take care. Thanks, Brian Inglis Calgary, Alberta, Canada
La perfection est atteinte Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher but when there is no more to cut
-- Antoine de Saint-Exupéry
More information about the Cygwin
mailing list