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

Re: [PATCH v3 2/2] meson: prefer shell at "/bin/sh"

From
Eli Schwartz <eschwartz@gentoo.org>
Date
Apr 25, 2025, 22:21 UTC
Message-ID
<27b77b6b-d696-4837-89fe-b359ce481083@gentoo.org>
In-Reply-To
<xmqqcyd0t6qx.fsf@gitster.g>
On 4/25/25 2:51 PM, Junio C Hamano wrote:
Show 12 quoted lines
> Eli Schwartz <eschwartz@gentoo.org> writes:
>> POSIX does not require a specific absolute file path for "sh", but it
>> does mandate that you have a shell and its name is "sh", whichever
>> directory it may be found in.
>> ...
>> There is (most of the time) not actually a program called "sh". Various
>> different programs may provide a symlink "sh", pointing to their own shell:
> 
> Exactly.  And with many systems being personal these days, /bin/sh
> may point at a shell that is better for interactive use (like
> "bash"), while the user may prefer another (like "dash") scripted
> use that is not pointed by that single /bin/sh symbolic link.

I would argue 100% of interactive bash users, are running "bash" to get it. They are not running "sh" and then rewriting all scripts in /usr/bin from

#!/bin/sh
to
#!/usr/bin/dash
for the speedup.

The point is that if users set the "non-interactive scripts" command /bin/sh to GNU bash, they are fine with that being used everywhere (and it will in fact run all Git's scripts well).

Show 5 quoted lines
> In any case, we live in real world where things are not strictly
> POSIX.  Our Makefile does support with SHELL_PATH "sh", "dash", and
> "bash" just fine.  Why shouldn't I wish for feature parity in a new
> build framework that aims to at least compete and become an
> alternative?

But it's a very fair point that it's possible to need more than just POSIX. Meson can override program lookup:

$ cat paths.ini

[binaries] sh = '/usr/bin/bash'

$ meson setup builddirbash/ --native-file=paths.ini
[...]
  Runtime executable paths
    perl        : /usr/bin/perl
    python      : /usr/bin/python3
    shell       : /usr/bin/bash

A dedicated build option might be more discoverable, but it's certainly possible to override this today. Autodetecting the right one can be tricky...

-- 
Eli Schwartz
Previous: Junio C HamanoNext: brian m. carlson
Message 25 of 31 in “meson: prefer '/bin/sh' over PATH lookup”
  1. 0/2 meson: prefer '/bin/sh' over PATH lookupPatrick Steinhardt, Apr 24, 2025
  2. 2/2 meson: prefer POSIX-specified shell pathPatrick Steinhardt, Apr 24, 2025
  3. Justin ToblerApr 24, 2025
  4. Patrick SteinhardtApr 25, 2025
  5. 1/2 meson: report detected runtime executable pathsPatrick Steinhardt, Apr 24, 2025
  6. Eli SchwartzApr 25, 2025
  7. Patrick SteinhardtApr 25, 2025
  8. Junio C HamanoApr 25, 2025
  9. Junio C HamanoApr 24, 2025
  10. Patrick SteinhardtApr 25, 2025
  11. 0/2 meson: prefer '/bin/sh' over PATH lookupPatrick Steinhardt, Apr 25, 2025
  12. 1/2 meson: report detected runtime executable pathsPatrick Steinhardt, Apr 25, 2025
  13. Toon ClaesApr 25, 2025
  14. 2/2 meson: prefer POSIX-specified shell pathPatrick Steinhardt, Apr 25, 2025
  15. Toon ClaesApr 25, 2025
  16. brian m. carlsonApr 25, 2025
  17. Patrick SteinhardtApr 25, 2025
  18. Toon ClaesApr 25, 2025
  19. 0/2 meson: prefer '/bin/sh' over PATH lookupPatrick Steinhardt, Apr 25, 2025
  20. 1/2 meson: report detected runtime executable pathsPatrick Steinhardt, Apr 25, 2025
  21. 2/2 meson: prefer shell at "/bin/sh"Patrick Steinhardt, Apr 25, 2025
  22. Junio C HamanoApr 25, 2025
  23. Eli SchwartzApr 25, 2025
  24. Junio C HamanoApr 25, 2025
  25. Eli SchwartzApr 25, 2025
  26. brian m. carlsonApr 25, 2025
  27. Eli SchwartzApr 25, 2025
  28. brian m. carlsonApr 25, 2025
  29. Junio C HamanoMay 2, 2025
  30. Eli SchwartzMay 2, 2025
  31. Patrick SteinhardtMay 5, 2025

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.