coreutils-9.0-1: chmod -R silently returns failure if dir contains a symlink (regression)
Christian Franke
Christian.Franke@t-online.de
Wed Feb 12 22:00:28 GMT 2025
Brian Inglis via Cygwin wrote:
> 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.
>
Problem does no longer occur with 9.5-1 and 9.6-1 test releases.
--
Regards,
Christian
More information about the Cygwin
mailing list