cc'ing maintainer Scott Vanderbilt <[email protected]> writes:
> On 5/28/2016 6:05 AM, Jeremie Courreges-Anglas wrote: >> Scott Vanderbilt <[email protected]> writes: >> >>> I just upgraded amd64 snapshots (20 April to 26 May), and refreshed my >>> ports. nano is now dumping core on launch with following error: >>> >>> nano(69373) in free(): error: bogus pointer (double free?) 0x440e168aca0 >>> Abort trap (core dumped) >>> >>> dmesg follows. What more information can I provide that will be useful? >> >> A gdb backtrace. >> >> The port will probably not provide debug symbols, making the output not >> very helpful (still, it would be better than nothing). To get a package >> with debug symbols, >> >> cd /usr/ports/editors/nano && make clean repackage reinstall DEBUG=-g >> >> should be enough. >> > > OK, I think I got it. Apologies, if not - this is my first time using gdb. > > nano(94903) in free(): error: bogus pointer (double free?) 0xb9af74d42e0 > > Program received signal SIGABRT, Aborted. > 0x00000b9af70a9fda in thrkill () at <stdin>:2 > 2 <stdin>: No such file or directory. > in <stdin> > Current language: auto; currently asm > (gdb) bt > #0 0x00000b9af70a9fda in thrkill () at <stdin>:2 > #1 0x00000b9af7042999 in *_libc_abort () at > /usr/src/lib/libc/stdlib/abort.c:52 > #2 0x00000b9af70ac009 in wrterror (d=0xb9afee555a0, msg=0xb9af71bc7f6 > "bogus pointer (double free?)", p=0xb9af74d42e0) at > /usr/src/lib/libc/stdlib/malloc.c:295 > #3 0x00000b9af70ad4db in free (ptr=0xb9af74d42e0) at > /usr/src/lib/libc/stdlib/malloc.c:1362 > #4 0x00000b98dea0ddda in has_valid_path (filename=0x7f7ffffcd554 > "/etc/mail/myblack2.txt") at files.c:62 > #5 0x00000b98dea0ea2d in open_buffer (filename=0x7f7ffffcd554 > "/etc/mail/myblack2.txt", undoable=false) at files.c:452 > #6 0x00000b98dea185f5 in main (argc=2, argv=0x7f7ffffcd408) at nano.c:2599 > (gdb) Good, I understand why I couldn't reproduce it at first. The following patch should help. Index: Makefile =================================================================== RCS file: /cvs/ports/editors/nano/Makefile,v retrieving revision 1.79 diff -u -p -r1.79 Makefile --- Makefile 26 Apr 2016 15:54:00 -0000 1.79 +++ Makefile 28 May 2016 14:12:23 -0000 @@ -3,6 +3,7 @@ COMMENT= Pico editor clone with enhancements DISTNAME= nano-2.5.3 +REVISION= 0 CATEGORIES= editors HOMEPAGE= http://www.nano-editor.org/ Index: patches/patch-src_files_c =================================================================== RCS file: patches/patch-src_files_c diff -N patches/patch-src_files_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_files_c 28 May 2016 14:12:23 -0000 @@ -0,0 +1,36 @@ +$OpenBSD$ + +Relies on GNU dirname(3) behavior. + +--- src/files.c.orig Sat May 28 16:03:10 2016 ++++ src/files.c Sat May 28 16:08:27 2016 +@@ -36,14 +36,16 @@ + /* Verify that the containing directory of the given filename exists. */ + bool has_valid_path(const char *filename) + { +- char *parentdir; ++ char *parentbuf, *parentdir; + struct stat parentinfo; + bool validity = FALSE; + + if (strrchr(filename, '/') == NULL) +- parentdir = mallocstrcpy(NULL, "."); +- else +- parentdir = dirname(mallocstrcpy(NULL, filename)); ++ parentbuf = parentdir = mallocstrcpy(NULL, "."); ++ else { ++ parentbuf = mallocstrcpy(NULL, filename); ++ parentdir = dirname(parentbuf); ++ } + + if (stat(parentdir, &parentinfo) == -1) { + if (errno == ENOENT) +@@ -59,7 +61,7 @@ bool has_valid_path(const char *filename) + validity = TRUE; + } + +- free(parentdir); ++ free(parentbuf); + + if (!validity) + beep(); -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
