Thread: win32 readline

win32 readline

From
"Magnus Hagander"
Date:
Readline is pretty badly broken under mingw. Basically, it disables the
alt-gr key, which renders psql almost useless on most locales (no way to
type backslash, and a whole lot of other characters, for example).

This patch disables readline on win32. (meaning it's back to working the
way it did in <= 7.4, since msvc compiles have never supported readline)



The patch also contains two definitions for win32/port/security.c that
were for some reason not included when the rest of the win32-admin-check
patch was applied earlier, that I stumbled on while making this patch.


//Magnus


Attachment

Re: win32 readline

From
Bruce Momjian
Date:
Magnus Hagander wrote:
> Readline is pretty badly broken under mingw. Basically, it disables the
> alt-gr key, which renders psql almost useless on most locales (no way to
> type backslash, and a whole lot of other characters, for example).
>
> This patch disables readline on win32. (meaning it's back to working the
> way it did in <= 7.4, since msvc compiles have never supported readline)
>
>
>
> The patch also contains two definitions for win32/port/security.c that
> were for some reason not included when the rest of the win32-admin-check
> patch was applied earlier, that I stumbled on while making this patch.

I have added the following change to configure.in:

    # readline on MinGW has problems with backslashes in psql and other bugs.
    # This is particularly a problem with non-US code pages.
    # Therefore disable its use until we understand the cause. 2004-07-20
    case $host_os in mingw*)
      if test "$with_readline" = yes; then
        AC_MSG_WARN([*** Readline does not work on MinGW --- disabling])
        with_readline=no
      fi;;
    esac

and will issue this warning during configure run:

    configure: WARNING: *** Readline does not work on MinGW --- disabling

You can suppress this warning by running configure using
--without-readline.  If we find a fix for this we can remove this code.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: win32 readline

From
Peter Eisentraut
Date:
Magnus Hagander wrote:
> Readline is pretty badly broken under mingw. Basically, it disables
> the alt-gr key, which renders psql almost useless on most locales (no
> way to type backslash, and a whole lot of other characters, for
> example).

I can't reproduce that.  It works perfectly fine here.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: win32 readline

From
Bruce Momjian
Date:
Peter Eisentraut wrote:
> Magnus Hagander wrote:
> > Readline is pretty badly broken under mingw. Basically, it disables
> > the alt-gr key, which renders psql almost useless on most locales (no
> > way to type backslash, and a whole lot of other characters, for
> > example).
>
> I can't reproduce that.  It works perfectly fine here.

Peter, I have received multiple reports that psql readline doesn't work
on MinGW.  Can you get together with Magnus and others to find out why
you aren't seeing the failure and they are.  What code page are you
using for testing?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: win32 readline

From
Mark Kirkwood
Date:
To add to the confusion it works for me as well -  Windows 2003 with
Mingw 3.1.0

Peter Eisentraut wrote:

>Magnus Hagander wrote:
>
>
>>Readline is pretty badly broken under mingw. Basically, it disables
>>the alt-gr key, which renders psql almost useless on most locales (no
>>way to type backslash, and a whole lot of other characters, for
>>example).
>>
>>
>
>I can't reproduce that.  It works perfectly fine here.
>
>
>

Re: win32 readline

From
"Magnus Hagander"
Date:
Hmm. And this is a cvs pull that was before Bruce actually disabled
readline? What locale are you in?

Peter - what OS are you on, and what mingw version? And what locale?

I've done my tests on Win XP, and it elcearly does not work (locale =
Swedish). I've also talked to Merlin, and he had the same problems
(backslash worked bceauase his locale didn't require Alt-Gr for it, but
other Alt keysequences didn't)

//Magnus


> -----Original Message-----
> From: Mark Kirkwood [mailto:markir@coretech.co.nz]
>
> To add to the confusion it works for me as well -  Windows
> 2003 with Mingw 3.1.0
>
> Peter Eisentraut wrote:
>
> >Magnus Hagander wrote:
> >
> >
> >>Readline is pretty badly broken under mingw. Basically, it disables
> >>the alt-gr key, which renders psql almost useless on most
> locales (no
> >>way to type backslash, and a whole lot of other characters, for
> >>example).
> >>
> >>
> >
> >I can't reproduce that.  It works perfectly fine here.
> >
> >
> >
>
>

Re: win32 readline

From
"Mark Cave-Ayland"
Date:
FYI:

I've been using a CVS pull from the middle of May with readline under
Win32 without any problems. Firing up the database and doing a 'show
all' shows all lc_* vars set to English_United Kingdom.1252. This was
compiled using MingW-3.1.0-1 and MSYS-1.0.10, running under Windows XP
Pro. The only issues I have found with testing are that the history is
not maintained between psql sessions, and completion doesn't work with
\i when using a backslash (\) as a separator or when including a drive
specifier.


Hope this helps,

Mark.

---

Mark Cave-Ayland
Webbased Ltd.
Tamar Science Park
Derriford
Plymouth
PL6 8BX
England

Tel: +44 (0)1752 764445
Fax: +44 (0)1752 764446


This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender. You
should not copy it or use it for any purpose nor disclose or distribute
its contents to any other person.

> -----Original Message-----
> From: pgsql-patches-owner@postgresql.org
> [mailto:pgsql-patches-owner@postgresql.org] On Behalf Of
> Magnus Hagander
> Sent: 21 July 2004 09:13
> To: Mark Kirkwood; Peter Eisentraut
> Cc: pgsql-patches@postgresql.org
> Subject: Re: [PATCHES] win32 readline
>
>
> Hmm. And this is a cvs pull that was before Bruce actually
> disabled readline? What locale are you in?
>
> Peter - what OS are you on, and what mingw version? And what locale?
>
> I've done my tests on Win XP, and it elcearly does not work
> (locale = Swedish). I've also talked to Merlin, and he had
> the same problems (backslash worked bceauase his locale
> didn't require Alt-Gr for it, but other Alt keysequences didn't)
>
> //Magnus
>
>
> > -----Original Message-----
> > From: Mark Kirkwood [mailto:markir@coretech.co.nz]
> >
> > To add to the confusion it works for me as well -  Windows
> > 2003 with Mingw 3.1.0
> >
> > Peter Eisentraut wrote:
> >
> > >Magnus Hagander wrote:
> > >
> > >
> > >>Readline is pretty badly broken under mingw. Basically,
> it disables
> > >>the alt-gr key, which renders psql almost useless on most
> > locales (no
> > >>way to type backslash, and a whole lot of other characters, for
> > >>example).
> > >>
> > >>
> > >
> > >I can't reproduce that.  It works perfectly fine here.
> > >
> > >
> > >
> >
> >
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to
> majordomo@postgresql.org)
>



Re: win32 readline

From
"Magnus Hagander"
Date:
The locale that's interesting is the Windows locale, not the pg one.
And I assume you are on english locale? Then you don't need Alt-Gr for
backslash at least, but you're saying  other Alt-Gr-key based
combinations did work?

(I've also had reports of history problems, which in at least one case
has been fixed by the disabling of readline)

//Magnus

