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

Re: [PATCH] rebase-i-exec: Allow space in SHELL_PATH

From
Jeff King <peff@peff.net>
Date
Nov 13, 2015, 23:09 UTC
Message-ID
<20151113230933.GA16173@sigill.intra.peff.net>
In-Reply-To
<CABA5-zmmKeeDDhSdan9sTppRVeDNuPiR8WX=P4Umdbq=ELafqw@mail.gmail.com>
On Fri, Nov 13, 2015 at 11:47:40PM +0100, Fredrik Medley wrote:
Show 12 quoted lines
> > Hmm. Now I'm a bit puzzled. It sounds like the installed file does have
> > @SHELL_PATH@ set to /bin/sh, which is normal. And presumably the setting
> > containing space is coming from the $SHELL environment variable.
> I wrote the email on another computer. Checking the system where I reinstalled
> Git for Windows yesterday shows ${SHELL:-/bin/sh} and SHELL=/usr/bin/bash
> When running "git rebase --interactive HEAD^ --exec 'echo $SHELL'", I get
> mingw64/libexec/git-core/git-rebase--interactive: line 613:
> C:/Program: No such file or directory
> 
> Fixing the double quotes, "git rebase --interactive HEAD^ --exec 'echo
> $SHELL'" shows
> C:/Program Files/Git/usr/bin/bash

It looks like bash on your system may simply be filling in its absolute path into the $SHELL variable. This seems like an interesting bash-ism:

  $ unset SHELL
  $ dash -c 'echo $SHELL'
  $ bash -c 'echo $SHELL'
  /bin/bash

If $SHELL is already set and exported, it will not override it, but in your case $SHELL is probably local to each individual bash invocation.

So that at least kind-of makes sense. It's possible somebody could be doing something clever with $SHELL, but I kind of doubt it. If they want to do something clever, it is much easier to put it directly on the exec line, and have the normal $SHELL run their clever thing.

-Peff
Previous: Fredrik MedleyNext: Johannes Schindelin
Message 6 of 9 in “rebase-i-exec: Allow space in SHELL_PATH”
  1. rebase-i-exec: Allow space in SHELL_PATHFredrik Medley, Nov 13, 2015
  2. Jeff KingNov 13, 2015
  3. Fredrik MedleyNov 13, 2015
  4. Jeff KingNov 13, 2015
  5. Fredrik MedleyNov 13, 2015
  6. Jeff KingNov 13, 2015
  7. Johannes SchindelinNov 16, 2015
  8. Jeff KingNov 16, 2015
  9. Matthieu MoyNov 13, 2015

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.