NetBSD Problem Report #43879
From www@NetBSD.org Tue Sep 14 17:32:00 2010
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id AE34A63B966
for <gnats-bugs@gnats.NetBSD.org>; Tue, 14 Sep 2010 17:32:00 +0000 (UTC)
Message-Id: <20100914173200.3EF6963B960@www.NetBSD.org>
Date: Tue, 14 Sep 2010 17:32:00 +0000 (UTC)
From: ftigeot@wolfpond.org
Reply-To: ftigeot@wolfpond.org
To: gnats-bugs@NetBSD.org
Subject: gettext-lib miscompiles on DragonFly
X-Send-Pr-Version: www-1.0
>Number: 43879
>Category: pkg
>Synopsis: gettext-lib miscompiles on DragonFly
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: darcy
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Sep 14 17:35:00 +0000 2010
>Closed-Date: Wed Nov 03 05:14:10 +0000 2010
>Last-Modified: Wed Nov 03 05:14:10 +0000 2010
>Originator: Francois Tigeot
>Release: DragonFlyBSD
>Organization:
>Environment:
DragonFly sekishi.zefyris.com 2.7-DEVELOPMENT DragonFly v2.7.3.962.gd8d671-DEVELOPMENT #3: Tue Sep 14 11:55:21 CEST 2010 ftigeot@sekishi.zefyris.com:/usr/obj/usr/src/sys/BADAXE64 x86_64
>Description:
With a DragonFly/x86-64 system, setting LANG to a non-english locale results in an immediate crash of applications using devel/gettext-lib (pretty much everything in a modern X11 desktop).
Example with mutt:
$ LANG=fr_FR.UTF-8 mutt
[1] 5541 segmentation fault (core dumped) LANG=fr_FR.UTF-8 mutt
I have tracked this crash to line 669 of gettext-runtime/intl/dcigettext.c
This line uses a value returned by a previous call of tsearch().
tsearch() is declared in /usr/include/search.h and returns a pointer.
Howewer, search.h is not included in dcigettext.c and thus the compiler considers tsearch() returns a value of type int.
With the amd64 ABI, sizeof(int) is less than sizeof(void*). The pointer is truncated and the program crashes trying to access a random memory address.
The problem also exists on DragonFly/i386, but on this architecture, sizeof(int) and sizeof(void*) are the same and thus the void* to int conversion does not results in any ill effects.
The reason <search.h> is not included ultimately lies with the GNU configure system. This code is an extract of dcigettext.c:
# if defined HAVE_SEARCH_H
# include <search.h>
# endif
The inclusion of <search.h> is protected by the HAVE_SEARCH_H symbol. It should be defined in an automatically generated file, configure.h but is not.
>How-To-Repeat:
Set LANG to fr_FR.UTF-8
Try to run mail/mutt
>Fix:
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->dragonfly-pkg-people
Responsible-Changed-By: hauke@NetBSD.org
Responsible-Changed-When: Thu, 16 Sep 2010 10:27:38 +0000
Responsible-Changed-Why:
DragonFly specific issue.
From: Francois Tigeot <ftigeot@wolfpond.org>
To: gnats-bugs@NetBSD.org
Cc: hauke@NetBSD.org, dragonfly-pkg-people@NetBSD.org, pkg-manager@NetBSD.org,
pkgsrc-bugs@NetBSD.org, gnats-admin@NetBSD.org
Subject: Re: pkg/43879 (gettext-lib miscompiles on DragonFly)
Date: Fri, 24 Sep 2010 22:01:32 +0200
This is a multi-part message in MIME format.
--------------070403030107030108060203
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
hauke@NetBSD.org wrote:
> Synopsis: gettext-lib miscompiles on DragonFly
>
> Responsible-Changed-From-To: pkg-manager->dragonfly-pkg-people
> Responsible-Changed-By: hauke@NetBSD.org
> Responsible-Changed-When: Thu, 16 Sep 2010 10:27:38 +0000
> Responsible-Changed-Why:
> DragonFly specific issue.
I think I have a fix.
With the attached patches, HAVE_SEARCH_H is now correctly defined and
there is no more crash with non-english locales on 64-bit systems.
I'm not exactly familiar with pkgsrc/autoconf interaction, so there may
be a better way.
--
Francois Tigeot
--------------070403030107030108060203
Content-Type: text/plain;
name="Makefile.diff"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="Makefile.diff"
LS0tIE1ha2VmaWxlLm9yaWcJMjAxMC0wOS0yNCAyMTozOTozOSArMDIwMAorKysgTWFrZWZp
bGUJMjAxMC0wOS0yNCAyMTo1MjoyNyArMDIwMApAQCAtMzUsNSArMzUsMTAgQEAKIFJFUURf
RElSUys9CQkke0xPQ0FMRURJUn0KIFJFUURfRklMRVMrPQkJJHtFR0RJUn0vbG9jYWxlLmFs
aWFzICR7TE9DQUxFRElSfS9sb2NhbGUuYWxpYXMKIAorVVNFX1RPT0xTKz0JCWF1dG9jb25m
CisKK3ByZS1jb25maWd1cmU6CisJY2QgJHtXUktTUkN9L2dldHRleHQtcnVudGltZSAmJiBh
dXRvY29uZgorCiAuaW5jbHVkZSAiLi4vLi4vY29udmVydGVycy9saWJpY29udi9idWlsZGxp
bmszLm1rIgogLmluY2x1ZGUgIi4uLy4uL21rL2JzZC5wa2cubWsiCg==
--------------070403030107030108060203
Content-Type: text/plain;
name="patch-ad"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="patch-ad"
LS0tIGdldHRleHQtcnVudGltZS9jb25maWd1cmUuYWMub3JpZwkyMDA1LTA1LTIwIDIzOjAz
OjM5ICswMjAwCisrKyBnZXR0ZXh0LXJ1bnRpbWUvY29uZmlndXJlLmFjCTIwMTAtMDktMjQg
MjE6Mjc6MzUgKzAyMDAKQEAgLTc2LDYgKzc2LDcgQEAKIAogZG5sIENoZWNrcyBmb3IgaGVh
ZGVyIGZpbGVzLgogQUNfQ0hFQ0tfSEVBREVSUyhzdHJpbmcuaCkKK0FDX0NIRUNLX0hFQURF
UlMoc2VhcmNoLmgpCiBBTV9TVERCT09MX0gKIAogZG5sIENoZWNrcyBmb3IgdHlwZWRlZnMs
IHN0cnVjdHVyZXMsIGFuZCBjb21waWxlciBjaGFyYWN0ZXJpc3RpY3MuCg==
--------------070403030107030108060203--
Responsible-Changed-From-To: dragonfly-pkg-people->dfly-pkg-people
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Sat, 25 Sep 2010 23:04:43 +0000
Responsible-Changed-Why:
wrong address
Responsible-Changed-From-To: dfly-pkg-people->joerg
Responsible-Changed-By: reed@NetBSD.org
Responsible-Changed-When: Fri, 22 Oct 2010 11:06:31 +0000
Responsible-Changed-Why:
Assigned to maintainer. Newer code doesn't use same gettext-runtime/configure.ac. It does still use the tsearch.
From: "D'Arcy J.M. Cain" <darcy@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/43879 CVS commit: pkgsrc/devel/gettext-lib
Date: Fri, 22 Oct 2010 16:12:48 +0000
Module Name: pkgsrc
Committed By: darcy
Date: Fri Oct 22 16:12:48 UTC 2010
Modified Files:
pkgsrc/devel/gettext-lib: Makefile distinfo
Added Files:
pkgsrc/devel/gettext-lib/patches: patch-ad
Log Message:
Fix compile on Dragonfly.
Closes PR #43879.
Patch supplied by ftigeot@wolfpond.org.
Tested by darcy@NetBSD.org on i386.
No revision bump as no code changed.
To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 pkgsrc/devel/gettext-lib/Makefile
cvs rdiff -u -r1.15 -r1.16 pkgsrc/devel/gettext-lib/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/devel/gettext-lib/patches/patch-ad
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 25 Oct 2010 03:03:47 +0000
State-Changed-Why:
Fixed, thanks for the patch.
Responsible-Changed-From-To: joerg->darcy
Responsible-Changed-By: joerg@NetBSD.org
Responsible-Changed-When: Mon, 25 Oct 2010 16:13:18 +0000
Responsible-Changed-Why:
commiter who committed the partially objected change.
State-Changed-From-To: closed->analyzed
State-Changed-By: joerg@NetBSD.org
State-Changed-When: Mon, 25 Oct 2010 16:13:18 +0000
State-Changed-Why:
Change has incorrect side effects like pulling Perl in via autoconf.
State-Changed-From-To: analyzed->feedback
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Thu, 28 Oct 2010 09:36:01 +0000
State-Changed-Why:
Fixed differently, ok?
From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/43879 CVS commit: pkgsrc/devel/gettext-lib
Date: Thu, 28 Oct 2010 09:34:20 +0000
Module Name: pkgsrc
Committed By: wiz
Date: Thu Oct 28 09:34:19 UTC 2010
Modified Files:
pkgsrc/devel/gettext-lib: Makefile distinfo
Removed Files:
pkgsrc/devel/gettext-lib/patches: patch-ac patch-ad
Log Message:
Remove patch-ad and Makefile changes intended to fix PR 43879 that
caused PR 44003.
Fix PR 43879 by removing patch-ac which was added in 2004 to fix a problem
on Darwin -- Darwins from at least 10.4 up don't need it any longer.
To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 pkgsrc/devel/gettext-lib/Makefile
cvs rdiff -u -r1.16 -r1.17 pkgsrc/devel/gettext-lib/distinfo
cvs rdiff -u -r1.3 -r0 pkgsrc/devel/gettext-lib/patches/patch-ac
cvs rdiff -u -r1.1 -r0 pkgsrc/devel/gettext-lib/patches/patch-ad
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Francois Tigeot <ftigeot@wolfpond.org>
To: gnats-bugs@NetBSD.org
Cc: darcy@NetBSD.org, gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org,
ftigeot@wolfpond.org
Subject: Re: PR/43879 CVS commit: pkgsrc/devel/gettext-lib
Date: Thu, 28 Oct 2010 16:24:01 +0200
The fix is good, gettext-lib now builds without trouble and runs fine
on a DragonFly/x86-64 host.
--
Francois Tigeot
State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Wed, 03 Nov 2010 05:14:10 +0000
State-Changed-Why:
Confirmed fixed, thanks
>Unformatted:
Here are the above changes in plain text. I will commit them in an hour.
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/devel/gettext-lib/Makefile,v
retrieving revision 1.48
diff -u -r1.48 Makefile
--- Makefile 5 Feb 2010 08:44:03 -0000 1.48
+++ Makefile 22 Oct 2010 14:58:35 -0000
@@ -35,5 +35,10 @@
REQD_DIRS+= ${LOCALEDIR}
REQD_FILES+= ${EGDIR}/locale.alias ${LOCALEDIR}/locale.alias
+USE_TOOLS+= autoconf
+
+pre-configure:
+ cd ${WRKSRC}/gettext-runtime && autoconf
+
.include "../../converters/libiconv/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
New file patches/patch-ad:
$NetBSD$
--- gettext-runtime/configure.ac.orig 2005-05-20 21:03:39.000000000 +0000
+++ gettext-runtime/configure.ac
@@ -76,6 +76,7 @@ dnl Checks for libraries.
dnl Checks for header files.
AC_CHECK_HEADERS(string.h)
+AC_CHECK_HEADERS(search.h)
AM_STDBOOL_H
dnl Checks for typedefs, structures, and compiler characteristics.
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.