PLFS coreutils checks (was Re: Updated buildscripts (v2.2.8))

Ryan.Oliver at pha.com.au Ryan.Oliver at pha.com.au
Tue Apr 22 00:40:24 PDT 2003


Ryan Oliver wrote:
> b) proper evaluation of the non-root user having a valid shell during the
>    make check-root fail-2eperms test (maybe check the shell against a
list
> of
>    valid shells, and we can't assume there is an /etc/shells file )
>    Don't know if I like the whoami fix, bashcentric stuff don't cut it
for
>    patches upstream...

Ok, let me hear what you guys think of this,

Here's the original code fragment from tests/rm/fail-2eperms

# Find a username with UID != 0, and a valid shell.
non_root_username=
names=`grep -v '[^:]*:[^:]*:0:' /etc/passwd| sed 's/:.*//'`
for name in $names; do
  su -c ':' $name && { non_root_username=$name; break; }
done
test "x$non_root_username" = x && framework_failure=1

Firstly su -c ':' $name is broken on Solaris

why not use
for name in $names; do
  retname=`su 'id -un' $name
  test "$name" = "$retname" && { non_root_username=$name; break; }
done

at the least its a valid check if the shell is actually a shell, and double
checks that the user reports itself correctly.

Of course wont work on solaris unless you use /usr/xpg4/bin/id.
The coreutils guys would have to sort that one out ;-) (shouldn't be too
hard)

Doesn't affect us though ;-)
Whaddya guys think? (Mind you I'll have to test it when I get home)

Regards
Ryan


-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-dev' in the subject header of the message



More information about the lfs-dev mailing list