[PATCH] git-gui: change the termination checks to avoid potential hang.

Subsystems: the rest

STALE3738d

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

[PATCH] git-gui: change the termination checks to avoid potential hang.

From: Pat Thoyts <hidden>
Date: 2016-06-15 22:49:19

Supposedly the askpass utility can hang under some circumstances. This
patch adjusts the Tk application to terminate properly and should avoid
this problem.

Reported-by: Anders Kaseorg <redacted>
Signed-off-by: Pat Thoyts <redacted>
---
 git-gui--askpass |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/git-gui--askpass b/git-gui--askpass
index 12e117e..8ba4779 100755
--- a/git-gui--askpass
+++ b/git-gui--askpass
@@ -30,16 +30,20 @@ if {!$yesno} {
 
 frame .b
 button .b.ok     -text OK     -command finish
-button .b.cancel -text Cancel -command {destroy .}
+button .b.cancel -text Cancel -command cancel
 
 pack .b.ok -side left -expand 1
 pack .b.cancel -side right -expand 1
 pack .b -side bottom -fill x -padx 10 -pady 10
 
 bind . <Visibility> {focus -force .e}
-bind . <Key-Return> finish
-bind . <Key-Escape> {destroy .}
-bind . <Destroy>    {exit $rc}
+bind . <Key-Return> [list .b.ok invoke]
+bind . <Key-Escape> [list .b.cancel invoke]
+bind . <Destroy>    {set rc $rc}
+
+proc cancel {} {
+	set ::rc 255
+}
 
 proc finish {} {
 	if {$::yesno} {
@@ -50,10 +54,11 @@ proc finish {} {
 		}
 	}
 
-	set ::rc 0
 	puts $::answer
-	destroy .
+	set ::rc 0
 }
 
 wm title . "OpenSSH"
 tk::PlaceWindow .
+vwait rc
+exit $rc
-- 
1.7.2.1.44.g721e7

Re: [PATCH] git-gui: change the termination checks to avoid potential hang.

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:49:20

Pat Thoyts wrote:
Supposedly
And consistently.

 $ wish
 % puts $tcl_version
 8.5
 % puts $tk_version
 8.5
 $ dpkg -l tcl8.5 tk8.5 | tail -2
 ii  tcl8.5         8.5.8-2       Tcl (the Tool Command Language) v8.5 - ru
 ii  tk8.5          8.5.8-1       Tk toolkit for Tcl and X11, v8.5 - run-ti
 $ ./git-gui--askpass
 <types passphrase>

The window would stay open and hang.
Signed-off-by: Pat Thoyts <redacted>
---
 git-gui--askpass |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
Tested-by: Jonathan Nieder <redacted>
quoted hunk
+++ b/git-gui--askpass
[...]
+vwait rc
+exit $rc
I like it.

Thanks for keeping git gui in good shape.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help