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

Re: [PATCH] add Android support

From
Rafael Gieschke <rafael@gieschke.de>
Date
May 16, 2011, 23:23 UTC
Message-ID
<D01E807D-C82C-4A8F-9678-9CEA92C413DA@gieschke.de>
In-Reply-To
<7vzkmmjqpx.fsf@alter.siamese.dyndns.org>
Am 16.05.2011 um 23:11 schrieb Junio C Hamano:
Show 22 quoted lines
> Please do not throw in conditional compilation in a codepath that is
> otherwise generic.
> 
> Do something like this near the beginning of the file (or if they are
> common, in an appropriate header):
> 
>        #ifdef NO_GETPASS
>        #define getpass(ignored) NULL
>        #endif
> 
>        #ifdef NO_PW_GECOS
>        #define get_gecos(ignored) "&"
>        #else
>        #define get_gecos(struct_passwd) (struct_passwd->pw_gecos)
>        #endif
> 
> That way, you do not have to change connect.c at all, and the code that
> accesses gecos field would get a slight abstraction, i.e.
> 
> 	for (len = 0, dst = name, src = get_gecos(w); len < sz; src++) {
> 		...
> 
Thanks. Great idea, didn't think about that. See new patch.
Show 7 quoted lines
> I however suspect that NO_GETPASS would be a useless thing in the longer
> term. Wouldn't you rather wish to have a native Android UI that asks a
> password and plug that implementation as a replacement for git_getpass()?
> 
> It might be worthwhile to study how mingw folks do this part before you
> dive in and butcher this codepath in a way you may regret later.
> 
I don't think that it is a lot of fun to call Android UI code from C as it is normally only done from Java.
The same problem occurs in dropbear on Android. There, it is solved by including a NetBSD version of getpass.c: https://github.com/CyanogenMod/android_external_dropbear/blob/master/netbsd_getpass.c .
If including NetBSD code is okay, the new patch will work. There currently is very limited use for this on Android, however, as there is no libcurl by default on Android. So, the only usage is git-imap-send, which works fine with this patch.
Compiling libcurl for Android should be possible with some work, though. So compat/getpass.c would be used for libcurl/HTTP access, too.
Previous: Junio C HamanoNext: Daniel Stenberg
Message 3 of 5 in “add Android support”
  1. add Android supportRafael Gieschke, May 16, 2011
  2. Junio C HamanoMay 16, 2011
  3. Rafael GieschkeMay 16, 2011
  4. Daniel StenbergMay 17, 2011
  5. Rafael GieschkeMay 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.