git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: t4204-patch-id failures

From
Armin Kunaschik <megabreit@googlemail.com>
Date
May 23, 2016, 22:56 UTC
Message-ID
<CALR6jEgjcAGjLBbHuB+sG24Xwp9AH1i8SbtSdQoLyFcKmwAAcA@mail.gmail.com>
In-Reply-To
<xmqqbn3w76rn.fsf@gitster.mtv.corp.google.com>
On Tue, May 24, 2016 at 12:23 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Junio C Hamano <gitster@pobox.com> writes:
Show 14 quoted lines
> Having said all that, this illustrates the root cause of different
> behaviours better, but it is harder to reason about than simply
> changing the variable name used in this shell function.  POSIX reads
> a bit fuzzy to me around here:
>
>     ... each command of a multi-command pipeline is in a subshell
>     environment; as an extension, however, any or all commands in a
>     pipeline may be executed in the current environment. All other
>     commands shall be executed in the current shell environment.
>
> That essentially says nothing useful; it does not guarantee that
> each command on a pipeline runs in its own subshell environment, and
> a portable script must be prepared to see some of them run in the
> current shell environment.
Writing portable shell scripts sometimes is quite a mess :-)
Show 14 quoted lines
> So let's do this instead:
>
> -- >8 --
> Subject: t4204: do not let $name variable clobbered
>
> test_patch_id_file_order shell function uses $name variable to hold
> one filename, and calls another shell function calc_patch_id as a
> downstream of one pipeline.  The called function, however, also uses
> the same $name variable.  With a shell implementation that runs the
> callee in the current shell environment, the caller's $name would
> be clobbered by the callee's use of the same variable.
>
> This hasn't been an issue with dash and bash.  ksh93 reveals the
> breakage in the test script.
Maybe add ksh88 too, just to be "feature" complete.
> Fix it by using a distinct variable name in the callee.
Agreed.
> Reported-by: Armin Kunaschik <megabreit@googlemail.com>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Previous: Junio C Hamano
Message 4 of 4 in “t4204-patch-id failures”
  1. Armin KunaschikMay 23, 2016
  2. Junio C HamanoMay 23, 2016
  3. Junio C HamanoMay 23, 2016
  4. Armin KunaschikMay 23, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.