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

Re: [PATCH v2] Fix false positives in t3404 due to SHELL=/bin/false

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 5, 2011, 18:51 UTC
Message-ID
<7vsjx7chgi.fsf@alter.siamese.dyndns.org>
In-Reply-To
<982E526FA742C94E9AC26DA766FD07090A33A5@NYCMBX3.winmail.deshaw.com>
"Vallon, Justin" <Justin.Vallon@deshaw.com> writes:
Show 10 quoted lines
>>Because POSIX shells are required to mark variables they inherit from the
>>environment with the export attribute, your tests will run with SHELL
>>exported to the environment if your usual shell is bash (i.e. SHELL is
>>already exported to processes it spawns), even if you use another POSIX
>>shell to run your git and tests.  That makes the issue doubly harder to
>>notice.
>
> I don't really follow this.  The #! line is /bin/sh.  The user's $SHELL
> does not come into play.  Either SHELL is in /bin/sh's environment and
> it should be cleared in the child, or it isn't and it won't matter.
Read what you are responding to again.

The "doubly harder to notice" is _not_ about gentoo's /bin/sh, but about the experiment Matthieu did (ask: "what shell spawned t3404 that has the she-bang /bin/sh?").

If that shell is bash, which automatically marks SHELL with the export attribute, it places the variable in the environment. t3404 is run under /bin/sh, which presumably is POSIX and initializes its shell variable SHELL with what was in the environment, and while doing so, it also marks the variable with the export attribute. The script does not "unset SHELL" but merely assigns an empty string to it, which is the value to be exported to the processes the script runs.

Imagine that whoever was having trouble did not have SHELL exported to the environment when t3404 is run. The script assigns an empty string to its shell variable SHELL but nothing marks the variable with the export attribute, hence the processes the script runs will never see that as the value of the environment variable (in fact, they wouldn't see SHELL environment variable at all).

Previous: Vallon, Justin
Message 11 of 11 in “Fix false positives in t3404 due to SHELL=/bin/false”
  1. Fix false positives in t3404 due to SHELL=/bin/falseRobin H. Johnson, Dec 27, 2010
  2. Junio C HamanoDec 27, 2010
  3. Fix false positives in t3404 due to SHELL=/bin/falseRobin H. Johnson, Dec 27, 2010
  4. Junio C HamanoDec 28, 2010
  5. Vallon, JustinJan 4, 2011
  6. Robin H. JohnsonJan 4, 2011
  7. Matthieu MoyJan 4, 2011
  8. Jonathan NiederJan 4, 2011
  9. Junio C HamanoJan 4, 2011
  10. Vallon, JustinJan 5, 2011
  11. Junio C HamanoJan 5, 2011

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.