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

Re: [PATCH] compat: add a getpass() compatibility function

From
Rafael Gieschke <rafael@gieschke.de>
Date
May 19, 2011, 17:01 UTC
Message-ID
<EC81F772-7149-40A0-891A-973C886AB052@gieschke.de>
In-Reply-To
<BANLkTinPHeSfZXRb7pqt7-XWkR5fH=wAjg@mail.gmail.com>
Am 19.05.2011 um 14:17 schrieb Erik Faye-Lund:
> But I can't help to think that this implementation of getpass looks a
> bit heavy, especially since we already have our own getpass
> implementation in compat/mingw.c.
> Do we really need two implementations? Wouldn't it be better to factor
> out the mingw-version to a separate source file, and then improve it?
Yes, I agree very much that it would be nicer to have a common version.
Show 6 quoted lines
> Windows doesn't have /dev/tty, but the logic in this version handles
> that by using stdin/stderr instead. The signal-stuff has a comment
> that indicates it might not even be correct. tcgetattr/tcsetattr isn't
> supported on Windows, but it's not needed if we use getch (as the
> version in compat/mingw.c does). POSIX/curses getch respects the
> echo-setting, while Windows getch never echo.
Sadly, there is no curses.h on Android. So as my goal is compiling on Android, it wouldn't help much to create another dependency on curses.h.
So we would still need the /dev/tty opening and the tcgetattr/tcsetattr stuff, which would result in a very cluttered code if combined with getpass from compat/mingw.c. So I think, it will be easier to keep the two separated.
I do share your concern about the license and the heavyness of the code, so I switched to the getpass.c from uClibc and prepared a new patch. It is LGPL-v2.1 licensed, which seems like it has to be added anyway. I also tried to remove unused code from the new version as good possible.
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 19 in “compat: add a getpass() compatibility function”
  1. compat: add a getpass() compatibility functionRafael Gieschke, May 19, 2011
  2. Erik Faye-LundMay 19, 2011
  3. Junio C HamanoMay 19, 2011
  4. Rafael GieschkeMay 19, 2011
  5. Junio C HamanoMay 19, 2011
  6. Erik Faye-LundMay 19, 2011
  7. Rafael GieschkeMay 19, 2011
  8. Erik Faye-LundMay 19, 2011
  9. Rafael GieschkeMay 19, 2011
  10. Erik Faye-LundMay 19, 2011
  11. Erik Faye-LundMay 19, 2011
  12. Rafael GieschkeMay 20, 2011
  13. Erik Faye-LundMay 20, 2011
  14. Junio C HamanoMay 20, 2011
  15. Erik Faye-LundMay 20, 2011
  16. Erik Faye-LundMay 19, 2011
  17. Jonathan NiederMay 19, 2011
  18. Erik Faye-LundMay 19, 2011
  19. Junio C HamanoMay 19, 2011

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.