Re: [PATCH] t3070: make chain lint tester happy
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Mar 25, 2023, 06:54 UTC
- Message-ID
- <CAPig+cT9zjP++ECkTMjh33gzWyh_ho6n8_XYkXTHxnuGiDbnow@mail.gmail.com>
- In-Reply-To
- <20230325063731.GB562387@coredump.intra.peff.net>
On Sat, Mar 25, 2023 at 2:38 AM Jeff King <peff@peff.net> wrote:
Show 7 quoted lines
> On Fri, Mar 24, 2023 at 11:17:11PM +0100, Michael J Gruber wrote:
> > 1f2e05f0b7 ("wildmatch: fix exponential behavior", 2023-03-20)
> > introduced a new test with a background process. Backgrounding
> > necessarily gives a result of 0, so that a seemingly broken && chain is
> > not really broken.
> >
> > Adjust t3070 slightly so that our chain list test recognizes thes/list/lint/
Show 14 quoted lines
> > construct for what it is and does not raise a false positive. > > Good catch. While I agree that there's no missed exit code here, I'd say > that this is more than just a false positive. If there were any lines > above the "&", like: > > foo && > bar & > pid=$! && > ...etc... > > then we'd be losing the exit value of "foo". It's OK here because the > backgrounded command is the first line of the test, but it definitely > violates our guidelines.
This is one of a few cases chainlint recognizes specially by suppressing the complaint about the broken &&-chain since "&" can never fail. The fact that a broken &&-chain prior to the "&" would be missed was considered a reasonable tradeoff rather than complaining and asking the test author to jump through hoops just to pacify the linter. So, there are a few known cases when a broken &&-chain is allowed to slip through, and tightening linting to disallow those cases would require too many churn-like changes with little or no benefit.
> Which isn't to say that your patch needs to do anything differently. I > just wondered if it meant we should be improving the chain linter, but I > think it is doing the right thing to alert us here.
Now it gets confusing (for me, at least).
Show 9 quoted lines
> > + {
> > + test-tool wildmatch wildmatch \
> > + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab \
> > + "*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a" &
> > + pid=$!
> > + } &&
>
> This looks like the right solution. I do wonder how Phillip managed to
> miss it, though, since the test script complains loudly.I am unable to reproduce any linting errors when running this script through chainlint, which is why I was more than a little confused by this patch when I read it, and I was just about to ask for more information, such as the actual error message.