Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Jeff King
On Sun, Aug 05, 2012 at 10:35:06PM -0400, Ben Walton wrote: Excerpts from Junio C Hamano's message of Sun Aug 05 21:59:48 -0400 2012: Wouldn't #if solaris #define getpass getpassphrase #endif without anything else be more than sufficient? Yes, it would, but

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Jeff King
On Mon, Aug 06, 2012 at 05:31:00PM -0400, Ben Walton wrote: I'm happy to spend a few cycles on it. I don't have access to any real Solaris boxes these days, but I imagine I can get OpenSolaris running under VirtualBox without too much trouble... I'm also happy to do this work and have

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Ben Walton
Excerpts from Jeff King's message of Mon Aug 06 17:34:04 -0400 2012: On Mon, Aug 06, 2012 at 05:31:00PM -0400, Ben Walton wrote: I'm happy to spend a few cycles on it. I don't have access to any real Solaris boxes these days, but I imagine I can get OpenSolaris running under

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Jeff King
On Mon, Aug 06, 2012 at 06:09:08PM -0400, Ben Walton wrote: I'm currently in pkgutil hell trying to remember how to get a working gcc on Solaris. Bleh. What kind of OS doesn't ship with a compiler by default? :) One that's losing mindshare and isn't gaining traction? *g* Feel free to

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Ben Walton
Excerpts from Jeff King's message of Mon Aug 06 18:31:13 -0400 2012: Looking over the code, I recall now why I used stdio: strbuf_getline requires it. These days we have strbuf_getwholeline_fd. It's slightly less efficient (it has to read() a character at a time), but since we are talking

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Andreas Schwab
Jeff King p...@peff.net writes: The stdio behavior on Solaris is weird. If I run this sample program: #include stdio.h int main(void) { FILE *fh = fopen(/dev/tty, w+); char buf[32] = {0}; fgets(buf, sizeof(buf), fh); fprintf(fh, got %s\n, buf); return 0; }

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Ben Walton
Excerpts from Jeff King's message of Mon Aug 06 18:42:22 -0400 2012: +if (strbuf_getwholeline(sb, fd, term)) Shouldn't this be strbuf_getwholeline_fd though? Otherwise, I think this is a good addition. Thanks -Ben -- Ben Walton Systems Programmer - CHASS University of Toronto

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Jeff King
On Mon, Aug 06, 2012 at 07:31:30PM -0400, Ben Walton wrote: Excerpts from Jeff King's message of Mon Aug 06 18:42:22 -0400 2012: +if (strbuf_getwholeline(sb, fd, term)) Shouldn't this be strbuf_getwholeline_fd though? Whoops, yes. When I got your email, I had just finished the patch

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Jeff King
On Tue, Aug 07, 2012 at 01:05:45AM +0200, Andreas Schwab wrote: The stdio behavior on Solaris is weird. If I run this sample program: #include stdio.h int main(void) { FILE *fh = fopen(/dev/tty, w+); char buf[32] = {0}; fgets(buf, sizeof(buf), fh);

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Jeff King
On Mon, Aug 06, 2012 at 08:23:18PM -0400, Jeff King wrote: This is all moot if we end up ripping stdio out of this code for other reasons, but it does give us another option for a fix. And here is what that patch would look like: -- 8 -- Subject: [PATCH] terminal: seek when switching between

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Tay Ray Chuan
On Tue, Aug 7, 2012 at 8:35 AM, Jeff King p...@peff.net wrote: Subject: [PATCH] terminal: seek when switching between reading and writing When a stdio stream is opened in update mode (e.g., w+), the C standard forbids switching between reading or writing without an intervening positioning

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Ben Walton
Excerpts from Jeff King's message of Mon Aug 06 20:35:41 -0400 2012: --- compat/terminal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/compat/terminal.c b/compat/terminal.c index 6d16c8f..bbb038d 100644 --- a/compat/terminal.c +++ b/compat/terminal.c @@ -59,6 +59,7 @@ char

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-05 Thread Tay Ray Chuan
On Mon, Aug 6, 2012 at 7:17 AM, Ben Walton bwal...@artsci.utoronto.ca wrote: I've also briefly dabbled with getting Solaris to simply use the HAVE_DEV_TTY code path but the terminal echo stuff hasn't worked nicely for me just yet. (It reads the password with nothing echoed but then displays

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-05 Thread Junio C Hamano
Ben Walton bwal...@artsci.utoronto.ca writes: diff --git a/compat/terminal.h b/compat/terminal.h index 97db7cd..8d7b3f9 100644 --- a/compat/terminal.h +++ b/compat/terminal.h @@ -3,4 +3,13 @@ char *git_terminal_prompt(const char *prompt, int echo); +/* getpass() returns at most 8

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-05 Thread Ben Walton
Excerpts from Junio C Hamano's message of Sun Aug 05 21:59:48 -0400 2012: Wouldn't #if solaris #define getpass getpassphrase #endif without anything else be more than sufficient? Yes, it would, but I was hoping to make it more explicit that the function getpass may be