[oi-dev] shell/ksh93

Jim Klimov jimklimov at cos.ru
Tue Mar 30 09:24:59 UTC 2021


On March 29, 2021 5:55:46 PM UTC, "stes at PANDORA.BE" <stes at telenet.be> wrote:
>
>After upgrading an OI system to 
>
>consolidation/osnet/osnet-incorporation           0.5.11-2020.0.1.20430
>     i--
>developer/opensolaris/osnet                       0.5.11-2020.0.1.20430
>     i--
>
>the /bin/sh is now provided by shell/ksh93
>
>stat /bin/sh
>  File: /bin/sh -> i86/ksh93
>
>which is now in the shell/ksh93 package.
>
>Without changing anything else, when I build squeak-5 and run gmake
>REQUIRED_PACKAGES
>it automagically finds (perhaps via pkgdepend resolve) 
>
>REQUIRED_PACKAGES += shell/ksh93
>
>it did NOT find the old 
>
>-REQUIRED_PACKAGES += SUNWcs
>
>so I removed SUNWcs from the Makefile.  I did not even change
>
>shared-macros.mk:REQUIRED_PACKAGES += SUNWcs
>
>I thought first that perhaps a change of 'shared-macros.mk' would have
>been required, but apparently not.
>
>Then a publish of the package publishes with the following required
>packages:
>
>depend type=require
>fmri=pkg:/shell/ksh93 at 93.21.1.20120801-2020.0.1.20430
>depend type=require fmri=pkg:/system/library/math at 0.5.11-2020.0.1.20430
>depend type=require fmri=pkg:/system/library at 0.5.11-2020.0.1.20430
>
>so basically it replaced SUNWcs by shell/ksh93.
>
>I suspect that if I submit a new Pull Request (PR) for the squeak
>packages,
>the old:
>
># pkg contents -t depend squeak-4-nodisplay
>TYPE    FMRI
>require pkg:/SUNWcs at 0.5.11-2020.0.1.20416
>require pkg:/system/library/math at 0.5.11-2020.0.1.20416
>require pkg:/system/library at 0.5.11-2020.0.1.20416
>
>the old pkg:/SUNWcs will simply be replaced by the 'new'  shell/ksh93.
>
>I'm fine with this, I think it is more or less a design decision
>imposed by Illumos.org,
>unless OpenIndiana would somehow change/modify/undo or reject that
>illumos choice ...
>
>Perhaps one could argue that the package Korn shell is an odd
>dependency,
>for a package which simply delivers a few Bourne shell scripts
>(/bin/sh).
>
>However isn't that the logical consequence in some sense of delivering
>/bin/sh in shell/ksh93 ?
>
>David Stes
>
>_______________________________________________
>oi-dev mailing list
>oi-dev at openindiana.org
>https://openindiana.org/mailman/listinfo/oi-dev

I believe this is part of a bigger rearrangement that I campaigned for a decade ago, with the system shell /sbin/sh and the libs it needs moving out from /usr where it got put relatively late in Solaris 10/OpenSolaris days - which unlike earlier releases precluded easy runs without a /usr (e.g. to mount it later from a compressed dataset over a necessarily not-compressed but now small rootfs due to grub limitations back then, or using NFS, etc.).

The system (primarily programmatic and optimized for that) shell /sbin/sh is what recovery root user uses, and system-provided scripts (SMF methods...) should use AFAIK. In Solarish systems that is "dictated" to be a ksh variant. Historically it was also a static binary to stay cached in RAM and never fail if the disk gave out (oh the fun of running with bits that are still remembered but can no longer be read, if only to inspect and shutdown), but not any longer.

The default (primarily interactive) shell /bin/sh (with /bin being a symlink to /usr/bin lately) may be same or different (bash, dash are common choices that power-users can easily symlink). Userland scripts expecting a particular syntax may be better off saying so in the shebang ("I need ksh", "I use bash features") and not expect their current /bin/sh to handle anything beyond standard basic POSIX (no "local", "declare", arrays, maths, maybe even $(...) vs `...`, etc).

Then again, ksh also handles the baseline syntax, and is "guaranteed" to be present, so you can depend on it as a package if you don't care and not bloat the footprint. After all, if your package delivers scripts it should depend on *some* interpreter (which was until recently part of big SUNWcs wad). Kudos to AndyF et al for finally splitting that up.

Hope that helps,
Jim Klimov


--
Typos courtesy of K-9 Mail on my Android



More information about the oi-dev mailing list