Accepting request 558827 from shells
-> OBS-URL: https://build.opensuse.org/request/show/558827 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ksh?expand=0&rev=108
This commit is contained in:
commit
2c1447427e
3
INIT.2012-08-01.tar.bz2
Normal file
3
INIT.2012-08-01.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0b854435757829f9fbc9d24242192e2056069862d9c463bf8dcfb76b1f094c8b
|
||||
size 295820
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:aae227f4af1192d81ac3415cd59deaf7a69c4f40d4750ccf89bd72b4b12db10f
|
||||
size 305854
|
3
ast-base.2012-08-01.tar.bz2
Normal file
3
ast-base.2012-08-01.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:81f4007679dad9a93b2a4ed241cbe2e86d1422ee3b74c4f905aaae1345070af2
|
||||
size 8035476
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6d3da64fb55c68e66e50b125bfd26c456c5a326d5621e3ac42a35242f720c6ad
|
||||
size 8453430
|
887
astksh_builtin_poll20120806_001.diff
Normal file
887
astksh_builtin_poll20120806_001.diff
Normal file
@ -0,0 +1,887 @@
|
||||
--- src/cmd/ksh93/Makefile
|
||||
+++ src/cmd/ksh93/Makefile 2012-08-06 21:25:47.000000000 +0000
|
||||
@@ -161,6 +161,7 @@ DATAFILES = limits.c msg.c strdata.c tes
|
||||
|
||||
shell$(RELEASE) $(VERSION) id=shell :LIBRARY: shell.3 nval.3 alarm.c cd_pwd.c cflow.c deparse.c \
|
||||
enum.c getopts.c hist.c misc.c print.c read.c sleep.c trap.c test.c \
|
||||
+ poll.c \
|
||||
typeset.c ulimit.c umask.c whence.c main.c nvdisc.c nvtype.c \
|
||||
arith.c args.c array.c completion.c defs.c edit.c expand.c regress.c \
|
||||
fault.c fcin.c history.c init.c io.c jobs.c lex.c macro.c name.c \
|
||||
--- src/cmd/ksh93/Mamfile
|
||||
+++ src/cmd/ksh93/Mamfile 2012-08-06 21:25:47.000000000 +0000
|
||||
@@ -548,6 +548,22 @@ meta test.o %.c>%.o bltins/test.c test
|
||||
prev bltins/test.c
|
||||
exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} -D_API_ast=20100309 -D_PACKAGE_ast -D_BLD_shell -DSHOPT_DYNAMIC -DSHOPT_MULTIBYTE -DSHOPT_PFSH -DSHOPT_STATS -DSHOPT_NAMESPACE -DSHOPT_COSHELL -DSHOPT_HISTEXPAND -DERROR_CONTEXT_T=Error_context_t -DSHOPT_FIXEDARRAY -DSHOPT_ESH -DKSHELL -c bltins/test.c
|
||||
done test.o generated
|
||||
+
|
||||
+make poll.o
|
||||
+make bltins/poll.c
|
||||
+prev ${PACKAGE_ast_INCLUDE}/tmx.h implicit
|
||||
+prev FEATURE/poll implicit
|
||||
+prev FEATURE/externs implicit
|
||||
+prev include/builtins.h implicit
|
||||
+prev include/io.h implicit
|
||||
+prev ${PACKAGE_ast_INCLUDE}/error.h implicit
|
||||
+prev include/defs.h implicit
|
||||
+done bltins/poll.c
|
||||
+meta poll.o %.c>%.o bltins/poll.c test
|
||||
+prev bltins/poll.c
|
||||
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} -D_API_ast=20100309 -D_PACKAGE_ast -D_BLD_shell -DSHOPT_DYNAMIC -DSHOPT_MULTIBYTE -DSHOPT_PFSH -DSHOPT_STATS -DSHOPT_NAMESPACE -DSHOPT_COSHELL -DSHOPT_DYNAMIC -DSHOPT_HISTEXPAND -DERROR_CONTEXT_T=Error_context_t -DSHOPT_FIXEDARRAY -DSHOPT_ESH -DKSHELL -c bltins/poll.c
|
||||
+done poll.o generated
|
||||
+
|
||||
make typeset.o
|
||||
make bltins/typeset.c
|
||||
prev FEATURE/dynamic implicit
|
||||
@@ -1328,7 +1344,7 @@ meta hexpand.o %.c>%.o edit/hexpand.c he
|
||||
prev edit/hexpand.c
|
||||
exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} -DSHOPT_HISTEXPAND -DSHOPT_EDPREDICT -DSHOPT_MULTIBYTE -DKSHELL -DSHOPT_ESH -DSHOPT_VSH -D_PACKAGE_ast -DSHOPT_PFSH -DSHOPT_STATS -DSHOPT_NAMESPACE -DSHOPT_COSHELL -D_BLD_shell -D_API_ast=20100309 -DERROR_CONTEXT_T=Error_context_t -DSHOPT_FIXEDARRAY -c edit/hexpand.c
|
||||
done hexpand.o generated
|
||||
-exec - ${AR} rc libshell.a alarm.o cd_pwd.o cflow.o deparse.o enum.o getopts.o hist.o misc.o print.o read.o sleep.o trap.o test.o typeset.o ulimit.o umask.o whence.o main.o nvdisc.o nvtype.o arith.o args.o array.o completion.o defs.o edit.o expand.o regress.o fault.o fcin.o
|
||||
+exec - ${AR} rc libshell.a alarm.o cd_pwd.o cflow.o deparse.o enum.o getopts.o hist.o misc.o poll.o print.o read.o sleep.o trap.o test.o typeset.o ulimit.o umask.o whence.o main.o nvdisc.o nvtype.o arith.o args.o array.o completion.o defs.o edit.o expand.o regress.o fault.o fcin.o
|
||||
exec - ${AR} rc libshell.a history.o init.o io.o jobs.o lex.o macro.o name.o nvtree.o parse.o path.o string.o streval.o subshell.o tdump.o timers.o trestore.o waitevent.o xec.o env.o limits.o msg.o strdata.o testops.o keywords.o options.o signals.o aliases.o builtins.o variables.o lexstates.o emacs.o vi.o hexpand.o
|
||||
exec - (ranlib libshell.a) >/dev/null 2>&1 || true
|
||||
done libshell.a generated
|
||||
--- src/cmd/ksh93/bltins/poll.c
|
||||
+++ src/cmd/ksh93/bltins/poll.c 2012-08-07 03:13:40.000000000 +0000
|
||||
@@ -0,0 +1,717 @@
|
||||
+/***********************************************************************
|
||||
+* *
|
||||
+* This software is part of the ast package *
|
||||
+* Copyright (c) 2007-2012 AT&T Intellectual Property *
|
||||
+* and is licensed under the *
|
||||
+* Eclipse Public License, Version 1.0 *
|
||||
+* by AT&T Intellectual Property *
|
||||
+* *
|
||||
+* A copy of the License is available at *
|
||||
+* http://www.eclipse.org/org/documents/epl-v10.html *
|
||||
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
|
||||
+* *
|
||||
+* Information and Software Systems Research *
|
||||
+* AT&T Research *
|
||||
+* Florham Park NJ *
|
||||
+* *
|
||||
+* Roland Mainz <roland.mainz@nrubsig.org> *
|
||||
+* *
|
||||
+***********************************************************************/
|
||||
+#pragma prototyped
|
||||
+
|
||||
+#include "defs.h"
|
||||
+#include "variables.h"
|
||||
+#include "lexstates.h"
|
||||
+#include "io.h"
|
||||
+#include "name.h"
|
||||
+#include "builtins.h"
|
||||
+#include "history.h"
|
||||
+#include "terminal.h"
|
||||
+#include <stdio.h>
|
||||
+#include <stdbool.h>
|
||||
+#include <poll.h>
|
||||
+#include <tmx.h>
|
||||
+#include <stk.h>
|
||||
+
|
||||
+#ifndef SH_DICT
|
||||
+# define SH_DICT "libshell"
|
||||
+#endif
|
||||
+
|
||||
+#define sh_contexttoshell(context) ((context)?((context)->shp):(NULL))
|
||||
+
|
||||
+static
|
||||
+const char sh_optpoll[] =
|
||||
+"[-?\n@(#)$Id: poll (AT&T Labs Research) 2012-08-01 $\n]"
|
||||
+"[-author?Roland Mainz <roland.mainz@nrubsig.org>]"
|
||||
+"[-license?http://www.eclipse.org/org/documents/epl-v10.html]"
|
||||
+"[+NAME? poll - input/output multiplexing]"
|
||||
+"[+DESCRIPTION?The poll command provides applications with a "
|
||||
+ "mechanism for multiplexing input/output over a set of "
|
||||
+ "file descriptors. "
|
||||
+ "For each member of the (optionally sparse) indexed or "
|
||||
+ "associative compound or type (see \btypeset -T\b) array "
|
||||
+ "variable \bvar\b, poll examines the given file descriptor "
|
||||
+ "in the subscript \b.fd\b for the event(s) specified in "
|
||||
+ "the subscript \b.events\b. "
|
||||
+ "The poll command identifies those file descriptors on "
|
||||
+ "which an application can read or write data, or on which "
|
||||
+ "certain events have occurred.]"
|
||||
+"[+?The \bvar\b argument specifies an array of file descriptors to "
|
||||
+ "be examined and the events of interest for each file "
|
||||
+ "descriptor. "
|
||||
+ "It is a array of compound variables (or user-defined type) "
|
||||
+ "with one member for each open file descriptor of interest. "
|
||||
+ "The array's compound or type variable members contain the "
|
||||
+ "following subscripts:]{"
|
||||
+ "[+?\b.fd\b # file descriptor]"
|
||||
+ "[+?\b.events\b # compound variable of requested event(s)]"
|
||||
+ "[+?\b.revents\b # compound variable of returned event(s)]"
|
||||
+ "}"
|
||||
+"[+?The \bfd\b variable specifies an open file descriptor and the "
|
||||
+ "\bevents\b and \brevents\b members are compound variables "
|
||||
+ "constructed from the following boolean member variables:]"
|
||||
+ "{ "
|
||||
+ "[+.pollin?('true'|'false') Data other than high priority "
|
||||
+ "data may be read without blocking. For STREAMS, this "
|
||||
+ "flag is set in \brevents\b even if the message "
|
||||
+ "is of zero length.]"
|
||||
+ "[+.pollrdnorm?('true'|'false') Normal data (priority band "
|
||||
+ "equals 0) may be read without blocking. For STREAMS, "
|
||||
+ "this flag is set in \brevents\b even if the message "
|
||||
+ "is of zero length.]"
|
||||
+ "[+.pollrdband?('true'|'false') Data from a non-zero "
|
||||
+ "priority band may be read without blocking. For "
|
||||
+ "STREAMS, this flag is set in \brevents\b even if the "
|
||||
+ "message is of zero length.]"
|
||||
+ "[+.pollpri?('true'|'false') High priority data may be "
|
||||
+ "received without blocking. For STREAMS, this flag is "
|
||||
+ "set in \brevents\b even if the message is of zero "
|
||||
+ "length.]"
|
||||
+ "[+.pollout?('true'|'false') Normal data (priority band "
|
||||
+ "equals 0) may be written without blocking.]"
|
||||
+ "[+.pollwrnorm?('true'|'false') The same as \bpollout\b.]"
|
||||
+ "[+.pollwrband?('true'|'false') Priority data (priority band "
|
||||
+ "> 0) may be written. This event only examines bands "
|
||||
+ "that have been written to at least once.]"
|
||||
+ "[+.pollerr?('true'|'false') An error has occurred on the "
|
||||
+ "device or stream. This flag is only valid in the "
|
||||
+ "\brevents\b compound variable; it is not used in the "
|
||||
+ "\bevents\b compound variable.]"
|
||||
+ "[+.pollhup?('true'|'false') A hangup has occurred on the "
|
||||
+ "stream. This event and \bpollout\b are mutually "
|
||||
+ "exclusive; a stream can never be writable if a "
|
||||
+ "hangup has occurred. "
|
||||
+ "However, this event and \bpollin\b, "
|
||||
+ "\bpollrdband\b, or \bpollpri\b are not "
|
||||
+ "mutually exclusive. This flag is only valid "
|
||||
+ "in the \brevents\b compound variable; it is not "
|
||||
+ "used in the \bevents\b compound variable.]"
|
||||
+ "[+.pollnval?('true'|'false') The specified fd value does "
|
||||
+ "not belong to an open file. "
|
||||
+ "This flag is only valid in the \brevents\b compound "
|
||||
+ "variable; it is not used in the \bevents\b "
|
||||
+ "compound variable.]"
|
||||
+ "}"
|
||||
+"]"
|
||||
+
|
||||
+"[+?If the value fd is less than 0, events is ignored and "
|
||||
+ "revents is set to 0 in that entry on return from poll.]"
|
||||
+
|
||||
+"[+?The results of the poll query are stored in the \brevents\b "
|
||||
+ "compound variable members in the \bvar\b structure. "
|
||||
+ "\bpoll*\b-variables are set in the \brevents\b compound "
|
||||
+ "variable to indicate which of the requested events are true. "
|
||||
+ "If none are true, the matching member in the \brevents\b "
|
||||
+ "compound variable will have the value of 'false' when the "
|
||||
+ "poll command returns. "
|
||||
+ "The \brevents\b compound variable members \bpollhup\b, "
|
||||
+ "\bpollerr\b, and \bpollnval\b are always set to 'true' in "
|
||||
+ "\brevents\b if the conditions they indicate are true; this "
|
||||
+ "occurs even though these flags were not present and/or set "
|
||||
+ "to 'true' in the \bevents\b compound variable.]"
|
||||
+
|
||||
+"[+?If none of the defined events have occurred on any selected "
|
||||
+ "file descriptor, poll waits at least timeout milliseconds "
|
||||
+ "for an event to occur on any of the selected file "
|
||||
+ "descriptors. "
|
||||
+ "On a computer where millisecond timing accuracy is not "
|
||||
+ "available, timeout is rounded up to the nearest legal value "
|
||||
+ "available on that system. If the value timeout is 0, poll "
|
||||
+ "returns immediately. If the value of timeout is -1, poll "
|
||||
+ "blocks until a requested event occurs or until the call is "
|
||||
+ "interrupted.]"
|
||||
+
|
||||
+"[+?The poll utility supports regular files, terminal and "
|
||||
+ "pseudo-terminal devices, STREAMS-based files, FIFOs, and "
|
||||
+ "pipes. The behavior of poll on elements of fds that refer "
|
||||
+ "to other types of file is unspecified.]"
|
||||
+
|
||||
+"[+?The poll utility supports sockets.]"
|
||||
+#ifdef __SunOS
|
||||
+"[+?The poll utility may be used on Solaris on directory fds of "
|
||||
+ "/proc/$pid/ to get a \bpollhup='true'\b when the process quits.]"
|
||||
+#endif
|
||||
+"[+?A file descriptor for a socket that is listening for connections "
|
||||
+ "will indicate that it is ready for reading, once connections "
|
||||
+ "are available. A file descriptor for a socket that "
|
||||
+ "is connecting asynchronously will indicate that it is ready "
|
||||
+ "for writing, once a connection has been established.]"
|
||||
+
|
||||
+"[+?Regular files always poll TRUE for reading and writing.]"
|
||||
+
|
||||
+"[e:eventarray]:[fdcount?Upon successful completion, an indexed array "
|
||||
+ "of strings is returned which contains a list of array "
|
||||
+ "subscripts in the poll array which received events.]"
|
||||
+"[S!:pollsfio?Look into sfio streams for buffered information and set "
|
||||
+ "pollin/pollout to reflect sfio stream state.]"
|
||||
+"[R:pollttyraw?Put tty connections into raw mode when polling. The "
|
||||
+ "fd is returned to tty cooked mode before poll(1) exits.]"
|
||||
+"[t:timeout]:[seconds?Timeout in seconds. If the value timeout is 0, "
|
||||
+ "poll returns immediately. If the value of timeout is -1, "
|
||||
+ "poll blocks until a requested event occurs or until the "
|
||||
+ "call is interrupted.]"
|
||||
+"\n"
|
||||
+"\nvar\n"
|
||||
+"\n"
|
||||
+"[+EXIT STATUS?]{"
|
||||
+ "[+0?Success.]"
|
||||
+ "[+>0?An error occurred.]"
|
||||
+"}"
|
||||
+"[+NOTES?]{"
|
||||
+ "[+?poll*-variables defined in \bevents\b will always appear "
|
||||
+ "in \brevents\b. This gives the script author control over "
|
||||
+ "which poll*-variables he can expect in \brevents\b.]"
|
||||
+
|
||||
+ "[+?The \bpollinhup\b, \bpollnval\b and \bpollerr\b variables "
|
||||
+ "may appear in the \brevents\b compound variable even if "
|
||||
+ "they were not requested in \bevents\b.]"
|
||||
+
|
||||
+ "[+?Using the value of variables in \brevents\b which are "
|
||||
+ "not set in \bevents\b can be done by putting a '-' suffix "
|
||||
+ "after the variable name, e.g. use "
|
||||
+ "\b${ar[x]].revents.pollhup-}\b to get the value of "
|
||||
+ "\bar[x]].revents.pollhup\b or an empty string if the variable "
|
||||
+ "was not set.]"
|
||||
+
|
||||
+ "[+?Like \bpoll\b(2) it is legal to poll on the same fd in "
|
||||
+ "multiple entries, for exanple to listen for different events "
|
||||
+ "or to allow multiple callers to pool their poll lists "
|
||||
+ "together into one \bpoll\b(1) call.]"
|
||||
+"}"
|
||||
+
|
||||
+/* quoting: ']' must be quoted as "]]" and '?' must be quoted as "//" */
|
||||
+"[+EXAMPLES?]{"
|
||||
+ "[+?The following example will wait for 10 seconds for input "
|
||||
+ "on fd 0, variable \bp[fd0]].revents.pollin\b will be 'true' "
|
||||
+ "or 'false' depening on whether the stream 0 is ready for "
|
||||
+ "reading:]{"
|
||||
+ "[+?compound -A p=( [fd0]]=( fd=0 events=( pollin='true' ) ) ) ; poll -t10 p ; print -v p]"
|
||||
+ "}"
|
||||
+
|
||||
+ "[+?The following example will wait for 2 seconds for input "
|
||||
+ "on fd 0, and variables \bp[0]].revents.pollin\b and "
|
||||
+ "\bp[0]].revents.pollhup\b will be 'true' after polling ends "
|
||||
+ "because there is both input data available and the end of "
|
||||
+ "the stream was reached:]{"
|
||||
+ "[+?printf '\\n' | ksh -c 'compound -a p=( ( fd=0 events=( pollin=\"true\" pollhup=\"true\" ) ) ) ; poll -t2 p ; print -v p']"
|
||||
+ "}"
|
||||
+"}"
|
||||
+
|
||||
+"[+SEE ALSO?\bopen\b(1),\btmpfile\b(1),\bdup\b(1),\bclose\b(1),\bpoll\b(2)]"
|
||||
+;
|
||||
+
|
||||
+
|
||||
+/* Like |nv_open()| but constructs variable name on the fly using |sprintf()| format */
|
||||
+static
|
||||
+Namval_t *nv_open_fmt(Dt_t *dict, int flags, const char *namefmt, ...)
|
||||
+{
|
||||
+ char varnamebuff[PATH_MAX];
|
||||
+ va_list ap;
|
||||
+
|
||||
+ va_start(ap, namefmt);
|
||||
+ vsnprintf(varnamebuff, sizeof(varnamebuff), namefmt, ap);
|
||||
+ va_end(ap);
|
||||
+
|
||||
+ return nv_open(varnamebuff, dict, flags);
|
||||
+}
|
||||
+
|
||||
+/* Name/value mapping table for POLL*-flags */
|
||||
+struct pollflagnamemap
|
||||
+{
|
||||
+ const int flag;
|
||||
+ const char *name;
|
||||
+};
|
||||
+
|
||||
+const
|
||||
+struct pollflagnamemap pfnm[]=
|
||||
+{
|
||||
+ { POLLIN, "pollin" },
|
||||
+#ifdef POLLPRI
|
||||
+ { POLLPRI, "pollpri" },
|
||||
+#endif
|
||||
+ { POLLOUT, "pollout" },
|
||||
+#ifdef POLLRDNORM
|
||||
+ { POLLRDNORM, "pollrdnorm" },
|
||||
+#endif
|
||||
+#ifdef POLLWRNORM
|
||||
+ { POLLWRNORM, "pollwrnorm" },
|
||||
+#endif
|
||||
+#ifdef POLLRDBAND
|
||||
+ { POLLRDBAND, "pollrdband" },
|
||||
+#endif
|
||||
+#ifdef POLLWRBAND
|
||||
+ { POLLWRBAND, "pollwrband" },
|
||||
+#endif
|
||||
+#ifdef POLLMSG
|
||||
+ { POLLMSG, "pollmsg" },
|
||||
+#endif
|
||||
+#ifdef POLLREMOVE
|
||||
+ { POLLREMOVE, "pollremove" },
|
||||
+#endif
|
||||
+#ifdef POLLRDHUP
|
||||
+ { POLLRDHUP, "pollrdhup" },
|
||||
+#endif
|
||||
+ { POLLERR, "pollerr" },
|
||||
+ { POLLHUP, "pollhup" },
|
||||
+ { POLLNVAL, "pollnval" },
|
||||
+ { 0, NULL },
|
||||
+};
|
||||
+
|
||||
+/* structure to keep track of per array entry data */
|
||||
+struct pollstat
|
||||
+{
|
||||
+ /* name of array subscript */
|
||||
+ const char *array_subscript;
|
||||
+
|
||||
+ /* |sfio| keeps track of sfio information */
|
||||
+ struct
|
||||
+ {
|
||||
+ Sfio_t *sfd;
|
||||
+ ssize_t flags;
|
||||
+ } sfio;
|
||||
+
|
||||
+ /*
|
||||
+ * Bits in |eventvar_found| are POLL*-bits, set if matching
|
||||
+ * ar[i].events.poll* var was found. We use this later to
|
||||
+ * set the same ar[i].revents.poll* variable, regardless
|
||||
+ * whether it was polled or not. This was done so the script
|
||||
+ * author can control which poll* variables in the "revents"
|
||||
+ * compound appear and which not.
|
||||
+ */
|
||||
+ int eventvar_found;
|
||||
+};
|
||||
+
|
||||
+/* poll on given |fds| data and retry after EINTR/EAGAIN while adjusting timeout */
|
||||
+static
|
||||
+int poll_loop(Shbltin_t* context, struct pollfd *fds, nfds_t nfds, int timeout)
|
||||
+{
|
||||
+/* nanoseconds to milliseconds */
|
||||
+#define TIME_NS2MS(t) ((t)/(1000UL*1000UL))
|
||||
+/* milliseconds to nanoseconds */
|
||||
+#define TIME_MS2NS(t) (((Time_t)(t))*(1000UL*1000UL))
|
||||
+
|
||||
+ int n;
|
||||
+
|
||||
+ /* We need two codepaths here:
|
||||
+ * 1. timeout > 0: we have to wait for |timeout| or events.
|
||||
+ * 2. timeout <= 0: we have to wait forever (-1), return
|
||||
+ * immediately (0) or an event occurs.
|
||||
+ */
|
||||
+ if (timeout > 0)
|
||||
+ {
|
||||
+ const Time_t starttime = tmxgettime();
|
||||
+ Time_t timeout_ns = TIME_MS2NS(timeout);
|
||||
+
|
||||
+ do
|
||||
+ {
|
||||
+ while(((n = poll(fds, nfds, timeout)) < 0) &&
|
||||
+ ((errno == EINTR) || (errno == EAGAIN)) &&
|
||||
+ (!context->sigset))
|
||||
+ errno=0;
|
||||
+
|
||||
+ timeout_ns=timeout_ns-(tmxgettime()-starttime);
|
||||
+ timeout=TIME_NS2MS(timeout_ns);
|
||||
+ } while((timeout > 0) && (!context->sigset));
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ while(((n = poll(fds, nfds, timeout)) < 0) &&
|
||||
+ ((errno == EINTR) || (errno == EAGAIN)) &&
|
||||
+ (!context->sigset))
|
||||
+ errno=0;
|
||||
+ }
|
||||
+ return n;
|
||||
+}
|
||||
+
|
||||
+/* set ".poll*"-variables in "ar[i].revents" per data in |currpollfd| and |currps| */
|
||||
+static
|
||||
+void set_compound_revents(Shell_t *shp, const char *parrayname, struct pollstat *currps, struct pollfd *currpollfd)
|
||||
+{
|
||||
+ const char *subname=currps->array_subscript;
|
||||
+ Namval_t *np;
|
||||
+ int pi;
|
||||
+
|
||||
+ np = nv_open_fmt(shp->var_tree, NV_VARNAME|NV_NOFAIL|NV_COMVAR, "%s[%s].revents", parrayname, subname);
|
||||
+ if (!np)
|
||||
+ {
|
||||
+ errormsg(SH_DICT, ERROR_ERROR, "could not create pollfd %s[%s].revents", parrayname, subname);
|
||||
+ return;
|
||||
+ }
|
||||
+ nv_setvtree(np); /* make "revents" really a compound variable */
|
||||
+ nv_close(np);
|
||||
+
|
||||
+ for (pi=0 ; pfnm[pi].name != NULL ; pi++)
|
||||
+ {
|
||||
+ /*
|
||||
+ * POLLHUP|POLLNVAL|POLLERR can always appear in |currpollfd->revents|
|
||||
+ * even if we did not request them in |currpollfd->events|
|
||||
+ */
|
||||
+ if ((currps->eventvar_found & pfnm[pi].flag) ||
|
||||
+ ((currpollfd->revents & (POLLHUP|POLLNVAL|POLLERR)) & pfnm[pi].flag))
|
||||
+ {
|
||||
+ np = nv_open_fmt(shp->var_tree, NV_VARNAME|NV_NOFAIL, "%s[%s].revents.%s", parrayname, subname, pfnm[pi].name);
|
||||
+ if (!np)
|
||||
+ continue;
|
||||
+
|
||||
+ nv_putval(np, ((currpollfd->revents & pfnm[pi].flag)?"true":"false"), 0);
|
||||
+ nv_close(np);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/* |main()| for poll(1) builtin */
|
||||
+extern
|
||||
+int b_poll(int argc, char *argv[], Shbltin_t* context)
|
||||
+{
|
||||
+ Shell_t *shp = sh_contexttoshell(context);
|
||||
+ Namval_t *np,
|
||||
+ *array_np,
|
||||
+ *array_np_sub;
|
||||
+ Sfio_t *strstk = NULL; /* stk object for memory allocations */
|
||||
+ const char *parrayname, /* name of array with poll data */
|
||||
+ *eventarrayname = NULL, /* name of array with indexes to results */
|
||||
+ *subname, /* current subscript */
|
||||
+ *s;
|
||||
+ int n;
|
||||
+ int fd;
|
||||
+ nfds_t numpollfd = 0; /* number of entries to poll */
|
||||
+ int i,
|
||||
+ j;
|
||||
+ double timeout = -1.;
|
||||
+ char buff[PATH_MAX*2+1]; /* fixme: theoretically enough to hold two variable names */
|
||||
+ bool ttyraw = false;
|
||||
+ bool pollsfio = true;
|
||||
+ int pi; /* index for |pfnm| */
|
||||
+ struct pollfd *pollfd = NULL, /* data for poll(2) */
|
||||
+ *currpollfd; /* current |pollfd| we are working on */
|
||||
+ struct pollstat *pollstat = NULL, /* context data from shell array */
|
||||
+ *currps; /* current |pollstat| we are working on */
|
||||
+ int retval = 0; /* return value of builtin */
|
||||
+
|
||||
+ while (n = optget(argv, sh_optpoll)) switch (n)
|
||||
+ {
|
||||
+ case 't':
|
||||
+ errno = 0;
|
||||
+ timeout = strtod(opt_info.arg, (char **)NULL);
|
||||
+ if (errno != 0)
|
||||
+ errormsg(SH_DICT, ERROR_system(1), "%s: invalid timeout", opt_info.arg);
|
||||
+
|
||||
+ /* -t uses seconds */
|
||||
+ if (timeout >=0)
|
||||
+ timeout *= 1000.;
|
||||
+ break;
|
||||
+ case 'e':
|
||||
+ eventarrayname = opt_info.arg;
|
||||
+ break;
|
||||
+ case 'S':
|
||||
+ pollsfio=opt_info.num?true:false;
|
||||
+ break;
|
||||
+ case 'R':
|
||||
+ ttyraw=opt_info.num?true:false;
|
||||
+ break;
|
||||
+ case ':':
|
||||
+ errormsg(SH_DICT, ERROR_ERROR, "%s", opt_info.arg);
|
||||
+ break;
|
||||
+ case '?':
|
||||
+ errormsg(SH_DICT, ERROR_usage(2), "%s", opt_info.arg);
|
||||
+ break;
|
||||
+ }
|
||||
+ argc -= opt_info.index;
|
||||
+ argv += opt_info.index;
|
||||
+ if(argc!=1)
|
||||
+ errormsg(SH_DICT, ERROR_usage(2), optusage((char*)0));
|
||||
+
|
||||
+ parrayname = argv[0];
|
||||
+
|
||||
+ strstk = stkopen(0);
|
||||
+ if (!strstk)
|
||||
+ errormsg(SH_DICT, ERROR_system(1), e_nospace);
|
||||
+
|
||||
+ array_np = nv_open(parrayname, shp->var_tree, NV_VARNAME|NV_NOFAIL|NV_NOADD);
|
||||
+ if (!array_np)
|
||||
+ {
|
||||
+ stkclose(strstk);
|
||||
+ errormsg(SH_DICT, ERROR_system(1), "cannot find array variable %s", parrayname);
|
||||
+ }
|
||||
+ if (!nv_isattr(array_np, NV_ARRAY))
|
||||
+ {
|
||||
+ nv_close(array_np);
|
||||
+ stkclose(strstk);
|
||||
+ errormsg(SH_DICT, ERROR_system(1), "variable %s is not an array", parrayname);
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Count number of array elememts. We need to do it "manually"
|
||||
+ * to handle sparse indexed and associative arrays
|
||||
+ */
|
||||
+ nv_putsub(array_np, NULL, ARRAY_SCAN);
|
||||
+ array_np_sub = array_np;
|
||||
+ do
|
||||
+ {
|
||||
+ if (!(subname=nv_getsub(array_np_sub)))
|
||||
+ break;
|
||||
+ numpollfd++;
|
||||
+ } while(array_np_sub && nv_nextsub(array_np_sub));
|
||||
+
|
||||
+ /*
|
||||
+ * Done with counting, now we need to allocate a work area big enough
|
||||
+ */
|
||||
+ pollfd = (struct pollfd *)stkalloc(strstk, (sizeof(struct pollfd) * numpollfd));
|
||||
+ pollstat = (struct pollstat *)stkalloc(strstk, (sizeof(struct pollstat) * numpollfd));
|
||||
+ if (!pollfd || !pollstat)
|
||||
+ {
|
||||
+ errormsg(SH_DICT, ERROR_ERROR, e_nospace);
|
||||
+ goto done_error;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Walk the array again and fetch the data we need...
|
||||
+ */
|
||||
+ nv_putsub(array_np, NULL, ARRAY_SCAN);
|
||||
+ array_np_sub = array_np;
|
||||
+ i = 0;
|
||||
+ do
|
||||
+ {
|
||||
+ currps=&pollstat[i];
|
||||
+ currpollfd=&pollfd[i];
|
||||
+
|
||||
+ if (!(subname=nv_getsub(array_np_sub)))
|
||||
+ break;
|
||||
+
|
||||
+ currps->array_subscript=subname=stkcopy(strstk, subname);
|
||||
+ if (!subname)
|
||||
+ {
|
||||
+ errormsg(SH_DICT, ERROR_ERROR, e_nospace);
|
||||
+ goto done_error;
|
||||
+ }
|
||||
+
|
||||
+ np = nv_open_fmt(shp->var_tree, NV_VARNAME|NV_NOFAIL|NV_NOADD, "%s[%s].fd", parrayname, subname);
|
||||
+ if (!np)
|
||||
+ {
|
||||
+ errormsg(SH_DICT, ERROR_ERROR, "missing pollfd %s[%s].fd", parrayname, subname);
|
||||
+ goto done_error;
|
||||
+ }
|
||||
+ fd = (int)nv_getnum(np);
|
||||
+ nv_close(np);
|
||||
+ if ((fd < -1) || (fd > OPEN_MAX))
|
||||
+ {
|
||||
+ errormsg(SH_DICT, ERROR_ERROR, "invalid pollfd %s[%s].fd %d", parrayname, subname, fd);
|
||||
+ goto done_error;
|
||||
+ }
|
||||
+ currpollfd->fd = fd;
|
||||
+
|
||||
+ np = nv_open_fmt(shp->var_tree, NV_VARNAME|NV_NOFAIL|NV_COMVAR|NV_NOADD, "%s[%s].events", parrayname, subname);
|
||||
+ if (!np)
|
||||
+ {
|
||||
+ errormsg(SH_DICT, ERROR_ERROR, "missing pollfd %s[%s].events", parrayname, subname);
|
||||
+ goto done_error;
|
||||
+ }
|
||||
+ nv_close(np);
|
||||
+
|
||||
+ currpollfd->events=0;
|
||||
+ currpollfd->revents=0;
|
||||
+ currps->eventvar_found=0;
|
||||
+ for (pi=0 ; pfnm[pi].name != NULL ; pi++)
|
||||
+ {
|
||||
+ const char *s;
|
||||
+
|
||||
+ np = nv_open_fmt(shp->var_tree, NV_VARNAME|NV_NOFAIL|NV_NOADD, "%s[%s].events.%s", parrayname, subname, pfnm[pi].name);
|
||||
+ if (!np)
|
||||
+ continue;
|
||||
+
|
||||
+ currps->eventvar_found |= pfnm[pi].flag;
|
||||
+ s=nv_getval(np);
|
||||
+ if ((s != NULL) && (!strcmp(s, "true")))
|
||||
+ currpollfd->events |= pfnm[pi].flag;
|
||||
+ nv_close(np);
|
||||
+ }
|
||||
+
|
||||
+ i++;
|
||||
+ } while(array_np_sub && nv_nextsub(array_np_sub));
|
||||
+
|
||||
+ nv_close(array_np);
|
||||
+ array_np=NULL;
|
||||
+
|
||||
+ /*
|
||||
+ * If sfio handles fds we need to check whether there are
|
||||
+ * any data in the sfio buffers and remember this information
|
||||
+ * so we can set { POLLIN, POLLOUT } on demand to reflect
|
||||
+ * this information.
|
||||
+ */
|
||||
+ if (pollsfio)
|
||||
+ {
|
||||
+ Sfio_t **sfd;
|
||||
+ int num_sfd=0,
|
||||
+ active_sfd=0;
|
||||
+
|
||||
+ sfd = (Sfio_t **)stkalloc(strstk, (sizeof(Sfio_t *) * (numpollfd+1)));
|
||||
+ if (!sfd)
|
||||
+ {
|
||||
+ errormsg(SH_DICT, ERROR_ERROR, e_nospace);
|
||||
+ goto done_error;
|
||||
+ }
|
||||
+
|
||||
+ for (i=0 ; i < numpollfd ; i++)
|
||||
+ {
|
||||
+ currps=&pollstat[i];
|
||||
+ fd=pollfd[i].fd;
|
||||
+
|
||||
+ currps->sfio.sfd=(fd>=0)?sh_fd2sfio(fd):NULL;
|
||||
+ currps->sfio.flags=0;
|
||||
+ if (currps->sfio.sfd!=NULL)
|
||||
+ {
|
||||
+ /* Only add |currps->sfio.sfd| to the
|
||||
+ * |sfd| array (list of |Sfio_t*|
|
||||
+ * passed to |sfpoll()|) if it is not
|
||||
+ * in that list yet. This prevents
|
||||
+ * that we call |sfpoll()| on the same
|
||||
+ * sfio stream multiple times (which
|
||||
+ * can happen if pollfd contains the
|
||||
+ * same fd multiple times (which is
|
||||
+ * valid usage, for example if multiple
|
||||
+ * consumers pool their pool lists in
|
||||
+ * one poll call or listen to different
|
||||
+ * sets of poll event flags)).
|
||||
+ */
|
||||
+ for (j=0 ; j < num_sfd ; j++)
|
||||
+ {
|
||||
+ if (sfd[j]==currps->sfio.sfd)
|
||||
+ break;
|
||||
+ }
|
||||
+ if (j == num_sfd)
|
||||
+ sfd[num_sfd++]=currps->sfio.sfd;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ active_sfd = sfpoll(&sfd[0], num_sfd, 0);
|
||||
+ if (active_sfd > 0)
|
||||
+ {
|
||||
+ ssize_t sfpoll_flags;
|
||||
+
|
||||
+ for (i=0 ; i < active_sfd ; i++)
|
||||
+ {
|
||||
+ sfpoll_flags=sfvalue(sfd[i]);
|
||||
+
|
||||
+ /*
|
||||
+ * We have to loop over all entries
|
||||
+ * because single fd may be polled
|
||||
+ * multiple times in different pollfd
|
||||
+ * entries
|
||||
+ */
|
||||
+ for (j=0 ; j < numpollfd ; j++)
|
||||
+ {
|
||||
+ if (pollstat[j].sfio.sfd == sfd[i])
|
||||
+ pollstat[j].sfio.flags=sfpoll_flags;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Create --eventarray array on demand
|
||||
+ */
|
||||
+ if (eventarrayname)
|
||||
+ {
|
||||
+ np = nv_open_fmt(shp->var_tree, NV_VARNAME|NV_ARRAY|NV_NOFAIL, "%s", eventarrayname);
|
||||
+ if (!np)
|
||||
+ {
|
||||
+ errormsg(SH_DICT, ERROR_ERROR, "could not create eventarray variable %s", eventarrayname);
|
||||
+ goto done_error;
|
||||
+ }
|
||||
+
|
||||
+ nv_close(np);
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Make sure we poll on "raw" tty to catch _every_ keystroke...
|
||||
+ */
|
||||
+ if (ttyraw)
|
||||
+ {
|
||||
+ for (i=0 ; i < numpollfd ; i++)
|
||||
+ {
|
||||
+ fd=pollfd[i].fd;
|
||||
+ if ((fd >=0) && (shp->fdstatus[fd]&IOTTY))
|
||||
+ tty_raw(fd, 1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * ... then poll for events...
|
||||
+ */
|
||||
+ n = poll_loop(context, pollfd, numpollfd, timeout);
|
||||
+
|
||||
+ /*
|
||||
+ * ... and restore the tty's to "cooked" mode
|
||||
+ */
|
||||
+ if (ttyraw)
|
||||
+ {
|
||||
+ for (i=0 ; i < numpollfd ; i++)
|
||||
+ {
|
||||
+ fd=pollfd[i].fd;
|
||||
+ if ((fd >=0) && (shp->fdstatus[fd]&IOTTY))
|
||||
+ tty_cooked(fd);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (n < 0)
|
||||
+ {
|
||||
+ /* |ERROR_system(0)| won't quit the builtin */
|
||||
+ errormsg(SH_DICT, ERROR_system(0), "poll(2) failure");
|
||||
+ retval=1;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Write results back into the array
|
||||
+ */
|
||||
+ for (i=0 ; i < numpollfd ; i++)
|
||||
+ {
|
||||
+ /* Adjust data in |pollfd[i]| to reflect sfio stream status (if requested) */
|
||||
+ if (pollsfio)
|
||||
+ {
|
||||
+ if ((pollfd[i].events & POLLIN) && (pollstat[i].sfio.flags & SF_READ))
|
||||
+ pollfd[i].revents |= POLLIN;
|
||||
+ if ((pollfd[i].events & POLLOUT) && (pollstat[i].sfio.flags & SF_WRITE))
|
||||
+ pollfd[i].revents |= POLLOUT;
|
||||
+ }
|
||||
+
|
||||
+ set_compound_revents(shp, parrayname, &pollstat[i], &pollfd[i]);
|
||||
+
|
||||
+ if (eventarrayname && pollfd[i].revents)
|
||||
+ {
|
||||
+ sprintf(buff, "%s+=( '%s' )", eventarrayname, pollstat[i].array_subscript);
|
||||
+ sh_trap(buff, 0);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ goto done;
|
||||
+
|
||||
+done_error:
|
||||
+ retval=1;
|
||||
+done:
|
||||
+ if (array_np)
|
||||
+ nv_close(array_np);
|
||||
+ if (strstk)
|
||||
+ stkclose(strstk);
|
||||
+
|
||||
+ return(retval);
|
||||
+}
|
||||
--- src/cmd/ksh93/data/builtins.c
|
||||
+++ src/cmd/ksh93/data/builtins.c 2012-08-06 21:25:47.000000000 +0000
|
||||
@@ -109,6 +109,7 @@ const struct shtable3 shtab_builtins[] =
|
||||
#endif /* JOBS */
|
||||
"false", NV_BLTIN|BLT_ENV, bltin(false),
|
||||
"getopts", NV_BLTIN|BLT_ENV, bltin(getopts),
|
||||
+ "poll", NV_BLTIN, bltin(poll),
|
||||
"print", NV_BLTIN|BLT_ENV, bltin(print),
|
||||
"printf", NV_BLTIN|BLT_ENV, bltin(printf),
|
||||
"pwd", NV_BLTIN, bltin(pwd),
|
||||
--- src/cmd/ksh93/include/builtins.h
|
||||
+++ src/cmd/ksh93/include/builtins.h 2012-08-06 21:25:47.000000000 +0000
|
||||
@@ -100,6 +100,7 @@ extern int b_wait(int, char*[],Shbltin_t
|
||||
extern int b_whence(int, char*[],Shbltin_t*);
|
||||
|
||||
extern int b_alarm(int, char*[],Shbltin_t*);
|
||||
+extern int b_poll(int, char*[],Shbltin_t*);
|
||||
extern int b_print(int, char*[],Shbltin_t*);
|
||||
extern int b_printf(int, char*[],Shbltin_t*);
|
||||
extern int b_pwd(int, char*[],Shbltin_t*);
|
||||
--- src/cmd/ksh93/tests/builtin_poll.sh
|
||||
+++ src/cmd/ksh93/tests/builtin_poll.sh 2012-08-07 01:22:35.000000000 +0000
|
||||
@@ -0,0 +1,100 @@
|
||||
+########################################################################
|
||||
+# #
|
||||
+# This software is part of the ast package #
|
||||
+# Copyright (c) 2009-2012 Roland Mainz #
|
||||
+# and is licensed under the #
|
||||
+# Eclipse Public License, Version 1.0 #
|
||||
+# by AT&T Intellectual Property #
|
||||
+# #
|
||||
+# A copy of the License is available at #
|
||||
+# http://www.eclipse.org/org/documents/epl-v10.html #
|
||||
+# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
|
||||
+# #
|
||||
+# #
|
||||
+# Roland Mainz <roland.mainz@nrubsig.org> #
|
||||
+# #
|
||||
+########################################################################
|
||||
+
|
||||
+#
|
||||
+# Copyright (c) 2009, 2012, Roland Mainz. All rights reserved.
|
||||
+#
|
||||
+
|
||||
+#
|
||||
+# Test module to check the ksh93 "poll" builtin
|
||||
+#
|
||||
+
|
||||
+# test setup
|
||||
+function err_exit
|
||||
+{
|
||||
+ print -u2 -n '\t'
|
||||
+ print -u2 -r ${Command}[$1]: "${@:2}"
|
||||
+ (( Errors++ ))
|
||||
+}
|
||||
+alias err_exit='err_exit $LINENO'
|
||||
+
|
||||
+set -o nounset
|
||||
+Command=${0##*/}
|
||||
+integer Errors=0
|
||||
+
|
||||
+typeset ocwd
|
||||
+typeset tmpdir
|
||||
+
|
||||
+# create temporary test directory
|
||||
+ocwd="${PWD}"
|
||||
+tmpdir="${ mktemp -t -d 'test_builtin_poll.XXXXXXXX' ; }" || err_exit 'Cannot create temporary directory.'
|
||||
+
|
||||
+cd "${tmpdir}" || { err_exit "cd ${tmpdir} failed." ; exit $((Errors<125?Errors:125)) ; }
|
||||
+
|
||||
+
|
||||
+# basic tests
|
||||
+function test1
|
||||
+{
|
||||
+ compound d1=(
|
||||
+ compound -A u=(
|
||||
+ [y]=( integer fd=5 ; compound events=( pollin='true' ) revents=() )
|
||||
+ [x]=( integer fd=5 ; compound events=( pollin='true' ) revents=() )
|
||||
+ )
|
||||
+ )
|
||||
+
|
||||
+ # test 1:
|
||||
+ print -C d1 >'testdata.cpv'
|
||||
+ cat '/dev/zero' | $SHELL -o errexit -c 'builtin poll ; read -C <"testdata.cpv" d1 ; redirect 5<&0 ; poll -e d1.res -t 5. d1.u ; print -C d1 >"testdata.cpv"' >'log.txt' 2>&1 || err_exit "poll returned non-zero exit code $?"
|
||||
+ unset d1 ; read -C d1 <'testdata.cpv' || err_exit 'Cannot read test data.'
|
||||
+ [[ "$(< 'log.txt')" == '' ]] || err_exit "Excepted empty stdout/stderr, got $(printf '%q\n' "$(< 'log.txt')")"
|
||||
+ [[ "${d1.u[x].revents.pollin-}" == 'true' ]] || err_exit "d1.u[x].revents contains '${d1.u[x].revents-}', not 'POLLIN'"
|
||||
+ [[ "${d1.u[y].revents.pollin-}" == 'true' ]] || err_exit "d1.u[y].revents contains '${d1.u[y].revents-}', not 'POLLIN'"
|
||||
+ [[ "${d1.res[*]-}" == 'x y' ]] || err_exit "d1.res contains '${d1.res[*]-}', not 'x y'"
|
||||
+
|
||||
+ rm 'testdata.cpv' 'log.txt'
|
||||
+
|
||||
+ # test 2:
|
||||
+ unset d1.res
|
||||
+ d1.u[z]=( integer fd=5 ; compound events=( pollout='true' ) revents=() )
|
||||
+
|
||||
+ print -C d1 >'testdata.cpv'
|
||||
+ $SHELL -o errexit -c 'builtin poll ; read -C <"testdata.cpv" d1 ; { poll -e d1.res -t 5. d1.u ; } 5<"/dev/null" 5>"/dev/null" ; print -C d1 >"testdata.cpv"' >'log.txt' 2>&1 || err_exit "poll returned non-zero exit code $?"
|
||||
+ unset d1 ; read -C d1 <'testdata.cpv' || err_exit 'Cannot read test data.'
|
||||
+
|
||||
+ [[ "$(< 'log.txt')" == '' ]] || err_exit "Excepted empty stdout/stderr, got $(printf '%q\n' "$(< 'log.txt')")"
|
||||
+ [[ "${d1.u[x].revents.pollin-}" == 'true' ]] || err_exit "d1.u[x].revents contains '${d1.u[x].revents-}', not 'POLLIN'"
|
||||
+ [[ "${d1.u[y].revents.pollin-}" == 'true' ]] || err_exit "d1.u[y].revents contains '${d1.u[y].revents-}', not 'POLLIN'"
|
||||
+ [[ "${d1.u[z].revents.pollout-}" == 'true' ]] || err_exit "d1.u[z].revents contains '${d1.u[z].revents-}', not 'POLLOUT,'"
|
||||
+ [[ "${d1.res[*]-}" == 'x y z' ]] || err_exit "d1.res contains '${d1.res[*]-}', not 'x y z'"
|
||||
+
|
||||
+ rm 'testdata.cpv' 'log.txt'
|
||||
+
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# run tests
|
||||
+builtin 'poll' || err_exit 'poll builtin not found.'
|
||||
+
|
||||
+test1
|
||||
+
|
||||
+# cleanup
|
||||
+cd "${ocwd}"
|
||||
+rmdir "${tmpdir}" || err_exit "Cannot remove temporary directory ${tmpdir}."
|
||||
+
|
||||
+
|
||||
+# tests done
|
||||
+exit $((Errors<125?Errors:125))
|
@ -1,8 +1,8 @@
|
||||
--- lib/package/ast-ksh.pkg
|
||||
+++ lib/package/ast-ksh.pkg 2011-07-05 16:29:57.891926052 +0000
|
||||
@@ -1,4 +1,4 @@
|
||||
-ast-ksh :PACKAGE: ksh93 msggen libast libcmd libcoshell libsum libdll
|
||||
+ast-ksh :PACKAGE: ksh93 msggen msgcc libpp libast libcmd libcoshell libsum libdll
|
||||
-ast-ksh :PACKAGE: ksh93 libast libcmd libcoshell libsum libdll
|
||||
+ast-ksh :PACKAGE: msgcc ksh93 libpp libast libcmd libcoshell libsum libdll
|
||||
|
||||
:COVERS: ksh
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- ./src/lib/libast/features/lib
|
||||
+++ ./src/lib/libast/features/lib 2014-02-17 15:26:32.488708646 +0000
|
||||
@@ -134,27 +134,6 @@ tst lib_poll_fd_1 note{ fd is first arg
|
||||
--- src/lib/libast/features/lib
|
||||
+++ src/lib/libast/features/lib
|
||||
@@ -92,27 +92,6 @@
|
||||
}
|
||||
}end
|
||||
|
||||
@ -28,11 +28,9 @@
|
||||
exp _lib_poll _lib_poll_fd_1||_lib_poll_fd_2
|
||||
|
||||
tst lib_poll_notimer note{ poll with no fds ignores timeout }end execute{
|
||||
--- ./src/lib/libast/features/spawn
|
||||
+++ ./src/lib/libast/features/spawn 2014-02-17 15:29:54.946324412 +0000
|
||||
@@ -6,123 +6,6 @@ lib posix_spawnattr_setfchdir,posix_spaw
|
||||
|
||||
mem inheritance.pgroup spawn.h
|
||||
@@ -241,120 +220,6 @@
|
||||
}
|
||||
}end
|
||||
|
||||
-tst lib_posix_spawn unistd.h stdlib.h spawn.h -Dfork=______fork note{ posix_spawn exists and it works and its worth using }end status{
|
||||
- #include <sys/types.h>
|
||||
@ -57,9 +55,9 @@
|
||||
- posix_spawnattr_t attr;
|
||||
- int n;
|
||||
- int status;
|
||||
- char* cmd[4];
|
||||
- char* cmd[3];
|
||||
- char tmp[1024];
|
||||
- if (argv[2])
|
||||
- if (argv[1])
|
||||
- _exit(signal(SIGHUP, SIG_DFL) != SIG_IGN);
|
||||
- signal(SIGHUP, SIG_IGN);
|
||||
- if (posix_spawnattr_init(&attr))
|
||||
@ -79,9 +77,8 @@
|
||||
- }
|
||||
- /* first try an a.out and verify that SIGHUP is ignored */
|
||||
- cmd[0] = argv[0];
|
||||
- cmd[1] = argv[1];
|
||||
- cmd[2] = "test";
|
||||
- cmd[3] = 0;
|
||||
- cmd[1] = "test";
|
||||
- cmd[2] = 0;
|
||||
- if (posix_spawn(&pid, cmd[0], 0, &attr, cmd, 0))
|
||||
- {
|
||||
- NOTE("posix_spawn() FAILED");
|
||||
@ -144,8 +141,6 @@
|
||||
- NOTE("ENOEXEC invokes sh");
|
||||
- else if (status == 0)
|
||||
- NOTE("ENOEXEC reports no error");
|
||||
- else
|
||||
- NOTE("ENOEXEC produces non-zero exit status");
|
||||
- }
|
||||
- _exit(n);
|
||||
- }
|
||||
|
86
ksh.changes
86
ksh.changes
@ -1,3 +1,89 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Dec 20 13:18:32 CET 2017 - mls@suse.de
|
||||
|
||||
- fix build with new glibc versions
|
||||
new patch: ksh93-filedefined.dif
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 12 13:23:14 CEST 2016 - mls@suse.de
|
||||
|
||||
- fix locking error in spawn implementation [bnc#988213]
|
||||
new patch: ksh93-spawnlock.dif
|
||||
- make patch ordering the same as in sle-11
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 5 14:49:03 CEST 2016 - mls@suse.de
|
||||
|
||||
- own the ksh files in /etc/alternatives [bnc#987362] [bnc#962069]
|
||||
- fix leak in optimize processing [bnc#982423]
|
||||
new patch: ksh93-optimizeleak.dif
|
||||
- fix editor prediction code garbling input [bnc#964966]
|
||||
new patch: ksh93-edpredict.dif
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Dec 16 16:00:53 CET 2015 - mls@suse.de
|
||||
|
||||
- add ast suffix to optbin manpages to prevent file conflicts
|
||||
- fix fd leak when doing redirects in a subshell [bnc#954856]
|
||||
new patch: ksh93-redirectleak.dif
|
||||
- rewrite ksh93-backtick.dif to a more correct version
|
||||
[bnc#953533] [bnc#955221]
|
||||
- also tweak ksh93-backtick.dif so that the pipe is drained after
|
||||
io_restore is called.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Sep 15 18:07:09 CEST 2015 - mls@suse.de
|
||||
|
||||
- fix freeing memory twice if an array is turned into an
|
||||
compound variable and then unset [bnc#924043]
|
||||
new patch: ksh93-nvtree-free.dif
|
||||
- backport fix for segmentation fault with 'typeset -RF'
|
||||
new patch: ksh93-int16double.dif
|
||||
- backport hanging command substitution with large output fix from
|
||||
upstream [bnc#887320] [bnc#926172] [bnc#934437]
|
||||
new patch: ksh93-backtick.dif
|
||||
- backport job list corruption fix from ksg93v [bnc#924318]
|
||||
new patch: ksh93-jpold.dif
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 12 13:54:45 CEST 2015 - mls@suse.de
|
||||
|
||||
- go back to ksh93u to have a stable version in SLE-12
|
||||
use 93vu as version so that the software stack sees this
|
||||
as an update. (FATE#319107, bsc#939252)
|
||||
- add back the following patches:
|
||||
* astksh_builtin_poll20120806_001.diff
|
||||
* ksh93-backticks.dif
|
||||
* ksh93-crashes.dif
|
||||
* ksh93-dttree-crash.dif
|
||||
* ksh93-fdstatus.dif
|
||||
* ksh93-heredoclex.dif
|
||||
* ksh93-jobs.dif
|
||||
* ksh93-sfio.dif
|
||||
* ksh93-uninitialized.dif
|
||||
- fix stk aliasing code [bnc#844071]
|
||||
new patch: ksh93-stkalias.dif
|
||||
- fix stk restoration in sh_exec [bnc#844071]
|
||||
new patch: ksh93-stkfreeze.dif
|
||||
- make a unknown location fatal in stkset so that we get a core
|
||||
dump right away instead of later in an unrelated part of code
|
||||
new patch: ksh93-stkset-abort.dif
|
||||
- fix build with std malloc
|
||||
new patch: ksh93-malloc-hook.dif
|
||||
- backport job locking code fix
|
||||
new patch: ksh93-joblock.dif
|
||||
- disable vfork, use fork instead
|
||||
new patch: ksh93-disable-vfork.dif
|
||||
- fix crash when the subshell number overflows [bnc#893031]
|
||||
new patch: ksh93-longenv.dif
|
||||
- fix path normalization in cd command [bnc#867401]
|
||||
new patch: ksh93-cdpwd.dif
|
||||
- fix segfault in dirname when cwd is gone [bnc#852160]
|
||||
new patch: ksh93-subshellpwd.dif
|
||||
- Fix ksh using wrong files is some elements in the path do not
|
||||
exist [bnc#899014]
|
||||
new patch: ksh93-path-skip.dif
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jun 11 10:42:59 UTC 2015 - schwab@suse.de
|
||||
|
||||
|
270
ksh.spec
270
ksh.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package ksh
|
||||
#
|
||||
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
Name: ksh
|
||||
%global date 2014-06-25
|
||||
%global date 2012-08-01
|
||||
%global use_suid_exe 0
|
||||
%if %suse_version > 1210
|
||||
%global use_opt_bins 1
|
||||
@ -25,13 +25,11 @@ Name: ksh
|
||||
%global use_opt_bins 0
|
||||
%endif
|
||||
%if !0%{?qemu_user_space_build:1}
|
||||
%bcond_without do_tests
|
||||
%global do_tests 1
|
||||
%else
|
||||
%bcond_with do_tests
|
||||
%global do_tests 0
|
||||
%endif
|
||||
%bcond_with use_locale
|
||||
%bcond_with vm_debug
|
||||
%bcond_without skip_signals
|
||||
%global use_locale 0
|
||||
BuildRequires: bind-utils
|
||||
BuildRequires: bison
|
||||
BuildRequires: flex
|
||||
@ -50,15 +48,6 @@ BuildRequires: libbz2-devel
|
||||
%if %suse_version > 1120
|
||||
BuildRequires: update-alternatives
|
||||
%endif
|
||||
%if %{with vm_debug}
|
||||
BuildRequires: ccache
|
||||
BuildRequires: gdb
|
||||
BuildRequires: less
|
||||
BuildRequires: procps
|
||||
BuildRequires: strace
|
||||
BuildRequires: valgrind
|
||||
BuildRequires: vim
|
||||
%endif
|
||||
# /bin/ex and /bin/ed required for build
|
||||
BuildRequires: awk
|
||||
BuildRequires: ed
|
||||
@ -74,7 +63,7 @@ Requires(preun): update-alternatives
|
||||
%if %use_suid_exe
|
||||
PreReq: permissions
|
||||
%endif
|
||||
Version: 93v
|
||||
Version: 93vu
|
||||
Release: 0
|
||||
Summary: Korn Shell
|
||||
License: CPL-1.0 and EPL-1.0
|
||||
@ -112,31 +101,64 @@ Patch14: ksh93-ia64.dif
|
||||
Patch15: ksh93-s390.dif
|
||||
Patch16: ksh93-gcc.dif
|
||||
Patch17: ksh93-heredoc.dif
|
||||
Patch18: ksh93-jobs.dif
|
||||
Patch19: ksh93-reg.dif
|
||||
Patch20: ksh93-aso.dif
|
||||
Patch21: ksh93-vm.dif
|
||||
Patch22: ksh93-limit-name-len.dif
|
||||
Patch23: ksh93-foreground-prgrp.dif
|
||||
Patch24: ksh93-builtin.dif
|
||||
# PATCH-FIX-UPSTREAM ksh93-read-dont-ignore-esc.dif [bnc#765171]
|
||||
# is part of ksh93u+ 2012-06-28
|
||||
# PATCH-EXTEND-UPSTREAM astksh_builtin_poll20120806_001.diff [bnc#779888]
|
||||
Patch27: astksh_builtin_poll20120806_001.diff
|
||||
# PATCH-FIX-UPSTREAM ksh93-env.dif [bnc#785266, bnc#803613]
|
||||
Patch28: ksh93-env.dif
|
||||
# PATCH-FIX-SUSE ksh93-typedef.dif
|
||||
# PATCH-FIX-UPSTREAM ksh93-typedef.dif
|
||||
Patch29: ksh93-typedef.dif
|
||||
# PATCH-EXTEND-UPSTREAM ksh93-pathtemp.dif [bnc#786134]
|
||||
# the fix is part of ksh93u+ 2012-06-28
|
||||
# nevertheless the /dev/shm extension is useful
|
||||
Patch30: ksh93-pathtemp.dif
|
||||
# PATCH-FIX-UPSTREAM ksh93-dttree-crash.dif [bnc#795324]
|
||||
Patch31: ksh93-dttree-crash.dif
|
||||
# PATCH-FIX-UPSTREAM ksh93-heredoclex.dif [bnc#804998]
|
||||
Patch32: ksh93-heredoclex.dif
|
||||
# PATCH-FIX-UPSTREAM ksh93-fdstatus.dif [bnc#808449, bnc#814135]
|
||||
# this is a backport from the alpha version ksh93v-2013-04-22
|
||||
Patch33: ksh93-fdstatus.dif
|
||||
# PATCH-FIX-UPSTREAM ksh93-alias-k.dif [bnc#824187]
|
||||
Patch34: ksh93-alias-k.dif
|
||||
# PATCH-FIX-SUSE Do not use mount(2) system call instead of fs3d_mount(3ast)
|
||||
Patch36: ksh93-fs3d.dif
|
||||
# PATCH-FIX-SUSE Various crashes fixed for bnc#844071
|
||||
Patch37: ksh93-crashes.dif
|
||||
# PATCH-FIX-SUSE Strings in backticks cannot be longer than 65536 characters bnc#887320
|
||||
Patch38: ksh93-backticks.dif
|
||||
# PATCH-FIX-UPSTREAM fix use of cc -E without -P
|
||||
Patch39: cpp.patch
|
||||
Patch42: ksh-locale.patch
|
||||
# PATCH-FIX-SUSE Reduce warnings about uninitialized varaibles (most of them are handled correct)
|
||||
Patch35: ksh93-uninitialized.dif
|
||||
# PATCH-FIX-UPSTREAM Ouch ... use memmove instead of memcopy on overlapping areas
|
||||
Patch36: ksh93-sfio.dif
|
||||
# [bnc#899014]
|
||||
Patch37: ksh93-path-skip.dif
|
||||
Patch38: ksh93-fs3d.dif
|
||||
# [bnc#852160]
|
||||
Patch39: ksh93-subshellpwd.dif
|
||||
# [bnc#867401]
|
||||
Patch40: ksh93-cdpwd.dif
|
||||
# [bnc#893031]
|
||||
Patch41: ksh93-longenv.dif
|
||||
Patch42: ksh93-malloc-hook.dif
|
||||
Patch43: ksh93-disable-vfork.dif
|
||||
Patch44: ksh93-joblock.dif
|
||||
Patch45: ksh93-stkfreeze.dif
|
||||
Patch46: ksh93-stkset-abort.dif
|
||||
Patch47: ksh93-stkalias.dif
|
||||
Patch48: ksh93-backtick.dif
|
||||
Patch49: ksh93-nvtree-free.dif
|
||||
Patch50: ksh93-int16double.dif
|
||||
Patch51: ksh93-jpold.dif
|
||||
Patch52: ksh93-redirectleak.dif
|
||||
Patch53: ksh93-optimizeleak.dif
|
||||
Patch54: ksh93-edpredict.dif
|
||||
Patch55: ksh93-spawnlock.dif
|
||||
Patch56: ksh93-filedefined.dif
|
||||
Patch62: ksh-locale.patch
|
||||
Patch63: cpp.patch
|
||||
|
||||
%description
|
||||
The original Korn Shell. The ksh is an sh-compatible command
|
||||
@ -177,7 +199,7 @@ chmod +x %{S:31}
|
||||
tar --use-compress-program=bzcat -xf %{S:1} \
|
||||
lib/package/ \
|
||||
src/cmd/ksh93/ src/lib/libast/ src/lib/libcmd/ src/lib/libcoshell/ src/lib/libdll/ src/lib/libsum/ \
|
||||
src/cmd/builtin/ src/cmd/msggen/ src/cmd/msgcc/ src/lib/libpp/ src/lib/libuu/
|
||||
src/cmd/builtin/ src/cmd/msgcc/ src/lib/libpp/ src/lib/libuu/
|
||||
if test -d share ; then
|
||||
find share/ \( -name chef -o -name fudd -o -name piglatin -o -name valley \) -a -type d |\
|
||||
xargs -r rm -vrf
|
||||
@ -187,6 +209,7 @@ if test -d share ; then
|
||||
find share/ -type d -a -empty | xargs -r rm -vrf
|
||||
fi
|
||||
%patch
|
||||
%patch62
|
||||
%patch1
|
||||
%ifarch %arm
|
||||
%patch2
|
||||
@ -208,40 +231,78 @@ fi
|
||||
%patch15
|
||||
%patch16
|
||||
%patch17
|
||||
%patch18
|
||||
%patch19
|
||||
%patch20
|
||||
%patch21
|
||||
%patch22
|
||||
%patch23
|
||||
%patch24
|
||||
%patch27
|
||||
%patch28
|
||||
%patch29
|
||||
%patch30
|
||||
%patch31
|
||||
%patch32
|
||||
%patch33
|
||||
%patch34
|
||||
%patch35
|
||||
%patch36
|
||||
%patch37
|
||||
#%patch38
|
||||
%patch39 -p1
|
||||
%patch38
|
||||
%patch39
|
||||
%patch40
|
||||
%patch41
|
||||
%patch42
|
||||
%if 0%{?ksh_no_vfork}
|
||||
%patch43
|
||||
%endif
|
||||
%patch44
|
||||
%patch45
|
||||
%patch46
|
||||
%patch47
|
||||
%patch48
|
||||
%patch49
|
||||
%patch50
|
||||
%patch51
|
||||
%patch52
|
||||
%patch53
|
||||
%patch54
|
||||
%patch55
|
||||
%patch56
|
||||
|
||||
%patch63 -p 1
|
||||
|
||||
%build
|
||||
PATH=$(getconf PATH)
|
||||
export PATH
|
||||
unset MALLOC_CHECK_
|
||||
#
|
||||
# Check for a clean signal environment for runtime tests
|
||||
#
|
||||
typeset -i IGNORED=0x$(ps --no-headers -o ignored $$)
|
||||
typeset -i SIGMASK=0x0
|
||||
typeset -i usesigexec=0
|
||||
|
||||
if test "$USESIGEXEC" != 0 ; then
|
||||
#
|
||||
# The environment variable USESIGEXEC is set by the sigexec
|
||||
# helper program which provides a real pty/tty pair as well
|
||||
# as a clean signal environment.
|
||||
#
|
||||
${CC:-gcc} ${RPM_OPT_FLAGS} -D_GNU_SOURCE -o sigexec %{S:42} -lutil
|
||||
let "SIGMASK|=(1<<($(kill -l PIPE)-1))"
|
||||
let "SIGMASK|=(1<<($(kill -l URG) -1))"
|
||||
let "SIGMASK|=(1<<($(kill -l XFSZ)-1))"
|
||||
|
||||
((IGNORED & SIGMASK)) && let ++usesigexec || true
|
||||
test -t 0 || let ++usesigexec
|
||||
|
||||
%if 0%{?qemu_user_space_build:1}
|
||||
# agraf: In a qemu user space build, ps can not find the actual sigmask
|
||||
# of processes, so we run into an endless loop. Disable sigexec.
|
||||
usesigexec=0
|
||||
%endif
|
||||
|
||||
if ((usesigexec > 0)) ; then
|
||||
${CC:-gcc} ${RPM_OPT_FLAGS} -o sigexec %{S:42} -lutil
|
||||
for fd in /proc/$$/fd/*; do
|
||||
test -s $fd -a ! -c $fd && break || true
|
||||
done
|
||||
set -- $(readlink $fd)
|
||||
exec ./sigexec $SHELL ${1+"$@"}
|
||||
fi
|
||||
IGNORED=0x$(ps --no-headers -o ignored $$)
|
||||
|
||||
AR="ar"
|
||||
CC=gcc
|
||||
@ -328,14 +389,10 @@ fi
|
||||
#define SHOPT_REMOTE 1
|
||||
#define SHOPT_CMDLIB_BLTIN 1
|
||||
#define SHOPT_CMDLIB_HDR <cmdlist.h>
|
||||
#define SHOPT_CMDLIB_DIR "/opt/ast/bin"
|
||||
#define SH_CMDLIB_DIR "/opt/ast/bin"
|
||||
#define SHOPT_CMDLIB_DIR "/%{_lib}/ast/bin"
|
||||
#define SH_CMDLIB_DIR "/%{_lib}/ast/bin"
|
||||
#define THISPROG "/%{_lib}/ast/bin/suid_exec"
|
||||
%if %{with vm_debug}
|
||||
#define _AST_std_malloc 1
|
||||
%else
|
||||
#define _AST_std_malloc 0
|
||||
%endif
|
||||
#define _map_malloc 1
|
||||
EOF
|
||||
set +C
|
||||
@ -379,12 +436,12 @@ fi
|
||||
export _PACKAGE_HOSTTYPE_
|
||||
;;
|
||||
ppc64le|powerpc64le)
|
||||
RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-O[s0-9]/-O}"
|
||||
# -mpowerpc64 is correct, the compiler defaults to
|
||||
# little endian anyway
|
||||
cflags -mpowerpc64 RPM_OPT_FLAGS
|
||||
HOSTTYPE=linux.powerpc64le
|
||||
;;
|
||||
RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-O[s0-9]/-O}"
|
||||
# -mpowerpc64 is correct, the compiler defaults to
|
||||
# little endian anyway
|
||||
cflags -mpowerpc64 RPM_OPT_FLAGS
|
||||
HOSTTYPE=linux.powerpc64le
|
||||
;;
|
||||
ppc64|powerpc64)
|
||||
RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-O[s0-9]/-O}"
|
||||
cflags -mpowerpc64 RPM_OPT_FLAGS
|
||||
@ -415,9 +472,6 @@ fi
|
||||
cflags -fsigned-bitfields RPM_OPT_FLAGS
|
||||
cflags -fsigned-chars RPM_OPT_FLAGS
|
||||
cflags -fsigned-zeros RPM_OPT_FLAGS
|
||||
%if %{with vm_debug}
|
||||
cflags -fno-omit-frame-pointer RPM_OPT_FLAGS
|
||||
%endif
|
||||
case "$(gcc --version | head -n 1)" in
|
||||
*4.[012345].*)
|
||||
cflags -fno-tree-sink RPM_OPT_FLAGS ;;
|
||||
@ -425,8 +479,6 @@ fi
|
||||
esac
|
||||
cflags -g2 RPM_OPT_FLAGS
|
||||
cflags -pipe RPM_OPT_FLAGS
|
||||
cflags -D_GNU_SOURCE RPM_OPT_FLAGS
|
||||
cflags -D_REENTRANT RPM_OPT_FLAGS
|
||||
cflags -Wl,-O2 LDFLAGS
|
||||
cflags -Wl,--hash-size=16699 LDFLAGS
|
||||
cflags -Wl,-O2 LDSOFLG
|
||||
@ -435,7 +487,7 @@ fi
|
||||
cflags -Wl,--hash-size=8599 LDSOFLG
|
||||
cflags -Wl,-Bsymbolic-functions LDSOFLG
|
||||
cflags -Wl,-rpath,/%{_lib}/ast LDSOFLG
|
||||
RPM_OPT_FLAGS="$RPM_OPT_FLAGS $LARGEFILE"
|
||||
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE $LARGEFILE"
|
||||
RPM_OPT_FLAGS="$RPM_OPT_FLAGS $IGNORE $FEATURE"
|
||||
mam_cc_L=use
|
||||
mam_cc_OPTIMIZE=-pipe
|
||||
@ -489,7 +541,7 @@ fi
|
||||
*) cflags @$nobuiltin RPM_OPT_FLAGS
|
||||
esac
|
||||
|
||||
export | grep -vE 'PROFILEREAD|PWD|MAIL|HOME|HOST|HIST|LESS' > .env
|
||||
export | grep -vE 'PROFILEREAD|PWD|MAIL|HOME|HOST|HIST|LESS|TMP' > .env
|
||||
bin/package make CCFLAGS="$RPM_OPT_FLAGS -I${root}/include" HOSTTYPE="$HOSTTYPE" AR="$AR" CC="$CC"
|
||||
root=$(echo ${PWD}/arch/linux*)
|
||||
test -d $root || exit 1
|
||||
@ -529,30 +581,19 @@ fi
|
||||
popd
|
||||
done
|
||||
base=src/cmd/ksh93
|
||||
%if %{with do_tests}
|
||||
pushd ${root}/bin
|
||||
mkdir ${TMPDIR}/bin
|
||||
for bin in * ; do
|
||||
test -e "$bin" || continue
|
||||
test "$bin" = ".paths" && continue
|
||||
test "${bin#*.}" = "old" && continue
|
||||
install -m 0755 $bin ${TMPDIR}/bin/
|
||||
done
|
||||
popd
|
||||
test=${PWD}/${base}/tests
|
||||
OPATH=$PATH
|
||||
OSHELL=$SHELL
|
||||
PATH=${TMPDIR}/bin:$PATH
|
||||
SHELL=${TMPDIR}/bin/ksh
|
||||
SHCOMP=${TMPDIR}/bin/shcomp
|
||||
PATH=$PATH:${root}/bin
|
||||
SHELL=${root}/bin/ksh
|
||||
SHCOMP=${root}/bin/shcomp
|
||||
export PATH SHCOMP SHELL
|
||||
%if %do_tests
|
||||
pushd ${test}
|
||||
%if %{with skip_signals}
|
||||
echo "Skip signal.sh test as this is broken due used malloc() in signal handlers"
|
||||
rm -vf signal.sh
|
||||
%endif
|
||||
typeset -i failed=0
|
||||
ln -sf ${root}/lib ${test}/../
|
||||
sed -ri '/^L[[:blank:]]/a \t 8000' pty.sh
|
||||
sed -ri 's/(SECONDS[[:blank:]]*>[[:blank:]]*)([[:digit:]]+)/\18/' signal.sh
|
||||
unset ${!LESS*}
|
||||
printf '\033[1m'
|
||||
grep -E '^(model name|flags)[[:blank:]]*:' /proc/cpuinfo | sort -ur | fold -s
|
||||
@ -564,19 +605,6 @@ fi
|
||||
test "$result" = xy || exit 1
|
||||
result=$(${SHELL} -c 'echo | echo "x$(/bin/echo y)"')
|
||||
test "$result" = xy || exit 1
|
||||
${SHELL} -c 'trap "exit 0" EXIT; typeset -T X=(typeset x; function x.get { :; }); X -a xs=((x=yo) (x=jo))'
|
||||
cat > eso_boot.mod.sh <<-'EOF'
|
||||
. ./environ.mod
|
||||
EOF
|
||||
cat > environ.mod <<-'EOF'
|
||||
f() {
|
||||
:
|
||||
}
|
||||
unset -f f
|
||||
msg=`echo OK`
|
||||
echo $msg
|
||||
EOF
|
||||
${SHELL} ./eso_boot.mod.sh
|
||||
exec 3> ${TMPDIR:-/tmp}/log
|
||||
LANG=POSIX
|
||||
strace $MEMORY -o '!%{S:31}' ${SHELL} %{S:10} 400
|
||||
@ -632,7 +660,6 @@ fi
|
||||
s@^\+ g?cc@$SHELL msgcc -M-set=ast $includes@
|
||||
s@[[:blank:]]-c[[:blank:]]([^[:blank:]\.]+/([^[:blank:]\.\/]+))\.c@ -c \1\.c -o msgs/\2\.mso@p
|
||||
}" ${root}/lib/package/gen/make.out > src/cmd/ksh93/doit
|
||||
%if %{with use_locale}
|
||||
pushd src/cmd/ksh93
|
||||
mkdir msgs
|
||||
${root}/lib/probe/C/pp/probe $(type -p gcc) > pp_default.h
|
||||
@ -641,7 +668,6 @@ fi
|
||||
rm -rf msgs/
|
||||
popd
|
||||
msggen share/locale/C/LC_MESSAGES/libshell src/cmd/ksh93/libshell.msg
|
||||
%endif
|
||||
pushd ${root}/bin
|
||||
PATH=$PATH:.
|
||||
set -- $(shcomp --version 2>&1)
|
||||
@ -666,7 +692,7 @@ fi
|
||||
mkdir -p %{buildroot}%{_mandir}
|
||||
mkdir %{buildroot}%{_mandir}/man1
|
||||
mkdir %{buildroot}%{_mandir}/man3
|
||||
%if %{with use_locale}
|
||||
%if %use_locale
|
||||
mkdir -p %{buildroot}%{_datadir}/locale
|
||||
%endif
|
||||
mkdir -p %{buildroot}%{_datadir}/ksh/fun
|
||||
@ -688,10 +714,10 @@ fi
|
||||
touch %{buildroot}/%{_sysconfdir}/alternatives/usr-bin-ksh
|
||||
touch %{buildroot}/%{_sysconfdir}/alternatives/ksh.1.gz
|
||||
touch %{buildroot}/%{_sysconfdir}/alternatives/rksh.1.gz
|
||||
ln -sf %{_sysconfdir}/alternatives/ksh %{buildroot}/bin/ksh
|
||||
ln -sf %{_sysconfdir}/alternatives/usr-bin-ksh %{buildroot}%{_bindir}/ksh
|
||||
ln -sf %{_sysconfdir}/alternatives/ksh.1.gz %{buildroot}/%{_mandir}/man1/ksh.1.gz
|
||||
ln -sf %{_sysconfdir}/alternatives/rksh.1.gz %{buildroot}/%{_mandir}/man1/rksh.1.gz
|
||||
ln -sf %{_sysconfdir}/alternatives/ksh %{buildroot}/bin/ksh
|
||||
ln -sf %{_sysconfdir}/alternatives/usr-bin-ksh %{buildroot}%{_bindir}/ksh
|
||||
ln -sf %{_sysconfdir}/alternatives/ksh.1.gz %{buildroot}/%{_mandir}/man1/ksh.1.gz
|
||||
ln -sf %{_sysconfdir}/alternatives/rksh.1.gz %{buildroot}/%{_mandir}/man1/rksh.1.gz
|
||||
%else
|
||||
# create ghost files
|
||||
ln -sf /bin/true %{buildroot}/bin/ksh
|
||||
@ -710,9 +736,6 @@ fi
|
||||
ln -sf /%{_lib}/ast/$so %{buildroot}%{_libdir}/ast/${so%%%%.*}.so
|
||||
done
|
||||
rm -f %{buildroot}%{_libdir}/ast/*.so.*
|
||||
%if %suse_version >= 1320
|
||||
ln -s %{_sysconfdir}/bash.bashrc %{buildroot}%{_sysconfdir}/ksh.kshrc
|
||||
%endif
|
||||
sed -rn '/^\.de Af/,/^\.\./p;/^\.de aF/,/^\.\./p' man/man3/int.3 > af.man
|
||||
for man in $(grep -l '\.}S' man/man[138]/*.[138]); do
|
||||
sed -ri '1r af.man' $man
|
||||
@ -722,12 +745,10 @@ fi
|
||||
done
|
||||
install -m 0644 lib/*.a %{buildroot}%{_libdir}/ast/
|
||||
%if %suse_version > 1120
|
||||
install -m 0644 man/man1/sh.1 %{buildroot}%{_mandir}/man1/ksh93.1ast
|
||||
ln -sf ../man1/ksh93.1ast.gz %{buildroot}/%{_mandir}/man1/ksh.1ast.gz
|
||||
ln -sf ../man1/ksh93.1ast.gz %{buildroot}/%{_mandir}/man1/rksh.1ast.gz
|
||||
install -m 0644 man/man1/sh.1 %{buildroot}%{_mandir}/man1/ksh93.1
|
||||
%else
|
||||
install -m 0644 man/man1/sh.1 %{buildroot}%{_mandir}/man1/ksh.1ast
|
||||
ln -sf ../man1/ksh.1ast.gz %{buildroot}/%{_mandir}/man1/rksh.1ast.gz
|
||||
install -m 0644 man/man1/sh.1 %{buildroot}%{_mandir}/man1/ksh.1
|
||||
ln -sf ../man1/ksh.1.gz %{buildroot}/%{_mandir}/man1/rksh.1.gz
|
||||
%endif
|
||||
install -m 0644 man/man1/shcomp.1ast %{buildroot}%{_mandir}/man1/shcomp.1ast
|
||||
%if %use_opt_bins
|
||||
@ -740,24 +761,12 @@ fi
|
||||
ast=${man}ast
|
||||
install -m 0644 man/man3/${man} %{buildroot}%{_mandir}/man3/${ast}
|
||||
done
|
||||
if test -d include/ast/sys/ ; then
|
||||
for head in include/ast/* ; do
|
||||
test -e "$head" || continue
|
||||
if test -d $head ; then
|
||||
install -d %{buildroot}%{_includedir}/ast/${head##*/}
|
||||
install -m 0644 ${head}/* %{buildroot}%{_includedir}/ast/${head##*/}/
|
||||
else
|
||||
install -m 0644 $head %{buildroot}%{_includedir}/ast/
|
||||
fi
|
||||
done
|
||||
else
|
||||
install -m 0644 include/ast/* %{buildroot}%{_includedir}/ast/
|
||||
fi
|
||||
install -m 0644 include/ast/* %{buildroot}%{_includedir}/ast/
|
||||
if cmp -s %{buildroot}%{_includedir}/ast/namval.h %{buildroot}%{_includedir}/ast/ast_namval.h ; then
|
||||
ln -sf ast_namval.h %{buildroot}%{_includedir}/ast/namval.h
|
||||
fi
|
||||
popd
|
||||
%if %{with use_locale}
|
||||
%if %use_locale
|
||||
for msg in share/locale/* ; do
|
||||
test -d $msg || continue
|
||||
mkdir -p %{buildroot}%{_datadir}/locale/${msg##*/}/LC_MESSAGES
|
||||
@ -809,9 +818,7 @@ fi
|
||||
%endif
|
||||
|
||||
%post
|
||||
%if %suse_version < 1320
|
||||
test -e etc/bash.bashrc && ln -sf bash.bashrc etc/ksh.kshrc || true
|
||||
%endif
|
||||
%if %use_suid_exe
|
||||
%if %{defined set_permissions}
|
||||
%set_permissions /%{_lib}/ast/bin/suid_exec
|
||||
@ -835,8 +842,8 @@ fi
|
||||
%endif
|
||||
--install /bin/ksh ksh /bin/ksh93 20 \
|
||||
--slave %{_bindir}/ksh usr-bin-ksh /bin/ksh93 \
|
||||
--slave %{_mandir}/man1/ksh.1ast.gz ksh.1.gz %{_mandir}/man1/ksh93.1ast.gz \
|
||||
--slave %{_mandir}/man1/rksh.1ast.gz rksh.1.gz %{_mandir}/man1/ksh93.1ast.gz
|
||||
--slave %{_mandir}/man1/ksh.1.gz ksh.1.gz %{_mandir}/man1/ksh93.1.gz \
|
||||
--slave %{_mandir}/man1/rksh.1.gz rksh.1.gz %{_mandir}/man1/ksh93.1.gz
|
||||
%else
|
||||
if test -x /%{_lib}/ast/bin/ksh ; then
|
||||
rm -f /%{_lib}/ast/bin/ksh
|
||||
@ -851,13 +858,13 @@ fi
|
||||
%endif
|
||||
|
||||
%if %suse_version > 1120
|
||||
|
||||
%preun
|
||||
if test $1 -eq 0 ; then
|
||||
%{_sbindir}/update-alternatives --quiet --remove ksh /bin/ksh93
|
||||
fi
|
||||
%endif
|
||||
|
||||
%if %suse_version < 1320
|
||||
%postun
|
||||
if test $1 -eq 0 -a ! -x bin/ksh ; then
|
||||
if test ! -x bin/pdksh ; then
|
||||
@ -867,14 +874,11 @@ if test $1 -eq 0 -a ! -x bin/ksh ; then
|
||||
rm -f bin/ksh %{_exec_prefix}/bin/ksh
|
||||
%endif
|
||||
fi
|
||||
%endif
|
||||
|
||||
%if %suse_version < 1320
|
||||
%posttrans
|
||||
if test -x bin/ksh -o -x bin/pdksh ; then
|
||||
test -e etc/bash.bashrc && ln -sf bash.bashrc etc/ksh.kshrc || true
|
||||
fi
|
||||
%endif
|
||||
|
||||
%files -f ksh.lang
|
||||
%defattr(-,root,root)
|
||||
@ -890,6 +894,7 @@ fi
|
||||
%{_bindir}/ksh
|
||||
%doc %{_mandir}/man1/ksh.1.gz
|
||||
%doc %{_mandir}/man1/rksh.1.gz
|
||||
%doc %{_mandir}/man1/ksh93.1.gz
|
||||
%ghost %{_sysconfdir}/alternatives/ksh
|
||||
%ghost %{_sysconfdir}/alternatives/usr-bin-ksh
|
||||
%ghost %{_sysconfdir}/alternatives/ksh.1.gz
|
||||
@ -897,14 +902,8 @@ fi
|
||||
%else
|
||||
%ghost %verify(not link) /bin/ksh
|
||||
%ghost %verify(not link) %{_bindir}/ksh
|
||||
%endif
|
||||
%if %suse_version > 1120
|
||||
%ghost %verify(not link) %{_mandir}/man1/ksh.1ast.gz
|
||||
%ghost %verify(not link) %{_mandir}/man1/rksh.1ast.gz
|
||||
%doc %{_mandir}/man1/ksh93.1ast.gz
|
||||
%else
|
||||
%doc %{_mandir}/man1/ksh.1ast.gz
|
||||
%doc %{_mandir}/man1/rksh.1ast.gz
|
||||
%doc %{_mandir}/man1/ksh.1.gz
|
||||
%doc %{_mandir}/man1/rksh.1.gz
|
||||
%endif
|
||||
%doc %{_mandir}/man1/shcomp.1ast.gz
|
||||
%if %use_opt_bins
|
||||
@ -926,9 +925,6 @@ fi
|
||||
%dir %{_datadir}/ksh
|
||||
%dir %{_datadir}/ksh/fun
|
||||
%{_datadir}/ksh/fun/*
|
||||
%if %suse_version >= 1320
|
||||
%{_sysconfdir}/ksh.kshrc
|
||||
%endif
|
||||
|
||||
%files -n ksh-devel
|
||||
%defattr(-,root,root)
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- src/cmd/ksh93/data/builtins.c
|
||||
+++ src/cmd/ksh93/data/builtins.c 2014-02-19 11:05:51.494209208 +0000
|
||||
@@ -85,8 +85,8 @@ const struct shtable3 shtab_builtins[] =
|
||||
+++ src/cmd/ksh93/data/builtins.c 2013-06-11 16:24:46.269439322 +0000
|
||||
@@ -78,8 +78,8 @@ const struct shtable3 shtab_builtins[] =
|
||||
#if _bin_newgrp || _usr_bin_newgrp
|
||||
"newgrp", NV_BLTIN|BLT_ENV|BLT_SPC, Bltin(login),
|
||||
#endif /* _bin_newgrp || _usr_bin_newgrp */
|
||||
@ -8,6 +8,6 @@
|
||||
- "hash", NV_BLTIN|BLT_SPC, bltin(alias),
|
||||
+ "alias", NV_BLTIN|BLT_SPC|BLT_DCL, bltin(alias),
|
||||
+ "hash", NV_BLTIN|BLT_SPC|BLT_DCL, bltin(alias),
|
||||
"enum", NV_BLTIN|BLT_ENV|BLT_SPC|BLT_DCL,bltin(enum),
|
||||
"eval", NV_BLTIN|BLT_ENV|BLT_SPC|BLT_EXIT,bltin(eval),
|
||||
"exit", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(return),
|
||||
"fc", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(hist),
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- src/lib/libast/features/aso
|
||||
+++ src/lib/libast/features/aso 2014-02-18 13:50:32.820793960 +0000
|
||||
@@ -10,7 +10,10 @@ if aso note{ gcc 4.1+ 64 bit memory atom
|
||||
+++ src/lib/libast/features/aso 2012-02-20 12:09:41.065934089 +0100
|
||||
@@ -5,7 +5,10 @@ if aso note{ gcc 4.1+ 64 bit memory atom
|
||||
int main()
|
||||
{
|
||||
uint64_t i = 0;
|
||||
@ -11,8 +11,8 @@
|
||||
+ return __sync_fetch_and_add(&i,7)+__sync_fetch_and_add(&j,7)+__sync_fetch_and_add(&l,7)+__sync_fetch_and_add(&m,7);
|
||||
}
|
||||
}end && {
|
||||
#define _ASO_INTRINSIC 1
|
||||
@@ -46,7 +49,9 @@ elif aso note{ gcc 4.1+ 32 bit memory at
|
||||
#define _aso_cas8(p,o,n) __sync_val_compare_and_swap(p,o,n)
|
||||
@@ -31,7 +34,9 @@ elif aso note{ gcc 4.1+ 32 bit memory at
|
||||
int main()
|
||||
{
|
||||
uint32_t i = 0;
|
||||
@ -22,4 +22,4 @@
|
||||
+ return __sync_fetch_and_add(&i,7)+__sync_fetch_and_add(&j,7)+__sync_fetch_and_add(&l,7);
|
||||
}
|
||||
}end && {
|
||||
#define _ASO_INTRINSIC 1
|
||||
#define _aso_cas8(p,o,n) __sync_val_compare_and_swap(p,o,n)
|
||||
|
151
ksh93-backtick.dif
Normal file
151
ksh93-backtick.dif
Normal file
@ -0,0 +1,151 @@
|
||||
--- ./src/cmd/ksh93/sh/io.c.orig 2015-12-09 11:17:56.993309654 +0000
|
||||
+++ ./src/cmd/ksh93/sh/io.c 2015-12-09 11:20:10.671805470 +0000
|
||||
@@ -692,7 +692,7 @@ int sh_close(register int fd)
|
||||
}
|
||||
if(fd >= shp->gd->lim.open_max)
|
||||
sh_iovalidfd(shp,fd);
|
||||
- if(!(sp=shp->sftable[fd]) || sfclose(sp) < 0)
|
||||
+ if(!(sp=shp->sftable[fd]) || sffileno(sp) != fd || sfclose(sp) < 0)
|
||||
{
|
||||
int err=errno;
|
||||
if(fdnotify)
|
||||
--- ./src/cmd/ksh93/sh/jobs.c.orig 2015-11-27 12:18:44.168204649 +0000
|
||||
+++ ./src/cmd/ksh93/sh/jobs.c 2015-11-27 14:49:54.255529119 +0000
|
||||
@@ -1630,6 +1630,8 @@ int job_wait(register pid_t pid)
|
||||
}
|
||||
sfsync(sfstderr);
|
||||
job.waitsafe = 0;
|
||||
+ if (pw && !job.savesig && shp->subshell)
|
||||
+ sh_readpipedata();
|
||||
nochild = job_reap(job.savesig);
|
||||
if(job.waitsafe)
|
||||
continue;
|
||||
--- ./src/cmd/ksh93/sh/macro.c.orig 2015-08-11 12:00:52.454212675 +0000
|
||||
+++ ./src/cmd/ksh93/sh/macro.c 2015-11-27 14:02:27.493074974 +0000
|
||||
@@ -2183,7 +2183,7 @@ static void comsubst(Mac_t *mp,register
|
||||
stkseek(stkp,soff+foff+64);
|
||||
stkseek(stkp,soff);
|
||||
}
|
||||
- if(foff > IOBSIZE)
|
||||
+ if(sffileno(sp)>=0 && foff>(Sfoff_t)IOBSIZE)
|
||||
sfsetbuf(sp,NULL,SF_UNBOUND);
|
||||
while((str=(char*)sfreserve(sp,SF_UNBOUND,0)) && (c=bufsize=sfvalue(sp))>0)
|
||||
{
|
||||
--- ./src/cmd/ksh93/sh/subshell.c.orig 2015-08-11 11:59:29.030528394 +0000
|
||||
+++ ./src/cmd/ksh93/sh/subshell.c 2015-12-09 11:20:38.614700038 +0000
|
||||
@@ -105,11 +105,23 @@ static struct subshell
|
||||
#if SHOPT_COSHELL
|
||||
void *coshell;
|
||||
#endif /* SHOPT_COSHELL */
|
||||
+ char *pipedata;
|
||||
+ size_t pipedatalen;
|
||||
} *subshell_data;
|
||||
|
||||
static long subenv;
|
||||
|
||||
|
||||
+static void sh_addtopipedata(struct subshell *sp, void *buf, size_t len)
|
||||
+{
|
||||
+ if (!sp->pipedata)
|
||||
+ sp->pipedata = malloc(len);
|
||||
+ else
|
||||
+ sp->pipedata = realloc(sp->pipedata, sp->pipedatalen + len);
|
||||
+ memcpy(sp->pipedata + sp->pipedatalen, buf, len);
|
||||
+ sp->pipedatalen += len;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* This routine will turn the sftmp() file into a real /tmp file or pipe
|
||||
* if the /tmp file create fails
|
||||
@@ -146,7 +158,7 @@ void sh_subtmpfile(Shell_t *shp)
|
||||
sh_fcntl(sp->pipefd,F_SETFD,FD_CLOEXEC);
|
||||
/* write the data to the pipe */
|
||||
if(off = sftell(sfstdout))
|
||||
- write(fds[1],sfsetbuf(sfstdout,(Void_t*)sfstdout,0),(size_t)off);
|
||||
+ sh_addtopipedata(sp, sfsetbuf(sfstdout,(Void_t*)sfstdout,0),(size_t)off);
|
||||
sfclose(sfstdout);
|
||||
if((sh_fcntl(fds[1],F_DUPFD, 1)) != 1)
|
||||
errormsg(SH_DICT,ERROR_system(1),e_file+4);
|
||||
@@ -173,6 +185,50 @@ void sh_subtmpfile(Shell_t *shp)
|
||||
}
|
||||
}
|
||||
|
||||
+void sh_readpipedata()
|
||||
+{
|
||||
+ register struct subshell *sp = subshell_data;
|
||||
+ fd_set rfd;
|
||||
+ if (sp)
|
||||
+ sp = sp->pipe;
|
||||
+ if (!sp || sp->pipefd < 0 || sp->pipefd >= FD_SETSIZE)
|
||||
+ return;
|
||||
+ sigset_t sigsaved, sigchld;
|
||||
+ sigemptyset(&sigchld);
|
||||
+ sigaddset(&sigchld, SIGCHLD);
|
||||
+ /* block sigchild */
|
||||
+ sigprocmask(SIG_BLOCK, &sigchld, &sigsaved);
|
||||
+ FD_ZERO(&rfd);
|
||||
+ FD_SET(sp->pipefd, &rfd);
|
||||
+ while (!job.savesig) {
|
||||
+ int i = pselect(sp->pipefd + 1, &rfd, 0, 0, 0, &sigsaved);
|
||||
+ if (i > 0) {
|
||||
+ char buf[4096];
|
||||
+ i = read(sp->pipefd, buf, 4096);
|
||||
+ if (i == 0 || (i < 0 && errno != EINTR))
|
||||
+ break;
|
||||
+ sh_addtopipedata(sp, buf, i);
|
||||
+ }
|
||||
+ }
|
||||
+ sigprocmask(SIG_SETMASK, &sigsaved, 0);
|
||||
+}
|
||||
+
|
||||
+void sh_emptypipe(struct subshell *sp, int pipefd)
|
||||
+{
|
||||
+ int i;
|
||||
+ char buf[4096];
|
||||
+ if (!sp || pipefd < 0)
|
||||
+ return;
|
||||
+ for (;;) {
|
||||
+ i = read(pipefd, buf, 4096);
|
||||
+ if (i < 0 && errno == EINTR)
|
||||
+ continue;
|
||||
+ if (i <= 0)
|
||||
+ break;
|
||||
+ sh_addtopipedata(sp, buf, i);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
|
||||
/*
|
||||
* This routine creates a temp file if necessary and creates a subshell.
|
||||
@@ -614,7 +670,7 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_
|
||||
sp->tmpfd = -1;
|
||||
sp->pipefd = -1;
|
||||
/* use sftmp() file for standard output */
|
||||
- if(!(iop = sftmp(comsub==1?PIPE_BUF:IOBSIZE)))
|
||||
+ if(!(iop = sftmp(comsub==1?SF_UNBOUND:IOBSIZE)))
|
||||
{
|
||||
sfswap(sp->saveout,sfstdout);
|
||||
errormsg(SH_DICT,ERROR_system(1),e_tmpcreate);
|
||||
@@ -822,6 +878,22 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_
|
||||
sh_argfree(shp,argsav,0);
|
||||
if(shp->topfd != buff.topfd)
|
||||
sh_iorestore(shp,buff.topfd|IOSUBSHELL,jmpval);
|
||||
+
|
||||
+ /* empty the pipe and move all data into iop */
|
||||
+ if (comsub && sp->pipefd>=0)
|
||||
+ {
|
||||
+ sh_emptypipe(sp, sffileno(iop));
|
||||
+ sfclose(iop);
|
||||
+ sp->pipefd = -1;
|
||||
+ iop = sftmp(SF_UNBOUND);
|
||||
+ if (sp->pipedatalen)
|
||||
+ sfwrite(iop, sp->pipedata, sp->pipedatalen);
|
||||
+ if (sp->pipedata)
|
||||
+ free(sp->pipedata);
|
||||
+ sp->pipedata = 0;
|
||||
+ sp->pipedatalen = 0;
|
||||
+ }
|
||||
+
|
||||
if(sp->sig)
|
||||
{
|
||||
if(sp->prev)
|
@ -1,15 +0,0 @@
|
||||
---
|
||||
src/cmd/ksh93/sh/macro.c | 2 -
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- src/cmd/ksh93/sh/macro.c
|
||||
+++ src/cmd/ksh93/sh/macro.c 2014-07-18 13:50:47.590235743 +0000
|
||||
@@ -2198,7 +2198,7 @@ static void comsubst(Mac_t *mp,register
|
||||
mp->shp->inlineno = error_info.line+mp->shp->st.firstline;
|
||||
t = (Shnode_t*)sh_parse(mp->shp, sp,SH_EOF|SH_NL);
|
||||
mp->shp->inlineno = c;
|
||||
- type = 1;
|
||||
+ type = 3;
|
||||
}
|
||||
#if KSHELL
|
||||
if(t)
|
@ -1,20 +1,6 @@
|
||||
--- src/cmd/builtin/pty.c
|
||||
+++ src/cmd/builtin/pty.c 2014-02-18 14:37:47.047276323 +0000
|
||||
@@ -113,6 +113,13 @@ USAGE_LICENSE
|
||||
#include <sys/stat.h>
|
||||
#include "FEATURE/pty"
|
||||
|
||||
+#ifdef __linux__
|
||||
+# if !_lib_openpty
|
||||
+# undef _lib_openpty
|
||||
+# define _lib_openpty 1
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
#define MODE_666 (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
|
||||
#define MAXNAME 64
|
||||
|
||||
@@ -216,27 +223,59 @@ mkpty(int* master, int* slave)
|
||||
+++ src/cmd/builtin/pty.c 2013-02-01 15:59:52.697952156 +0000
|
||||
@@ -216,27 +216,64 @@ mkpty(int* master, int* slave)
|
||||
#if !_lib_openpty
|
||||
char* sname;
|
||||
#endif
|
||||
@ -30,7 +16,7 @@
|
||||
*/
|
||||
|
||||
- alarm(4);
|
||||
- if (tcgetattr(sffileno(sfstderr), &tty) >= 0)
|
||||
- if (tcgetattr(STDERR_FILENO, &tty) >= 0)
|
||||
- ttyp = &tty;
|
||||
- else
|
||||
+ alarm(6);
|
||||
@ -60,10 +46,9 @@
|
||||
+ cfsetispeed(&tty, B38400);
|
||||
+ cfsetospeed(&tty, B38400);
|
||||
+#endif
|
||||
+ ttyp = &tty;
|
||||
+
|
||||
+ ttyp = &tty;
|
||||
#ifdef TIOCGWINSZ
|
||||
- if (ioctl(sffileno(sfstderr), TIOCGWINSZ, &win) >= 0)
|
||||
- if (ioctl(STDERR_FILENO, TIOCGWINSZ, &win) >= 0)
|
||||
- winp = &win;
|
||||
- else
|
||||
+ if (ioctl(sffileno(sfstderr), TIOCGWINSZ, &win) < 0)
|
||||
@ -80,10 +65,16 @@
|
||||
+ if (win.ws_col < 80)
|
||||
+ win.ws_col = 80;
|
||||
+ winp = &win;
|
||||
+#endif
|
||||
+#ifdef __linux__
|
||||
+# if !_lib_openpty
|
||||
+# undef _lib_openpty
|
||||
+# define _lib_openpty 1
|
||||
+# endif
|
||||
#endif
|
||||
#if _lib_openpty
|
||||
if (openpty(master, slave, NULL, ttyp, winp) < 0)
|
||||
@@ -279,6 +318,9 @@ mkpty(int* master, int* slave)
|
||||
@@ -279,6 +316,9 @@ mkpty(int* master, int* slave)
|
||||
#if !O_cloexec
|
||||
fcntl(*slave, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
@ -93,8 +84,89 @@
|
||||
alarm(0);
|
||||
return 0;
|
||||
}
|
||||
@@ -317,9 +357,13 @@ process(Sfio_t* mp, Sfio_t* lp, int dela
|
||||
char* s;
|
||||
Sfio_t* ip;
|
||||
Sfio_t* sps[2];
|
||||
+ struct stat dst;
|
||||
+ struct stat fst;
|
||||
|
||||
ip = sfstdin;
|
||||
- for (;;)
|
||||
+ if (!fstat(sffileno(ip), &dst) && !stat("/dev/null", &fst) && dst.st_dev == fst.st_dev && dst.st_ino == fst.st_ino)
|
||||
+ ip = 0;
|
||||
+ do
|
||||
{
|
||||
i = 0;
|
||||
t = timeout;
|
||||
@@ -336,39 +380,39 @@ process(Sfio_t* mp, Sfio_t* lp, int dela
|
||||
{
|
||||
if (n < 0)
|
||||
error(ERROR_SYSTEM|2, "poll failed");
|
||||
- if (t < 0)
|
||||
- break;
|
||||
+ break;
|
||||
}
|
||||
- else
|
||||
- for (i = 0; i < n; i++)
|
||||
+ for (i = t = 0; i < n; i++)
|
||||
+ {
|
||||
+ if (!(sfvalue(sps[i]) & SF_READ))
|
||||
+ /*skip*/;
|
||||
+ else if (sps[i] == mp)
|
||||
{
|
||||
- if (!(sfvalue(sps[i]) & SF_READ))
|
||||
- /*skip*/;
|
||||
- else if (sps[i] == mp)
|
||||
+ t++;
|
||||
+ if (!(s = (char*)sfreserve(mp, SF_UNBOUND, -1)))
|
||||
{
|
||||
- if (!(s = (char*)sfreserve(mp, SF_UNBOUND, -1)))
|
||||
- {
|
||||
- sfclose(mp);
|
||||
- mp = 0;
|
||||
- }
|
||||
- else if ((r = sfvalue(mp)) > 0 && (sfwrite(sfstdout, s, r) != r || sfsync(sfstdout)))
|
||||
- {
|
||||
- error(ERROR_SYSTEM|2, "output write failed");
|
||||
- goto done;
|
||||
- }
|
||||
+ sfclose(mp);
|
||||
+ mp = 0;
|
||||
}
|
||||
- else
|
||||
+ else if ((r = sfvalue(mp)) > 0 && (sfwrite(sfstdout, s, r) != r || sfsync(sfstdout)))
|
||||
{
|
||||
- if (!(s = sfgetr(ip, '\n', 1)))
|
||||
- ip = 0;
|
||||
- else if (sfputr(mp, s, '\r') < 0 || sfsync(mp))
|
||||
- {
|
||||
- error(ERROR_SYSTEM|2, "write failed");
|
||||
- goto done;
|
||||
- }
|
||||
+ error(ERROR_SYSTEM|2, "output write failed");
|
||||
+ goto done;
|
||||
}
|
||||
}
|
||||
- }
|
||||
+ else
|
||||
+ {
|
||||
+ t++;
|
||||
+ if (!(s = sfgetr(ip, '\n', 1)))
|
||||
+ ip = 0;
|
||||
+ else if (sfputr(mp, s, '\r') < 0 || sfsync(mp))
|
||||
+ {
|
||||
+ error(ERROR_SYSTEM|2, "write failed");
|
||||
+ goto done;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ } while (t);
|
||||
done:
|
||||
if (mp)
|
||||
sfclose(mp);
|
||||
--- src/cmd/builtin/what.c
|
||||
+++ src/cmd/builtin/what.c 2014-02-18 14:29:07.979144811 +0000
|
||||
+++ src/cmd/builtin/what.c 2012-02-13 11:02:18.645933606 +0000
|
||||
@@ -68,7 +68,7 @@ static struct
|
||||
int match;
|
||||
int single;
|
||||
|
19
ksh93-cdpwd.dif
Normal file
19
ksh93-cdpwd.dif
Normal file
@ -0,0 +1,19 @@
|
||||
--- ./src/cmd/ksh93/bltins/cd_pwd.c.orig 2014-11-13 16:07:38.336318883 +0000
|
||||
+++ ./src/cmd/ksh93/bltins/cd_pwd.c 2014-11-13 16:24:53.323415375 +0000
|
||||
@@ -116,9 +116,14 @@ int b_cd(int argc, char *argv[],Shbltin_
|
||||
char *sp;
|
||||
for(dp=dir; *dp=='.'; dp++)
|
||||
{
|
||||
- if(*++dp=='.' && (*++dp=='/' || *dp==0))
|
||||
+ if (dp[1]=='.' && (dp[2]=='/' || dp[2]==0))
|
||||
+ {
|
||||
n++;
|
||||
- else if(*dp && *dp!='/')
|
||||
+ dp += 2;
|
||||
+ }
|
||||
+ else if (dp[1]=='/' || dp[1]==0)
|
||||
+ dp++;
|
||||
+ else
|
||||
break;
|
||||
if(*dp==0)
|
||||
break;
|
@ -1,6 +1,6 @@
|
||||
--- src/lib/libast/astsa/ast.h
|
||||
+++ src/lib/libast/astsa/ast.h 2014-02-17 16:21:31.627048693 +0000
|
||||
@@ -100,6 +100,12 @@ typedef struct
|
||||
+++ src/lib/libast/astsa/ast.h 2012-02-21 12:03:33.000000000 +0000
|
||||
@@ -93,6 +93,12 @@ typedef struct
|
||||
#define pointerof(x) ((void*)((char*)0+(x)))
|
||||
#define roundof(x,y) (((x)+(y)-1)&~((y)-1))
|
||||
|
||||
@ -14,20 +14,18 @@
|
||||
#define offsetof(type,member) ((unsigned long)&(((type*)0)->member))
|
||||
#endif
|
||||
--- src/lib/libast/features/libpath.sh
|
||||
+++ src/lib/libast/features/libpath.sh 2014-02-18 11:00:22.655840483 +0000
|
||||
@@ -21,8 +21,8 @@
|
||||
+++ src/lib/libast/features/libpath.sh 2007-03-30 16:45:55.000000000 +0000
|
||||
@@ -21,7 +21,7 @@
|
||||
########################################################################
|
||||
ok=0
|
||||
for i in \
|
||||
- -x /lib/ld.so /lib/ld-*.so /usr/lib/ld.so /lib/rld \
|
||||
- -f /usr/shlib/libc.so /shlib/libc.so /usr/lib/libc.so \
|
||||
+ -x /lib64/ld.so /lib/ld.so /lib64/ld-*.so /lib/ld-*.so /usr/lib/ld.so /lib/rld \
|
||||
+ -f /usr/shlib/libc.so /shlib/libc.so /usr/lib/libc.so /usr/lib64/libc.so \
|
||||
-r /usr/shlib/libc.so /shlib/libc.so \
|
||||
-x /lib*/*ld*.so*
|
||||
-f /usr/shlib/libc.so /shlib/libc.so /usr/lib/libc.so \
|
||||
-r /usr/shlib/libc.so /shlib/libc.so
|
||||
do case $i in
|
||||
--- src/lib/libast/features/map.c
|
||||
+++ src/lib/libast/features/map.c 2014-02-17 16:21:31.627048693 +0000
|
||||
+++ src/lib/libast/features/map.c 2009-12-09 11:13:24.000000000 +0000
|
||||
@@ -67,10 +67,14 @@ main()
|
||||
#define _map_malloc 1
|
||||
printf("\n");
|
||||
@ -44,8 +42,8 @@
|
||||
printf("#undef eaccess\n");
|
||||
printf("#define eaccess _ast_eaccess\n");
|
||||
--- src/lib/libast/features/sys
|
||||
+++ src/lib/libast/features/sys 2014-02-17 16:21:31.627048693 +0000
|
||||
@@ -139,7 +139,7 @@ tst typ_signed_size_t output{
|
||||
+++ src/lib/libast/features/sys 2012-02-21 12:04:43.000000000 +0000
|
||||
@@ -134,7 +134,7 @@ tst typ_signed_size_t output{
|
||||
}
|
||||
}end
|
||||
|
||||
@ -55,7 +53,7 @@
|
||||
define EXIT_SUCCESS 0
|
||||
define MB_CUR_MAX 1
|
||||
--- src/lib/libdll/features/dll
|
||||
+++ src/lib/libdll/features/dll 2014-02-17 16:21:31.627048693 +0000
|
||||
+++ src/lib/libdll/features/dll 2007-03-30 16:40:59.000000000 +0000
|
||||
@@ -15,7 +15,7 @@ tst dll_DYNAMIC link{
|
||||
}end
|
||||
tst run{
|
||||
|
@ -1,28 +0,0 @@
|
||||
--- src/cmd/ksh93/sh/name.c
|
||||
+++ src/cmd/ksh93/sh/name.c 2014-05-14 11:00:22.538735546 +0000
|
||||
@@ -2645,6 +2645,7 @@ void _nv_unset(register Namval_t *np,int
|
||||
while(stkclose(slp->slptr)==1);
|
||||
else
|
||||
sfclose(slp->slptr);
|
||||
+ slp->slptr = 0;
|
||||
free((void*)np->nvalue.ip);
|
||||
np->nvalue.ip = 0;
|
||||
}
|
||||
--- src/cmd/ksh93/sh/parse.c
|
||||
+++ src/cmd/ksh93/sh/parse.c 2014-04-14 12:24:29.098237738 +0000
|
||||
@@ -486,11 +486,14 @@
|
||||
void sh_funstaks(register struct slnod *slp,int flag)
|
||||
{
|
||||
register struct slnod *slpold;
|
||||
- while(slpold=slp)
|
||||
+ while(slp)
|
||||
{
|
||||
if(slp->slchild)
|
||||
sh_funstaks(slp->slchild,flag);
|
||||
+ slpold = slp;
|
||||
slp = slp->slnext;
|
||||
+ if (!slpold->slptr)
|
||||
+ continue;
|
||||
if(flag<=0)
|
||||
stakdelete(slpold->slptr);
|
||||
else
|
11
ksh93-disable-vfork.dif
Normal file
11
ksh93-disable-vfork.dif
Normal file
@ -0,0 +1,11 @@
|
||||
--- src/lib/libast/features/lib.orig 2014-11-19 13:03:58.009305098 +0000
|
||||
+++ src/lib/libast/features/lib 2014-11-19 13:23:05.010183379 +0000
|
||||
@@ -221,7 +221,7 @@ tst lib_vfork unistd.h stdlib.h vfork.h
|
||||
_exit(2);
|
||||
}
|
||||
status = 1;
|
||||
- _exit(wait(&status) < 0 || status != 0);
|
||||
+ _exit(wait(&status) < 0 || status != 0 || 1);
|
||||
}
|
||||
}end
|
||||
|
960
ksh93-dttree-crash.dif
Normal file
960
ksh93-dttree-crash.dif
Normal file
@ -0,0 +1,960 @@
|
||||
--- src/cmd/ksh93/bltins/typeset.c
|
||||
+++ src/cmd/ksh93/bltins/typeset.c 2013-10-25 13:20:42.799733785 +0000
|
||||
@@ -579,7 +579,7 @@ static int setall(char **argv,regist
|
||||
np = sh_fsearch(shp,name,NV_ADD|HASH_NOSCOPE);
|
||||
else
|
||||
#endif /* SHOPT_NAMESPACE */
|
||||
- np = nv_open(name,sh_subfuntree(1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE);
|
||||
+ np = nv_open(name,sh_subfuntree(shp,1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1168,14 +1168,14 @@ static int unall(int argc, char **argv,
|
||||
{
|
||||
name = sh_optunalias;
|
||||
if(shp->subshell)
|
||||
- troot = sh_subaliastree(0);
|
||||
+ troot = sh_subaliastree(shp,0);
|
||||
}
|
||||
else
|
||||
name = sh_optunset;
|
||||
while(r = optget(argv,name)) switch(r)
|
||||
{
|
||||
case 'f':
|
||||
- troot = sh_subfuntree(1);
|
||||
+ troot = sh_subfuntree(shp,1);
|
||||
break;
|
||||
case 'a':
|
||||
all=1;
|
||||
--- src/cmd/ksh93/include/defs.h
|
||||
+++ src/cmd/ksh93/include/defs.h 2013-10-25 13:20:42.799733785 +0000
|
||||
@@ -423,10 +423,10 @@ extern void sh_printopts(Shopt_t,int,Sh
|
||||
extern int sh_readline(Shell_t*,char**,volatile int,int,ssize_t,long);
|
||||
extern Sfio_t *sh_sfeval(char*[]);
|
||||
extern void sh_setmatch(Shell_t*,const char*,int,int,int[],int);
|
||||
-extern Dt_t *sh_subaliastree(int);
|
||||
+extern Dt_t *sh_subaliastree(Shell_t*,int);
|
||||
extern void sh_scope(Shell_t*, struct argnod*, int);
|
||||
extern Namval_t *sh_scoped(Shell_t*, Namval_t*);
|
||||
-extern Dt_t *sh_subfuntree(int);
|
||||
+extern Dt_t *sh_subfuntree(Shell_t*,int);
|
||||
extern void sh_subjobcheck(pid_t);
|
||||
extern int sh_subsavefd(int);
|
||||
extern void sh_subtmpfile(Shell_t*);
|
||||
--- src/cmd/ksh93/sh/arith.c
|
||||
+++ src/cmd/ksh93/sh/arith.c 2013-10-25 13:20:42.799733785 +0000
|
||||
@@ -180,7 +180,10 @@ static Namval_t *scope(register Namval_t
|
||||
{
|
||||
ap = nv_arrayptr(np);
|
||||
if(ap && !ap->table)
|
||||
+ {
|
||||
ap->table = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(ap->table,shp,1);
|
||||
+ }
|
||||
if(ap && ap->table && (nq=nv_search(nv_getsub(np),ap->table,NV_ADD)))
|
||||
nq->nvenv = (char*)np;
|
||||
if(nq && nv_isnull(nq))
|
||||
--- src/cmd/ksh93/sh/array.c
|
||||
+++ src/cmd/ksh93/sh/array.c 2013-10-25 13:20:42.800733693 +0000
|
||||
@@ -79,6 +79,7 @@ struct assoc_array
|
||||
|
||||
static Namarr_t *array_scope(Namval_t *np, Namarr_t *ap, int flags)
|
||||
{
|
||||
+ Shell_t *shp = sh_getinterp();
|
||||
Namarr_t *aq;
|
||||
#if SHOPT_FIXEDARRAY
|
||||
struct fixed_array *fp;
|
||||
@@ -95,6 +96,7 @@ static Namarr_t *array_scope(Namval_t *n
|
||||
if(is_associative(aq))
|
||||
{
|
||||
aq->scope = (void*)dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(aq->scope,shp,1);
|
||||
dtview((Dt_t*)aq->scope,aq->table);
|
||||
aq->table = (Dt_t*)aq->scope;
|
||||
return(aq);
|
||||
@@ -271,6 +273,7 @@ int nv_arrayisset(Namval_t *np, Namarr_t
|
||||
*/
|
||||
static Namval_t *array_find(Namval_t *np,Namarr_t *arp, int flag)
|
||||
{
|
||||
+ Shell_t *shp=sh_getinterp();
|
||||
register struct index_array *ap = (struct index_array*)arp;
|
||||
register union Value *up;
|
||||
Namval_t *mp;
|
||||
@@ -373,7 +376,10 @@ static Namval_t *array_find(Namval_t *np
|
||||
{
|
||||
char *cp;
|
||||
if(!ap->header.table)
|
||||
+ {
|
||||
ap->header.table = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(ap->header.table,shp,1);
|
||||
+ }
|
||||
sfprintf(sh.strbuf,"%d",ap->cur);
|
||||
cp = sfstruse(sh.strbuf);
|
||||
mp = nv_search(cp, ap->header.table, NV_ADD);
|
||||
@@ -402,6 +408,7 @@ static Namval_t *array_find(Namval_t *np
|
||||
#if SHOPT_TYPEDEF
|
||||
int nv_arraysettype(Namval_t *np, Namval_t *tp, const char *sub, int flags)
|
||||
{
|
||||
+ Shell_t *shp = sh_getinterp();
|
||||
Namval_t *nq;
|
||||
char *av[2];
|
||||
int rdonly = nv_isattr(np,NV_RDONLY);
|
||||
@@ -410,7 +417,10 @@ int nv_arraysettype(Namval_t *np, Namval
|
||||
av[1] = 0;
|
||||
sh.last_table = 0;
|
||||
if(!ap->table)
|
||||
+ {
|
||||
ap->table = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(ap->table,shp,1);
|
||||
+ }
|
||||
if(nq = nv_search(sub, ap->table, NV_ADD))
|
||||
{
|
||||
if(!nq->nvfun && nq->nvalue.cp && *nq->nvalue.cp==0)
|
||||
@@ -485,6 +495,7 @@ static Namfun_t *array_clone(Namval_t *n
|
||||
if(ap->table)
|
||||
{
|
||||
ap->table = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(ap->table,shp,1);
|
||||
if(ap->scope && !(flags&NV_COMVAR))
|
||||
{
|
||||
ap->scope = ap->table;
|
||||
@@ -854,7 +865,9 @@ static struct index_array *array_grow(Na
|
||||
np->nvalue.cp=0;
|
||||
if(nv_hasdisc(np,&array_disc) || (nv_type(np) && nv_isvtree(np)))
|
||||
{
|
||||
+ Shell_t *shp = sh_getinterp();
|
||||
ap->header.table = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(ap->header.table,shp,1);
|
||||
mp = nv_search("0", ap->header.table,NV_ADD);
|
||||
if(mp && nv_isnull(mp))
|
||||
{
|
||||
@@ -1169,6 +1182,7 @@ int nv_nextsub(Namval_t *np)
|
||||
*/
|
||||
Namval_t *nv_putsub(Namval_t *np,register char *sp,register long mode)
|
||||
{
|
||||
+ Shell_t *shp = sh_getinterp();
|
||||
register struct index_array *ap = (struct index_array*)nv_arrayptr(np);
|
||||
register int size = (mode&ARRAY_MASK);
|
||||
#if SHOPT_FIXEDARRAY
|
||||
@@ -1180,7 +1194,6 @@ Namval_t *nv_putsub(Namval_t *np,registe
|
||||
{
|
||||
if(sp)
|
||||
{
|
||||
- Shell_t *shp = sh_getinterp();
|
||||
if(ap && ap->xp && !strmatch(sp,"+([0-9])"))
|
||||
{
|
||||
Namval_t *mp = nv_namptr(ap->xp,0);
|
||||
@@ -1258,7 +1271,10 @@ Namval_t *nv_putsub(Namval_t *np,registe
|
||||
char *cp;
|
||||
Namval_t *mp;
|
||||
if(!ap->header.table)
|
||||
+ {
|
||||
ap->header.table = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(ap->header.table,shp,1);
|
||||
+ }
|
||||
sfprintf(sh.strbuf,"%d",ap->cur);
|
||||
cp = sfstruse(sh.strbuf);
|
||||
mp = nv_search(cp, ap->header.table, NV_ADD);
|
||||
@@ -1666,6 +1682,7 @@ int nv_aimax(register Namval_t* np)
|
||||
*/
|
||||
void *nv_associative(register Namval_t *np,const char *sp,int mode)
|
||||
{
|
||||
+ Shell_t *shp = sh_getinterp();
|
||||
register struct assoc_array *ap = (struct assoc_array*)nv_arrayptr(np);
|
||||
register int type;
|
||||
switch(mode)
|
||||
@@ -1674,6 +1691,7 @@ void *nv_associative(register Namval_t *
|
||||
if(ap = (struct assoc_array*)calloc(1,sizeof(struct assoc_array)))
|
||||
{
|
||||
ap->header.table = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(ap->header.table,shp,1);
|
||||
ap->cur = 0;
|
||||
ap->pos = 0;
|
||||
ap->header.hdr.disc = &array_disc;
|
||||
@@ -1742,7 +1760,6 @@ void *nv_associative(register Namval_t *
|
||||
case NV_ANAME:
|
||||
if(ap->cur)
|
||||
{
|
||||
- Shell_t *shp = sh_getinterp();
|
||||
if(!shp->instance && nv_isnull(ap->cur))
|
||||
return(NIL(void*));
|
||||
return((void*)ap->cur->nvname);
|
||||
--- src/cmd/ksh93/sh/init.c
|
||||
+++ src/cmd/ksh93/sh/init.c 2013-10-25 13:20:42.800733693 +0000
|
||||
@@ -1909,9 +1909,13 @@ static Init_t *nv_init(Shell_t *shp)
|
||||
(OPTINDNOD)->nvalue.lp = (&shp->st.optindex);
|
||||
/* set up the seconds clock */
|
||||
shp->alias_tree = inittree(shp,shtab_aliases);
|
||||
+ dtuserdata(shp->alias_tree,shp,1);
|
||||
shp->track_tree = dtopen(&_Nvdisc,Dtset);
|
||||
+ dtuserdata(shp->track_tree,shp,1);
|
||||
shp->bltin_tree = inittree(shp,(const struct shtable2*)shtab_builtins);
|
||||
+ dtuserdata(shp->bltin_tree,shp,1);
|
||||
shp->fun_tree = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(shp->fun_tree,shp,1);
|
||||
dtview(shp->fun_tree,shp->bltin_tree);
|
||||
nv_mount(DOTSHNOD, "type", shp->typedict=dtopen(&_Nvdisc,Dtoset));
|
||||
nv_adddisc(DOTSHNOD, shdiscnames, (Namval_t**)0);
|
||||
@@ -1954,6 +1958,7 @@ static Dt_t *inittree(Shell_t *shp,const
|
||||
nbltins = n;
|
||||
}
|
||||
base_treep = treep = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(treep,shp,1);
|
||||
treep->user = (void*)shp;
|
||||
for(tp=name_vals;*tp->sh_name;tp++,np++)
|
||||
{
|
||||
--- src/cmd/ksh93/sh/macro.c
|
||||
+++ src/cmd/ksh93/sh/macro.c 2013-10-25 13:20:42.801733601 +0000
|
||||
@@ -2742,7 +2742,10 @@ static char *sh_tilde(Shell_t *shp,regis
|
||||
skip:
|
||||
#endif /* _WINIX */
|
||||
if(!logins_tree)
|
||||
+ {
|
||||
logins_tree = dtopen(&_Nvdisc,Dtbag);
|
||||
+ dtuserdata(logins_tree,shp,1);
|
||||
+ }
|
||||
if(np=nv_search(string,logins_tree,NV_ADD))
|
||||
{
|
||||
c = shp->subshell;
|
||||
--- src/cmd/ksh93/sh/name.c
|
||||
+++ src/cmd/ksh93/sh/name.c 2013-10-25 13:20:42.802733508 +0000
|
||||
@@ -821,6 +821,7 @@ Namval_t *nv_create(const char *name, D
|
||||
{
|
||||
Dt_t *dp = dtview(shp->var_tree,(Dt_t*)0);
|
||||
rp->sdict = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(rp->sdict,shp,1);
|
||||
dtview(rp->sdict,dp);
|
||||
dtview(shp->var_tree,rp->sdict);
|
||||
}
|
||||
@@ -1170,7 +1171,10 @@ Namval_t *nv_create(const char *name, D
|
||||
ap = nv_arrayptr(np);
|
||||
}
|
||||
if(n && ap && !ap->table)
|
||||
+ {
|
||||
ap->table = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(ap->table,shp,1);
|
||||
+ }
|
||||
if(ap && ap->table && (nq=nv_search(sub,ap->table,n)))
|
||||
nq->nvenv = (char*)np;
|
||||
if(nq && nv_isnull(nq))
|
||||
@@ -1391,7 +1395,7 @@ Namval_t *nv_open(const char *name, Dt_t
|
||||
while((c= *(unsigned char*)cp++) && (c!='=') && (c!='/') &&
|
||||
(c>=0x200 || !(c=sh_lexstates[ST_NORM][c]) || c==S_EPAT || c==S_COLON));
|
||||
if(shp->subshell && c=='=')
|
||||
- root = sh_subaliastree(1);
|
||||
+ root = sh_subaliastree(shp,1);
|
||||
if(c= *--cp)
|
||||
*cp = 0;
|
||||
np = nv_search(name, root, (flags&NV_NOADD)?0:NV_ADD);
|
||||
@@ -2350,6 +2354,7 @@ void sh_scope(Shell_t *shp, struct argno
|
||||
newroot = nv_dict(shp->namespace);
|
||||
#endif /* SHOPT_NAMESPACE */
|
||||
newscope = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(newscope,shp,1);
|
||||
if(envlist)
|
||||
{
|
||||
dtview(newscope,(Dt_t*)shp->var_tree);
|
||||
@@ -3334,7 +3339,10 @@ int nv_rename(register Namval_t *np, int
|
||||
if(ap=nv_arrayptr(np))
|
||||
{
|
||||
if(!ap->table)
|
||||
+ {
|
||||
ap->table = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(ap->table,shp,1);
|
||||
+ }
|
||||
if(ap->table)
|
||||
mp = nv_search(nv_getsub(np),ap->table,NV_ADD);
|
||||
nv_arraychild(np,mp,0);
|
||||
--- src/cmd/ksh93/sh/nvdisc.c
|
||||
+++ src/cmd/ksh93/sh/nvdisc.c 2013-10-25 13:20:42.802733508 +0000
|
||||
@@ -246,6 +246,7 @@ static void chktfree(register Namval_t *
|
||||
*/
|
||||
static void assign(Namval_t *np,const char* val,int flags,Namfun_t *handle)
|
||||
{
|
||||
+ Shell_t *shp = sh_getinterp();
|
||||
int type = (flags&NV_APPEND)?APPEND:ASSIGN;
|
||||
register struct vardisc *vp = (struct vardisc*)handle;
|
||||
register Namval_t *nq = vp->disc[type];
|
||||
@@ -330,7 +331,7 @@ static void assign(Namval_t *np,const ch
|
||||
}
|
||||
else if(!nq || !isblocked(bp,type))
|
||||
{
|
||||
- Dt_t *root = sh_subfuntree(1);
|
||||
+ Dt_t *root = sh_subfuntree(shp,1);
|
||||
int n;
|
||||
Namarr_t *ap;
|
||||
block(bp,type);
|
||||
@@ -1296,6 +1297,7 @@ static Namfun_t *clone_table(Namval_t* n
|
||||
Dt_t *oroot=tp->dict,*nroot=dtopen(&_Nvdisc,Dtoset);
|
||||
if(!nroot)
|
||||
return(0);
|
||||
+ dtuserdata(nroot,dtuserdata(oroot,0,0),1);
|
||||
memcpy((void*)ntp,(void*)fp,sizeof(struct table));
|
||||
ntp->dict = nroot;
|
||||
ntp->parent = nv_lastdict();
|
||||
@@ -1493,6 +1495,6 @@ Namval_t *sh_fsearch(Shell_t *shp, const
|
||||
sfputr(stkp,nv_name(shp->namespace),'.');
|
||||
sfputr(stkp,fname,0);
|
||||
fname = stkptr(stkp,offset);
|
||||
- return(nv_search(fname,sh_subfuntree(add&NV_ADD),add));
|
||||
+ return(nv_search(fname,sh_subfuntree(shp,add&NV_ADD),add));
|
||||
}
|
||||
#endif /* SHOPT_NAMESPACE */
|
||||
--- src/cmd/ksh93/sh/path.c
|
||||
+++ src/cmd/ksh93/sh/path.c 2013-10-25 13:20:42.803733416 +0000
|
||||
@@ -592,7 +592,7 @@ static void funload(Shell_t *shp,int fno
|
||||
pname = path_fullname(shp,stakptr(PATH_OFFSET));
|
||||
if(shp->fpathdict && (rp = dtmatch(shp->fpathdict,(void*)pname)))
|
||||
{
|
||||
- Dt_t *funtree = sh_subfuntree(1);
|
||||
+ Dt_t *funtree = sh_subfuntree(shp,1);
|
||||
while(1)
|
||||
{
|
||||
rpfirst = dtprev(shp->fpathdict,rp);
|
||||
@@ -868,13 +868,13 @@ Pathcomp_t *path_absolute(Shell_t *shp,r
|
||||
if(isfun && f>=0 && (cp = strrchr(name,'.')))
|
||||
{
|
||||
*cp = 0;
|
||||
- if(nv_open(name,sh_subfuntree(1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE))
|
||||
+ if(nv_open(name,sh_subfuntree(shp,1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE))
|
||||
f = -1;
|
||||
*cp = '.';
|
||||
}
|
||||
if(isfun && f>=0)
|
||||
{
|
||||
- nv_onattr(nv_open(name,sh_subfuntree(1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE),NV_LTOU|NV_FUNCTION);
|
||||
+ nv_onattr(nv_open(name,sh_subfuntree(shp,1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE),NV_LTOU|NV_FUNCTION);
|
||||
funload(shp,f,name);
|
||||
close(f);
|
||||
f = -1;
|
||||
--- src/cmd/ksh93/sh/subshell.c
|
||||
+++ src/cmd/ksh93/sh/subshell.c 2013-10-25 13:20:42.803733416 +0000
|
||||
@@ -379,7 +379,7 @@ static void nv_restore(struct subshell *
|
||||
* return pointer to alias tree
|
||||
* create new one if in a subshell and one doesn't exist and create is non-zero
|
||||
*/
|
||||
-Dt_t *sh_subaliastree(int create)
|
||||
+Dt_t *sh_subaliastree(Shell_t *shp,int create)
|
||||
{
|
||||
register struct subshell *sp = subshell_data;
|
||||
if(!sp || sp->shp->curenv==0)
|
||||
@@ -387,6 +387,7 @@ Dt_t *sh_subaliastree(int create)
|
||||
if(!sp->salias && create)
|
||||
{
|
||||
sp->salias = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(sp->salias,shp,1);
|
||||
dtview(sp->salias,sp->shp->alias_tree);
|
||||
sp->shp->alias_tree = sp->salias;
|
||||
}
|
||||
@@ -397,7 +398,7 @@ Dt_t *sh_subaliastree(int create)
|
||||
* return pointer to function tree
|
||||
* create new one if in a subshell and one doesn't exist and create is non-zero
|
||||
*/
|
||||
-Dt_t *sh_subfuntree(int create)
|
||||
+Dt_t *sh_subfuntree(Shell_t *shp,int create)
|
||||
{
|
||||
register struct subshell *sp = subshell_data;
|
||||
if(!sp || sp->shp->curenv==0)
|
||||
@@ -405,6 +406,7 @@ Dt_t *sh_subfuntree(int create)
|
||||
if(!sp->sfun && create)
|
||||
{
|
||||
sp->sfun = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(sp->sfun,shp,1);
|
||||
dtview(sp->sfun,sp->shp->fun_tree);
|
||||
sp->shp->fun_tree = sp->sfun;
|
||||
}
|
||||
--- src/cmd/ksh93/sh/xec.c
|
||||
+++ src/cmd/ksh93/sh/xec.c 2013-10-25 13:20:42.804733324 +0000
|
||||
@@ -2688,6 +2688,7 @@ int sh_exec(register const Shnode_t *t,
|
||||
else
|
||||
{
|
||||
root = dtopen(&_Nvdisc,Dtoset);
|
||||
+ dtuserdata(root,shp,1);
|
||||
nv_mount(np, (char*)0, root);
|
||||
np->nvalue.cp = Empty;
|
||||
dtview(root,shp->var_base);
|
||||
@@ -2729,7 +2730,7 @@ int sh_exec(register const Shnode_t *t,
|
||||
np = sh_fsearch(shp,fname,NV_ADD|HASH_NOSCOPE);
|
||||
if(!np)
|
||||
#endif /* SHOPT_NAMESPACE */
|
||||
- np = nv_open(fname,sh_subfuntree(1),NV_NOASSIGN|NV_NOARRAY|NV_VARNAME|NV_NOSCOPE);
|
||||
+ np = nv_open(fname,sh_subfuntree(shp,1),NV_NOASSIGN|NV_NOARRAY|NV_VARNAME|NV_NOSCOPE);
|
||||
if(npv)
|
||||
{
|
||||
if(!shp->mktype)
|
||||
@@ -2743,11 +2744,6 @@ int sh_exec(register const Shnode_t *t,
|
||||
slp = (struct slnod*)np->nvenv;
|
||||
sh_funstaks(slp->slchild,-1);
|
||||
stakdelete(slp->slptr);
|
||||
- if(shp->funload)
|
||||
- {
|
||||
- free((void*)np->nvalue.rp);
|
||||
- np->nvalue.rp = 0;
|
||||
- }
|
||||
if(rp->sdict)
|
||||
{
|
||||
Namval_t *mp, *nq;
|
||||
@@ -2761,6 +2757,12 @@ int sh_exec(register const Shnode_t *t,
|
||||
dtclose(rp->sdict);
|
||||
rp->sdict = 0;
|
||||
}
|
||||
+ if(shp->funload)
|
||||
+ {
|
||||
+ if(!shp->fpathdict)
|
||||
+ free((void*)np->nvalue.rp);
|
||||
+ np->nvalue.rp = 0;
|
||||
+ }
|
||||
}
|
||||
if(!np->nvalue.rp)
|
||||
{
|
||||
@@ -2799,7 +2801,10 @@ int sh_exec(register const Shnode_t *t,
|
||||
if(!shp->fpathdict)
|
||||
shp->fpathdict = dtopen(&_Rpdisc,Dtobag);
|
||||
if(shp->fpathdict)
|
||||
+ {
|
||||
+ dtuserdata(shp->fpathdict,shp,1);
|
||||
dtinsert(shp->fpathdict,rp);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
else
|
||||
--- src/lib/libast/Mamfile
|
||||
+++ src/lib/libast/Mamfile 2013-10-25 13:20:42.806733139 +0000
|
||||
@@ -3969,6 +3969,14 @@ meta dtopen.o %.c>%.o cdt/dtopen.c dtope
|
||||
prev cdt/dtopen.c
|
||||
exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icdt -Icomp -Iinclude -Istd -I${INSTALLROOT}/include/ast -D_PACKAGE_ast -c cdt/dtopen.c
|
||||
done dtopen.o generated
|
||||
+make dtstat.o
|
||||
+make cdt/dtstat.c
|
||||
+prev cdt/dthdr.h implicit
|
||||
+done cdt/dtstat.c
|
||||
+meta dtstat.o %.c>%.o cdt/dtstat.c dtstat
|
||||
+prev cdt/dtstat.c
|
||||
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icdt -Icomp -Iinclude -Istd -I${INSTALLROOT}/include/ast -D_PACKAGE_ast -c cdt/dtstat.c
|
||||
+done dtstat.o generated
|
||||
make dtstrhash.o
|
||||
make cdt/dtstrhash.c
|
||||
prev cdt/dthdr.h implicit
|
||||
@@ -3985,6 +3993,14 @@ meta dttree.o %.c>%.o cdt/dttree.c dttre
|
||||
prev cdt/dttree.c
|
||||
exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icdt -Icomp -Iinclude -Istd -I${INSTALLROOT}/include/ast -D_PACKAGE_ast -c cdt/dttree.c
|
||||
done dttree.o generated
|
||||
+make dtuser.o
|
||||
+make cdt/dtuser.c
|
||||
+prev cdt/dthdr.h implicit
|
||||
+done cdt/dtuser.c
|
||||
+meta dtuser.o %.c>%.o cdt/dtuser.c dtuser
|
||||
+prev cdt/dtuser.c
|
||||
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icdt -Icomp -Iinclude -Istd -I${INSTALLROOT}/include/ast -D_PACKAGE_ast -c cdt/dtuser.c
|
||||
+done dtuser.o generated
|
||||
make dtview.o
|
||||
make cdt/dtview.c
|
||||
prev cdt/dthdr.h implicit
|
||||
@@ -6101,7 +6117,7 @@ exec - ${AR} rc libast.a state.o transit
|
||||
exec - ${AR} rc libast.a streval.o strexpr.o strmatch.o strcopy.o modei.o modex.o strmode.o strlcat.o strlcpy.o strlook.o strncopy.o strsearch.o strpsearch.o stresc.o stropt.o strtape.o strpcmp.o strnpcmp.o strvcmp.o strnvcmp.o tok.o tokline.o tokscan.o pathaccess.o pathcat.o pathcanon.o pathcheck.o pathpath.o pathexists.o pathfind.o pathkey.o pathprobe.o pathrepl.o pathnative.o pathposix.o pathtemp.o pathtmp.o pathstat.o pathgetlink.o pathsetlink.o pathbin.o pathshell.o pathcd.o pathprog.o fs3d.o ftwalk.o ftwflags.o fts.o astintercept.o conformance.o getenv.o setenviron.o optget.o optjoin.o optesc.o optctx.o strsort.o struniq.o magic.o mime.o mimetype.o signal.o sigflag.o systrace.o error.o errorf.o errormsg.o errorx.o localeconv.o setlocale.o translate.o catopen.o iconv.o lc.o lctab.o mc.o base64.o recfmt.o recstr.o reclen.o fmtrec.o fmtbase.o fmtbuf.o fmtclock.o fmtdev.o fmtelapsed.o fmterror.o fmtesc.o fmtfmt.o fmtfs.o fmtident.o fmtint.o fmtip4.o fmtip6.o fmtls.o fmtmatch.o fmtmode.o fmtnum.o fmtperm.o fmtre.o fmttime.o
|
||||
exec - ${AR} rc libast.a fmtuid.o fmtgid.o fmtsignal.o fmtscale.o fmttmx.o fmttv.o fmtversion.o strelapsed.o strperm.o struid.o strgid.o strtoip4.o strtoip6.o stack.o stk.o swapget.o swapmem.o swapop.o swapput.o sigdata.o sigcrit.o sigunblock.o procopen.o procclose.o procrun.o procfree.o tmdate.o tmequiv.o tmfix.o tmfmt.o tmform.o tmgoff.o tminit.o tmleap.o tmlex.o tmlocale.o tmmake.o tmpoff.o tmscan.o tmsleep.o tmtime.o tmtype.o tmweek.o tmword.o tmzone.o tmxdate.o tmxduration.o tmxfmt.o tmxgettime.o tmxleap.o tmxmake.o tmxscan.o tmxsettime.o tmxsleep.o tmxtime.o tmxtouch.o tvcmp.o tvgettime.o tvsettime.o tvsleep.o tvtouch.o cmdarg.o vecargs.o vecfile.o vecfree.o vecload.o vecstring.o univdata.o touch.o mnt.o debug.o memccpy.o memchr.o memcmp.o memcpy.o memdup.o memmove.o memset.o mkdir.o mkfifo.o mknod.o rmdir.o remove.o rename.o link.o unlink.o strdup.o strchr.o strrchr.o strstr.o strtod.o strtold.o strtol.o strtoll.o strtoul.o strtoull.o strton.o strtonll.o strntod.o strntold.o strnton.o
|
||||
exec - ${AR} rc libast.a strntonll.o strntol.o strntoll.o strntoul.o strntoull.o strcasecmp.o strncasecmp.o strerror.o mktemp.o tmpnam.o fsync.o execlp.o execve.o execvp.o execvpe.o spawnveg.o vfork.o killpg.o hsearch.o tsearch.o getlogin.o putenv.o setenv.o unsetenv.o lstat.o statvfs.o eaccess.o gross.o omitted.o readlink.o symlink.o getpgrp.o setpgid.o setsid.o waitpid.o creat64.o fcntl.o open.o atexit.o getdents.o getwd.o dup2.o errno.o getpreroot.o ispreroot.o realopen.o setpreroot.o getgroups.o mount.o system.o iblocks.o modedata.o tmdata.o memfatal.o sfkeyprintf.o sfdcdio.o sfdcdos.o sfdcfilter.o sfdcseekable.o sfdcslow.o sfdcsubstr.o sfdctee.o sfdcunion.o sfdcmore.o sfdcprefix.o wc.o wc2utf8.o basename.o closelog.o dirname.o fmtmsglib.o fnmatch.o ftw.o getdate.o getsubopt.o glob.o nftw.o openlog.o re_comp.o resolvepath.o realpath.o regcmp.o regexp.o setlogmask.o strftime.o strptime.o swab.o syslog.o tempnam.o wordexp.o mktime.o regalloc.o regclass.o regcoll.o regcomp.o regcache.o regdecomp.o regerror.o regexec.o regfatal.o reginit.o
|
||||
-exec - ${AR} rc libast.a regnexec.o regsubcomp.o regsubexec.o regsub.o regrecord.o regrexec.o regstat.o dtclose.o dtdisc.o dthash.o dtlist.o dtmethod.o dtopen.o dtstrhash.o dttree.o dtview.o dtwalk.o dtnew.o dtcomp.o sfclose.o sfclrlock.o sfdisc.o sfdlen.o sfexcept.o sfgetl.o sfgetu.o sfcvt.o sfecvt.o sffcvt.o sfextern.o sffilbuf.o sfflsbuf.o sfprints.o sfgetd.o sfgetr.o sfllen.o sfmode.o sfmove.o sfnew.o sfpkrd.o sfnotify.o sfnputc.o sfopen.o sfpeek.o sfpoll.o sfpool.o sfpopen.o sfprintf.o sfputd.o sfputl.o sfputr.o sfputu.o sfrd.o sfread.o sfreserve.o sfscanf.o sfseek.o sfset.o sfsetbuf.o sfsetfd.o sfsize.o sfsk.o sfstack.o sfstrtod.o sfsync.o sfswap.o sftable.o sftell.o sftmp.o sfungetc.o sfvprintf.o sfvscanf.o sfwr.o sfwrite.o sfpurge.o sfraise.o sfwalk.o sfgetm.o sfmutex.o sfputm.o sfresize.o _sfclrerr.o _sfeof.o _sferror.o _sffileno.o _sfopen.o _sfstacked.o _sfvalue.o _sfgetc.o _sfgetl.o _sfgetl2.o _sfgetu.o _sfgetu2.o _sfdlen.o _sfllen.o _sfslen.o _sfulen.o _sfputc.o _sfputd.o _sfputl.o _sfputm.o
|
||||
+exec - ${AR} rc libast.a regnexec.o regsubcomp.o regsubexec.o regsub.o regrecord.o regrexec.o regstat.o dtclose.o dtdisc.o dthash.o dtlist.o dtmethod.o dtopen.o dtstat.o dtstrhash.o dttree.o dtuser.o dtview.o dtwalk.o dtnew.o dtcomp.o sfclose.o sfclrlock.o sfdisc.o sfdlen.o sfexcept.o sfgetl.o sfgetu.o sfcvt.o sfecvt.o sffcvt.o sfextern.o sffilbuf.o sfflsbuf.o sfprints.o sfgetd.o sfgetr.o sfllen.o sfmode.o sfmove.o sfnew.o sfpkrd.o sfnotify.o sfnputc.o sfopen.o sfpeek.o sfpoll.o sfpool.o sfpopen.o sfprintf.o sfputd.o sfputl.o sfputr.o sfputu.o sfrd.o sfread.o sfreserve.o sfscanf.o sfseek.o sfset.o sfsetbuf.o sfsetfd.o sfsize.o sfsk.o sfstack.o sfstrtod.o sfsync.o sfswap.o sftable.o sftell.o sftmp.o sfungetc.o sfvprintf.o sfvscanf.o sfwr.o sfwrite.o sfpurge.o sfraise.o sfwalk.o sfgetm.o sfmutex.o sfputm.o sfresize.o _sfclrerr.o _sfeof.o _sferror.o _sffileno.o _sfopen.o _sfstacked.o _sfvalue.o _sfgetc.o _sfgetl.o _sfgetl2.o _sfgetu.o _sfgetu2.o _sfdlen.o _sfllen.o _sfslen.o _sfulen.o _sfputc.o _sfputd.o _sfputl.o _sfputm.o
|
||||
exec - ${AR} rc libast.a _sfputu.o clearerr.o fclose.o fdopen.o feof.o ferror.o fflush.o fgetc.o fgetpos.o fgets.o fileno.o fopen.o fprintf.o fpurge.o fputc.o fputs.o fread.o freopen.o fscanf.o fseek.o fseeko.o fsetpos.o ftell.o ftello.o fwrite.o flockfile.o ftrylockfile.o funlockfile.o getc.o getchar.o getw.o pclose.o popen.o printf.o putc.o putchar.o puts.o putw.o rewind.o scanf.o setbuf.o setbuffer.o setlinebuf.o setvbuf.o snprintf.o sprintf.o sscanf.o asprintf.o vasprintf.o tmpfile.o ungetc.o vfprintf.o vfscanf.o vprintf.o vscanf.o vsnprintf.o vsprintf.o vsscanf.o _doprnt.o _doscan.o _filbuf.o _flsbuf.o _stdfun.o _stdopen.o _stdprintf.o _stdscanf.o _stdsprnt.o _stdvbuf.o _stdvsnprnt.o _stdvsprnt.o _stdvsscn.o fgetwc.o fwprintf.o putwchar.o vfwscanf.o wprintf.o fgetws.o fwscanf.o swprintf.o vswprintf.o wscanf.o fputwc.o getwc.o swscanf.o vswscanf.o fputws.o getwchar.o ungetwc.o vwprintf.o fwide.o putwc.o vfwprintf.o vwscanf.o stdio_c99.o fcloseall.o fmemopen.o getdelim.o getline.o frexp.o frexpl.o astcopy.o
|
||||
exec - ${AR} rc libast.a astconf.o astdynamic.o astlicense.o astquery.o astwinsize.o conftab.o aststatic.o getopt.o getoptl.o aso.o asolock.o asometh.o asorelax.o aso-sem.o aso-fcntl.o vmbest.o vmclear.o vmclose.o vmdcheap.o vmdebug.o vmdisc.o vmexit.o vmlast.o vmopen.o vmpool.o vmprivate.o vmprofile.o vmregion.o vmsegment.o vmset.o vmstat.o vmstrdup.o vmtrace.o vmwalk.o vmmopen.o malloc.o vmgetmem.o a64l.o acosh.o asinh.o atanh.o cbrt.o crypt.o erf.o err.o exp.o exp__E.o expm1.o gamma.o getpass.o lgamma.o log.o log1p.o log__L.o rand48.o random.o rcmd.o rint.o support.o sfstrtmp.o spawn.o
|
||||
exec - (ranlib libast.a) >/dev/null 2>&1 || true
|
||||
--- src/lib/libast/cdt/cdtlib.h
|
||||
+++ src/lib/libast/cdt/cdtlib.h 2013-10-25 13:20:42.807733047 +0000
|
||||
@@ -58,9 +58,9 @@
|
||||
/* This struct holds private method data created on DT_OPEN */
|
||||
struct _dtdata_s
|
||||
{ unsigned int lock; /* general dictionary lock */
|
||||
- Dtuser_t user; /* application's data */
|
||||
unsigned int type; /* method type, control flags */
|
||||
ssize_t size; /* number of objects */
|
||||
+ Dtuser_t user; /* application's data */
|
||||
Dt_t dict; /* when DT_INDATA is requested */
|
||||
};
|
||||
|
||||
@@ -123,7 +123,7 @@ typedef struct _dtlib_s
|
||||
#endif /* _BLD_cdt */
|
||||
|
||||
/* these macros lock/unlock dictionaries. DTRETURN substitutes for "return" */
|
||||
-#define DTSETLOCK(dt) (((dt)->data->type&DT_SHARE) ? asolock(&(dt)->data->lock,1,ASO_SPINLOCK) : 0 )
|
||||
+#define DTSETLOCK(dt) (((dt)->data->type&DT_SHARE) ? asolock(&(dt)->data->lock,1,ASO_LOCK) : 0 )
|
||||
#define DTCLRLOCK(dt) (((dt)->data->type&DT_SHARE) ? asolock(&(dt)->data->lock,1,ASO_UNLOCK) : 0 )
|
||||
#define DTRETURN(ob,rv) do { (ob) = (rv); goto dt_return; } while(0)
|
||||
#define DTERROR(dt, mesg) (!((dt)->disc && (dt)->disc->eventf) ? 0 : \
|
||||
--- src/lib/libast/cdt/dtcomp.c
|
||||
+++ src/lib/libast/cdt/dtcomp.c 2013-10-25 13:20:42.807733047 +0000
|
||||
@@ -52,9 +52,3 @@ extern ssize_t dtsize(Dt_t* d)
|
||||
{
|
||||
return (ssize_t)(*(_DT(d)->searchf))((d),(Void_t*)(0),DT_STAT);
|
||||
}
|
||||
-
|
||||
-#undef dtstat
|
||||
-extern ssize_t dtstat(Dt_t* d)
|
||||
-{
|
||||
- return (ssize_t)(*(_DT(d)->searchf))((d),(Void_t*)(0),DT_STAT);
|
||||
-}
|
||||
--- src/lib/libast/cdt/dthash.c
|
||||
+++ src/lib/libast/cdt/dthash.c 2013-10-25 13:20:42.807733047 +0000
|
||||
@@ -52,11 +52,13 @@ static int htable(Dt_t* dt)
|
||||
if((n = hash->tblz) > 0 && (hash->type&H_FIXED) )
|
||||
return 0; /* fixed size table */
|
||||
|
||||
- if(n == 0 && disc && disc->eventf) /* let user have input */
|
||||
+ if(disc && disc->eventf) /* let user have input */
|
||||
{ if((*disc->eventf)(dt, DT_HASHSIZE, &n, disc) > 0 )
|
||||
{ if(n < 0) /* fix table size */
|
||||
{ hash->type |= H_FIXED;
|
||||
- n = -n;
|
||||
+ n = -n; /* desired table size */
|
||||
+ if(hash->tblz >= n ) /* table size is fixed now */
|
||||
+ return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,12 +236,13 @@ static Void_t* hstat(Dt_t* dt, Dtstat_t*
|
||||
|
||||
for(endt = (t = hash->htbl) + hash->tblz; t < endt; ++t)
|
||||
{ for(n = 0, l = *t; l; l = l->_rght)
|
||||
+ { if(n < DT_MAXSIZE)
|
||||
+ st->lsize[n] += 1;
|
||||
n += 1;
|
||||
+ }
|
||||
st->mlev = n > st->mlev ? n : st->mlev;
|
||||
if(n < DT_MAXSIZE) /* if chain length is small */
|
||||
- { st->msize = n > st->msize ? n : st->msize;
|
||||
- st->lsize[n] += n;
|
||||
- }
|
||||
+ st->msize = n > st->msize ? n : st->msize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +313,7 @@ int type;
|
||||
hsh = _DTHSH(dt,key,disc);
|
||||
|
||||
tbl = hash->htbl + (hsh & (hash->tblz-1));
|
||||
- pp = ll = NIL(Dtlink_t*);
|
||||
+ pp = ll = NIL(Dtlink_t*); /* pp is the before, ll is the here */
|
||||
for(p = NIL(Dtlink_t*), l = *tbl; l; p = l, l = l->_rght)
|
||||
{ if(hsh == l->_hash)
|
||||
{ o = _DTOBJ(disc,l); k = _DTKEY(disc,o);
|
||||
@@ -342,20 +345,41 @@ int type;
|
||||
_dtfree(dt, ll, type);
|
||||
DTRETURN(obj, _DTOBJ(disc,ll));
|
||||
}
|
||||
+ else if(type & DT_INSTALL )
|
||||
+ { if(dt->meth->type&DT_BAG)
|
||||
+ goto do_insert;
|
||||
+ else if(!(lnk = _dtmake(dt, obj, type)) )
|
||||
+ DTRETURN(obj, NIL(Void_t*) );
|
||||
+ else /* replace old object with new one */
|
||||
+ { if(pp) /* remove old object */
|
||||
+ pp->_rght = ll->_rght;
|
||||
+ else *tbl = ll->_rght;
|
||||
+ o = _DTOBJ(disc,ll);
|
||||
+ _dtfree(dt, ll, DT_DELETE);
|
||||
+ DTANNOUNCE(dt, o, DT_DELETE);
|
||||
+
|
||||
+ goto do_insert;
|
||||
+ }
|
||||
+ }
|
||||
else
|
||||
{ /**/DEBUG_ASSERT(type&(DT_INSERT|DT_ATTACH|DT_APPEND|DT_RELINK));
|
||||
- if(!(dt->meth->type&DT_BAG) )
|
||||
+ if((dt->meth->type&DT_BAG) )
|
||||
+ goto do_insert;
|
||||
+ else
|
||||
{ if(type&(DT_INSERT|DT_APPEND|DT_ATTACH) )
|
||||
- type |= DT_SEARCH; /* for announcement */
|
||||
+ type |= DT_MATCH; /* for announcement */
|
||||
else if(lnk && (type&DT_RELINK) )
|
||||
+ { /* remove a duplicate */
|
||||
+ o = _DTOBJ(disc, lnk);
|
||||
_dtfree(dt, lnk, DT_DELETE);
|
||||
+ DTANNOUNCE(dt, o, DT_DELETE);
|
||||
+ }
|
||||
DTRETURN(obj, _DTOBJ(disc,ll));
|
||||
}
|
||||
- else goto do_insert;
|
||||
}
|
||||
}
|
||||
else /* no matching object */
|
||||
- { if(!(type&(DT_INSERT|DT_APPEND|DT_ATTACH|DT_RELINK)) )
|
||||
+ { if(!(type&(DT_INSERT|DT_INSTALL|DT_APPEND|DT_ATTACH|DT_RELINK)) )
|
||||
DTRETURN(obj, NIL(Void_t*));
|
||||
|
||||
do_insert: /* inserting a new object */
|
||||
--- src/lib/libast/cdt/dtlist.c
|
||||
+++ src/lib/libast/cdt/dtlist.c 2013-10-25 13:20:42.807733047 +0000
|
||||
@@ -142,9 +142,9 @@ int type;
|
||||
}
|
||||
|
||||
#if __STD_C
|
||||
-static Void_t* liststat(Dt_t* dt, Dtstat_t* st)
|
||||
+static Void_t* listat(Dt_t* dt, Dtstat_t* st)
|
||||
#else
|
||||
-static Void_t* liststat(dt, st)
|
||||
+static Void_t* listat(dt, st)
|
||||
Dt_t* dt;
|
||||
Dtstat_t* st;
|
||||
#endif
|
||||
@@ -186,7 +186,7 @@ int type;
|
||||
else if(type&DT_CLEAR)
|
||||
DTRETURN(obj, lclear(dt));
|
||||
else if(type&DT_STAT )
|
||||
- DTRETURN(obj, liststat(dt, (Dtstat_t*)obj));
|
||||
+ DTRETURN(obj, listat(dt, (Dtstat_t*)obj));
|
||||
|
||||
h = list->here; /* save finger to last search object */
|
||||
list->here = NIL(Dtlink_t*);
|
||||
@@ -202,8 +202,9 @@ int type;
|
||||
{ r = (Dtlink_t*)obj;
|
||||
goto do_insert;
|
||||
}
|
||||
- else if(type&(DT_INSERT|DT_APPEND|DT_ATTACH))
|
||||
- { if(!(r = _dtmake(dt, obj, type)) )
|
||||
+ else if(type&(DT_INSERT|DT_INSTALL|DT_APPEND|DT_ATTACH))
|
||||
+ { dt_insert:
|
||||
+ if(!(r = _dtmake(dt, obj, type)) )
|
||||
DTRETURN(obj, NIL(Void_t*));
|
||||
dt->data->size += 1;
|
||||
|
||||
@@ -290,7 +291,7 @@ int type;
|
||||
}
|
||||
r = h ? h : r;
|
||||
}
|
||||
- if(!r)
|
||||
+ if(!r) /* not found */
|
||||
DTRETURN(obj, NIL(Void_t*));
|
||||
|
||||
if(type&(DT_DELETE|DT_DETACH|DT_REMOVE))
|
||||
--- src/lib/libast/cdt/dtopen.c
|
||||
+++ src/lib/libast/cdt/dtopen.c 2013-10-25 13:20:42.808732955 +0000
|
||||
@@ -153,25 +153,3 @@ void _dtfree(Dt_t* dt, Dtlink_t* l, int
|
||||
if(disc->link < 0) /* free holder */
|
||||
(void)(*dt->memoryf)(dt, (Void_t*)l, 0, disc);
|
||||
}
|
||||
-
|
||||
-int dtuserlock(Dt_t* dt, unsigned int key, int type)
|
||||
-{
|
||||
- if(type > 0)
|
||||
- return asolock(&dt->data->user.lock, key, ASO_LOCK);
|
||||
- else if(type < 0)
|
||||
- return asolock(&dt->data->user.lock, key, ASO_UNLOCK);
|
||||
- else return asolock(&dt->data->user.lock, key, ASO_TRYLOCK);
|
||||
-}
|
||||
-
|
||||
-Void_t* dtuserdata(Dt_t* dt, Void_t* data, unsigned int key)
|
||||
-{
|
||||
- if(key == 0)
|
||||
- return dt->data->user.data;
|
||||
- else if(dtuserlock(dt, key, 1) < 0 )
|
||||
- return NIL(Void_t*);
|
||||
- else
|
||||
- { dt->data->user.data = data;
|
||||
- dtuserlock(dt, key, -1);
|
||||
- return data;
|
||||
- }
|
||||
-}
|
||||
--- src/lib/libast/cdt/dtstat.c
|
||||
+++ src/lib/libast/cdt/dtstat.c 2013-10-25 13:20:42.808732955 +0000
|
||||
@@ -0,0 +1,54 @@
|
||||
+/***********************************************************************
|
||||
+* *
|
||||
+* This software is part of the ast package *
|
||||
+* Copyright (c) 1985-2012 AT&T Intellectual Property *
|
||||
+* and is licensed under the *
|
||||
+* Eclipse Public License, Version 1.0 *
|
||||
+* by AT&T Intellectual Property *
|
||||
+* *
|
||||
+* A copy of the License is available at *
|
||||
+* http://www.eclipse.org/org/documents/epl-v10.html *
|
||||
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
|
||||
+* *
|
||||
+* Information and Software Systems Research *
|
||||
+* AT&T Research *
|
||||
+* Florham Park NJ *
|
||||
+* *
|
||||
+* Glenn Fowler <gsf@research.att.com> *
|
||||
+* David Korn <dgk@research.att.com> *
|
||||
+* Phong Vo <kpv@research.att.com> *
|
||||
+* *
|
||||
+***********************************************************************/
|
||||
+#include "dthdr.h"
|
||||
+
|
||||
+/* Get statistics for a dictionary
|
||||
+**
|
||||
+** Written by Kiem-Phong Vo
|
||||
+*/
|
||||
+
|
||||
+ssize_t dtstat(Dt_t* dt, Dtstat_t* dtst)
|
||||
+{
|
||||
+ ssize_t sz, k, maxk;
|
||||
+ char *str;
|
||||
+ char *end;
|
||||
+
|
||||
+ sz = (ssize_t)(*dt->meth->searchf)(dt, (Void_t*)dtst, DT_STAT);
|
||||
+
|
||||
+ str = dtst->mesg;
|
||||
+ end = &dtst->mesg[sizeof(dtst->mesg)] - 1;
|
||||
+ str += sfsprintf(str, end - str, "Objects=%d Levels=%d(Largest:", dtst->size, dtst->mlev+1);
|
||||
+
|
||||
+ /* print top 3 levels */
|
||||
+ for(k = maxk = 0; k <= dtst->mlev; ++k)
|
||||
+ if(dtst->lsize[k] > dtst->lsize[maxk])
|
||||
+ maxk = k;
|
||||
+ if(maxk > 0)
|
||||
+ maxk -= 1;
|
||||
+ for(k = 0; k < 3 && maxk <= dtst->mlev; ++k, ++maxk)
|
||||
+ str += sfsprintf(str, end - str, " lev[%d]=%d", maxk, dtst->lsize[maxk] );
|
||||
+ if (str < end)
|
||||
+ *str++ = ')';
|
||||
+ *str = 0;
|
||||
+
|
||||
+ return sz;
|
||||
+}
|
||||
--- src/lib/libast/cdt/dtstrhash.c
|
||||
+++ src/lib/libast/cdt/dtstrhash.c 2013-10-25 13:20:42.808732955 +0000
|
||||
@@ -22,40 +22,38 @@
|
||||
#include "dthdr.h"
|
||||
|
||||
/* Hashing a string into an unsigned integer.
|
||||
-** The basic method is to continuingly accumulate bytes and multiply
|
||||
-** with some given prime. The length n of the string is added last.
|
||||
-** The recurrent equation is like this:
|
||||
-** h[k] = (h[k-1] + bytes)*prime for 0 <= k < n
|
||||
-** h[n] = (h[n-1] + n)*prime
|
||||
-** The prime is chosen to have a good distribution of 1-bits so that
|
||||
-** the multiplication will distribute the bits in the accumulator well.
|
||||
-** The below code accumulates 2 bytes at a time for speed.
|
||||
-**
|
||||
-** Written by Kiem-Phong Vo (02/28/03)
|
||||
+** This is the FNV (Fowler-Noll-Vo) hash function.
|
||||
+** Written by Kiem-Phong Vo (01/10/2012)
|
||||
*/
|
||||
|
||||
#if __STD_C
|
||||
uint dtstrhash(uint h, Void_t* args, ssize_t n)
|
||||
#else
|
||||
uint dtstrhash(h,args,n)
|
||||
-reg uint h;
|
||||
+uint h;
|
||||
Void_t* args;
|
||||
ssize_t n;
|
||||
#endif
|
||||
{
|
||||
unsigned char *s = (unsigned char*)args;
|
||||
|
||||
- if(n <= 0)
|
||||
- { for(; *s != 0; s += s[1] ? 2 : 1)
|
||||
- h = (h + (s[0]<<8) + s[1])*DT_PRIME;
|
||||
- n = s - (unsigned char*)args;
|
||||
+#if _ast_sizeof_int == 8 /* 64-bit hash */
|
||||
+#define FNV_PRIME ((1<<40) + (1<<8) + 0xb3)
|
||||
+#define FNV_OFFSET 14695981039346656037
|
||||
+#else /* 32-bit hash */
|
||||
+#define FNV_PRIME ((1<<24) + (1<<8) + 0x93)
|
||||
+#define FNV_OFFSET 2166136261
|
||||
+#endif
|
||||
+ h = (h == 0 || h == ~0) ? FNV_OFFSET : h;
|
||||
+ if(n <= 0) /* see discipline key definition for == 0 */
|
||||
+ { for(; *s != 0; ++s )
|
||||
+ h = (h ^ s[0]) * FNV_PRIME;
|
||||
}
|
||||
else
|
||||
{ unsigned char* ends;
|
||||
- for(ends = s+n-1; s < ends; s += 2)
|
||||
- h = (h + (s[0]<<8) + s[1])*DT_PRIME;
|
||||
- if(s <= ends)
|
||||
- h = (h + (s[0]<<8))*DT_PRIME;
|
||||
+ for(ends = s+n; s < ends; ++s)
|
||||
+ h = (h ^ s[0]) * FNV_PRIME;
|
||||
}
|
||||
- return (h+n)*DT_PRIME;
|
||||
+
|
||||
+ return h;
|
||||
}
|
||||
--- src/lib/libast/cdt/dttree.c
|
||||
+++ src/lib/libast/cdt/dttree.c 2013-10-25 13:20:42.808732955 +0000
|
||||
@@ -545,7 +545,14 @@ int type;
|
||||
}
|
||||
else goto no_root;
|
||||
}
|
||||
- else if(type&DT_REMOVE) /* remove a particular element in the tree */
|
||||
+ else if(type&(DT_DELETE|DT_DETACH))
|
||||
+ { dt_delete: /* remove an object from the dictionary */
|
||||
+ obj = _DTOBJ(disc,root);
|
||||
+ _dtfree(dt, root, type);
|
||||
+ dt->data->size -= 1;
|
||||
+ goto no_root;
|
||||
+ }
|
||||
+ else if(type&DT_REMOVE) /* remove a particular object */
|
||||
{ if(_DTOBJ(disc,root) == obj)
|
||||
goto dt_delete;
|
||||
else
|
||||
@@ -555,28 +562,32 @@ int type;
|
||||
DTRETURN(obj, NIL(Void_t*));
|
||||
}
|
||||
}
|
||||
- else if(type&(DT_DELETE|DT_DETACH))
|
||||
- { dt_delete: /* remove an object from the dictionary */
|
||||
- obj = _DTOBJ(disc,root);
|
||||
- _dtfree(dt, root, type);
|
||||
- dt->data->size -= 1;
|
||||
- goto no_root;
|
||||
- }
|
||||
else if(type&(DT_INSERT|DT_APPEND|DT_ATTACH))
|
||||
{ if(dt->meth->type&DT_OSET)
|
||||
- { type |= DT_SEARCH; /* for announcement */
|
||||
+ { type |= DT_MATCH; /* for announcement */
|
||||
goto has_root;
|
||||
}
|
||||
- else
|
||||
+ else /* if(dt->meth->type&DT_OBAG) */
|
||||
{ root->_left = NIL(Dtlink_t*);
|
||||
root->_rght = link._left;
|
||||
link._left = root;
|
||||
goto dt_insert;
|
||||
}
|
||||
}
|
||||
+ else if(type&DT_INSTALL)
|
||||
+ { /* remove old object before insert new one */
|
||||
+ o = _DTOBJ(disc, root);
|
||||
+ _dtfree(dt, root, DT_DELETE);
|
||||
+ DTANNOUNCE(dt, o, DT_DELETE);
|
||||
+ goto dt_insert;
|
||||
+ }
|
||||
else if(type&DT_RELINK) /* a duplicate */
|
||||
{ if(dt->meth->type&DT_OSET)
|
||||
+ { /* remove object */
|
||||
+ o = _DTOBJ(disc, me);
|
||||
_dtfree(dt, me, DT_DELETE);
|
||||
+ DTANNOUNCE(dt, o, DT_DELETE);
|
||||
+ }
|
||||
else
|
||||
{ me->_left = NIL(Dtlink_t*);
|
||||
me->_rght = link._left;
|
||||
@@ -612,7 +623,7 @@ int type;
|
||||
{ obj = NIL(Void_t*);
|
||||
goto no_root;
|
||||
}
|
||||
- else if(type&(DT_INSERT|DT_APPEND|DT_ATTACH))
|
||||
+ else if(type&(DT_INSERT|DT_APPEND|DT_ATTACH|DT_INSTALL))
|
||||
{ dt_insert:
|
||||
if(!(root = _dtmake(dt, obj, type)) )
|
||||
{ obj = NIL(Void_t*);
|
||||
--- src/lib/libast/cdt/dtuser.c
|
||||
+++ src/lib/libast/cdt/dtuser.c 2013-10-25 13:20:42.808732955 +0000
|
||||
@@ -0,0 +1,59 @@
|
||||
+/***********************************************************************
|
||||
+* *
|
||||
+* This software is part of the ast package *
|
||||
+* Copyright (c) 1985-2012 AT&T Intellectual Property *
|
||||
+* and is licensed under the *
|
||||
+* Eclipse Public License, Version 1.0 *
|
||||
+* by AT&T Intellectual Property *
|
||||
+* *
|
||||
+* A copy of the License is available at *
|
||||
+* http://www.eclipse.org/org/documents/epl-v10.html *
|
||||
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
|
||||
+* *
|
||||
+* Information and Software Systems Research *
|
||||
+* AT&T Research *
|
||||
+* Florham Park NJ *
|
||||
+* *
|
||||
+* Glenn Fowler <gsf@research.att.com> *
|
||||
+* David Korn <dgk@research.att.com> *
|
||||
+* Phong Vo <kpv@research.att.com> *
|
||||
+* *
|
||||
+***********************************************************************/
|
||||
+#include "dthdr.h"
|
||||
+
|
||||
+/* Perform various functions on the user's behalf.
|
||||
+**
|
||||
+** Written by Kiem-Phong Vo (01/05/2012)
|
||||
+*/
|
||||
+
|
||||
+/* managing the lock dt->data->user.lock */
|
||||
+int dtuserlock(Dt_t* dt, unsigned int key, int type)
|
||||
+{
|
||||
+ if(key == 0)
|
||||
+ return -1;
|
||||
+ else if(type > 0)
|
||||
+ return asolock(&dt->data->user.lock, key, ASO_LOCK);
|
||||
+ else if(type < 0)
|
||||
+ return asolock(&dt->data->user.lock, key, ASO_UNLOCK);
|
||||
+ else return asolock(&dt->data->user.lock, key, ASO_TRYLOCK);
|
||||
+}
|
||||
+
|
||||
+/* managing the user data slot dt->data->user.data */
|
||||
+Void_t* dtuserdata(Dt_t* dt, Void_t* data, int set)
|
||||
+{
|
||||
+ if(set == 0) /* just return current value */
|
||||
+ return asogetptr(&dt->data->user.data);
|
||||
+ else while(1)
|
||||
+ { Void_t *current = dt->data->user.data;
|
||||
+ if(asocasptr(&dt->data->user.data, current, data) == current)
|
||||
+ return current;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/* announcing an event on the user's behalf */
|
||||
+int dtuserevent(Dt_t* dt, int flags, Void_t* data)
|
||||
+{
|
||||
+ if(!dt->disc->eventf)
|
||||
+ return 0;
|
||||
+ else return (*dt->disc->eventf)(dt, DT_ANNOUNCE|DT_USER|flags, data, dt->disc);
|
||||
+}
|
||||
--- src/lib/libast/include/cdt.h
|
||||
+++ src/lib/libast/include/cdt.h 2013-10-25 13:20:42.809732863 +0000
|
||||
@@ -164,6 +164,7 @@ struct _dtstat_s
|
||||
ssize_t msize; /* max #defined elts in below arrays */
|
||||
ssize_t lsize[DT_MAXSIZE]; /* #objects by level */
|
||||
ssize_t tsize[DT_MAXSIZE]; /* #tables by level */
|
||||
+ char mesg[256]; /* digest of top level statistics */
|
||||
};
|
||||
|
||||
/* supported storage methods */
|
||||
@@ -199,7 +200,8 @@ struct _dtstat_s
|
||||
#define DT_ATLEAST 0000040000 /* find the least elt >= object */
|
||||
#define DT_ATMOST 0000100000 /* find the biggest elt <= object */
|
||||
#define DT_REMOVE 0002000000 /* remove a specific object */
|
||||
-#define DT_TOANNOUNCE (DT_INSERT|DT_DELETE|DT_SEARCH|DT_NEXT|DT_PREV|DT_FIRST|DT_LAST|DT_MATCH|DT_ATTACH|DT_DETACH|DT_APPEND|DT_ATLEAST|DT_ATMOST|DT_REMOVE)
|
||||
+#define DT_INSTALL 0004000000 /* install a new object */
|
||||
+#define DT_TOANNOUNCE (DT_INSERT|DT_DELETE|DT_SEARCH|DT_NEXT|DT_PREV|DT_FIRST|DT_LAST|DT_MATCH|DT_ATTACH|DT_DETACH|DT_APPEND|DT_ATLEAST|DT_ATMOST|DT_REMOVE|DT_INSTALL)
|
||||
|
||||
#define DT_RELINK 0000002000 /* re-inserting (dtdisc,dtmethod...) */
|
||||
#define DT_FLATTEN 0000000040 /* flatten objects into a list */
|
||||
@@ -216,6 +218,7 @@ struct _dtstat_s
|
||||
/* the actual event will be this bit */
|
||||
/* combined with the operation bit */
|
||||
#define DT_OPTIMIZE 0100000000 /* optimizing data structure */
|
||||
+#define DT_USER 0200000000 /* an announcement on user's behalf */
|
||||
|
||||
/* events for discipline and method event-handling functions */
|
||||
#define DT_OPEN 1 /* a dictionary is being opened */
|
||||
@@ -277,7 +280,8 @@ extern int dtwalk _ARG_((Dt_t*, int(*)(
|
||||
extern int dtcustomize _ARG_((Dt_t*, int, int));
|
||||
extern unsigned int dtstrhash _ARG_((unsigned int, Void_t*, ssize_t));
|
||||
extern int dtuserlock _ARG_((Dt_t*, unsigned int, int));
|
||||
-extern Void_t* dtuserdata _ARG_((Dt_t*, Void_t*, unsigned int));
|
||||
+extern Void_t* dtuserdata _ARG_((Dt_t*, Void_t*, int));
|
||||
+extern int dtuserevent _ARG_((Dt_t*, int, Void_t*));
|
||||
|
||||
/* deal with upward binary compatibility (operation bit translation, etc.) */
|
||||
extern Dt_t* _dtopen _ARG_((Dtdisc_t*, Dtmethod_t*, unsigned long));
|
||||
@@ -334,6 +338,7 @@ _END_EXTERNS_
|
||||
#define dtsearch(d,o) (*(_DT(d)->searchf))((d),(Void_t*)(o),DT_SEARCH)
|
||||
#define dtmatch(d,o) (*(_DT(d)->searchf))((d),(Void_t*)(o),DT_MATCH)
|
||||
#define dtinsert(d,o) (*(_DT(d)->searchf))((d),(Void_t*)(o),DT_INSERT)
|
||||
+#define dtinstall(d,o) (*(_DT(d)->searchf))((d),(Void_t*)(o),DT_INSTALL)
|
||||
#define dtappend(d,o) (*(_DT(d)->searchf))((d),(Void_t*)(o),DT_APPEND)
|
||||
#define dtdelete(d,o) (*(_DT(d)->searchf))((d),(Void_t*)(o),DT_DELETE)
|
||||
#define dtremove(d,o) (*(_DT(d)->searchf))((d),(Void_t*)(o),DT_REMOVE)
|
||||
@@ -345,7 +350,6 @@ _END_EXTERNS_
|
||||
#define dtextract(d) (Dtlink_t*)(*(_DT(d)->searchf))((d),(Void_t*)(0),DT_EXTRACT)
|
||||
#define dtrestore(d,l) (Dtlink_t*)(*(_DT(d)->searchf))((d),(Void_t*)(l),DT_RESTORE)
|
||||
|
||||
-#define dtstat(d,s) (ssize_t)(*(_DT(d)->searchf))((d),(Void_t*)(s),DT_STAT)
|
||||
#define dtsize(d) (ssize_t)(*(_DT(d)->searchf))((d),(Void_t*)(0),DT_STAT)
|
||||
|
||||
#define DT_PRIME 17109811 /* 2#00000001 00000101 00010011 00110011 */
|
40
ksh93-edpredict.dif
Normal file
40
ksh93-edpredict.dif
Normal file
@ -0,0 +1,40 @@
|
||||
--- src/cmd/ksh93/edit/edit.c.orig 2016-02-18 10:33:20.604776826 +0000
|
||||
+++ src/cmd/ksh93/edit/edit.c 2016-02-18 10:34:02.019627077 +0000
|
||||
@@ -628,8 +628,8 @@ void ed_setup(register Edit_t *ep, int f
|
||||
ep->hoff = 0;
|
||||
#endif /* SHOPT_EDPREDICT */
|
||||
#if KSHELL
|
||||
- ep->e_stkptr = stakptr(0);
|
||||
ep->e_stkoff = staktell();
|
||||
+ ep->e_stkptr = stakfreeze(0);
|
||||
if(!(last = shp->prompt))
|
||||
last = "";
|
||||
shp->prompt = 0;
|
||||
--- src/cmd/ksh93/edit/emacs.c.orig 2016-02-18 10:33:27.144753171 +0000
|
||||
+++ src/cmd/ksh93/edit/emacs.c 2016-02-18 10:34:33.289514039 +0000
|
||||
@@ -721,10 +721,8 @@ process:
|
||||
draw(ep,FINAL);
|
||||
tty_cooked(ERRIO);
|
||||
if(ed->e_nlist)
|
||||
- {
|
||||
ed->e_nlist = 0;
|
||||
- stakset(ed->e_stkptr,ed->e_stkoff);
|
||||
- }
|
||||
+ stakset(ed->e_stkptr,ed->e_stkoff);
|
||||
if(c == '\n')
|
||||
{
|
||||
out[eol++] = '\n';
|
||||
--- src/cmd/ksh93/edit/vi.c.orig 2016-02-18 10:33:35.772722001 +0000
|
||||
+++ src/cmd/ksh93/edit/vi.c 2016-02-18 10:36:15.506143712 +0000
|
||||
@@ -608,10 +608,8 @@ int ed_viread(void *context, int fd, reg
|
||||
/* to cause the shell to process the line */
|
||||
tty_cooked(ERRIO);
|
||||
if(ed->e_nlist)
|
||||
- {
|
||||
ed->e_nlist = 0;
|
||||
- stakset(ed->e_stkptr,ed->e_stkoff);
|
||||
- }
|
||||
+ stakset(ed->e_stkptr,ed->e_stkoff);
|
||||
if( vp->addnl )
|
||||
{
|
||||
virtual[++last_virt] = '\n';
|
@ -1,6 +1,17 @@
|
||||
--- src/cmd/ksh93/sh/init.c
|
||||
+++ src/cmd/ksh93/sh/init.c 2013-02-15 13:29:57.129444048 +0000
|
||||
@@ -336,6 +336,8 @@ static void put_restricted(register Namv
|
||||
int path_scoped = 0, fpath_scoped=0;
|
||||
Pathcomp_t *pp;
|
||||
char *name = nv_name(np);
|
||||
+ if (!shp)
|
||||
+ shp = sh_getinterp();
|
||||
if(!(flags&NV_RDONLY) && sh_isoption(SH_RESTRICTED))
|
||||
errormsg(SH_DICT,ERROR_exit(1),e_restricted,nv_name(np));
|
||||
if(np==PATHNOD || (path_scoped=(strcmp(name,PATHNOD->nvname)==0)))
|
||||
--- src/cmd/ksh93/sh/name.c
|
||||
+++ src/cmd/ksh93/sh/name.c 2012-10-16 12:12:43.000000000 +0000
|
||||
@@ -2264,7 +2264,7 @@ static void attstore(register Namval_t *
|
||||
@@ -2162,7 +2162,7 @@ static void attstore(register Namval_t *
|
||||
if((flag&(NV_UTOL|NV_LTOU|NV_INTEGER)) == (NV_UTOL|NV_LTOU))
|
||||
{
|
||||
data = (void*)nv_mapchar(np,0);
|
||||
|
1631
ksh93-fdstatus.dif
Normal file
1631
ksh93-fdstatus.dif
Normal file
File diff suppressed because it is too large
Load Diff
35
ksh93-filedefined.dif
Normal file
35
ksh93-filedefined.dif
Normal file
@ -0,0 +1,35 @@
|
||||
--- ./src/lib/libast/features/stdio.orig 2017-12-20 12:15:45.571650029 +0000
|
||||
+++ ./src/lib/libast/features/stdio 2017-12-20 12:16:26.250531883 +0000
|
||||
@@ -6,6 +6,8 @@ cat{
|
||||
#define _FILE_DEFINED 1
|
||||
#define _FILE_defined 1
|
||||
#define _FILEDEFED 1
|
||||
+ #define __FILE_defined 1
|
||||
+ #define ____FILE_defined 1
|
||||
|
||||
#ifndef __FILE_TAG
|
||||
#define __FILE_TAG _sfio_s
|
||||
--- ./src/lib/libast/include/ast.h.orig 2017-12-20 12:16:37.212500201 +0000
|
||||
+++ ./src/lib/libast/include/ast.h 2017-12-20 12:17:25.635360669 +0000
|
||||
@@ -58,9 +58,21 @@ struct _sfio_s;
|
||||
#ifndef __FILE_typedef
|
||||
#define __FILE_typedef 1
|
||||
#endif
|
||||
+#ifndef _FILE_DEFINED
|
||||
+#define _FILE_DEFINED 1
|
||||
+#endif
|
||||
+#ifndef _FILE_defined
|
||||
+#define _FILE_defined 1
|
||||
+#endif
|
||||
#ifndef _FILEDEFED
|
||||
#define _FILEDEFED 1
|
||||
#endif
|
||||
+#ifndef __FILE_defined
|
||||
+#define __FILE_defined 1
|
||||
+#endif
|
||||
+#ifndef ____FILE_defined
|
||||
+#define ____FILE_defined 1
|
||||
+#endif
|
||||
#endif
|
||||
|
||||
/*
|
@ -1,13 +1,13 @@
|
||||
--- src/cmd/ksh93/sh/jobs.c
|
||||
+++ src/cmd/ksh93/sh/jobs.c 2014-02-18 14:28:42.330940622 +0000
|
||||
@@ -894,7 +894,9 @@ static void job_reset(register struct pr
|
||||
Shell_t *shp = pw->p_shp;
|
||||
+++ src/cmd/ksh93/sh/jobs.c 2012-02-08 10:52:14.000000000 +0000
|
||||
@@ -845,7 +845,9 @@ static void job_reset(register struct pr
|
||||
{
|
||||
/* save the terminal state for current job */
|
||||
#ifdef SIGTSTP
|
||||
- job_fgrp(pw,tcgetpgrp(job.fd));
|
||||
+ pid_t tgrp;
|
||||
+ if((tgrp=tcgetpgrp(job.fd))!=job.mypid)
|
||||
+ job_fgrp(pw,tgrp);
|
||||
if(sh_isoption(shp,SH_INTERACTIVE) && tcsetpgrp(job.fd,job.mypid) !=0)
|
||||
if(tcsetpgrp(job.fd,job.mypid) !=0)
|
||||
return;
|
||||
#endif /* SIGTSTP */
|
||||
|
105
ksh93-fs3d.dif
105
ksh93-fs3d.dif
@ -1,65 +1,62 @@
|
||||
2013-10-17 10:30:20 - werner@suse.de
|
||||
|
||||
Found by debugging with valgrind and environment variable LD_LIBRARY_PATH that
|
||||
the mount() system call function from the glibc is used instead of a fs3d_mount()
|
||||
function. To avoid this make fs3d_mount() a weak symbol to be overloadable by
|
||||
a shared library function and make the stub function return -1 for not configured
|
||||
file system type.
|
||||
|
||||
--- src/lib/libast/misc/fs3d.c
|
||||
+++ src/lib/libast/misc/fs3d.c 2013-10-17 10:30:20.000000000 +0000
|
||||
@@ -28,6 +28,20 @@
|
||||
* only active for non-shared 3d library
|
||||
*/
|
||||
|
||||
+#if defined(__linux__) && defined(__GNUC__)
|
||||
+# if defined __USE_ISOC99
|
||||
+# define _cat_pragma(exp) _Pragma(#exp)
|
||||
+# define _weak_pragma(exp) _cat_pragma(weak name)
|
||||
+# else
|
||||
+# define _weak_pragma(exp)
|
||||
+# endif
|
||||
+# define _declare(name,sym) __extension__ extern __typeof__(sym) name
|
||||
+# define weak_symbol(sym) _weak_pragma(name) _declare(sym,sym) __attribute__((__weak__))
|
||||
+# include <error.h>
|
||||
+#else
|
||||
+# define weak_symbol(sym)
|
||||
+#endif
|
||||
+
|
||||
#define mount ______mount
|
||||
|
||||
#include <ast.h>
|
||||
@@ -35,6 +49,7 @@
|
||||
#undef mount
|
||||
|
||||
#include <fs3d.h>
|
||||
+weak_symbol(fs3d_mount);
|
||||
|
||||
--- ./src/lib/libast/misc/fs3d.c.orig 2014-11-11 12:09:50.142397030 +0000
|
||||
+++ ./src/lib/libast/misc/fs3d.c 2014-11-11 12:11:19.667992242 +0000
|
||||
@@ -39,6 +39,7 @@
|
||||
int
|
||||
fs3d(register int op)
|
||||
@@ -102,11 +117,18 @@ fs3d(register int op)
|
||||
* user code that includes <fs3d.h> will have mount() mapped to fs3d_mount()
|
||||
* this restricts the various "standard" mount prototype conflicts to this spot
|
||||
* this means that code that includes <fs3d.h> cannot access the real mount
|
||||
- * (at least without some additional macro hackery
|
||||
+ * (at least without some additional macro hackery)
|
||||
*/
|
||||
{
|
||||
+#if SHOPT_FS_3D
|
||||
register int cur;
|
||||
register char* v;
|
||||
char val[sizeof(FS3D_off) + 8];
|
||||
@@ -95,6 +96,7 @@ fs3d(register int op)
|
||||
return cur;
|
||||
nope:
|
||||
fsview = -1;
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -107,6 +109,7 @@ fs3d(register int op)
|
||||
|
||||
#undef mount
|
||||
-
|
||||
+#if defined(__linux__) && defined(__GNUC__)
|
||||
+int __attribute__((__noinline__))
|
||||
+fs3d_mount(const char* source, char* target, int flags, void* data)
|
||||
+{
|
||||
+ errno = ENODEV;
|
||||
+ return -1;
|
||||
+}
|
||||
+#else
|
||||
|
||||
+#if SHOPT_FS_3D
|
||||
extern int mount(const char*, char*, int, void*);
|
||||
|
||||
int
|
||||
@@ -114,3 +136,4 @@ fs3d_mount(const char* source, char* tar
|
||||
@@ -114,3 +117,4 @@ fs3d_mount(const char* source, char* tar
|
||||
{
|
||||
return mount(source, target, flags, data);
|
||||
}
|
||||
+#endif
|
||||
--- ./src/lib/libast/path/pathkey.c.orig 2014-11-11 12:11:29.333948438 +0000
|
||||
+++ ./src/lib/libast/path/pathkey.c 2014-11-11 12:11:47.067868209 +0000
|
||||
@@ -109,8 +109,10 @@ pathkey_20100601(const char* lang, const
|
||||
* 3D
|
||||
*/
|
||||
|
||||
+#if SHOPT_FS_3D
|
||||
if (!flags && fs3d(FS3D_TEST) && (c = mount(path, tmp, FS3D_GET|FS3D_ALL|FS3D_SIZE(PATH_MAX), NiL)) > 1 && c < PATH_MAX)
|
||||
path = tmp;
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* preroot
|
||||
--- ./src/lib/libcoshell/coinit.c.orig 2014-11-11 12:08:49.438671153 +0000
|
||||
+++ ./src/lib/libcoshell/coinit.c 2014-11-11 12:09:25.956506292 +0000
|
||||
@@ -355,6 +355,7 @@ coinitialize(Coshell_t* co, int flags)
|
||||
p = (int)sfstrtell(sp);
|
||||
sfprintf(sp, "vpath ");
|
||||
n = PATH_MAX;
|
||||
+#if SHOPT_FS_3D
|
||||
if (fs3d(FS3D_TEST))
|
||||
for (;;)
|
||||
{
|
||||
@@ -370,6 +371,7 @@ coinitialize(Coshell_t* co, int flags)
|
||||
}
|
||||
}
|
||||
else
|
||||
+#endif
|
||||
{
|
||||
m = 0;
|
||||
sfprintf(sp, "- /#option/2d");
|
||||
|
@ -1,3 +1,27 @@
|
||||
--- src/lib/libast/misc/optget.c
|
||||
+++ src/lib/libast/misc/optget.c 2013-01-28 14:52:53.000000000 +0000
|
||||
@@ -4367,9 +4367,9 @@ optget(register char** argv, const char*
|
||||
*/
|
||||
|
||||
opt_info.assignment = 0;
|
||||
- num = 1;
|
||||
- w = v = 0;
|
||||
- x = 0;
|
||||
+ nov = no = num = 1;
|
||||
+ e = w = v = 0;
|
||||
+ n = x = 0;
|
||||
for (;;)
|
||||
{
|
||||
if (!opt_info.offset)
|
||||
@@ -5214,7 +5214,7 @@ optget(register char** argv, const char*
|
||||
|
||||
if (opt_info.num != LONG_MIN)
|
||||
opt_info.num = (long)(opt_info.number = num);
|
||||
- if ((n = *++s == '#') || *s == ':' || w && !nov && v && (optnumber(v, &e, NiL), n = !*e))
|
||||
+ if ((n = (*++s == '#')) || *s == ':' || w && !nov && v && (optnumber(v, &e, NiL), n = !*e))
|
||||
{
|
||||
if (w)
|
||||
{
|
||||
--- src/lib/libpp/ppsearch.c
|
||||
+++ src/lib/libpp/ppsearch.c 2012-03-14 11:40:11.000000000 +0000
|
||||
@@ -107,6 +107,14 @@ ppmultiple(register struct ppfile* fp, r
|
||||
@ -39,39 +63,3 @@
|
||||
/*
|
||||
* search for an include file
|
||||
* if (flags&SEARCH_INCLUDE) then
|
||||
--- src/lib/libcmd/ls.c
|
||||
+++ src/lib/libcmd/ls.c 2014-02-20 11:11:51.762689002 +0000
|
||||
@@ -1257,7 +1257,7 @@ ls(State_t* state, register FTSENT* ent)
|
||||
if (!VISIBLE(state, ent))
|
||||
{
|
||||
fts_set(NiL, ent, FTS_SKIP);
|
||||
- return;
|
||||
+ return 0;
|
||||
}
|
||||
switch (ent->fts_info)
|
||||
{
|
||||
@@ -1265,12 +1265,12 @@ ls(State_t* state, register FTSENT* ent)
|
||||
if (ent->fts_parent->fts_info == FTS_DNX)
|
||||
break;
|
||||
error(2, "%s: not found", ent->fts_path);
|
||||
- return;
|
||||
+ return 0;
|
||||
case FTS_DC:
|
||||
if (state->lsflags & LS_DIRECTORY)
|
||||
break;
|
||||
error(2, "%s: directory causes cycle", ent->fts_path);
|
||||
- return;
|
||||
+ return 0;
|
||||
case FTS_DNR:
|
||||
if (state->lsflags & LS_DIRECTORY)
|
||||
break;
|
||||
--- src/lib/libcmd/xargs.c
|
||||
+++ src/lib/libcmd/xargs.c 2014-02-20 11:23:40.348375000 +0000
|
||||
@@ -116,6 +116,7 @@ run(int argc, char** argv, Cmddisc_t* di
|
||||
{
|
||||
if (((Xargs_t*)disc)->context)
|
||||
return sh_run(((Xargs_t*)disc)->context, argc, argv);
|
||||
+ return(argc);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- src/cmd/ksh93/sh/lex.c
|
||||
+++ src/cmd/ksh93/sh/lex.c 2012-01-16 15:09:38.000000000 +0000
|
||||
@@ -1916,6 +1916,8 @@ static int here_copy(Lex_t *lp,register
|
||||
@@ -1893,6 +1893,8 @@ static int here_copy(Lex_t *lp,register
|
||||
sfputc(sp,'\\');
|
||||
}
|
||||
}
|
||||
|
19
ksh93-heredoclex.dif
Normal file
19
ksh93-heredoclex.dif
Normal file
@ -0,0 +1,19 @@
|
||||
--- src/cmd/ksh93/sh/lex.c
|
||||
+++ src/cmd/ksh93/sh/lex.c 2013-02-26 12:21:11.618820739 +0100
|
||||
@@ -1559,6 +1559,7 @@ static int comsub(register Lex_t *lp, in
|
||||
register int line=lp->sh->inlineno;
|
||||
char *first,*cp=fcseek(0),word[5];
|
||||
int off, messages=0, assignok=lp->assignok, csub;
|
||||
+ struct ionod *inheredoc = lp->heredoc;
|
||||
struct lexstate save;
|
||||
save = lp->lex;
|
||||
csub = lp->comsub;
|
||||
@@ -1683,7 +1684,7 @@ done:
|
||||
lp->lexd.dolparen--;
|
||||
lp->lex = save;
|
||||
lp->assignok = (endchar(lp)==RBRACT?assignok:0);
|
||||
- if(lp->heredoc)
|
||||
+ if(lp->heredoc && !inheredoc)
|
||||
errormsg(SH_DICT,ERROR_exit(SYNBAD),e_lexsyntax5,lp->sh->inlineno,lp->heredoc->ioname);
|
||||
return(messages);
|
||||
}
|
@ -1,26 +1,26 @@
|
||||
--- src/cmd/ksh93/features/math.sh
|
||||
+++ src/cmd/ksh93/features/math.sh 2014-02-18 12:40:44.891530835 +0000
|
||||
@@ -141,6 +141,18 @@ echo "#include <math.h>"
|
||||
+++ src/cmd/ksh93/features/math.sh 2012-01-20 14:23:38.000000000 +0000
|
||||
@@ -130,6 +130,18 @@ echo "#include <math.h>"
|
||||
case $_hdr_ieeefp in
|
||||
1) echo "#include <ieeefp.h>" ;;
|
||||
esac
|
||||
+cat <<!
|
||||
+#if defined(__ia64__) && defined(signbit)
|
||||
+# if defined __GNUC__ && __GNUC__ >= 4
|
||||
+# define __signbitl(f) __builtin_signbitl(f)
|
||||
+# define __signbitl(f) __builtin_signbitl(f)
|
||||
+# else
|
||||
+# include <ast_float.h>
|
||||
+# if _lib_copysignl
|
||||
+# define __signbitl(f) (int)(copysignl(1.0,(f))<0.0)
|
||||
+# define __signbitl(f) (int)(copysignl(1.0,(f))<0.0)
|
||||
+# endif
|
||||
+# endif
|
||||
+#endif
|
||||
+!
|
||||
echo
|
||||
|
||||
: generate the intercept functions and table entries
|
||||
|
||||
--- src/lib/libast/sfio/sfcvt.c
|
||||
+++ src/lib/libast/sfio/sfcvt.c 2014-02-18 12:38:56.090667053 +0000
|
||||
+++ src/lib/libast/sfio/sfcvt.c 2013-02-01 17:13:48.305452072 +0000
|
||||
@@ -54,6 +54,16 @@ static char *Zero = "0";
|
||||
#endif
|
||||
#endif
|
||||
|
22
ksh93-int16double.dif
Normal file
22
ksh93-int16double.dif
Normal file
@ -0,0 +1,22 @@
|
||||
--- src/cmd/ksh93/sh/array.c.orig 2015-04-01 11:26:36.544797902 +0000
|
||||
+++ src/cmd/ksh93/sh/array.c 2015-04-01 11:27:01.414692760 +0000
|
||||
@@ -592,7 +592,7 @@ static char *array_getval(Namval_t *np,
|
||||
return(cp);
|
||||
}
|
||||
#if SHOPT_FIXEDARRAY
|
||||
- if(ap->fixed && nv_isattr(np,NV_INT16P) == NV_INT16)
|
||||
+ if(ap->fixed && nv_isattr(np,NV_INT16P|NV_DOUBLE) == NV_INT16)
|
||||
np->nvalue.s = *np->nvalue.sp;
|
||||
#endif /* SHOPT_FIXEDARRAY */
|
||||
return(nv_getv(np,&ap->hdr));
|
||||
--- src/cmd/ksh93/sh/name.c.orig 2015-04-01 11:25:38.049045236 +0000
|
||||
+++ src/cmd/ksh93/sh/name.c 2015-04-01 11:25:55.169972879 +0000
|
||||
@@ -1647,7 +1647,7 @@ void nv_putval(register Namval_t *np, co
|
||||
return;
|
||||
}
|
||||
up= &np->nvalue;
|
||||
- if(nv_isattr(np,NV_INT16P) == NV_INT16)
|
||||
+ if(nv_isattr(np,NV_INT16P|NV_DOUBLE) == NV_INT16)
|
||||
{
|
||||
if(!np->nvalue.up || !nv_isarray(np))
|
||||
{
|
31
ksh93-joblock.dif
Normal file
31
ksh93-joblock.dif
Normal file
@ -0,0 +1,31 @@
|
||||
--- ./src/cmd/ksh93/include/jobs.h.orig 2014-11-19 14:14:36.055335722 +0000
|
||||
+++ ./src/cmd/ksh93/include/jobs.h 2014-11-19 14:16:12.275918218 +0000
|
||||
@@ -33,6 +33,7 @@
|
||||
# include <signal.h>
|
||||
#endif /* !SIGINT */
|
||||
#include "FEATURE/options"
|
||||
+#include <aso.h>
|
||||
|
||||
#if SHOPT_COSHELL
|
||||
# include <coshell.h>
|
||||
@@ -150,16 +151,13 @@ extern struct jobs job;
|
||||
#define vmbusy() 0
|
||||
#endif
|
||||
|
||||
-#define job_lock() (job.in_critical++)
|
||||
+#define job_lock() asoincint(&job.in_critical)
|
||||
#define job_unlock() \
|
||||
do { \
|
||||
int _sig; \
|
||||
- if (!--job.in_critical && (_sig = job.savesig)) \
|
||||
- { \
|
||||
- if (!job.in_critical++ && !vmbusy()) \
|
||||
- job_reap(_sig); \
|
||||
- job.in_critical--; \
|
||||
- } \
|
||||
+ if (asogetint(&job.in_critical) == 1 && (_sig = job.savesig) && !vmbusy()) \
|
||||
+ job_reap(_sig); \
|
||||
+ asodecint(&job.in_critical); \
|
||||
} while(0)
|
||||
|
||||
extern const char e_jobusage[];
|
35
ksh93-jobs.dif
Normal file
35
ksh93-jobs.dif
Normal file
@ -0,0 +1,35 @@
|
||||
--- src/cmd/ksh93/sh/jobs.c
|
||||
+++ src/cmd/ksh93/sh/jobs.c 2012-12-20 13:33:28.000000000 +0000
|
||||
@@ -638,12 +638,14 @@ void job_init(Shell_t *shp, int lflag)
|
||||
/* This should have already been done by rlogin */
|
||||
register int fd;
|
||||
register char *ttynam;
|
||||
+ int err = errno;
|
||||
#ifndef SIGTSTP
|
||||
setpgid(0,shp->gd->pid);
|
||||
#endif /*SIGTSTP */
|
||||
if(job.mypgid<0 || !(ttynam=ttyname(JOBTTY)))
|
||||
return;
|
||||
- close(JOBTTY);
|
||||
+ while(close(JOBTTY)<0 && errno==EINTR)
|
||||
+ errno = err;
|
||||
if((fd = open(ttynam,O_RDWR)) <0)
|
||||
return;
|
||||
if(fd!=JOBTTY)
|
||||
@@ -1110,7 +1112,7 @@ static struct process *job_bystring(regi
|
||||
|
||||
int job_kill(register struct process *pw,register int sig)
|
||||
{
|
||||
- Shell_t *shp = pw->p_shp;
|
||||
+ Shell_t *shp;
|
||||
register pid_t pid;
|
||||
register int r;
|
||||
const char *msg;
|
||||
@@ -1123,6 +1125,7 @@ int job_kill(register struct process *pw
|
||||
errno = ECHILD;
|
||||
if(pw==0)
|
||||
goto error;
|
||||
+ shp = pw->p_shp;
|
||||
pid = pw->p_pid;
|
||||
#if SHOPT_COSHELL
|
||||
if(pw->p_cojob)
|
10
ksh93-jpold.dif
Normal file
10
ksh93-jpold.dif
Normal file
@ -0,0 +1,10 @@
|
||||
--- src/cmd/ksh93/sh/jobs.c.orig 2015-09-15 15:56:08.902265877 +0000
|
||||
+++ src/cmd/ksh93/sh/jobs.c 2015-09-15 15:57:00.866122451 +0000
|
||||
@@ -1981,6 +1981,7 @@ again:
|
||||
{
|
||||
count = bp->count;
|
||||
jp = bp->list;
|
||||
+ jpold = 0;
|
||||
goto again;
|
||||
}
|
||||
if(jp)
|
@ -9,3 +9,23 @@
|
||||
const char* description;
|
||||
int index;
|
||||
const char* conf;
|
||||
--- src/cmd/ksh93/sh/init.c
|
||||
+++ src/cmd/ksh93/sh/init.c 2013-02-01 15:53:58.733952540 +0000
|
||||
@@ -170,7 +170,7 @@ struct match
|
||||
char *val;
|
||||
char *rval[2];
|
||||
regoff_t *match;
|
||||
- char node[NV_MINSZ+sizeof(char*)];
|
||||
+ char node[NV_MINSZ+sizeof(char*)+sizeof(Dtlink_t)];
|
||||
regoff_t first;
|
||||
int vsize;
|
||||
int nmatch;
|
||||
@@ -766,7 +766,7 @@ static int hasgetdisc(register Namfun_t
|
||||
void sh_setmatch(Shell_t *shp,const char *v, int vsize, int nmatch, regoff_t match[],int index)
|
||||
{
|
||||
struct match *mp = &ip->SH_MATCH_init;
|
||||
- Namval_t *np = nv_namptr(mp->node,0);
|
||||
+ Namval_t *np = (Namval_t*)(&(mp->node[0]));
|
||||
register int i,n,x, savesub=shp->subshell;
|
||||
Namarr_t *ap = nv_arrayptr(SH_MATCHNOD);
|
||||
shp->subshell = 0;
|
||||
|
65
ksh93-longenv.dif
Normal file
65
ksh93-longenv.dif
Normal file
@ -0,0 +1,65 @@
|
||||
--- ./src/cmd/ksh93/include/defs.h.orig 2014-11-13 16:34:43.395195739 +0000
|
||||
+++ ./src/cmd/ksh93/include/defs.h 2014-11-13 16:38:37.944297333 +0000
|
||||
@@ -162,8 +162,8 @@ struct shared
|
||||
Namval_t *prev_table; /* previous table used in nv_open */ \
|
||||
Sfio_t *outpool; /* ouput stream pool */ \
|
||||
long timeout; /* read timeout */ \
|
||||
- short curenv; /* current subshell number */ \
|
||||
- short jobenv; /* subshell number for jobs */ \
|
||||
+ long curenv; /* current subshell number */ \
|
||||
+ long jobenv; /* subshell number for jobs */ \
|
||||
int infd; /* input file descriptor */ \
|
||||
short nextprompt; /* next prompt is PS<nextprompt> */ \
|
||||
short poolfiles; \
|
||||
--- ./src/cmd/ksh93/include/jobs.h.orig 2014-11-13 16:35:10.331086826 +0000
|
||||
+++ ./src/cmd/ksh93/include/jobs.h 2014-11-13 16:38:53.856235814 +0000
|
||||
@@ -87,7 +87,7 @@ struct process
|
||||
unsigned short p_exit; /* exit value or signal number */
|
||||
unsigned short p_exitmin; /* minimum exit value for xargs */
|
||||
unsigned short p_flag; /* flags - see below */
|
||||
- int p_env; /* subshell environment number */
|
||||
+ long p_env; /* subshell environment number */
|
||||
#ifdef JOBS
|
||||
off_t p_name; /* history file offset for command */
|
||||
struct termios p_stty; /* terminal state for job */
|
||||
--- ./src/cmd/ksh93/sh/jobs.c.orig 2014-11-13 16:36:02.050894977 +0000
|
||||
+++ ./src/cmd/ksh93/sh/jobs.c 2014-11-13 16:37:09.568636499 +0000
|
||||
@@ -1815,7 +1815,7 @@ static struct process *job_unpost(regist
|
||||
register struct process *pw;
|
||||
/* make sure all processes are done */
|
||||
#ifdef DEBUG
|
||||
- sfprintf(sfstderr,"ksh: job line %4d: drop pid=%d critical=%d pid=%d env=%d\n",__LINE__,getpid(),job.in_critical,pwtop->p_pid,pwtop->p_env);
|
||||
+ sfprintf(sfstderr,"ksh: job line %4d: drop pid=%d critical=%d pid=%d env=%ld\n",__LINE__,getpid(),job.in_critical,pwtop->p_pid,pwtop->p_env);
|
||||
sfsync(sfstderr);
|
||||
#endif /* DEBUG */
|
||||
pwtop = pw = job_byjid((int)pwtop->p_job);
|
||||
--- ./src/cmd/ksh93/sh/subshell.c.orig 2014-11-13 16:34:53.259157199 +0000
|
||||
+++ ./src/cmd/ksh93/sh/subshell.c 2014-11-13 16:38:11.440395221 +0000
|
||||
@@ -107,7 +107,7 @@ static struct subshell
|
||||
#endif /* SHOPT_COSHELL */
|
||||
} *subshell_data;
|
||||
|
||||
-static int subenv;
|
||||
+static long subenv;
|
||||
|
||||
|
||||
/*
|
||||
@@ -183,7 +183,8 @@ void sh_subfork(void)
|
||||
{
|
||||
register struct subshell *sp = subshell_data;
|
||||
Shell_t *shp = sp->shp;
|
||||
- int curenv = shp->curenv, comsub=shp->comsub;
|
||||
+ long curenv = shp->curenv;
|
||||
+ int comsub=shp->comsub;
|
||||
pid_t pid;
|
||||
char *trap = shp->st.trapcom[0];
|
||||
if(trap)
|
||||
@@ -476,7 +477,7 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_
|
||||
struct subshell sub_data;
|
||||
register struct subshell *sp = &sub_data;
|
||||
int jmpval,nsig=0,duped=0;
|
||||
- int savecurenv = shp->curenv;
|
||||
+ long savecurenv = shp->curenv;
|
||||
int savejobpgid = job.curpgid;
|
||||
int *saveexitval = job.exitval;
|
||||
int16_t subshell;
|
15
ksh93-malloc-hook.dif
Normal file
15
ksh93-malloc-hook.dif
Normal file
@ -0,0 +1,15 @@
|
||||
--- ./src/lib/libast/vmalloc/malloc.c.orig 2014-11-19 11:51:06.992595039 +0000
|
||||
+++ ./src/lib/libast/vmalloc/malloc.c 2014-11-19 12:00:22.713076989 +0000
|
||||
@@ -1070,12 +1070,8 @@ extern Void_t* F1(_ast_valloc, size_t,n)
|
||||
|
||||
#if !_UWIN
|
||||
|
||||
-#if !_malloc_hook
|
||||
-
|
||||
#include <malloc.h>
|
||||
|
||||
-#endif
|
||||
-
|
||||
typedef struct mallinfo Mallinfo_t;
|
||||
typedef struct mstats Mstats_t;
|
||||
|
11
ksh93-nvtree-free.dif
Normal file
11
ksh93-nvtree-free.dif
Normal file
@ -0,0 +1,11 @@
|
||||
--- src/cmd/ksh93/sh/nvtree.c.orig 2015-03-17 16:00:01.111718083 +0000
|
||||
+++ src/cmd/ksh93/sh/nvtree.c 2015-03-17 16:00:31.560586300 +0000
|
||||
@@ -1152,6 +1152,8 @@ static void put_tree(register Namval_t *
|
||||
nv_putv(np, val, flags,fp);
|
||||
if(val && nv_isattr(np,(NV_INTEGER|NV_BINARY)))
|
||||
return;
|
||||
+ if (!val && !np->nvfun)
|
||||
+ return;
|
||||
if(ap= nv_arrayptr(np))
|
||||
nleft = array_elem(ap);
|
||||
if(nleft==0)
|
15
ksh93-optimizeleak.dif
Normal file
15
ksh93-optimizeleak.dif
Normal file
@ -0,0 +1,15 @@
|
||||
--- ./src/cmd/ksh93/sh/name.c.orig 2016-06-01 13:09:29.754690694 +0000
|
||||
+++ ./src/cmd/ksh93/sh/name.c 2016-06-01 13:09:53.348690652 +0000
|
||||
@@ -2726,6 +2726,12 @@ void nv_optimize(Namval_t *np)
|
||||
}
|
||||
if((xp= (struct optimize*)fp) && xp->ptr==shp->argaddr)
|
||||
return;
|
||||
+ if (xp && xp->next) {
|
||||
+ register struct optimize *xpn;
|
||||
+ for (xpn = xp->next; xpn; xpn = xpn->next)
|
||||
+ if (xpn->ptr == shp->argaddr && xpn->np == np)
|
||||
+ return;
|
||||
+ }
|
||||
if(op = opt_free)
|
||||
opt_free = op->next;
|
||||
else
|
13
ksh93-path-skip.dif
Normal file
13
ksh93-path-skip.dif
Normal file
@ -0,0 +1,13 @@
|
||||
--- ./src/cmd/ksh93/sh/path.c.orig 2014-10-09 15:50:51.198269322 +0000
|
||||
+++ ./src/cmd/ksh93/sh/path.c 2014-10-09 15:51:16.351159405 +0000
|
||||
@@ -517,8 +517,8 @@ static int path_opentype(Shell_t *shp,co
|
||||
do
|
||||
{
|
||||
pp = path_nextcomp(shp,oldpp=pp,name,0);
|
||||
- while(oldpp && (oldpp->flags&PATH_SKIP))
|
||||
- oldpp = oldpp->next;
|
||||
+ if (oldpp && (oldpp->flags&PATH_SKIP))
|
||||
+ continue;
|
||||
if(fun && (!oldpp || !(oldpp->flags&PATH_FPATH)))
|
||||
continue;
|
||||
if((fd = sh_open(path_relative(shp,stakptr(PATH_OFFSET)),O_RDONLY,0)) >= 0)
|
@ -1,6 +1,13 @@
|
||||
--- src/lib/libast/path/pathtemp.c
|
||||
+++ src/lib/libast/path/pathtemp.c 2014-02-18 15:01:00.750362427 +0000
|
||||
@@ -85,9 +85,42 @@
|
||||
+++ src/lib/libast/path/pathtemp.c 2012-10-25 10:35:14.510345073 +0000
|
||||
@@ -73,15 +73,49 @@
|
||||
#include <ls.h>
|
||||
#include <tv.h>
|
||||
#include <tm.h>
|
||||
+#include <error.h>
|
||||
|
||||
#define ATTEMPT 10
|
||||
|
||||
#define TMP_ENV "TMPDIR"
|
||||
#define TMP_PATH_ENV "TMPPATH"
|
||||
#define TMP1 "/tmp"
|
||||
@ -16,7 +23,7 @@
|
||||
+
|
||||
+ if (!pgsz)
|
||||
+ pgsz = strtoul(astconf("PAGESIZE",NiL,NiL),NiL,0);
|
||||
+
|
||||
+
|
||||
+ if (!path || !*path)
|
||||
+ {
|
||||
+ errno = EFAULT;
|
||||
@ -29,7 +36,7 @@
|
||||
+
|
||||
+ if (ret < 0)
|
||||
+ goto err;
|
||||
+
|
||||
+
|
||||
+ if (vfs.f_frsize*vfs.f_bavail < pgsz)
|
||||
+ {
|
||||
+ errno = ENOSPC;
|
||||
@ -41,11 +48,11 @@
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+#define VALID(d) (*(d)&&!xaccess(d,W_OK|X_OK))
|
||||
+#define VALID(d) (*(d)&&!xaccess(d,W_OK|X_OK))
|
||||
|
||||
static struct Tmp_s
|
||||
static struct
|
||||
{
|
||||
@@ -197,7 +230,7 @@ pathtemp(char* buf, size_t len, const ch
|
||||
@@ -182,7 +216,7 @@ pathtemp(char* buf, size_t len, const ch
|
||||
tv.tv_nsec = 0;
|
||||
else
|
||||
tvgettime(&tv);
|
||||
@ -54,7 +61,7 @@
|
||||
{
|
||||
if (!tmp.vec)
|
||||
{
|
||||
@@ -242,7 +275,7 @@ pathtemp(char* buf, size_t len, const ch
|
||||
@@ -227,7 +261,7 @@ pathtemp(char* buf, size_t len, const ch
|
||||
tmp.dir = tmp.vec;
|
||||
d = *tmp.dir++;
|
||||
}
|
||||
@ -64,7 +71,7 @@
|
||||
}
|
||||
if (!len)
|
||||
--- src/lib/libast/sfio/sftmp.c
|
||||
+++ src/lib/libast/sfio/sftmp.c 2014-02-18 14:57:17.508587267 +0000
|
||||
+++ src/lib/libast/sfio/sftmp.c 2012-10-25 12:09:18.026344912 +0000
|
||||
@@ -20,6 +20,14 @@
|
||||
* *
|
||||
***********************************************************************/
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- src/cmd/ksh93/sh/main.c
|
||||
+++ src/cmd/ksh93/sh/main.c 2014-02-17 16:18:29.717590155 +0000
|
||||
@@ -205,14 +205,38 @@ int sh_main(int ac, char *av[], Shinit_f
|
||||
+++ src/cmd/ksh93/sh/main.c 2010-08-17 15:35:18.000000000 +0000
|
||||
@@ -200,14 +200,38 @@ int sh_main(int ac, char *av[], Shinit_f
|
||||
{
|
||||
/* system profile */
|
||||
sh_source(shp, iop, e_sysprofile);
|
||||
@ -8,12 +8,12 @@
|
||||
+ /* make sure PWD is set up correctly */
|
||||
+ path_pwd(shp,1);
|
||||
+#if SHOPT_SYSRC
|
||||
+ if(!sh_isoption(shp,SH_NOEXEC))
|
||||
+ if(!sh_isoption(SH_NOEXEC))
|
||||
+ {
|
||||
+ if(!sh_isoption(shp,SH_NOUSRPROFILE) && !sh_isoption(shp,SH_PRIVILEGED) && sh_isoption(shp,SH_RC))
|
||||
+ if(!sh_isoption(SH_NOUSRPROFILE) && !sh_isoption(SH_PRIVILEGED) && sh_isoption(SH_RC))
|
||||
+ {
|
||||
+#if SHOPT_BASH
|
||||
+ if(sh_isoption(shp,SH_BASH) && !sh_isoption(shp,SH_POSIX))
|
||||
+ if(sh_isoption(SH_BASH) && !sh_isoption(SH_POSIX))
|
||||
+ sh_source(shp, iop, e_bash_sysrc);
|
||||
+ else
|
||||
+#endif
|
||||
@ -28,9 +28,9 @@
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+ if(sh_isoption(shp,SH_LOGIN_SHELL) && !sh_isoption(shp,SH_NOPROFILE))
|
||||
+ if(sh_isoption(SH_LOGIN_SHELL) && !sh_isoption(SH_NOPROFILE))
|
||||
+ {
|
||||
if(!sh_isoption(shp,SH_NOUSRPROFILE) && !sh_isoption(shp,SH_PRIVILEGED))
|
||||
if(!sh_isoption(SH_NOUSRPROFILE) && !sh_isoption(SH_PRIVILEGED))
|
||||
{
|
||||
char **files = shp->gd->login_files;
|
||||
while ((name = *files++) && !sh_source(shp, iop, sh_mactry(shp,name)));
|
||||
@ -38,12 +38,12 @@
|
||||
}
|
||||
- /* make sure PWD is set up correctly */
|
||||
- path_pwd(shp,1);
|
||||
if(!sh_isoption(shp,SH_NOEXEC))
|
||||
if(!sh_isoption(SH_NOEXEC))
|
||||
{
|
||||
if(!sh_isoption(shp,SH_NOUSRPROFILE) && !sh_isoption(shp,SH_PRIVILEGED) && sh_isoption(shp,SH_RC))
|
||||
@@ -220,9 +243,6 @@ int sh_main(int ac, char *av[], Shinit_f
|
||||
if(!sh_isoption(SH_NOUSRPROFILE) && !sh_isoption(SH_PRIVILEGED) && sh_isoption(SH_RC))
|
||||
@@ -215,9 +239,6 @@ int sh_main(int ac, char *av[], Shinit_f
|
||||
#if SHOPT_BASH
|
||||
if(sh_isoption(shp,SH_BASH) && !sh_isoption(shp,SH_POSIX))
|
||||
if(sh_isoption(SH_BASH) && !sh_isoption(SH_POSIX))
|
||||
{
|
||||
-#if SHOPT_SYSRC
|
||||
- sh_source(shp, iop, e_bash_sysrc);
|
||||
@ -51,12 +51,12 @@
|
||||
sh_source(shp, iop, shp->gd->rcfile ? shp->gd->rcfile : sh_mactry(shp,(char*)e_bash_rc));
|
||||
}
|
||||
else
|
||||
@@ -230,10 +250,6 @@ int sh_main(int ac, char *av[], Shinit_f
|
||||
@@ -225,10 +246,6 @@ int sh_main(int ac, char *av[], Shinit_f
|
||||
{
|
||||
if(name = sh_mactry(shp,nv_getval(ENVNOD)))
|
||||
name = *name ? strdup(name) : (char*)0;
|
||||
-#if SHOPT_SYSRC
|
||||
- if(!name || !strmatch(name, "?(.)/./*"))
|
||||
- if(!strmatch(name, "?(.)/./*"))
|
||||
- sh_source(shp, iop, e_sysrc);
|
||||
-#endif
|
||||
if(name)
|
||||
|
20
ksh93-redirectleak.dif
Normal file
20
ksh93-redirectleak.dif
Normal file
@ -0,0 +1,20 @@
|
||||
--- src/cmd/ksh93/sh/io.c.orig 2015-12-09 11:18:00.657295950 +0000
|
||||
+++ src/cmd/ksh93/sh/io.c 2015-12-09 11:18:57.719080685 +0000
|
||||
@@ -1541,7 +1541,17 @@ int sh_redirect(Shell_t *shp,struct iono
|
||||
sh_iosave(shp,fn,indx,tname?fname:(trunc?Empty:0));
|
||||
}
|
||||
else if(sh_subsavefd(fn))
|
||||
+ {
|
||||
+ if(fd==fn)
|
||||
+ {
|
||||
+ if((r=sh_fcntl(fd,F_DUPFD,10)) > 0)
|
||||
+ {
|
||||
+ fd = r;
|
||||
+ sh_close(fn);
|
||||
+ }
|
||||
+ }
|
||||
sh_iosave(shp,fn,indx|IOSUBSHELL,tname?fname:0);
|
||||
+ }
|
||||
}
|
||||
if(fd<0)
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
--- src/cmd/ksh93/edit/edit.c
|
||||
+++ src/cmd/ksh93/edit/edit.c 2013-02-01 17:18:31.405454238 +0000
|
||||
@@ -1697,8 +1697,13 @@ int ed_histgen(Edit_t *ep,const char *pa
|
||||
@@ -1769,8 +1769,13 @@ int ed_histgen(Edit_t *ep,const char *pa
|
||||
mplast->next = mp;
|
||||
mplast->next = 0;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
--- src/cmd/ksh93/bltins/read.c
|
||||
+++ src/cmd/ksh93/bltins/read.c 2014-02-18 12:46:08.326103466 +0000
|
||||
@@ -297,6 +297,20 @@ int sh_readline(register Shell_t *shp,ch
|
||||
+++ src/cmd/ksh93/bltins/read.c 2013-02-01 15:29:39.393452098 +0000
|
||||
@@ -288,6 +288,19 @@ int sh_readline(register Shell_t *shp,ch
|
||||
ep->e_nttyparm.c_lflag |= ISIG;
|
||||
tty_set(sffileno(iop),TCSADRAIN,&ep->e_nttyparm);
|
||||
tty_set(fd,TCSADRAIN,&ep->e_nttyparm);
|
||||
}
|
||||
+#if defined(__linux__)
|
||||
+ else if ((shp->fdstatus[fd]&(IOTTY|IONOSEEK))==0)
|
||||
@ -17,7 +17,6 @@
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
}
|
||||
binary = nv_isattr(np,NV_BINARY);
|
||||
if(!binary && !(flags&(N_FLAG|NN_FLAG)))
|
||||
|
263
ksh93-sfio.dif
Normal file
263
ksh93-sfio.dif
Normal file
@ -0,0 +1,263 @@
|
||||
--- src/lib/libast/include/sfio_t.h
|
||||
+++ src/lib/libast/include/sfio_t.h 2013-10-11 09:22:41.000000000 +0000
|
||||
@@ -34,7 +34,7 @@
|
||||
#define _SFIO_PRIVATE \
|
||||
Sfoff_t extent; /* current file size */ \
|
||||
Sfoff_t here; /* current physical location */ \
|
||||
- unsigned char unused_1;/* unused #1 */ \
|
||||
+ unsigned char ngetr; /* sfgetr count */ \
|
||||
unsigned char tiny[1];/* for unbuffered read stream */ \
|
||||
unsigned short bits; /* private flags */ \
|
||||
unsigned int mode; /* current io mode */ \
|
||||
@@ -82,7 +82,7 @@
|
||||
(ssize_t)(-1), /* val */ \
|
||||
(Sfoff_t)0, /* extent */ \
|
||||
(Sfoff_t)0, /* here */ \
|
||||
- 0, /* getr */ \
|
||||
+ 0, /* ngetr */ \
|
||||
{0}, /* tiny */ \
|
||||
0, /* bits */ \
|
||||
(unsigned int)(((type)&(SF_RDWR))|SF_INIT), /* mode */ \
|
||||
@@ -93,7 +93,8 @@
|
||||
(mutex), /* mutex */ \
|
||||
(Void_t*)0, /* stdio */ \
|
||||
(Sfoff_t)0, /* lpos */ \
|
||||
- (size_t)0 /* iosz */ \
|
||||
+ (size_t)0, /* iosz */ \
|
||||
+ 0 /* getr */ \
|
||||
}
|
||||
|
||||
/* function to clear an Sfio_t structure */
|
||||
@@ -110,7 +111,7 @@
|
||||
(f)->val = (ssize_t)(-1), /* val */ \
|
||||
(f)->extent = (Sfoff_t)(-1), /* extent */ \
|
||||
(f)->here = (Sfoff_t)0, /* here */ \
|
||||
- (f)->getr = 0, /* getr */ \
|
||||
+ (f)->ngetr = 0, /* ngetr */ \
|
||||
(f)->tiny[0] = 0, /* tiny */ \
|
||||
(f)->bits = 0, /* bits */ \
|
||||
(f)->mode = 0, /* mode */ \
|
||||
@@ -121,7 +122,8 @@
|
||||
(f)->mutex = (mtx), /* mutex */ \
|
||||
(f)->stdio = (Void_t*)0, /* stdio */ \
|
||||
(f)->lpos = (Sfoff_t)0, /* lpos */ \
|
||||
- (f)->iosz = (size_t)0 /* iosz */ \
|
||||
+ (f)->iosz = (size_t)0, /* iosz */ \
|
||||
+ (f)->getr = 0 /* getr */ \
|
||||
)
|
||||
|
||||
/* expose next stream inside discipline function; state saved in int f */
|
||||
--- src/lib/libast/sfio/sfflsbuf.c
|
||||
+++ src/lib/libast/sfio/sfflsbuf.c 2013-10-18 11:50:01.866235555 +0000
|
||||
@@ -96,7 +96,7 @@ int c; /* if c>=0, c is also written out
|
||||
isall = SFISALL(f,isall);
|
||||
if((w = SFWR(f,data,n,f->disc)) > 0)
|
||||
{ if((n -= w) > 0) /* save unwritten data, then resume */
|
||||
- memcpy((char*)f->data,(char*)data+w,n);
|
||||
+ memmove((char*)f->data,(char*)data+w,n);
|
||||
written += w;
|
||||
f->next = f->data+n;
|
||||
if(c < 0 && (!isall || n == 0))
|
||||
--- src/lib/libast/sfio/sfmode.c
|
||||
+++ src/lib/libast/sfio/sfmode.c 2013-10-11 09:26:43.000000000 +0000
|
||||
@@ -258,7 +258,7 @@ reg Sfio_t* f; /* stream to close */
|
||||
#endif
|
||||
{
|
||||
Sfproc_t* p;
|
||||
- int pid, status;
|
||||
+ int status;
|
||||
|
||||
if(!(p = f->proc))
|
||||
return -1;
|
||||
@@ -279,7 +279,7 @@ reg Sfio_t* f; /* stream to close */
|
||||
sigcritical(SIG_REG_EXEC|SIG_REG_PROC);
|
||||
#endif
|
||||
status = -1;
|
||||
- while ((pid = waitpid(p->pid,&status,0)) == -1 && errno == EINTR)
|
||||
+ while (waitpid(p->pid,&status,0) == -1 && errno == EINTR)
|
||||
;
|
||||
#if _PACKAGE_ast
|
||||
status = status == -1 ?
|
||||
@@ -405,12 +405,16 @@ reg int local; /* a local call */
|
||||
if(f->mode&SF_GETR)
|
||||
{ f->mode &= ~SF_GETR;
|
||||
#ifdef MAP_TYPE
|
||||
- if((f->bits&SF_MMAP) && (f->tiny[0] += 1) >= (4*SF_NMAP) )
|
||||
- { /* turn off mmap to avoid page faulting */
|
||||
- sfsetbuf(f,(Void_t*)f->tiny,(size_t)SF_UNBOUND);
|
||||
- f->tiny[0] = 0;
|
||||
+ if(f->bits&SF_MMAP)
|
||||
+ {
|
||||
+ if (!++f->ngetr)
|
||||
+ f->tiny[0]++;
|
||||
+ if(((f->tiny[0]<<8)|f->ngetr) >= (4*SF_NMAP) )
|
||||
+ { /* turn off mmap to avoid page faulting */
|
||||
+ sfsetbuf(f,(Void_t*)f->tiny,(size_t)SF_UNBOUND);
|
||||
+ f->ngetr = f->tiny[0] = 0;
|
||||
+ }
|
||||
}
|
||||
- else
|
||||
#endif
|
||||
if(f->getr)
|
||||
{ f->next[-1] = f->getr;
|
||||
--- src/lib/libast/sfio/sfmove.c
|
||||
+++ src/lib/libast/sfio/sfmove.c 2013-10-18 12:04:03.194735625 +0000
|
||||
@@ -113,7 +113,11 @@ reg int rc; /* record separator */
|
||||
|
||||
/* try reading a block of data */
|
||||
direct = 0;
|
||||
- if((r = fr->endb - (next = fr->next)) <= 0)
|
||||
+ if(fr->rsrv && (r = -fr->rsrv->slen) > 0)
|
||||
+ { fr->rsrv->slen = 0;
|
||||
+ next = fr->rsrv->data;
|
||||
+ }
|
||||
+ else if((r = fr->endb - (next = fr->next)) <= 0)
|
||||
{ /* amount of data remained to be read */
|
||||
if((w = n > MAX_SSIZE ? MAX_SSIZE : (ssize_t)n) < 0)
|
||||
{ if(fr->extent < 0)
|
||||
--- src/lib/libast/sfio/sfpoll.c
|
||||
+++ src/lib/libast/sfio/sfpoll.c 2013-10-18 11:59:50.778735232 +0000
|
||||
@@ -138,7 +138,7 @@ int tm; /* time in millisecs for select
|
||||
while((np = SFPOLL(fds,m,tm)) < 0 )
|
||||
{ if(errno == eintr || errno == EAGAIN)
|
||||
errno = 0;
|
||||
- else break;
|
||||
+ else goto report;
|
||||
}
|
||||
if(np > 0) /* poll succeeded */
|
||||
np = c;
|
||||
@@ -147,14 +147,14 @@ int tm; /* time in millisecs for select
|
||||
{ f = fa[check[r]];
|
||||
|
||||
if((f->flags&SF_WRITE) && !WRREADY(f) )
|
||||
- { if(fds[m].revents&POLLOUT)
|
||||
+ { if(fds[m].revents&(POLLOUT|POLLHUP|POLLERR))
|
||||
status[check[r]] |= SF_WRITE;
|
||||
}
|
||||
|
||||
if((f->flags&SF_READ) && !RDREADY(f))
|
||||
{ if((f->mode&SF_WRITE) && HASAUXFD(f))
|
||||
m += 1;
|
||||
- if(fds[m].revents&POLLIN)
|
||||
+ if(fds[m].revents&(POLLIN|POLLHUP|POLLERR))
|
||||
status[check[r]] |= SF_READ;
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,7 @@ int tm; /* time in millisecs for select
|
||||
while((np = select(m+1,&rd,&wr,NIL(fd_set*),tmp)) < 0 )
|
||||
{ if(errno == eintr)
|
||||
errno = 0;
|
||||
- else break;
|
||||
+ else goto report;
|
||||
}
|
||||
if(np > 0)
|
||||
np = c;
|
||||
@@ -227,6 +227,7 @@ int tm; /* time in millisecs for select
|
||||
}
|
||||
#endif /*_lib_select*/
|
||||
|
||||
+ report:
|
||||
for(r = c = 0; c < n; ++c)
|
||||
{ if(status[c] == 0)
|
||||
continue;
|
||||
--- src/lib/libast/sfio/sfpool.c
|
||||
+++ src/lib/libast/sfio/sfpool.c 2013-10-18 11:49:25.614237061 +0000
|
||||
@@ -138,7 +138,7 @@ int n; /* current position in pool */
|
||||
else /* write failed, recover buffer then quit */
|
||||
{ if(w > 0)
|
||||
{ v -= w;
|
||||
- memcpy(head->data,(head->data+w),v);
|
||||
+ memmove(head->data,(head->data+w),v);
|
||||
}
|
||||
head->next = head->data+v;
|
||||
goto done;
|
||||
@@ -147,7 +147,7 @@ int n; /* current position in pool */
|
||||
|
||||
/* move data from head to f */
|
||||
if((head->data+k) != f->data )
|
||||
- memcpy(f->data,(head->data+k),v);
|
||||
+ memmove(f->data,(head->data+k),v);
|
||||
f->next = f->data+v;
|
||||
}
|
||||
|
||||
--- src/lib/libast/sfio/sfsetbuf.c
|
||||
+++ src/lib/libast/sfio/sfsetbuf.c 2013-10-18 12:02:37.534736056 +0000
|
||||
@@ -254,6 +254,15 @@ size_t size; /* buffer size, -1 for defa
|
||||
#endif
|
||||
}
|
||||
|
||||
+ /* set page size, this is also the desired default buffer size */
|
||||
+ if(_Sfpage <= 0)
|
||||
+ {
|
||||
+#if _lib_getpagesize
|
||||
+ if((_Sfpage = (size_t)getpagesize()) <= 0)
|
||||
+#endif
|
||||
+ _Sfpage = SF_PAGE;
|
||||
+ }
|
||||
+
|
||||
#if SFSETLINEMODE
|
||||
if(init)
|
||||
f->flags |= sfsetlinemode();
|
||||
@@ -308,15 +317,6 @@ size_t size; /* buffer size, -1 for defa
|
||||
(void)_sfpopen(f,-1,-1,1);
|
||||
}
|
||||
}
|
||||
-
|
||||
- /* set page size, this is also the desired default buffer size */
|
||||
- if(_Sfpage <= 0)
|
||||
- {
|
||||
-#if _lib_getpagesize
|
||||
- if((_Sfpage = (size_t)getpagesize()) <= 0)
|
||||
-#endif
|
||||
- _Sfpage = SF_PAGE;
|
||||
- }
|
||||
}
|
||||
|
||||
#ifdef MAP_TYPE
|
||||
--- src/lib/libast/string/stropt.c
|
||||
+++ src/lib/libast/string/stropt.c 2013-01-03 17:20:37.000000000 +0100
|
||||
@@ -90,7 +90,7 @@ stropt(const char* as, const void* tab,
|
||||
{
|
||||
for (p = (char**)tab; t = *p; p = (char**)((char*)p + siz))
|
||||
{
|
||||
- for (v = s; *t && *t++ == *v; v++);
|
||||
+ for (v = s; *t && *t == *v; t++, v++);
|
||||
if (!*t || isspace(*v) || *v == ',' || *v == '=')
|
||||
break;
|
||||
if (*v == ':' && *(v + 1) == '=')
|
||||
--- src/lib/libast/vmalloc/vmopen.c
|
||||
+++ src/lib/libast/vmalloc/vmopen.c 2013-10-18 13:54:50.918235639 +0000
|
||||
@@ -68,19 +68,22 @@ int mode; /* type of region */
|
||||
Block_t *bp, *np;
|
||||
Seg_t *seg;
|
||||
Vmuchar_t *addr;
|
||||
- int rv;
|
||||
+ int rv, mt;
|
||||
|
||||
if(!meth || !disc || !disc->memoryf )
|
||||
return NIL(Vmalloc_t*);
|
||||
|
||||
GETPAGESIZE(_Vmpagesize);
|
||||
|
||||
+ mode = (mode&VM_FLAGS) | meth->meth; /* start with user-settable flags */
|
||||
+
|
||||
vmp = &vmproto; /* avoid memory allocation here! */
|
||||
memset(vmp, 0, sizeof(Vmalloc_t));
|
||||
memcpy(&vmp->meth, meth, sizeof(Vmethod_t));
|
||||
+ mt = vmp->meth.meth;
|
||||
+ vmp->meth.meth = 0;
|
||||
vmp->disc = disc;
|
||||
|
||||
- mode &= VM_FLAGS; /* start with user-settable flags */
|
||||
size = 0;
|
||||
|
||||
if(disc->exceptf)
|
||||
@@ -155,6 +158,8 @@ int mode; /* type of region */
|
||||
seg->free = bp;
|
||||
else vd->wild = bp;
|
||||
|
||||
+ vmp->meth.meth = mt;
|
||||
+
|
||||
done: /* now make the region handle */
|
||||
if(vd->mode&VM_MEMORYF)
|
||||
vm = &init->vm.vm;
|
@ -1,5 +1,5 @@
|
||||
--- src/cmd/ksh93/edit/edit.c
|
||||
+++ src/cmd/ksh93/edit/edit.c 2014-02-17 15:30:42.426703357 +0000
|
||||
+++ src/cmd/ksh93/edit/edit.c 2007-12-20 17:50:28.000000000 +0000
|
||||
@@ -28,6 +28,7 @@
|
||||
*/
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
#include <errno.h>
|
||||
#include <ccode.h>
|
||||
#include "FEATURE/options"
|
||||
@@ -57,8 +58,20 @@ static char *savelex;
|
||||
@@ -57,8 +58,20 @@ static char KILL_LINE[20] = { ESC, '[',
|
||||
|
||||
|
||||
#if SHOPT_MULTIBYTE
|
||||
@ -32,7 +32,7 @@
|
||||
# define is_cntrl(c) iscntrl(c)
|
||||
# define is_print(c) isprint(c)
|
||||
--- src/cmd/ksh93/edit/emacs.c
|
||||
+++ src/cmd/ksh93/edit/emacs.c 2014-02-17 15:30:42.426703357 +0000
|
||||
+++ src/cmd/ksh93/edit/emacs.c 2007-12-20 17:50:28.000000000 +0000
|
||||
@@ -62,6 +62,7 @@ One line screen editor for any program
|
||||
*/
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
# define gencpy(a,b) ed_gencpy(a,b)
|
||||
# define genncpy(a,b,n) ed_genncpy(a,b,n)
|
||||
# define genlen(str) ed_genlen(str)
|
||||
@@ -1567,11 +1571,19 @@ static void setcursor(register Emacs_t *
|
||||
@@ -1563,11 +1567,19 @@ static void setcursor(register Emacs_t *
|
||||
#if SHOPT_MULTIBYTE
|
||||
static int print(register int c)
|
||||
{
|
||||
@ -72,7 +72,7 @@
|
||||
}
|
||||
#endif /* SHOPT_MULTIBYTE */
|
||||
--- src/cmd/ksh93/edit/vi.c
|
||||
+++ src/cmd/ksh93/edit/vi.c 2014-02-17 15:30:42.426703357 +0000
|
||||
+++ src/cmd/ksh93/edit/vi.c 2007-12-20 17:50:28.000000000 +0000
|
||||
@@ -28,6 +28,8 @@
|
||||
* cbosgd!pds
|
||||
-*/
|
||||
@ -82,7 +82,7 @@
|
||||
|
||||
#if KSHELL
|
||||
# include "defs.h"
|
||||
@@ -60,10 +62,19 @@
|
||||
@@ -65,10 +67,19 @@
|
||||
# define gencpy(a,b) ed_gencpy(a,b)
|
||||
# define genncpy(a,b,n) ed_genncpy(a,b,n)
|
||||
# define genlen(str) ed_genlen(str)
|
||||
@ -105,9 +105,123 @@
|
||||
# endif
|
||||
static int _isalph(int);
|
||||
static int _ismetach(int);
|
||||
--- src/cmd/ksh93/sh/io.c
|
||||
+++ src/cmd/ksh93/sh/io.c 2010-06-28 14:09:09.000000000 +0000
|
||||
@@ -1536,6 +1536,7 @@ static int io_heredoc(Shell_t *shp,regis
|
||||
if(traceon)
|
||||
sfprintf(sfstderr,"< %s\n",name);
|
||||
sfputr(outfile,name,'\n');
|
||||
+ off = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
--- src/cmd/ksh93/sh/macro.c
|
||||
+++ src/cmd/ksh93/sh/macro.c 2013-03-19 17:16:46.062074381 +0100
|
||||
@@ -54,6 +54,7 @@
|
||||
#if SHOPT_MULTIBYTE
|
||||
# undef isascii
|
||||
# define isacii(c) ((c)<=UCHAR_MAX)
|
||||
+# include <lc.h>
|
||||
#else
|
||||
# define mbchar(p) (*(unsigned char*)p++)
|
||||
#endif /* SHOPT_MULTIBYTE */
|
||||
@@ -2026,6 +2027,11 @@ static void comsubst(Mac_t *mp,register
|
||||
struct _mac_ savemac;
|
||||
int savtop = stktell(stkp);
|
||||
char lastc=0, *savptr = stkfreeze(stkp,0);
|
||||
+#if SHOPT_MULTIBYTE
|
||||
+ const Lc_t *lc=lcinfo(LC_CTYPE)->lc;
|
||||
+ wchar_t lastw=0;
|
||||
+#endif /* SHOPT_MULTIBYTE */
|
||||
+ ssize_t len;
|
||||
int was_history = sh_isstate(SH_HISTORY);
|
||||
int was_verbose = sh_isstate(SH_VERBOSE);
|
||||
int was_interactive = sh_isstate(SH_INTERACTIVE);
|
||||
@@ -2127,7 +2133,7 @@ static void comsubst(Mac_t *mp,register
|
||||
num = lseek(fd, (off_t)0, SEEK_CUR);
|
||||
goto out_offset;
|
||||
}
|
||||
- if(!(sp=mp->shp->sftable[fd]))
|
||||
+ if(!(sp=mp->shp->sftable[fd]) || (sffileno(sp)!=fd &&!(sfset(sp,0,0)&SF_STRING)))
|
||||
sp = sfnew(NIL(Sfio_t*),(char*)malloc(IOBSIZE+1),IOBSIZE,fd,SF_READ|SF_MALLOC);
|
||||
type = 3;
|
||||
}
|
||||
@@ -2209,17 +2215,36 @@ static void comsubst(Mac_t *mp,register
|
||||
}
|
||||
else if(lastc)
|
||||
{
|
||||
- mac_copy(mp,&lastc,1);
|
||||
+ char mb[8];
|
||||
+ mb[0] = lastc;
|
||||
+ len = 1;
|
||||
+#if SHOPT_MULTIBYTE
|
||||
+ if(lastw)
|
||||
+ len = mbconv(mb, lastw);
|
||||
+ lastw = 0;
|
||||
+#endif /* SHOPT_MULTIBYTE */
|
||||
lastc = 0;
|
||||
+ mac_copy(mp,mb,len);
|
||||
}
|
||||
newlines = nextnewlines;
|
||||
if(++c < bufsize)
|
||||
str[c] = 0;
|
||||
else
|
||||
{
|
||||
- ssize_t len = 1;
|
||||
+ len = 1;
|
||||
|
||||
/* can't write past buffer so save last character */
|
||||
+#if SHOPT_MULTIBYTE
|
||||
+ if ((lc->flags & LC_utf8)==0 && (len = mbsize(str))>1)
|
||||
+ {
|
||||
+ len = mb2wc(lastw,str,len);
|
||||
+ if (len < 0)
|
||||
+ {
|
||||
+ lastw = 0;
|
||||
+ len = 1;
|
||||
+ }
|
||||
+ }
|
||||
+#endif /* SHOPT_MULTIBYTE */
|
||||
c -= len;
|
||||
lastc = str[c];
|
||||
str[c] = 0;
|
||||
@@ -2240,8 +2265,16 @@ static void comsubst(Mac_t *mp,register
|
||||
}
|
||||
if(lastc)
|
||||
{
|
||||
- mac_copy(mp,&lastc,1);
|
||||
+ char mb[8];
|
||||
+ mb[0] = lastc;
|
||||
+ len = 1;
|
||||
+#if SHOPT_MULTIBYTE
|
||||
+ if(lastw)
|
||||
+ len = mbconv(mb, lastw);
|
||||
+ lastw = 0;
|
||||
+#endif /* SHOPT_MULTIBYTE */
|
||||
lastc = 0;
|
||||
+ mac_copy(mp,mb,len);
|
||||
}
|
||||
sfclose(sp);
|
||||
return;
|
||||
@@ -2340,13 +2373,13 @@ static void mac_copy(register Mac_t *mp,
|
||||
if(mp->pattern)
|
||||
{
|
||||
char *sp = "&|()";
|
||||
- while(c = *sp++)
|
||||
+ while((c = *sp++))
|
||||
{
|
||||
if(state[c]==0)
|
||||
state[c] = S_EPAT;
|
||||
}
|
||||
sp = "*?[{";
|
||||
- while(c = *sp++)
|
||||
+ while((c = *sp++))
|
||||
{
|
||||
if(state[c]==0)
|
||||
state[c] = S_PAT;
|
||||
--- src/cmd/ksh93/sh/string.c
|
||||
+++ src/cmd/ksh93/sh/string.c 2014-02-17 15:30:52.534784033 +0000
|
||||
@@ -36,7 +36,7 @@
|
||||
+++ src/cmd/ksh93/sh/string.c 2007-12-20 17:51:07.000000000 +0000
|
||||
@@ -37,7 +37,7 @@
|
||||
#endif
|
||||
|
||||
#if !_lib_iswprint && !defined(iswprint)
|
||||
@ -116,7 +230,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ void sh_trim(register char *sp)
|
||||
@@ -245,7 +245,7 @@ void sh_trim(register char *sp)
|
||||
if(sp)
|
||||
{
|
||||
dp = sp;
|
||||
@ -126,7 +240,7 @@
|
||||
#if SHOPT_MULTIBYTE
|
||||
int len;
|
||||
--- src/cmd/ksh93/tests/sjis.sh
|
||||
+++ src/cmd/ksh93/tests/sjis.sh 2014-02-17 15:30:52.534784033 +0000
|
||||
+++ src/cmd/ksh93/tests/sjis.sh 2011-05-20 15:11:29.000000000 +0000
|
||||
@@ -0,0 +1,77 @@
|
||||
+########################################################################
|
||||
+# #
|
||||
@ -206,7 +320,7 @@
|
||||
+fi
|
||||
+exit $err
|
||||
--- src/lib/libast/comp/setlocale.c
|
||||
+++ src/lib/libast/comp/setlocale.c 2014-02-17 15:30:52.534784033 +0000
|
||||
+++ src/lib/libast/comp/setlocale.c 2007-12-20 17:50:28.000000000 +0000
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "lclib.h"
|
||||
@ -215,20 +329,29 @@
|
||||
#include <ast_wchar.h>
|
||||
#include <ctype.h>
|
||||
#include <mc.h>
|
||||
--- src/lib/libast/comp/wc.c
|
||||
+++ src/lib/libast/comp/wc.c 2007-12-20 17:50:28.000000000 +0000
|
||||
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <ast.h>
|
||||
+#include <ast_wchar.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#define STUB 1
|
||||
--- src/lib/libast/features/wchar
|
||||
+++ src/lib/libast/features/wchar 2014-02-17 15:39:52.471093724 +0000
|
||||
@@ -8,8 +8,9 @@ cat{
|
||||
+++ src/lib/libast/features/wchar 2007-12-20 17:50:28.000000000 +0000
|
||||
@@ -8,7 +8,8 @@ cat{
|
||||
#define _AST_WCHAR_H 1
|
||||
}end
|
||||
|
||||
-lib mbstowcs,wctomb,wcscmp,wcscoll,wcslen,wcstombs,wcsxfrm,wcwidth stdlib.h stdio.h wchar.h
|
||||
+lib mbstowcs,wctomb,wcscmp,wcscoll,wcslen,wcstombs,wcsxfrm,wcscpy,wcwidth stdlib.h stdio.h wchar.h
|
||||
lib mbrlen,mbrtowc,mbsrtowcs,wcrtomb,wcsrtombs stdlib.h stdio.h wchar.h
|
||||
-lib mbstowcs,wctomb,wcrtomb,wcslen,wcstombs,wcwidth stdlib.h stdio.h wchar.h
|
||||
+lib mbstowcs,wctomb,wcrtomb,wcslen,wcstombs,wcscpy,wcwidth stdlib.h stdio.h wchar.h wctype.h
|
||||
+lib iswprint,iswalpha,iswalnum,iswdigit,iswcntrl stdlib.h stdio.h ctype.h wctype.h
|
||||
lib towlower,towupper stdlib.h stdio.h wchar.h
|
||||
typ mbstate_t stdlib.h stdio.h wchar.h
|
||||
nxt wchar
|
||||
@@ -69,6 +70,12 @@ cat <<!
|
||||
@@ -68,6 +69,12 @@ cat <<!
|
||||
#undef putwc
|
||||
#undef putwchar
|
||||
#undef ungetwc
|
||||
@ -241,7 +364,7 @@
|
||||
|
||||
#define fgetwc _ast_fgetwc
|
||||
#define fgetws _ast_fgetws
|
||||
@@ -138,6 +145,12 @@ cat <<!
|
||||
@@ -118,6 +125,12 @@ cat <<!
|
||||
#if !_lib_wcstombs
|
||||
extern size_t wcstombs(char*, const wchar_t*, size_t);
|
||||
#endif
|
||||
@ -255,33 +378,36 @@
|
||||
extern int fwprintf(FILE*, const wchar_t*, ...);
|
||||
extern int fwscanf(FILE*, const wchar_t*, ...);
|
||||
--- src/lib/libast/include/ast.h
|
||||
+++ src/lib/libast/include/ast.h 2014-02-17 15:49:44.951821429 +0000
|
||||
@@ -444,13 +444,21 @@ extern char** environ;
|
||||
#else
|
||||
+++ src/lib/libast/include/ast.h 2010-08-17 15:09:21.000000000 +0000
|
||||
@@ -185,8 +185,6 @@ typedef struct
|
||||
#define mbwide() (mbmax()>1)
|
||||
|
||||
#define mb2wc(w,p,n) (*ast.mb_towc)(&(w),(char*)(p),(n))
|
||||
-#define mbchar(p) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),mbmax()))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p+=ast.mb_sync+1,ast.tmp_int)):(*(unsigned char*)(p++)))
|
||||
-#define mbnchar(p,n) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),n))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p+=ast.mb_sync+1,ast.tmp_int)):(*(unsigned char*)(p++)))
|
||||
#define mbinit() (mbwide()?(*ast.mb_towc)((wchar_t*)0,(char*)0,mbmax()):0)
|
||||
#define mbsize(p) (mbwide()?(*ast.mb_len)((char*)(p),mbmax()):((p),1))
|
||||
#define mbnsize(p,n) (mbwide()?(*ast.mb_len)((char*)(p),n):((p),1))
|
||||
#define mbconv(s,w) (ast.mb_conv?(*ast.mb_conv)(s,w):((*(s)=(w)),1))
|
||||
#define mb2wc(w,p,n) (*ast.mb_towc)(&w,(char*)p,n)
|
||||
-#define mbchar(p) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),mbmax()))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p+=ast.mb_sync+1,ast.tmp_int)):(*(unsigned char*)(p++)))
|
||||
-#define mbnchar(p,n) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),n))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p+=ast.mb_sync+1,ast.tmp_int)):(*(unsigned char*)(p++)))
|
||||
#define mbinit() (mbwide()?(*ast.mb_towc)((wchar_t*)0,(char*)0,mbmax()):0)
|
||||
#define mbsize(p) (mbwide()?(*ast.mb_len)((char*)(p),mbmax()):((p),1))
|
||||
#define mbnsize(p,n) (mbwide()?(*ast.mb_len)((char*)(p),n):((p),1))
|
||||
@@ -195,6 +193,17 @@ typedef struct
|
||||
#define mbxfrm(t,f,n) (mbcoll()?(*ast.mb_xfrm)((char*)(t),(char*)(f),n):0)
|
||||
#define mbalpha(w) (ast.mb_alpha?(*ast.mb_alpha)(w):isalpha((w)&0xff))
|
||||
|
||||
+#define mbchar(p) (mbwide() ? \
|
||||
+ (((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),mbmax()))>0) ? \
|
||||
+ ({p+=ast.tmp_int;ast.tmp_wchar;}) : \
|
||||
+ ({ast.tmp_int=*(unsigned char*)p;p+=ast.mb_sync+1;ast.tmp_int;})) : \
|
||||
+ (*(unsigned char*)(p++)))
|
||||
+#define mbnchar(p,n) (mbwide() ? \
|
||||
+ (((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),n))>0) ? \
|
||||
+ ({p+=ast.tmp_int;ast.tmp_wchar;}) : \
|
||||
+ ({ast.tmp_int=*(unsigned char*)p;p+=ast.mb_sync+1;ast.tmp_int;})): \
|
||||
+ (*(unsigned char*)(p++)))
|
||||
#endif
|
||||
|
||||
/* generic plugin version support */
|
||||
+#define mbchar(p) (mbwide() ? \
|
||||
+ (((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),mbmax()))>0) ? \
|
||||
+ ({p+=ast.tmp_int;ast.tmp_wchar;}) : \
|
||||
+ ({ast.tmp_int=*(unsigned char*)p;p+=ast.mb_sync+1;ast.tmp_int;})) : \
|
||||
+ (*(unsigned char*)(p++)))
|
||||
+#define mbnchar(p,n) (mbwide() ? \
|
||||
+ (((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),n))>0) ? \
|
||||
+ ({p+=ast.tmp_int;ast.tmp_wchar;}) : \
|
||||
+ ({ast.tmp_int=*(unsigned char*)p;p+=ast.mb_sync+1;ast.tmp_int;})) : \
|
||||
+ (*(unsigned char*)(p++)))
|
||||
+
|
||||
/*
|
||||
* common macros
|
||||
*/
|
||||
--- src/lib/libast/regex/reglib.h
|
||||
+++ src/lib/libast/regex/reglib.h 2014-02-17 15:30:52.538784065 +0000
|
||||
+++ src/lib/libast/regex/reglib.h 2007-12-20 17:50:28.000000000 +0000
|
||||
@@ -57,6 +57,7 @@ typedef struct regsubop_s
|
||||
char re_rhs[1]; /* substitution rhs */
|
||||
|
||||
@ -291,13 +417,13 @@
|
||||
#include <stk.h>
|
||||
|
||||
--- src/lib/libcmd/Mamfile
|
||||
+++ src/lib/libcmd/Mamfile 2014-02-17 15:42:56.236560387 +0000
|
||||
@@ -592,7 +592,7 @@ make cat.o
|
||||
+++ src/lib/libcmd/Mamfile 2013-02-05 15:11:03.153953100 +0000
|
||||
@@ -509,7 +509,7 @@ make cat.o
|
||||
prev cat.c
|
||||
meta cat.o %.c>%.o cat.c cat
|
||||
prev cat.c
|
||||
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DERROR_CATALOG=\""libcmd"\" -DUSAGE_LICENSE=\""[-author?Glenn Fowler <glenn.s.fowler@gmail.com>][-author?David Korn <dgkorn@gmail.com>][-copyright?Copyright (c) 1992-2014 AT&T Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?libcmd]"\" -D_BLD_cmd -D_PACKAGE_ast -c cat.c
|
||||
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DERROR_CATALOG=\""libcmd"\" -DUSAGE_LICENSE=\""[-author?Glenn Fowler <glenn.s.fowler@gmail.com>][-author?David Korn <dgkorn@gmail.com>][-copyright?Copyright (c) 1992-2014 AT&T Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?libcmd]"\" -D_BLD_cmd -D_PACKAGE_ast -DSHOPT_MULTIBYTE -c cat.c
|
||||
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DERROR_CATALOG=\""libcmd"\" -DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf@research.att.com>][-author?David Korn <dgk@research.att.com>][-copyright?Copyright (c) 1992-2012 AT&T Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?libcmd]"\" -D_BLD_cmd -D_PACKAGE_ast -c cat.c
|
||||
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DERROR_CATALOG=\""libcmd"\" -DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf@research.att.com>][-author?David Korn <dgk@research.att.com>][-copyright?Copyright (c) 1992-2012 AT&T Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?libcmd]"\" -D_BLD_cmd -D_PACKAGE_ast -DSHOPT_MULTIBYTE -c cat.c
|
||||
done cat.o generated
|
||||
make chgrp.o
|
||||
prev chgrp.c
|
||||
|
@ -10,3 +10,41 @@
|
||||
|
||||
#if defined(SIGCLD) && !defined(SIGCHLD)
|
||||
# define SIGCHLD SIGCLD
|
||||
--- src/cmd/ksh93/sh/xec.c
|
||||
+++ src/cmd/ksh93/sh/xec.c 2007-12-21 12:28:04.000000000 +0000
|
||||
@@ -3834,6 +3834,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
|
||||
{
|
||||
signal(SIGTTIN,SIG_DFL);
|
||||
signal(SIGTTOU,SIG_DFL);
|
||||
+ signal(SIGTSTP,SIG_DFL);
|
||||
}
|
||||
#endif /* SIGTSTP */
|
||||
#ifdef JOBS
|
||||
@@ -3871,6 +3872,9 @@ static pid_t sh_ntfork(Shell_t *shp,cons
|
||||
{
|
||||
signal(SIGTTIN,SIG_IGN);
|
||||
signal(SIGTTOU,SIG_IGN);
|
||||
+ if(sh_isstate(SH_INTERACTIVE))
|
||||
+ signal(SIGTSTP,SIG_IGN);
|
||||
+ else signal(SIGTSTP,SIG_DFL);
|
||||
}
|
||||
#endif /* SIGTSTP */
|
||||
if(spawnpid>0)
|
||||
@@ -3951,6 +3955,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
|
||||
{
|
||||
signal(SIGTTIN,SIG_DFL);
|
||||
signal(SIGTTOU,SIG_DFL);
|
||||
+ signal(SIGTSTP,SIG_DFL);
|
||||
jobwasset++;
|
||||
}
|
||||
#endif /* SIGTSTP */
|
||||
@@ -4013,6 +4018,9 @@ static pid_t sh_ntfork(Shell_t *shp,cons
|
||||
{
|
||||
signal(SIGTTIN,SIG_IGN);
|
||||
signal(SIGTTOU,SIG_IGN);
|
||||
+ if(sh_isstate(SH_INTERACTIVE))
|
||||
+ signal(SIGTSTP,SIG_IGN);
|
||||
+ else signal(SIGTSTP,SIG_DFL);
|
||||
}
|
||||
#endif /* SIGTSTP */
|
||||
if(sigwasset)
|
||||
|
40
ksh93-spawnlock.dif
Normal file
40
ksh93-spawnlock.dif
Normal file
@ -0,0 +1,40 @@
|
||||
--- ./src/cmd/ksh93/sh/jobs.c.orig 2016-07-26 12:52:44.178281624 +0000
|
||||
+++ ./src/cmd/ksh93/sh/jobs.c 2016-07-26 12:52:59.563281597 +0000
|
||||
@@ -2071,6 +2071,10 @@ void job_fork(pid_t parent)
|
||||
job_lock();
|
||||
jobfork++;
|
||||
break;
|
||||
+ case -2:
|
||||
+ jobfork--;
|
||||
+ job_unlock();
|
||||
+ break;
|
||||
case 0:
|
||||
jobfork=0;
|
||||
job_unlock();
|
||||
--- ./src/cmd/ksh93/sh/xec.c.orig 2016-07-26 12:52:37.322281636 +0000
|
||||
+++ ./src/cmd/ksh93/sh/xec.c 2016-07-26 12:55:37.097281318 +0000
|
||||
@@ -3952,6 +3952,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
|
||||
# endif /* !_lib_fork */
|
||||
sh_pushcontext(shp,buffp,SH_JMPCMD);
|
||||
errorpush(&buffp->err,ERROR_SILENT);
|
||||
+ job_lock(); /* errormsg will unlock */
|
||||
jmpval = sigsetjmp(buffp->buff,0);
|
||||
if(jmpval == 0)
|
||||
{
|
||||
@@ -4050,7 +4051,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
|
||||
}
|
||||
fail:
|
||||
if(jobfork && spawnpid<0)
|
||||
- job_fork(0);
|
||||
+ job_fork(-2);
|
||||
if(spawnpid < 0) switch(errno=shp->path_err)
|
||||
{
|
||||
case ENOENT:
|
||||
@@ -4058,6 +4059,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
|
||||
default:
|
||||
errormsg(SH_DICT,ERROR_system(ERROR_NOEXEC),e_exec+4);
|
||||
}
|
||||
+ job_unlock();
|
||||
}
|
||||
else
|
||||
exitset();
|
33
ksh93-stkalias.dif
Normal file
33
ksh93-stkalias.dif
Normal file
@ -0,0 +1,33 @@
|
||||
--- ./src/lib/libast/misc/stk.c.orig 2014-11-26 16:01:29.606716557 +0000
|
||||
+++ ./src/lib/libast/misc/stk.c 2014-11-26 16:03:06.031328609 +0000
|
||||
@@ -505,7 +505,7 @@ static char *stkgrow(register Sfio_t *st
|
||||
register char *cp, *dp=0;
|
||||
register size_t m = stktell(stream);
|
||||
size_t endoff;
|
||||
- char *end=0;
|
||||
+ char *end=0, *oldbase=0;
|
||||
int nn=0,add=1;
|
||||
n += (m + sizeof(struct frame)+1);
|
||||
if(sp->stkflags&STK_SMALL)
|
||||
@@ -521,6 +521,7 @@ static char *stkgrow(register Sfio_t *st
|
||||
dp=sp->stkbase;
|
||||
sp->stkbase = ((struct frame*)dp)->prev;
|
||||
end = fp->end;
|
||||
+ oldbase = dp;
|
||||
}
|
||||
endoff = end - dp;
|
||||
cp = newof(dp, char, n, nn*sizeof(char*));
|
||||
@@ -547,10 +548,10 @@ static char *stkgrow(register Sfio_t *st
|
||||
if(fp->nalias=nn)
|
||||
{
|
||||
fp->aliases = (char**)fp->end;
|
||||
- if(end && nn>1)
|
||||
- memmove(fp->aliases,end,(nn-1)*sizeof(char*));
|
||||
+ if(end && nn>add)
|
||||
+ memmove(fp->aliases,end,(nn-add)*sizeof(char*));
|
||||
if(add)
|
||||
- fp->aliases[nn-1] = dp + roundof(sizeof(struct frame),STK_ALIGN);
|
||||
+ fp->aliases[nn-1] = oldbase + roundof(sizeof(struct frame),STK_ALIGN);
|
||||
}
|
||||
if(m && !dp)
|
||||
{
|
30
ksh93-stkfreeze.dif
Normal file
30
ksh93-stkfreeze.dif
Normal file
@ -0,0 +1,30 @@
|
||||
--- ./src/cmd/ksh93/sh/xec.c.orig 2014-11-21 14:11:39.619645318 +0000
|
||||
+++ ./src/cmd/ksh93/sh/xec.c 2014-11-21 14:13:55.409987787 +0000
|
||||
@@ -514,8 +514,8 @@ int sh_debug(Shell_t *shp, const char *t
|
||||
Stk_t *stkp=shp->stk;
|
||||
struct sh_scoped savst;
|
||||
Namval_t *np = SH_COMMANDNOD;
|
||||
- char *sav = stkptr(stkp,0);
|
||||
int n=4, offset=stktell(stkp);
|
||||
+ char *sav = stkfreeze(stkp,0);
|
||||
const char *cp = "+=( ";
|
||||
Sfio_t *iop = stkstd;
|
||||
short level;
|
||||
@@ -570,7 +570,7 @@ int sh_debug(Shell_t *shp, const char *t
|
||||
nv_putval(SH_FUNNAMENOD,shp->st.funname,NV_NOFREE);
|
||||
shp->st = savst;
|
||||
if(sav != stkptr(stkp,0))
|
||||
- stkset(stkp,sav,0);
|
||||
+ stkset(stkp,sav,offset);
|
||||
else
|
||||
stkseek(stkp,offset);
|
||||
return(n);
|
||||
@@ -998,7 +998,7 @@ int sh_exec(register const Shnode_t *t,
|
||||
int ntflag = 0;
|
||||
#endif
|
||||
int topfd = shp->topfd;
|
||||
- char *sav=stkptr(stkp,0);
|
||||
+ char *sav=stkfreeze(stkp,0);
|
||||
char *cp=0, **com=0, *comn;
|
||||
int argn;
|
||||
int skipexitset = 0;
|
11
ksh93-stkset-abort.dif
Normal file
11
ksh93-stkset-abort.dif
Normal file
@ -0,0 +1,11 @@
|
||||
--- ./src/lib/libast/misc/stk.c.orig 2014-11-22 10:46:29.708285640 +0000
|
||||
+++ ./src/lib/libast/misc/stk.c 2014-11-22 10:48:32.533777385 +0000
|
||||
@@ -378,6 +378,8 @@ char *stkset(register Sfio_t * stream, r
|
||||
frames++;
|
||||
}
|
||||
/* set stack back to the beginning */
|
||||
+ if (loc)
|
||||
+ abort();
|
||||
cp = (char*)(fp+1);
|
||||
if(frames)
|
||||
sfsetbuf(stream,cp,sp->stkend-cp);
|
11
ksh93-subshellpwd.dif
Normal file
11
ksh93-subshellpwd.dif
Normal file
@ -0,0 +1,11 @@
|
||||
--- ./src/cmd/ksh93/sh/subshell.c.orig 2014-11-13 15:56:44.331110277 +0000
|
||||
+++ ./src/cmd/ksh93/sh/subshell.c 2014-11-13 15:58:05.104764274 +0000
|
||||
@@ -547,7 +547,7 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_
|
||||
struct subshell *xp;
|
||||
sp->shpwd = shp->pwd;
|
||||
#ifdef _lib_fchdir
|
||||
- for(xp=sp->prev; xp; xp=xp->prev)
|
||||
+ for(xp=sp->prev; shp->pwd && xp; xp=xp->prev)
|
||||
{
|
||||
if(xp->pwdfd>0 && strcmp(xp->pwd,shp->pwd)==0)
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
--- src/cmd/ksh93/data/msg.c
|
||||
+++ src/cmd/ksh93/data/msg.c 2014-02-18 16:08:16.662492587 +0000
|
||||
@@ -208,7 +208,11 @@ const char e_bash_profile[] = "$HOME/.ba
|
||||
+++ src/cmd/ksh93/data/msg.c 2007-04-02 14:59:19.000000000 +0000
|
||||
@@ -205,7 +205,11 @@ const char e_bash_profile[] = "$HOME/.ba
|
||||
const char e_crondir[] = "/var/spool/cron";
|
||||
const char e_prohibited[] = "login setuid/setgid shells prohibited";
|
||||
#if SHOPT_SUID_EXEC
|
||||
@ -13,7 +13,7 @@
|
||||
const char hist_fname[] = "/.sh_history";
|
||||
const char e_dot[] = ".";
|
||||
--- src/cmd/ksh93/sh/suid_exec.c
|
||||
+++ src/cmd/ksh93/sh/suid_exec.c 2014-02-18 16:10:34.891601497 +0000
|
||||
+++ src/cmd/ksh93/sh/suid_exec.c 2012-02-03 08:36:40.000000000 +0000
|
||||
@@ -62,10 +62,24 @@
|
||||
#define FDVERIFY 12 /* used to validate /tmp process */
|
||||
#undef BLKSIZE
|
||||
@ -110,8 +110,8 @@
|
||||
|
||||
/*
|
||||
* return true of shell is in <dir> directory
|
||||
@@ -345,16 +377,31 @@ int eaccess(register const char *name, r
|
||||
#endif
|
||||
@@ -341,16 +373,30 @@ int eaccess(register const char *name, r
|
||||
}
|
||||
|
||||
#ifdef _lib_setreuid
|
||||
-static void setids(int mode,int owner,int group)
|
||||
@ -120,12 +120,12 @@
|
||||
+#include <grp.h>
|
||||
+static void setids(int mode,uid_t owner,gid_t group)
|
||||
{
|
||||
if(mode & S_ISGID)
|
||||
- if(mode & S_ISGID)
|
||||
- setregid(rgroupid,group);
|
||||
+ {
|
||||
+ if(mode & S_ISGID) {
|
||||
+ struct passwd *pwd;
|
||||
+
|
||||
+ if (setregid(rgroupid,group) < 0)
|
||||
+ if (setregid(rgroupid,group))
|
||||
+ error_exit(badexec);
|
||||
+
|
||||
+ if (((pwd = getpwuid(owner)) == (struct passwd*)0) || !(pwd->pw_name))
|
||||
@ -140,7 +140,7 @@
|
||||
* is not set, the value for owner that is passsed should be correct.
|
||||
*/
|
||||
- setreuid(ruserid,owner);
|
||||
+ if (setreuid(ruserid,owner) < 0)
|
||||
+ if (setreuid(ruserid,owner))
|
||||
+ error_exit(badexec);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- src/cmd/ksh93/bltins/test.c
|
||||
+++ src/cmd/ksh93/bltins/test.c 2014-02-17 16:21:04.138828304 +0000
|
||||
@@ -48,12 +48,12 @@
|
||||
+++ src/cmd/ksh93/bltins/test.c 2011-05-20 13:45:25.000000000 +0000
|
||||
@@ -47,12 +47,12 @@
|
||||
#ifdef S_ISSOCK
|
||||
# if _pipe_socketpair
|
||||
# if _socketpair_shutdown_mode
|
||||
@ -16,8 +16,8 @@
|
||||
# endif
|
||||
# define isasock(f,p) (test_stat(f,p)>=0&&S_ISSOCK((p)->st_mode))
|
||||
#else
|
||||
@@ -88,7 +88,7 @@ static int test_strmatch(Shell_t *shp,co
|
||||
int match[2*(MATCH_MAX+1)],n;
|
||||
@@ -87,7 +87,7 @@ static int test_strmatch(Shell_t *shp,co
|
||||
regoff_t match[2*(MATCH_MAX+1)],n;
|
||||
register int c, m=0;
|
||||
register const char *cp=pat;
|
||||
- while(c = *cp++)
|
||||
@ -25,7 +25,7 @@
|
||||
{
|
||||
if(c=='(')
|
||||
m++;
|
||||
@@ -470,7 +470,7 @@ int test_unop(Shell_t *shp,register int
|
||||
@@ -463,7 +463,7 @@ int test_unop(Shell_t *shp,register int
|
||||
|
||||
int test_binop(Shell_t *shp,register int op,const char *left,const char *right)
|
||||
{
|
||||
|
@ -1,11 +1,37 @@
|
||||
--- src/cmd/ksh93/bltins/typeset.c
|
||||
+++ src/cmd/ksh93/bltins/typeset.c 2014-02-18 15:57:51.077469326 +0000
|
||||
@@ -549,7 +549,7 @@ static int setall(char **argv,regist
|
||||
+++ src/cmd/ksh93/bltins/typeset.c 2013-03-19 17:21:08.667413362 +0100
|
||||
@@ -461,6 +461,7 @@ static void print_value(Sfio_t *iop, Nam
|
||||
{
|
||||
char *name;
|
||||
int aflag=tp->aflag;
|
||||
+ Namval_t *table;
|
||||
if(nv_isnull(np))
|
||||
{
|
||||
if(!np->nvflag)
|
||||
@@ -504,7 +505,9 @@ static void print_value(Sfio_t *iop, Nam
|
||||
sfwrite(iop,"}\n",2);
|
||||
return;
|
||||
}
|
||||
else if(*shp->prefix==0)
|
||||
shp->prefix = 0;
|
||||
- if(*argv[0]=='+')
|
||||
+ if(*argv && *argv[0]=='+')
|
||||
nvflags |= NV_NOADD;
|
||||
flag &= ~(NV_NOARRAY|NV_NOSCOPE|NV_VARNAME|NV_IDENT|NV_STATIC|NV_COMVAR|NV_IARRAY);
|
||||
if(argv[1])
|
||||
+ table = tp->sh->last_table;
|
||||
sfputr(iop,nv_name(np),aflag=='+'?'\n':'=');
|
||||
+ tp->sh->last_table = table;
|
||||
if(aflag=='+')
|
||||
return;
|
||||
if(nv_isarray(np) && nv_arrayptr(np))
|
||||
@@ -675,6 +678,7 @@ static int setall(char **argv,regist
|
||||
{
|
||||
if(comvar || (shp->last_root==shp->var_tree && (tp->tp || (!shp->st.real_fun && (nvflags&NV_STATIC)) || (!(flag&(NV_EXPORT|NV_RDONLY)) && nv_isattr(np,(NV_EXPORT|NV_IMPORT))==(NV_EXPORT|NV_IMPORT)))))
|
||||
{
|
||||
+ if((flag&(NV_HOST|NV_INTEGER))!=NV_HOST)
|
||||
_nv_unset(np,0);
|
||||
}
|
||||
}
|
||||
@@ -790,7 +794,7 @@ static int setall(char **argv,regist
|
||||
else
|
||||
{
|
||||
char *oldname=0;
|
||||
- int len=strlen(name);
|
||||
+ size_t len=strlen(name);
|
||||
if(tp->argnum==1 && newflag==NV_INTEGER && nv_isattr(np,NV_INTEGER))
|
||||
tp->argnum = 10;
|
||||
if(np->nvfun && !nv_isarray(np) && name[len-1]=='.')
|
||||
|
361
ksh93-uninitialized.dif
Normal file
361
ksh93-uninitialized.dif
Normal file
@ -0,0 +1,361 @@
|
||||
--- src/cmd/builtin/pty.c
|
||||
+++ src/cmd/builtin/pty.c 2013-10-25 13:30:22.019295258 +0000
|
||||
@@ -503,7 +503,7 @@ masterline(Sfio_t* mp, Sfio_t* lp, char*
|
||||
char* t;
|
||||
ssize_t n;
|
||||
ssize_t a;
|
||||
- size_t promptlen;
|
||||
+ size_t promptlen = 0;
|
||||
ptrdiff_t d;
|
||||
char promptbuf[64];
|
||||
|
||||
@@ -773,6 +773,8 @@ dialogue(Sfio_t* mp, Sfio_t* lp, int del
|
||||
!(master->buf = vmnewof(vm, 0, char, 2 * SF_BUFSIZE, 0)))
|
||||
{
|
||||
error(ERROR_SYSTEM|2, "out of space");
|
||||
+ id = 0;
|
||||
+ line = 0;
|
||||
goto done;
|
||||
}
|
||||
master->vm = vm;
|
||||
--- src/cmd/ksh93/edit/edit.c
|
||||
+++ src/cmd/ksh93/edit/edit.c 2013-10-25 13:30:22.020295166 +0000
|
||||
@@ -1414,12 +1414,12 @@ int ed_internal(const char *src, genchar
|
||||
int ed_external(const genchar *src, char *dest)
|
||||
{
|
||||
register genchar wc;
|
||||
- register int c,size;
|
||||
register char *dp = dest;
|
||||
char *dpmax = dp+sizeof(genchar)*MAXLINE-2;
|
||||
if((char*)src == dp)
|
||||
{
|
||||
- char buffer[MAXLINE*sizeof(genchar)];
|
||||
+ int c;
|
||||
+ char buffer[MAXLINE*sizeof(genchar)] = "";
|
||||
c = ed_external(src,buffer);
|
||||
|
||||
#ifdef _lib_wcscpy
|
||||
@@ -1431,6 +1431,7 @@ int ed_external(const genchar *src, char
|
||||
}
|
||||
while((wc = *src++) && dp<dpmax)
|
||||
{
|
||||
+ ssize_t size;
|
||||
if((size = mbconv(dp, wc)) < 0)
|
||||
{
|
||||
/* copy the character as is */
|
||||
--- src/cmd/ksh93/sh/init.c
|
||||
+++ src/cmd/ksh93/sh/init.c 2013-10-25 13:30:22.020295166 +0000
|
||||
@@ -1264,7 +1264,7 @@ Shell_t *sh_init(register int argc,regis
|
||||
static int beenhere;
|
||||
Shell_t *shp;
|
||||
register int n;
|
||||
- int type;
|
||||
+ int type = 0;
|
||||
static char *login_files[3];
|
||||
memfatal();
|
||||
n = strlen(e_version);
|
||||
@@ -1943,7 +1943,7 @@ static Dt_t *inittree(Shell_t *shp,const
|
||||
register const struct shtable2 *tp;
|
||||
register unsigned n = 0;
|
||||
register Dt_t *treep;
|
||||
- Dt_t *base_treep, *dict;
|
||||
+ Dt_t *base_treep, *dict = 0;
|
||||
for(tp=name_vals;*tp->sh_name;tp++)
|
||||
n++;
|
||||
np = (Namval_t*)calloc(n,sizeof(Namval_t));
|
||||
--- src/cmd/ksh93/sh/macro.c
|
||||
+++ src/cmd/ksh93/sh/macro.c 2013-10-25 13:30:22.021295073 +0000
|
||||
@@ -1794,7 +1794,7 @@ retry2:
|
||||
register int d = (mode=='@'?' ':mp->ifs);
|
||||
regoff_t match[2*(MATCH_MAX+1)];
|
||||
int nmatch, nmatch_prev, vsize_last;
|
||||
- char *vlast;
|
||||
+ char *vlast=NULL;
|
||||
while(1)
|
||||
{
|
||||
if(!v)
|
||||
--- src/cmd/ksh93/sh/name.c
|
||||
+++ src/cmd/ksh93/sh/name.c 2013-10-25 13:30:22.022294981 +0000
|
||||
@@ -1344,7 +1344,7 @@ Namval_t *nv_open(const char *name, Dt_t
|
||||
const char *msg = e_varname;
|
||||
char *fname = 0;
|
||||
int offset = staktell();
|
||||
- Dt_t *funroot;
|
||||
+ Dt_t *funroot = NIL(Dt_t*);
|
||||
#if NVCACHE
|
||||
struct Cache_entry *xp;
|
||||
#endif
|
||||
@@ -1820,7 +1820,7 @@ void nv_putval(register Namval_t *np, co
|
||||
else
|
||||
{
|
||||
const char *tofree=0;
|
||||
- int offset,append;
|
||||
+ int offset=0,append;
|
||||
#if _lib_pathnative
|
||||
char buff[PATH_MAX];
|
||||
#endif /* _lib_pathnative */
|
||||
--- src/cmd/ksh93/sh/nvdisc.c
|
||||
+++ src/cmd/ksh93/sh/nvdisc.c 2013-10-25 13:30:22.022294981 +0000
|
||||
@@ -449,7 +449,7 @@ static Sfdouble_t lookupn(Namval_t *np,
|
||||
char *nv_setdisc(register Namval_t* np,register const char *event,Namval_t *action,register Namfun_t *fp)
|
||||
{
|
||||
register struct vardisc *vp = (struct vardisc*)np->nvfun;
|
||||
- register int type;
|
||||
+ register int type = -1;
|
||||
char *empty = "";
|
||||
while(vp)
|
||||
{
|
||||
@@ -505,6 +505,8 @@ char *nv_setdisc(register Namval_t* np,r
|
||||
}
|
||||
return(NIL(char*));
|
||||
}
|
||||
+ if (type < 0)
|
||||
+ return(NIL(char*));
|
||||
/* Handle GET/SET/APPEND/UNSET disc */
|
||||
if(vp && vp->fun.disc->putval!=assign)
|
||||
vp = 0;
|
||||
--- src/cmd/ksh93/sh/nvtree.c
|
||||
+++ src/cmd/ksh93/sh/nvtree.c 2013-10-25 13:30:22.023294889 +0000
|
||||
@@ -583,7 +583,7 @@ void nv_outnode(Namval_t *np, Sfio_t* ou
|
||||
char *fmtq,*ep,*xp;
|
||||
Namval_t *mp;
|
||||
Namarr_t *ap = nv_arrayptr(np);
|
||||
- int scan,tabs=0,c,more,associative = 0;
|
||||
+ int scan=0,tabs=0,c,more,associative = 0;
|
||||
int saveI = Indent;
|
||||
Indent = indent;
|
||||
if(ap)
|
||||
@@ -696,7 +696,7 @@ void nv_outnode(Namval_t *np, Sfio_t* ou
|
||||
|
||||
static void outval(char *name, const char *vname, struct Walk *wp)
|
||||
{
|
||||
- register Namval_t *np, *nq, *last_table=wp->shp->last_table;
|
||||
+ register Namval_t *np, *nq=0, *last_table=wp->shp->last_table;
|
||||
register Namfun_t *fp;
|
||||
int isarray=0, special=0,mode=0;
|
||||
if(*name!='.' || vname[strlen(vname)-1]==']')
|
||||
--- src/cmd/ksh93/sh/nvtype.c
|
||||
+++ src/cmd/ksh93/sh/nvtype.c 2013-10-25 13:30:22.023294889 +0000
|
||||
@@ -854,9 +854,10 @@ void nv_newtype(Namval_t *mp)
|
||||
Namval_t *nv_mktype(Namval_t **nodes, int numnodes)
|
||||
{
|
||||
Namval_t *mp=nodes[0], *bp=0, *np, *nq, **mnodes=nodes;
|
||||
- int i,j,k,m,n,nd=0,nref=0,iref=0,inherit=0;
|
||||
+ int i,j,k,nd=0,nref=0,iref=0,inherit=0;
|
||||
int size=sizeof(NV_DATA), dsize=0, nnodes;
|
||||
- size_t offset=0;
|
||||
+ size_t offset=0,m;
|
||||
+ ssize_t n;
|
||||
char *name=0, *cp, *sp, **help;
|
||||
Namtype_t *pp,*qp=0,*dp,*tp;
|
||||
Dt_t *root = nv_dict(mp);
|
||||
@@ -869,6 +870,7 @@ Namval_t *nv_mktype(Namval_t **nodes, in
|
||||
_nv_unset(nodes[0],NV_RDONLY);
|
||||
errormsg(SH_DICT,ERROR_exit(1),e_badtypedef,cp);
|
||||
}
|
||||
+ n=strlen(nodes[1]->nvname);
|
||||
for(nnodes=1,i=1; i <numnodes; i++)
|
||||
{
|
||||
np=nodes[i];
|
||||
@@ -1100,7 +1102,6 @@ Namval_t *nv_mktype(Namval_t **nodes, in
|
||||
nv_disc(nq, &pp->childfun.fun, NV_LAST);
|
||||
if(tp = (Namtype_t*)nv_hasdisc(nq, &type_disc))
|
||||
tp->strsize = -tp->strsize;
|
||||
-else sfprintf(sfstderr,"tp==NULL\n");
|
||||
for(r=0; r < dp->numnodes; r++)
|
||||
{
|
||||
Namval_t *nr = nv_namptr(dp->nodes,r);
|
||||
--- src/cmd/ksh93/sh/parse.c
|
||||
+++ src/cmd/ksh93/sh/parse.c 2013-10-25 13:30:22.024294796 +0000
|
||||
@@ -301,7 +301,7 @@ static Shnode_t *getanode(Lex_t *lp, str
|
||||
*/
|
||||
static Shnode_t *makelist(Lex_t *lexp, int type, Shnode_t *l, Shnode_t *r)
|
||||
{
|
||||
- register Shnode_t *t;
|
||||
+ register Shnode_t *t = NIL(Shnode_t*);
|
||||
if(!l || !r)
|
||||
sh_syntax(lexp);
|
||||
else
|
||||
@@ -742,7 +742,7 @@ static Shnode_t *funct(Lex_t *lexp)
|
||||
register Shnode_t *t;
|
||||
register int flag;
|
||||
struct slnod *volatile slp=0;
|
||||
- Stak_t *savstak;
|
||||
+ Stak_t *savstak = NIL(Stak_t*);
|
||||
Sfoff_t first, last;
|
||||
struct functnod *volatile fp;
|
||||
Sfio_t *iop;
|
||||
@@ -815,7 +815,7 @@ static Shnode_t *funct(Lex_t *lexp)
|
||||
{
|
||||
struct comnod *ac;
|
||||
char *cp, **argv, **argv0;
|
||||
- int c;
|
||||
+ int c=-1;
|
||||
t->funct.functargs = ac = (struct comnod*)simple(lexp,SH_NOIO|SH_FUNDEF,NIL(struct ionod*));
|
||||
if(ac->comset || (ac->comtyp&COMSCAN))
|
||||
errormsg(SH_DICT,ERROR_exit(3),e_lexsyntax4,lexp->sh->inlineno);
|
||||
--- src/cmd/ksh93/sh/xec.c
|
||||
+++ src/cmd/ksh93/sh/xec.c 2013-10-25 13:30:22.025294704 +0000
|
||||
@@ -1507,7 +1507,7 @@ int sh_exec(register const Shnode_t *t,
|
||||
Namval_t node;
|
||||
#endif /* SHOPT_NAMESPACE */
|
||||
struct Namref nr;
|
||||
- long mode;
|
||||
+ long mode = 0;
|
||||
register struct slnod *slp;
|
||||
if(!np->nvalue.ip)
|
||||
{
|
||||
@@ -1916,8 +1916,8 @@ int sh_exec(register const Shnode_t *t,
|
||||
* don't create a new process, just
|
||||
* save and restore io-streams
|
||||
*/
|
||||
- pid_t pid;
|
||||
- int jmpval, waitall;
|
||||
+ pid_t pid = 0;
|
||||
+ int jmpval, waitall = 0;
|
||||
int simple = (t->fork.forktre->tre.tretyp&COMMSK)==TCOM;
|
||||
struct checkpt *buffp = (struct checkpt*)stkalloc(shp->stk,sizeof(struct checkpt));
|
||||
#if SHOPT_COSHELL
|
||||
@@ -2409,7 +2409,7 @@ int sh_exec(register const Shnode_t *t,
|
||||
Shnode_t *tt = t->wh.whtre;
|
||||
#if SHOPT_FILESCAN
|
||||
Sfio_t *iop=0;
|
||||
- int savein;
|
||||
+ int savein=-1;
|
||||
#endif /*SHOPT_FILESCAN*/
|
||||
#if SHOPT_OPTIMIZE
|
||||
int jmpval = ((struct checkpt*)shp->jmplist)->mode;
|
||||
@@ -2877,7 +2877,7 @@ int sh_exec(register const Shnode_t *t,
|
||||
else
|
||||
{
|
||||
register int traceon=0;
|
||||
- register char *right;
|
||||
+ register char *right = 0;
|
||||
register char *trap;
|
||||
char *argv[6];
|
||||
n = type>>TSHIFT;
|
||||
@@ -2911,7 +2911,7 @@ int sh_exec(register const Shnode_t *t,
|
||||
}
|
||||
else if(type&TBINARY)
|
||||
{
|
||||
- char *op;
|
||||
+ char *op = 0;
|
||||
int pattern = 0;
|
||||
if(trap || traceon)
|
||||
op = (char*)(shtab_testops+(n&037)-1)->sh_name;
|
||||
@@ -3376,7 +3376,7 @@ int sh_funscope(int argn, char *argv[],i
|
||||
int jmpval;
|
||||
volatile int r = 0;
|
||||
int n;
|
||||
- char *savstak;
|
||||
+ char *savstak = 0;
|
||||
struct funenv *fp = 0;
|
||||
struct checkpt *buffp = (struct checkpt*)stkalloc(shp->stk,sizeof(struct checkpt));
|
||||
Namval_t *nspace = shp->namespace;
|
||||
@@ -3492,10 +3492,10 @@ int sh_funscope(int argn, char *argv[],i
|
||||
shp->st = *prevscope;
|
||||
shp->topscope = (Shscope_t*)prevscope;
|
||||
nv_getval(sh_scoped(shp,IFSNOD));
|
||||
- if(nsig)
|
||||
+ if(nsig && savstak)
|
||||
memcpy((char*)&shp->st.trapcom[0],savstak,nsig);
|
||||
shp->trapnote=0;
|
||||
- if(nsig)
|
||||
+ if(nsig && savstak)
|
||||
stakset(savstak,0);
|
||||
shp->options = options;
|
||||
shp->last_root = last_root;
|
||||
@@ -3584,11 +3584,11 @@ static void sh_funct(Shell_t *shp,Namval
|
||||
int sh_fun(Namval_t *np, Namval_t *nq, char *argv[])
|
||||
{
|
||||
Shell_t *shp = sh_getinterp();
|
||||
- register int offset;
|
||||
+ register int offset = 0;
|
||||
register char *base;
|
||||
Namval_t node;
|
||||
struct Namref nr;
|
||||
- long mode;
|
||||
+ long mode = 0;
|
||||
char *prefix = shp->prefix;
|
||||
int n=0;
|
||||
char *av[3];
|
||||
--- src/lib/libast/sfio/sfstrtof.h
|
||||
+++ src/lib/libast/sfio/sfstrtof.h 2013-10-25 13:30:22.025294704 +0000
|
||||
@@ -211,8 +211,8 @@ S2F_function(str, end) char* str; char**
|
||||
int decimal = 0;
|
||||
int thousand = 0;
|
||||
int part = 0;
|
||||
- int back_part;
|
||||
- S2F_batch back_n;
|
||||
+ int back_part = 0;
|
||||
+ S2F_batch back_n = 0;
|
||||
S2F_number v;
|
||||
S2F_number p;
|
||||
S2F_part_t parts[16];
|
||||
--- src/lib/libast/sfio/sftable.c
|
||||
+++ src/lib/libast/sfio/sftable.c 2013-10-25 13:30:22.026294612 +0000
|
||||
@@ -53,7 +53,7 @@ int type; /* >0: scanf, =0: printf, -1:
|
||||
#endif
|
||||
{
|
||||
int base, fmt, flags, dot, width, precis;
|
||||
- ssize_t n_str, size;
|
||||
+ ssize_t n_str, size = 0;
|
||||
char *t_str, *sp;
|
||||
int v, n, skip, dollar, decimal, thousand;
|
||||
Sffmt_t savft;
|
||||
--- src/lib/libast/sfio/sfvprintf.c
|
||||
+++ src/lib/libast/sfio/sfvprintf.c 2013-10-25 13:30:22.026294612 +0000
|
||||
@@ -101,7 +101,7 @@ char* form; /* format to use */
|
||||
va_list args; /* arg list if !argf */
|
||||
#endif
|
||||
{
|
||||
- int n, v, w, k, n_s, base, fmt, flags;
|
||||
+ int n, v=0, w, k, n_s, base, fmt, flags;
|
||||
Sflong_t lv;
|
||||
char *sp, *ssp, *endsp, *ep, *endep;
|
||||
int dot, width, precis, sign, decpt;
|
||||
@@ -129,7 +129,7 @@ va_list args; /* arg list if !argf */
|
||||
int decimal = 0, thousand = 0;
|
||||
|
||||
#if _has_multibyte
|
||||
- wchar_t* wsp;
|
||||
+ wchar_t* wsp = 0;
|
||||
SFMBDCL(fmbs) /* state of format string */
|
||||
SFMBDCL(mbs) /* state of some string */
|
||||
#ifdef mbwidth
|
||||
--- src/lib/libast/string/stropt.c
|
||||
+++ src/lib/libast/string/stropt.c 2013-10-25 13:30:22.033293966 +0000
|
||||
@@ -60,13 +60,13 @@ stropt(const char* as, const void* tab,
|
||||
register char* v;
|
||||
register char* t;
|
||||
char** p;
|
||||
- char* u;
|
||||
+ char* u = 0;
|
||||
char* x;
|
||||
char* e;
|
||||
int n;
|
||||
int ql;
|
||||
int qr;
|
||||
- int qc;
|
||||
+ int qc = 0;
|
||||
|
||||
if (!as) n = 0;
|
||||
else if (!(x = s = strdup(as))) n = -1;
|
||||
--- src/lib/libast/string/strtoi.h
|
||||
+++ src/lib/libast/string/strtoi.h 2013-10-25 13:30:22.027294520 +0000
|
||||
@@ -230,13 +230,13 @@ S2I_function(a, e, base) const char* a;
|
||||
#endif
|
||||
register S2I_unumber n;
|
||||
register S2I_unumber x;
|
||||
- register int c;
|
||||
+ register int c = 0;
|
||||
register int shift;
|
||||
register unsigned char* p;
|
||||
register unsigned char* cv;
|
||||
unsigned char* b;
|
||||
unsigned char* k;
|
||||
- S2I_unumber v;
|
||||
+ S2I_unumber v = 0;
|
||||
#if S2I_multiplier
|
||||
register int base;
|
||||
#endif
|
@ -1,6 +1,6 @@
|
||||
--- src/cmd/ksh93/sh/xec.c
|
||||
+++ src/cmd/ksh93/sh/xec.c 2011-07-04 15:42:21.000000000 +0000
|
||||
@@ -4041,7 +4041,8 @@ int sh_funscope_20120720(int argn, char *argv[],i
|
||||
@@ -3387,7 +3387,8 @@ int sh_funscope(int argn, char *argv[],i
|
||||
shp->st.var_local = shp->var_tree;
|
||||
if(!fun)
|
||||
{
|
||||
|
14
ksh93-vi.dif
14
ksh93-vi.dif
@ -1,6 +1,6 @@
|
||||
--- src/cmd/ksh93/edit/vi.c
|
||||
+++ src/cmd/ksh93/edit/vi.c 2014-02-17 15:53:10.873464619 +0000
|
||||
@@ -396,6 +396,8 @@ int ed_viread(void *context, int fd, reg
|
||||
+++ src/cmd/ksh93/edit/vi.c 2007-03-28 16:41:47.000000000 +0000
|
||||
@@ -401,6 +401,8 @@ int ed_viread(void *context, int fd, reg
|
||||
|
||||
if(!yankbuf)
|
||||
yankbuf = (genchar*)malloc(MAXLINE*CHARSIZE);
|
||||
@ -9,7 +9,7 @@
|
||||
if( vp->last_cmd == '\0' )
|
||||
{
|
||||
/*** first time for this shell ***/
|
||||
@@ -405,6 +407,8 @@ int ed_viread(void *context, int fd, reg
|
||||
@@ -410,6 +412,8 @@ int ed_viread(void *context, int fd, reg
|
||||
vp->lastmotion = '\0';
|
||||
vp->lastrepeat = 1;
|
||||
vp->repeat = 1;
|
||||
@ -18,7 +18,7 @@
|
||||
*yankbuf = 0;
|
||||
}
|
||||
|
||||
@@ -1132,7 +1136,7 @@ static void cdelete(Vi_t *vp,register in
|
||||
@@ -1137,7 +1141,7 @@ static void cdelete(Vi_t *vp,register in
|
||||
|
||||
/*** save characters to be deleted ***/
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
{
|
||||
i = cp[nchars];
|
||||
cp[nchars] = 0;
|
||||
@@ -2165,6 +2169,9 @@ static void save_last(register Vi_t* vp)
|
||||
@@ -2169,6 +2173,9 @@ static void save_last(register Vi_t* vp)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
if( (i = cur_virt - first_virt + 1) > 0 )
|
||||
{
|
||||
/*** save last thing user typed ***/
|
||||
@@ -2414,6 +2421,11 @@ static int textmod(register Vi_t *vp,reg
|
||||
@@ -2417,6 +2424,11 @@ static int textmod(register Vi_t *vp,reg
|
||||
p = yankbuf;
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
addin:
|
||||
switch( c )
|
||||
{
|
||||
@@ -2686,6 +2698,8 @@ yankeol:
|
||||
@@ -2687,6 +2699,8 @@ yankeol:
|
||||
vp->lastmotion = c;
|
||||
if( c == 'y' )
|
||||
{
|
||||
|
42
ksh93-vm.dif
42
ksh93-vm.dif
@ -1,30 +1,29 @@
|
||||
--- src/lib/libast/vmalloc/vmmaddress.c
|
||||
+++ src/lib/libast/vmalloc/vmmaddress.c 2014-02-18 14:19:22.978507488 +0000
|
||||
@@ -37,6 +37,10 @@
|
||||
#endif /*MAP_ANON*/
|
||||
#endif /*_mem_mmap_anon*/
|
||||
--- src/lib/libast/vmalloc/vmhdr.h
|
||||
+++ src/lib/libast/vmalloc/vmhdr.h 2012-01-19 09:45:14.000000000 +0000
|
||||
@@ -152,6 +152,9 @@ extern void _vmmessage _ARG_((const cha
|
||||
#endif /*DEBUG*/
|
||||
|
||||
#define VMPAGESIZE 8192
|
||||
+#if defined(__linux__) && !defined(_lib_getpagesize)
|
||||
+#define _lib_getpagesize 1
|
||||
+#endif
|
||||
+
|
||||
/* Heuristic to suggest an address usable for mapping shared memory
|
||||
**
|
||||
** Written by Kiem-Phong Vo, phongvo@gmail.com, 07/07/2012
|
||||
--- src/lib/libast/vmalloc/vmdcshare.c
|
||||
+++ src/lib/libast/vmalloc/vmdcshare.c 2014-04-14 16:28:26.406992119 +0200
|
||||
@@ -53,8 +53,10 @@
|
||||
#if _lib_getpagesize
|
||||
#define GETPAGESIZE(x) ((x) ? (x) : ((x)=getpagesize()) )
|
||||
#else
|
||||
--- src/lib/libast/vmalloc/vmmopen.c
|
||||
+++ src/lib/libast/vmalloc/vmmopen.c 2012-01-20 11:13:12.000000000 +0000
|
||||
@@ -63,8 +63,10 @@ void _STUB_vmmapopen(){}
|
||||
/* magic word signaling file/segment is ready */
|
||||
#define MM_MAGIC ((unsigned int)(('P'<<24) | ('&'<<16) | ('N'<<8) | ('8')) ) /* 1344687672 */
|
||||
#define MM_MAGIC ((unsigned int)(('P'<<24) | ('&'<<16) | ('N'<<8) | ('8')) )
|
||||
|
||||
+#ifndef __linux__
|
||||
/* default mimimum region size */
|
||||
#define MM_MINSIZE (64*_Vmpagesize)
|
||||
+#endif
|
||||
|
||||
/* flags for actions on region closing */
|
||||
#define MM_DETACH 01 /* detach all attached memory */
|
||||
@@ -174,10 +176,19 @@
|
||||
/* macros to get the data section and size */
|
||||
#define MMHEAD(file) ROUND(sizeof(Mmvm_t)+strlen(file), ALIGN)
|
||||
@@ -166,10 +168,18 @@ static int mminit(Mmdisc_t* mmdc)
|
||||
|
||||
if(mmdc->mmvm) /* already done this */
|
||||
return 0;
|
||||
@ -34,14 +33,13 @@
|
||||
if((size = mmdc->size) < MM_MINSIZE )
|
||||
size = MM_MINSIZE;
|
||||
+#else
|
||||
+# if __WORDSIZE == 64
|
||||
+ extent = 4*1024*1024*sizeof(long);
|
||||
+# else
|
||||
+ extent = 512*1024;
|
||||
+# endif
|
||||
+ if (sizeof(void*) > 32)
|
||||
+ extent = ROUND(0x80000,_Vmpagesize);
|
||||
+ else
|
||||
+ extent = ROUND(0x40000,_Vmpagesize);
|
||||
+ if((size = mmdc->size) < extent)
|
||||
+ size = extent;
|
||||
+#endif
|
||||
size += MMHEAD(mmdc->name) + ALIGN;
|
||||
size += MMHEAD(mmdc->file) + ALIGN;
|
||||
size = ROUND(size, _Vmpagesize);
|
||||
|
||||
|
224
ksh93.dif
224
ksh93.dif
@ -1,18 +1,19 @@
|
||||
--- src/cmd/ksh93/bltins/print.c
|
||||
+++ src/cmd/ksh93/bltins/print.c 2014-02-17 14:55:59.193998326 +0000
|
||||
@@ -104,7 +104,11 @@ int B_echo(int argc, char *argv[],Shb
|
||||
{
|
||||
+++ src/cmd/ksh93/bltins/print.c 2008-05-05 11:20:21.000000000 +0000
|
||||
@@ -105,7 +105,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;
|
||||
+ prdata.options = sh_optecho + 5;
|
||||
+# endif
|
||||
prdata.raw = prdata.echon = 0;
|
||||
prdata.sh = context->shp;
|
||||
NOT_USED(argc);
|
||||
@@ -117,7 +121,52 @@ int B_echo(int argc, char *argv[],Shb
|
||||
@@ -118,7 +122,52 @@ static char* nullarg[] = { 0, 0 };
|
||||
prdata.sh->universe = 1;
|
||||
}
|
||||
if(!bsd_univ)
|
||||
@ -66,8 +67,8 @@
|
||||
prdata.raw = 1;
|
||||
while(argv[1] && *argv[1]=='-')
|
||||
--- src/cmd/ksh93/data/msg.c
|
||||
+++ src/cmd/ksh93/data/msg.c 2014-02-17 14:53:59.613033047 +0000
|
||||
@@ -205,7 +205,7 @@ const char e_bash_login[] = "$HOME/.bash
|
||||
+++ src/cmd/ksh93/data/msg.c 2007-12-20 18:01:26.000000000 +0000
|
||||
@@ -202,7 +202,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
|
||||
@ -77,7 +78,7 @@
|
||||
#if SHOPT_SUID_EXEC
|
||||
const char e_suidexec[] = "/etc/suid_exec";
|
||||
--- src/cmd/ksh93/data/variables.c
|
||||
+++ src/cmd/ksh93/data/variables.c 2014-02-17 14:53:59.613033047 +0000
|
||||
+++ src/cmd/ksh93/data/variables.c 2008-09-18 17:22:24.000000000 +0000
|
||||
@@ -69,7 +69,7 @@ const struct shtable2 shtab_variables[]
|
||||
"OPTARG", 0, (char*)0,
|
||||
"OPTIND", NV_NOFREE|NV_INTEGER, (char*)0,
|
||||
@ -88,7 +89,7 @@
|
||||
"LC_ALL", 0, (char*)0,
|
||||
"LC_COLLATE", 0, (char*)0,
|
||||
--- src/cmd/ksh93/features/options
|
||||
+++ src/cmd/ksh93/features/options 2014-02-17 14:53:59.613033047 +0000
|
||||
+++ 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 &&
|
||||
@ -98,9 +99,20 @@
|
||||
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/main.c
|
||||
+++ src/cmd/ksh93/sh/main.c 2014-02-17 14:59:07.103514563 +0000
|
||||
@@ -113,9 +113,9 @@ bool sh_source(Shell_t *shp, Sfio_t *iop
|
||||
+++ src/cmd/ksh93/sh/main.c 2007-12-20 18:01:26.000000000 +0000
|
||||
@@ -113,9 +113,9 @@ int sh_source(Shell_t *shp, Sfio_t *iop,
|
||||
}
|
||||
|
||||
#ifdef S_ISSOCK
|
||||
@ -112,18 +124,18 @@
|
||||
#endif
|
||||
|
||||
int sh_main(int ac, char *av[], Shinit_f userinit)
|
||||
@@ -184,7 +184,7 @@ int sh_main(int ac, char *av[], Shinit_f
|
||||
@@ -179,7 +179,7 @@ int sh_main(int ac, char *av[], Shinit_f
|
||||
}
|
||||
if(!sh_isoption(shp,SH_RC) && (sh_isoption(shp,SH_BASH) && !sh_isoption(shp,SH_POSIX)
|
||||
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(shp,SH_RC);
|
||||
sh_onoption(SH_RC);
|
||||
--- src/cmd/ksh93/sh/xec.c
|
||||
+++ src/cmd/ksh93/sh/xec.c 2014-02-17 15:00:46.556316756 +0000
|
||||
@@ -978,7 +978,7 @@ int sh_exec(register Shell_t *shp,regist
|
||||
+++ src/cmd/ksh93/sh/xec.c 2012-01-26 12:07:46.000000000 +0000
|
||||
@@ -1015,7 +1015,7 @@ int sh_exec(register const Shnode_t *t,
|
||||
{
|
||||
case TCOM:
|
||||
{
|
||||
@ -132,17 +144,17 @@
|
||||
char *trap;
|
||||
Namval_t *np, *nq, *last_table;
|
||||
struct ionod *io;
|
||||
@@ -1097,7 +1097,7 @@ int sh_exec(register Shell_t *shp,regist
|
||||
@@ -1131,7 +1131,7 @@ int sh_exec(register const Shnode_t *t,
|
||||
comn = com[argn-1];
|
||||
}
|
||||
io = t->tre.treio;
|
||||
tryagain:
|
||||
- if(shp->envlist = argp = t->com.comset)
|
||||
+ if((shp->envlist = argp = t->com.comset))
|
||||
{
|
||||
if(argn==0 || (np && (nv_isattr(np,BLT_DCL)||(!command && nv_isattr(np,BLT_SPC)))))
|
||||
if(argn==0 || (np && nv_isattr(np,(BLT_DCL|BLT_SPC))))
|
||||
{
|
||||
--- src/cmd/ksh93/tests/attributes.sh
|
||||
+++ src/cmd/ksh93/tests/attributes.sh 2014-02-17 14:53:59.617033080 +0000
|
||||
+++ 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"
|
||||
@ -153,7 +165,7 @@
|
||||
unset var
|
||||
typeset -b var
|
||||
--- src/cmd/ksh93/tests/bracket.sh
|
||||
+++ src/cmd/ksh93/tests/bracket.sh 2014-02-17 14:53:59.617033080 +0000
|
||||
+++ src/cmd/ksh93/tests/bracket.sh 2012-02-09 14:11:32.000000000 +0000
|
||||
@@ -221,6 +221,10 @@ done
|
||||
[[ abcdcdabcde == {5}(ab|cd)e ]] || err_exit 'abcdcdabcd == {5}(ab|cd)e'
|
||||
) || err_exit 'errors with {..}(...) patterns'
|
||||
@ -174,7 +186,7 @@
|
||||
then [[ -L "$file" ]] || err_exit '-L not working'
|
||||
[[ -L "$file"/ ]] && err_exit '-L with file/ not working'
|
||||
--- src/cmd/ksh93/tests/builtins.sh
|
||||
+++ src/cmd/ksh93/tests/builtins.sh 2014-02-17 14:53:59.617033080 +0000
|
||||
+++ src/cmd/ksh93/tests/builtins.sh 2009-07-09 13:14:50.000000000 +0000
|
||||
@@ -344,7 +344,7 @@ wait $pid1
|
||||
(( $? == 1 )) || err_exit "wait not saving exit value"
|
||||
wait $pid2
|
||||
@ -185,7 +197,7 @@
|
||||
for v in ${v//,/ }
|
||||
do v=${v#*:}
|
||||
--- src/cmd/ksh93/tests/coprocess.sh
|
||||
+++ src/cmd/ksh93/tests/coprocess.sh 2014-02-17 14:53:59.617033080 +0000
|
||||
+++ src/cmd/ksh93/tests/coprocess.sh 2013-02-01 15:22:31.000000000 +0000
|
||||
@@ -113,15 +113,15 @@ do
|
||||
cop=$!
|
||||
exp=Done
|
||||
@ -266,7 +278,7 @@
|
||||
$cat |&
|
||||
pid=$!
|
||||
--- src/cmd/ksh93/tests/locale.sh
|
||||
+++ src/cmd/ksh93/tests/locale.sh 2014-02-17 15:02:01.480920975 +0000
|
||||
+++ src/cmd/ksh93/tests/locale.sh 2011-05-24 14:46:02.000000000 +0000
|
||||
@@ -62,7 +62,7 @@ done
|
||||
# this locale is supported by ast on all platforms
|
||||
# EU for { decimal_point="," thousands_sep="." }
|
||||
@ -306,8 +318,8 @@
|
||||
fi
|
||||
")
|
||||
got=$*
|
||||
@@ -342,7 +342,7 @@ then LC_ALL=en_US.UTF-8
|
||||
LC_ALL=C.UTF-8 eval $'[[ $(print -r -- "$x") == $\'hello\\u[20ac]\\xee world\' ]]' || err_exit '%q with unicode and non-unicode not working'
|
||||
@@ -336,7 +336,7 @@ then LC_ALL=en_US.UTF-8
|
||||
[[ $(print -r -- "$x") == $'hello\u[20ac]\xee world' ]] || err_exit '%q with unicode and non-unicode not working'
|
||||
if [[ $(whence od) ]]
|
||||
then got='68 65 6c 6c 6f e2 82 ac ee 20 77 6f 72 6c 64 0a'
|
||||
- [[ $(print -r -- "$x" | od -An -tx1) == "$got" ]] || err_exit "incorrect string from printf %q"
|
||||
@ -316,7 +328,7 @@
|
||||
|
||||
fi
|
||||
--- src/cmd/ksh93/tests/options.sh
|
||||
+++ src/cmd/ksh93/tests/options.sh 2014-02-17 14:53:59.617033080 +0000
|
||||
+++ src/cmd/ksh93/tests/options.sh 2012-01-16 16:50:59.000000000 +0000
|
||||
@@ -510,7 +510,7 @@ z=$($SHELL 2>&1 -uc 'print ${X2345678901
|
||||
[[ $z == *X23456789012345:* ]] || err_exit "error message garbled with set -u got $z"
|
||||
|
||||
@ -327,7 +339,7 @@
|
||||
set -o pipefail
|
||||
(sleep $toolong;kill \$\$> /dev/null) &
|
||||
--- src/cmd/ksh93/tests/path.sh
|
||||
+++ src/cmd/ksh93/tests/path.sh 2014-02-17 14:53:59.621033112 +0000
|
||||
+++ 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'
|
||||
|
||||
@ -338,7 +350,7 @@
|
||||
PATH=$path
|
||||
|
||||
--- src/cmd/ksh93/tests/pty.sh
|
||||
+++ src/cmd/ksh93/tests/pty.sh 2014-02-17 14:53:59.621033112 +0000
|
||||
+++ src/cmd/ksh93/tests/pty.sh 2012-03-15 11:51:40.000000000 +0000
|
||||
@@ -428,15 +428,16 @@ r echo repeat-3
|
||||
|
||||
# err_exit #
|
||||
@ -359,7 +371,7 @@
|
||||
|
||||
exit $((Errors<125?Errors:125))
|
||||
--- src/cmd/ksh93/tests/signal.sh
|
||||
+++ src/cmd/ksh93/tests/signal.sh 2014-02-17 14:53:59.621033112 +0000
|
||||
+++ src/cmd/ksh93/tests/signal.sh 2011-05-20 13:25:48.000000000 +0000
|
||||
@@ -285,10 +285,10 @@ then for exp in TERM VTALRM PIPE
|
||||
$SHELL <<- EOF
|
||||
foo() { return 0; }
|
||||
@ -373,30 +385,19 @@
|
||||
done > /dev/null
|
||||
EOF
|
||||
} 2>> /dev/null
|
||||
--- src/cmd/ksh93/sh.1
|
||||
+++ src/cmd/ksh93/sh.1 2014-02-17 14:53:59.613033047 +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/lib/libast/disc/memfatal.c
|
||||
+++ src/lib/libast/disc/memfatal.c 2014-02-17 15:03:10.461477163 +0000
|
||||
@@ -86,7 +86,7 @@ memfatal_20130509(Vmdisc_t* disc)
|
||||
+++ src/lib/libast/disc/memfatal.c 2009-07-09 13:30:39.000000000 +0000
|
||||
@@ -74,7 +74,7 @@ memfatal(void)
|
||||
{
|
||||
if (!disc)
|
||||
{
|
||||
- malloc(0);
|
||||
+ void * ptr = malloc(0);
|
||||
if (!(disc = vmdisc(Vmregion, NiL)))
|
||||
return -1;
|
||||
}
|
||||
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 2014-02-17 14:53:59.621033112 +0000
|
||||
+++ src/lib/libast/features/align.c 2007-12-20 18:01:26.000000000 +0000
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "FEATURE/common"
|
||||
|
||||
@ -406,7 +407,7 @@
|
||||
union _u_
|
||||
{
|
||||
--- src/lib/libast/features/botch.c
|
||||
+++ src/lib/libast/features/botch.c 2014-02-17 15:03:39.981715158 +0000
|
||||
+++ 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
|
||||
*/
|
||||
@ -414,10 +415,10 @@
|
||||
+#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "FEATURE/common"
|
||||
#include "FEATURE/lib"
|
||||
--- src/lib/libast/features/lib
|
||||
+++ src/lib/libast/features/lib 2014-02-17 14:53:59.621033112 +0000
|
||||
@@ -487,14 +487,19 @@ tst lib_utime_now note{ utime works with
|
||||
+++ src/lib/libast/features/lib 2007-12-20 18:01:26.000000000 +0000
|
||||
@@ -538,14 +538,19 @@ tst lib_utime_now note{ utime works with
|
||||
}end
|
||||
|
||||
tst cross{
|
||||
@ -445,8 +446,8 @@
|
||||
}end
|
||||
|
||||
--- src/lib/libast/misc/procopen.c
|
||||
+++ src/lib/libast/misc/procopen.c 2014-02-17 14:53:59.621033112 +0000
|
||||
@@ -601,7 +601,7 @@ procopen(const char* cmd, char** argv, c
|
||||
+++ src/lib/libast/misc/procopen.c 2007-12-20 18:01:26.000000000 +0000
|
||||
@@ -599,7 +599,7 @@ procopen(const char* cmd, char** argv, c
|
||||
if (!fork())
|
||||
{
|
||||
sfsprintf(path, sizeof(path), "%d", getppid());
|
||||
@ -456,7 +457,7 @@
|
||||
}
|
||||
sleep(2);
|
||||
--- src/lib/libast/port/astwinsize.c
|
||||
+++ src/lib/libast/port/astwinsize.c 2014-02-17 15:05:53.702793018 +0000
|
||||
+++ src/lib/libast/port/astwinsize.c 2012-02-03 08:58:43.000000000 +0000
|
||||
@@ -29,6 +29,10 @@
|
||||
#include <ast.h>
|
||||
#include <ast_tty.h>
|
||||
@ -466,10 +467,21 @@
|
||||
+#endif
|
||||
+
|
||||
#if defined(__STDPP__directive) && defined(__STDPP__hide)
|
||||
__STDPP__directive pragma pp:hide sleep
|
||||
__STDPP__directive pragma pp:hide ioctl sleep
|
||||
#else
|
||||
@@ -36,10 +40,6 @@ __STDPP__directive pragma pp:hide ioctl
|
||||
#define sleep ______sleep
|
||||
#endif
|
||||
|
||||
-#if _sys_ioctl
|
||||
-#include <sys/ioctl.h>
|
||||
-#endif
|
||||
-
|
||||
#if defined(TIOCGWINSZ)
|
||||
#if _sys_stream && _sys_ptem
|
||||
#include <sys/stream.h>
|
||||
--- src/lib/libast/sfio/sfstrtof.h
|
||||
+++ src/lib/libast/sfio/sfstrtof.h 2014-02-17 14:53:59.621033112 +0000
|
||||
+++ src/lib/libast/sfio/sfstrtof.h 2007-12-20 18:01:26.000000000 +0000
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
#if !defined(S2F_function)
|
||||
@ -479,9 +491,20 @@
|
||||
#define S2F_type 2
|
||||
#define S2F_scan 1
|
||||
#ifndef elementsof
|
||||
--- src/lib/libcmd/Mamfile
|
||||
+++ src/lib/libcmd/Mamfile 2013-02-05 10:41:01.310073683 +0000
|
||||
@@ -897,7 +897,7 @@ exec - -e '/^b_[a-z_][a-z_0-9]*(/!d' \
|
||||
exec - -e 's/^b_//' \
|
||||
exec - -e 's/(.*//' \
|
||||
exec - -e 's/.*/CMDLIST(&)/' \
|
||||
-exec - |
|
||||
+exec - cmdinit.c basename.c cat.c chgrp.c chmod.c chown.c cksum.c cmp.c comm.c cp.c cut.c dirname.c date.c expr.c fds.c fmt.c fold.c getconf.c head.c id.c join.c ln.c logname.c md5sum.c mkdir.c mkfifo.c mktemp.c mv.c paste.c pathchk.c pids.c rev.c rm.c rmdir.c stty.c sum.c sync.c tail.c tee.c tty.c uname.c uniq.c vmstate.c wc.c revlib.c wclib.c fts_fix.c lib.c |
|
||||
exec - sort -u
|
||||
exec - } > 1.${COTEMP}.h
|
||||
exec - if cmp 2>/dev/null -s 1.${COTEMP}.h cmdlist.h
|
||||
--- src/lib/libcmd/chmod.c
|
||||
+++ src/lib/libcmd/chmod.c 2014-02-17 14:53:59.621033112 +0000
|
||||
@@ -270,7 +270,7 @@ b_chmod(int argc, char** argv, Shbltin_t
|
||||
+++ src/lib/libcmd/chmod.c 2011-05-20 13:28:58.000000000 +0000
|
||||
@@ -272,7 +272,7 @@ b_chmod(int argc, char** argv, Shbltin_t
|
||||
case FTS_SLNONE:
|
||||
if (chlink)
|
||||
{
|
||||
@ -490,80 +513,3 @@
|
||||
chmodf = lchmod;
|
||||
goto commit;
|
||||
#else
|
||||
--- src/cmd/ksh93/tests/namespace.sh
|
||||
+++ src/cmd/ksh93/tests/namespace.sh 2014-02-19 12:11:42.493794867 +0000
|
||||
@@ -27,6 +27,9 @@ alias err_exit='err_exit $LINENO'
|
||||
|
||||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
+integer compiled=0
|
||||
+read -n4 c < $0 2> /dev/null
|
||||
+[[ $c == *$'\ck'* ]] && let compiled=1
|
||||
|
||||
tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; }
|
||||
trap "cd /; rm -rf $tmp" EXIT
|
||||
@@ -117,6 +120,7 @@ namespace com.foo
|
||||
}
|
||||
[[ $(print -v .com.foo.container) == "${.com.foo.exp}" ]] || err_exit 'compound variables defined in a namespace not expanded the same outside and inside'
|
||||
|
||||
+if (( compiled==0 )) ; then
|
||||
namespace a.b
|
||||
{
|
||||
typeset -T x_t=(
|
||||
@@ -126,7 +130,9 @@ namespace a.b
|
||||
}
|
||||
.a.b.x_t var
|
||||
[[ $(var.pi) == 10 ]] || print -u2 'discipline functions for types in namespace not working'
|
||||
+fi
|
||||
|
||||
+if (( compiled==0 )) ; then
|
||||
namespace com.foo.test1
|
||||
{
|
||||
typeset -T x_t=(
|
||||
@@ -137,6 +143,7 @@ namespace com.foo.test1
|
||||
}
|
||||
.com.foo.test1.y_t v
|
||||
[[ $(v.x.pr) == 9/5 ]] || err_exit '_.__ not working with nested types in a namespace'
|
||||
+fi
|
||||
|
||||
namespace a.b
|
||||
{
|
||||
--- src/cmd/ksh93/tests/wchar.sh
|
||||
+++ src/cmd/ksh93/tests/wchar.sh 2014-02-19 14:09:16.651095254 +0000
|
||||
@@ -40,7 +40,7 @@ Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
locales="en_US.UTF-8 en_US.ISO-8859-15 zh_CN.GB18030"
|
||||
-supported="C.UTF-8"
|
||||
+supported="de_DE.UTF-8"
|
||||
|
||||
for lc_all in $locales
|
||||
do if [[ $($SHELL -c "LC_ALL=$lc_all || echo error" 2>&1) == "" ]]
|
||||
--- src/cmd/ksh93/tests/treemove.sh
|
||||
+++ src/cmd/ksh93/tests/treemove.sh 2014-02-19 15:06:17.998369193 +0000
|
||||
@@ -64,6 +64,9 @@ function err_exit
|
||||
alias err_exit='err_exit $LINENO'
|
||||
|
||||
integer Errors=0
|
||||
+integer compiled=0
|
||||
+read -n4 c < $0 2> /dev/null
|
||||
+[[ $c == *$'\ck'* ]] && let compiled=1
|
||||
|
||||
function idempotent
|
||||
{
|
||||
@@ -236,6 +239,7 @@ exp='typeset -C res.a=(typeset -l -i val
|
||||
[[ $(typeset -p res.a) == "$exp" ]] || err_exit 'typeset -m for compound variable in a type not working'
|
||||
idempotent exp res.a 'typeset -C res'
|
||||
|
||||
+if (( compiled != 1 )) ; then
|
||||
unset c
|
||||
compound c dummy
|
||||
objstack_t c.ost
|
||||
@@ -247,6 +251,7 @@ c.ost.popobj dummy
|
||||
exp='typeset -C c=(objstack_t ost=(typeset -l -i st_n=1;st[0]=(obj=(typeset -l -i val=5))))'
|
||||
[[ $(typeset -p c) == "$exp" ]] || err_exit 'typeset -m for types not working'
|
||||
idempotent exp c "$(typeset -T)"
|
||||
+fi
|
||||
|
||||
unset c
|
||||
typeset -p c
|
||||
|
39
sigexec.c
39
sigexec.c
@ -41,7 +41,7 @@ static void sigother(int sig)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int ptm, pts, sig;
|
||||
int ptm, pts;
|
||||
ssize_t len;
|
||||
static struct termios o;
|
||||
static struct winsize w;
|
||||
@ -166,19 +166,16 @@ int main(int argc, char* argv[])
|
||||
dup2(pts, 2);
|
||||
close(pts);
|
||||
close(ptm);
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigaction(SIGHUP, &sa, (struct sigaction*)0);
|
||||
if (ioctl (0, TIOCSCTTY, 1) < 0) {
|
||||
perror("pty: can not get controlling tty");
|
||||
exit(errno);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
close(pts);
|
||||
close(ptm);
|
||||
perror("pty: can not fork");
|
||||
exit(errno);
|
||||
exit(1);
|
||||
default:
|
||||
dup2(ptm, 0);
|
||||
close(pts);
|
||||
@ -193,7 +190,7 @@ int main(int argc, char* argv[])
|
||||
exit (0);
|
||||
if (errno == EINTR || errno == EAGAIN)
|
||||
continue;
|
||||
return errno;
|
||||
return 1;
|
||||
}
|
||||
ptr += p;
|
||||
len -= p;
|
||||
@ -207,28 +204,24 @@ int main(int argc, char* argv[])
|
||||
(void)sigfillset(&set);
|
||||
sigprocmask(SIG_UNBLOCK, &set, (sigset_t*)0);
|
||||
|
||||
(void)sigemptyset(&set);
|
||||
(void)sigaddset(&set, SIGCHLD);
|
||||
sigprocmask(SIG_BLOCK, &set, (sigset_t*)0);
|
||||
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sa.sa_handler = SIG_DFL;
|
||||
sigemptyset (&sa.sa_mask);
|
||||
|
||||
for (sig = 1; sig < _NSIG; sig++) {
|
||||
|
||||
if (sig == SIGKILL || sig == SIGSTOP)
|
||||
continue;
|
||||
|
||||
if (sig == SIGQUIT)
|
||||
continue;
|
||||
|
||||
if ((sigaction(sig, &sa, (struct sigaction*)0) < 0))
|
||||
if (errno != EINVAL)
|
||||
return errno;
|
||||
}
|
||||
sigaction(SIGHUP, &sa, (struct sigaction*)0);
|
||||
sigaction(SIGINT, &sa, (struct sigaction*)0);
|
||||
sigaction(SIGPIPE, &sa, (struct sigaction*)0);
|
||||
sigaction(SIGTERM, &sa, (struct sigaction*)0);
|
||||
sigaction(SIGURG, &sa, (struct sigaction*)0);
|
||||
sigaction(SIGXFSZ, &sa, (struct sigaction*)0);
|
||||
sigaction(SIGQUIT, &sa, (struct sigaction*)0);
|
||||
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigaction(SIGQUIT, &sa, (struct sigaction*)0);
|
||||
|
||||
if (setenv("USESIGEXEC", "0", 1) < 0)
|
||||
return errno;
|
||||
|
||||
return execv(argv[1], &argv[1]);
|
||||
return execv(argv[1], &argv[1]);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- src/cmd/INIT/Mamfile
|
||||
+++ src/cmd/INIT/Mamfile 2014-02-17 15:18:52.481030284 +0000
|
||||
+++ src/cmd/INIT/Mamfile 2008-02-14 12:08:37.000000000 +0000
|
||||
@@ -5,7 +5,7 @@ setv AR ${mam_cc_AR} ${mam_cc_AR_ARFLAGS
|
||||
setv ARFLAGS rc
|
||||
setv AS as
|
||||
@ -19,8 +19,8 @@
|
||||
setv TAR tar
|
||||
setv YACC yacc
|
||||
--- src/cmd/INIT/iffe.sh
|
||||
+++ src/cmd/INIT/iffe.sh 2014-02-17 15:18:52.481030284 +0000
|
||||
@@ -1186,7 +1186,7 @@ case `(getopts '[-][123:xyz]' opt --xyz;
|
||||
+++ src/cmd/INIT/iffe.sh 2008-02-14 12:15:59.000000000 +0000
|
||||
@@ -1170,7 +1170,7 @@ case `(getopts '[-][123:xyz]' opt --xyz;
|
||||
--*) echo $command: $1: unknown option >&2
|
||||
exit 2
|
||||
;;
|
||||
@ -30,7 +30,7 @@
|
||||
*) break
|
||||
;;
|
||||
--- src/cmd/INIT/mamake.c
|
||||
+++ src/cmd/INIT/mamake.c 2014-02-17 15:18:52.485030316 +0000
|
||||
+++ src/cmd/INIT/mamake.c 2008-02-14 12:08:37.000000000 +0000
|
||||
@@ -118,7 +118,7 @@ USAGE_LICENSE
|
||||
#define set(b,o) ((b)->nxt=(b)->buf+(o))
|
||||
#define use(b) (*(b)->nxt=0,(b)->nxt=(b)->buf)
|
||||
@ -85,7 +85,7 @@
|
||||
}
|
||||
|
||||
--- src/cmd/ksh93/Mamfile
|
||||
+++ src/cmd/ksh93/Mamfile 2014-07-02 12:15:12.166235595 +0000
|
||||
+++ src/cmd/ksh93/Mamfile 2012-02-10 14:30:31.000000000 +0000
|
||||
@@ -7,7 +7,7 @@ setv AR ${mam_cc_AR} ${mam_cc_AR_ARFLAGS
|
||||
setv ARFLAGS rc
|
||||
setv AS as
|
||||
@ -104,42 +104,43 @@
|
||||
setv SILENT
|
||||
setv TAR tar
|
||||
setv YACC yacc
|
||||
@@ -1441,7 +1441,7 @@ bind -lshell
|
||||
prev +ljobs
|
||||
@@ -1337,7 +1337,7 @@ prev +ljobs
|
||||
prev +li
|
||||
prev ${mam_libsocket}
|
||||
prev ${mam_libsecdb}
|
||||
-exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -o ksh pmain.o ${mam_libshell} ${mam_libast}
|
||||
+exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -o ksh pmain.o ${mam_libshell} ${mam_libcmd} ${mam_libast} ${mam_libm} ${mam_libast}
|
||||
-exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -o ksh pmain.o ${mam_libshell} ${mam_libnsl} ${mam_libast}
|
||||
+exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -o ksh pmain.o ${mam_libshell} ${mam_libnsl} ${mam_libcmd} ${mam_libast} ${mam_libm} ${mam_libast}
|
||||
done ksh generated
|
||||
make shcomp
|
||||
make shcomp.o
|
||||
@@ -1464,7 +1464,7 @@ prev +li
|
||||
@@ -1361,7 +1361,7 @@ prev ${mam_libsocket}
|
||||
prev ${mam_libsecdb}
|
||||
setv CC.DLL -UCC.DLL
|
||||
setv SH_DICT -DSH_DICT="\"libshell\""
|
||||
-exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -o shcomp shcomp.o ${mam_libshell} ${mam_libast}
|
||||
+exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -o shcomp shcomp.o ${mam_libshell} ${mam_libcmd} ${mam_libast} ${mam_libm} ${mam_libast}
|
||||
-exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -o shcomp shcomp.o ${mam_libshell} ${mam_libnsl} ${mam_libast}
|
||||
+exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -o shcomp shcomp.o ${mam_libshell} ${mam_libnsl} ${mam_libcmd} ${mam_libast} ${mam_libm} ${mam_libast}
|
||||
done shcomp generated
|
||||
make suid_exec
|
||||
make suid_exec.o
|
||||
@@ -1480,13 +1480,13 @@ meta suid_exec.o %.c>%.o sh/suid_exec.c
|
||||
@@ -1377,14 +1377,14 @@ meta suid_exec.o %.c>%.o sh/suid_exec.c
|
||||
prev sh/suid_exec.c
|
||||
setv CC.DLL -UCC.DLL
|
||||
setv _BLD_shell -U_BLD_shell
|
||||
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} -DERROR_CONTEXT_T=Error_context_t -D_API_ast=20130625 -D_PACKAGE_ast -c sh/suid_exec.c
|
||||
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -fPIE -I. -Iinclude -I${PACKAGE_ast_INCLUDE} -DERROR_CONTEXT_T=Error_context_t -D_API_ast=20130625 -D_PACKAGE_ast -c sh/suid_exec.c
|
||||
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} -DERROR_CONTEXT_T=Error_context_t -D_API_ast=20100309 -D_PACKAGE_ast -c sh/suid_exec.c
|
||||
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -fPIE -I. -Iinclude -I${PACKAGE_ast_INCLUDE} -DERROR_CONTEXT_T=Error_context_t -D_API_ast=20100309 -D_PACKAGE_ast -c sh/suid_exec.c
|
||||
done suid_exec.o generated
|
||||
prev +ljobs
|
||||
prev +li
|
||||
prev ${mam_libsocket}
|
||||
prev ${mam_libsecdb}
|
||||
setv CC.DLL -UCC.DLL
|
||||
-exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} ${mam_cc_L+-L${INSTALLROOT}/lib} -o suid_exec suid_exec.o ${mam_libast} ${mam_libast}
|
||||
+exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} ${mam_cc_L+-L${INSTALLROOT}/lib} -pie -o suid_exec suid_exec.o ${mam_libast} ${mam_libast}
|
||||
-exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -o suid_exec suid_exec.o ${mam_libast} ${mam_libnsl} ${mam_libast}
|
||||
+exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -pie -o suid_exec suid_exec.o ${mam_libast} ${mam_libnsl} ${mam_libast}
|
||||
done suid_exec generated
|
||||
make bash
|
||||
prev ksh
|
||||
make shell
|
||||
prev libshell.a archive
|
||||
--- src/lib/libast/Mamfile
|
||||
+++ src/lib/libast/Mamfile 2014-02-17 15:18:52.485030316 +0000
|
||||
+++ src/lib/libast/Mamfile 2013-02-05 15:08:23.757451837 +0000
|
||||
@@ -5,7 +5,7 @@ setv AR ${mam_cc_AR} ${mam_cc_AR_ARFLAGS
|
||||
setv ARFLAGS rc
|
||||
setv AS as
|
||||
@ -158,7 +159,7 @@
|
||||
setv SILENT
|
||||
setv TAR tar
|
||||
setv YACC yacc
|
||||
@@ -1095,7 +1095,7 @@ make lcgen
|
||||
@@ -1003,7 +1003,7 @@ make lcgen
|
||||
make port/lcgen.c
|
||||
prev std/stdio.h implicit
|
||||
done port/lcgen.c
|
||||
@ -167,7 +168,7 @@
|
||||
done lcgen generated
|
||||
make port/lc.tab
|
||||
done port/lc.tab
|
||||
@@ -7586,58 +7586,31 @@ exec - test '' = 'misc/magic.tab' || ${S
|
||||
@@ -7291,58 +7291,31 @@ exec - test '' = 'misc/magic.tab' || ${S
|
||||
done ${INSTALLROOT}/lib/file/magic generated
|
||||
prev comp/fmtmsg.h
|
||||
prev ast_lib.h
|
||||
@ -230,7 +231,7 @@
|
||||
make test
|
||||
done test dontcare virtual
|
||||
--- src/lib/libcmd/Mamfile
|
||||
+++ src/lib/libcmd/Mamfile 2014-02-17 15:18:52.485030316 +0000
|
||||
+++ src/lib/libcmd/Mamfile 2013-02-05 15:13:53.797951789 +0000
|
||||
@@ -7,7 +7,7 @@ setv AR ${mam_cc_AR} ${mam_cc_AR_ARFLAGS
|
||||
setv ARFLAGS rc
|
||||
setv AS as
|
||||
@ -250,7 +251,7 @@
|
||||
setv TAR tar
|
||||
setv YACC yacc
|
||||
--- src/lib/libdll/Mamfile
|
||||
+++ src/lib/libdll/Mamfile 2014-02-17 15:18:52.485030316 +0000
|
||||
+++ src/lib/libdll/Mamfile 2008-02-14 12:08:37.000000000 +0000
|
||||
@@ -7,7 +7,7 @@ setv AR ${mam_cc_AR} ${mam_cc_AR_ARFLAGS
|
||||
setv ARFLAGS rc
|
||||
setv AS as
|
||||
@ -271,7 +272,7 @@
|
||||
setv YACC yacc
|
||||
--- src/lib/libpp/Mamfile
|
||||
+++ src/lib/libpp/Mamfile 2012-01-24 18:31:22.000000000 +0000
|
||||
@@ -675,7 +675,7 @@ exec - .
|
||||
@@ -663,7 +663,7 @@ exec - .
|
||||
exec - w
|
||||
exec - q
|
||||
exec - !
|
||||
@ -280,7 +281,7 @@
|
||||
exec - ./${COTEMP}.exe > pp.yacc
|
||||
exec - rm -f 1.${COTEMP}.c ${COTEMP}.exe
|
||||
done pp.yacc generated
|
||||
@@ -717,7 +717,7 @@ exec - .
|
||||
@@ -705,7 +705,7 @@ exec - .
|
||||
exec - w
|
||||
exec - q
|
||||
exec - !
|
||||
@ -289,42 +290,3 @@
|
||||
exec - ./${COTEMP}.exe > ppkey.yacc
|
||||
exec - rm -f 1.${COTEMP}.c ${COTEMP}.exe
|
||||
done ppkey.yacc generated
|
||||
--- src/cmd/builtin/Mamfile
|
||||
+++ src/cmd/builtin/Mamfile 2014-02-20 11:36:55.598747064 +0000
|
||||
@@ -384,36 +384,6 @@ done who.o generated
|
||||
setv CMD_STANDALONE -DCMD_STANDALONE="b_who"
|
||||
exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} ${mam_cc_L+-L${INSTALLROOT}/lib} -o who who.o ${mam_libast} ${mam_libcmd}
|
||||
done who generated
|
||||
-make ln
|
||||
-make cp
|
||||
-done cp
|
||||
-exec - if silent test -f "ln"
|
||||
-exec - then ${STDRM} -f ln
|
||||
-exec - fi
|
||||
-exec - ${STDLN} cp ln
|
||||
-done ln generated
|
||||
-make mv
|
||||
-prev cp
|
||||
-exec - if silent test -f "mv"
|
||||
-exec - then ${STDRM} -f mv
|
||||
-exec - fi
|
||||
-exec - ${STDLN} cp mv
|
||||
-done mv generated
|
||||
-make md5sum
|
||||
-make cksum
|
||||
-done cksum
|
||||
-exec - if silent test -f "md5sum"
|
||||
-exec - then ${STDRM} -f md5sum
|
||||
-exec - fi
|
||||
-exec - ${STDLN} cksum md5sum
|
||||
-done md5sum generated
|
||||
-make sum
|
||||
-prev cksum
|
||||
-exec - if silent test -f "sum"
|
||||
-exec - then ${STDRM} -f sum
|
||||
-exec - fi
|
||||
-exec - ${STDLN} cksum sum
|
||||
-done sum generated
|
||||
make ${INSTALLROOT}/bin
|
||||
exec - if silent test ! -d ${INSTALLROOT}/bin
|
||||
exec - then mkdir -p ${INSTALLROOT}/bin
|
||||
|
Loading…
Reference in New Issue
Block a user