aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-04-01 18:55:00 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2018-04-01 18:55:00 +0200
commitbb6f573ad204887e2447a40628efd98f334fb520 (patch)
treeb088b3516d3e5662563657a0818016741f643034
parent41fddb43729373740bfba82da83373ec5ba49fc8 (diff)
downloadbusybox-w32-bb6f573ad204887e2447a40628efd98f334fb520.tar.gz
busybox-w32-bb6f573ad204887e2447a40628efd98f334fb520.tar.bz2
busybox-w32-bb6f573ad204887e2447a40628efd98f334fb520.zip
hush: add a comment where we differ from bash wrt heredoc EOF mark handling
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/hush.c8
-rw-r--r--shell/hush_test/hush-heredoc/heredoc_backquote1.right5
-rwxr-xr-xshell/hush_test/hush-heredoc/heredoc_backquote1.tests10
3 files changed, 8 insertions, 15 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 4b8641d19..1921932d1 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -3861,6 +3861,13 @@ static int done_word(o_string *word, struct parse_context *ctx)
3861 * shell may perform it, but shall do so only when 3861 * shell may perform it, but shall do so only when
3862 * the expansion would result in one word." 3862 * the expansion would result in one word."
3863 */ 3863 */
3864//bash does not do parameter/command substitution or arithmetic expansion
3865//for _heredoc_ redirection word: these constructs look for exact eof marker
3866// as written:
3867// <<EOF$t
3868// <<EOF$((1))
3869// <<EOF`true` [this case also makes heredoc "quoted", a-la <<"EOF"]
3870//This contradicts the above docs.
3864 ctx->pending_redirect->rd_filename = xstrdup(word->data); 3871 ctx->pending_redirect->rd_filename = xstrdup(word->data);
3865 /* Cater for >\file case: 3872 /* Cater for >\file case:
3866 * >\a creates file a; >\\a, >"\a", >"\\a" create file \a 3873 * >\a creates file a; >\\a, >"\a", >"\\a" create file \a
@@ -4228,6 +4235,7 @@ static int fetch_heredocs(int heredoc_cnt, struct parse_context *ctx, struct in_
4228 4235
4229 redir->rd_type = REDIRECT_HEREDOC2; 4236 redir->rd_type = REDIRECT_HEREDOC2;
4230 /* redir->rd_dup is (ab)used to indicate <<- */ 4237 /* redir->rd_dup is (ab)used to indicate <<- */
4238bb_error_msg("redir->rd_filename:'%s'", redir->rd_filename);
4231 p = fetch_till_str(&ctx->as_string, input, 4239 p = fetch_till_str(&ctx->as_string, input,
4232 redir->rd_filename, redir->rd_dup); 4240 redir->rd_filename, redir->rd_dup);
4233 if (!p) { 4241 if (!p) {
diff --git a/shell/hush_test/hush-heredoc/heredoc_backquote1.right b/shell/hush_test/hush-heredoc/heredoc_backquote1.right
deleted file mode 100644
index 0be2a3296..000000000
--- a/shell/hush_test/hush-heredoc/heredoc_backquote1.right
+++ /dev/null
@@ -1,5 +0,0 @@
1heredoc1
2Ok1:0
3heredoc2
4EO`false`F
5Ok2:0
diff --git a/shell/hush_test/hush-heredoc/heredoc_backquote1.tests b/shell/hush_test/hush-heredoc/heredoc_backquote1.tests
deleted file mode 100755
index ec3d8fe1d..000000000
--- a/shell/hush_test/hush-heredoc/heredoc_backquote1.tests
+++ /dev/null
@@ -1,10 +0,0 @@
1cat <<EO`true`F
2heredoc1
3EO`true`F
4echo Ok1:$?
5
6cat <<EO`true`F
7heredoc2
8EO`false`F
9EO`true`F
10echo Ok2:$?