From: Thomas Braun <thomas.braun@virtuell-zuhause.de>
To: patthoyts@users.sourceforge.net, David Aguilar <davvid@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>, git@vger.kernel.org
Subject: Re: [PATCH] gitk: use mktemp -d to avoid predictable temporary directories
Date: Mon, 16 Jun 2014 13:40:03 +0200 [thread overview]
Message-ID: <539ED793.7050409@virtuell-zuhause.de> (raw)
In-Reply-To: <87k38ir4p0.fsf@red.patthoyts.tk>
Am 15.06.2014 09:51, schrieb Pat Thoyts:
> David Aguilar <davvid@gmail.com> writes:
>
>> gitk uses a predictable ".gitk-tmp.$PID" pattern when generating
>> a temporary directory.
>>
>> Use "mktemp -d .gitk-tmp.XXXXXX" to harden gitk against someone
>> seeding /tmp with files matching the pid pattern.
>>
>> Signed-off-by: David Aguilar <davvid@gmail.com>
>> ---
>> This issue was brought up during the first review of the previous patch
>> back in 2009.
>>
>> http://thread.gmane.org/gmane.comp.version-control.git/132609/focus=132748
>>
>> This is really [PATCH 2/2] and should be applied on top of my previous
>> gitk patch.
>>
>> gitk | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/gitk b/gitk
>> index 82293dd..dd2ff63 100755
>> --- a/gitk
>> +++ b/gitk
>> @@ -3502,7 +3502,8 @@ proc gitknewtmpdir {} {
>> } else {
>> set tmpdir $gitdir
>> }
>> - set gitktmpdir [file join $tmpdir [format ".gitk-tmp.%s" [pid]]]
>> + set gitktmpformat [file join $tmpdir ".gitk-tmp.XXXXXX"]
>> + set gitktmpdir [exec mktemp -d $gitktmpformat]
>> if {[catch {file mkdir $gitktmpdir} err]} {
>> error_popup "[mc "Error creating temporary directory %s:" $gitktmpdir] $err"
>> unset gitktmpdir
>
> This is a problem on Windows where we will not have mktemp. In Tcl 8.6
> the file command acquired a "file tempfile" command to help with this
> kind of issue (https://www.tcl.tk/man/tcl8.6/TclCmd/file.htm#M39) but
> for older versions we should probably stick with the existing pattern at
> least on Windows.
We could of course add mktemp from http://www.mktemp.org to msysgit.
I can do that if required.
In mingwgitDevEnv we already have the the need for mktemp, and a msys
package, so this is also not a problem.
prev parent reply other threads:[~2014-06-16 11:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-13 21:43 [PATCH] gitk: use mktemp -d to avoid predictable temporary directories David Aguilar
2014-06-15 4:57 ` Paul Mackerras
2014-06-15 7:51 ` Pat Thoyts
2014-06-15 16:32 ` brian m. carlson
2014-06-15 21:49 ` David Aguilar
2014-06-15 22:16 ` brian m. carlson
2014-06-16 18:17 ` Junio C Hamano
2014-06-19 2:54 ` David Aguilar
2014-06-16 11:40 ` Thomas Braun [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=539ED793.7050409@virtuell-zuhause.de \
--to=thomas.braun@virtuell-zuhause.de \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=patthoyts@users.sourceforge.net \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).