aboutsummaryrefslogtreecommitdiff
path: root/shell/hush_test/hush-heredoc (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ash: fix ifs cleanup on error pathsDenys Vlasenko2022-08-022-0/+10
| | | | | | | | | | | | | Patch by Alex Gorinson <algore3698@gmail.com> function old new delta evalvar 477 495 +18 varvalue 603 618 +15 subevalvar 1557 1572 +15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 48/0) Total: 48 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: add "heredoc.tests" from ash, tweak ash "is a function" messageDenys Vlasenko2018-07-242-0/+117
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix nested redirects colliding with script fdsDenys Vlasenko2018-07-242-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This necessitates switch from libc FILE api to a simple homegrown replacement. The change which fixes the bug here is the deleting of restore_redirected_FILEs(); line. It was prematurely moving (restoring) script fd#3. The fix is: we don't even _want_ to restore scrit fds, we are perfectly fine with them being moved. The only reason we tried to restore them is that FILE api did not allow moving of FILE->fd. function old new delta refill_HFILE_and_getc - 93 +93 hfopen - 90 +90 hfclose - 66 +66 pseudo_exec_argv 591 597 +6 hush_main 1089 1095 +6 builtin_source 209 214 +5 save_fd_on_redirect 197 200 +3 setup_redirects 320 321 +1 fgetc_interactive 235 236 +1 i_peek_and_eat_bkslash_nl 99 97 -2 expand_vars_to_list 1103 1100 -3 restore_redirects 99 52 -47 fclose_and_forget 57 - -57 remember_FILE 63 - -63 ------------------------------------------------------------------------------ (add/remove: 3/2 grow/shrink: 6/3 up/down: 271/-172) Total: 99 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: handle backslash-newline in heredoc terminatorsDenys Vlasenko2018-07-242-0/+5
| | | | | | | | | function old new delta fetch_heredocs 479 527 +48 (ash fails this test) Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix handling of heredocs not enclosed in groups where they are "declared"Denys Vlasenko2018-07-244-0/+20
| | | | | | | | | | | function old new delta fetch_heredocs - 479 +479 parse_and_run_stream 146 148 +2 parse_stream 2787 2296 -491 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 481/-491) Total: -10 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix heredoc handling in the "cmd <<EOF ;<newline>" caseDenys Vlasenko2018-07-234-0/+15
| | | | | | | function old new delta parse_stream 2759 2787 +28 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix handling of heredocs starting with empty linesDenys Vlasenko2018-07-232-0/+6
| | | | | | | function old new delta parse_stream 2748 2759 +11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: add a comment where we differ from bash wrt heredoc EOF mark handlingDenys Vlasenko2018-04-012-15/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* parser: Fix backquote support in here-document EOF markDenys Vlasenko2018-04-012-0/+15
| | | | | | | | | | | | | | | | | | | | Upstream commit: Author: Herbert Xu <herbert@gondor.apana.org.au> Date: Thu Mar 15 18:27:30 2018 +0800 parser: Fix backquote support in here-document EOF mark Currently using backquotes in a here-document EOF mark is broken because dash tries to do command substitution on it. This patch fixes it by checking whether we're looking for an EOF mark during tokenisation. Reported-by: Harald van Dijk <harald@gigawatt.nl> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> With added fix for quoted-ness of the EOF mark. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: use pgetc_eatbnl() in more placesDenys Vlasenko2018-03-312-0/+33
| | | | | | | | | | | | | | | | | | | | | Part of upstream commit: Date: Thu Mar 8 08:37:11 2018 +0100 Author: Harald van Dijk <harald@gigawatt.nl> parser: use pgetc_eatbnl() in more places dash has a pgetc_eatbnl function in parser.c which skips any backslash-newline combinations. It's not used everywhere it could be. There is also some duplicated backslash-newline handling elsewhere in parser.c. Replace most of the calls to pgetc() with calls to pgetc_eatbnl() and remove the duplicated backslash-newline handling. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Not adding "readtoken1(pgetc_eatbnl(), DQSYNTAX..." changes, since readtoken1() handles the "starts with backslash + newline" case itself. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix handling of empty heredoc EOF markerDenys Vlasenko2017-07-292-0/+18
| | | | | | | function old new delta parse_stream 2609 2634 +25 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell: syncronize ash and hush heredoc1.testsDenys Vlasenko2017-07-062-0/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: [PARSER] Recognise here-doc delimiters terminated by EOFDenys Vlasenko2016-10-264-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream commit 1: Date: Wed, 26 Sep 2007 17:14:16 +0800 [PARSER] Recognise here-doc delimiters terminated by EOF Previously dash required a <newline> character to be present in order for a here-document delimiter to be detected. Allowing EOF in the absence of a <newline> to play the same purpose allows some intuitive scripts to succeed. POSIX seems to be silence on this so this should be OK. Test case: eval 'cat <<- NOT test NOT' echo OK Old result: test NOTOK New result: test OK Upstream commit 2: Date: Sat, 20 Oct 2007 18:49:31 +0800 [PARSER] Fix here-doc corruption The change [PARSER] Recognise here-doc delimiters terminated by EOF introduced a regerssion whereby lines starting with eofmark but are not equal to eofmark would be corrupted. This patch fixes it. Test case: cat << _ACEOF _ASBOX _ACEOF Old result: SASBOX New result: _ASBOX Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sh testsuite: create hush-heredoc/* and move files aroundDenys Vlasenko2016-10-0214-0/+194
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>