NetBSD-Bugs archive

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

Re: misc/40758: send-pr(.sh) creates lock-files even when unneeded and forgets to remove them



I filed this PR 15 years ago and send-pr in 10.0 still has the same
issue.  I suggest the following patch to fix the issue.

---
 external/gpl2/send-pr/dist/send-pr/send-pr.sh | 25 ++++++++++---------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/external/gpl2/send-pr/dist/send-pr/send-pr.sh
b/external/gpl2/send-pr/dist/send-pr/send-pr.sh
index 659bfed2f99..512f68cdcf3 100755
--- a/external/gpl2/send-pr/dist/send-pr/send-pr.sh
+++ b/external/gpl2/send-pr/dist/send-pr/send-pr.sh
@@ -74,18 +74,6 @@ fi

 #

-if [ -z "$TMPDIR" ]; then
-  TMPDIR=/tmp
-else
-  if [ "`echo $TMPDIR | grep '/$'`" != "" ]; then
-    TMPDIR="`echo $TMPDIR | sed -e 's,/$,,'`"
-  fi
-fi
-
-TEMP=`mktemp -t p` || exit 1
-BAD=`mktemp -t pbad` || exit 1
-REF=`mktemp -t pf` || exit 1
-
 # find a user name
 if [ "$LOGNAME" = "" ]; then
 	if [ "$USER" != "" ]; then
@@ -270,6 +258,19 @@ DESCRIPTION_C='<precise description of the
problem (multiple lines)>'
 HOW_TO_REPEAT_C='<code/input/activities to reproduce the problem
(multiple lines)>'
 FIX_C='<how to correct or work around the problem, if known (multiple lines)>'

+# Safely create temporary files.
+if [ -z "$TMPDIR" ]; then
+  TMPDIR=/tmp
+else
+  if [ "`echo $TMPDIR | grep '/$'`" != "" ]; then
+    TMPDIR="`echo $TMPDIR | sed -e 's,/$,,'`"
+  fi
+fi
+
+TEMP=`mktemp -t p` || exit 1
+BAD=`mktemp -t pbad` || exit 1
+REF=`mktemp -t pf` || exit 1
+
 # Catch some signals. ($xs kludge needed by Sun /bin/sh)
 xs=0
 TRAP_EXIT_ACTION='rm -f $REF $TEMP; exit $xs'
-- 


Thanks,
-- 
Malte Dehling



Home | Main Index | Thread Index | Old Index