--- src/cmd/ksh93/bltins/print.c +++ src/cmd/ksh93/bltins/print.c 2008-05-05 11:20:21.000000000 +0000 @@ -86,7 +86,11 @@ static char* nullarg[] = { 0, 0 }; { static char bsd_univ; struct print prdata; - prdata.options = sh_optecho+5; +# if defined(__linux__) + prdata.options = sh_optecho; +# else + prdata.options = sh_optecho + 5; +# endif prdata.raw = prdata.echon = 0; prdata.sh = ((Shbltin_t*)extra)->shp; NOT_USED(argc); @@ -99,7 +103,52 @@ static char* nullarg[] = { 0, 0 }; prdata.sh->universe = 1; } if(!bsd_univ) + { +# if defined(__linux__) + char *opt = argv[1]; + while ((opt = argv[1]) && (*opt == '-')) + { + int c; + + opt++; + + for (c = 0; opt[c]; c++) +# if !SHOPT_ECHOE + if (strchr("neE", opt[c]) == 0) +# else + if (strchr("n", opt[c]) == 0) +# endif /* SHOPT_ECHOE */ + break; + + if (*opt == 0 || opt[c]) + break; + + while ((c = *opt++)) + { + switch (c) { + case 'n': + prdata.echon = 1; + break; +# if !SHOPT_ECHOE + case 'e': + prdata.raw = 0; + break; + case 'E': + prdata.raw = 1; + break; +# endif /* SHOPT_ECHOE */ + default: + goto out; + break; + } + } + + argv++; + } + out: +# endif return(b_print(0,argv,&prdata)); + } prdata.options = sh_optecho; prdata.raw = 1; while(argv[1] && *argv[1]=='-') --- src/cmd/ksh93/data/msg.c +++ src/cmd/ksh93/data/msg.c 2007-12-20 18:01:26.000000000 +0000 @@ -199,7 +199,7 @@ const char e_bash_login[] = "$HOME/.bash const char e_bash_logout[] = "$HOME/.bash_logout"; const char e_bash_profile[] = "$HOME/.bash_profile"; #endif -const char e_crondir[] = "/usr/spool/cron/atjobs"; +const char e_crondir[] = "/var/spool/cron"; const char e_prohibited[] = "login setuid/setgid shells prohibited"; #if SHOPT_SUID_EXEC const char e_suidexec[] = "/etc/suid_exec"; --- src/cmd/ksh93/data/variables.c +++ src/cmd/ksh93/data/variables.c 2008-09-18 17:22:24.000000000 +0000 @@ -68,7 +68,7 @@ const struct shtable2 shtab_variables[] "OPTARG", 0, (char*)0, "OPTIND", NV_NOFREE|NV_INTEGER, (char*)0, "PS4", 0, (char*)0, - "FPATH", 0, (char*)0, + "FPATH", NV_NOFREE, "/usr/share/ksh/fun", "LANG", 0, (char*)0, "LC_ALL", 0, (char*)0, "LC_COLLATE", 0, (char*)0, --- src/cmd/ksh93/features/options +++ src/cmd/ksh93/features/options 2007-12-20 18:01:26.000000000 +0000 @@ -36,7 +36,7 @@ tst cross{ 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" + test -x /bin/universe && univ=`/bin/universe` > /dev/null 2>&1 && test ucb = "$univ" option UCB $? }end --- src/cmd/ksh93/sh.1 +++ src/cmd/ksh93/sh.1 2008-09-22 12:11:56.000000000 +0000 @@ -200,7 +200,7 @@ separated by .BR \(bv . The standard output of each command but the last is connected by a -.IR pipe (2) +.IR socketpair (2) to the standard input of the next command. Each command, except possibly the last, --- src/cmd/ksh93/sh/lex.c +++ src/cmd/ksh93/sh/lex.c 2010-08-17 14:49:14.000000000 +0000 @@ -1136,7 +1136,11 @@ int sh_lex(Lex_t* lp) if(!(state=lp->lexd.first)) state = fcfirst(); else - fcseek(state-fcseek(0)); + { + register const char * cp; + cp = fcseek(0); + fcseek(state-cp); + } lp->lexd.paren = 1; } return(lp->token=LPAREN); --- src/cmd/ksh93/sh/main.c +++ src/cmd/ksh93/sh/main.c 2007-12-20 18:01:26.000000000 +0000 @@ -130,9 +130,9 @@ int sh_source(Shell_t *shp, Sfio_t *iop, } #ifdef S_ISSOCK -#define REMOTE(m) (S_ISSOCK(m)||!(m)) +#define REMOTE(m) ((S_ISSOCK((m).st_mode)||!((m).st_mode))&&!((m).st_ino)) #else -#define REMOTE(m) !(m) +#define REMOTE(m) (!((m).st_mode)&&!((m).st_ino)) #endif int sh_main(int ac, char *av[], Shinit_f userinit) @@ -199,7 +199,7 @@ int sh_main(int ac, char *av[], Shinit_f } if(!sh_isoption(SH_RC) && (sh_isoption(SH_BASH) && !sh_isoption(SH_POSIX) #if SHOPT_REMOTE - || !fstat(0, &statb) && REMOTE(statb.st_mode) + || !fstat(0, &statb) && REMOTE(statb) #endif )) sh_onoption(SH_RC); --- src/cmd/ksh93/sh/suid_exec.c +++ src/cmd/ksh93/sh/suid_exec.c 2007-12-20 18:01:26.000000000 +0000 @@ -65,7 +65,11 @@ #define THISPROG "/etc/suid_exec" #define DEFSHELL "/bin/sh" +#if defined(__linux__) +static void error_exit(const char*) __attribute__ ((noreturn)); +#else static void error_exit(const char*); +#endif static int in_dir(const char*, const char*); static int endsh(const char*); #ifndef _lib_setregid --- src/cmd/ksh93/tests/attributes.sh +++ src/cmd/ksh93/tests/attributes.sh 2009-07-09 13:14:05.000000000 +0000 @@ -199,7 +199,7 @@ hello worldhello worldhello world [[ $v1 == "$b1" ]] || err_exit "v1=$v1 should be $b1" [[ $v2 == "$x" ]] || err_exit "v1=$v2 should be $x" if env '!=1' >/dev/null 2>&1 -then [[ $(env '!=1' $SHELL -c 'echo ok' 2>/dev/null) == ok ]] || err_exit 'malformed environment terminates shell' +then [[ $(env "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" '!=1' $SHELL -c 'echo ok' 2>/dev/null) == ok ]] || err_exit 'malformed environment terminates shell' fi unset var typeset -b var --- src/cmd/ksh93/tests/builtins.sh +++ src/cmd/ksh93/tests/builtins.sh 2009-07-09 13:14:50.000000000 +0000 @@ -332,7 +332,7 @@ wait $pid1 (( $? == 1 )) || err_exit "wait not saving exit value" wait $pid2 (( $? == 127 )) || err_exit "subshell job known to parent" -env= +env="LD_LIBRARY_PATH=\$LD_LIBRARY_PATH" v=$(getconf LIBPATH) for v in ${v//,/ } do v=${v#*:} --- src/cmd/ksh93/tests/locale.sh +++ src/cmd/ksh93/tests/locale.sh 2011-05-24 16:46:02.000000000 +0200 @@ -62,7 +62,7 @@ done # this locale is supported by ast on all platforms # EU for { decimal_point="," thousands_sep="." } -locale=C_EU.UTF-8 +locale=de_DE.UTF-8 export LC_ALL=C @@ -111,11 +111,11 @@ set -- $($SHELL -c " unset LC_CTYPE export LANG=$locale export LC_ALL=C - command wc -C < $tmp/two_euro_chars.txt + command wc -m < $tmp/two_euro_chars.txt unset LC_ALL - command wc -C < $tmp/two_euro_chars.txt + command wc -m < $tmp/two_euro_chars.txt export LC_ALL=C - command wc -C < $tmp/two_euro_chars.txt + command wc -m < $tmp/two_euro_chars.txt ") got=$* [[ $got == $exp ]] || err_exit "command wc LC_ALL default failed -- expected '$exp', got '$got'" @@ -124,11 +124,11 @@ set -- $($SHELL -c " then unset LC_CTYPE export LANG=$locale export LC_ALL=C - wc -C < $tmp/two_euro_chars.txt + wc -m < $tmp/two_euro_chars.txt unset LC_ALL - wc -C < $tmp/two_euro_chars.txt + wc -m < $tmp/two_euro_chars.txt export LC_ALL=C - wc -C < $tmp/two_euro_chars.txt + wc -m < $tmp/two_euro_chars.txt fi ") got=$* --- src/cmd/ksh93/tests/options.sh +++ src/cmd/ksh93/tests/options.sh 2012-01-16 16:50:59.135145199 +0000 @@ -510,7 +510,7 @@ z=$($SHELL 2>&1 -uc 'print ${X2345678901 [[ $z == *X23456789012345:* ]] || err_exit "error message garbled with set -u got $z" # pipe hang bug fixed 2011-03-15 -float start=SECONDS toolong=3 +float start=SECONDS toolong=8 ( $SHELL <<-EOF set -o pipefail (sleep $toolong;kill \$\$> /dev/null) & --- src/cmd/ksh93/tests/path.sh +++ src/cmd/ksh93/tests/path.sh 2008-09-11 16:02:46.000000000 +0000 @@ -269,7 +269,7 @@ builtin getconf getconf UNIVERSE - att # override sticky default 'UNIVERSE = foo' [[ $(PATH=/usr/ucb/bin:/usr/bin echo -n ucb) == 'ucb' ]] || err_exit "ucb universe echo ignores -n option" -[[ $(PATH=/usr/xpg/bin:/usr/bin echo -n att) == '-n att' ]] || err_exit "att universe echo does not ignore -n option" +[[ $(PATH=/usr/xpg/bin:/usr/bin echo -n att) == 'att' ]] || err_exit "att universe echo ignores -n option" PATH=$path --- src/cmd/ksh93/tests/signal.sh +++ src/cmd/ksh93/tests/signal.sh 2011-05-20 13:25:48.196426330 +0000 @@ -285,10 +285,10 @@ then for exp in TERM VTALRM PIPE $SHELL <<- EOF foo() { return 0; } trap foo EXIT - { sleep 2; kill -$exp \$\$; sleep 3; kill -0 \$\$ && kill -KILL \$\$; } & + { sleep 2; kill -$exp \$\$; sleep 8; kill -0 \$\$ && kill -KILL \$\$; } & $yes | while read yes - do (/bin/date; sleep .1) + do (/bin/date; sleep .01) done > /dev/null EOF } 2>> /dev/null --- src/lib/libast/disc/memfatal.c +++ src/lib/libast/disc/memfatal.c 2009-07-09 13:30:39.000000000 +0000 @@ -72,7 +72,7 @@ memfatal(void) { Vmdisc_t* disc; - malloc(0); + void * ptr = malloc(0); if (disc = vmdisc(Vmregion, NiL)) disc->exceptf = nomalloc; } --- src/lib/libast/features/align.c +++ src/lib/libast/features/align.c 2007-12-20 18:01:26.000000000 +0000 @@ -32,6 +32,7 @@ #include "FEATURE/common" #include +#include union _u_ { --- src/lib/libast/features/botch.c +++ src/lib/libast/features/botch.c 2007-12-20 18:01:26.000000000 +0000 @@ -27,6 +27,7 @@ * generate ast traps for botched standard prototypes */ +#include #include #include "FEATURE/lib" --- src/lib/libast/features/lib +++ src/lib/libast/features/lib 2007-12-20 18:01:26.000000000 +0000 @@ -523,14 +523,19 @@ tst lib_utime_now note{ utime works with }end tst cross{ - u=att - case `/bin/cat -s /dev/null/foo 2>&1` in - '') ;; - *) case `/bin/echo '\\t'` in - '\t') u=ucb ;; + if test -n "$UNIVERSE" + then + u=$UNIVERSE + else + u=att + case `/bin/cat -s /dev/null/foo 2>&1` in + '') ;; + *) case `/bin/echo '\\t'` in + '\t') u=ucb ;; + esac + ;; esac - ;; - esac + fi echo "#define _UNIV_DEFAULT \"$u\" /* default universe name */" }end --- src/lib/libast/misc/procopen.c +++ src/lib/libast/misc/procopen.c 2007-12-20 18:01:26.000000000 +0000 @@ -598,7 +598,7 @@ procopen(const char* cmd, char** argv, c if (!fork()) { sfsprintf(path, sizeof(path), "%d", getppid()); - execlp("trace", "trace", "-p", path, NiL); + execlp("trace", "trace", "-p", path, NULL); _exit(EXIT_NOTFOUND); } sleep(2); --- src/lib/libast/sfio/sfstrtof.h +++ src/lib/libast/sfio/sfstrtof.h 2007-12-20 18:01:26.000000000 +0000 @@ -54,7 +54,7 @@ #if !defined(S2F_function) #define S2F_function _sfdscan -#define S2F_static 1 +#define S2F_static -1 #define S2F_type 2 #define S2F_scan 1 #ifndef elementsof --- src/lib/libcmd/chmod.c +++ src/lib/libcmd/chmod.c 2011-05-20 13:28:57.511927049 +0000 @@ -272,7 +272,7 @@ b_chmod(int argc, char** argv, void* con case FTS_SLNONE: if (chlink) { -#if _lib_lchmod +#if !defined(__linux__) && _lib_lchmod chmodf = lchmod; goto commit; #else