{"thread":{"id":"65557","subject":"[PATCH] Reintegrate: send \"Huh?\" warnings to stderr, not stdout","startedAt":"2026-04-27T10:47:43Z","lastAt":"2026-05-04T10:28:58Z","messageCount":4,"participants":["Erik Cervin-Edin","Tian Yuchen","Erik Cervin Edin","erik@cervined.in"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"542366","messageId":"ae896PlyiYeqldFN@mbp","threadId":"65557","inReplyTo":null,"subject":"[PATCH] Reintegrate: send \"Huh?\" warnings to stderr, not stdout","fromName":"Erik Cervin-Edin","fromEmail":"erik@cervined.in","sentAt":"2026-04-27T10:47:38Z","receivedAt":"2026-04-27T10:47:43Z","isPatch":true,"body":"The \"Huh?: $msg\" warning in show_merge(), emitted when a first-parent\nmerge subject does not match either \"Merge branch '...'\" or \"Merge\nremote branch '...'\", uses\n\n\techo 2>&1 \"Huh?: $msg\"\n\nThe \"2>&1\" redirect dupes stderr onto stdout's destination; it does\nnot change where stdout itself points.  Since echo writes to stdout,\nthe \"Huh?:\" message lands on stdout regardless -- as would any\ncommand's normal output.  The intent appears to have been \">&2\",\nwhich dupes stdout onto stderr.\n\nIn the common Reintegrate invocation that captures stdout, e.g.\n\n\tMeta/Reintegrate next..seen >Meta/redo-seen.sh\n\nthis means the warning is silently embedded in the generated heredoc\nbody instead of being printed to the maintainer's terminal.  The\nresulting redo-* script is corrupted with a \"Huh?:...\" line and the\nmaintainer has no diagnostic that something went wrong.\n\nEvery other diagnostic in this script already uses \">&2\"; this line\nis the lone outlier.\n\nUse \">&2\" so the warning reaches stderr as intended.\n\nSigned-off-by: Erik Cervin-Edin <erik@cervined.in>\n---\n Reintegrate | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Reintegrate b/Reintegrate\nindex a1e67a0330..6fdc7c5f41 100755\n--- a/Reintegrate\n+++ b/Reintegrate\n@@ -327,7 +327,7 @@ show_merge () {\n \t\tmerge_hier=\n \t\t;;\n \t*)\n-\t\techo 2>&1 \"Huh?: $msg\"\n+\t\techo >&2 \"Huh?: $msg\"\n \t\treturn\n \t\t;;\n \tesac &&\n-- \n2.53.0\n\n"},{"id":"542442","messageId":"5a821f71-3d6e-4942-9bdb-257617484a6b@malon.dev","threadId":"65557","inReplyTo":"ae896PlyiYeqldFN@mbp","subject":"Re: [PATCH] Reintegrate: send \"Huh?\" warnings to stderr, not stdout","fromName":"Tian Yuchen","fromEmail":"cat@malon.dev","sentAt":"2026-04-28T18:05:16Z","receivedAt":"2026-04-28T18:05:35Z","isPatch":true,"body":"On 4/27/26 18:47, Erik Cervin-Edin wrote:\n> The \"Huh?: $msg\" warning in show_merge(), emitted when a first-parent\n> merge subject does not match either \"Merge branch '...'\" or \"Merge\n> remote branch '...'\", uses\n> \n> \techo 2>&1 \"Huh?: $msg\"\n\nYes, this is clearly wrong.\n\n> The \"2>&1\" redirect dupes stderr onto stdout's destination; it does\n> not change where stdout itself points.  Since echo writes to stdout,\n> the \"Huh?:\" message lands on stdout regardless -- as would any\n> command's normal output.  \n\n> The intent appears to have been \">&2\", which dupes stdout onto stderr.\n\nIt would be better for me if this sentence (i.e., what was the code \noriginally *intended* to do before the patch?) were placed right at the \nbeginning. Something similar to:\n\n\tIn show_merge(), the warning \"Huh?: $msg\" is emitted to stdout because \nit uses the erroneous redirect `echo 2>&1`. The intent was clearly to \nuse `>&2` to print to stderr...\n\nOf course, it’s up to you ;)\n\n> \n> In the common Reintegrate invocation that captures stdout, e.g.\n> \n> \tMeta/Reintegrate next..seen >Meta/redo-seen.sh\n> \n> this means the warning is silently embedded in the generated heredoc\n> body instead of being printed to the maintainer's terminal.  The\n> resulting redo-* script is corrupted with a \"Huh?:...\" line and the\n> maintainer has no diagnostic that something went wrong.\n> \n> Every other diagnostic in this script already uses \">&2\"; this line\n> is the lone outlier.\n> \n> Use \">&2\" so the warning reaches stderr as intended.\n\nOverall, the reasoning is nice :-)\n\n> Signed-off-by: Erik Cervin-Edin <erik@cervined.in>\n> ---\n>   Reintegrate | 2 +-\n>   1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/Reintegrate b/Reintegrate\n> index a1e67a0330..6fdc7c5f41 100755\n> --- a/Reintegrate\n> +++ b/Reintegrate\n> @@ -327,7 +327,7 @@ show_merge () {\n>   \t\tmerge_hier=\n>   \t\t;;\n>   \t*)\n> -\t\techo 2>&1 \"Huh?: $msg\"\n> +\t\techo >&2 \"Huh?: $msg\"\n>   \t\treturn\n>   \t\t;;\n>   \tesac &&\n\nThanks, Yuchen\n\n"},{"id":"542656","messageId":"afht-MqIGaZLwbnY@mbp","threadId":"65557","inReplyTo":"5a821f71-3d6e-4942-9bdb-257617484a6b@malon.dev","subject":"Re: [PATCH] Reintegrate: send \"Huh?\" warnings to stderr, not stdout","fromName":"Erik Cervin Edin","fromEmail":"erik@cervined.in","sentAt":"2026-05-04T10:03:36Z","receivedAt":"2026-05-04T10:03:41Z","isPatch":true,"body":"On 26/04/29 02:05AM, Tian Yuchen wrote:\n> It would be better for me if this sentence (i.e., what was the code\n> originally *intended* to do before the patch?) were placed right at the\n> beginning. Something similar to:\n> \n> \tIn show_merge(), the warning \"Huh?: $msg\" is emitted to stdout because it\n> uses the erroneous redirect `echo 2>&1`. The intent was clearly to use `>&2`\n> to print to stderr...\n> \n> Of course, it’s up to you ;)\n\nGood point! I hoisted the intent up to the opening paragraph; took the\nspirit of your wording rather than copying it verbatim, and tightened\nthe rest while I was at it.\n"},{"id":"542658","messageId":"20260504102844.74734-2-erik@cervined.in","threadId":"65557","inReplyTo":"ae896PlyiYeqldFN@mbp","subject":"[PATCH v2] Reintegrate: send \"Huh?\" warnings to stderr, not stdout","fromName":"","fromEmail":"erik@cervined.in","sentAt":"2026-05-04T10:28:44Z","receivedAt":"2026-05-04T10:28:58Z","isPatch":true,"body":"From: Erik Cervin-Edin <erik@cervined.in>\n\nIn show_merge(), the \"Huh?: $msg\" warning -- emitted when a\nfirst-parent merge subject does not match either \"Merge branch '...'\"\nor \"Merge remote branch '...'\" -- is meant to go to stderr, but the\nredirect\n\n\techo 2>&1 \"Huh?: $msg\"\n\ngoes the wrong way and sends the message to stdout instead.\n\nIn the common Reintegrate invocation that captures stdout, e.g.\n\n\tMeta/Reintegrate next..seen >Meta/redo-seen.sh\n\nthis means the warning is silently embedded in the generated heredoc\nbody instead of being printed to the maintainer's terminal, with no\ndiagnostic that something went wrong. Worse, the resulting redo-*\nscript is corrupted with a \"Huh?:...\" line.\n\nSwitch the redirection to \">&2\", matching every other diagnostic in\nthis script.\n\nSigned-off-by: Erik Cervin-Edin <erik@cervined.in>\n---\n Reintegrate | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Reintegrate b/Reintegrate\nindex a1e67a0330..6fdc7c5f41 100755\n--- a/Reintegrate\n+++ b/Reintegrate\n@@ -327,7 +327,7 @@ show_merge () {\n \t\tmerge_hier=\n \t\t;;\n \t*)\n-\t\techo 2>&1 \"Huh?: $msg\"\n+\t\techo >&2 \"Huh?: $msg\"\n \t\treturn\n \t\t;;\n \tesac &&\n-- \n2.53.0\n\n"}]}