diff --git a/.gitignore b/.gitignore index 0fb2e1ef3f89..b5b7054989e2 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,7 @@ FEATURE/ /src/lib/libdll/dlldefs.h # Miscellaneous artefacts +*.stackdump *.dSYM/ *.bak *.sav diff --git a/NEWS b/NEWS index 3d04ccabb65b..d45052569b01 100644 --- a/NEWS +++ b/NEWS @@ -2761,7 +2761,7 @@ Uppercase BUG_* IDs are shell bug IDs as used by the Modernish shell library. specifies and as all other POSIX shells do. To redirect standard output for reading and writing, you now need '1<>'. Ref.: https://github.com/att/ast/issues/75 - http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_07 + https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_07 2020-05-12: diff --git a/README.md b/README.md index 9c6dac4a6038..8ce4232b8a48 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ in performance. In addition, "sh" scripts can be run on KSH-93 without modification. The code should conform to the -[IEEE POSIX 1003.1 standard](http://www.opengroup.org/austin/papers/posix_faq.html) +[IEEE POSIX 1003.1 standard](https://www.opengroup.org/austin/papers/posix_faq.html) and to the proposed ANSI C standard so that it should be portable to all such systems. Like the previous version, KSH-88, it is designed to accept eight bit character sets transparently, thereby making it internationally diff --git a/bin/shtests b/bin/shtests index 5f28d0160c0e..40b2924564d1 100755 --- a/bin/shtests +++ b/bin/shtests @@ -1,6 +1,6 @@ # Wrapper script to run the ksh93 regression tests directly. # By Martijn Dekker 2020-05-14, 2023-03-17 -# Public domain. http://creativecommons.org/publicdomain/zero/1.0/ +# Public domain. https://creativecommons.org/publicdomain/zero/1.0/ # # The manual: bin/shtests --man # Brief help: bin/shtests --help diff --git a/src/cmd/INIT/README-mamake.md b/src/cmd/INIT/README-mamake.md index faff91bbf0b2..c48aa061c5cb 100644 --- a/src/cmd/INIT/README-mamake.md +++ b/src/cmd/INIT/README-mamake.md @@ -11,7 +11,7 @@ to be built using only a standard C compiler and utilities installation without any other dependencies or complications. MAM was designed by Glenn Fowler at AT&T. -The [original documentation](http://web.archive.org/web/20041227143022/http://www2.research.att.com/~gsf/mam/mam.html) +The [original documentation](https://web.archive.org/web/20041227143022/http://www2.research.att.com/~gsf/mam/mam.html) for MAM specified a more extensive language than was actually implemented in `mamake.c`, while the `ignore` attribute is not documented there. This file documents the MAM implementation that we are actually using. @@ -174,7 +174,7 @@ The `exec` command assigns the `generated` attribute to the current rule, even i `bind` `-l`*libraryname* [ `dontcare` ] -These commands are scanned for while sorting leaf directories for recurive +These commands are scanned for while sorting leaf directories for recursive building, and executed as normal commands while building the current directory. #### …while scanning and sorting leaf directories #### diff --git a/src/cmd/ksh93/data/builtins.c b/src/cmd/ksh93/data/builtins.c index 11d4adc579c6..794d5cf7e260 100644 --- a/src/cmd/ksh93/data/builtins.c +++ b/src/cmd/ksh93/data/builtins.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -1685,6 +1685,7 @@ const char sh_optksh[] = "was found on \bPATH\b but was not executable.]" "[+127?\b-c\b and \b-s\b were not specified and the command script " "corresponding to \aarg\a could not be found.]" + "[+128?An unrecoverable system or internal error occurred.]" "}" "[+SEE ALSO?\bset\b(1), \bbuiltin\b(1)]" diff --git a/src/cmd/ksh93/sh/parse.c b/src/cmd/ksh93/sh/parse.c index 151fb2c2973e..85a7b683b96a 100644 --- a/src/cmd/ksh93/sh/parse.c +++ b/src/cmd/ksh93/sh/parse.c @@ -164,7 +164,7 @@ static void typeset_order(const char *str,int line) } } -static int b_dummy(int argc, char *argv[], Shbltin_t *context) +static noreturn int b_dummy(int argc, char *argv[], Shbltin_t *context) { NOT_USED(argc); NOT_USED(argv[0]); diff --git a/src/cmd/ksh93/sh/path.c b/src/cmd/ksh93/sh/path.c index 20f5c165fe79..54f665db9ec3 100644 --- a/src/cmd/ksh93/sh/path.c +++ b/src/cmd/ksh93/sh/path.c @@ -1024,7 +1024,7 @@ pid_t path_spawn(const char *opath,char **argv, char **envp, Pathcomp_t *libpath char **xp=0, *xval, *libenv = (libpath?libpath->lib:0); Namval_t* np; char *s, *v; - int r, n, pidsize; + int r, n, pidsize=0; pid_t pid= -1; if(nv_search(opath,sh.bltin_tree,0)) { diff --git a/src/cmd/ksh93/tests/builtins.sh b/src/cmd/ksh93/tests/builtins.sh index 242d92f25d15..a6865c178132 100755 --- a/src/cmd/ksh93/tests/builtins.sh +++ b/src/cmd/ksh93/tests/builtins.sh @@ -1382,7 +1382,7 @@ exp='ok1ok2ok3ok4ok5ok6ok7ok8ok9ok10ok11ok12end' got=$( readonly v=foo exec 2>/dev/null # All the "special builtins" below should fail, and not exit, so 'print end' is reached. - # Ref.: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html + # Ref.: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html # Left out are 'command exec /dev/null/nonexistent', where no shell follows the standard, # as well as 'command exit' and 'command return', because, well, obviously. command : # # Martijn Dekker # +# Johnothan King # # # ######################################################################## @@ -533,7 +534,7 @@ test_glob '' a\\\\b.* test_glob '' $unquoted_patvar # ====== -# 93u+m/1.0.5 regression - glob expansion with brace expansion and parameter exapansion +# 93u+m/1.0.5 regression - glob expansion with brace expansion and parameter expansion v='./' mkdir -p bin/BAD sbin/WRONG ((SHOPT_BRACEPAT)) && test_glob '<./bin/*> <./sbin/*>' "./"{bin,sbin}"/*" diff --git a/src/cmd/ksh93/tests/path.sh b/src/cmd/ksh93/tests/path.sh index e831cdb9298b..fdacae0bc7b1 100755 --- a/src/cmd/ksh93/tests/path.sh +++ b/src/cmd/ksh93/tests/path.sh @@ -265,8 +265,11 @@ exp=$PWD/rm command -p mkdir bin print 'print ok' > bin/tst command -p chmod +x bin/tst -if [[ $(PATH=$PWD/bin tst 2>/dev/null) != ok ]] -then err_exit '(PATH=$PWD/bin foo) does not find $PWD/bin/foo' +exp=ok +got=$(PATH=$PWD/bin tst 2>&1) +if [[ $exp != "$got" ]] +then err_exit '"PATH=$PWD/bin tst" does not run $PWD/bin/tst' \ + "(expected $exp, got $(printf %q "$got"))" fi cd / if whence ls > /dev/null diff --git a/src/cmd/ksh93/tests/signal.sh b/src/cmd/ksh93/tests/signal.sh index c0abce4efdbd..e51cccfdf309 100755 --- a/src/cmd/ksh93/tests/signal.sh +++ b/src/cmd/ksh93/tests/signal.sh @@ -371,9 +371,15 @@ e=$? [[ $x == done ]] || err_exit "output failed -- expected 'done', got '$x'" (( SECONDS > .35 )) && err_exit "took $SECONDS seconds, expected around .2" -trap '' SIGBUS -[[ $($SHELL -c 'trap date SIGBUS; trap -p SIGBUS') ]] && err_exit 'SIGBUS should not have a trap' -trap -- - SIGBUS +# The test for SIGBUS trap handling below is incompatible with ASan because ASan +# implements its own SIGBUS handler independently of ksh. +if ! [[ -v ASAN_OPTIONS || -v TSAN_OPTIONS || -v MSAN_OPTIONS || -v LSAN_OPTIONS ]]; then + trap '' SIGBUS + got=$("$SHELL" -c 'trap date SIGBUS; trap -p SIGBUS') + [[ "$got" ]] && err_exit 'SIGBUS should not have a trap' \ + "(got $(printf %q "$got"))" + trap -- - SIGBUS +fi { x=$( diff --git a/src/lib/libast/RELEASE b/src/lib/libast/RELEASE index ce584a8ebfff..d14d6701bb4f 100644 --- a/src/lib/libast/RELEASE +++ b/src/lib/libast/RELEASE @@ -766,7 +766,7 @@ ____ vmalloc/vmbest.c: set /dev/zero mmap fd FD_CLOEXEC features/mmap: fix ancient read() vs. mmap() time arithmetic typo vmalloc/malloc.c: _AST_std_malloc==1 to force standard malloc -03-06-09 comp/omitted.c: add _imp__FUNCTION sybols for __CYGWIN__ static link +03-06-09 comp/omitted.c: add _imp__FUNCTION symbols for __CYGWIN__ static link vmalloc/vmbest.c: handle systems with sbrk() but no brk() 03-06-04 port/astconf.c: drop non-standard diagnostics 03-06-03 comp/conf.sh: rework symbol collision logic diff --git a/src/lib/libast/features/lib b/src/lib/libast/features/lib index 54b9d8108732..d2a505b73bf5 100644 --- a/src/lib/libast/features/lib +++ b/src/lib/libast/features/lib @@ -37,7 +37,7 @@ lib readlink,remove,rename,rewinddir,rmdir,setlocale lib setpgid,setpgrp,setpgrp2,setreuid,setsid,setuid,sigaction lib sigprocmask,sigsetmask,sigunblock,sigvec,socketpair lib spawn,spawnve -lib strcoll,strdup,strerror,strcasecmp,strncasecmp +lib strcoll,strdup,strerror,strcasecmp,strncasecmp,strlcat,strlcpy lib strmode,strxfrm,strftime,swab,symlink,sysconf,sysinfo lib telldir,tmpnam,tzset,universe,unlink,utime,wctype lib ftruncate,truncate diff --git a/src/lib/libast/man/sfio.3 b/src/lib/libast/man/sfio.3 index 05ee70f2fcdf..2e3ab93db3a4 100644 --- a/src/lib/libast/man/sfio.3 +++ b/src/lib/libast/man/sfio.3 @@ -1777,7 +1777,7 @@ Otherwise, \f3top\fP is pushed on top of the stack identified by \f3base\fP and \f3sfstack()\fP returns the \f3base\fP stream. .Ss " char* sfstruse(Sfio_t* f)" Makes the string in a Sfio string buffer ready for use -and makes the buffer ready for re-use. This is done by +and makes the buffer ready for reuse. This is done by writing a terminating 0 byte to the given .B SF_STRING buffer, setting the I/O position to the start of the buffer diff --git a/src/lib/libast/sfio/sfsetbuf.c b/src/lib/libast/sfio/sfsetbuf.c index c17dd2fa55f3..10b53ebf68fb 100644 --- a/src/lib/libast/sfio/sfsetbuf.c +++ b/src/lib/libast/sfio/sfsetbuf.c @@ -221,7 +221,7 @@ void* sfsetbuf(Sfio_t* f, /* stream to be buffered */ f->blksz = (size_t)st.st_blksize; #endif bufsize = 64 * 1024; -#ifdef MAP_TUPE +#ifdef MAP_TYPE if(S_ISDIR(st.st_mode) || (Sfoff_t)st.st_size < (Sfoff_t)SF_GRAIN) okmmap = 0; #endif diff --git a/src/lib/libsum/sum-sha2.c b/src/lib/libsum/sum-sha2.c index 676e4ccd987e..019643369f79 100644 --- a/src/lib/libsum/sum-sha2.c +++ b/src/lib/libsum/sum-sha2.c @@ -166,8 +166,8 @@ typedef uint64_t sha2_word64; /* Exactly 8 bytes */ * * NOTE: The naming of R and S appears backwards here (R is a SHIFT and * S is a ROTATION) because the SHA-256/384/512 description document - * (see http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf) uses this - * same "backwards" definition. + * uses this same "backwards" definition: + * https://web.archive.org/web/20050907174740/http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf */ /* Shift-right (used in SHA-256, SHA-384, and SHA-512): */