From owner-freebsd-ports@FreeBSD.ORG Sat Oct 4 19:30:12 2003 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B8FB916A4B3 for ; Sat, 4 Oct 2003 19:30:12 -0700 (PDT) Received: from mail.inka.de (quechua.inka.de [193.197.184.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3324D43F75 for ; Sat, 4 Oct 2003 19:30:11 -0700 (PDT) (envelope-from naddy@mips.inka.de) Received: from kemoauc.mips.inka.de (uucp@) by mail.inka.de with gbsmtp id 1A5yev-0007B7-01; Sun, 05 Oct 2003 04:30:09 +0200 Received: from kemoauc.mips.inka.de (localhost [127.0.0.1]) by kemoauc.mips.inka.de (8.12.10/8.12.10) with ESMTP id h952EwQc064569 for ; Sun, 5 Oct 2003 04:14:59 +0200 (CEST) (envelope-from naddy@kemoauc.mips.inka.de) Received: (from naddy@localhost) by kemoauc.mips.inka.de (8.12.10/8.12.10/Submit) id h952Ewq3064568 for freebsd-ports@freebsd.org; Sun, 5 Oct 2003 04:14:58 +0200 (CEST) (envelope-from naddy) Date: Sun, 5 Oct 2003 04:14:58 +0200 From: Christian Weisgerber To: freebsd-ports@freebsd.org Message-ID: <20031005021458.GA64365@kemoauc.mips.inka.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0OAP2g/MAC+5xKAE" Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: editors/nano fix needs testing X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2003 02:30:12 -0000 --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline The attached patch should fix nano's core dump on -CURRENT (which is also reproducible on -STABLE with sufficiently aggressive MALLOC_OPTIONS). I don't really use nano, though, so it would be nice if some people who do did test this on -CURRENT and -STABLE. -- Christian "naddy" Weisgerber naddy@mips.inka.de --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="nano.patch" Index: Makefile =================================================================== RCS file: /home/pcvs/ports/editors/nano/Makefile,v retrieving revision 1.23 diff -u -r1.23 Makefile --- Makefile 4 Oct 2003 23:07:39 -0000 1.23 +++ Makefile 5 Oct 2003 01:16:47 -0000 @@ -7,7 +7,7 @@ PORTNAME= nano PORTVERSION= 1.2.2 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= editors MASTER_SITES= http://www.nano-editor.org/dist/v1.2/ @@ -29,10 +29,4 @@ ${MKDIR} ${EXAMPLESDIR} ${INSTALL_DATA} ${WRKSRC}/nanorc.sample ${EXAMPLESDIR} -.include - -.if ${OSVERSION} > 500000 -BROKEN= "memory allocation bug" -.endif - -.include +.include Index: files/patch-files.c =================================================================== RCS file: files/patch-files.c diff -N files/patch-files.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/patch-files.c 5 Oct 2003 01:16:47 -0000 @@ -0,0 +1,56 @@ + +$FreeBSD$ + +--- files.c.orig Sun Oct 5 02:30:55 2003 ++++ files.c Sun Oct 5 02:35:06 2003 +@@ -1701,16 +1701,17 @@ + #ifdef NANO_EXTRA + static int did_cred = 0; + #endif ++ static char *writepath = NULL; + + #if !defined(DISABLE_BROWSER) || (!defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)) + currshortcut = writefile_list; + #endif + +- answer = mallocstrcpy(answer, path); ++ writepath = mallocstrcpy(writepath, path); + + if (exiting && ISSET(TEMP_OPT)) { + if (filename[0] != '\0') { +- i = write_file(answer, 0, 0, 0); ++ i = write_file(writepath, 0, 0, 0); + display_main_list(); + return i; + } else { +@@ -1751,24 +1752,24 @@ + "%s%s%s", _("Write Selection to File"), formatstr, backupstr); + } else { + if (append == 2) +- i = statusq(1, writefile_list, answer, 0, ++ i = statusq(1, writefile_list, writepath, 0, + "%s%s%s", _("File Name to Prepend to"), formatstr, backupstr); + else if (append == 1) +- i = statusq(1, writefile_list, answer, 0, ++ i = statusq(1, writefile_list, writepath, 0, + "%s%s%s", _("File Name to Append to"), formatstr, backupstr); + else +- i = statusq(1, writefile_list, answer, 0, ++ i = statusq(1, writefile_list, writepath, 0, + "%s%s%s", _("File Name to Write"), formatstr, backupstr); + } + #else + if (append == 2) +- i = statusq(1, writefile_list, answer, ++ i = statusq(1, writefile_list, writepath, + "%s", _("File Name to Prepend to")); + else if (append == 1) +- i = statusq(1, writefile_list, answer, ++ i = statusq(1, writefile_list, writepath, + "%s", _("File Name to Append to")); + else +- i = statusq(1, writefile_list, answer, ++ i = statusq(1, writefile_list, writepath, + "%s", _("File Name to Write")); + #endif /* !NANO_SMALL */ + Index: files/patch-search.c =================================================================== RCS file: files/patch-search.c diff -N files/patch-search.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/patch-search.c 5 Oct 2003 01:16:47 -0000 @@ -0,0 +1,19 @@ + +$FreeBSD$ + +--- search.c.orig Sun Oct 5 02:38:32 2003 ++++ search.c Sun Oct 5 02:40:32 2003 +@@ -769,8 +769,12 @@ + + int do_gotoline(int line, int save_pos) + { ++ static char *linestr = NULL; ++ ++ linestr = mallocstrcpy(linestr, answer); ++ + if (line <= 0) { /* Ask for it */ +- int st = statusq(FALSE, goto_list, line != 0 ? answer : "", ++ int st = statusq(FALSE, goto_list, line != 0 ? linestr : "", + #ifndef NANO_SMALL + NULL, + #endif --0OAP2g/MAC+5xKAE--