> -----Original Message-----
> From: Mark Cave-Ayland [mailto:m.cave-ayland@webbased.co.uk]
> Sent: Wednesday, July 21, 2004 12:38 PM
> To: Magnus Hagander; 'Mark Kirkwood'; 'Peter Eisentraut'
> Cc: pgsql-patches@postgresql.org
> Subject: RE: [PATCHES] win32 readline
>
> FYI:
>
> I've been using a CVS pull from the middle of May with readline under
> Win32 without any problems. Firing up the database and doing
> a 'show all' shows all lc_* vars set to English_United
> Kingdom.1252. This was compiled using MingW-3.1.0-1 and
> MSYS-1.0.10, running under Windows XP Pro. The only issues I
> have found with testing are that the history is not
> maintained between psql sessions, and completion doesn't work
> with \i when using a backslash (\) as a separator or when
> including a drive specifier.
>
>
> Hope this helps,
>
> Mark.
>
> ---
>
> Mark Cave-Ayland
> Webbased Ltd.
> Tamar Science Park
> Derriford
> Plymouth
> PL6 8BX
> England
>
> Tel: +44 (0)1752 764445
> Fax: +44 (0)1752 764446
>
>
> This email and any attachments are confidential to the
> intended recipient and may also be privileged. If you are not
> the intended recipient please delete it from your system and
> notify the sender. You should not copy it or use it for any
> purpose nor disclose or distribute its contents to any other person.
>
> > -----Original Message-----
> > From: pgsql-patches-owner@postgresql.org
> > [mailto:pgsql-patches-owner@postgresql.org] On Behalf Of Magnus
> > Hagander
> > Sent: 21 July 2004 09:13
> > To: Mark Kirkwood; Peter Eisentraut
> > Cc: pgsql-patches@postgresql.org
> > Subject: Re: [PATCHES] win32 readline
> >
> >
> > Hmm. And this is a cvs pull that was before Bruce actually disabled
> > readline? What locale are you in?
> >
> > Peter - what OS are you on, and what mingw version? And what locale?
> >
> > I've done my tests on Win XP, and it elcearly does not work
> (locale =
> > Swedish). I've also talked to Merlin, and he had the same problems
> > (backslash worked bceauase his locale didn't require Alt-Gr for it,
> > but other Alt keysequences didn't)
> >
> > //Magnus
> >
> >
> > > -----Original Message-----
> > > From: Mark Kirkwood [mailto:markir@coretech.co.nz]
> > >
> > > To add to the confusion it works for me as well -  Windows
> > > 2003 with Mingw 3.1.0
> > >
> > > Peter Eisentraut wrote:
> > >
> > > >Magnus Hagander wrote:
> > > >
> > > >
> > > >>Readline is pretty badly broken under mingw. Basically,
> > it disables
> > > >>the alt-gr key, which renders psql almost useless on most
> > > locales (no
> > > >>way to type backslash, and a whole lot of other characters, for
> > > >>example).
> > > >>
> > > >>
> > > >
> > > >I can't reproduce that.  It works perfectly fine here.
> > > >
> > > >
> > > >
> > >
> > >
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >     (send "unregister YourEmailAddressHere" to
> > majordomo@postgresql.org)
> >
>
>
>
>

Re: win32 readline

From
"Mark Cave-Ayland"
Date:
> -----Original Message-----
> From: pgsql-patches-owner@postgresql.org
> [mailto:pgsql-patches-owner@postgresql.org] On Behalf Of
> Magnus Hagander
> Sent: 21 July 2004 11:49
> To: Mark Cave-Ayland
> Cc: pgsql-patches@postgresql.org
> Subject: Re: [PATCHES] win32 readline
>
>
> The locale that's interesting is the Windows locale, not the
> pg one. And I assume you are on english locale? Then you
> don't need Alt-Gr for backslash at least, but you're saying
> other Alt-Gr-key based combinations did work?
>
> (I've also had reports of history problems, which in at least
> one case has been fixed by the disabling of readline)
>
> //Magnus


Ah sorry, I misunderstood that you needed the Windows locale. Assuming
that the locale is the one that's set in Control Panel, Regional Options
then on my PC it's set to "English (United Kingdom)". As you suggest, I
don't need to use Alt-Gr for a backslash, but I can happily write all
sorts of strange characters (particularly lots of DOS characters) by
holding down Alt-Gr and tapping other keys on the keyboard. I can even
include these strange characters in SELECT queries, plus they display
correctly when cycling through the history.

Note this is running psql from cmd.exe instead of through the MSYS
terminal - for some reason psql.exe hangs when I try and run it from the
MSYS terminal at the moment....


Kind regards,

Mark.

---

Mark Cave-Ayland
Webbased Ltd.
Tamar Science Park
Derriford
Plymouth
PL6 8BX
England

Tel: +44 (0)1752 764445
Fax: +44 (0)1752 764446


This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender. You
should not copy it or use it for any purpose nor disclose or distribute
its contents to any other person.



Re: win32 readline

From
Mark Kirkwood
Date:
- CVS HEAD from approx 19 Jul
- locale is 'English_New Zealand.1252'

Magnus Hagander wrote:

>Hmm. And this is a cvs pull that was before Bruce actually disabled
>readline? What locale are you in?
>
>
>
>

Re: win32 readline

From
Mark Kirkwood
Date:
Sorry - I have done it too:

Windows Locale is : English (New Zealand)

Mark Kirkwood wrote:

> - CVS HEAD from approx 19 Jul
> - locale is 'English_New Zealand.1252'
>
> Magnus Hagander wrote:
>
>> Hmm. And this is a cvs pull that was before Bruce actually disabled
>> readline? What locale are you in?
>>
>>
>>
>>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>               http://www.postgresql.org/docs/faqs/FAQ.html


Re: win32 readline

From
Peter Eisentraut
Date:
Magnus Hagander wrote:
> Hmm. And this is a cvs pull that was before Bruce actually disabled
> readline? What locale are you in?

Actually, I just just typed away in the bash shell, which uses readline
as well.

> Peter - what OS are you on, and what mingw version? And what locale?

Windows XP Pro, MinGW 2.0.0, MSys 1.0.8, locale German (Germany)

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: win32 readline

From
"Magnus Hagander"
Date:
> > Hmm. And this is a cvs pull that was before Bruce actually disabled
> > readline? What locale are you in?
>
> Actually, I just just typed away in the bash shell, which
> uses readline as well.

Ok, then we're testing completely different things. I'm talking about
the psql client when running under CMD.EXE, *not* in the msys shell.
(backslash works fine in the bash shell)

//Magnus


Re: win32 readline

From
Peter Eisentraut
Date:
Magnus Hagander wrote:
> Ok, then we're testing completely different things. I'm talking about
> the psql client when running under CMD.EXE, *not* in the msys shell.
> (backslash works fine in the bash shell)

OK, I'll try that later.  As an additional data point, running sh.exe
from within cmd.exe also gives a functional readline environment.  So
either there are local difficulties with some people, or psql is not
using readline as well as it could.  In any case, there is still hope
for readline on Windows.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: win32 readline

From
"Magnus Hagander"
Date:
>Magnus Hagander wrote:
>> Ok, then we're testing completely different things. I'm talking about
>> the psql client when running under CMD.EXE, *not* in the msys shell.
>> (backslash works fine in the bash shell)
>
>OK, I'll try that later.  As an additional data point, running sh.exe
>from within cmd.exe also gives a functional readline environment.  So
>either there are local difficulties with some people, or psql is not
>using readline as well as it could.  In any case, there is still hope
>for readline on Windows.

Right. sh does work for me.

Just for reference, what features are we losing without readline. Tab
completion, but what more?

//Magnus

Re: win32 readline

From
Peter Eisentraut
Date:
Magnus Hagander wrote:
> Just for reference, what features are we losing without readline. Tab
> completion, but what more?

Command history, customizable key bindings, cut and paste, cursor keys
come to mind.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: win32 readline

From
"Magnus Hagander"
Date:
> Magnus Hagander wrote:
> > Just for reference, what features are we losing without
> readline. Tab
> > completion, but what more?
>
> Command history, customizable key bindings, cut and paste,
> cursor keys come to mind.

Command history, cut-and-paste and cursor keys definitly work in my
build *without* readline.  (Command history works better without
readline than with, according to a couple of reports I've had). Don't
know about the key bindings, never used those :-)

//Magnus

Re: win32 readline

From
Bruce Momjian
Date:
Where are we on this?  Right now readline is disabled on Win32.  psql
works fine for me.  In fact it is more native because the delete key
deletes, and control-d doesn't exit.

I am inclined to leave the code unchanged and we can revisit this later
after we figure out why readline doesn't work on some Win32 versions.

---------------------------------------------------------------------------

Peter Eisentraut wrote:
> Magnus Hagander wrote:
> > Just for reference, what features are we losing without readline. Tab
> > completion, but what more?
>
> Command history, customizable key bindings, cut and paste, cursor keys
> come to mind.
>
> --
> Peter Eisentraut
> http://developer.postgresql.org/~petere/
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: win32 readline

From
"Marc G. Fournier"
Date:
On Mon, 2 Aug 2004, Bruce Momjian wrote:

>
> Where are we on this?  Right now readline is disabled on Win32.  psql
> works fine for me.  In fact it is more native because the delete key
> deletes, and control-d doesn't exit.
>
> I am inclined to leave the code unchanged and we can revisit this later
> after we figure out why readline doesn't work on some Win32 versions.

Stupid question, but for Windows ... how many will actually use psql, vs
something like PgAdmin?  I'd say revisit it later myself ... it isn't
critical to the operation of the server, only a 'luxury item' that we've
all gotten used to being there :)


