Thread: psql Crash in -TIP

psql Crash in -TIP

From
Rod Taylor
Date:
case '/':if (pset.db)    strncpy(buf, PQdb(pset.db), MAX_PROMPT_SIZE);break;


In the above code segment from prompt.c (PSQL sources) it appears
PQdb(pset.db) is returning NULL for me.

(gdb) run
Starting program: /usr/home/rbt/work/postgresql/dbdocs/bin/./psql
Welcome to psql 7.4devel, the PostgreSQL interactive terminal.
Type:  \copyright for distribution terms      \h for help with SQL commands      \? for help on internal slash commands
    \g or terminate with semicolon to execute query      \q to quit 
Program received signal SIGSEGV, Segmentation fault.
0x48169d14 in strncpy () from /usr/lib/libc.so.4
(gdb) backtrace
#0  0x48169d14 in strncpy () from /usr/lib/libc.so.4
#1  0x805151a in get_prompt (status=PROMPT_READY) at prompt.c:172
#2  0x804f073 in MainLoop (source=0x4818ddc0) at mainloop.c:178
#3  0x8050c25 in main (argc=1, argv=0xbfbffaa0) at startup.c:301
#4  0x804a43e in _start ()


--
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

Re: psql Crash in -TIP

From
Tom Lane
Date:
Rod Taylor <rbt@rbt.ca> writes:
> In the above code segment from prompt.c (PSQL sources) it appears
> PQdb(pset.db) is returning NULL for me.

Um.  I think I know where I broke that ...
        regards, tom lane



Re: psql Crash in -TIP

From
Tom Lane
Date:
Tom Lane <tgl@sss.pgh.pa.us> writes:
> Rod Taylor <rbt@rbt.ca> writes:
>> In the above code segment from prompt.c (PSQL sources) it appears
>> PQdb(pset.db) is returning NULL for me.

> Um.  I think I know where I broke that ...

Fixed now.
        regards, tom lane