git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH git-gui] git-gui--askpass: Do not hang on exit
       [not found] <20100704203342.6064.32250.reportbug@balanced-tree>
@ 2010-07-04 21:21 ` Jonathan Nieder
  2010-07-04 21:24   ` [PATCH v2 " Jonathan Nieder
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Nieder @ 2010-07-04 21:21 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Anders Kaseorg, git

Anders Kaseorg wrote:

> When git-gui--askpass is manually copied from the source into
> /usr/lib/git-core, though, it doesn’t particularly work; its window
> just freezes after the password is typed.

The problem seems to be the

  bind . <Destroy>    {exit $::rc}

line; apparently each exit causes the window to be destroyed again,
resulting in git gui hanging.

Reported-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---

diff --git a/git-gui--askpass b/git-gui--askpass
index 12e117e..1537f75 100755
--- a/git-gui--askpass
+++ b/git-gui--askpass
@@ -39,7 +39,7 @@ 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 . <Destroy>    {exit $::rc}
 
 proc finish {} {
 	if {$::yesno} {
@@ -52,7 +52,9 @@ proc finish {} {
 
 	set ::rc 0
 	puts $::answer
+	bind . <Destroy> {}
 	destroy .
+	exit 0
 }
 
 wm title . "OpenSSH"
-- 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 git-gui] git-gui--askpass: Do not hang on exit
  2010-07-04 21:21 ` [PATCH git-gui] git-gui--askpass: Do not hang on exit Jonathan Nieder
@ 2010-07-04 21:24   ` Jonathan Nieder
  2010-08-14 23:21     ` [PATCH] git-gui: change the termination checks to avoid potential hang Pat Thoyts
  2010-08-15 23:53     ` [PATCH v2 git-gui] git-gui--askpass: Do not hang on exit Pat Thoyts
  0 siblings, 2 replies; 6+ messages in thread
From: Jonathan Nieder @ 2010-07-04 21:24 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Anders Kaseorg, git

Anders Kaseorg wrote:

> When git-gui--askpass is manually copied from the source into
> /usr/lib/git-core, though, it doesn’t particularly work; its window
> just freezes after the password is typed.

The problem seems to be the

  bind . <Destroy>    {exit $::rc}

line; apparently each exit causes the window to be destroyed again,
resulting in git gui hanging.

Reported-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 I wrote:

 > @@ -52,7 +52,9 @@ proc finish {} {
 >  
 >  	set ::rc 0
 >  	puts $::answer
 > +	bind . <Destroy> {}
 >  	destroy .

 but that does nothing to help the case when the destroy event
 comes from the window manager.  Here’s a saner patch (sorry for
 the noise).

diff --git a/git-gui--askpass b/git-gui--askpass
index 12e117e..20b8799 100755
--- a/git-gui--askpass
+++ b/git-gui--askpass
@@ -39,7 +39,10 @@ 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 . <Destroy>    {
+	bind . <Destroy> {}
+	exit $::rc
+}
 
 proc finish {} {
 	if {$::yesno} {
-- 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] git-gui: change the termination checks to avoid potential hang.
  2010-07-04 21:24   ` [PATCH v2 " Jonathan Nieder
@ 2010-08-14 23:21     ` Pat Thoyts
  2010-08-18  4:21       ` Jonathan Nieder
  2010-08-15 23:53     ` [PATCH v2 git-gui] git-gui--askpass: Do not hang on exit Pat Thoyts
  1 sibling, 1 reply; 6+ messages in thread
From: Pat Thoyts @ 2010-08-14 23:21 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Shawn O. Pearce, Anders Kaseorg, git

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 <andersk@mit.edu>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
---
 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 git-gui] git-gui--askpass: Do not hang on exit
  2010-07-04 21:24   ` [PATCH v2 " Jonathan Nieder
  2010-08-14 23:21     ` [PATCH] git-gui: change the termination checks to avoid potential hang Pat Thoyts
@ 2010-08-15 23:53     ` Pat Thoyts
  1 sibling, 0 replies; 6+ messages in thread
From: Pat Thoyts @ 2010-08-15 23:53 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Shawn O. Pearce, Anders Kaseorg, git

Jonathan Nieder <jrnieder@gmail.com> writes:

>Anders Kaseorg wrote:
>
>> When git-gui--askpass is manually copied from the source into
>> /usr/lib/git-core, though, it doesn’t particularly work; its window
>> just freezes after the password is typed.
>
>The problem seems to be the
>
>  bind . <Destroy>    {exit $::rc}
>
>line; apparently each exit causes the window to be destroyed again,
>resulting in git gui hanging.
>
>Reported-by: Anders Kaseorg <andersk@mit.edu>
>Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
>---
> I wrote:
>
> > @@ -52,7 +52,9 @@ proc finish {} {
> >  
> >  	set ::rc 0
> >  	puts $::answer
> > +	bind . <Destroy> {}
> >  	destroy .
>
> but that does nothing to help the case when the destroy event
> comes from the window manager.  Here’s a saner patch (sorry for
> the noise).
>
>diff --git a/git-gui--askpass b/git-gui--askpass
>index 12e117e..20b8799 100755
>--- a/git-gui--askpass
>+++ b/git-gui--askpass
>@@ -39,7 +39,10 @@ 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 . <Destroy>    {
>+	bind . <Destroy> {}
>+	exit $::rc
>+}
> 
> proc finish {} {
> 	if {$::yesno} {

I'm not so keen to take this patch for git-gui. Exiting from bindings
isn't such great Tk style and I'd rather we used a vwait to explicitly
run the event loop and exit after terminating that. The following patch
does this. 'git-gui: change the termination checks to avoid potential hang'

I'm not certain of the conditions that produced the error this is
supposed to fix. I have not reproduced the hang so far on a linux system
using Tk 8.5. It would be good to get confirmation that my proposed
patch actually solves the issue reported.

-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] git-gui: change the termination checks to avoid potential hang.
  2010-08-14 23:21     ` [PATCH] git-gui: change the termination checks to avoid potential hang Pat Thoyts
@ 2010-08-18  4:21       ` Jonathan Nieder
  2010-08-18 22:48         ` Pat Thoyts
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Nieder @ 2010-08-18  4:21 UTC (permalink / raw)
  To: Pat Thoyts; +Cc: Shawn O. Pearce, Anders Kaseorg, git

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 <patthoyts@users.sourceforge.net>
> ---
>  git-gui--askpass |   17 +++++++++++------
>  1 files changed, 11 insertions(+), 6 deletions(-)

Tested-by: Jonathan Nieder <jrnieder@gmail.com>

> +++ b/git-gui--askpass
[...]
> +vwait rc
> +exit $rc

I like it.

Thanks for keeping git gui in good shape.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] git-gui: change the termination checks to avoid potential hang.
  2010-08-18  4:21       ` Jonathan Nieder
@ 2010-08-18 22:48         ` Pat Thoyts
  0 siblings, 0 replies; 6+ messages in thread
From: Pat Thoyts @ 2010-08-18 22:48 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Shawn O. Pearce, Anders Kaseorg, git

Jonathan Nieder <jrnieder@gmail.com> writes:
>
>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.

OK I managed to confirm that using Tk 8.5. It seems 8.4 and 8.6 get away
with it. I've pushed the fix to git-gui master now. Thanks for testing.

-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-08-18 23:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20100704203342.6064.32250.reportbug@balanced-tree>
2010-07-04 21:21 ` [PATCH git-gui] git-gui--askpass: Do not hang on exit Jonathan Nieder
2010-07-04 21:24   ` [PATCH v2 " Jonathan Nieder
2010-08-14 23:21     ` [PATCH] git-gui: change the termination checks to avoid potential hang Pat Thoyts
2010-08-18  4:21       ` Jonathan Nieder
2010-08-18 22:48         ` Pat Thoyts
2010-08-15 23:53     ` [PATCH v2 git-gui] git-gui--askpass: Do not hang on exit Pat Thoyts

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).