git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/3] credential.c: fix credential reading with regards to CR/LF

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 2, 2020, 16:32 UTC
Message-ID
<xmqqk0w8a8re.fsf@gitster.c.googlers.com>
In-Reply-To
<nycvar.QRO.7.76.6.2010021011540.50@tvgsbejvaqbjf.bet>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 31 quoted lines
> 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.

Thanks.
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 10 of 32 in “credential.c: fix credential reading with regards to CR/LF”
  1. credential.c: fix credential reading with regards to CR/LFJohannes Schindelin via GitGitGadget, Feb 14, 2020
  2. Junio C HamanoFeb 14, 2020
  3. Jeff KingFeb 14, 2020
  4. 0/3 Prepare git credential to read input with DOS line endingsJohannes Schindelin via GitGitGadget, Sep 28, 2020
  5. 1/3 credential.c: fix credential reading with regards to CR/LFNikita Leonov via GitGitGadget, Sep 28, 2020
  6. Jeff KingSep 29, 2020
  7. Johannes SchindelinOct 2, 2020
  8. Jeff KingOct 2, 2020
  9. Johannes SchindelinOct 2, 2020
  10. Junio C HamanoOct 2, 2020
  11. Johannes SchindelinOct 3, 2020
  12. 3/3 docs: make notes regarding credential line readingNikita Leonov via GitGitGadget, Sep 28, 2020
  13. 2/3 credentials: make line reading Windows compatibleNikita Leonov via GitGitGadget, Sep 28, 2020
  14. Junio C HamanoSep 28, 2020
  15. Jeff KingSep 29, 2020
  16. Junio C HamanoSep 30, 2020
  17. Johannes SchindelinOct 2, 2020
  18. Carlo ArenasSep 28, 2020
  19. Junio C HamanoSep 28, 2020
  20. Jeff KingSep 29, 2020
  21. Junio C HamanoSep 29, 2020
  22. Jeff KingSep 29, 2020
  23. Junio C HamanoSep 29, 2020
  24. Jeff KingSep 29, 2020
  25. Junio C HamanoSep 30, 2020
  26. Jeff KingSep 30, 2020
  27. Junio C HamanoSep 30, 2020
  28. Jeff KingOct 1, 2020
  29. Junio C HamanoOct 1, 2020
  30. Johannes SchindelinOct 2, 2020
  31. Junio C HamanoSep 28, 2020
  32. credential: treat CR/LF as line endings in the credential protocolJohannes Schindelin via GitGitGadget, Oct 3, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.