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

Re: [PATCH 1/1] Makefile: fix the "built from commit" code

From
Jeff King <peff@peff.net>
Date
Jun 28, 2018, 17:47 UTC
Message-ID
<20180628174721.GD31766@sigill.intra.peff.net>
In-Reply-To
<xmqqa7reyg6z.fsf@gitster-ct.c.googlers.com>
On Thu, Jun 28, 2018 at 10:27:32AM -0700, Junio C Hamano wrote:
Show 24 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> >> I.e.:
> >> 
> >>   FOO='with spaces'
> >>   BAR=$FOO sh -c 'echo $BAR'
> >> 
> >> works just fine.
> >
> > 	$ x="two  spaces"
> >
> > 	$ echo $x
> > 	two spaces
> >
> > Maybe we should quote a little bit more religiously.
> 
> Both of you are wrong ;-)
> 
> Of course, the lack of dq around echo's argument makes shell split
> two and spaces into two args and feed them separately to echo, and
> causes echo to show them with a single SP in between.  Peff's
> exampel should have been
> 
> 	BAR=$FOO sh -c 'echo "$BAR"'

Yes, that's a better example. I was primarily trying to show that the outer shell did not barf with "spaces: command not found".

Show 10 quoted lines
> But that does not have much to do with the primary point Peff was
> talking about, which is that in this sequence:
> 
> 	$ x="two  spaces"
> 	$ y="$x"
> 	$ z=$x
> 	$ echo "x=<$x>" "y=<$y>" "z=<$z>"
> 
> assignment to y and z behave identically, i.e. dq around "$x" when
> assigning to y is not needed.

I actually had to test it to convince myself that one-shot assignments behaved the same way, but they do.

-Peff
Previous: Junio C HamanoNext: Johannes Schindelin
Message 6 of 12 in “Makefile: fix the "built from commit" code”
  1. 0/1 Makefile: fix the "built from commit" codeJohannes Schindelin via GitGitGadget, Jun 28, 2018
  2. 1/1 Makefile: fix the "built from commit" codeJohannes Schindelin via GitGitGadget, Jun 27, 2018
  3. Jeff KingJun 28, 2018
  4. Johannes SchindelinJun 28, 2018
  5. Junio C HamanoJun 28, 2018
  6. Jeff KingJun 28, 2018
  7. Johannes SchindelinJun 29, 2018
  8. Jeff KingJun 28, 2018
  9. Johannes SchindelinJun 28, 2018
  10. brian m. carlsonJun 28, 2018
  11. 0/1 Fix "built from commit" logicJohannes Schindelin via GitGitGadget, Jun 29, 2018
  12. 1/1 Makefile: fix the "built from commit" codeJohannes Schindelin via GitGitGadget, Jun 27, 2018

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.