From 7cdb01f62510b6fb627bb517c3713d13ebf8b542 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Thu, 16 Dec 2021 08:48:06 +0100 Subject: [PATCH] New selection of default libcmd /opt/ast/bin built-ins Note that this is only about the /opt/ast/bin built-in commands, not about the regular pathless builtins such as printf. To use these, either add /opt/ast/bin to your $PATH or use a command like 'builtin cp'. As usual, --man provides info. Removed as defaults for lack of convincing advantages over the OS's external commands: - chmod, cmp, head, logname, mkdir, sync, uname, wc Remain as useful defaults: - basename, cat, cut, dirname. These are commonly used in performance-sensitive code paths in scripts and having them as built-ins can be good for performance. - getconf: This is the only interface to some libast internals that is available to ksh. It's also has better functionality than most OS-shipped 'getconf' commands, e.g., it can list and query all the configuration values. Added as defaults: - cp, ln, mv: Having these built in can speed up scripts that manage files. Also the AST versions have extended functionality (see cp --man, etc.). - mktemp: External mktemp commands vary too widely and are incompatible, but it's important that scripts can securely make temporary files, so it's good to ship a known interface to this functionality. As a result, the statically linked ksh binary is very slightly smaller than before. Resolves: https://github.com/ksh93/ksh/issues/349 --- NEWS | 6 ++++++ src/cmd/ksh93/data/builtins.c | 16 ++++++---------- src/cmd/ksh93/include/version.h | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index 70fbf10eb..3baa35769 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,12 @@ For full details, see the git log at: https://github.com/ksh93/ksh Any uppercase BUG_* names are modernish shell bug IDs. +2021-12-16: + +- Changed the default selection of compiled-in /opt/ast/bin built-in libcmd + command to: basename, cat, cp, cut, dirname, getconf, ln, mktemp, mv. + Add /opt/ast/bin to your $PATH to use these. Type 'cp --man', etc. for info. + 2021-12-13: - Fixed a bug introduced on 2020-08-09 that prevented '.' and '..' from diff --git a/src/cmd/ksh93/data/builtins.c b/src/cmd/ksh93/data/builtins.c index df28b9bd8..139392c03 100644 --- a/src/cmd/ksh93/data/builtins.c +++ b/src/cmd/ksh93/data/builtins.c @@ -135,18 +135,14 @@ const struct shtable3 shtab_builtins[] = #include SHOPT_CMDLIB_HDR #else CMDLIST(basename) - CMDLIST(chmod) + CMDLIST(cat) + CMDLIST(cp) + CMDLIST(cut) CMDLIST(dirname) CMDLIST(getconf) - CMDLIST(head) - CMDLIST(mkdir) - CMDLIST(logname) - CMDLIST(cat) - CMDLIST(cmp) - CMDLIST(cut) - CMDLIST(uname) - CMDLIST(wc) - CMDLIST(sync) + CMDLIST(ln) + CMDLIST(mktemp) + CMDLIST(mv) #if !_std_malloc && !_AST_std_malloc CMDLIST(vmstate) /* vmstate only works with vmalloc */ #endif diff --git a/src/cmd/ksh93/include/version.h b/src/cmd/ksh93/include/version.h index b6e14fdba..7e0d8673c 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-13" /* must be in this format for $((.sh.version)) */ +#define SH_RELEASE_DATE "2021-12-16" /* 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. */