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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 42633 in the body.
You can then email your comments to 42633 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#42633; Package coreutils. (Fri, 31 Jul 2020 14:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nick Alcock <nix <at> esperi.org.uk>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 31 Jul 2020 14:33:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nick Alcock <nix <at> esperi.org.uk>
To: GNU Coreutils Bug List <bug-coreutils <at> gnu.org>
Subject: 8.32 make check as root failure of rmdir/ignore.sh
Date: Fri, 31 Jul 2020 15:32:14 +0100
I get an ERROR when running rmdir/ignore.sh as root (but not when
running as non-root). The running system has coreutils 8.31 installed;
The source tree, /usr/src/coreutils/x86_64-loom, is a loopback mount of
an xfs filesystem dedicated only to this build. (The build subdir
shai-build has nothing special about it.)

The failure observed is described in a comment in the test as applying
only to 8.31 and below: I don't *think* it can be mistakenly running the
host touch(1), can it?

(This is all built from a bootstrapped git checkout with a
locally-updated gnulib, updated five minutes before I did the build.)

ERROR: tests/rmdir/ignore
=========================

++ initial_cwd_=/usr/src/coreutils/x86_64-loom/shai-build
+++ testdir_prefix_
+++ printf gt
++ pfx_=gt
+++ mktempd_ /usr/src/coreutils/x86_64-loom/shai-build gt-ignore.sh.XXXX
+++ case $# in
+++ destdir_=/usr/src/coreutils/x86_64-loom/shai-build
+++ template_=gt-ignore.sh.XXXX
+++ MAX_TRIES_=4
+++ case $destdir_ in
+++ destdir_slash_=/usr/src/coreutils/x86_64-loom/shai-build/
+++ case $template_ in
++++ unset TMPDIR
+++ d=/usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ
+++ case $d in
+++ :
+++ test -d /usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ
++++ ls -dgo /usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ
+++ perms='drwx------ 2 10 Jul 31 15:23 /usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ'
+++ case $perms in
+++ :
+++ echo /usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ
+++ return
++ test_dir_=/usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ
++ cd /usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ
++ case $srcdir in
++ builddir=..
++ export srcdir builddir
++ gl_init_sh_nl_='
'
++ IFS=' 	
'
++ for sig_ in 1 2 3 13 15
+++ expr 1 + 128
++ eval 'trap '\''Exit 129'\'' 1'
+++ trap 'Exit 129' 1
++ for sig_ in 1 2 3 13 15
+++ expr 2 + 128
++ eval 'trap '\''Exit 130'\'' 2'
+++ trap 'Exit 130' 2
++ for sig_ in 1 2 3 13 15
+++ expr 3 + 128
++ eval 'trap '\''Exit 131'\'' 3'
+++ trap 'Exit 131' 3
++ for sig_ in 1 2 3 13 15
+++ expr 13 + 128
++ eval 'trap '\''Exit 141'\'' 13'
+++ trap 'Exit 141' 13
++ for sig_ in 1 2 3 13 15
+++ expr 15 + 128
++ eval 'trap '\''Exit 143'\'' 15'
+++ trap 'Exit 143' 15
++ trap remove_tmp_ 0
+ path_prepend_ ./src
+ test 1 '!=' 0
+ path_dir_=./src
+ case $path_dir_ in
+ abs_path_dir_=/usr/src/coreutils/x86_64-loom/shai-build/./src
+ case $abs_path_dir_ in
+ PATH=/usr/src/coreutils/x86_64-loom/shai-build/./src:/usr/src/coreutils/x86_64-loom/shai-build/src:/bin:/usr/bin:/sbin:/usr/sbin
+ create_exe_shims_ /usr/src/coreutils/x86_64-loom/shai-build/./src
+ case $EXEEXT in
+ return 0
+ shift
+ test 0 '!=' 0
+ export PATH
+ print_ver_ rmdir
+ require_built_ rmdir
+ skip_=no
+ for i in "$@"
+ case " $built_programs " in
+ test no = yes
+ test yes = yes
+ local i
+ for i in $*
+ env rmdir --version
rmdir (GNU coreutils) 8.32-dirty
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.
++ pwd
+ cwd=/usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ
+ mkdir -p /usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ/a/b/c /usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ/a/x
+ rmdir -p --ignore-fail-on-non-empty /usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ/a/b/c
+ test -d /usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ/a/x
+ test -d /usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ/a/b
+ test -d /usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ/a/b/c
+ mkdir -p x/y
+ chmod a-w x
+ returns_ 1 rmdir --ignore-fail-on-non-empty x/y
+ fail=1
+ test -d x/y
+ fail=1
+ touch x/y/z
touch: cannot touch 'x/y/z': No such file or directory
+ framework_failure_
+ warn_ 'ignore.sh: set-up failure: '
+ case $IFS in
+ printf '%s\n' 'ignore.sh: set-up failure: '
ignore.sh: set-up failure: 
+ test 9 = 2
+ printf '%s\n' 'ignore.sh: set-up failure: '
+ sed 1q
+ Exit 99
+ set +e
+ exit 99
+ exit 99
+ remove_tmp_
+ __st=99
+ cleanup_
+ :
+ test '' = yes
+ cd /usr/src/coreutils/x86_64-loom/shai-build
+ chmod -R u+rwx /usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ
+ rm -rf /usr/src/coreutils/x86_64-loom/shai-build/gt-ignore.sh.HNnQ
+ exit 99
ERROR tests/rmdir/ignore.sh (exit status: 99)




