Re: [PATCH v2 1/3] credential.c: fix credential reading with regards to CR/LF
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Oct 3, 2020, 13:28 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2010031527200.50@tvgsbejvaqbjf.bet>
- In-Reply-To
- <xmqqk0w8a8re.fsf@gitster.c.googlers.com>
Hi Junio,
On Fri, 2 Oct 2020, Junio C Hamano wrote:
Show 36 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > Therefore, I spent some time pouring over the commit message. This is my
> > current version:
> >
> > credential: treat CR/LF as line endings in the credential protocol
> >
> > This fix makes using Git credentials more friendly to Windows users: it
> > allows a credential helper to communicate using CR/LF line endings ("DOS
> > line endings" commonly found on Windows) instead of LF-only line endings
> > ("Unix line endings").
> >
> > Note that this changes the behavior a bit: if a credential helper
> > produces, say, a password with a trailing Carriage Return character,
> > that will now be culled even when the rest of the lines end only in Line
> > Feed characters, indicating that the Carriage Return was not meant to be
> > part of the line ending.
> >
> > In practice, it seems _very_ unlikely that something like this happens.
> > Passwords usually need to consist of non-control characters, URLs need
> > to have special characters URL-encoded, and user names, well, are names.
> >
> > So let's change the credential machinery to accept both CR/LF and LF
> > line endings.
> >
> > While we do this for the credential helper protocol, we do _not_ do
> > adjust `git credential-cache--daemon` (which won't work on Windows,
> > anyway, because it requires Unix sockets) nor `git credential-store`
> > (which writes the file `~/.git-credentials` which we consider an
> > implementation detail that should be opaque to the user, read: we do
> > expect users _not_ to edit this file manually).
> >
> > What do you think?
>
> I am not Peff, but I was also drawn into the same confusion by the
> "we never see an empty line" red herring.:-)
> There are some micronits, but the above made a lot easier to > understand (I think you could even add "quit\r" bit to make it even > easier to understand) than the original description.
Okay, I incorporated a comment talking about `quit\r` and will submit a new iteration right now.
Thanks, Dscho