[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Username length inconsistencies.



Bernd Eckenfels <lists@lina.inka.de> writes:
> 
> At least if we have Linux Privileges best thing would be not to check for
> root at all, but test for specific permissions (i.e write in the run-time
> dir, or chmod possible or ...).

Right, so in this case the most important criterion is whether the user can
create files owned by arbitrary users. So something like:

if ( touch foo && chown root foo 2>/dev/null ) ; then
	echo good
else
	echo bad
fi

$ if ( touch foo && chown root foo 2>/dev/null ) ; then
>         echo good
> else
>         echo bad
> fi
bad
$ fakeroot
$ if ( touch foo && chown root foo 2>/dev/null ) ; then
>         echo good
> else
>         echo bad
> fi
good

Obpackagingtip: Incidentally I've begun using this in the debian/rules clean
rule:

	test ! -d debian/tmp || test -O debian/tmp || dh_testroot

That way debian/rules clean doesn't need to be run in fakeroot.

greg


--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: