Bash test fix for su nobody
Greg Schafer
gschafer at zip.com.au
Wed Aug 8 16:24:52 MDT 2007
Dan Nicholson wrote:
> A while back we changed the bash test suite to run as the nobody user
> because it enables more tests to be run. Ken and I have each had a
> pair of test failures building with 6.3-rc1. Looking closer, the test
> is checking whether `test -r /dev/stdin' and `test -r /dev/fd/0'
> return successfully.
Ahh yes. We had a similar discussion back here:
http://www.diy-linux.org/pipermail/diy-linux-dev/2006-August/000841.html
> These fail because permissions to the backing device (/dev/pts/0 in my
> case) are set up with 620 permissions, owned by dan:tty. This is host
> dependent, but I imagine it will fail more times than not when
> switching to the nobody user to run the test.
>
> One fix is basically to nullify the test by redirecting stdin to
> something that will definitely be readable, e.g. /dev/null. This is
> discussed here:
>
> http://linuxfromscratch.org/pipermail/lfs-dev/2007-August/059866.html
>
> I added a patch later in the thread:
>
> http://linuxfromscratch.org/pipermail/lfs-dev/2007-August/059877.html
Sorry for not commenting earlier but I feel your fix is a little heavy
handed. For something so critical as the shell test suite, ISTM
redirecting stdin for the *whole test suite* could potentially skew
results of other tests (not that I'm any expert on file descriptors). I
think a more conservative approach would be to redirect stdin only for the
test in question ie: `run-test'. I'll probably go with something like this
if it tests out correctly:
sed -i.bak '/THIS_SH/s,$, </dev/tty,' tests/run-test
Regards
Greg
--
http://www.diy-linux.org/
More information about the lfs-dev
mailing list