mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 11:42:21 +00:00
New semantic versioning scheme; disable vmalloc in release builds
As of this commit, ksh 93u+m has a standard semantic version number <https://semver.org/>, beginning with 1.0.0-alpha. This is added to the version string in a way that should be compatible with scripts parsing ${.sh.version} or $(ksh --version). This addition does not replace the release date and does not affect $((.sh.version)). For non-release builds, the version string will be: FORK/VERSION+HASH YYYY-MM-DD e.g.: 93u+m/1.0.0-alpha+41ef7f76 2021-01-03 For release builds, it will be: FORK/VERSION YYYY-MM-DD e.g.: 93u+m/1.0.0 2021-01-03 It is now automatically decided by bin/package whether to build a release or development build. When building from a directory that is not a git repository, or if the current git branch name starts with a number (e.g. '1.0'), the release build is enabled; otherwise a development build is the default. This is arranged by adding -D flags to $CCFLAGS as described below. These flags are prepended to $CCFLAGS, so they can be overridden by adding your own -D or -U flags via the environment. In addition, AST vmalloc is disabled for release builds as of this commit, forcing the use of the OS's standard malloc(3). In 2021, this is generally more reliable, faster, and more economical with memory than AST vmalloc. Several memory leaks and crashing bugs are avoided, e.g.: <https://github.com/ksh93/ksh/issues/95>. For development builds, vmalloc stays enabled (along with its known bugs) because this allows the use of the vmstat builtin, making it much more efficient to test for memory leaks. For more info, see the regression test script: src/cmd/ksh93/tests/leaks.sh bin/package, src/cmd/INIT/package.sh: - Add flags for build type. In $CCFLAGS, define _AST_ksh_release if we're not on any git branch or on a git branch whose name starts with a number. Otherwise, define _AST_git_commit as the first 8 characters of the current git commit hash. src/lib/libast/features/vmalloc: - If _AST_ksh_release is defined, disable vmalloc and force use of the operating system's malloc. Discussion: https://github.com/ksh93/ksh/issues/95 src/cmd/ksh93/include/version.h: - Define new format for version string, adding a semantic version number as well as (for non-release builds) the git commit hash. src/cmd/ksh93/sh/init.c: e_version[]: - Add a 'v' to the ${.sh.version} feature string if ksh was compiled with vmalloc enabled. This allows scripts, such as regression tests, to detect this. src/cmd/ksh93/data/builtins.c: sh_optksh[]: - Add a copyright line crediting the contributors to ksh 93u+m. Resolves: https://github.com/ksh93/ksh/issues/95
This commit is contained in:
parent
41ef7f76cf
commit
3567220898
6 changed files with 60 additions and 2 deletions
19
bin/package
19
bin/package
|
@ -5411,6 +5411,25 @@ license)# all work in $PACKAGESRC/LICENSES
|
||||||
;;
|
;;
|
||||||
|
|
||||||
make|view)
|
make|view)
|
||||||
|
# Add flags for build type
|
||||||
|
case `git branch 2>/dev/null` in
|
||||||
|
'' | *\*\ [0-9]*.[0-9]*)
|
||||||
|
# If we're not on a git branch (tarball) or on a branch that starts
|
||||||
|
# with a number (release branch), then compile as a release version
|
||||||
|
CCFLAGS="-D_AST_ksh_release${CCFLAGS:+ $CCFLAGS}" # prefix it to allow override with -U
|
||||||
|
export CCFLAGS
|
||||||
|
;;
|
||||||
|
*) # Otherwise, add 8-character git commit hash if available, and if the working dir is clean
|
||||||
|
git_commit=`git status >/dev/null 2>&1 && git diff-index --quiet HEAD && git rev-parse --short=8 HEAD`
|
||||||
|
case $git_commit in
|
||||||
|
????????)
|
||||||
|
CCFLAGS="-D_AST_git_commit=\\\"$git_commit\\\"${CCFLAGS:+ $CCFLAGS}"
|
||||||
|
export CCFLAGS
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
unset git_commit
|
||||||
|
;;
|
||||||
|
esac
|
||||||
# Hack to build on some systems that need an explicit link with libm due to a bug in the build system
|
# Hack to build on some systems that need an explicit link with libm due to a bug in the build system
|
||||||
case `uname` in
|
case `uname` in
|
||||||
NetBSD | SunOS)
|
NetBSD | SunOS)
|
||||||
|
|
|
@ -5410,6 +5410,25 @@ license)# all work in $PACKAGESRC/LICENSES
|
||||||
;;
|
;;
|
||||||
|
|
||||||
make|view)
|
make|view)
|
||||||
|
# Add flags for build type
|
||||||
|
case `git branch 2>/dev/null` in
|
||||||
|
'' | *\*\ [0-9]*.[0-9]*)
|
||||||
|
# If we're not on a git branch (tarball) or on a branch that starts
|
||||||
|
# with a number (release branch), then compile as a release version
|
||||||
|
CCFLAGS="-D_AST_ksh_release${CCFLAGS:+ $CCFLAGS}" # prefix it to allow override with -U
|
||||||
|
export CCFLAGS
|
||||||
|
;;
|
||||||
|
*) # Otherwise, add 8-character git commit hash if available, and if the working dir is clean
|
||||||
|
git_commit=`git status >/dev/null 2>&1 && git diff-index --quiet HEAD && git rev-parse --short=8 HEAD`
|
||||||
|
case $git_commit in
|
||||||
|
????????)
|
||||||
|
CCFLAGS="-D_AST_git_commit=\\\"$git_commit\\\"${CCFLAGS:+ $CCFLAGS}"
|
||||||
|
export CCFLAGS
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
unset git_commit
|
||||||
|
;;
|
||||||
|
esac
|
||||||
# Hack to build on some systems that need an explicit link with libm due to a bug in the build system
|
# Hack to build on some systems that need an explicit link with libm due to a bug in the build system
|
||||||
case `uname` in
|
case `uname` in
|
||||||
NetBSD | SunOS)
|
NetBSD | SunOS)
|
||||||
|
|
|
@ -1486,6 +1486,7 @@ USAGE_LICENSE
|
||||||
const char sh_optksh[] =
|
const char sh_optksh[] =
|
||||||
"+[-1?\n@(#)$Id: sh (AT&T Research) "SH_RELEASE" $\n]"
|
"+[-1?\n@(#)$Id: sh (AT&T Research) "SH_RELEASE" $\n]"
|
||||||
USAGE_LICENSE
|
USAGE_LICENSE
|
||||||
|
"[-copyright?(c) 2020-2021 Contributors to ksh " SH_RELEASE_FORK "]"
|
||||||
"[+NAME?\b\f?\f\b - Shell, the standard command language interpreter]"
|
"[+NAME?\b\f?\f\b - Shell, the standard command language interpreter]"
|
||||||
"[+DESCRIPTION?\b\f?\f\b is a command language interpreter that "
|
"[+DESCRIPTION?\b\f?\f\b is a command language interpreter that "
|
||||||
"executes commands read from a command line string, the "
|
"executes commands read from a command line string, the "
|
||||||
|
|
|
@ -17,4 +17,19 @@
|
||||||
* David Korn <dgk@research.att.com> *
|
* David Korn <dgk@research.att.com> *
|
||||||
* *
|
* *
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
#define SH_RELEASE "93u+m 2021-01-03"
|
|
||||||
|
#define SH_RELEASE_FORK "93u+m" /* only change if you develop a new ksh93 fork */
|
||||||
|
#define SH_RELEASE_SVER "1.0.0-alpha" /* semantic version number: https://semver.org */
|
||||||
|
#define SH_RELEASE_DATE "2021-01-03" /* must be in this format for $((.sh.version)) */
|
||||||
|
|
||||||
|
/* Scripts sometimes field-split ${.sh.version}, so don't change amount of whitespace. */
|
||||||
|
/* Arithmetic $((.sh.version)) uses the last 10 chars, so the date must be at the end. */
|
||||||
|
#if _AST_ksh_release
|
||||||
|
# define SH_RELEASE SH_RELEASE_FORK "/" SH_RELEASE_SVER " " SH_RELEASE_DATE
|
||||||
|
#else
|
||||||
|
# ifdef _AST_git_commit
|
||||||
|
# define SH_RELEASE SH_RELEASE_FORK "/" SH_RELEASE_SVER "+" _AST_git_commit " " SH_RELEASE_DATE
|
||||||
|
# else
|
||||||
|
# define SH_RELEASE SH_RELEASE_FORK "/" SH_RELEASE_SVER "+dev " SH_RELEASE_DATE
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
|
@ -107,6 +107,10 @@ char e_version[] = "\n@(#)$Id: Version "
|
||||||
#define ATTRS 1
|
#define ATTRS 1
|
||||||
"R"
|
"R"
|
||||||
#endif
|
#endif
|
||||||
|
#if !_std_malloc && !_AST_std_malloc
|
||||||
|
#define ATTRS 1
|
||||||
|
"v" /* uses vmalloc */
|
||||||
|
#endif
|
||||||
#if ATTRS
|
#if ATTRS
|
||||||
" "
|
" "
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -207,7 +207,7 @@ tst malloc_hook note{ gnu malloc hooks work }end execute{
|
||||||
|
|
||||||
cat{
|
cat{
|
||||||
#include "FEATURE/mmap"
|
#include "FEATURE/mmap"
|
||||||
#if _BLD_INSTRUMENT || cray || _UWIN && _BLD_ast
|
#if _AST_ksh_release || _BLD_INSTRUMENT || cray || _UWIN && _BLD_ast
|
||||||
#undef _map_malloc
|
#undef _map_malloc
|
||||||
#define _std_malloc 1 /* defer to standard malloc */
|
#define _std_malloc 1 /* defer to standard malloc */
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue