bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

coreutils-5.92 - tests/cp/fail-perm fails when run as root


From: Theodoros V. Kalamatianos
Subject: coreutils-5.92 - tests/cp/fail-perm fails when run as root
Date: Sat, 29 Oct 2005 19:53:43 +0300 (EEST)

Hi,

I have built coreutils-5.92 on my system (Linux-2.6.11.6/i686, glibc-2.3.3CVS) and was testing the build when I came up with a failed test for tests/cp/fail-perm. The testsuite is run as root. When run as a non-privileged user the test succeeds. Bellow is the log from a run:

# env DEBUG=yes VERBOSE=yes make check -C tests/cp TESTS=fail-perm > log 2>&1


make: Entering directory `/usr/src/RPM/BUILD/coreutils-5.92/tests/cp'
make  check-TESTS
make[1]: Entering directory `/usr/src/RPM/BUILD/coreutils-5.92/tests/cp'
+ cp --version
cp (GNU coreutils) 5.92
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.
+ PRIV_CHECK_ARG=require-non-root
+ . ./../priv-check
++ case "$PRIV_CHECK_ARG" in
++ who='by an unprivileged user'
+++ id -u
++ my_uid=0
++ test 0 = 0
++ case $my_uid in
++ test 0 = 0
++ : nobody
+++ id -u nobody
++ coreutils_non_root_uid=65534
++ test 0 = 0
++ test 65534 = 0
++ give_msg=no
++ case $PRIV_CHECK_ARG:$my_uid in
++ setuidgid nobody test -w .
++ exec setuidgid nobody env 
PATH=/usr/src/RPM/BUILD/coreutils-5.92/tests/cp/../../src:/usr/java/j2sdk1.4.2_09/bin/:/root/.ccache:/root/.ccache:/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/root/.ccache:/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/java/j2sdk1.4.2_09/bin/:/root/.ccache:/usr/ucb:/bin:/usr/bin:/etc:/usr/X11R6/bin:/fs/ring/reactor/scripts:/fs/ring/reactor/programs:/root/bin:/usr/share/pvm3/:/fs/ring/reactor/scripts:/fs/ring/reactor/programs:/root/bin:/usr/share/pvm3/
 ./fail-perm