>
> ---------------------------------------------------------------------------
>
> Peter Eisentraut wrote:
>> Magnus Hagander wrote:
>>> Just for reference, what features are we losing without readline. Tab
>>> completion, but what more?
>>
>> Command history, customizable key bindings, cut and paste, cursor keys
>> come to mind.
>>
>> --
>> Peter Eisentraut
>> http://developer.postgresql.org/~petere/
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 3: if posting/reading through Usenet, please send an appropriate
>>       subscribe-nomail command to majordomo@postgresql.org so that your
>>       message can get through to the mailing list cleanly
>>
>
> --
>  Bruce Momjian                        |  http://candle.pha.pa.us
>  pgman@candle.pha.pa.us               |  (610) 359-1001
>  +  If your life is a hard drive,     |  13 Roberts Road
>  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>      subscribe-nomail command to majordomo@postgresql.org so that your
>      message can get through to the mailing list cleanly
>

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: scrappy@hub.org           Yahoo!: yscrappy              ICQ: 7615664

Re: win32 readline

From
Peter Eisentraut
Date:
Marc G. Fournier wrote:
> Stupid question, but for Windows ... how many will actually use psql,
> vs something like PgAdmin?

I don't see any reason to believe that it would be significantly less
than now.

> I'd say revisit it later myself ... it
> isn't critical to the operation of the server, only a 'luxury item'
> that we've all gotten used to being there :)

By that logic, approximately 37% of all features count as luxury items.
:)

--
Peter Eisentraut
http://developer.postgresql.org/~petere/