Subject: Re: bug#12041: Issues running the testsuite as root

From: Dennis Clarke <[email-masked]>
Date: Wed, 25 Jul 2012 08:33:03 -0400

> The attached patch should solve the issue.  Could you give it a try?

Let's see if I applied that correctly : 

$ diff t/primary-prefix-couples-force-valid.sh_backup t/primary-prefix-couples-force-valid.sh
57c57,62
<       test ! -x '$(libexecdir)/bar.h'
---
> ## If this test is run as root, "test -x" could suceed also for
> ## non-executable files, so we need to protect the next check.
> ## See automake bug#12041.
>       if test -x Makefile; then echo SKIP THIS; else \
>         test ! -x '$(libexecdir)/bar.h'; \
>       fi;
$ 

looks good. 

If I su - then run the test I now see : 

bash-3.2# 
bash-3.2# id 
uid=0(root) gid=0(root) groups=1(other),2(bin),3(sys),4(adm),5(uucp),6(mail),7(tty),8(lp),9(nuucp),12(daemon)
bash-3.2# make check TESTS=t/primary-prefix-couples-force-valid AM_MAKEFLAGS='TESTS="$(TESTS)"'
make TESTS="t/primary-prefix-couples-force-valid" t/wrap/aclocal-1.12 t/wrap/automake-1.12 t/ax/test-init.sh   t/ax/plain-functions.sh   t/ax/tap-functions.sh \
  defs-static
`t/wrap/aclocal-1.12' is up to date.
`t/wrap/automake-1.12' is up to date.
`t/ax/test-init.sh' is up to date.
`t/ax/plain-functions.sh' is up to date.
`t/ax/tap-functions.sh' is up to date.
`defs-static' is up to date.
make TESTS="t/primary-prefix-couples-force-valid" check-TESTS check-local
PASS: t/primary-prefix-couples-force-valid.sh
============================================================================
Testsuite summary for GNU Automake 1.12.2
============================================================================
# TOTAL: 1
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
bash-3.2# 

So that seems to fix that. 

However I am fairly certian that all files are not executable from the perspective
of the root user. That seems absurd. 

bash-3.2# id
uid=0(root) gid=0(root) groups=1(other),2(bin),3(sys),4(adm),5(uucp),6(mail),7(tty),8(lp),9(nuucp),12(daemon)

bash-3.2# ls -lap 
total 37
drwxr-xr-x   2 root     sys            7 Jul 25 12:29 ./
drwxr-xr-x  25 root     root          26 Jul 14 01:46 ../
-rwxr-xr-x   1 root     root          55 Jul 25 12:29 look.sh
-rwx------   1 root     root        1990 Jul 25 12:27 set.sh
-rwxr-xr-x   1 root     root        8600 Jul 25 12:27 x
-rw-r--r--   1 root     root         172 Jul 25 12:24 x.c
-rw-r--r--   1 root     root         285 Jul 25 12:25 y.c
bash-3.2# 
bash-3.2# cat look.sh
#!/bin/ksh

if test -x x.c; then
    echo "ta da"
fi 

bash-3.2# 
bash-3.2# ./look.sh 
bash-3.2# 

bash-3.2# vi thus.sh
#!/bin/ksh

if test -x look.sh; then
    echo "executable bit seen"
fi 

~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"thus.sh" [New file]

bash-3.2# chmod 755 thus.sh 
bash-3.2# ./thus.sh 
executable bit seen

Dennis