Re: BUG #6510: A simple prompt is displayed using wrong charset - Mailing list pgsql-bugs

From Noah Misch
Subject Re: BUG #6510: A simple prompt is displayed using wrong charset
Date
Msg-id 20121015233817.GC13670@tornado.leadboat.com
Whole thread Raw
In response to Re: BUG #6510: A simple prompt is displayed using wrong charset  (Noah Misch <noah@leadboat.com>)
Responses Re: BUG #6510: A simple prompt is displayed using wrong charset  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-bugs
On Mon, Oct 15, 2012 at 05:41:36AM -0400, Noah Misch wrote:
> > --- a/src/port/sprompt.c
> > +++ b/src/port/sprompt.c
> > @@ -60,8 +60,13 @@ simple_prompt(const char *prompt, int maxlen, bool echo)
> >       * Do not try to collapse these into one "w+" mode file. Doesn't work on
> >       * some platforms (eg, HPUX 10.20).
> >       */
> > +#ifdef WIN32
> > +    termin = fopen("CONIN$", "r");
> > +    termout = fopen("CONOUT$", "w+");
>
> This definitely needs a block comment explaining the behaviors that led us to
> select this particular implementation.
>
> > +#else
> >      termin = fopen(DEVTTY, "r");
> >      termout = fopen(DEVTTY, "w");
>
> This thread has illustrated that the DEVTTY abstraction does not suffice.  I
> think we should remove it entirely.  Remove it from port.h; use literal
> "/dev/tty" here; re-add it as a local #define near the one remaining use, with
> an XXX comment indicating that the usage is broken.
>
> If it would help, I can prepare a version with the comment changes and
> refactoring I have in mind.

Following an off-list ack from Alexander, here is that version.  No functional
differences from Alexander's latest version, and I have verified that it still
fixes the original test case.  I'm marking this Ready for Committer.

To test this on an English (United States) copy of Windows 7, I made two
configuration changes in the "Region and Language" control panel.  On the
"Administrative" tab, choose "Change system locale..." and select Russian
(Russia).  After the reboot, choose "Russian (Russia)" on the "Format" tab.
(Neither of these changes will affect the display language of most Windows UI
components.)  Finally, run "initdb -W testdatadir".  Before the patch, the
password prompt contained some line-drawing characters and other garbage.
Afterward, it matches the string in src/bin/initdb/po/ru.po.

Thanks,
nm

Attachment

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pg_ctl restart issue with relative paths
Next
From: Craig Ringer
Date:
Subject: Re: BUG #7602: Select with many joins against the same table is very slow compared to 9.2.0.