git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitk - restore operation of git-reset on Cygwin
@ 2008-05-23  3:00 Mark Levedahl
  2008-05-23  3:46 ` Paul Mackerras
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Levedahl @ 2008-05-23  3:00 UTC (permalink / raw)
  To: paulus; +Cc: git, Mark Levedahl

Commit 6df7403a98737 modified the call to git-reset to invoke git
directly rather than using "sh -c", but is redirecting stderr to stdout.
This does not work on Cygwin, probably because the Tcl/Tk package is
a windows program rather than Cygwin. The result is always an error
message proclaiming 'can not find channel named "1"'. This restores
invocation through sh -c.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
Note - this applies to Paul's tree, please let me know if you prefer
one that applies to Junio's instead (gitk-git/gitk rather than gitk).

 gitk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gitk b/gitk
index 22bcd18..aa70911 100755
--- a/gitk
+++ b/gitk
@@ -7617,7 +7617,7 @@ proc resethead {} {
     tkwait window $w
     if {!$confirm_ok} return
     if {[catch {set fd [open \
-	    [list | git reset --$resettype $rowmenuid 2>@1] r]} err]} {
+	    [list | sh -c "git reset --$resettype $rowmenuid 2>&1"] r]} err]} {
 	error_popup $err
     } else {
 	dohidelocalchanges
--
1.5.5.1.333.gd69f4

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

* Re: [PATCH] gitk - restore operation of git-reset on Cygwin
  2008-05-23  3:00 [PATCH] gitk - restore operation of git-reset on Cygwin Mark Levedahl
@ 2008-05-23  3:46 ` Paul Mackerras
  2008-05-23 22:26   ` Mark Levedahl
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Mackerras @ 2008-05-23  3:46 UTC (permalink / raw)
  To: Mark Levedahl; +Cc: git

Mark Levedahl writes:

> Commit 6df7403a98737 modified the call to git-reset to invoke git
> directly rather than using "sh -c", but is redirecting stderr to stdout.
> This does not work on Cygwin, probably because the Tcl/Tk package is
> a windows program rather than Cygwin. The result is always an error
> message proclaiming 'can not find channel named "1"'. This restores
> invocation through sh -c.

Are you using Tk 8.4 or 8.5?  The man pages for 8.5 imply that the
2>@1 form should work for all platforms, but maybe that wasn't true in
8.4.  If that's the case it's worth mentioning in the patch
description.

Paul.

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

* Re: [PATCH] gitk - restore operation of git-reset on Cygwin
  2008-05-23  3:46 ` Paul Mackerras
@ 2008-05-23 22:26   ` Mark Levedahl
  2008-05-23 23:13     ` Mark Levedahl
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Levedahl @ 2008-05-23 22:26 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git

Paul Mackerras wrote:
> Mark Levedahl writes:
>
>   
>> Commit 6df7403a98737 modified the call to git-reset to invoke git
>> directly rather than using "sh -c", but is redirecting stderr to stdout.
>> This does not work on Cygwin, probably because the Tcl/Tk package is
>> a windows program rather than Cygwin. The result is always an error
>> message proclaiming 'can not find channel named "1"'. This restores
>> invocation through sh -c.
>>     
>
> Are you using Tk 8.4 or 8.5?  The man pages for 8.5 imply that the
> 2>@1 form should work for all platforms, but maybe that wasn't true in
> 8.4.  If that's the case it's worth mentioning in the patch
> description.
>
> Paul.
>   
Cygwin's Tcl/Tk is essentially frozen at 8.4.1. However, I really 
believe the problem is that the Tcl/Tk is not a full Cygwin application: 
it is mostly Windows, with only a few pieces converted to Posix through 
the cygwin.dll, so many things don't quite work correctly. For instance, 
the current gitk works fine under a pure Cygwin build of Tcl/Tk (8.4.13) 
I have locally. So, I believe the commit message I wrote is correct.

Mark

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

* Re: [PATCH] gitk - restore operation of git-reset on Cygwin
  2008-05-23 22:26   ` Mark Levedahl
@ 2008-05-23 23:13     ` Mark Levedahl
  2008-05-23 23:17       ` Shawn O. Pearce
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Levedahl @ 2008-05-23 23:13 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git

Mark Levedahl wrote:
> Paul Mackerras wrote:
>> Are you using Tk 8.4 or 8.5?  The man pages for 8.5 imply that the
>> 2>@1 form should work for all platforms, but maybe that wasn't true in
>> 8.4.  If that's the case it's worth mentioning in the patch
>> description.
>>
>> Paul.
>>   
> Cygwin's Tcl/Tk is essentially frozen at 8.4.1. However, I really 
> believe the problem is that the Tcl/Tk is not a full Cygwin 
> application: it is mostly Windows, with only a few pieces converted to 
> Posix through the cygwin.dll, so many things don't quite work 
> correctly. For instance, the current gitk works fine under a pure 
> Cygwin build of Tcl/Tk (8.4.13) I have locally. So, I believe the 
> commit message I wrote is correct.
>
> Mark
>

I just tried installation of ActiveState Tcl 8.4.16, put that on the 
Cygwin path, and gitk operates correctly without the patch. So, the 
issue seems to be entirely one of Cygwin's particular Tcl/Tk build, 
though whether that is due to the version or the odd attributes of its 
compilation I cannot say.

Mark

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

* Re: [PATCH] gitk - restore operation of git-reset on Cygwin
  2008-05-23 23:13     ` Mark Levedahl
@ 2008-05-23 23:17       ` Shawn O. Pearce
  0 siblings, 0 replies; 5+ messages in thread
From: Shawn O. Pearce @ 2008-05-23 23:17 UTC (permalink / raw)
  To: Mark Levedahl; +Cc: Paul Mackerras, git

Mark Levedahl <mlevedahl@gmail.com> wrote:
> >Paul Mackerras wrote:
> >>Are you using Tk 8.4 or 8.5?  The man pages for 8.5 imply that the
> >>2>@1 form should work for all platforms, but maybe that wasn't true in
> >>8.4.  If that's the case it's worth mentioning in the patch
> >>description.
> 
> I just tried installation of ActiveState Tcl 8.4.16, put that on the 
> Cygwin path, and gitk operates correctly without the patch. So, the 
> issue seems to be entirely one of Cygwin's particular Tcl/Tk build, 
> though whether that is due to the version or the odd attributes of its 
> compilation I cannot say.

git-gui ran into this problem and uses the following procedure
anytime it wants both stdout and stderr:

proc _open_stdout_stderr {cmd} {
    _trace_exec $cmd
    if {[catch {
            set fd [open [concat [list | ] $cmd] r]
        } err]} {
        if {   [lindex $cmd end] eq {2>@1}
            && $err eq {can not find channel named "1"}
            } {
            # Older versions of Tcl 8.4 don't have this 2>@1 IO
            # redirect operator.  Fallback to |& cat for those.
            # The command was not actually started, so its safe
            # to try to start it a second time.
            #
            set fd [open [concat \
                [list | ] \
                [lrange $cmd 0 end-1] \
                [list |& cat] \
                ] r]
        } else {
            error $err
        }
    }
    fconfigure $fd -eofchar {}
    return $fd
}

-- 
Shawn.

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

end of thread, other threads:[~2008-05-23 23:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-23  3:00 [PATCH] gitk - restore operation of git-reset on Cygwin Mark Levedahl
2008-05-23  3:46 ` Paul Mackerras
2008-05-23 22:26   ` Mark Levedahl
2008-05-23 23:13     ` Mark Levedahl
2008-05-23 23:17       ` Shawn O. Pearce

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 NNTP newsgroup(s).