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

Re: [PATCH/RFC] contrib: add win32 credential-helper

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 4, 2012, 17:44 UTC
Message-ID
<7vaa2r9ytl.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20120404112341.GA28354@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 22 quoted lines
> On Wed, Apr 04, 2012 at 12:37:25PM +0200, Erik Faye-Lund wrote:
> ...
>> The problem is that for some helpers you need to know the encoding in
>> order to have a user-interface show the data. This goes both for OSX
>> and Windows. If you mess up the encoding, in the helper, then you'll
>> mess up the entries in the OS'es key-managers. While this might not be
>> a problem in practice for US-English users, we've seen for Git for
>> Windows that e.g. some Asians are really unhappy with their username
>> becoming some completely incomprehensible string.
>
> How are they inputting their username? If they are seeing garbage, then
> surely it is coming to git in some encoding that is different than what
> the password manager expects. Then we give it to a helper, which hands
> it to system storage, which assumes that what we give it is utf-8. So
> the error there seems to me to be the layer between the helper and the
> system storage, where the string is converted from "a stream of bytes"
> to "a utf-8 encoded string".
>
> So why is this a credential helper protocol problem, and not an
> implementation issue for the specific helper? How does git find out the
> encoding? Presumably by checking $LANG, or whatever system-specific
> locale information there is. Can't the helper do the same thing?
FWIW, this matches exactly my reaction.

If a helper on a specific system somehow *knows* the user means to give UTF-8, uses system UI that interacts with the user and gives UTF-16 back, and uses system store that takes UCS-2, it is entirely sensible for the helper to convert between these encodings internally and use UTF-8 when interacting with credential-helper API which only expects "stream of bytes". But that is just a specific implementation detail of the helper.

Previous: Jeff King
Message 8 of 8 in “contrib: add win32 credential-helper”
  1. contrib: add win32 credential-helperErik Faye-Lund, Mar 19, 2012
  2. Jeff KingMar 23, 2012
  3. Erik Faye-LundApr 2, 2012
  4. Erik Faye-LundApr 3, 2012
  5. Jeff KingApr 4, 2012
  6. Erik Faye-LundApr 4, 2012
  7. Jeff KingApr 4, 2012
  8. Junio C HamanoApr 4, 2012

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.