All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Erik Faye-Lund <kusmabite@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Ben Walton <bwalton@artsci.utoronto.ca>,
	git@vger.kernel.org, rctay89@gmail.com, schwab@linux-m68k.org
Subject: Re: [PATCH] Enable HAVE_DEV_TTY for Solaris
Date: Wed, 8 Aug 2012 17:05:31 -0400	[thread overview]
Message-ID: <20120808210531.GA12822@sigill.intra.peff.net> (raw)
In-Reply-To: <CABPQNSaUCEDU4+2N63n0k_XwSXOP_iFZG3GEYSPSBPcSVV8wRQ@mail.gmail.com>

On Wed, Aug 08, 2012 at 04:13:03PM +0200, Erik Faye-Lund wrote:

> On Tue, Aug 7, 2012 at 6:10 AM, Jeff King <peff@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 function. Many
> > implementations are lenient about this, but Solaris libc
> > will flush the recently-read contents to the output buffer.
> > In this instance, that meant writing the non-echoed password
> > that the user just typed to the terminal.
> >
> > Fix it by inserting a no-op fseek between the read and
> > write.
> 
> My Windows-patches for git_terminal_prompt would probably also solve
> this problem. Instead of opening a read-write handle to /dev/tty, they
> open two handles to the terminal instead; one for reading and one for
> writing. This is because the terminal cannot be opened in read-write
> mode on Windows (we need to open "CONIN$" and "CONOUT$" separately).

Yeah, it would solve it, although it means opening /dev/tty twice (which
is probably not a big deal, though). I'm fine if we go that way in the
long run to share implementations, but let's treat it as a separate
topic.  This fix is an obvious one-liner, and is just fixing me being
stupid about actually following the C standard. So it's a no-brainer for
as a maintenance fix.

> You can have a look at the series here if you're interested:
> https://github.com/kusma/git/tree/work/terminal-cleanup
> 
> That last patch is the reason why I haven't submitted the series yet,
> but perhaps some of the preparatory patches could be worth-while for
> other platforms in the mean time?

Yeah, that last patch is really gross. There's no explanation of the
race issue, so I'll refrain from thinking about it until you are ready
to post a series. :)

-Peff

      reply	other threads:[~2012-08-08 21:05 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-05 23:17 [PATCH] Avoid crippled getpass function on Solaris Ben Walton
2012-08-06  1:56 ` Tay Ray Chuan
2012-08-06  2:41   ` Ben Walton
2012-08-06  1:59 ` Junio C Hamano
2012-08-06  2:35   ` Ben Walton
2012-08-06 19:39     ` Jeff King
2012-08-06 19:57       ` Junio C Hamano
2012-08-06 21:31       ` Ben Walton
2012-08-06 21:34         ` Jeff King
2012-08-06 22:09           ` Ben Walton
2012-08-06 22:31             ` Jeff King
2012-08-06 22:39               ` Ben Walton
2012-08-06 22:42                 ` Jeff King
2012-08-06 23:31                   ` Ben Walton
2012-08-07  0:01                     ` Jeff King
2012-08-06 23:05               ` Andreas Schwab
2012-08-07  0:23                 ` Jeff King
2012-08-07  0:35                   ` Jeff King
2012-08-07  2:18                     ` Tay Ray Chuan
2012-08-07  3:01                     ` Ben Walton
2012-08-07  3:07                     ` [PATCH] Enable HAVE_DEV_TTY for Solaris Ben Walton
2012-08-07  3:43                       ` Junio C Hamano
2012-08-07  4:03                         ` Jeff King
2012-08-07  4:10                           ` Jeff King
2012-08-07 15:31                             ` Ben Walton
2012-08-08 14:13                             ` Erik Faye-Lund
2012-08-08 21:05                               ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120808210531.GA12822@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=bwalton@artsci.utoronto.ca \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kusmabite@gmail.com \
    --cc=rctay89@gmail.com \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.