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

Re: [PATCH] t5563: prevent "ambiguous redirect"

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 31, 2023, 15:39 UTC
Message-ID
<xmqq7cuxhqus.fsf@gitster.g>
In-Reply-To
<pull.1507.git.1680245525637.gitgitgadget@gmail.com>

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:

> (in fact, the `printf ''>$CHALLENGE` is removed because the next line
> overwrites the file anyway because it _also_ uses a single `>` to
> redirect the output).

Good eyes. I also wondered what that empty printf was doing. While I suspect the original intention was to start from an empty file and keep appending contents with any meaning so that the redirection on subsequent lines would look identical, I do not think it is necessary in this case, primarily because it is unlikely that any future change will swap the first line with any subsequent lines.

Thanks for spotting. I was hoping that we could soon retire the "quote the redirection target if it has parameter substitution to help older bash" rule in our coding guidelines, but this example shows that the world is not quite ready yet.

Previous: Johannes Schindelin via GitGitGadget
Message 2 of 2 in “t5563: prevent "ambiguous redirect"”
  1. t5563: prevent "ambiguous redirect"Johannes Schindelin via GitGitGadget, Mar 31, 2023
  2. Junio C HamanoMar 31, 2023

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.