{"thread":{"id":"24286","subject":"[PATCH git-gui] git-gui--askpass: Do not hang on exit","startedAt":"2010-07-04T21:21:25Z","lastAt":"2010-08-18T22:48:17Z","messageCount":6,"participants":["Jonathan Nieder","Pat Thoyts"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"144784","messageId":"20100704212125.GA1613@burratino","threadId":"24286","inReplyTo":"20100704203342.6064.32250.reportbug@balanced-tree","subject":"[PATCH git-gui] git-gui--askpass: Do not hang on exit","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-04T21:21:25Z","receivedAt":"2010-07-04T21:21:25Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Anders Kaseorg wrote:\n\n> When git-gui--askpass is manually copied from the source into\n> /usr/lib/git-core, though, it doesn’t particularly work; its window\n> just freezes after the password is typed.\n\nThe problem seems to be the\n\n  bind . <Destroy>    {exit $::rc}\n\nline; apparently each exit causes the window to be destroyed again,\nresulting in git gui hanging.\n\nReported-by: Anders Kaseorg <andersk@mit.edu>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n\ndiff --git a/git-gui--askpass b/git-gui--askpass\nindex 12e117e..1537f75 100755\n--- a/git-gui--askpass\n+++ b/git-gui--askpass\n@@ -39,7 +39,7 @@ pack .b -side bottom -fill x -padx 10 -pady 10\n bind . <Visibility> {focus -force .e}\n bind . <Key-Return> finish\n bind . <Key-Escape> {destroy .}\n-bind . <Destroy>    {exit $rc}\n+bind . <Destroy>    {exit $::rc}\n \n proc finish {} {\n \tif {$::yesno} {\n@@ -52,7 +52,9 @@ proc finish {} {\n \n \tset ::rc 0\n \tputs $::answer\n+\tbind . <Destroy> {}\n \tdestroy .\n+\texit 0\n }\n \n wm title . \"OpenSSH\"\n-- \n"},{"id":"144785","messageId":"20100704212439.GA1765@burratino","threadId":"24286","inReplyTo":"20100704212125.GA1613@burratino","subject":"[PATCH v2 git-gui] git-gui--askpass: Do not hang on exit","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-04T21:24:39Z","receivedAt":"2010-07-04T21:24:39Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Anders Kaseorg wrote:\n\n> When git-gui--askpass is manually copied from the source into\n> /usr/lib/git-core, though, it doesn’t particularly work; its window\n> just freezes after the password is typed.\n\nThe problem seems to be the\n\n  bind . <Destroy>    {exit $::rc}\n\nline; apparently each exit causes the window to be destroyed again,\nresulting in git gui hanging.\n\nReported-by: Anders Kaseorg <andersk@mit.edu>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n I wrote:\n\n > @@ -52,7 +52,9 @@ proc finish {} {\n >  \n >  \tset ::rc 0\n >  \tputs $::answer\n > +\tbind . <Destroy> {}\n >  \tdestroy .\n\n but that does nothing to help the case when the destroy event\n comes from the window manager.  Here’s a saner patch (sorry for\n the noise).\n\ndiff --git a/git-gui--askpass b/git-gui--askpass\nindex 12e117e..20b8799 100755\n--- a/git-gui--askpass\n+++ b/git-gui--askpass\n@@ -39,7 +39,10 @@ pack .b -side bottom -fill x -padx 10 -pady 10\n bind . <Visibility> {focus -force .e}\n bind . <Key-Return> finish\n bind . <Key-Escape> {destroy .}\n-bind . <Destroy>    {exit $rc}\n+bind . <Destroy>    {\n+\tbind . <Destroy> {}\n+\texit $::rc\n+}\n \n proc finish {} {\n \tif {$::yesno} {\n-- \n"},{"id":"148160","messageId":"87iq3bh1op.fsf_-_@fox.patthoyts.tk","threadId":"24286","inReplyTo":"20100704212439.GA1765@burratino","subject":"[PATCH] git-gui: change the termination checks to avoid potential hang.","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2010-08-14T23:21:30Z","receivedAt":"2010-08-14T23:21:30Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"Supposedly the askpass utility can hang under some circumstances. This\npatch adjusts the Tk application to terminate properly and should avoid\nthis problem.\n\nReported-by: Anders Kaseorg <andersk@mit.edu>\nSigned-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n---\n git-gui--askpass |   17 +++++++++++------\n 1 files changed, 11 insertions(+), 6 deletions(-)\n\ndiff --git a/git-gui--askpass b/git-gui--askpass\nindex 12e117e..8ba4779 100755\n--- a/git-gui--askpass\n+++ b/git-gui--askpass\n@@ -30,16 +30,20 @@ if {!$yesno} {\n \n frame .b\n button .b.ok     -text OK     -command finish\n-button .b.cancel -text Cancel -command {destroy .}\n+button .b.cancel -text Cancel -command cancel\n \n pack .b.ok -side left -expand 1\n pack .b.cancel -side right -expand 1\n pack .b -side bottom -fill x -padx 10 -pady 10\n \n bind . <Visibility> {focus -force .e}\n-bind . <Key-Return> finish\n-bind . <Key-Escape> {destroy .}\n-bind . <Destroy>    {exit $rc}\n+bind . <Key-Return> [list .b.ok invoke]\n+bind . <Key-Escape> [list .b.cancel invoke]\n+bind . <Destroy>    {set rc $rc}\n+\n+proc cancel {} {\n+\tset ::rc 255\n+}\n \n proc finish {} {\n \tif {$::yesno} {\n@@ -50,10 +54,11 @@ proc finish {} {\n \t\t}\n \t}\n \n-\tset ::rc 0\n \tputs $::answer\n-\tdestroy .\n+\tset ::rc 0\n }\n \n wm title . \"OpenSSH\"\n tk::PlaceWindow .\n+vwait rc\n+exit $rc\n-- \n1.7.2.1.44.g721e7\n"},{"id":"148159","messageId":"87mxsnh1qp.fsf@fox.patthoyts.tk","threadId":"24286","inReplyTo":"20100704212439.GA1765@burratino","subject":"Re: [PATCH v2 git-gui] git-gui--askpass: Do not hang on exit","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2010-08-15T23:53:18Z","receivedAt":"2010-08-15T23:53:18Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n>Anders Kaseorg wrote:\n>\n>> When git-gui--askpass is manually copied from the source into\n>> /usr/lib/git-core, though, it doesn’t particularly work; its window\n>> just freezes after the password is typed.\n>\n>The problem seems to be the\n>\n>  bind . <Destroy>    {exit $::rc}\n>\n>line; apparently each exit causes the window to be destroyed again,\n>resulting in git gui hanging.\n>\n>Reported-by: Anders Kaseorg <andersk@mit.edu>\n>Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n>---\n> I wrote:\n>\n> > @@ -52,7 +52,9 @@ proc finish {} {\n> >  \n> >  \tset ::rc 0\n> >  \tputs $::answer\n> > +\tbind . <Destroy> {}\n> >  \tdestroy .\n>\n> but that does nothing to help the case when the destroy event\n> comes from the window manager.  Here’s a saner patch (sorry for\n> the noise).\n>\n>diff --git a/git-gui--askpass b/git-gui--askpass\n>index 12e117e..20b8799 100755\n>--- a/git-gui--askpass\n>+++ b/git-gui--askpass\n>@@ -39,7 +39,10 @@ pack .b -side bottom -fill x -padx 10 -pady 10\n> bind . <Visibility> {focus -force .e}\n> bind . <Key-Return> finish\n> bind . <Key-Escape> {destroy .}\n>-bind . <Destroy>    {exit $rc}\n>+bind . <Destroy>    {\n>+\tbind . <Destroy> {}\n>+\texit $::rc\n>+}\n> \n> proc finish {} {\n> \tif {$::yesno} {\n\nI'm not so keen to take this patch for git-gui. Exiting from bindings\nisn't such great Tk style and I'd rather we used a vwait to explicitly\nrun the event loop and exit after terminating that. The following patch\ndoes this. 'git-gui: change the termination checks to avoid potential hang'\n\nI'm not certain of the conditions that produced the error this is\nsupposed to fix. I have not reproduced the hang so far on a linux system\nusing Tk 8.5. It would be good to get confirmation that my proposed\npatch actually solves the issue reported.\n\n-- \nPat Thoyts                            http://www.patthoyts.tk/\nPGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD\n"},{"id":"148338","messageId":"20100818042107.GC21185@burratino","threadId":"24286","inReplyTo":"87iq3bh1op.fsf_-_@fox.patthoyts.tk","subject":"Re: [PATCH] git-gui: change the termination checks to avoid potential hang.","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-18T04:21:07Z","receivedAt":"2010-08-18T04:21:07Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Pat Thoyts wrote:\n\n> Supposedly\n\nAnd consistently.\n\n $ wish\n % puts $tcl_version\n 8.5\n % puts $tk_version\n 8.5\n $ dpkg -l tcl8.5 tk8.5 | tail -2\n ii  tcl8.5         8.5.8-2       Tcl (the Tool Command Language) v8.5 - ru\n ii  tk8.5          8.5.8-1       Tk toolkit for Tcl and X11, v8.5 - run-ti\n $ ./git-gui--askpass\n <types passphrase>\n\nThe window would stay open and hang.\n\n> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n> ---\n>  git-gui--askpass |   17 +++++++++++------\n>  1 files changed, 11 insertions(+), 6 deletions(-)\n\nTested-by: Jonathan Nieder <jrnieder@gmail.com>\n\n> +++ b/git-gui--askpass\n[...]\n> +vwait rc\n> +exit $rc\n\nI like it.\n\nThanks for keeping git gui in good shape.\n"},{"id":"148419","messageId":"878w431qry.fsf@fox.patthoyts.tk","threadId":"24286","inReplyTo":"20100818042107.GC21185@burratino","subject":"Re: [PATCH] git-gui: change the termination checks to avoid potential hang.","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2010-08-18T22:48:17Z","receivedAt":"2010-08-18T22:48:17Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n>\n>And consistently.\n>\n> $ wish\n> % puts $tcl_version\n> 8.5\n> % puts $tk_version\n> 8.5\n> $ dpkg -l tcl8.5 tk8.5 | tail -2\n> ii  tcl8.5         8.5.8-2       Tcl (the Tool Command Language) v8.5 - ru\n> ii  tk8.5          8.5.8-1       Tk toolkit for Tcl and X11, v8.5 - run-ti\n> $ ./git-gui--askpass\n> <types passphrase>\n>\n>The window would stay open and hang.\n\nOK I managed to confirm that using Tk 8.5. It seems 8.4 and 8.6 get away\nwith it. I've pushed the fix to git-gui master now. Thanks for testing.\n\n-- \nPat Thoyts                            http://www.patthoyts.tk/\nPGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD\n"}]}