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-05-26 23:17:10 +0300
committerBryan Drewery <bryan@shatow.net>2017-05-26 23:17:10 +0300
commit8a57d14e8368135e97462739fd14b942fd501ad1 (patch)
treecb0de800a96bf379183a3ebae8d40164bbd6f7ee /external
parenteb4c6db0909b1c1eda509621df964983c43d342d (diff)
Update sh from FreeBSD head @ r318502
Diffstat (limited to 'external')
-rw-r--r--external/sh/eval.c10
-rw-r--r--external/sh/expand.c13
-rw-r--r--external/sh/output.c31
-rw-r--r--external/sh/output.h6
4 files changed, 31 insertions, 29 deletions
diff --git a/external/sh/eval.c b/external/sh/eval.c
index e7598b6c..c7e8b17e 100644
--- a/external/sh/eval.c
+++ b/external/sh/eval.c
@@ -36,7 +36,7 @@ static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95";
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/bin/sh/eval.c 317882 2017-05-06 13:28:42Z jilles $");
+__FBSDID("$FreeBSD: head/bin/sh/eval.c 318501 2017-05-18 21:44:14Z jilles $");
#include <paths.h>
#include <signal.h>
@@ -1080,9 +1080,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
#endif
mode = (cmdentry.u.index == EXECCMD)? 0 : REDIR_PUSH;
if (flags == EV_BACKCMD) {
- memout.nleft = 0;
memout.nextc = memout.buf;
- memout.bufsize = 64;
mode |= REDIR_BACKQ;
}
savecmdname = commandname;
@@ -1134,8 +1132,12 @@ cmddone:
exitshell(exitstatus);
if (flags == EV_BACKCMD) {
backcmd->buf = memout.buf;
- backcmd->nleft = memout.nextc - memout.buf;
+ backcmd->nleft = memout.buf != NULL ?
+ memout.nextc - memout.buf : 0;
memout.buf = NULL;
+ memout.nextc = NULL;
+ memout.bufend = NULL;
+ memout.bufsize = 64;
}
if (cmdentry.u.index != EXECCMD)
popredir();
diff --git a/external/sh/expand.c b/external/sh/expand.c
index 5884230c..7a31c959 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 317882 2017-05-06 13:28:42Z jilles $");
+__FBSDID("$FreeBSD: head/bin/sh/expand.c 318269 2017-05-14 13:14:19Z jilles $");
#include <sys/types.h>
#include <sys/time.h>
@@ -440,8 +440,15 @@ expari(const char *p, struct nodelist **restrict argbackq, int flag,
fmtstr(expdest, DIGITS(result), ARITH_FORMAT_STR, result);
adj = strlen(expdest);
STADJUST(adj, expdest);
- if (!quoted)
- reprocess(expdest - adj - stackblock(), flag, VSNORMAL, 0, dst);
+ /*
+ * If this is quoted, a '-' must not indicate a range in [...].
+ * If this is not quoted, splitting may occur.
+ */
+ if (quoted ?
+ result < 0 && begoff > 1 && flag & (EXP_GLOB | EXP_CASE) :
+ flag & EXP_SPLIT)
+ reprocess(expdest - adj - stackblock(), flag, VSNORMAL, quoted,
+ dst);
return p;
}
diff --git a/external/sh/output.c b/external/sh/output.c
index d55c6d0a..3eb2fa39 100644
--- a/external/sh/output.c
+++ b/external/sh/output.c
@@ -36,7 +36,7 @@ static char sccsid[] = "@(#)output.c 8.2 (Berkeley) 5/4/95";
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/bin/sh/output.c 314436 2017-02-28 23:42:47Z imp $");
+__FBSDID("$FreeBSD: head/bin/sh/output.c 318502 2017-05-18 22:10:04Z jilles $");
/*
* Shell output routines. We use our own output routines because:
@@ -71,9 +71,9 @@ __FBSDID("$FreeBSD: head/bin/sh/output.c 314436 2017-02-28 23:42:47Z imp $");
static int doformat_wr(void *, const char *, int);
-struct output output = {NULL, 0, NULL, OUTBUFSIZ, 1, 0};
-struct output errout = {NULL, 0, NULL, 256, 2, 0};
-struct output memout = {NULL, 0, NULL, 0, MEM_OUT, 0};
+struct output output = {NULL, NULL, NULL, OUTBUFSIZ, 1, 0};
+struct output errout = {NULL, NULL, NULL, 256, 2, 0};
+struct output memout = {NULL, NULL, NULL, 64, MEM_OUT, 0};
struct output *out1 = &output;
struct output *out2 = &errout;
@@ -208,26 +208,26 @@ outbin(const void *data, size_t len, struct output *file)
void
emptyoutbuf(struct output *dest)
{
- int offset;
+ int offset, newsize;
if (dest->buf == NULL) {
INTOFF;
dest->buf = ckmalloc(dest->bufsize);
dest->nextc = dest->buf;
- dest->nleft = dest->bufsize;
+ dest->bufend = dest->buf + dest->bufsize;
INTON;
} else if (dest->fd == MEM_OUT) {
- offset = dest->bufsize;
+ offset = dest->nextc - dest->buf;
+ newsize = dest->bufsize << 1;
INTOFF;
- dest->bufsize <<= 1;
- dest->buf = ckrealloc(dest->buf, dest->bufsize);
- dest->nleft = dest->bufsize - offset;
+ dest->buf = ckrealloc(dest->buf, newsize);
+ dest->bufsize = newsize;
+ dest->bufend = dest->buf + newsize;
dest->nextc = dest->buf + offset;
INTON;
} else {
flushout(dest);
}
- dest->nleft--;
}
@@ -248,20 +248,13 @@ flushout(struct output *dest)
if (xwrite(dest->fd, dest->buf, dest->nextc - dest->buf) < 0)
dest->flags |= OUTPUT_ERR;
dest->nextc = dest->buf;
- dest->nleft = dest->bufsize;
}
void
freestdout(void)
{
- INTOFF;
- if (output.buf) {
- ckfree(output.buf);
- output.buf = NULL;
- output.nleft = 0;
- }
- INTON;
+ output.nextc = output.buf;
}
diff --git a/external/sh/output.h b/external/sh/output.h
index f3f90df9..0bbb06cb 100644
--- a/external/sh/output.h
+++ b/external/sh/output.h
@@ -30,7 +30,7 @@
* SUCH DAMAGE.
*
* @(#)output.h 8.2 (Berkeley) 5/4/95
- * $FreeBSD: head/bin/sh/output.h 314436 2017-02-28 23:42:47Z imp $
+ * $FreeBSD: head/bin/sh/output.h 318385 2017-05-16 21:54:51Z jilles $
*/
#ifndef OUTPUT_INCL
@@ -40,7 +40,7 @@
struct output {
char *nextc;
- int nleft;
+ char *bufend;
char *buf;
int bufsize;
short fd;
@@ -75,7 +75,7 @@ void fmtstr(char *, int, const char *, ...) __printflike(3, 4);
void doformat(struct output *, const char *, va_list) __printflike(2, 0);
int xwrite(int, const char *, int);
-#define outc(c, file) (--(file)->nleft < 0? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))
+#define outc(c, file) ((file)->nextc == (file)->bufend ? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))
#define out1c(c) outc(c, out1);
#define out2c(c) outcslow(c, out2);