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

Re: [SRM] devscripts update (#507482)



On Fri, 2009-01-09 at 15:31 +0000, Adam D. Barratt wrote:
> 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?
[...]
> 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.

One (hopefully) last diff, incorporating the quoting; sorry for not
getting it right the first time. (The lenny version already starts in a
temporary directory and creates relative names using mktemp -d, so
should be ok "as-is").

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-10 10:23:20.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: