On 8/4/07, Bryan Kadzban <[EMAIL PROTECTED]> wrote:
> (Replying via mutt since the PSU in my main machine (the one that has
> Thunderbird installed) died last night: the RMA is in progress, but
> it'll be a few days...)
>
> On Sat, Aug 04, 2007 at 04:42:51PM +0100, Ken Moffat wrote:
> > > 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.
>
> Seems like it should work to me.  There is one thing we might want to be
> careful of:  We may not want to allow some random host user to access the
> pseudo-term device after the tests are done.  However, this is a
> separate devpts mount from the host's /dev/pts, so I'm not sure if the
> devices are accessible from the host.

I believe I found a way to "fix" the error which doesn't require
changing the permissions of the host's pseudo-terms: tie stdin to
/dev/null when running the tests. Basically, this prevents the stdin
test from doing anything useful. If you look closely, though, the
stdout and stderr tests aren't doing anything either, though, because
they've been tied to a log file. So, I say we just go all the way and
make the terminal tests useless (especially since we're running them
through su, which is probably not the intended way).

su-tools nobody -s /bin/bash -c "make tests" </dev/null

Here's the diff of the test logs before and after adding </dev/null.
It looks like no other tests are affected.

# diff -pu test.log.1 test.log.2
--- test.log.1  2007-08-04 09:21:10.000000000 -0700
+++ test.log.2  2007-08-04 09:26:12.000000000 -0700
@@ -119,14 +119,6 @@ run-set-x
 run-shopt
 run-strip
 run-test
-152c152
-< 1
----
-> 0
-158c158
-< 1
----
-> 0
 run-tilde
 run-tilde2
 run-trap

--
Dan
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to