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 [EMAIL PROTECTED])
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend

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

               http://archives.postgresql.org

Reply via email to