diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2018-07-14 21:03:06 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2018-07-14 21:03:06 +0100 |
commit | 8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch) | |
tree | 7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-shells/dash/files | |
parent | 30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff) |
gentoo resync : 14.07.2018
Diffstat (limited to 'app-shells/dash/files')
-rw-r--r-- | app-shells/dash/files/dash-0.5.10-dumb-echo.patch | 92 | ||||
-rw-r--r-- | app-shells/dash/files/dash-0.5.10.1-parser.patch | 66 | ||||
-rw-r--r-- | app-shells/dash/files/dash-0.5.9.1-dumb-echo.patch | 92 | ||||
-rw-r--r-- | app-shells/dash/files/dash-0.5.9.1-format-security.patch | 13 |
4 files changed, 263 insertions, 0 deletions
diff --git a/app-shells/dash/files/dash-0.5.10-dumb-echo.patch b/app-shells/dash/files/dash-0.5.10-dumb-echo.patch new file mode 100644 index 000000000000..35d324609302 --- /dev/null +++ b/app-shells/dash/files/dash-0.5.10-dumb-echo.patch @@ -0,0 +1,92 @@ +http://bugs.gentoo.org/337329 +http://bugs.gentoo.org/527848 + +there's no requirement for `echo` to support escape sequences. bash, by default, +does not, while dash always does. POSIX permits either behavior: +http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html + +however, since the behavior is not portable, no one should be relying on echo +having any specific behavior. they should use `printf` when they want an escape +sequence. it also makes dash smaller & faster to disable this logic entirely. + +--- dash-0.5.10/src/bltin/printf.c ++++ dash-0.5.10/src/bltin/printf.c +@@ -457,22 +457,13 @@ + int + echocmd(int argc, char **argv) + { +- const char *lastfmt = snlfmt; +- int nonl; ++ int i; + +- if (*++argv && equal(*argv, "-n")) { +- argv++; +- lastfmt = "%s"; ++ for (i = 1; i < argc; ++i) { ++ outstr(argv[i], out1); ++ if (i < argc - 1) ++ outc(' ', out1); + } +- +- do { +- const char *fmt = "%s "; +- char *s = *argv; +- +- if (!s || !*++argv) +- fmt = lastfmt; +- +- nonl = print_escape_str(fmt, NULL, NULL, s ?: nullstr); +- } while (!nonl && *argv); ++ outc('\n', out1); + return 0; + } +--- dash-0.5.10/src/dash.1 ++++ dash-0.5.10/src/dash.1 +@@ -1182,43 +1182,15 @@ + option turns off the effect of any preceding + .Fl P + options. +-.It Xo echo Op Fl n ++.It Xo echo + .Ar args... + .Xc + Print the arguments on the standard output, separated by spaces. +-Unless the +-.Fl n +-option is present, a newline is output following the arguments. + .Pp +-If any of the following sequences of characters is encountered during +-output, the sequence is not output. Instead, the specified action is +-performed: +-.Bl -tag -width indent +-.It Li \eb +-A backspace character is output. +-.It Li \ec +-Subsequent output is suppressed. This is normally used at the end of the +-last argument to suppress the trailing newline that +-.Ic echo +-would otherwise output. +-.It Li \ef +-Output a form feed. +-.It Li \en +-Output a newline character. +-.It Li \er +-Output a carriage return. +-.It Li \et +-Output a (horizontal) tab character. +-.It Li \ev +-Output a vertical tab. +-.It Li \e0 Ns Ar digits +-Output the character whose value is given by zero to three octal digits. +-If there are zero digits, a nul character is output. +-.It Li \e\e +-Output a backslash. +-.El ++No arguments or backslash sequences are supported as they are not portable. ++They will be printed out exactly as passed in. + .Pp +-All other backslash sequences elicit undefined behaviour. ++You can replace `echo -n ...` with the portable `printf %s ...` construct. + .It eval Ar string ... + Concatenate all the arguments with spaces. + Then re-parse and execute the command. diff --git a/app-shells/dash/files/dash-0.5.10.1-parser.patch b/app-shells/dash/files/dash-0.5.10.1-parser.patch new file mode 100644 index 000000000000..0939b7cb7222 --- /dev/null +++ b/app-shells/dash/files/dash-0.5.10.1-parser.patch @@ -0,0 +1,66 @@ +From 469c5fd4f57622b1a6571172898ab29430319d4a Mon Sep 17 00:00:00 2001 +From: Herbert Xu <herbert@gondor.apana.org.au> +Date: Fri, 11 May 2018 23:41:25 +0800 +Subject: parser: Fix incorrect eating of backslash newlines + +With the introduction of synstack->syntax, a number of references +to the syntax variable was missed during the conversion. This +causes backslash newlines to be incorrectly removed in single +quote context. + +This patch also combines these calls into a new helper function +pgetc_top. + +Fixes: ab1cecb40478 ("parser: Add syntax stack for recursive...") +Reported-by: Leah Neukirchen <leah@vuxu.org> +Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> +--- + src/parser.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/src/parser.c b/src/parser.c +index 8e40781..8bd3db4 100644 +--- a/src/parser.c ++++ b/src/parser.c +@@ -853,6 +853,11 @@ static int pgetc_eatbnl(void) + return c; + } + ++static int pgetc_top(struct synstack *stack) ++{ ++ return stack->syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); ++} ++ + static void synstack_push(struct synstack **stack, struct synstack *next, + const char *syntax) + { +@@ -915,7 +920,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) + attyline(); + if (synstack->syntax == BASESYNTAX) + return readtoken(); +- c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); ++ c = pgetc_top(synstack); + goto loop; + } + #endif +@@ -929,7 +934,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) + goto endword; /* exit outer loop */ + USTPUTC(c, out); + nlprompt(); +- c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); ++ c = pgetc_top(synstack); + goto loop; /* continue outer loop */ + case CWORD: + USTPUTC(c, out); +@@ -1056,7 +1061,7 @@ toggledq: + USTPUTC(c, out); + } + } +- c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); ++ c = pgetc_top(synstack); + } + } + endword: +-- +cgit v1.1 + diff --git a/app-shells/dash/files/dash-0.5.9.1-dumb-echo.patch b/app-shells/dash/files/dash-0.5.9.1-dumb-echo.patch new file mode 100644 index 000000000000..cbf5febafd19 --- /dev/null +++ b/app-shells/dash/files/dash-0.5.9.1-dumb-echo.patch @@ -0,0 +1,92 @@ +http://bugs.gentoo.org/337329 +http://bugs.gentoo.org/527848 + +there's no requirement for `echo` to support escape sequences. bash, by default, +does not, while dash always does. POSIX permits either behavior: +http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html + +however, since the behavior is not portable, no one should be relying on echo +having any specific behavior. they should use `printf` when they want an escape +sequence. it also makes dash smaller & faster to disable this logic entirely. + +--- dash-0.5.9.1/src/bltin/printf.c ++++ dash-0.5.9.1/src/bltin/printf.c +@@ -449,21 +449,12 @@ + int + echocmd(int argc, char **argv) + { +- int nonl; +- +- nonl = *++argv ? equal(*argv, "-n") : 0; +- argv += nonl; +- +- do { +- int c; +- +- if (likely(*argv)) +- nonl += print_escape_str("%s", NULL, NULL, *argv++); +- if (likely((nonl + !*argv) > 1)) +- break; +- +- c = *argv ? ' ' : '\n'; +- out1c(c); +- } while (*argv); ++ int i; ++ for (i = 1; i < argc; ++i) { ++ outstr(argv[i], out1); ++ if (i < argc - 1) ++ outc(' ', out1); ++ } ++ outc('\n', out1); + return 0; + } +--- dash-0.5.9.1/src/dash.1 ++++ dash-0.5.9.1/src/dash.1 +@@ -1182,43 +1182,15 @@ + option turns off the effect of any preceding + .Fl P + options. +-.It Xo echo Op Fl n ++.It Xo echo + .Ar args... + .Xc + Print the arguments on the standard output, separated by spaces. +-Unless the +-.Fl n +-option is present, a newline is output following the arguments. + .Pp +-If any of the following sequences of characters is encountered during +-output, the sequence is not output. Instead, the specified action is +-performed: +-.Bl -tag -width indent +-.It Li \eb +-A backspace character is output. +-.It Li \ec +-Subsequent output is suppressed. This is normally used at the end of the +-last argument to suppress the trailing newline that +-.Ic echo +-would otherwise output. +-.It Li \ef +-Output a form feed. +-.It Li \en +-Output a newline character. +-.It Li \er +-Output a carriage return. +-.It Li \et +-Output a (horizontal) tab character. +-.It Li \ev +-Output a vertical tab. +-.It Li \e0 Ns Ar digits +-Output the character whose value is given by zero to three octal digits. +-If there are zero digits, a nul character is output. +-.It Li \e\e +-Output a backslash. +-.El ++No arguments or backslash sequences are supported as they are not portable. ++They will be printed out exactly as passed in. + .Pp +-All other backslash sequences elicit undefined behaviour. ++You can replace `echo -n ...` with the portable `printf %s ...` construct. + .It eval Ar string ... + Concatenate all the arguments with spaces. + Then re-parse and execute the command. diff --git a/app-shells/dash/files/dash-0.5.9.1-format-security.patch b/app-shells/dash/files/dash-0.5.9.1-format-security.patch new file mode 100644 index 000000000000..ea2114f392b3 --- /dev/null +++ b/app-shells/dash/files/dash-0.5.9.1-format-security.patch @@ -0,0 +1,13 @@ +Origin: https://bugzilla.redhat.com/show_bug.cgi?id=1037030#c2 + +--- a/src/jobs.c ++++ a/src/jobs.c +@@ -427,7 +427,7 @@ sprint_status(char *s, int status, int sigonly) + goto out; + #endif + } +- col = fmtstr(s, 32, strsignal(st)); ++ col = fmtstr(s, 32, "%s", strsignal(st)); + #ifdef WCOREDUMP + if (WCOREDUMP(status)) { + col += fmtstr(s + col, 16, " (core dumped)"); |