Re: Alias/heredoc/cmdsubst regression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Op 25-01-20 om 02:38 schreef Harald van Dijk:
[...]
Nice find.

Thanks, but I can't take credit for being particularly astute here. The modernish loop construct (including the 'find' utility being fully integrated into the shell as 'LOOP find <var> [ in <path> ... ] [ <find-expression> ]; DO ... DONE' -- check it out!) is based on a triplet of aliases that define a block using { ... }, so it was only a matter of time before this bug simply bit me.

Thanks for the analysis. It made it trivial to patch. I hope Herbert agrees.

There is another place that parseheredoc() can be called from where checkkwd was not being corrected afterwards:

   alias BEGIN='{' END='}'
   : <<EOF &&
   $(echo hi)
   EOF
   BEGIN
   echo ok
   END

This has been failing for longer. This prints "Syntax error: "(" unexpected" since at least 0.5.1.

Interesting. For me, this one prints (on dash 0.5.7 until current):
testalias2.sh: 5: testalias2.sh: {: not found
ok
testalias2.sh: 7: testalias2.sh: Syntax error: "}" unexpected

But anyway, thank you for this second test case. Time to add a bug detection ID (BUG_ALIASHDOC) and couple of regression tests with these two test cases to modernish -- and document that here-docs containing command substitutions that are lexically within modernish loops won't be portable for another five years or so. :/

It's unfortunate dash still doesn't have a regression test suite (Herbert never responded to my question, just over a year ago, if he would consider a patch to add one), but modernish regress-tests all the shells it will run on, so 'dash bin/modernish --test' can fulfil that function.

- M.

--
modernish -- harness the shell
https://github.com/modernish/modernish



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux