{"thread":{"id":"60260","subject":"[PATCH] git-gui - simplify _open_stdout_stderr","startedAt":"2023-09-22T16:44:19Z","lastAt":"2025-04-01T16:48:08Z","messageCount":3,"participants":["Mark Levedahl","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"482150","messageId":"20230922164412.130504-1-mlevedahl@gmail.com","threadId":"60260","inReplyTo":null,"subject":"[PATCH] git-gui - simplify _open_stdout_stderr","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2023-09-22T16:44:12Z","receivedAt":"2023-09-22T16:44:19Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"From: \"Mark Levedahl Date: Tue, 19 Sep 2023\" <mlevedahl@gmail.com>\n\nSince b792230 (\"git-gui: Show a progress meter for checking out files\",\n2007-07-08), git-gui includes a workaround for Tcl that does not support\nusing 2>@1 to redirect stderr to stdout. Tcl added such support in\n8.4.7, released in 2004, while the later 8.4.14 still predated git-gui.\nBut, Cygwin was stuck on an 8.4.1 Tcl variant until 2011, hence the need\nfor this workaround. Commit 7145c65 recently removed much other specific\ncode for that obsolete Cygwin Tcl/Tk, but missed this piece.\n\nAlso, Tcl since 8.5 explicitly supports 2>@1 across all platforms, and\ngit-gui requires Tcl >= 8.5, further evidence the workaround is\nobsolete.  (I did test that 2>@1 works as-expected on current Linux,\nCygwin, and Git For Windows Tcl packages).\n\nRemove the workaround and exploit concat's documented capability to\nhandle both scalar and list arguments, leaving a much simpler function.\nThis eliminates any question that cmd might be executed twice.\n\nSigned-off-by: Mark Levedahl <mlevedahl@gmail.com>\n---\n git-gui.sh | 21 ++-------------------\n 1 file changed, 2 insertions(+), 19 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 8bc8892..a5d008d 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -583,25 +583,8 @@ proc git {args} {\n \n proc _open_stdout_stderr {cmd} {\n \t_trace_exec $cmd\n-\tif {[catch {\n-\t\t\tset fd [open [concat [list | ] $cmd] r]\n-\t\t} err]} {\n-\t\tif {   [lindex $cmd end] eq {2>@1}\n-\t\t    && $err eq {can not find channel named \"1\"}\n-\t\t\t} {\n-\t\t\t# Older versions of Tcl 8.4 don't have this 2>@1 IO\n-\t\t\t# redirect operator.  Fallback to |& cat for those.\n-\t\t\t# The command was not actually started, so its safe\n-\t\t\t# to try to start it a second time.\n-\t\t\t#\n-\t\t\tset fd [open [concat \\\n-\t\t\t\t[list | ] \\\n-\t\t\t\t[lrange $cmd 0 end-1] \\\n-\t\t\t\t[list |& cat] \\\n-\t\t\t\t] r]\n-\t\t} else {\n-\t\t\terror $err\n-\t\t}\n+\tif {[catch {set fd [open [concat | $cmd] r]} err]} {\n+\t\terror $err\n \t}\n \tfconfigure $fd -eofchar {}\n \treturn $fd\n-- \n2.41.0.99.19\n\n"},{"id":"515443","messageId":"0140dfd8-f65d-34a0-2e66-44e3f696b100@gmx.de","threadId":"60260","inReplyTo":"20230922164412.130504-1-mlevedahl@gmail.com","subject":"Re: [PATCH] git-gui - simplify _open_stdout_stderr","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2025-04-01T16:04:46Z","receivedAt":"2025-04-01T16:04:49Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Mark,\n\nthis patch is still relevant, right? I am Cc:ing Johannes Sixt for\nawareness.\n\nCiao,\nJohannes\n\nOn Fri, 22 Sep 2023, Mark Levedahl wrote:\n\n> From: \"Mark Levedahl Date: Tue, 19 Sep 2023\" <mlevedahl@gmail.com>\n>\n> Since b792230 (\"git-gui: Show a progress meter for checking out files\",\n> 2007-07-08), git-gui includes a workaround for Tcl that does not support\n> using 2>@1 to redirect stderr to stdout. Tcl added such support in\n> 8.4.7, released in 2004, while the later 8.4.14 still predated git-gui.\n> But, Cygwin was stuck on an 8.4.1 Tcl variant until 2011, hence the need\n> for this workaround. Commit 7145c65 recently removed much other specific\n> code for that obsolete Cygwin Tcl/Tk, but missed this piece.\n>\n> Also, Tcl since 8.5 explicitly supports 2>@1 across all platforms, and\n> git-gui requires Tcl >= 8.5, further evidence the workaround is\n> obsolete.  (I did test that 2>@1 works as-expected on current Linux,\n> Cygwin, and Git For Windows Tcl packages).\n>\n> Remove the workaround and exploit concat's documented capability to\n> handle both scalar and list arguments, leaving a much simpler function.\n> This eliminates any question that cmd might be executed twice.\n>\n> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>\n> ---\n>  git-gui.sh | 21 ++-------------------\n>  1 file changed, 2 insertions(+), 19 deletions(-)\n>\n> diff --git a/git-gui.sh b/git-gui.sh\n> index 8bc8892..a5d008d 100755\n> --- a/git-gui.sh\n> +++ b/git-gui.sh\n> @@ -583,25 +583,8 @@ proc git {args} {\n>\n>  proc _open_stdout_stderr {cmd} {\n>  \t_trace_exec $cmd\n> -\tif {[catch {\n> -\t\t\tset fd [open [concat [list | ] $cmd] r]\n> -\t\t} err]} {\n> -\t\tif {   [lindex $cmd end] eq {2>@1}\n> -\t\t    && $err eq {can not find channel named \"1\"}\n> -\t\t\t} {\n> -\t\t\t# Older versions of Tcl 8.4 don't have this 2>@1 IO\n> -\t\t\t# redirect operator.  Fallback to |& cat for those.\n> -\t\t\t# The command was not actually started, so its safe\n> -\t\t\t# to try to start it a second time.\n> -\t\t\t#\n> -\t\t\tset fd [open [concat \\\n> -\t\t\t\t[list | ] \\\n> -\t\t\t\t[lrange $cmd 0 end-1] \\\n> -\t\t\t\t[list |& cat] \\\n> -\t\t\t\t] r]\n> -\t\t} else {\n> -\t\t\terror $err\n> -\t\t}\n> +\tif {[catch {set fd [open [concat | $cmd] r]} err]} {\n> +\t\terror $err\n>  \t}\n>  \tfconfigure $fd -eofchar {}\n>  \treturn $fd\n> --\n> 2.41.0.99.19\n>\n>\n"},{"id":"515453","messageId":"c16b5707-1d9e-41ba-a915-523ef7ab2689@gmail.com","threadId":"60260","inReplyTo":"0140dfd8-f65d-34a0-2e66-44e3f696b100@gmx.de","subject":"Re: [PATCH] git-gui - simplify _open_stdout_stderr","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2025-04-01T16:48:07Z","receivedAt":"2025-04-01T16:48:08Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"\nOn 4/1/25 12:04 PM, Johannes Schindelin wrote:\n> Hi Mark,\n>\n> this patch is still relevant, right? I am Cc:ing Johannes Sixt for\n> awareness.\n\nAbsolutely. I have a number of commits in my tree removing compatibility \nfor unsupportable Tcl/Tk and git versions, I should clean these up now \nthere is a real maintainer.\n\nMark\n\n\n"}]}