Re: BUG #6510: A simple prompt is displayed using wrong charset

From: Noah Misch <noah(at)leadboat(dot)com>
To: Alexander Law <exclusion(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Pg Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #6510: A simple prompt is displayed using wrong charset
Date: 2012-10-15 23:38:17
Message-ID: 20121015233817.GC13670@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general pgsql-hackers

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 Content-Type Size
simple_prompt-nonascii-v3.patch text/plain 3.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Craig Ringer 2012-10-16 02:30:31 Re: BUG #7602: Select with many joins against the same table is very slow compared to 9.2.0.
Previous Message Bruce Momjian 2012-10-15 19:27:48 Re: pg_ctl restart issue with relative paths

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2012-10-16 00:02:39 Re: Postgres DB Migration from 8.3 to 9.1
Previous Message Thomas Endres 2012-10-15 21:38:09 Re: Is pg_basebackup also for "regular" backups?

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Farina 2012-10-15 23:56:10 Re: Global Sequences
Previous Message Phil Sorber 2012-10-15 23:36:43 Re: [WIP] pg_ping utility