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 @@ ch

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 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 function.

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 betwee

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 > > 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 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 p

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 C:416.407.56

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Andreas Schwab
Jeff King writes: > The stdio behavior on Solaris is weird. If I run this sample program: > > #include > 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; > } > > o

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Jeff King
On Mon, Aug 06, 2012 at 06:39:55PM -0400, Ben Walton wrote: > 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 efficien

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 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 fre

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 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

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Ben Walton
Excerpts from Jeff King's message of Mon Aug 06 15:39:58 -0400 2012: > 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

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-06 Thread Junio C Hamano
Jeff King writes: > From my reading of > getpassphrase, it does seem to be a drop-in replacement. > > So I'm OK conceptually with the patch if we can't do any better. But > getpass still sucks. It doesn't handle echoing, and it may or may not > fall back to reading from stdin if the tty isn

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? > > Ye

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-05 Thread Ben Walton
Excerpts from Tay Ray Chuan's message of Sun Aug 05 21:56:55 -0400 2012: > > 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 di

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

Re: [PATCH] Avoid crippled getpass function on Solaris

2012-08-05 Thread Junio C Hamano
Ben Walton 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 characters on solari

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 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 the string after reading

[PATCH] Avoid crippled getpass function on Solaris

2012-08-05 Thread Ben Walton
On Solaris getpass() returns at most 8 characters which cripples the credential reading for accounts using longer passwords. The alternate function getpassphrase() was introduced in SunOS 5.6 and will return up to 256 characters. Ensure that git_terminal_prompt uses the more able function when bu