Home > Archive > PostgreSQL Discussion > September 2005 > Function keys cause psql to segfault









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Function keys cause psql to segfault
CSN

2005-09-26, 3:23 am

If I'm in psql (via putty, from WinXP to Redhat) and
hit F1-4 (F5+ just display a ~), psql will
segmentation fault and exit. Not that I'm in the habit
of entering function keys while in psql - I
accidentally hit one while entering numbers (lost a
fair amount of history).

I just tried it using WinXP's command prompt and none
of the function keys cause psql to segfault.

CSN

____________________
____________________
__________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Bruce Momjian

2005-09-26, 3:23 am

CSN wrote:
> If I'm in psql (via putty, from WinXP to Redhat) and
> hit F1-4 (F5+ just display a ~), psql will
> segmentation fault and exit. Not that I'm in the habit
> of entering function keys while in psql - I
> accidentally hit one while entering numbers (lost a
> fair amount of history).


My guess is that those send a break or some control sequence. od -c
might show you what is being output.

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

CSN

2005-09-26, 3:23 am


Here's what 'od -c' shows for F1-4:

^[OP^[OQ^[OR^[OS


CSN

--- Bruce Momjian <pgman@candle.pha.pa.us> wrote:

> CSN wrote:
> and
> habit
> a
>
> My guess is that those send a break or some control
> sequence. od -c
> might show you what is being output.
>
> --
> 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
>





____________________
______________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Tom Lane

2005-09-26, 3:23 am

Bruce Momjian <pgman@candle.pha.pa.us> writes:
> CSN wrote:
[color=darkred]
> My guess is that those send a break or some control sequence. od -c
> might show you what is being output.


Try watching the psql process with strace in another terminal window.
If Bruce's theory is correct (and it sounds good to me) then you should
be able to see a signal being delivered to psql.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Bruce Momjian

2005-09-26, 3:23 am

Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
>
>
> Try watching the psql process with strace in another terminal window.
> If Bruce's theory is correct (and it sounds good to me) then you should
> be able to see a signal being delivered to psql.


Also, try the function keys in another command-line application and see
if that exits too.

--
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 4: Have you searched our list archives?

http://archives.postgresql.org

CSN

2005-09-26, 3:23 am


I did 'strace psql dbname' and this was the output
after hitting F1:

read(0, "\33", 1) = 1
read(0, "O", 1) = 1
read(0, "P", 1) = 1
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++


CSN

--- Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> and
>
> control sequence. od -c
>
> Try watching the psql process with strace in another
> terminal window.
> If Bruce's theory is correct (and it sounds good to
> me) then you should
> be able to see a signal being delivered to psql.
>
> regards, tom lane
>





____________________
______________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

CSN

2005-09-26, 3:23 am


Hmm, all I could think of was perl and php - hitting
F1-4 just caused these chars to be displayed (the
interpreters didn't exit):

^[OP^[OQ^[OR^[OS


CSN

--- Bruce Momjian <pgman@candle.pha.pa.us> wrote:

> Tom Lane wrote:
> Redhat) and
> control sequence. od -c
> another terminal window.
> to me) then you should
>
> Also, try the function keys in another command-line
> application and see
> if that exits too.
>
> --
> 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
>





____________________
______________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Tom Lane

2005-09-26, 3:23 am

CSN < cool_screen_name9000
1@yahoo.com> writes:
> I did 'strace psql dbname' and this was the output
> after hitting F1:


> read(0, "\33", 1) = 1
> read(0, "O", 1) = 1
> read(0, "P", 1) = 1
> --- SIGSEGV (Segmentation fault) @ 0 (0) ---


Hmm ... I don't have an F1 key, but I typed escape-O-P at a psql
running under Linux, and got this:

Process 28978 attached - interrupt to quit
read(0, "\33", 1) = 1
read(0, "O", 1) = 1
read(0, "P", 1) = 1
write(2, "\7", 1) = 1
rt_sigprocmask(SIG_S
ETMASK, [], NULL, 8) = 0
read(0,

So it seems fine here. I'm wondering if there's something broken
about your machine's readline library.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Klint Gore

2005-09-26, 3:23 am

On Sun, 25 Sep 2005 20:00:03 -0700 (PDT), CSN < cool_screen_name9000
1@yahoo.com> wrote:
>
> I did 'strace psql dbname' and this was the output
> after hitting F1:
>
> read(0, "\33", 1) = 1
> read(0, "O", 1) = 1
> read(0, "P", 1) = 1
> --- SIGSEGV (Segmentation fault) @ 0 (0) ---
> +++ killed by SIGSEGV +++


esc O P is PF1 on a VT100/VT200. Does it make any difference if you
change the terminal emulation in putty or the term setting in redhat?

klint.

+---------------------------------------+-----------------+
: Klint Gore : "Non rhyming :
: EMail : kg@kgb.une.edu.au : slang - the :
: Snail : A.B.R.I. : possibilities :
: Mail University of New England : are useless" :
: Armidale NSW 2351 Australia : L.J.J. :
: Fax : +61 2 6772 5376 : :
+---------------------------------------+-----------------+

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

CSN

2005-09-26, 3:23 am


It looks like I had readline 4.3 installed. I just
installed readline 5.0 - the F1-4 keys still cause
psql to segfault. (AFAIK I don't need to recompile
postgres for psql to use the newly installed
readline).

CSN

--- Tom Lane <tgl@sss.pgh.pa.us> wrote:

> CSN < cool_screen_name9000
1@yahoo.com> writes:
>
>
> Hmm ... I don't have an F1 key, but I typed
> escape-O-P at a psql
> running under Linux, and got this:
>
> Process 28978 attached - interrupt to quit
> read(0, "\33", 1) = 1
> read(0, "O", 1) = 1
> read(0, "P", 1) = 1
> write(2, "\7", 1) = 1
> rt_sigprocmask(SIG_S
ETMASK, [], NULL, 8) = 0
> read(0,
>
> So it seems fine here. I'm wondering if there's
> something broken
> about your machine's readline library.
>
> regards, tom lane
>



____________________
____________________
__________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 1: 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

CSN

2005-09-26, 3:23 am


Hmm, in putty (Terminal->Keyboard) I changed "the
function keys and keypad" from "ESC[n~" to "Linux".
Hitting F1-5 in psql outputs "ABCDE" - no segfaults!
Setting it to "Xterm R6" also results in function keys
1-4 causing segfaults (there are also options for
"VT400", "VT100+", and "SCO" - haven't tried those).

Thanks,
CSN

--- Klint Gore <kg@kgb.une.edu.au> wrote:

> On Sun, 25 Sep 2005 20:00:03 -0700 (PDT), CSN
> < cool_screen_name9000
1@yahoo.com> wrote:
>
> esc O P is PF1 on a VT100/VT200. Does it make any
> difference if you
> change the terminal emulation in putty or the term
> setting in redhat?
>
> klint.
>
>

+---------------------------------------+-----------------+
> : Klint Gore : "Non
> rhyming :
> : EMail : kg@kgb.une.edu.au : slang -
> the :
> : Snail : A.B.R.I. :
> possibilities :
> : Mail University of New England : are
> useless" :
> : Armidale NSW 2351 Australia : L.J.J.
> :
> : Fax : +61 2 6772 5376 :
> :
>

+---------------------------------------+-----------------+
>





____________________
______________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Douglas McNaught

2005-09-26, 11:23 am

CSN < cool_screen_name9000
1@yahoo.com> writes:

> Hmm, in putty (Terminal->Keyboard) I changed "the
> function keys and keypad" from "ESC[n~" to "Linux".
> Hitting F1-5 in psql outputs "ABCDE" - no segfaults!
> Setting it to "Xterm R6" also results in function keys
> 1-4 causing segfaults (there are also options for
> "VT400", "VT100+", and "SCO" - haven't tried those).


Sounds like it might be useful to compile psql with debugging symbols
and get a backtrace from the crash.

-Doug

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Chris Travers

2005-09-28, 1:23 pm

Douglas McNaught wrote:

>CSN < cool_screen_name9000
1@yahoo.com> writes:
>
>
>
>
>Sounds like it might be useful to compile psql with debugging symbols
>and get a backtrace from the crash.
>
>

Just an oddball theory:

Do we really know what data is being sent with the function keys from
XP? If Putty is doing passthrough encoding, this might be the problem.

The od output doesn't look right to me. One should try:
od -c
F1F2F3F4 ctrl-D
When I try this on a gterm, I get:
^[OQ^[OR^[OS0000000 033 O Q 033 O R 033 O S
0000011
My guess is that Windows is sending some data (maybe embedded nulls) in
the data from the Fn key sequences that is causing Readline to crash.

In that case it would be a readline bug not something correctable in
psql I'm afraid.

Best Wishes,
Chris Travers
Metatron Technology Consultingp

>-Doug
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>
>
>
>



---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com