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

Re: [PATCH] contrib: Replaced /bin/sh with /bin/bash to make scripts with Bash syntax work on Solaris.

From
GTGreg Troxel <gdt@ir.bbn.com>
Date
Aug 10, 2010, 12:33 UTC
Message-ID
<rmiy6cezlyf.fsf@fnord.ir.bbn.com>
In-Reply-To
<7vmxsv7n3d.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
> Asgeir Storesund Nilsen <asgeir@twingine.no> writes:
>
>> I absolutely agree on the idea of using pure POSIX, but in reality I guess
>> most of both developer and user base are using (GNU/)Linux and thus an
>> environment where /bin/sh is in fact Bash?

The various BSDs have shells that are not bash, but which are believed to be fully POSIX-compliant. Putting #!/bin/bash in scripts is nonportable and just creates work for packagers to undo this.

> For example, dash is a much lighter alternative than bash, and groks POSIX
> fine.

I believe that some GNU/Linux distributions have a /bin/sh that is not bash. Plus there is the /bin/sh on BSD, which is vastly smaller even if one counts libedit:

   text    data     bss     dec     hex filename
 109602    1192    5836  116630   1c796 /bin/sh
   text    data     bss     dec     hex filename
  96523    4248    7488  108259   1a6e3 /lib/libedit.so.2.11
   text    data     bss     dec     hex filename
 716381   18328   11880  746589   b645d /usr/pkg/bin/bash
> I think a safer assumption is that /bin/sh is POSIX, and we make sure that
> the builder can countermand it with SHELL_PATH; as platforms whose /bin/sh
> is _not_ POSIX does not have to have bash as /bin/bash but somewhere else
> (e.g. /usr/local/bin/bash).
Agreed.  The current sources work well on NetBSD w.r.t. sh usage.
Previous: Junio C Hamano
Message 7 of 7 in “contrib: Replaced /bin/sh with /bin/bash to make scripts with Bash syntax work on Solaris.”
  1. contrib: Replaced /bin/sh with /bin/bash to make scripts with Bash syntax work on Solaris.Asgeir S. Nilsen, Aug 6, 2010
  2. Junio C HamanoAug 6, 2010
  3. Jonathan NiederAug 8, 2010
  4. Junio C HamanoAug 9, 2010
  5. Jonathan NiederAug 9, 2010
  6. Junio C HamanoAug 9, 2010
  7. Greg TroxelAug 10, 2010

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.