aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2015-07-14 14:12:05 +0100
committerRon Yorston <rmy@pobox.com>2015-07-14 14:12:05 +0100
commit895a1533781ca4713ef92113ab6ac5f2584ddd9d (patch)
tree49c8602e9cd733e6f6c105e94e614b8236677853 /shell
parent535ec990c50206697852d5c25e94a959f24d86bc (diff)
parent072fc60f29ee3a4ff38f095a9ef149b2e820c8c0 (diff)
downloadbusybox-w32-895a1533781ca4713ef92113ab6ac5f2584ddd9d.tar.gz
busybox-w32-895a1533781ca4713ef92113ab6ac5f2584ddd9d.tar.bz2
busybox-w32-895a1533781ca4713ef92113ab6ac5f2584ddd9d.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c46
-rwxr-xr-x[-rw-r--r--]shell/ash_test/ash-misc/echo_write_error.tests0
-rw-r--r--shell/ash_test/ash-misc/tickquote1.right1
-rwxr-xr-xshell/ash_test/ash-misc/tickquote1.tests1
-rw-r--r--shell/hush.c3
-rw-r--r--shell/shell_common.c1
6 files changed, 6 insertions, 46 deletions
diff --git a/shell/ash.c b/shell/ash.c
index c5b9741d6..ef3f7933a 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -9888,7 +9888,6 @@ evalcommand(union node *cmd, int flags)
9888 if (evalfun(cmdentry.u.func, argc, argv, flags)) 9888 if (evalfun(cmdentry.u.func, argc, argv, flags))
9889 goto raise; 9889 goto raise;
9890 break; 9890 break;
9891
9892 } /* switch */ 9891 } /* switch */
9893 9892
9894 out: 9893 out:
@@ -10917,7 +10916,6 @@ struct heredoc {
10917}; 10916};
10918 10917
10919static smallint tokpushback; /* last token pushed back */ 10918static smallint tokpushback; /* last token pushed back */
10920static smallint parsebackquote; /* nonzero if we are inside backquotes */
10921static smallint quoteflag; /* set if (part of) last token was quoted */ 10919static smallint quoteflag; /* set if (part of) last token was quoted */
10922static token_id_t lasttoken; /* last token read (integer id Txxx) */ 10920static token_id_t lasttoken; /* last token read (integer id Txxx) */
10923static struct heredoc *heredoclist; /* list of here documents to read */ 10921static struct heredoc *heredoclist; /* list of here documents to read */
@@ -11577,19 +11575,6 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
11577 11575
11578 IF_ASH_BASH_COMPAT(smallint bash_dollar_squote = 0;) 11576 IF_ASH_BASH_COMPAT(smallint bash_dollar_squote = 0;)
11579 11577
11580#if __GNUC__
11581 /* Avoid longjmp clobbering */
11582 (void) &out;
11583 (void) &quotef;
11584 (void) &dblquote;
11585 (void) &varnest;
11586 (void) &arinest;
11587 (void) &parenlevel;
11588 (void) &dqvarnest;
11589 (void) &oldstyle;
11590 (void) &prevsyntax;
11591 (void) &syntax;
11592#endif
11593 startlinno = g_parsefile->linno; 11578 startlinno = g_parsefile->linno;
11594 bqlist = NULL; 11579 bqlist = NULL;
11595 quotef = 0; 11580 quotef = 0;
@@ -11757,7 +11742,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
11757 if (syntax == ARISYNTAX) 11742 if (syntax == ARISYNTAX)
11758 raise_error_syntax("missing '))'"); 11743 raise_error_syntax("missing '))'");
11759#endif 11744#endif
11760 if (syntax != BASESYNTAX && !parsebackquote && eofmark == NULL) 11745 if (syntax != BASESYNTAX && eofmark == NULL)
11761 raise_error_syntax("unterminated quoted string"); 11746 raise_error_syntax("unterminated quoted string");
11762 if (varnest != 0) { 11747 if (varnest != 0) {
11763 startlinno = g_parsefile->linno; 11748 startlinno = g_parsefile->linno;
@@ -12053,34 +12038,17 @@ parsesub: {
12053 */ 12038 */
12054parsebackq: { 12039parsebackq: {
12055 struct nodelist **nlpp; 12040 struct nodelist **nlpp;
12056 smallint savepbq;
12057 union node *n; 12041 union node *n;
12058 char *volatile str; 12042 char *str;
12059 struct jmploc jmploc;
12060 struct jmploc *volatile savehandler;
12061 size_t savelen; 12043 size_t savelen;
12062 smallint saveprompt = 0; 12044 smallint saveprompt = 0;
12063 12045
12064#ifdef __GNUC__
12065 (void) &saveprompt;
12066#endif
12067 savepbq = parsebackquote;
12068 if (setjmp(jmploc.loc)) {
12069 free(str);
12070 parsebackquote = 0;
12071 exception_handler = savehandler;
12072 longjmp(exception_handler->loc, 1);
12073 }
12074 INT_OFF;
12075 str = NULL; 12046 str = NULL;
12076 savelen = out - (char *)stackblock(); 12047 savelen = out - (char *)stackblock();
12077 if (savelen > 0) { 12048 if (savelen > 0) {
12078 str = ckmalloc(savelen); 12049 str = alloca(savelen);
12079 memcpy(str, stackblock(), savelen); 12050 memcpy(str, stackblock(), savelen);
12080 } 12051 }
12081 savehandler = exception_handler;
12082 exception_handler = &jmploc;
12083 INT_ON;
12084 if (oldstyle) { 12052 if (oldstyle) {
12085 /* We must read until the closing backquote, giving special 12053 /* We must read until the closing backquote, giving special
12086 * treatment to some slashes, and then push the string and 12054 * treatment to some slashes, and then push the string and
@@ -12151,7 +12119,6 @@ parsebackq: {
12151 nlpp = &(*nlpp)->next; 12119 nlpp = &(*nlpp)->next;
12152 *nlpp = stzalloc(sizeof(**nlpp)); 12120 *nlpp = stzalloc(sizeof(**nlpp));
12153 /* (*nlpp)->next = NULL; - stzalloc did it */ 12121 /* (*nlpp)->next = NULL; - stzalloc did it */
12154 parsebackquote = oldstyle;
12155 12122
12156 if (oldstyle) { 12123 if (oldstyle) {
12157 saveprompt = doprompt; 12124 saveprompt = doprompt;
@@ -12180,13 +12147,7 @@ parsebackq: {
12180 if (str) { 12147 if (str) {
12181 memcpy(out, str, savelen); 12148 memcpy(out, str, savelen);
12182 STADJUST(savelen, out); 12149 STADJUST(savelen, out);
12183 INT_OFF;
12184 free(str);
12185 str = NULL;
12186 INT_ON;
12187 } 12150 }
12188 parsebackquote = savepbq;
12189 exception_handler = savehandler;
12190 USTPUTC(CTLBACKQ, out); 12151 USTPUTC(CTLBACKQ, out);
12191 if (oldstyle) 12152 if (oldstyle)
12192 goto parsebackq_oldreturn; 12153 goto parsebackq_oldreturn;
@@ -12206,7 +12167,6 @@ parsearith: {
12206 goto parsearith_return; 12167 goto parsearith_return;
12207} 12168}
12208#endif 12169#endif
12209
12210} /* end of readtoken */ 12170} /* end of readtoken */
12211 12171
12212/* 12172/*
diff --git a/shell/ash_test/ash-misc/echo_write_error.tests b/shell/ash_test/ash-misc/echo_write_error.tests
index 0a40c9ff7..0a40c9ff7 100644..100755
--- a/shell/ash_test/ash-misc/echo_write_error.tests
+++ b/shell/ash_test/ash-misc/echo_write_error.tests
diff --git a/shell/ash_test/ash-misc/tickquote1.right b/shell/ash_test/ash-misc/tickquote1.right
new file mode 100644
index 000000000..2e661bfe3
--- /dev/null
+++ b/shell/ash_test/ash-misc/tickquote1.right
@@ -0,0 +1 @@
./tickquote1.tests: line 1: syntax error: unterminated quoted string
diff --git a/shell/ash_test/ash-misc/tickquote1.tests b/shell/ash_test/ash-misc/tickquote1.tests
new file mode 100755
index 000000000..90d5bbc9b
--- /dev/null
+++ b/shell/ash_test/ash-misc/tickquote1.tests
@@ -0,0 +1 @@
echo `"pwd`
diff --git a/shell/hush.c b/shell/hush.c
index f2c0a70f2..3ca04494c 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -442,7 +442,7 @@ enum {
442 MAYBE_ASSIGNMENT = 0, 442 MAYBE_ASSIGNMENT = 0,
443 DEFINITELY_ASSIGNMENT = 1, 443 DEFINITELY_ASSIGNMENT = 1,
444 NOT_ASSIGNMENT = 2, 444 NOT_ASSIGNMENT = 2,
445 /* Not an assigment, but next word may be: "if v=xyz cmd;" */ 445 /* Not an assignment, but next word may be: "if v=xyz cmd;" */
446 WORD_IS_KEYWORD = 3, 446 WORD_IS_KEYWORD = 3,
447}; 447};
448/* Used for initialization: o_string foo = NULL_O_STRING; */ 448/* Used for initialization: o_string foo = NULL_O_STRING; */
@@ -5390,7 +5390,6 @@ static NOINLINE int expand_vars_to_list(o_string *output, int n, char *arg)
5390 !!(output->o_expflags & EXP_FLAG_ESC_GLOB_CHARS)); 5390 !!(output->o_expflags & EXP_FLAG_ESC_GLOB_CHARS));
5391 } 5391 }
5392 break; 5392 break;
5393
5394 } /* switch (char after <SPECIAL_VAR_SYMBOL>) */ 5393 } /* switch (char after <SPECIAL_VAR_SYMBOL>) */
5395 5394
5396 if (val && val[0]) { 5395 if (val && val[0]) {
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 2244a3c97..1567d1de4 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -500,7 +500,6 @@ shell_builtin_ulimit(char **argv)
500 /* bad option. getopt already complained. */ 500 /* bad option. getopt already complained. */
501 break; 501 break;
502 } 502 }
503
504 } /* while (there are options) */ 503 } /* while (there are options) */
505 504
506 return 0; 505 return 0;