Browse Source
Tighten here-doc recognition to prevent it from being fooled by text which looks like a here-doc operator but happens merely to be the content of a string, such as this real-world case from t7201: echo "<<<<<<< ours" && echo ourside && echo "=======" && echo theirside && echo ">>>>>>> theirs" This problem went unnoticed because chainlint.sed is not a real parser, but rather applies heuristics to pretend to understand shell code. In this case, it saw what it thought was a here-doc operator (`<< ours`), and fell off the end of the test looking for the closing tag "ours" which it never found, thus swallowed the remainder of the test without checking it for &&-chain breakage. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
![sunshine@sunshineco.com](/assets/img/avatar_default.png)
![Junio C Hamano](/assets/img/avatar_default.png)
3 changed files with 36 additions and 2 deletions
@ -0,0 +1,14 @@ |
|||||||
|
echo "<<<<<<< ours" && |
||||||
|
echo ourside && |
||||||
|
echo "=======" && |
||||||
|
echo theirside && |
||||||
|
echo ">>>>>>> theirs" && |
||||||
|
|
||||||
|
( |
||||||
|
echo "<<<<<<< ours" && |
||||||
|
echo ourside && |
||||||
|
echo "=======" && |
||||||
|
echo theirside && |
||||||
|
echo ">>>>>>> theirs" ?!AMP?! |
||||||
|
poodle |
||||||
|
) >merged |
@ -0,0 +1,16 @@ |
|||||||
|
# LINT: "<< ours" inside string is not here-doc |
||||||
|
echo "<<<<<<< ours" && |
||||||
|
echo ourside && |
||||||
|
echo "=======" && |
||||||
|
echo theirside && |
||||||
|
echo ">>>>>>> theirs" && |
||||||
|
|
||||||
|
( |
||||||
|
# LINT: "<< ours" inside string is not here-doc |
||||||
|
echo "<<<<<<< ours" && |
||||||
|
echo ourside && |
||||||
|
echo "=======" && |
||||||
|
echo theirside && |
||||||
|
echo ">>>>>>> theirs" |
||||||
|
poodle |
||||||
|
) >merged |
Loading…
Reference in new issue