+ cp --version
cp (GNU coreutils) 5.92
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.
+ PRIV_CHECK_ARG=require-non-root
+ . ./../priv-check
++ case "$PRIV_CHECK_ARG" in
++ who='by an unprivileged user'
+++ id -u
++ my_uid=65534
++ test 0 = 0
++ case $my_uid in
++ test 65534 = 0
++ give_msg=no
++ case $PRIV_CHECK_ARG:$my_uid in
++ test no = yes
++ pwd
+ pwd=/usr/src/RPM/BUILD/coreutils-5.92/tests/cp
++ echo ./fail-perm
++ sed 's,.*/,,'
+ t0=fail-perm.tmp
+ tmp=fail-perm.tmp/9685
+ trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+ trap '(exit $?); exit' 1 2 13 15
+ framework_failure=0
+ mkdir -p fail-perm.tmp/9685
+ cd fail-perm.tmp/9685
+ mkdir D D/D
+ touch D/a
touch: setting times of `D/a': Permission denied
+ framework_failure=1
+ chmod 0 D/a
+ chmod 500 D
+ test 1 = 1
+ echo 'failure in testing framework'
failure in testing framework
+ exit 1
+ status=1
+ cd /usr/src/RPM/BUILD/coreutils-5.92/tests/cp
+ chmod -R u+rwx fail-perm.tmp
+ rm -rf fail-perm.tmp
+ exit 1
FAIL: fail-perm
======================================
1 of 1 tests failed
Please report to address@hidden
======================================
make[1]: *** [check-TESTS] Error 1
make[1]: Leaving directory `/usr/src/RPM/BUILD/coreutils-5.92/tests/cp'
make: *** [check-am] Error 2
make: Leaving directory `/usr/src/RPM/BUILD/coreutils-5.92/tests/cp'


I modified the test a bit to add ls -alR commands before and after the touch command and to run touch under strace. I got the following:


make: Entering directory `/usr/src/RPM/BUILD/coreutils-5.92/tests/cp'
make  check-TESTS
make[1]: Entering directory `/usr/src/RPM/BUILD/coreutils-5.92/tests/cp'
+ cp --version
cp (GNU coreutils) 5.92
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.
+ PRIV_CHECK_ARG=require-non-root
+ . ./../priv-check
++ case "$PRIV_CHECK_ARG" in
++ who='by an unprivileged user'
+++ id -u
++ my_uid=0
++ test 0 = 0
++ case $my_uid in
++ test 0 = 0
++ : nobody
+++ id -u nobody
++ coreutils_non_root_uid=65534
++ test 0 = 0
++ test 65534 = 0
++ give_msg=no
++ case $PRIV_CHECK_ARG:$my_uid in
++ setuidgid nobody test -w .
++ exec setuidgid nobody env 
PATH=/usr/src/RPM/BUILD/coreutils-5.92/tests/cp/../../src:/usr/java/j2sdk1.4.2_09/bin/:/root/.ccache:/root/.ccache:/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/root/.ccache:/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/java/j2sdk1.4.2_09/bin/:/root/.ccache:/usr/ucb:/bin:/usr/bin:/etc:/usr/X11R6/bin:/fs/ring/reactor/scripts:/fs/ring/reactor/programs:/root/bin:/usr/share/pvm3/:/fs/ring/reactor/scripts:/fs/ring/reactor/programs:/root/bin:/usr/share/pvm3/
 ./fail-perm
+ cp --version
cp (GNU coreutils) 5.92
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.
+ PRIV_CHECK_ARG=require-non-root
+ . ./../priv-check
++ case "$PRIV_CHECK_ARG" in
++ who='by an unprivileged user'
+++ id -u
++ my_uid=65534
++ test 0 = 0
++ case $my_uid in
++ test 65534 = 0
++ give_msg=no
++ case $PRIV_CHECK_ARG:$my_uid in
++ test no = yes
++ pwd
+ pwd=/usr/src/RPM/BUILD/coreutils-5.92/tests/cp
++ echo ./fail-perm
++ sed 's,.*/,,'
+ t0=fail-perm.tmp
+ tmp=fail-perm.tmp/10103
+ trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+ trap '(exit $?); exit' 1 2 13 15
+ framework_failure=0
+ mkdir -p fail-perm.tmp/10103
+ cd fail-perm.tmp/10103
+ mkdir D D/D
+ ls -alR
.:
total 3
drwxr-xr-x 3 nobody nogroup 1024 Oct 29 19:28 .
drwxr-xr-x 3 nobody nogroup 1024 Oct 29 19:28 ..
drwxr-xr-x 3 nobody nogroup 1024 Oct 29 19:28 D

./D:
total 3
drwxr-xr-x 3 nobody nogroup 1024 Oct 29 19:28 .
drwxr-xr-x 3 nobody nogroup 1024 Oct 29 19:28 ..
drwxr-xr-x 2 nobody nogroup 1024 Oct 29 19:28 D

./D/D:
total 2
drwxr-xr-x 2 nobody nogroup 1024 Oct 29 19:28 .
drwxr-xr-x 3 nobody nogroup 1024 Oct 29 19:28 ..
+ strace touch D/a
execve("/usr/src/RPM/BUILD/coreutils-5.92/tests/cp/../../src/touch", ["touch", 
"D/a"], [/* 61 vars */]) = 0
uname({sys="Linux", node="rhama.deepcore.ngn", ...}) = 0
brk(0)                                  = 0x8053000
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7fe9000
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=146190, ...}) = 0
old_mmap(NULL, 146190, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7fc5000
close(4)                                = 0
open("/lib/tls/librt.so.1", O_RDONLY)   = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\200\36"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0755, st_size=31236, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7fc4000
old_mmap(NULL, 78392, PROT_READ|PROT_EXEC, MAP_PRIVATE, 4, 0) = 0xb7fb0000
old_mmap(0xb7fb8000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 4, 
0x7000) = 0xb7fb8000
old_mmap(0xb7fb9000, 41528, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7fb9000
close(4)                                = 0
open("/lib/tls/libc.so.6", O_RDONLY)    = 4
read(4, "address@hidden"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0755, st_size=1334740, ...}) = 0
old_mmap(NULL, 1340908, PROT_READ|PROT_EXEC, MAP_PRIVATE, 4, 0) = 0xb7e68000
old_mmap(0xb7faa000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 4, 
0x142000) = 0xb7faa000
old_mmap(0xb7fad000, 9708, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7fad000
close(4)                                = 0
open("/lib/tls/libpthread.so.0", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340F\0"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0755, st_size=80031, ...}) = 0
old_mmap(NULL, 62436, PROT_READ|PROT_EXEC, MAP_PRIVATE, 4, 0) = 0xb7e58000
old_mmap(0xb7e65000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 4, 
0xd000) = 0xb7e65000
old_mmap(0xb7e66000, 5092, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7e66000
close(4)                                = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7e57000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7e57080, limit:1048575, 
seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, 
useable:1}) = 0
munmap(0xb7fc5000, 146190)              = 0
set_tid_address(0xb7e570c8)             = 10121
rt_sigaction(SIGRTMIN, {0xb7e5c650, [], SA_RESTORER|SA_SIGINFO, 0xb7e63210}, 
NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
open("/usr/share/locale/locale-archive", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No 
such file or directory)
brk(0)                                  = 0x8053000
brk(0x8074000)                          = 0x8074000
brk(0)                                  = 0x8074000
open("/usr/share/locale/locale.alias", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=2586, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7fe8000
read(4, "# Locale name alias data base.\n#"..., 4096) = 2586
read(4, "", 4096)                       = 0
close(4)                                = 0
munmap(0xb7fe8000, 4096)                = 0
open("/usr/share/locale/el_GR/LC_IDENTIFICATION", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=336, ...}) = 0
mmap2(NULL, 336, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7fe8000
close(4)                                = 0
open("/usr/share/locale/el_GR/LC_MEASUREMENT", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=28, ...}) = 0
mmap2(NULL, 28, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7fe7000
close(4)                                = 0
open("/usr/share/locale/el_GR/LC_TELEPHONE", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=54, ...}) = 0
mmap2(NULL, 54, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7fe6000
close(4)                                = 0
open("/usr/share/locale/el_GR/LC_ADDRESS", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=132, ...}) = 0
mmap2(NULL, 132, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7fe5000
close(4)                                = 0
open("/usr/share/locale/el_GR/LC_NAME", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=67, ...}) = 0
mmap2(NULL, 67, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7fe4000
close(4)                                = 0
open("/usr/share/locale/el_GR/LC_PAPER", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=39, ...}) = 0
mmap2(NULL, 39, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7fe3000
close(4)                                = 0
open("/usr/share/locale/en_US/LC_MESSAGES", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0
close(4)                                = 0
open("/usr/share/locale/en_US/LC_MESSAGES/SYS_LC_MESSAGES", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=57, ...}) = 0
mmap2(NULL, 57, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7fe2000
close(4)                                = 0
open("/usr/share/locale/el_GR/LC_MONETARY", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=295, ...}) = 0
mmap2(NULL, 295, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7fe1000
close(4)                                = 0
open("/usr/share/locale/en_US/LC_COLLATE", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=21499, ...}) = 0
mmap2(NULL, 21499, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7fdb000
close(4)                                = 0
open("/usr/share/locale/en_US/LC_TIME", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=2456, ...}) = 0
mmap2(NULL, 2456, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7fda000
close(4)                                = 0
open("/usr/share/locale/el_GR/LC_NUMERIC", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=59, ...}) = 0
mmap2(NULL, 59, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7fd9000
close(4)                                = 0
open("/usr/share/locale/el_GR/LC_CTYPE", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=178804, ...}) = 0
mmap2(NULL, 178804, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7e2b000
close(4)                                = 0
close(0)                                = 0
open("D/a", O_WRONLY|O_NONBLOCK|O_CREAT|O_NOCTTY, 0666) = 0
utimes("/proc/self/fd/0", NULL)         = -1 EACCES (Permission denied)
close(0)                                = 0
open("/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT 
(No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No 
such file or directory)
write(2, "touch: ", 7touch: )                  = 7
write(2, "setting times of `D/a\'", 22setting times of `D/a') = 22
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No 
such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such 
file or directory)
write(2, ": Permission denied", 19: Permission denied)     = 19
write(2, "\n", 1
)                       = 1
close(1)                                = 0
exit_group(1)                           = ?
+ ls -alR
.:
total 3
drwxr-xr-x 3 nobody nogroup 1024 Oct 29 19:28 .
drwxr-xr-x 3 nobody nogroup 1024 Oct 29 19:28 ..
drwxr-xr-x 3 nobody nogroup 1024 Oct 29 19:28 D

