GNU bug report logs - #50784
coreutils 9.0 sometimes gets spurious failures in chmod -R

Previous Next

Package: coreutils;

Reported by: Daniel Schepler <dschepler <at> gmail.com>

Date: Fri, 24 Sep 2021 18:23:01 UTC

Severity: normal

Merged with 50791, 53262

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: Daniel Schepler <dschepler <at> gmail.com>, 50784 <at> debbugs.gnu.org
Subject: bug#50784: coreutils 9.0 sometimes gets spurious failures in chmod -R
Date: Fri, 24 Sep 2021 21:02:56 +0100
[Message part 1 (text/plain, inline)]
On 24/09/2021 20:29, Pádraig Brady wrote:
> On 24/09/2021 19:21, Daniel Schepler wrote:
>> After I upgraded my system (locally built) to coreutils 9.0, I noticed
>> that my lightly modified sbuild started getting build failures when it
>> tries to run "chmod -R g+w /<<BUILDDIR>>" (as root) in the chroot.
>> I'm not sure exactly what combination of files triggers the error, but
>> I'm able to reproduce it roughly as follows:
>>
>> cd /tmp
>> tar -x -f .../coreutils-9.0.tar.xz
>> cd coreutils-9.0
>> mkdir obj-x86_64-linux-gnu
>> cd obj-x86_64-linux-gnu
>> ../configure --prefix=/usr
>> make -j8
>> chmod -R u+w /tmp/coreutils-9.0/obj-x86_64-linux-gnu
>> echo $?
>>
>> In the last chmod command, there are no failures reported; and even if
>> I run it under strace, I see no hints of any failed system calls other
>> than one in access("/etc/ld.so.preload", R_OK) at startup -- and
>> certainly no failures in the fchmodat() system calls.  Yet the exit
>> code from the process is 1.
>>
>> I wasn't seeing any such errors under sbuild using coreutils 8.32.
> 
> Drats. I think it's determining ignoring symlinks as an error.
> Could you try with the following untested diff:
> 
> diff --git a/src/chmod.c b/src/chmod.c
> index 37b04f500..9ab60898d 100644
> --- a/src/chmod.c
> +++ b/src/chmod.c
> @@ -322,6 +322,9 @@ process_file (FTS *fts, FTSENT *ent)
>      if ( ! recurse)
>        fts_set (fts, ent, FTS_SKIP);
> 
> +  if (ch.status == CH_NOT_APPLIED)  /* For symlinks.  */
> +    ch.status = CH_NO_CHANGE_REQUESTED;
> +
>      return CH_NO_CHANGE_REQUESTED <= ch.status;
>    }

Tested equivalent patch is attached.
[chmod-fix-symlink-exit.patch (text/x-patch, attachment)]

This bug report was last modified 3 years and 129 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.