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

Peter Hutterer peter.hutterer at who-t.net
Mon Jan 3 22:19:06 PST 2011


On Mon, Jan 03, 2011 at 10:28:30PM -0500, Gaetan Nadon wrote:
> 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.

fair enough, leave it in. it is useful after all and I didn't know about the
implications with sudo (I never build with it). just leave it as-is, though
a cleanup patch for changing $1 to $dir would be appreciated.

Cheers,
  Peter
 
> 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
> > > +}
> > 




More information about the xorg-devel mailing list