NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/52849: libedit core dumps on saving history file with psql from postgresql*-client packages on amd64 platform



>Number:         52849
>Category:       lib
>Synopsis:       libedit core dumps on saving history file with psql from postgresql*-client packages on amd64 platform
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 22 15:55:00 +0000 2017
>Originator:     Paul J Lavoie
>Release:        -current from past several months
>Organization:
>Environment:
NetBSD dipper 8.99.9 NetBSD 8.99.9 (GENERIC) #2: Thu Dec 14 14:11:23 UTC 2017  root@dipper:/usr/obj/sys/arch/amd64/compile/GENERIC amd64
>Description:
Postgresql for the past few months (since 10 was introduced into pkgsrc at least back in October) would fail to save its history file on exit, producing a core dump. Copy/paste of multi-line input within an X session would also only input the first line of text. This was found to also apply to postgresql96-client when checked a couple weeks ago, which had been working fine in the summer.

Having become frustrated with this and having some time, I've spent the past couple of days hunting down this issue. Compiling -current with MKDEBUGLIB enabled, I found that psql was crashing on the exit code inside the history_save_fp() function, specifically the first line:

if (fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1)

due to a null being passed as fp. 

I've recompiled postgresql10-client to use the READLINE_DEFAULT=readline to avoid the libedit variant, and have found that the application now works properly, in both use cases.

Given that postgresql works with readline, but not with libedit, I'm inclined to think that some recent change in libedit has broken compatibility.

I may look further to see if I can pinpoint the issue.
>How-To-Repeat:
Grab -current
Grab pkgsrc
Compile postgresql10-client (or postgresql96-client)
Connect to postgresql db with the command utility 'psql'
Exit application
Watch core dump.
>Fix:
Workaround: compile postgresql*-client with readline instead of libedit.



Home | Main Index | Thread Index | Old Index