ksh/ksh93.dif

300 lines
8.2 KiB
Plaintext

--- src/cmd/ksh93/bltins/print.c
+++ src/cmd/ksh93/bltins/print.c 2008-05-05 11:20:21.000000000 +0000
@@ -103,7 +103,11 @@ static int outexceptf(Sfio_t* iop, int m
{
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 = (Shell_t*)extra;
NOT_USED(argc);
@@ -116,7 +120,52 @@ static int outexceptf(Sfio_t* iop, int m
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 19:01:26.148482219 +0100
@@ -176,7 +176,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
# ifdef THISPROG
--- src/cmd/ksh93/data/variables.c
+++ src/cmd/ksh93/data/variables.c 2008-09-18 19:22:24.179237867 +0200
@@ -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 19:01:26.184486786 +0100
@@ -35,7 +35,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/io.c
+++ src/cmd/ksh93/sh/io.c 2008-09-11 17:16:15.604470938 +0200
@@ -587,6 +587,7 @@ int sh_close(register int fd)
return(r);
}
+#ifdef O_SERVICE
static int
onintr(struct addrinfo* addr, void* handle)
{
@@ -602,6 +603,7 @@ onintr(struct addrinfo* addr, void* hand
sh_chktrap();
return 0;
}
+#endif
/*
* Mimic open(2) with checks for pseudo /dev/ files.
--- src/cmd/ksh93/sh.1
+++ src/cmd/ksh93/sh.1 2008-09-22 14:11:56.360975393 +0200
@@ -201,7 +201,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/main.c
+++ src/cmd/ksh93/sh/main.c 2007-12-20 19:01:26.212490337 +0100
@@ -125,9 +125,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[], void (*userinit)(int))
@@ -193,7 +193,7 @@ int sh_main(int ac, char *av[], void (*u
}
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 19:01:26.248494902 +0100
@@ -69,7 +69,11 @@
# define DEFSHELL "/bin/sh"
#endif
+#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 2008-09-18 11:54:26.469549564 +0200
@@ -195,7 +195,7 @@ hello worldhello worldhello world
!
[[ $v1 == "$b1" ]] || err_exit "v1=$v1 should be $b1"
[[ $v2 == "$x" ]] || err_exit "v1=$v2 should be $x"
-[[ $(env - '!=1' $SHELL -c 'echo ok' 2>/dev/null) == ok ]] || err_exit 'malformed environment terminates shell'
+[[ $(env - "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" '!=1' $SHELL -c 'echo ok' 2>/dev/null) == ok ]] || err_exit 'malformed environment terminates shell'
unset var
typeset -b var
printf '12%Z34' | read -r -N 5 var
--- src/cmd/ksh93/tests/builtins.sh
+++ src/cmd/ksh93/tests/builtins.sh 2007-12-20 19:01:26.280498962 +0100
@@ -332,7 +332,7 @@ ifs=$IFS
IFS=,
set -- $(getconf LIBPATH)
IFS=$ifs
-env=
+env="LD_LIBRARY_PATH=\$LD_LIBRARY_PATH"
for v
do IFS=:
set -- $v
--- src/cmd/ksh93/tests/path.sh
+++ src/cmd/ksh93/tests/path.sh 2008-09-11 18:02:46.295298918 +0200
@@ -224,6 +224,6 @@ 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"
exit $((Errors))
--- src/lib/libast/features/align.c
+++ src/lib/libast/features/align.c 2007-12-20 19:01:26.312503019 +0100
@@ -32,6 +32,7 @@
#include "FEATURE/common"
#include <setjmp.h>
+#include <stdio.h>
union _u_
{
--- src/lib/libast/features/botch.c
+++ src/lib/libast/features/botch.c 2007-12-20 19:01:26.352508090 +0100
@@ -27,6 +27,7 @@
* generate ast traps for botched standard prototypes
*/
+#include <stdio.h>
#include <sys/types.h>
#include "FEATURE/lib"
--- src/lib/libast/features/lib
+++ src/lib/libast/features/lib 2007-12-20 19:01:26.380511641 +0100
@@ -507,14 +507,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 19:01:26.412515701 +0100
@@ -538,7 +538,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 19:01:26.448520265 +0100
@@ -53,7 +53,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 2007-12-20 19:02:36.857449589 +0100
@@ -161,7 +161,7 @@ b_chmod(int argc, char** argv, void* con
int notify = 0;
int ignore = 0;
int show = 0;
-#if _lib_lchmod
+#if !defined(__linux__) && _lib_lchmod
int chlink = 0;
#endif
struct stat st;
@@ -185,7 +185,7 @@ b_chmod(int argc, char** argv, void* con
force = 1;
continue;
case 'h':
-#if _lib_lchmod
+#if !defined(__linux__) && _lib_lchmod
chlink = 1;
#endif
continue;
@@ -242,7 +242,7 @@ b_chmod(int argc, char** argv, void* con
}
}
chmodf =
-#if _lib_lchmod
+#if !defined(__linux__) && _lib_lchmod
chlink ? lchmod :
#endif
chmod;