[lokisetup] [PATCH] tmp races in makeself

Ludwig Nussel ludwig.nussel at gmx.de
Tue Sep 7 17:53:57 EDT 2004


Stephane Peter wrote:
> OK I just committed the patch to CVS, with some changes using the date 
> (as well as $RANDOM, can't hurt) for the directory being created. I 
> didn't change the mkdir -p because there are cases when the directory 
> may exist and we shouldn't fail. Namely when the user specifies 
> --target.

Then you did not fix the problem. You made it more unlikely but you
did not fix it. You must not use mkdir -p here. What about this
instead:

Index: makeself/makeself-header.sh
===================================================================
RCS file: /cvs/cvsroot/loki_setup/makeself/makeself-header.sh,v
retrieving revision 1.28
diff -u -r1.28 makeself-header.sh
--- makeself/makeself-header.sh	7 Sep 2004 21:05:11 -0000	1.28
+++ makeself/makeself-header.sh	7 Sep 2004 21:51:11 -0000
@@ -301,10 +301,12 @@
     if test "\$keep" = y; then
 	echo "Creating directory \$targetdir" >&2
 	tmpdir="\$targetdir"
+	dashp="-p"
     else
 	tmpdir="\$TMPROOT/selfgz\$\$\$RANDOM"
+	dashp=""
     fi
-    mkdir -p \$tmpdir || {
+    mkdir \$dashp \$tmpdir || {
 	echo 'Cannot create target directory' \$tmpdir >&2
 	echo 'You should try option --target OtherDirectory' >&2
 	eval \$finish

cu
Ludwig

-- 
(o_  Ludwig.Nussel at gmx.de
//\  PGP Key ID: FF8135CE
V_/_ ICQ:        52166811
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://icculus.org/pipermail/lokisetup/attachments/20040907/dfad322e/attachment.pgp>


More information about the Lokisetup mailing list