<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.26.0">
</HEAD>
<BODY>
On Tue, 2011-01-04 at 09:42 +1000, Peter Hutterer wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
<TT><FONT COLOR="#737373">> +check_writable_dir () {</FONT></TT><BR>
<TT><FONT COLOR="#737373">> + if [ X"$SUDO" = X ]; then</FONT></TT><BR>
<BR>
<TT><FONT COLOR="#1a1a1a">skip this check, just because it's sudo doesn't mean you can write to</FONT></TT><BR>
<TT><FONT COLOR="#1a1a1a">the directory.</FONT></TT><BR>
</BLOCKQUOTE>
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.<BR>
<BR>
With the (not fool proof) test for sudo, running:
<BLOCKQUOTE>
<PRE>
$SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH ${MAKE} $MAKEFLAGS install
</PRE>
</BLOCKQUOTE>
will fail if the user does not have write permission. This is what we have today, no early detection.<BR>
<BR>
Either I accept that early detection is not always possible, or I remove the function all together. <BR>
<BLOCKQUOTE TYPE=CITE>
<BR>
<TT><FONT COLOR="#1a1a1a">also, for readability, you may want to add a line of </FONT></TT><BR>
<TT><FONT COLOR="#1a1a1a">dir="$1"</FONT></TT><BR>
<BR>
<TT><FONT COLOR="#1a1a1a">and then use $dir instead of $1 in the remainder.</FONT></TT><BR>
<BR>
</BLOCKQUOTE>
Agreed<BR>
<BLOCKQUOTE TYPE=CITE>
<TT><FONT COLOR="#1a1a1a">Cheers,</FONT></TT><BR>
<TT><FONT COLOR="#1a1a1a"> Peter</FONT></TT><BR>
<BR>
<TT><FONT COLOR="#737373">> + if [ ! -d "$1" ] || [ ! -w "$1" ]; then</FONT></TT><BR>
<TT><FONT COLOR="#737373">> + echo "The path \"$1\" supplied by \"$2\" must be a writable directory"</FONT></TT><BR>
<TT><FONT COLOR="#737373">> + echo ""</FONT></TT><BR>
<TT><FONT COLOR="#737373">> + usage</FONT></TT><BR>
<TT><FONT COLOR="#737373">> + exit 1</FONT></TT><BR>
<TT><FONT COLOR="#737373">> + fi</FONT></TT><BR>
<TT><FONT COLOR="#737373">> + fi</FONT></TT><BR>
<TT><FONT COLOR="#737373">> +}</FONT></TT><BR>
<BR>
</BLOCKQUOTE>
</BODY>
</HTML>