GNU bug report logs - #42633
8.32 make check as root failure of rmdir/ignore.sh

Previous Next

Package: coreutils;

Reported by: Nick Alcock <nix <at> esperi.org.uk>

Date: Fri, 31 Jul 2020 14:33:02 UTC

Severity: normal

Found in version 8.32

Done: Bernhard Voelker <mail <at> bernhard-voelker.de>

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: Bernhard Voelker <mail <at> bernhard-voelker.de>, Nick Alcock <nix <at> esperi.org.uk>, 42633 <at> debbugs.gnu.org
Subject: bug#42633: 8.32 make check as root failure of rmdir/ignore.sh
Date: Fri, 31 Jul 2020 20:42:50 +0100
On 31/07/2020 18:56, Bernhard Voelker wrote:
> On 2020-07-31 16:32, Nick Alcock wrote:
>> I get an ERROR when running rmdir/ignore.sh as root (but not when
>> running as non-root). [...]
> 
>> ERROR: tests/rmdir/ignore
>> =========================
> [...]
>> + mkdir -p x/y
>> + chmod a-w x
>> + returns_ 1 rmdir --ignore-fail-on-non-empty x/y
>> + fail=1
> 
> Thanks for reporting this issue.
> 
> Indeed, this test does not work as root.
> The comment in the test explains that it expects an EPERM error:
> 
>    # Ensure that with --ignore-fail-on-non-empty, we still fail, e.g., for EPERM.
>    # Between 6.11 and 8.31, the following rmdir would mistakenly succeed.
>    mkdir -p x/y || framework_failure_
>    chmod a-w x || framework_failure_
>    returns_ 1 rmdir --ignore-fail-on-non-empty x/y || fail=1
> 
> but root does not see the EPERM; strace output:
> 
>    ...
>    rmdir("x/y")                            = 0
>    close(1)                                = 0
>    close(2)                                = 0
>    exit_group(0)                           = ?
>    +++ exited with 0 +++
> 
> The attached patch adds guards around the parts of the test which
> only work as non-privileged user.
> 
> Have a nice day,
> Berny
> 

Patch looks good thanks.

An alternative could be to use rmdir itself to test, like:

  if ! rmdir x/y 2>/dev/null; then
    returns_ 1 rmdir --ignore-fail-on-non-empty x/y || fail=1
  fi

cheers,
Pádraig




This bug report was last modified 4 years and 289 days ago.

Previous Next


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