Re: [PATCH] gitk: use mktemp -d to avoid predictable temporary directories

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

 



Am 15.06.2014 09:51, schrieb Pat Thoyts:
> David Aguilar <davvid@xxxxxxxxx> 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@xxxxxxxxx>
>> ---
>> 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.


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]