From owner-freebsd-java@FreeBSD.ORG Sun Jan 6 21:20:03 2008 Return-Path: Delivered-To: freebsd-java@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D578816A420 for ; Sun, 6 Jan 2008 21:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C7F6513C465 for ; Sun, 6 Jan 2008 21:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m06LK2Qf055672 for ; Sun, 6 Jan 2008 21:20:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m06LK2g4055671; Sun, 6 Jan 2008 21:20:02 GMT (envelope-from gnats) Resent-Date: Sun, 6 Jan 2008 21:20:02 GMT Resent-Message-Id: <200801062120.m06LK2g4055671@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-java@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Bernhard Froehlich Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91DD816A417 for ; Sun, 6 Jan 2008 21:10:56 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 92C0613C43E for ; Sun, 6 Jan 2008 21:10:56 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m06L9vkI043213 for ; Sun, 6 Jan 2008 21:09:57 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m06L9vYt043212; Sun, 6 Jan 2008 21:09:57 GMT (envelope-from nobody) Message-Id: <200801062109.m06L9vYt043212@www.freebsd.org> Date: Sun, 6 Jan 2008 21:09:57 GMT From: Bernhard Froehlich To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: java/119397: java/jdk16: Wrong locales with patchset 3 X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jan 2008 21:20:03 -0000 >Number: 119397 >Category: java >Synopsis: java/jdk16: Wrong locales with patchset 3 >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-java >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jan 06 21:20:02 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Bernhard Froehlich >Release: FreeBSD 7.0-RC1 >Organization: >Environment: FreeBSD chii.bluelife.at 7.0-RC1 FreeBSD 7.0-RC1 #1: Sat Dec 29 12:29:16 CET 2007 decke@chii.bluelife.at:/usr/obj/usr/src/sys/GENERIC amd64 >Description: All available locales are detected and replaced at build time in work/control/build/bsd-amd64/gensrc/sun/util/LocaleDataMetaInfo.java. With JDK 1.6 and patchset 3 the result is always " ben sun/text/resources/ | arn sun/text/resources/ " and is definitely wrong. http://lists.freebsd.org/pipermail/freebsd-java/2007-December/007027.html >How-To-Repeat: Locale.getAvailableLocales() returns an String array with: "ben", "arn", "sun/text/resources/" import java.util.Locale; import sun.util.LocaleDataMetaInfo; public class LocaleDebug { public static void main(String[] args) { Locale[] locales = Locale.getAvailableLocales(); for(int i=0; i < locales.length; i++) System.out.println(locales[i]); System.out.println("sun.text.resources.FormatData -> " + LocaleDataMetaInfo.getSupportedLocaleString("sun.text.resources.FormatData")); } } >Fix: There are 2 files j2se/make/java/java/localegen.sh and j2se/make/java/java/genlocales.gmk that are responsible for detecting and generating the list of available locales. All locales are formattet in genlocales.gmk and stored in a temporary file where one line should be one locale and seperated with newlines. I have found that this does not work because '\n' is interpreted as string and not as an escape character (newline) so the format of the file is wrong and causes the error. @$(ECHO) $(subst .properties,'\n',$(Euro_Resources_properties)) > $@.tmp.euro; @$(ECHO) $(subst .java,'\n',$(Euro_Resources_java)) >> $@.tmp.euro; The second part is localegen.sh where this temporary file is read ... localelist=`$NAWK -F$1_ '{print $2}' $2 | sort` The second parameter of nawk contains a $ and is not escaped so it gets replaced by the shell and not passed thru to nawk as it was expected. My attached fix is more like a workaround because it uses sed to reformat the badly formattet tempory file of locales. Patch attached with submission follows: --- ../../j2se/make/java/java/localegen.sh.orig 2008-01-06 16:38:14.000000000 +0100 +++ ../../j2se/make/java/java/localegen.sh 2008-01-06 16:51:26.000000000 +0100 @@ -22,7 +22,7 @@ localelist= getlocalelist() { localelist="" - localelist=`$NAWK -F$1_ '{print $2}' $2 | sort` + localelist=`$SED -e 'y/ /\n/' -e 's/\\\n//g' $2 | $NAWK -F$1_ '{print \$2}' | sort` } sed_script="$SED -e \"s@^#warn .*@// -- This file was mechanically generated: Do not edit! -- //@\" " >Release-Note: >Audit-Trail: >Unformatted: