Re: [PATCH 2/2] gitcredentials(7): make shell-snippet example more realistic

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

 



On Fri, May 01, 2020 at 02:32:07AM -0400, Jeff King wrote:

> > All of them make sense, but I do not think we want to encourage that
> > loose style of passing unquoted argument to echo to lose embedded
> > $IFS spaces that is not a SP.
> 
> You mean dropping the quotes in the first patch?
> 
> Doing:
> 
>   echo "password=$(cat $HOME/.secret)"
> 
> already eats some trailing whitespace, though I guess if you have
> newlines in your password you are beyond help anyway.
> 
> I can add back in the quoted \", though it does make the code slightly
> harder to read.

Or did you mean passing $1 in the test call? It definitely isn't good
shell practice, but we know that we're getting a single-word action from
Git, per the protocol.

Fully quoting, it looks like this:

  helper = "!f() { test \"$1\" = get && echo \"password=$(cat $HOME/.secret)\"; }; f"

which IMHO is getting a little hard to read. I think that's part of why
I gave such an unfinished example in the first place. :)

-Peff



[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