[PATCH modular 14/14] build.sh: verify PREFIX is a directory and is writable

Gaetan Nadon memsize at videotron.ca
Mon Jan 3 19:28:30 PST 2011


On Tue, 2011-01-04 at 09:42 +1000, Peter Hutterer wrote:

> > +check_writable_dir () {
> > +    if [ X"$SUDO" = X ]; then
> 
> skip this check, just because it's sudo doesn't mean you can write to
> the directory.

On the other hand, without this test, a user running build.sh with -s
<sudo> will always erroneously have the error message if he has write
permission only with sudo. The script aborts and there is no workaround.

With the (not fool proof) test for sudo, running:

        $SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH ${MAKE} $MAKEFLAGS install

will fail if the user does not have write permission. This is what we
have today, no early detection.

Either I accept that early detection is not always possible, or I remove
the function all together. 

> 
> also, for readability, you may want to add a line of 
> dir="$1"
> 
> and then use $dir instead of $1 in the remainder.
> 

Agreed

> Cheers,
>   Peter
> 
> > +     if [ ! -d "$1" ] || [ ! -w "$1" ]; then
> > +         echo "The path \"$1\" supplied by \"$2\" must be a
> writable directory"
> > +         echo ""
> > +         usage
> > +         exit 1
> > +     fi
> > +    fi
> > +}
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110103/b85166eb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110103/b85166eb/attachment.pgp>


More information about the xorg-devel mailing list