Обсуждение: 8.0B2 psql \e

Поиск
Список
Период
Сортировка

8.0B2 psql \e

От
elein
Дата:
Has anyone else experienced a segfault in psql on 8.0B2
when using \e?  I can reproduce this consistently.

If not I'll trace it down if I can, but if it is a known
problem, I won't bother.

--elein
============================================================
elein@varlena.com        Varlena, LLC        www.varlena.com

          PostgreSQL Consulting, Support & Training

PostgreSQL General Bits   http://www.varlena.com/GeneralBits/
=============================================================
I have always depended on the [QA] of strangers.

Re: 8.0B2 psql \e

От
Alvaro Herrera
Дата:
On Mon, Sep 13, 2004 at 12:47:54PM -0700, elein wrote:
> Has anyone else experienced a segfault in psql on 8.0B2
> when using \e?  I can reproduce this consistently.

I do it all the time and I haven't seen it ... is your query too long or
something?  Care to show psql's backtrace?

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Syntax error: function hell() needs an argument.
Please choose what hell you want to involve.

Re: 8.0B2 psql \e

От
Michael Fuhr
Дата:
On Mon, Sep 13, 2004 at 12:47:54PM -0700, elein wrote:
> Has anyone else experienced a segfault in psql on 8.0B2
> when using \e?  I can reproduce this consistently.
>
> If not I'll trace it down if I can, but if it is a known
> problem, I won't bother.

I'm using the latest CVS sources on Solaris 9 and can't reproduce
this problem.  The segfault was identified in 8.0.0beta1 a month
ago but I thought it was fixed.

http://archives.postgresql.org/pgsql-bugs/2004-08/msg00103.php

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

Re: 8.0B2 psql \e

От
Tom Lane
Дата:
elein <elein@varlena.com> writes:
> Has anyone else experienced a segfault in psql on 8.0B2
> when using \e?  I can reproduce this consistently.

Hmm, we fixed a bug in \e not long ago, but it was pre-beta2 ...

            regards, tom lane

Re: 8.0B2 psql \e

От
elein
Дата:
This looks like the same bug as Michael's
http://archives.postgresql.org/pgsql-bugs/2004-08/msg00103.php

trim_directory needs to check for a NULL pointer in path.

    if ( path == NULL || path[0] == '\0' )

I'll verify I have the version I think I have...

(gdb) bt
#0  0x0805dd15 in trim_trailing_separator (path=0x0) at path.c:442
#1  0x0805d6b2 in canonicalize_path (path=0x0) at path.c:123
#2  0x0804af80 in exec_command (cmd=0x808f958 "e", scan_state=0x808ba30, query_buf=0x808bb80)
    at command.c:378
#3  0x0804a964 in HandleSlashCmds (scan_state=0x808ba30, query_buf=0x808bb80) at command.c:86
#4  0x0804fd31 in MainLoop (source=0x40217a60) at mainloop.c:257
#5  0x080517b2 in main (argc=2, argv=0xbffff1f4) at startup.c:310
#6  0x401177ee in __libc_start_main () from /lib/libc.so.6

419     static void
420     trim_directory(char *path)
421     {
422             char *p;
423
424             if (path[0] == '\0')
425                     return;
426
427             for (p = path + strlen(path) - 1; IS_DIR_SEP(*p) && p > path; p--)
428                     ;
429             for (; !IS_DIR_SEP(*p) && p > path; p--)
430                     ;
431             *p = '\0';
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) print path[0]
Cannot access memory at address 0x0


On Mon, Sep 13, 2004 at 02:20:14PM -0600, Michael Fuhr wrote:
> On Mon, Sep 13, 2004 at 12:47:54PM -0700, elein wrote:
> > Has anyone else experienced a segfault in psql on 8.0B2
> > when using \e?  I can reproduce this consistently.
> >
> > If not I'll trace it down if I can, but if it is a known
> > problem, I won't bother.
>
> I'm using the latest CVS sources on Solaris 9 and can't reproduce
> this problem.  The segfault was identified in 8.0.0beta1 a month
> ago but I thought it was fixed.
>
> http://archives.postgresql.org/pgsql-bugs/2004-08/msg00103.php
>
> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/
>
> ---------------------------(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: 8.0B2 psql \e

От
elein
Дата:
This is the source for beta2.  Perhap the previous
fix was to add the path[0] check but the path == NULL
check was forgotten?

OR, is it a problem if path==NULL?

--elein

On Mon, Sep 13, 2004 at 01:31:26PM -0700, elein wrote:
> This looks like the same bug as Michael's
> http://archives.postgresql.org/pgsql-bugs/2004-08/msg00103.php
>
> trim_directory needs to check for a NULL pointer in path.
>
>     if ( path == NULL || path[0] == '\0' )
>
> I'll verify I have the version I think I have...
>
> (gdb) bt
> #0  0x0805dd15 in trim_trailing_separator (path=0x0) at path.c:442
> #1  0x0805d6b2 in canonicalize_path (path=0x0) at path.c:123
> #2  0x0804af80 in exec_command (cmd=0x808f958 "e", scan_state=0x808ba30, query_buf=0x808bb80)
>     at command.c:378
> #3  0x0804a964 in HandleSlashCmds (scan_state=0x808ba30, query_buf=0x808bb80) at command.c:86
> #4  0x0804fd31 in MainLoop (source=0x40217a60) at mainloop.c:257
> #5  0x080517b2 in main (argc=2, argv=0xbffff1f4) at startup.c:310
> #6  0x401177ee in __libc_start_main () from /lib/libc.so.6
>
> 419     static void
> 420     trim_directory(char *path)
> 421     {
> 422             char *p;
> 423
> 424             if (path[0] == '\0')
> 425                     return;
> 426
> 427             for (p = path + strlen(path) - 1; IS_DIR_SEP(*p) && p > path; p--)
> 428                     ;
> 429             for (; !IS_DIR_SEP(*p) && p > path; p--)
> 430                     ;
> 431             *p = '\0';
> ---Type <return> to continue, or q <return> to quit---q
> Quit
> (gdb) print path[0]
> Cannot access memory at address 0x0
>
>
> On Mon, Sep 13, 2004 at 02:20:14PM -0600, Michael Fuhr wrote:
> > On Mon, Sep 13, 2004 at 12:47:54PM -0700, elein wrote:
> > > Has anyone else experienced a segfault in psql on 8.0B2
> > > when using \e?  I can reproduce this consistently.
> > >
> > > If not I'll trace it down if I can, but if it is a known
> > > problem, I won't bother.
> >
> > I'm using the latest CVS sources on Solaris 9 and can't reproduce
> > this problem.  The segfault was identified in 8.0.0beta1 a month
> > ago but I thought it was fixed.
> >
> > http://archives.postgresql.org/pgsql-bugs/2004-08/msg00103.php
> >
> > --
> > Michael Fuhr
> > http://www.fuhr.org/~mfuhr/
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend

Re: 8.0B2 psql \e

От
Tom Lane
Дата:
elein <elein@varlena.com> writes:
> I'll verify I have the version I think I have...

> (gdb) bt
> #0  0x0805dd15 in trim_trailing_separator (path=0x0) at path.c:442
> #1  0x0805d6b2 in canonicalize_path (path=0x0) at path.c:123
> #2  0x0804af80 in exec_command (cmd=0x808f958 "e", scan_state=0x808ba30, query_buf=0x808bb80)
>     at command.c:378

You seem to be missing this patch:

http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/bin/psql/command.c.diff?r1=1.122;r2=1.123


            regards, tom lane