Re: [PATCH v3 0/2] [Outreachy][Patch v2] t3404: avoid losing exit status to pipes

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

 



On Mon, Oct 7, 2024 at 8:11 AM Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
>
> On Mon, Oct 7, 2024 at 4:08 AM Patrick Steinhardt <ps@xxxxxx> wrote:
> > On Mon, Oct 07, 2024 at 07:25:44AM +0000, Usman Akinyemi wrote:
> > > test $base = $(git rev-parse HEAD^) &&
> > > git show >output &&
> > > grep NEVER output >actual &&
> > > test_must_be_empty actual &&
> >
> > That makes sense. The expectation here is that `output` shouldn't
> > contain the string "NEVER" at all. And as grep(1) would fail when it
> > doesn't find a match the whole test would fail like this. So the below
> > would likely be the best solution.
>
> Thanks. I was just about to respond with the same answer. As a bit of
> extra explanation, the &&-chaining means that every command in the
> chain must return "success" (status 0), but the return code of `grep`
> depends upon whether or not it matched any lines. In this case, it
> returned non-zero which caused the test to fail.
Thanks Eric and Partrick. Thanks for the explanation. I will update
the patch then.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux