Re: chainlint.pl's new "deparse" output (was: [PATCH v2] [...])
From: Eric Sunshine <hidden>
Date: 2022-10-25 04:16:02
On Tue, Oct 25, 2022 at 12:05 AM Eric Sunshine [off-list ref] wrote:
On Mon, Oct 24, 2022 at 6:28 AM Ævar Arnfjörð Bjarmason [off-list ref] wrote:quoted
Another thing: When a test *ends* in a "&&" (common when you copy/paste e.g. "test_cmp expect actual &&\n" from another test) it doesn't spot it, but instead we get all the way to the eval/117, i.e. "broken &&-chain or run-away HERE-DOC".Yes, I recall considering that case and others, but decided that that's probably outside the scope of the linter. [...] It is unfortunate, though, that the shell's "syntax error" output gets swallowed by the eval/117 checker in test-lib.sh and turned into a somewhat less useful message. I'm not quite sure how we can fix the eval/117 checker to not swallow genuine syntax errors like that, unless we perhaps specially recognize exit code 2 and, um, do something...
Another "fix" would be to drop the eval/117 checker altogether. I
retained it as a final safeguard in case something slipped past
chainlint.pl, however, I'm not sure how much value the eval/117
checker really has since it misses so many real-world cases, such as
any &&-chain break in the body of a compound context (if/fi,
case/esac, for/done, while/done, (...), {...}, $(...), etc.).
Moreover, we see now that it's also obscuring useful error messages
(such as "syntax error") from the shell itself. So, dropping it may be
an option(?).