{"thread":{"id":"13628","subject":"[PATCH] gitk - restore operation of git-reset on Cygwin","startedAt":"2008-05-23T03:00:36Z","lastAt":"2008-05-23T23:17:14Z","messageCount":5,"participants":["Mark Levedahl","Paul Mackerras","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"77517","messageId":"1211511636-3552-1-git-send-email-mlevedahl@gmail.com","threadId":"13628","inReplyTo":null,"subject":"[PATCH] gitk - restore operation of git-reset on Cygwin","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2008-05-23T03:00:36Z","receivedAt":"2008-05-23T03:00:36Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"Commit 6df7403a98737 modified the call to git-reset to invoke git\ndirectly rather than using \"sh -c\", but is redirecting stderr to stdout.\nThis does not work on Cygwin, probably because the Tcl/Tk package is\na windows program rather than Cygwin. The result is always an error\nmessage proclaiming 'can not find channel named \"1\"'. This restores\ninvocation through sh -c.\n\nSigned-off-by: Mark Levedahl <mlevedahl@gmail.com>\n---\nNote - this applies to Paul's tree, please let me know if you prefer\none that applies to Junio's instead (gitk-git/gitk rather than gitk).\n\n gitk |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 22bcd18..aa70911 100755\n--- a/gitk\n+++ b/gitk\n@@ -7617,7 +7617,7 @@ proc resethead {} {\n     tkwait window $w\n     if {!$confirm_ok} return\n     if {[catch {set fd [open \\\n-\t    [list | git reset --$resettype $rowmenuid 2>@1] r]} err]} {\n+\t    [list | sh -c \"git reset --$resettype $rowmenuid 2>&1\"] r]} err]} {\n \terror_popup $err\n     } else {\n \tdohidelocalchanges\n--\n1.5.5.1.333.gd69f4\n"},{"id":"77518","messageId":"18486.15879.551874.408651@cargo.ozlabs.ibm.com","threadId":"13628","inReplyTo":"1211511636-3552-1-git-send-email-mlevedahl@gmail.com","subject":"Re: [PATCH] gitk - restore operation of git-reset on Cygwin","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2008-05-23T03:46:15Z","receivedAt":"2008-05-23T03:46:15Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Mark Levedahl writes:\n\n> Commit 6df7403a98737 modified the call to git-reset to invoke git\n> directly rather than using \"sh -c\", but is redirecting stderr to stdout.\n> This does not work on Cygwin, probably because the Tcl/Tk package is\n> a windows program rather than Cygwin. The result is always an error\n> message proclaiming 'can not find channel named \"1\"'. This restores\n> invocation through sh -c.\n\nAre you using Tk 8.4 or 8.5?  The man pages for 8.5 imply that the\n2>@1 form should work for all platforms, but maybe that wasn't true in\n8.4.  If that's the case it's worth mentioning in the patch\ndescription.\n\nPaul.\n"},{"id":"77605","messageId":"483744AB.8070509@gmail.com","threadId":"13628","inReplyTo":"18486.15879.551874.408651@cargo.ozlabs.ibm.com","subject":"Re: [PATCH] gitk - restore operation of git-reset on Cygwin","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2008-05-23T22:26:51Z","receivedAt":"2008-05-23T22:26:51Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"Paul Mackerras wrote:\n> Mark Levedahl writes:\n>\n>   \n>> Commit 6df7403a98737 modified the call to git-reset to invoke git\n>> directly rather than using \"sh -c\", but is redirecting stderr to stdout.\n>> This does not work on Cygwin, probably because the Tcl/Tk package is\n>> a windows program rather than Cygwin. The result is always an error\n>> message proclaiming 'can not find channel named \"1\"'. This restores\n>> invocation through sh -c.\n>>     \n>\n> Are you using Tk 8.4 or 8.5?  The man pages for 8.5 imply that the\n> 2>@1 form should work for all platforms, but maybe that wasn't true in\n> 8.4.  If that's the case it's worth mentioning in the patch\n> description.\n>\n> Paul.\n>   \nCygwin's Tcl/Tk is essentially frozen at 8.4.1. However, I really \nbelieve the problem is that the Tcl/Tk is not a full Cygwin application: \nit is mostly Windows, with only a few pieces converted to Posix through \nthe cygwin.dll, so many things don't quite work correctly. For instance, \nthe current gitk works fine under a pure Cygwin build of Tcl/Tk (8.4.13) \nI have locally. So, I believe the commit message I wrote is correct.\n\nMark\n"},{"id":"77612","messageId":"48374F82.7050005@gmail.com","threadId":"13628","inReplyTo":"483744AB.8070509@gmail.com","subject":"Re: [PATCH] gitk - restore operation of git-reset on Cygwin","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2008-05-23T23:13:06Z","receivedAt":"2008-05-23T23:13:06Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"Mark Levedahl wrote:\n> Paul Mackerras wrote:\n>> Are you using Tk 8.4 or 8.5?  The man pages for 8.5 imply that the\n>> 2>@1 form should work for all platforms, but maybe that wasn't true in\n>> 8.4.  If that's the case it's worth mentioning in the patch\n>> description.\n>>\n>> Paul.\n>>   \n> Cygwin's Tcl/Tk is essentially frozen at 8.4.1. However, I really \n> believe the problem is that the Tcl/Tk is not a full Cygwin \n> application: it is mostly Windows, with only a few pieces converted to \n> Posix through the cygwin.dll, so many things don't quite work \n> correctly. For instance, the current gitk works fine under a pure \n> Cygwin build of Tcl/Tk (8.4.13) I have locally. So, I believe the \n> commit message I wrote is correct.\n>\n> Mark\n>\n\nI just tried installation of ActiveState Tcl 8.4.16, put that on the \nCygwin path, and gitk operates correctly without the patch. So, the \nissue seems to be entirely one of Cygwin's particular Tcl/Tk build, \nthough whether that is due to the version or the odd attributes of its \ncompilation I cannot say.\n\nMark\n"},{"id":"77614","messageId":"20080523231714.GY29038@spearce.org","threadId":"13628","inReplyTo":"48374F82.7050005@gmail.com","subject":"Re: [PATCH] gitk - restore operation of git-reset on Cygwin","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-05-23T23:17:14Z","receivedAt":"2008-05-23T23:17:14Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Mark Levedahl <mlevedahl@gmail.com> wrote:\n> >Paul Mackerras wrote:\n> >>Are you using Tk 8.4 or 8.5?  The man pages for 8.5 imply that the\n> >>2>@1 form should work for all platforms, but maybe that wasn't true in\n> >>8.4.  If that's the case it's worth mentioning in the patch\n> >>description.\n> \n> I just tried installation of ActiveState Tcl 8.4.16, put that on the \n> Cygwin path, and gitk operates correctly without the patch. So, the \n> issue seems to be entirely one of Cygwin's particular Tcl/Tk build, \n> though whether that is due to the version or the odd attributes of its \n> compilation I cannot say.\n\ngit-gui ran into this problem and uses the following procedure\nanytime it wants both stdout and stderr:\n\nproc _open_stdout_stderr {cmd} {\n    _trace_exec $cmd\n    if {[catch {\n            set fd [open [concat [list | ] $cmd] r]\n        } err]} {\n        if {   [lindex $cmd end] eq {2>@1}\n            && $err eq {can not find channel named \"1\"}\n            } {\n            # Older versions of Tcl 8.4 don't have this 2>@1 IO\n            # redirect operator.  Fallback to |& cat for those.\n            # The command was not actually started, so its safe\n            # to try to start it a second time.\n            #\n            set fd [open [concat \\\n                [list | ] \\\n                [lrange $cmd 0 end-1] \\\n                [list |& cat] \\\n                ] r]\n        } else {\n            error $err\n        }\n    }\n    fconfigure $fd -eofchar {}\n    return $fd\n}\n\n-- \nShawn.\n"}]}