File ksh93.dif of Package ksh

--- src/cmd/ksh93/sh.1
+++ src/cmd/ksh93/sh.1	2008-09-22 12:11:56.000000000 +0000
@@ -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/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
@@ -186,7 +186,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/io.c
+++ src/cmd/ksh93/sh/io.c	2008-09-11 15:16:16.000000000 +0000
@@ -641,6 +641,7 @@ int sh_close(register int fd)
 
 #ifdef O_SERVICE
 
+#ifdef O_SERVICE
 static int
 onintr(struct addrinfo* addr, void* handle)
 {
@@ -656,6 +657,7 @@ onintr(struct addrinfo* addr, void* hand
 		sh_chktrap();
 	return 0;
 }
+#endif
 
 #endif
 
--- src/cmd/ksh93/sh/lex.c
+++ src/cmd/ksh93/sh/lex.c	2010-04-08 07:13:26.070925225 +0000
@@ -1082,11 +1082,13 @@ int sh_lex(Lex_t* lp)
 					}
 					/* backward compatibility */
 					{
+						register const char * cp;
 						if(lp->lexd.warn)
 							errormsg(SH_DICT,ERROR_warn(0),e_lexnested,shp->inlineno);
 						if(!(state=lp->lexd.first))
 							state = fcfirst();
-						fcseek(state-fcseek(0));
+						cp = fcseek(0);
+						fcseek(state-cp);
 						if(lp->arg)
 						{
 							lp->arg = (struct argnod*)stkfreeze(stkp,1);
--- 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)
@@ -198,7 +198,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	2009-12-09 13:01:41.000000000 +0000
@@ -135,11 +135,11 @@ set -- $($SHELL -c "
 	unset LC_CTYPE
 	export LANG=$utf_8
 	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'"
--- 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	2010-03-05 13:01:05.944126021 +0000
@@ -286,9 +286,9 @@ yes=$(whence -p yes)
 do { $SHELL <<- EOF
 		foo() { return 0; }
 		trap foo EXIT
-		{ sleep 2; kill -$exp \$\$; sleep 3; kill -0 \$\$ && kill -KILL \$\$; } &
+		{ sleep 2; kill -$exp \$\$; sleep 6; kill -0 \$\$ && kill -KILL \$\$; } &
 		$yes | while read yes; do
-		        (/bin/date; sleep .1)
+		        (/bin/date; sleep .05)
 		done > /dev/null
 	EOF
     } 2>> /dev/null
--- src/cmd/ksh93/tests/timetype.sh
+++ src/cmd/ksh93/tests/timetype.sh	2011-05-25 07:45:35.763926377 +0000
@@ -58,7 +58,7 @@
 [[ ${tt[0]} == *+00:00 ]] || err_exit 'tt[0] is not yesterday'
 [[ ${tt[1]} == *+00:00 ]] || err_exit 'tt[1] is not today'
 [[ ${tt[2]} == *+00:00 ]] || err_exit 'tt[2] is not tomorrow'
-[[ ${tt[3]} == *+14:00 ]] || err_exit 'tt[0] is not 2pm'
+[[ ${tt[3]} == *+14:00 ]] || err_exit 'tt[3] is not 2pm'
 unset tt
 Time_t tt=('2008-08-11+00:00:00,yesterday' '2008-08-11+00:00:00,today' '2008-08-11+00:00:00,tomorrow')
 tt[3]=9am
--- 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 <setjmp.h>
+#include <stdio.h>
 
 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 <stdio.h>
 #include <sys/types.h>
 
 #include "FEATURE/lib"
--- src/lib/libast/features/lib
+++ src/lib/libast/features/lib	2007-12-20 18:01:26.000000000 +0000
@@ -517,14 +517,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
@@ -537,7 +537,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	2007-12-20 18:02:37.000000000 +0000
@@ -162,7 +162,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;
@@ -186,7 +186,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;
@@ -249,7 +249,7 @@ b_chmod(int argc, char** argv, void* con
 		}
 	}
 	chmodf =
-#if _lib_lchmod
+#if !defined(__linux__) && _lib_lchmod
 		chlink ? lchmod :
 #endif
 		chmod;
openSUSE Build Service is sponsored by