Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/poudriere.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Drewery <bryan@shatow.net>2017-02-18 08:13:51 +0300
committerBryan Drewery <bryan@shatow.net>2017-02-18 08:13:51 +0300
commit2cd05a9fe00a73dbaf796c32683b36076b6edd57 (patch)
treeecc035a1bdae4b5bd769a3785e3a15dccd0ead4b /external
parent1daf9cd51d50fd302f5a221596f0a6e8b64b8d14 (diff)
Update sh from head @ r313660
Diffstat (limited to 'external')
-rw-r--r--external/sh/expand.c7
-rw-r--r--external/sh/miscbltin.c8
-rw-r--r--external/sh/parser.c33
-rw-r--r--external/sh/test.c4
-rw-r--r--external/sh/trap.c7
-rw-r--r--external/sh/var.c3
6 files changed, 35 insertions, 27 deletions
diff --git a/external/sh/expand.c b/external/sh/expand.c
index 03d7a34e..d29237be 100644
--- a/external/sh/expand.c
+++ b/external/sh/expand.c
@@ -40,7 +40,7 @@ static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95";
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/bin/sh/expand.c 296429 2016-03-06 17:24:02Z jilles $");
+__FBSDID("$FreeBSD: head/bin/sh/expand.c 303586 2016-07-31 13:11:34Z jilles $");
#include <sys/types.h>
#include <sys/time.h>
@@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, int flag, struct worddest *dst)
if (--in.nleft < 0) {
if (in.fd < 0)
break;
- while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR);
+ while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR)
+ ;
TRACE(("expbackq: read returns %d\n", i));
if (i <= 0)
break;
@@ -1196,7 +1197,7 @@ expsortcmp(const void *p1, const void *p2)
const char *s1 = *(const char * const *)p1;
const char *s2 = *(const char * const *)p2;
- return (strcmp(s1, s2));
+ return (strcoll(s1, s2));
}
diff --git a/external/sh/miscbltin.c b/external/sh/miscbltin.c
index d7ec6a2f..21befbbe 100644
--- a/external/sh/miscbltin.c
+++ b/external/sh/miscbltin.c
@@ -36,7 +36,7 @@ static char sccsid[] = "@(#)miscbltin.c 8.4 (Berkeley) 5/4/95";
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/bin/sh/miscbltin.c 296723 2016-03-12 14:54:34Z kib $");
+__FBSDID("$FreeBSD: head/bin/sh/miscbltin.c 301452 2016-06-05 16:09:31Z jilles $");
/*
* Miscellaneous builtins.
@@ -341,7 +341,7 @@ umaskcmd(int argc __unused, char **argv __unused)
} else {
void *set;
INTOFF;
- if ((set = setmode (ap)) == 0)
+ if ((set = setmode (ap)) == NULL)
error("Illegal number: %s", ap);
mask = getmode (set, ~mask & 0777);
@@ -406,7 +406,7 @@ static const struct limits limits[] = {
{ "swap limit", "kbytes", RLIMIT_SWAP, 1024, 'w' },
#endif
#ifdef RLIMIT_SBSIZE
- { "sbsize", "bytes", RLIMIT_SBSIZE, 1, 'b' },
+ { "socket buffer size", "bytes", RLIMIT_SBSIZE, 1, 'b' },
#endif
#ifdef RLIMIT_NPTS
{ "pseudo-terminals", (char *)0, RLIMIT_NPTS, 1, 'p' },
@@ -415,7 +415,7 @@ static const struct limits limits[] = {
{ "kqueues", (char *)0, RLIMIT_KQUEUES, 1, 'k' },
#endif
#ifdef RLIMIT_UMTXP
- { "umtxp", (char *)0, RLIMIT_UMTXP, 1, 'o' },
+ { "umtx shared locks", (char *)0, RLIMIT_UMTXP, 1, 'o' },
#endif
{ (char *) 0, (char *)0, 0, 0, '\0' }
};
diff --git a/external/sh/parser.c b/external/sh/parser.c
index 81079b40..3dc0d15a 100644
--- a/external/sh/parser.c
+++ b/external/sh/parser.c
@@ -36,7 +36,7 @@ static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/16/95";
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/bin/sh/parser.c 296327 2016-03-02 22:52:54Z jilles $");
+__FBSDID("$FreeBSD: head/bin/sh/parser.c 301139 2016-06-01 16:56:29Z truckman $");
#include <stdlib.h>
#include <unistd.h>
@@ -628,7 +628,7 @@ simplecmd(union node **rpp, union node *redir)
/* If we don't have any redirections already, then we must reset */
/* rpp to be the address of the local redir variable. */
- if (redir == 0)
+ if (redir == NULL)
rpp = &redir;
args = NULL;
@@ -1610,13 +1610,11 @@ endword:
*/
parsesub: {
- char buf[10];
int subtype;
int typeloc;
int flags;
char *p;
static const char types[] = "}-+?=";
- int bracketed_name = 0; /* used to handle ${[0-9]*} variables */
int linno;
int length;
int c1;
@@ -1640,7 +1638,6 @@ parsesub: {
subtype = VSNORMAL;
flags = 0;
if (c == '{') {
- bracketed_name = 1;
c = pgetc_linecont();
subtype = 0;
}
@@ -1656,16 +1653,19 @@ varname:
strncmp(out - length, "LINENO", length) == 0) {
/* Replace the variable name with the
* current line number. */
+ STADJUST(-6, out);
+ CHECKSTRSPACE(11, out);
linno = plinno;
if (funclinno != 0)
linno -= funclinno - 1;
- snprintf(buf, sizeof(buf), "%d", linno);
- STADJUST(-6, out);
- STPUTS(buf, out);
+ length = snprintf(out, 11, "%d", linno);
+ if (length > 10)
+ length = 10;
+ out += length;
flags |= VSLINENO;
}
} else if (is_digit(c)) {
- if (bracketed_name) {
+ if (subtype != VSNORMAL) {
do {
STPUTC(c, out);
c = pgetc_linecont();
@@ -1998,7 +1998,7 @@ getprompt(void *unused __unused)
/*
* Format prompt string.
*/
- for (i = 0; (i < 127) && (*fmt != '\0'); i++, fmt++)
+ for (i = 0; (i < PROMPTLEN - 1) && (*fmt != '\0'); i++, fmt++)
if (*fmt == '\\')
switch (*++fmt) {
@@ -2011,11 +2011,13 @@ getprompt(void *unused __unused)
case 'h':
case 'H':
ps[i] = '\0';
- gethostname(&ps[i], PROMPTLEN - i);
+ gethostname(&ps[i], PROMPTLEN - i - 1);
+ ps[PROMPTLEN - 1] = '\0';
/* Skip to end of hostname. */
trim = (*fmt == 'h') ? '.' : '\0';
- while ((ps[i+1] != '\0') && (ps[i+1] != trim))
+ while ((ps[i] != '\0') && (ps[i] != trim))
i++;
+ --i;
break;
/*
@@ -2027,7 +2029,7 @@ getprompt(void *unused __unused)
case 'W':
case 'w':
pwd = lookupvar("PWD");
- if (pwd == NULL)
+ if (pwd == NULL || *pwd == '\0')
pwd = "?";
if (*fmt == 'W' &&
*pwd == '/' && pwd[1] != '\0')
@@ -2060,8 +2062,9 @@ getprompt(void *unused __unused)
* Emit unrecognized formats verbatim.
*/
default:
- ps[i++] = '\\';
- ps[i] = *fmt;
+ ps[i] = '\\';
+ if (i < PROMPTLEN - 2)
+ ps[++i] = *fmt;
break;
}
else
diff --git a/external/sh/test.c b/external/sh/test.c
index 05d0631f..518846a6 100644
--- a/external/sh/test.c
+++ b/external/sh/test.c
@@ -15,7 +15,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/bin/test/test.c 295082 2016-01-30 19:59:58Z jilles $");
+__FBSDID("$FreeBSD: head/bin/test/test.c 298232 2016-04-19 00:38:07Z araujo $");
#include <sys/types.h>
#include <sys/stat.h>
@@ -465,7 +465,7 @@ t_lex(char *s)
{
int num;
- if (s == 0) {
+ if (s == NULL) {
return EOI;
}
num = find_op(s);
diff --git a/external/sh/trap.c b/external/sh/trap.c
index a5a9c6b2..f8f404fe 100644
--- a/external/sh/trap.c
+++ b/external/sh/trap.c
@@ -36,7 +36,7 @@ static char sccsid[] = "@(#)trap.c 8.5 (Berkeley) 6/5/95";
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/bin/sh/trap.c 281718 2015-04-18 23:49:57Z bdrewery $");
+__FBSDID("$FreeBSD: head/bin/sh/trap.c 297360 2016-03-28 18:58:40Z jilles $");
#include <signal.h>
#include <unistd.h>
@@ -412,6 +412,7 @@ onsig(int signo)
void
dotrap(void)
{
+ struct stackmark smark;
int i;
int savestatus, prev_evalskip, prev_skipcount;
@@ -445,7 +446,9 @@ dotrap(void)
last_trapsig = i;
savestatus = exitstatus;
- evalstring(trap[i], 0);
+ setstackmark(&smark);
+ evalstring(stsavestr(trap[i]), 0);
+ popstackmark(&smark);
/*
* If such a command was not
diff --git a/external/sh/var.c b/external/sh/var.c
index 1a34c72a..5ff6d207 100644
--- a/external/sh/var.c
+++ b/external/sh/var.c
@@ -36,7 +36,7 @@ static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95";
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/bin/sh/var.c 294593 2016-01-22 20:10:08Z jilles $");
+__FBSDID("$FreeBSD: head/bin/sh/var.c 306843 2016-10-08 13:40:12Z jilles $");
#include <unistd.h>
#include <stdlib.h>
@@ -186,6 +186,7 @@ initvar(void)
}
}
setvareq_const("OPTIND=1", 0);
+ setvareq_const("IFS= \t\n", 0);
}
/*