Re: [PATCH] gitk: catch mkdtemp errors

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] gitk: catch mkdtemp errors

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:01:45

David Aguilar [off-list ref] writes:
105b5d3fbb1c00bb0aeaf9d3e0fbe26a7b1993fc introduced a dependency
on mkdtemp, which is not available on Windows.

Use the original temporary directory behavior when mkdtemp fails.
This makes the code use mkdtemp when available and gracefully
fallback to the existing behavior when it is not available.

Helped-by: Junio C Hamano [off-list ref]
Helped-by: brian m. carlson [off-list ref]
Signed-off-by: David Aguilar <redacted>
---
In the meantime, I've fetched from you and merged up to your
master~2 aka 17f9836c (gitk: Show staged submodules regardless of
ignore config, 2014-04-08).

Thanks.
quoted hunk
 gitk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gitk b/gitk
index 41e5071..9237830 100755
--- a/gitk
+++ b/gitk
@@ -3504,7 +3504,9 @@ proc gitknewtmpdir {} {
 	    set tmpdir $gitdir
 	}
 	set gitktmpformat [file join $tmpdir ".gitk-tmp.XXXXXX"]
-	set gitktmpdir [exec mktemp -d $gitktmpformat]
+	if {[catch {set gitktmpdir [exec mktemp -d $gitktmpformat]}]} {
+	    set gitktmpdir [file join $gitdir [format ".gitk-tmp.%s" [pid]]]
+	}
 	if {[catch {file mkdir $gitktmpdir} err]} {
 	    error_popup "[mc "Error creating temporary directory %s:" $gitktmpdir] $err"
 	    unset gitktmpdir

Re: [PATCH] gitk: catch mkdtemp errors

From: Paul Mackerras <hidden>
Date: 2016-06-15 23:01:45

On Thu, Jun 26, 2014 at 01:47:36PM -0700, Junio C Hamano wrote:
David Aguilar [off-list ref] writes:
quoted
105b5d3fbb1c00bb0aeaf9d3e0fbe26a7b1993fc introduced a dependency
on mkdtemp, which is not available on Windows.

Use the original temporary directory behavior when mkdtemp fails.
This makes the code use mkdtemp when available and gracefully
fallback to the existing behavior when it is not available.

Helped-by: Junio C Hamano [off-list ref]
Helped-by: brian m. carlson [off-list ref]
Signed-off-by: David Aguilar <redacted>
---
In the meantime, I've fetched from you and merged up to your
master~2 aka 17f9836c (gitk: Show staged submodules regardless of
ignore config, 2014-04-08).
I have applied and pushed out this patch, along with one from Max
Kirillov, so please do another fetch.

Thanks,
Paul.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help