tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Proposed update to bmake-20240711



At Fri, 12 Jul 2024 08:29:04 -0700, Simon Gerraty <sjg%crufty.net@localhost> wrote:
Subject: Re: Proposed update to bmake-20240711
>
> I build every bmake release on Darwin and all tests pass.
> It is just using /bin/sh which does not appear to be an alias for any of
> the others:
>
> : sjg; ls -l /bin/*sh
> -r-xr-xr-x  1 root  wheel  1326752 May  2 14:33 /bin/bash
> -rwxr-xr-x  2 root  wheel  1153408 May  2 14:33 /bin/csh
> -rwxr-xr-x  1 root  wheel   307248 May  2 14:33 /bin/dash
> -r-xr-xr-x  1 root  wheel  2598896 May  2 14:33 /bin/ksh
> -rwxr-xr-x  1 root  wheel   134000 May  2 14:33 /bin/sh
> -rwxr-xr-x  2 root  wheel  1153408 May  2 14:33 /bin/tcsh
> -rwxr-xr-x  1 root  wheel  1377520 May  2 14:33 /bin/zsh

/bin/sh on macos isn't an alias, it's a wrapper, as revealed by strings,
and as is documented in sh(1):

$ ll /bin/*sh
1368 -r-xr-xr-x  1 root  wheel  restricted,compressed 1310352 May  7 00:01 /bin/bash
1048 -rwxr-xr-x  2 root  wheel  restricted,compressed 1136896 May  7 00:01 /bin/csh
 224 -rwxr-xr-x  1 root  wheel  restricted,compressed  274480 May  7 00:01 /bin/dash
2744 -r-xr-xr-x  1 root  wheel  restricted,compressed 2582512 May  7 00:01 /bin/ksh
  24 -rwxr-xr-x  1 root  wheel  restricted,compressed  101232 May  7 00:01 /bin/sh
1048 -rwxr-xr-x  2 root  wheel  restricted,compressed 1136896 May  7 00:01 /bin/tcsh
1472 -rwxr-xr-x  1 root  wheel  restricted,compressed 1361200 May  7 00:01 /bin/zsh

$ strings /bin/sh
@(#)PROGRAM:sh  PROJECT:dash-12
/bin/bash
/bin/dash
/bin/zsh
/private/var/select/sh
Error opening %s: %s
Unrecognized shell referenced in %s: %s
Failed to exec %s as variant for /bin/sh (%d: %s).
 Falling back to %s.
Failed to exec %s as variant for /bin/sh (%d: %s).

As you can guess from the strings output it is controlled by a symlink
in /var/select:

$ ll /private/var/select/sh
0 lrwxr-xr-x  1 root  wheel  - 9 May  7 00:01 /private/var/select/sh -> /bin/bash


As an aside I have a series of functions at the top of my ~/.shrc which
can, within some limits(*), test which kind of shell
is running them, at least within the range of shells I typically might
try to use as my login shell on any given type of system (which notably
has never included Zsh):

	https://github.com/robohack/dotfiles/blob/master/.shrc

(*) they're mostly designed to control which features of my ~/.profile
et al are enabled.

Note the is_ksh function is the most lax and generally just means
"ksh-like".  It doesn't think zsh is suitable, on purpose.  Indeed all
but one of the other functions don't like the current zsh (in default
modes) on macos either, though is_ash is "fooled" by it (though is_ash
is the least well tested).


On macos I use /bin/ksh as my login shell, but as you can see above I
keep /bin/sh pointed at /bin/bash as that's been the most reliable
combination for me.

--
					Greg A. Woods <gwoods%acm.org@localhost>

Kelowna, BC     +1 250 762-7675           RoboHack <woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost>     Avoncote Farms <woods%avoncote.ca@localhost>

Attachment: pgpFvd23LVcZi.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index