bugQuilt - Bugs: bug #21309, patchfns.in: gen_tempfile() -- Fix...

 
 

bug #21309: patchfns.in: gen_tempfile() -- Fix path generation under Cygwin

Submitted by:  Jari Aalto <jaalto>
Submitted on:  Wed 10 Oct 2007 07:11:50 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 17 Jun 2009 11:44:54 AM UTC, comment #1:

Is this okay as well? (I'm committing this assuming that it is.)

--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -841,12 +841,11 @@ in_array()

gen_tempfile()
{
- local name
if [ "$1" = -d ]
then
- mktemp -d ${2:-${TMPDIR:-/tmp}/${0// /_}}.XXXXXX
+ mktemp -d ${2:-${TMPDIR:-/tmp}}/quilt.XXXXXX
else
- mktemp ${1:-${TMPDIR:-/tmp}/${0// /_}}.XXXXXX
+ mktemp ${1:-${TMPDIR:-/tmp}}/quilt.XXXXXX
fi
}

Andreas Gruenbacher <agruen>
Project Administrator
Wed 10 Oct 2007 07:11:50 AM UTC, original submission:

PROBLEM
-------

The code in gen_tempfile() does not consider that $0 may contain
absolute path component.

The following patch fixes it.

ERROR MESSAGE UNDER CYGWIN
---------------------------

QUILT_DIR=/usr/share/quilt QUILT_LIB=/usr/lib/quilt bash -x /usr/share/quilt/annotate test

/usr/share/quilt/annotate
146
147 template=$(gen_tempfile)
148
149 trap "rm -f $template" EXIT

++ mktemp /tmp//usr/share/quilt/annotate.XXXXXX
mktemp: cannot create temp file /tmp//usr/share/quilt/annotate.mS2300: No such file or directory

PATCH
------

quilt/scripts/patchfns.in | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
index f6407b4..9d77dd2 100644
--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -841,12 +841,19 @@ in_array()

gen_tempfile()
{
- local name
+ local name=${0// /_}
+ name=${name##*/} # Remove path components
+
+ local dir
+
if [ "$1" = -d ]
then
- mktemp -d ${2:-${TMPDIR:-/tmp}/${0// /_}}.XXXXXX
+ dir=${2:-${TMPDIR:-/tmp}}
+ mktemp -d $dir/$name.XXXXXX
else
- mktemp ${1:-${TMPDIR:-/tmp}/${0// /_}}.XXXXXX
+ dir=${1:-${TMPDIR:-/tmp}}
+ mktemp -d $dir/$name.XXXXXX
+
fi
}

Jari Aalto <jaalto>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by agruen (Posted a comment)
  • -unavailable- added by jaalto (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 17 Jun 2009 11:44:54 AM UTCagruenStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1