From f6a6d236f1d4c3aa3fea4b4f2e7fe029c471ecc0 Mon Sep 17 00:00:00 2001 From: Johnothan King Date: Sun, 5 Dec 2021 10:55:15 -0800 Subject: [PATCH] Port over illumos fixes for conf.sh (#361) This commit ports over two of Andy Fiddaman's bugfixes to conf.sh on illumos: - The compiler isn't passed on to an invocation of iffe. The bugfix is from this commit: - The getconf builtin is missing several parameters on illumos. Reproducer: $ /opt/ast/bin/getconf ADDRESS_WIDTH getconf: Invalid argument (ADDRESS_WIDTH) # Should output '64' This bug occurs because conf.sh expects GNU sed and fails to work properly with other sed implementations. The bugfix and original bug report can be found here: https://www.illumos.org/issues/14044 https://github.com/citrus-it/ast/commit/ba443cfd --- NEWS | 5 +++++ src/cmd/ksh93/include/version.h | 2 +- src/lib/libast/comp/conf.sh | 6 +++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 1189f6e56..aba476ca5 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,11 @@ For full details, see the git log at: https://github.com/ksh93/ksh Any uppercase BUG_* names are modernish shell bug IDs. +2021-12-05: + +- Fixed an issue on illumos that caused some parameters in the getconf + builtin to fail. + 2021-12-01: - Fixed a memory fault that occurred when a discipline function exited diff --git a/src/cmd/ksh93/include/version.h b/src/cmd/ksh93/include/version.h index c8403199f..b762d4ada 100644 --- a/src/cmd/ksh93/include/version.h +++ b/src/cmd/ksh93/include/version.h @@ -21,7 +21,7 @@ #define SH_RELEASE_FORK "93u+m" /* only change if you develop a new ksh93 fork */ #define SH_RELEASE_SVER "1.0.0-beta.2" /* semantic version number: https://semver.org */ -#define SH_RELEASE_DATE "2021-12-01" /* must be in this format for $((.sh.version)) */ +#define SH_RELEASE_DATE "2021-12-05" /* must be in this format for $((.sh.version)) */ #define SH_RELEASE_CPYR "(c) 2020-2021 Contributors to ksh " SH_RELEASE_FORK /* Scripts sometimes field-split ${.sh.version}, so don't change amount of whitespace. */ diff --git a/src/lib/libast/comp/conf.sh b/src/lib/libast/comp/conf.sh index 08bae2884..adde98f18 100644 --- a/src/lib/libast/comp/conf.sh +++ b/src/lib/libast/comp/conf.sh @@ -243,7 +243,7 @@ case $append$extra in ;; *" -$f- "*) ;; - *) if iffe -n - hdr $f | grep _hdr_$f >/dev/null + *) if iffe -c "$cc" -n - hdr $f | grep _hdr_$f >/dev/null then hdr="$hdr $f" headers=$headers$nl#include$sp'<'$1'>' else hdr="$hdr -$f-" @@ -382,8 +382,8 @@ sort -u > $tmp.f { sed \ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]/ /g' \ - -e 's/[ ][ ]*/\n/g' \ - `cat $tmp.f` 2>/dev/null | + -e 's/[ ][ ]*/%/g' \ + `cat $tmp.f` 2>/dev/null | tr '%' '\n' | \ egrep '^(SI|_(CS|PC|SC|SI))_.' case $CONF_getconf_a in ?*) $CONF_getconf $CONF_getconf_a | sed 's,[=: ].*,,'