[projects/git-slug: 114/170] Change mktemp in trash script to process number

glen glen at pld-linux.org
Mon Sep 21 21:48:23 CEST 2015


commit 69a8453550be72287085fba5bd5212dcbc2dd759
Author: Kacper Kornet <draenog at pld-linux.org>
Date:   Mon Jun 25 08:19:55 2012 +0100

    Change mktemp in trash script to process number
    
    The trash script used to close close the file in watchdir twice: first
    by mktemp then by redirection and sometimes it confused the slug_watch.
    On the other hand we do not need to be super secure with creating files
    in watchdir, so using the process number to generate file name is
    sufficient and avoids the problem mentioned above. This the same problem
    which was corrected in 3d048a76d7 in another version of trash script.

 adc/trash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/adc/trash b/adc/trash
index 38ed273..596ca37 100755
--- a/adc/trash
+++ b/adc/trash
@@ -24,6 +24,6 @@ echo "Repository removed by $GL_USER" > $repofull/.gitolite.down
 ( echo $GL_USER
   echo $1
   GIT_DIR=$repofull git for-each-ref  --format="%(objectname) $EMPTYSHA1 %(refname)" refs/heads/\*
-  ) > $WATCHDIR/`mktemp $1.XXXXXX`
+  ) > "$WATCHDIR/$1.$$"
 
 mv $repofull $newdir/$ATTIC_SUFFIX
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/git-slug.git/commitdiff/4ed64f73960519a2f4fd04c42950b2c96ae795c5



More information about the pld-cvs-commit mailing list