diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-04-01 18:55:00 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-04-01 18:55:00 +0200 |
| commit | bb6f573ad204887e2447a40628efd98f334fb520 (patch) | |
| tree | b088b3516d3e5662563657a0818016741f643034 /shell | |
| parent | 41fddb43729373740bfba82da83373ec5ba49fc8 (diff) | |
| download | busybox-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>
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/hush.c | 8 | ||||
| -rw-r--r-- | shell/hush_test/hush-heredoc/heredoc_backquote1.right | 5 | ||||
| -rwxr-xr-x | shell/hush_test/hush-heredoc/heredoc_backquote1.tests | 10 |
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 <<- */ |
| 4238 | bb_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 @@ | |||
| 1 | heredoc1 | ||
| 2 | Ok1:0 | ||
| 3 | heredoc2 | ||
| 4 | EO`false`F | ||
| 5 | Ok2: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 @@ | |||
| 1 | cat <<EO`true`F | ||
| 2 | heredoc1 | ||
| 3 | EO`true`F | ||
| 4 | echo Ok1:$? | ||
| 5 | |||
| 6 | cat <<EO`true`F | ||
| 7 | heredoc2 | ||
| 8 | EO`false`F | ||
| 9 | EO`true`F | ||
| 10 | echo Ok2:$? | ||
