Thread: pg_dump segfaults on command-line arguments?

pg_dump segfaults on command-line arguments?

From
Martijn van Oosterhout
Date:
This seems like such a silly thing I'm sure it's been fixed already. It
happens on both machines where I have 7.2.1 installed. It appears to
segfault when receiving any long options it doesn't recognise. Is it a
problem with my libraries or with postgres? OS is Debian 2.2.

Feel free to tell me it's because the system needs an upgrade :)

flow:~# psql -V
psql (PostgreSQL) 7.2.1
contains support for: readline, history, multibyte
Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
Portions Copyright (c) 1996, Regents of the University of California
Read the file COPYRIGHT or use the command \copyright to see the
usage and distribution terms.
flow:~# pg_dump -V
pg_dump (PostgreSQL) 7.2.1
flow:~# pg_dump --inserts
pg_dump: no database name specified
flow:~# pg_dump --inse
Segmentation fault
flow:~# pg_dump --fsd
Segmentation fault
flow:~# pg_dump -d -t g
pg_dump: no database name specified
flow:~# dpkg -l 'postgres*' | grep ii
ii  postgresql     7.2.1-2        Object-relational SQL database, descended fr
ii  postgresql-cli 7.2.1-2        Front-end programs for PostgreSQL
ii  postgresql-dev 7.2.1-2        Header files for libpq (postgresql library)
ii  postgresql-doc 7.2.1-2        Documentation for the PostgreSQL database.
flow:~# ldd /usr/lib/postgresql/bin/pg_dump
        libpq.so.2 => /usr/lib/libpq.so.2 (0x40016000)
        libpam.so.0 => /lib/libpam.so.0 (0x40028000)
        libz.so.1 => /usr/lib/libz.so.1 (0x40030000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x4003f000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x4006c000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x4007b000)
        libdl.so.2 => /lib/libdl.so.2 (0x40091000)
        libm.so.6 => /lib/libm.so.6 (0x40096000)
        libreadline.so.4 => /lib/libreadline.so.4 (0x400b3000)
        libc.so.6 => /lib/libc.so.6 (0x400d8000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
        libncurses.so.5 => /lib/libncurses.so.5 (0x401b5000)
flow:~# ls -l `ldd /usr/lib/postgresql/bin/pg_dump | cut '-d ' -f3` | cut -c 57-
/lib/ld-linux.so.2 -> ld-2.1.3.so
/lib/libc.so.6 -> libc-2.1.3.so
/lib/libcrypt.so.1 -> libcrypt-2.1.3.so
/lib/libdl.so.2 -> libdl-2.1.3.so
/lib/libm.so.6 -> libm-2.1.3.so
/lib/libncurses.so.5 -> libncurses.so.5.0
/lib/libnsl.so.1 -> libnsl-2.1.3.so
/lib/libpam.so.0 -> libpam.so.0.72
/lib/libreadline.so.4 -> libreadline.so.4.1
/lib/libresolv.so.2 -> libresolv-2.1.3.so
/usr/lib/libpq.so.2 -> libpq.so.2.2
/usr/lib/libz.so.1 -> libz.so.1.1.3

Thanks in advance,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

Re: pg_dump segfaults on command-line arguments?

From
Tom Lane
Date:
Martijn van Oosterhout <kleptog@svana.org> writes:
> This seems like such a silly thing I'm sure it's been fixed already.

Yeah, it has, but there's been no 7.2.2 release.  You could get the
7.2-branch patch from the CVS archives:

2002-05-13 22:08  ishii

    * src/bin/: pg_dump/pg_dump.c, psql/startup.c (REL7_2_STABLE): Fix
    bug in pg_dump and psql (to reproduce the bug, just try pg_dump
    --nonexistingoption).

    per report from sugita@sra.co.jp on Thu, 09 May 2002 11:57:51 +0900
    (JST) at pgsql-patches list.

    Illegal long options to pg_dump makes core on some systems, since
    it lacks the last null sentinel of struct option array.

    Attached is a patch made by Mr. Ishida Akio <iakio@pjam.jpweb.net>.


            regards, tom lane