./D:
total 3
drwxr-xr-x 3 nobody nogroup 1024 Oct 29 19:28 .
drwxr-xr-x 3 nobody nogroup 1024 Oct 29 19:28 ..
-rw-r--r-- 1 nobody nogroup    0 Oct 29 19:28 a
drwxr-xr-x 2 nobody nogroup 1024 Oct 29 19:28 D

./D/D:
total 2
drwxr-xr-x 2 nobody nogroup 1024 Oct 29 19:28 .
drwxr-xr-x 3 nobody nogroup 1024 Oct 29 19:28 ..
+ chmod 0 D/a
+ chmod 500 D
+ test 0 = 1
+ fail=0
+ cp -pR D DD
++ ls -ld DD
+ set X dr-x------ 3 nobody nogroup 1024 Oct 29 19:28 DD
+ shift
+ test dr-x------ = dr-x------
+ chmod 0 D
+ ln -s D/D symlink
+ touch F
touch: setting times of `F': Permission denied
+ cat
+ cp F symlink
+ cmp out exp
+ cp --target-directory=symlink F
+ cmp out exp
+ chmod 700 D
+ exit 0
+ exit 0
+ status=0
+ cd /usr/src/RPM/BUILD/coreutils-5.92/tests/cp
+ chmod -R u+rwx fail-perm.tmp
+ rm -rf fail-perm.tmp
+ exit 0
PASS: fail-perm
==================
All 1 tests passed
==================
make[1]: Leaving directory `/usr/src/RPM/BUILD/coreutils-5.92/tests/cp'
make: Leaving directory `/usr/src/RPM/BUILD/coreutils-5.92/tests/cp'


I must be really missing something, because I have yet to detect why exactly the test is failing. I look forward to any comments...


Regards,

Theodoros Kalamatianos


PS: Please CC any answers to me, if its possible, because I am not subscribed to the bug-coreutils list.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]