Home | History | Annotate | Download | only in sh
History log of /src/tests/bin/sh/t_here.sh
RevisionDateAuthorComments
 1.9  22-Nov-2021  kre PR bin/53550

/bin/sh's processing of here doc expansions has changed. Now it happens
in the context of the parent shell, so side effects are visible there,
just like all other redirection expansions.

We need to stop testing that that doesn't happen, and instead test
that it does. This is that change.

Add another test case which is testing exactly the example from the PR
(well, with a different exit status, 1 is too generic and could happen
by accident) to make sure we don't reintroduce that bug sometime.
 1.8  09-Sep-2021  kre Add a new test case to check for correct parsing and execution
of a few bizarre here document usages, such as

: << do | for x in xxx
do
do echo $x
done

which should work, but never have done. (See the source for others).

This test case will currently fail, until the bug is fixed
(already done, to be committed very soon).
 1.7  22-Jan-2019  kre Add sub tests to the quoting test case, to demonstrate a parsing
bug (and its fix (depending upon whether the test is run against
an unfixed, or fixed, shell).

An obvious indication of the failure is the following (one of the
new sub-tests)

p=A
cat <<EOF
${p+\%$p\%}
${p+%$p%}
EOF

which should output

\%A\%
%A%


as a here doc is treated as a double quoted string, except
that the " character is just a character. In such a string,
the \ is only an escape character when the following character
is special, otherwise it represents a literal \ (which is the
case here).

An unfixed shell will omit the backslashes in the output.

It gets even more wrong if the % chars are replaced by "
(double quote) chars, which should make no difference, other
than the corresponding change, in the output. But doesn't
(it doesn't even produce output broken in a similar way).

This one is a harder case to be specific about however,
as while the fixed (and expected in the test) output is what
is technically correct, only a few shells actually produce
it, most generate something different (but not all the same.)
 1.6  31-Mar-2016  christos branches: 1.6.14; 1.6.16;
Added lots more end delimiter tests (some weird cases...). Also
use printf %s instead of echo, as there are embedded \ chars in
some of the strings, and some other (nameless) shells insist on
treating \ in the args to echo as something special... (from kre@)
 1.5  27-Mar-2016  christos PR bin/50993 - lots of new here document tests to validate all of
the changes made to fix that PR. LOTS more tests... A few general
improvements to the way the tests work and results are reported
as well. (from kre@)
 1.4  08-Mar-2016  christos Cleanup left over (dead) debugging code (from kre)
 1.3  01-Mar-2016  christos Improved handling of TEST_SH so that it is possible to define it
to the name of a shell, plus options that shell needs to run it
in the correct mode to be tested: eg: TEST_SH='bash -o posix'
Also finished the implementation of tests of "set -n" now that
the NetBSD shell supports that as it should. (from kre)
 1.2  29-Feb-2016  christos more tests from kre
 1.1  17-Mar-2012  jruoho branches: 1.1.2;
Deprecate tests/util.
 1.1.2.2  17-Apr-2012  yamt sync with head
 1.1.2.1  17-Mar-2012  yamt file t_here.sh was added on branch yamt-pagecache on 2012-04-17 00:09:02 +0000
 1.6.16.1  10-Jun-2019  christos Sync with HEAD
 1.6.14.1  26-Jan-2019  pgoyette Sync with HEAD

RSS XML Feed