emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#15425: closed (mktemp - conflicting options affect


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#15425: closed (mktemp - conflicting options affected by ENV)
Date: Sat, 21 Sep 2013 02:45:02 +0000

Your message dated Sat, 21 Sep 2013 03:44:05 +0100
with message-id <address@hidden>
and subject line Re: bug#15425: mktemp - conflicting options affected by ENV
has caused the debbugs.gnu.org bug report #15425,
regarding mktemp - conflicting options affected by ENV
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
15425: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15425
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: mktemp - conflicting options affected by ENV Date: Fri, 20 Sep 2013 10:50:25 -0600 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130821 Icedove/17.0.8
Hello,

Not sure if this is a bug or just unintended side-effect, but it caused some 
scripts here to fail and took a while to troubleshoot:
It basically boils down to the interplay between the deprecated "-t" "-p" and "$TMPDIR" 
and "--tmpdir".

===
##
## Problem 1: "-t" and TMPDIR (if non-empty) overrides "--tmpdir"
##
$ TMPDIR= mktemp -u --tmpdir=. -t XXXXXX
./og9G5s
$ TMPDIR=/foo/ mktemp -u --tmpdir=. -t XXXXXX
/foo/AAWcOl

##
## Problem 2: if TMPDIR is empty, "--tmpdir" overrides "-p", despite having "-t"
##
$ TMPDIR=/foo/ mktemp -u -p /bar/ --tmpdir=. -t XXXXXX
/foo/tHXcrq
$ TMPDIR= mktemp -u -p /bar/ --tmpdir=. -t XXXXXX
./OfWXSS
## I'd expect the above to use "/bar/OfWXSS", to be consistent with TMPDIR overriding 
"--tmpdir".
===

I realize "-t" and "-p" are deprecated, and it's best not to meddle with them -
but for consistency, perhaps consider having the new "--tmpdir" always take precedence over 
"-t" and "-p" ?
or print a warning to STDERR when "-t" and "--tmpdir" are mixed?

Regards,
 -gordon




--- End Message ---
--- Begin Message --- Subject: Re: bug#15425: mktemp - conflicting options affected by ENV Date: Sat, 21 Sep 2013 03:44:05 +0100 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2
On 09/21/2013 01:40 AM, Pádraig Brady wrote:
> On 09/21/2013 01:14 AM, Pádraig Brady wrote:
>> On 09/20/2013 05:50 PM, Assaf Gordon wrote:
>>> Hello,
>>>
>>> Not sure if this is a bug or just unintended side-effect, but it caused 
>>> some scripts here to fail and took a while to troubleshoot:
>>> It basically boils down to the interplay between the deprecated "-t" "-p" 
>>> and "$TMPDIR" and "--tmpdir".
>>>
>>> ===
>>> ##
>>> ## Problem 1: "-t" and TMPDIR (if non-empty) overrides "--tmpdir"
>>> ##
>>> $ TMPDIR= mktemp -u --tmpdir=. -t XXXXXX
>>> ./og9G5s
>>> $ TMPDIR=/foo/ mktemp -u --tmpdir=. -t XXXXXX
>>> /foo/AAWcOl
>>
>> Yes this is confusing, and _not_ order dependent:
>>
>> $ TMPDIR=/foo/ mktemp -t -u --tmpdir=. XXXXXX
>> /foo/AAWcOl
>>
>>>
>>> ##
>>> ## Problem 2: if TMPDIR is empty, "--tmpdir" overrides "-p", despite having 
>>> "-t"
>>> ##
>>> $ TMPDIR=/foo/ mktemp -u -p /bar/ --tmpdir=. -t XXXXXX
>>> /foo/tHXcrq
>>> $ TMPDIR= mktemp -u -p /bar/ --tmpdir=. -t XXXXXX
>>> ./OfWXSS
>>> ## I'd expect the above to use "/bar/OfWXSS", to be consistent with TMPDIR 
>>> overriding "--tmpdir".
>>> ===
>>
>> Also confusing, and order dependent too:
>>
>> $ mktemp -p /aaa -u --tmpdir=. asdf/XXXX
>> ./asdf/wdIT
>> $ mktemp -u --tmpdir=. -p /aaa asdf/XXXX
>> /aaa/asdf/3Jc7
>>
>>> I realize "-t" and "-p" are deprecated, and it's best not to meddle with 
>>> them -
>>> but for consistency, perhaps consider having the new "--tmpdir" always take 
>>> precedence over "-t" and "-p" ?
>>> or print a warning to STDERR when "-t" and "--tmpdir" are mixed?
>>
>> Yes I agree that --tmpdir should override -pt no matter what the order.
>> In fact there is no reason to use -pt with --tmpdir and since the former
>> are deprecated, I suggest we just disallow that combination with an error.
>>
>> Patch coming up.
> 
> I also see the --help says that -p implies -t
> AFAICS -t in the context of -p just means to interpret template as a single 
> file without dirs,
> however the example below shows that -t is not in fact implied with -p
> 
> $ mktemp -u -p dir1 dir2/XXXXXX
> dir1/dir2/qQBdsf
> $ mktemp -u -t -p dir1 dir2/XXXXXX
> src/mktemp: invalid template, ‘dir2/XXXXXX’, contains directory separator
> 
> So rather than adjusting any functionality of these deprecated options,
> I'll just remove the --help text saying that -t is implied.

Which would make -p = --tmpdir, which is what the code has done
since being introduced to coreutils 6 years ago, and what the
texinfo has documented for the last 4 years.  So I've just aligned
the --help to say -p is the short form of --tmpdir.

Hopefully the attached addresses all these issues.

thanks,
Pádraig.

Attachment: mktemp-pt.patch
Description: Text Data


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]