diff options
author | Andy Fiddaman <omnios@citrus-it.co.uk> | 2020-12-27 17:47:37 +0000 |
---|---|---|
committer | Andy Fiddaman <omnios@citrus-it.co.uk> | 2021-01-30 17:13:33 +0000 |
commit | b30d193948be5a7794d7ae3ba0ed9c2f72c88e0f (patch) | |
tree | 6a37e590faffb9bb9af66887de645c546445036c /usr/src/lib/libshell/common/features | |
parent | df36e06d12cbf655ddf22339ef8c39fa2b83ebf8 (diff) | |
download | illumos-joyent-b30d193948be5a7794d7ae3ba0ed9c2f72c88e0f.tar.gz |
13405 ksh93 update to 2012-08-01
13434 sh: mishandles backslash as last character of a block of input
11750 ksh mkdir builtin doesn't honor special file permissions
9199 ksh93 builtin *grep -v mishandles blank lines, blows up libgcrypt-config
6756 sh (and ksh) have issues with ${1+"$@"}
6520 ksh: sleep could wait forever
4860 ksh93: core in printf
3791 /bin/sh's builtin 'rm' busted: 'rm -f' without arguments returns error
1047 ksh overwrites child core files
880 ksh93 coredumps on 'unset'
499 "interrupted system call" when using "tee" builtin in ksh
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
Reviewed by: Dominik Hassler <hadfl@omnios.org>
Approved by: Rich Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src/lib/libshell/common/features')
-rw-r--r-- | usr/src/lib/libshell/common/features/cmds | 1 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/features/dynamic | 12 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/features/externs | 13 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/features/locale | 25 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/features/math | 4 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/features/math.sh | 189 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/features/options | 47 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/features/poll | 155 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/features/rlimits | 3 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/features/setjmp | 18 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/features/sigfeatures | 49 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/features/time | 35 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/features/ttys | 3 |
13 files changed, 0 insertions, 554 deletions
diff --git a/usr/src/lib/libshell/common/features/cmds b/usr/src/lib/libshell/common/features/cmds deleted file mode 100644 index 106198caa1..0000000000 --- a/usr/src/lib/libshell/common/features/cmds +++ /dev/null @@ -1 +0,0 @@ -cmd newgrp,test,id,wc,cut,logname,universe,pfexec,tput diff --git a/usr/src/lib/libshell/common/features/dynamic b/usr/src/lib/libshell/common/features/dynamic deleted file mode 100644 index 33f2d138e9..0000000000 --- a/usr/src/lib/libshell/common/features/dynamic +++ /dev/null @@ -1,12 +0,0 @@ -cat{ - #if SHOPT_DYNAMIC - #include <dlldefs.h> - #endif - #if !defined(SHOPT_FS_3D) && SHOPT_DYNAMIC - # define SHOPT_FS_3D 1 - #endif /* !SHOPT_FS_3D */ - #if SHOPT_FS_3D - # undef mount - # include <fs3d.h> - #endif /* SHOPT_FS_3D */ -}end diff --git a/usr/src/lib/libshell/common/features/externs b/usr/src/lib/libshell/common/features/externs deleted file mode 100644 index bc267591d8..0000000000 --- a/usr/src/lib/libshell/common/features/externs +++ /dev/null @@ -1,13 +0,0 @@ -set prototyped -hdr nc,exec_attr -mem exception.name,_exception.name math.h -lib setreuid,setregid,nice,fork,spawnveg,fchdir -lib pathnative,pathposix,uwin_path,uwin_unpath,fts_notify -lib memcntl sys/mman.h -lib getexecuser,free_execattr exec_attr.h -lsecdb - -reference unistd.h - -extern nice int (int) -extern setreuid int (uid_t,uid_t) -extern setregid int (gid_t,gid_t) diff --git a/usr/src/lib/libshell/common/features/locale b/usr/src/lib/libshell/common/features/locale deleted file mode 100644 index ee9bcae6fe..0000000000 --- a/usr/src/lib/libshell/common/features/locale +++ /dev/null @@ -1,25 +0,0 @@ -hdr locale,wchar -lib locale,localeconv,wctype,iswctype,iswblank -cat{ - #if _PACKAGE_ast - # undef _hdr_locale - # define _hdr_locale 1 - #else - # ifdef _hdr_locale - # include <locale.h> - # ifndef LC_MESSAGES - # define LC_MESSAGES LC_ALL - # endif /* LC_MESSAGES */ - # endif /* _hdr_locale */ - #endif /* _PACKAGE_ast */ - #ifdef _hdr_locale - # ifdef _lib_localeconv - static struct lconv *lp; - # define GETDECIMAL(x) (((lp=localeconv()) && lp->decimal_point && *lp->decimal_point) ? *lp->decimal_point : '.' ) - # else - # define GETDECIMAL(x) ('.') - # endif /* _lib_localeconv */ - #else - # define GETDECIMAL(x) ('.') - #endif /* _hdr_locale */ -}end diff --git a/usr/src/lib/libshell/common/features/math b/usr/src/lib/libshell/common/features/math deleted file mode 100644 index 2a720e673c..0000000000 --- a/usr/src/lib/libshell/common/features/math +++ /dev/null @@ -1,4 +0,0 @@ -lib,npt absl,acosl,acoshl,asinl,asinhl,atanl,atan2l,expl,cosl,coshl math.h -lib,npt fabsl,powl,hypotl,fmodl,logl,sinl,sinhl,sqrtl,tanl,tanhl math.h -lib,npt strtold,isinf,isinfl,isnan,isnanl,isnormal,isnormall math.h -lib,npt finite,finitel,isfinite math.h diff --git a/usr/src/lib/libshell/common/features/math.sh b/usr/src/lib/libshell/common/features/math.sh deleted file mode 100644 index b06fcefbb2..0000000000 --- a/usr/src/lib/libshell/common/features/math.sh +++ /dev/null @@ -1,189 +0,0 @@ -######################################################################## -# # -# This software is part of the ast package # -# Copyright (c) 1982-2010 AT&T Intellectual Property # -# and is licensed under the # -# Common Public License, Version 1.0 # -# by AT&T Intellectual Property # -# # -# A copy of the License is available at # -# http://www.opensource.org/licenses/cpl1.0.txt # -# (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) # -# # -# Information and Software Systems Research # -# AT&T Research # -# Florham Park NJ # -# # -# David Korn <dgk@research.att.com> # -# # -######################################################################## -: generate the ksh math builtin table -: include math.tab - -# @(#)math.sh (AT&T Research) 2009-08-18 - -command=$0 -iffeflags="-n -v" -iffehdrs="math.h ieeefp.h" -iffelibs="-lm" -table=/dev/null - -eval $1 -shift -table=$1 - -names= -tests= - -: check long double - -eval `iffe $iffeflags -c "$cc" - typ long.double 2>&$stderr` - -: check ast_standards.h - -eval `iffe $iffeflags -F ast_standards.h -c "$cc" - tst use_ast_standards -lm 'note{' 'math.h needs ast_standards.h' '}end' 'link{' '#include <math.h>' '#ifndef isgreater' '#define isgreater(a,b) 0' '#endif' 'int main() { return isgreater(0.0,1.0); }' '}end'` -case $_use_ast_standards in -1) iffeflags="$iffeflags -F ast_standards.h" ;; -esac - -: read the table - -exec < $table -while read type args name aka comment -do case $type in - [fi]) names="$names $name" - tests="$tests,$name" - case $_typ_long_double in - 1) tests="$tests,${name}l" ;; - esac - eval TYPE_$name=$type ARGS_$name=$args AKA_$name=$aka - ;; - esac -done - -: check the math library - -eval `iffe $iffeflags -c "$cc" - lib $tests $iffehdrs $iffelibs 2>&$stderr` -lib= -for name in $names -do eval x='$'_lib_${name}l y='$'_lib_${name} - case $x in - 1) lib="$lib,${name}l" ;; - esac - case $y in - 1) case $x in - '') lib="$lib,${name}" ;; - esac - ;; - esac -done -eval `iffe $iffeflags -c "$cc" - dat,npt,mac $lib $iffehdrs $iffelibs 2>&$stderr` - -cat <<! -#pragma prototyped - -/* : : generated by $command from $table : : */ - -typedef Sfdouble_t (*Math_f)(Sfdouble_t,...); - -! -case $_use_ast_standards in -1) echo "#include <ast_standards.h>" ;; -esac -echo "#include <math.h>" -case $_hdr_ieeefp in -1) echo "#include <ieeefp.h>" ;; -esac -echo - -: generate the intercept functions and table entries - -nl=' -' -ht=' ' -tab= -for name in $names -do eval x='$'_lib_${name}l y='$'_lib_${name} r='$'TYPE_${name} a='$'ARGS_${name} aka='$'AKA_${name} - case $x:$y in - 1:*) f=${name}l - t=Sfdouble_t - local= - ;; - *:1) f=${name} - t=double - local=$_typ_long_double - ;; - *) case $aka in - *=*) f=${aka%%=*} - v=${aka#*=} - eval x='$'_lib_${f}l y='$'_lib_${f} - case $x:$y in - 1:*) f=${f}l - ;; - *:1) ;; - *) continue - ;; - esac - L=local_$name r=int R=1 - echo "#ifdef $v${nl}static $r $L(Sfdouble_t x) { return $f(x) == $v; }${nl}#endif" - tab="$tab$nl#ifdef $v$nl$ht\"\\0${R}${a}${name}\",$ht(Math_f)${L},${nl}#endif" - ;; - esac - continue - ;; - esac - eval n='$'_npt_$f m='$'_mac_$f d='$'_dat_$f - case $r in - i) L=int r=int R=1 ;; - *) L=Sfdouble_t r=$t R=0 ;; - esac - case $d:$m:$n in - 1:*:*|*:1:*) - ;; - *:*:1) code="extern $r $f(" - sep= - for p in 1 2 3 4 5 6 7 - do code="$code${sep}$t" - case $a in - $p) break ;; - esac - sep="," - done - code="$code);" - echo "$code" - ;; - esac - case $local:$m:$n:$d in - 1:*:*:*|*:1:*:*|*:*:1:) - args= - code="static $L local_$f(" - sep= - for p in 1 2 3 4 5 6 7 8 9 - do args="$args${sep}a$p" - code="$code${sep}Sfdouble_t a$p" - case $a in - $p) break ;; - esac - sep="," - done - code="$code){return $f($args);}" - echo "$code" - f=local_$f - ;; - esac - for x in $name $aka - do tab="$tab$nl$ht\"\\0${R}${a}${x}\",$ht(Math_f)$f," - done -done -tab="$tab$nl$ht\"\",$ht$ht(Math_f)0" - -cat <<! - -/* - * first byte is two-digit octal number. Last digit is number of args - * first digit is 0 if return value is double, 1 for integer - */ -const struct mathtab shtab_math[] = -{$tab -}; -! diff --git a/usr/src/lib/libshell/common/features/options b/usr/src/lib/libshell/common/features/options deleted file mode 100644 index c3f48b64d4..0000000000 --- a/usr/src/lib/libshell/common/features/options +++ /dev/null @@ -1,47 +0,0 @@ -# SHOPT_* option probe - -tst cross{ - : check for shell magic #! - cat > /tmp/file$$ <<! - #! /bin/echo - exit 1 - ! - chmod 755 /tmp/file$$ - if /tmp/file$$ > /dev/null - then echo "#define SHELLMAGIC 1" - fi - rm -f /tmp/file$$ - - option() # name value - { - case $2 in - 0) echo "#ifndef SHOPT_$1" - echo "# define SHOPT_$1 1" - echo "#endif" - ;; - *) echo "#undef SHOPT_$1" - ;; - esac - } - - ls /dev/fd/9 9<&0 >/dev/null 2>&1 - option DEVFD $? - exec 9<&- - case `echo a | tr a '\012' | wc -l` in - *1*) option MULTIBYTE 0 ;; - esac - test -x /bin/pfexec -o -x /usr/bin/pfexec - option PFSH $? - /bin/test ! -l . 2> /dev/null - option TEST_L $? - test -f /etc/ksh.kshrc -o -f /etc/bash.bashrc && - option SYSRC 0 - test -f /bin/universe && univ=`/bin/universe` > /dev/null 2>&1 -a ucb = "$univ" - option UCB $? -}end - -cat{ - #if !_PACKAGE_ast && ( (MB_LEN_MAX-1)<=0 || !defined(_lib_mbtowc) ) - # undef SHOPT_MULTIBYTE - #endif -}end diff --git a/usr/src/lib/libshell/common/features/poll b/usr/src/lib/libshell/common/features/poll deleted file mode 100644 index 6fa8fb308c..0000000000 --- a/usr/src/lib/libshell/common/features/poll +++ /dev/null @@ -1,155 +0,0 @@ -hdr,sys poll,socket,netinet/in -lib select,poll,socket -lib htons,htonl sys/types.h sys/socket.h netinet/in.h -lib getaddrinfo sys/types.h sys/socket.h netdb.h -typ fd_set sys/socket.h sys/select.h -tst pipe_socketpair note{ use socketpair() for peekable pipe() }end execute{ - #include <ast.h> - #include <signal.h> - #include <sys/types.h> - #include <sys/socket.h> - #ifndef SHUT_RD - #define SHUT_RD 0 - #endif - #ifndef SHUT_WR - #define SHUT_WR 1 - #endif - static void handler(sig) - int sig; - { - _exit(0); - } - int main() - { - int n; - int pfd[2]; - int sfd[2]; - char buf[256]; - pid_t pid; - static char msg[] = "hello world\n"; - close(0); - if (pipe(pfd) < 0 || - socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0 || - shutdown(sfd[1], SHUT_RD) < 0 || - shutdown(sfd[0], SHUT_WR) < 0) - return(1); - if ((pid = fork()) < 0) - return(1); - if (pid) - { - close(pfd[1]); - close(sfd[1]); - wait(&n); - if (sfpkrd(pfd[0], buf, sizeof(buf), '\n', -1, 1) >= 0 || - sfpkrd(sfd[0], buf, sizeof(buf), '\n', -1, 1) < 0) - return(1); - } - else - { - close(pfd[0]); - close(sfd[0]); - write(pfd[1], msg, sizeof(msg) - 1); - write(sfd[1], msg, sizeof(msg) - 1); - return(0); - } - close(pfd[0]); - close(sfd[0]); - signal(SIGPIPE, handler); - if (socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0 || - shutdown(sfd[1], SHUT_RD) < 0 || - shutdown(sfd[0], SHUT_WR) < 0) - return(1); - close(sfd[0]); - write(sfd[1], msg, sizeof(msg) - 1); - return(1); - } -}end -tst socketpair_devfd note{ /dev/fd/N handles socketpair() }end execute{ - #include <ast.h> - #include <fs3d.h> - #include <sys/types.h> - #include <sys/socket.h> - int main() - { - int devfd; - int n; - int sfd[2]; - fs3d(FS3D_OFF); - close(0); - open("/dev/null", O_RDONLY); - if ((n = open("/dev/fd/0", O_RDONLY)) < 0) - return(1); - close(n); - if (socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0 || - shutdown(sfd[0], 1) < 0 || - shutdown(sfd[1], 0) < 0) - return(1); - close(0); - dup(sfd[0]); - close(sfd[0]); - if ((n = open("/dev/fd/0", O_RDONLY)) < 0) - return(1); - return(0); - } -}end -tst socketpair_shutdown_mode note{ fchmod() after socketpair() shutdown() }end execute{ - #include <ast.h> - #include <sys/types.h> - #include <sys/stat.h> - #include <sys/socket.h> - int main() - { - int sfd[2]; - struct stat st0; - struct stat st1; - if (socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0 || - shutdown(sfd[0], 1) < 0 || - shutdown(sfd[1], 0) < 0) - return(1); - if (fstat(sfd[0], &st0) < 0 || fstat(sfd[1], &st1) < 0) - return(1); - if ((st0.st_mode & (S_IRUSR|S_IWUSR)) == S_IRUSR && - (st1.st_mode & (S_IRUSR|S_IWUSR)) == S_IWUSR) - return(1); - if (fchmod(sfd[0], S_IRUSR) < 0 || - fstat(sfd[0], &st0) < 0 || - (st0.st_mode & (S_IRUSR|S_IWUSR)) != S_IRUSR) - return(1); - if (fchmod(sfd[1], S_IWUSR) < 0 || - fstat(sfd[1], &st1) < 0 || - (st1.st_mode & (S_IRUSR|S_IWUSR)) != S_IWUSR) - return(1); - return(0); - } -}end -cat{ - #pragma prototyped - #ifdef _lib_poll - # define poll _SYS_poll - #else - # undef _hdr_poll - # undef _sys_poll - #endif /* _lib_poll */ - #ifdef _hdr_poll - # include <poll.h> - #else - # ifdef _sys_poll - # include <sys/poll.h> - # endif /* _sys_poll */ - #endif /* _hdr_poll */ - #ifdef _lib_poll - # undef poll - extern int poll(struct pollfd*,unsigned long,int); - #endif /* _lib_poll */ - #ifdef _lib_select - # ifndef FD_ZERO - # define FD_ZERO(x) (*(x)=0) - # endif /* FD_ZERO */ - # ifndef FD_SET - # define FD_SET(n,x) (*(x)|=(1L<<(n))) - # endif /* FD_SET */ - # ifndef _typ_fd_set - typedef long fd_set; - # endif /*_typ_fd_set */ - #endif /* _lib_select */ -}end diff --git a/usr/src/lib/libshell/common/features/rlimits b/usr/src/lib/libshell/common/features/rlimits deleted file mode 100644 index f2ffe192cf..0000000000 --- a/usr/src/lib/libshell/common/features/rlimits +++ /dev/null @@ -1,3 +0,0 @@ -hdr,sys resource,vlimit -lib getrlimit,ulimit,vlimit -typ rlim_t sys/types.h sys/resource.h diff --git a/usr/src/lib/libshell/common/features/setjmp b/usr/src/lib/libshell/common/features/setjmp deleted file mode 100644 index a3504ee3e2..0000000000 --- a/usr/src/lib/libshell/common/features/setjmp +++ /dev/null @@ -1,18 +0,0 @@ -lib sigsetjmp,_setjmp,_longjmp -typ sigjmp_buf setjmp.h -cat{ - #undef sigsetjmp - #undef siglongjmp - #undef sigjmp_buf - #define sigjmp_buf jmp_buf - #ifdef _lib__setjmp - # define sigsetjmp(a,b) _setjmp(a) - #else - # define sigsetjmp(a,b) setjmp(a) - #endif /* _lib__setjmp */ - #ifdef _lib__longjmp - # define siglongjmp(a,b) _longjmp(a,b) - #else - # define siglongjmp(a,b) longjmp(a,b) - #endif /* _lib__longjmp */ -}end diff --git a/usr/src/lib/libshell/common/features/sigfeatures b/usr/src/lib/libshell/common/features/sigfeatures deleted file mode 100644 index 58beaf8daa..0000000000 --- a/usr/src/lib/libshell/common/features/sigfeatures +++ /dev/null @@ -1,49 +0,0 @@ -lib sigblock,sigrelse,sigsetmask,sigprocmask,sigvec -typ sigset_t ast.h signal.h -mem sigvec.sv_mask signal.h -cat{ - #ifndef _mem_sigvec_sv_mask - # undef _lib_sigvec - #endif - #ifdef _lib_sigprocmask - # define sh_sigaction(s,action) do { sigset_t ss;\ - sigemptyset(&ss); \ - if(s) sigaddset(&ss,(s)); \ - sigprocmask(action,&ss,0); \ - }while(0) - # define sigrelease(s) sh_sigaction(s,SIG_UNBLOCK) - # define sigblock(s) sh_sigaction(s,SIG_BLOCK) - # define sig_begin() sh_sigaction(0,SIG_SETMASK) - #else - # ifndef _lib_sigblock - # define sigblock(s) - # endif - # ifdef _lib_sigsetmask - # define sigrelease(s) sigsetmask(0) - # define sig_begin() sigsetmask(0) - # else - # ifdef _lib_sigrelse - # define sigrelease sigrelse - # define sig_begin() - # else - # define sig_begin() (0) - # define sigrelease(s) (0) - # endif /* _lib_sigrelse */ - # endif /* _lib_sigsetmask */ - #endif /* _lib_sigprocmask */ -}end -tst output{ - #include <signal.h> - int main() - { - #ifdef SIGRTMIN - printf("#undef _SIGRTMIN\n"); - printf("#define _SIGRTMIN %d\n", SIGRTMIN); - #endif - #ifdef SIGRTMAX - printf("#undef _SIGRTMAX\n"); - printf("#define _SIGRTMAX %d\n", SIGRTMAX); - #endif - return 0; - } -}end diff --git a/usr/src/lib/libshell/common/features/time b/usr/src/lib/libshell/common/features/time deleted file mode 100644 index f8d2129841..0000000000 --- a/usr/src/lib/libshell/common/features/time +++ /dev/null @@ -1,35 +0,0 @@ -hdr utime -lib gettimeofday,setitimer -mem timeval.tv_usec sys/time.h -tst lib_2_timeofday note{ 2 arg gettimeofday() }end link{ - #include <sys/types.h> - #include <sys/time.h> - int main() - { - struct timeval tv; - struct timezone tz; - return gettimeofday(&tv, &tz); - } -}end -tst lib_1_timeofday note{ 1 arg gettimeofday() }end link{ - #include <sys/types.h> - #include <sys/time.h> - int main() - { - struct timeval tv; - return gettimeofday(&tv); - } -}end -cat{ - #undef _def_time - #include <times.h> - #define _def_time 1 - #undef timeofday - #if _lib_2_timeofday - #define timeofday(p) gettimeofday(p,(struct timezone*)0) - #else - #if _lib_1_timeofday - #define timeofday(p) gettimeofday(p) - #endif - #endif -}end diff --git a/usr/src/lib/libshell/common/features/ttys b/usr/src/lib/libshell/common/features/ttys deleted file mode 100644 index 693dbd1be1..0000000000 --- a/usr/src/lib/libshell/common/features/ttys +++ /dev/null @@ -1,3 +0,0 @@ -hdr termios,termio,sgtty -sys termios,termio,ioctl,bsdtty,nttyio,filio -lib tcgetattr,tcgetpgrp termios.h |