Information forwarded to bug-coreutils <at> gnu.org:
bug#42633; Package coreutils. (Fri, 31 Jul 2020 17:57:01 GMT) Full text and rfc822 format available.

Message #8 received at 42633 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Nick Alcock <nix <at> esperi.org.uk>, 42633 <at> debbugs.gnu.org
Subject: Re: bug#42633: 8.32 make check as root failure of rmdir/ignore.sh
Date: Fri, 31 Jul 2020 19:56:23 +0200
[Message part 1 (text/plain, inline)]
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
[0001-tests-skip-some-parts-of-tests-rmdir-ignore.sh-if-ru.patch (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#42633; Package coreutils. (Fri, 31 Jul 2020 19:44:02 GMT) Full text and rfc822 format available.

Message #11 received at 42633 <at> debbugs.gnu.org (full text, mbox):

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: Re: 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




Information forwarded to bug-coreutils <at> gnu.org:
bug#42633; Package coreutils. (Sat, 01 Aug 2020 14:06:01 GMT) Full text and rfc822 format available.

Message #14 received at 42633 <at> debbugs.gnu.org (full text, mbox):

From: Nick Alcock <nix <at> esperi.org.uk>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 42633 <at> debbugs.gnu.org
Subject: Re: bug#42633: 8.32 make check as root failure of rmdir/ignore.sh
Date: Sat, 01 Aug 2020 15:05:03 +0100
On 31 Jul 2020, Bernhard Voelker spake thusly:

> 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.

This suggests that running make check as root is not a routine part of
coreutils pre-release work, and that nobody has run a make check as root
since Jan 30! That's quite surprising given that running a make check as
root has long been encouraged. The README even says

> If you can run the tests as root, please do so and report any
> problems.  We get much less test coverage in that mode, and it's
> arguably more important that these tools work well when run by
> root than when run by less privileged users.

(This is not the first time I've hit test failures when checking
released coreutils as root, though it isn't *common*.)

> The comment in the test explains that it expects an EPERM error:

*slaps self* so it does, I really should have noticed that.

> The attached patch adds guards around the parts of the test which
> only work as non-privileged user.

Looks good to me, and fixes the bug. make check now passes as root.





Information forwarded to bug-coreutils <at> gnu.org:
bug#42633; Package coreutils. (Mon, 03 Aug 2020 20:08:02 GMT) Full text and rfc822 format available.

Message #17 received at 42633 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>,
 Nick Alcock <nix <at> esperi.org.uk>, 42633 <at> debbugs.gnu.org
Subject: Re: bug#42633: 8.32 make check as root failure of rmdir/ignore.sh
Date: Mon, 3 Aug 2020 22:07:35 +0200
On 2020-07-31 21:42, Pádraig Brady wrote:
> Patch looks good thanks.

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

I thought about that, but as there's a second hunk to be guarded a couple
of lines later, we'd have to remember the result of the test in a variable,
and test for that there.  That's more code, so unless we're getting new
FPs on some platform, I'd go with the standard uid_is_privileged_ function.

Pushing soon ... unless there are objections.
Thanks again - also for testing, Nick.

Have a nice day,
Berny




Reply sent to Bernhard Voelker <mail <at> bernhard-voelker.de>:
You have taken responsibility. (Mon, 10 Aug 2020 20:30:02 GMT) Full text and rfc822 format available.

Notification sent to Nick Alcock <nix <at> esperi.org.uk>:
bug acknowledged by developer. (Mon, 10 Aug 2020 20:30:02 GMT) Full text and rfc822 format available.

Message #22 received at 42633-done <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>,
 Nick Alcock <nix <at> esperi.org.uk>, 42633-done <at> debbugs.gnu.org
Subject: Re: bug#42633: 8.32 make check as root failure of rmdir/ignore.sh
Date: Mon, 10 Aug 2020 22:29:39 +0200
On 2020-08-03 22:07, Bernhard Voelker wrote:
> Pushing soon ... unless there are objections.

Pushed some days ago, and therefore I'm hereby marking this issue as done.

Have a nice day,
Berny




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 08 Sep 2020 11:24:06 GMT) Full text and rfc822 format available.

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

Previous Next


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