Re: [GSoC PATCH v5 5/5] repo: add the --format flag

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

 



On Mon, Jul 28, 2025 at 8:15 PM Ben Knoble <ben.knoble@xxxxxxxxx> wrote:
> > Le 27 juil. 2025 à 18:02, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> a écrit :
> > Simpler:
> >    printf "$expected_value\0" >expected &&
>
> (Below as well): the shell linter I use does prefer to see
>
>     printf %s\\0 "$var"
>
> to avoid issues with the variable containing format specifiers.

That's a very good point about using "%s"; I should have suggested
that myself. Thanks for the correction.

> (Backslash has to be quoted in double-quotes, too, I think? So I left out the quotes here.)

No, backslash does not need to be escaped in double-quotes. The
literal form `printf "%s\0"` is common enough in Git test scripts, so,
for consistency, that should be the form we recommend in reviews, not
the form lacking quotes, I'd think.

Taking the above into consideration, the recommendation for Lucas
would, therefore, be:

    printf "%s\0" $expected_value >expected &&





[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