[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [SRM] devscripts update (#507482)



On Fri, 2009-01-09 at 15:07 +0000, Adam D. Barratt wrote:
> On Fri, 2009-01-09 at 10:18 +0100, Philipp Kern wrote:
[...]
> > Would be acceptable,
> 
> Thanks.
> 
> > but I wonder if the usage of $TEMP_DIR after cd and rm should be quoted?
> 
> Quoting shouldn't be required around the variable, as the output of
> mktemp should be sane; I'm happy to add quoting if you'd prefer,
> however. (To be honest, I don't think any of the quoting around the
> mktemp call itself is actually required, I just tend to apply
> belt-and-braces).

Whilst looking at the lenny patch, I spotted a couple of issues which
made the original patch produce error messages which weren't as useful
as they could be. The changes are fairly trivial (disabling the trap at
the top of cleanup_tmpdir() and including the full path in the message
[which is actually just a removal of part of my original patch]); I've
attached an updated debdiff.

Regards,

Adam
diff -adNru devscripts-2.9.26etch1/debsign.sh devscripts-2.9.26etch2/debsign.sh
--- devscripts-2.9.26etch1/debsign.sh	2008-12-08 18:11:35.000000000 +0000
+++ devscripts-2.9.26etch2/debsign.sh	2009-01-09 15:27:48.000000000 +0000
@@ -40,6 +40,7 @@
 PRECIOUS_FILES=0
 PROGNAME=`basename $0`
 MODIFIED_CONF_MSG='Default settings modified by devscripts configuration files:'
+TEMP_DIR=
 
 # --- Functions
 
@@ -84,10 +85,11 @@
 }
 
 cleanup_tmpdir () {
+    trap 0
     if [ "$PRECIOUS_FILES" -gt 0 ]; then
         echo "$PROGNAME: aborting with $PRECIOUS_FILES signed files in `pwd`" >&2
     else
-        cd ..; rm -rf debsign.$$
+        cd ..; rm -rf $TEMP_DIR
     fi
 }
 
@@ -384,9 +386,9 @@
 # Do we have to download the changes file?
 if [ -n "$remotehost" ]
 then
-    mkdir debsign.$$ || { echo "$PROGNAME: Can't mkdir!" >&2; exit 1; }
+    TEMP_DIR="$(mktemp -dt "debsign.XXXXXXX")" || { echo "$PROGNAME: Can't make temporary dir!" >&2; exit 1; }
     trap "cleanup_tmpdir" 0 1 2 3 7 10 13 15
-    cd debsign.$$
+    cd $TEMP_DIR
 
     remotechanges=$changes
     remotedsc=$dsc

Reply to: