From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9946 invoked by alias); 21 Jun 2011 13:55:51 -0000 Received: (qmail 9929 invoked by uid 22791); 21 Jun 2011 13:55:49 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,TW_GC,TW_IB,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 21 Jun 2011 13:55:31 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 38BDC4CE; Tue, 21 Jun 2011 15:55:30 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id IN8x02ZNnYjD; Tue, 21 Jun 2011 15:55:28 +0200 (CEST) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 2A2954CD; Tue, 21 Jun 2011 15:55:28 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id p5LDtRhm019283; Tue, 21 Jun 2011 15:55:27 +0200 (MEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: java-patches@gcc.gnu.org Subject: [libjava] Fix md5test, shatest on Tru64 UNIX with native libiconv (PR libgcj/49314) Date: Tue, 21 Jun 2011 13:55:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (usg-unix-v) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact java-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@gcc.gnu.org X-SW-Source: 2011-q2/txt/msg00083.txt.bz2 As described in the PR, unless the UTF-8 encoding of \ufeff is padded with a NUL byte, the iconv_init test fails for the native Tru64 UNIX libiconv, iconv_byte_swap isn't set correctly and later iconv calls fail. This patch fixes this, allowing the arraycopy testcase in the PR and the actual md5test and shatest testcases to succeed. This way, I get clean libjava testsuite results. Tested by rebuilding libgcj.so with the fixed natIconv.cc. A full rebuild and test of libgcj is currently running on alpha-dec-osf5.1b. Ok for mainline if it passes? Thanks. Rainer 2011-06-21 Rainer Orth PR libgcj/49314 * gnu/gcj/convert/natIconv.cc (iconv_init): Pad in[] with NUL byte. diff --git a/libjava/gnu/gcj/convert/natIconv.cc b/libjava/gnu/gcj/convert/natIconv.cc --- a/libjava/gnu/gcj/convert/natIconv.cc +++ b/libjava/gnu/gcj/convert/natIconv.cc @@ -1,6 +1,6 @@ // natIconv.cc -- Java side of iconv() reader. -/* Copyright (C) 2000, 2001, 2003, 2006 Free Software Foundation +/* Copyright (C) 2000, 2001, 2003, 2006, 2011 Free Software Foundation This file is part of libgcj. @@ -264,17 +264,19 @@ gnu::gcj::convert::IOConverter::iconv_in if (handle != (iconv_t) -1) { jchar c; - unsigned char in[3]; + unsigned char in[4]; char *inp, *outp; size_t inc, outc, r; - // This is the UTF-8 encoding of \ufeff. + // This is the UTF-8 encoding of \ufeff. At least Tru64 UNIX libiconv + // needs the trailing NUL byte, otherwise iconv fails with EINVAL. in[0] = 0xef; in[1] = 0xbb; in[2] = 0xbf; + in[3] = 0x00; inp = (char *) in; - inc = 3; + inc = 4; outp = (char *) &c; outc = 2; -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University