On Thu, Aug 02, 2007 at 01:49:33PM +1200, Steve Crosby wrote: > On 8/2/07, Ken Moffat <[EMAIL PROTECTED]> wrote: > > On Wed, Aug 01, 2007 at 02:53:59PM -0700, Dan Nicholson wrote: > > > On 7/30/07, Ken Moffat <[EMAIL PROTECTED]> wrote: > > > > > > I got those failures on a single run (using jhalfs). I'm not sure > > > what's causing the errors, but what's failing is `test -r /dev/fd/0' > > > and `test -r /dev/stdin' (look at tests/test.right for the output that > > > it's diffing to above). > > > > > > So, I suspect this has something to do with the su to the nobody user > > > and how su handles these devices. But the last time I thought about > > > this it hurt my head. It may have something even more to do with how > > > our scripts are handling the user switching. > > These files both end up being symlinks to /dev/pts/0 (or whatever pts > device you logged into) - and the perms for this are > > root:~# ls -l /dev/fd/0 > lrwx------ 1 root root 64 2007-08-02 14:30 /dev/fd/0 -> /dev/pts/0 > root:~# ls -l /dev/stdin > lrwxrwxrwx 1 root root 15 2007-08-03 02:22 /dev/stdin -> /proc/self/fd/0 > root:~# ls -l /proc/self/fd/0 > lrwx------ 1 root root 64 2007-08-02 14:30 /proc/self/fd/0 -> /dev/pts/0 > root:~# ls -l /dev/pts/0 > crw--w---- 1 root tty 136, 0 2007-08-02 14:30 /dev/pts/0 > > so the nobody user won't be able to read these devices. Not sure how > you would work around that, unless you use login instead of su to > start the nobody user doing the testing (which will change ownership > of /dev/pts/x and hence the tests will pass) > A little bit of testing (after building to the end of chapter 6 earlier, I've gone back into chroot to play with this). It looks as if chown /dev/stdin *might* work (I'm on an xterm):
root in chroot /# chown nobody /dev/stdin root in chroot /# su-tools nobody -s /bin/bash bash: /dev/null/.bashrc: Not a directory nobody in chroot /$ ls -l /dev/stdin lrwxrwxrwx 1 root root 15 Aug 4 15:51 /dev/stdin -> /proc/self/fd/0 nobody in chroot /$ ls -l /dev/pts total 0 crw--w---- 1 ken tty 136, 0 Aug 4 16:22 0 crw--w---- 1 ken tty 136, 1 Aug 4 16:01 1 crw--w---- 1 ken tty 136, 2 Aug 4 16:30 2 crw--w---- 1 nobody tty 136, 3 Aug 4 16:32 3 crw--w---- 1 ken tty 136, 4 Aug 4 16:30 4 nobody in chroot /$ test -r /dev/stdin ; echo $? 0 nobody in chroot /$ This seems too good to be true. We are running as root, so I guess we can happily continue to read and write to this pts dev after the tests are finished. If nobody pokes a hole in this or beats me to it, I'll start another build, but probably not before tomorrow. ĸen -- das eine Mal als Tragödie, das andere Mal als Farce -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
