mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-25 10:03:03 +01:00
53 lines
1.9 KiB
Diff
53 lines
1.9 KiB
Diff
Fix for `Bug#219343 backslash is swallowed in HERE document' from OpenBSD:
|
|
* exec.c (1.42), lex.c (1.37), lex.h (1.10): Fix " handling in here
|
|
documents. POSIX says they are not special, so cat << EOF \" EOF
|
|
should print \" Fixes PR 4472; testing jmc@ and Adam Montague. ok
|
|
(from OpenBSD)
|
|
|
|
Index: pdksh-5.2.14/exec.c
|
|
===================================================================
|
|
--- pdksh-5.2.14.orig/exec.c 2009-09-17 00:32:31.000000000 +0200
|
|
+++ pdksh-5.2.14/exec.c 2009-09-17 00:32:59.000000000 +0200
|
|
@@ -1480,7 +1480,7 @@
|
|
s = pushs(SSTRING, ATEMP);
|
|
s->start = s->str = content;
|
|
source = s;
|
|
- if (yylex(ONEWORD) != LWORD)
|
|
+ if (yylex(ONEWORD|HEREDOC) != LWORD)
|
|
internal_errorf(1, "herein: yylex");
|
|
source = osource;
|
|
shf_puts(evalstr(yylval.cp, 0), shf);
|
|
Index: pdksh-5.2.14/lex.c
|
|
===================================================================
|
|
--- pdksh-5.2.14.orig/lex.c 2009-09-17 00:32:52.000000000 +0200
|
|
+++ pdksh-5.2.14/lex.c 2009-09-17 00:32:59.000000000 +0200
|
|
@@ -240,10 +240,16 @@
|
|
case '\\':
|
|
c = getsc();
|
|
switch (c) {
|
|
- case '"': case '\\':
|
|
+ case '\\':
|
|
case '$': case '`':
|
|
*wp++ = QCHAR, *wp++ = c;
|
|
break;
|
|
+ case '"':
|
|
+ if ((cf & HEREDOC) == 0) {
|
|
+ *wp++ = QCHAR, *wp++ = c;
|
|
+ break;
|
|
+ }
|
|
+ /* FALLTROUGH */
|
|
default:
|
|
Xcheck(ws, wp);
|
|
if (c) { /* trailing \ is lost */
|
|
Index: pdksh-5.2.14/lex.h
|
|
===================================================================
|
|
--- pdksh-5.2.14.orig/lex.h 2009-09-17 00:31:55.000000000 +0200
|
|
+++ pdksh-5.2.14/lex.h 2009-09-17 00:32:59.000000000 +0200
|
|
@@ -113,6 +113,7 @@
|
|
#define ESACONLY BIT(7) /* only accept esac keyword */
|
|
#define CMDWORD BIT(8) /* parsing simple command (alias related) */
|
|
#define HEREDELIM BIT(9) /* parsing <<,<<- delimiter */
|
|
+#define HEREDOC BIT(10) /* parsing heredoc */
|
|
|
|
#define HERES 10 /* max << in line */
|
|
|