public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/14722] New: Bug in conversion to Unicode of command line arguments
@ 2004-03-24 18:28 John dot Downey at ftid dot com
  2004-03-24 18:36 ` [Bug libgcj/14722] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: John dot Downey at ftid dot com @ 2004-03-24 18:28 UTC (permalink / raw)
  To: java-prs

This seems to be a bug in gcj 3.3.2 which only occurs on Solaris 8. I
don't think it happened on Solaris 7 (though I can't verify that any
more) and it doesn't happen on Linux. I don't have access to any other
systems that I can build GCC on.

It also doesn't happen with Sun's java interpreter on Solaris 8.

The problem is that, with a native executable built with gcj, the
first command-line argument is converted to Unicode in such a way that
it starts with a Unicode byte order mark (0xfeff, decimal 65279). This
tends to be confusing for programs that want to do command-line
argument processing, especially for options starting with '-'.

I apologize if this has been reported before, but I couldn't find it
on the bugs database.

Of course, this may well be a Sun bug, but whether they'll be prepared
to fix it for the sake of gcj is another question.

I hope this is enough information. I haven't run the compiler with
-save-temps because there are no include files involved.

Regards,

John Downey

Here are my results:

$ uname -a
SunOS gp003dev 5.8 Generic_108528-22 sun4u sparc SUNW,Ultra-Enterprise
$
$ gcj -v --encoding=UTF-8 --classpath= --main=showargs showargs.java
Reading specs from
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/specs
Reading specs from
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/../../../libgcj.spec
rename spec lib to liborig
Configured with: /home/exshutil/src/gcc-3.3.2/configure
--prefix=/home/exshutil/gcc3 --with-gnu-as --with-as=/home/exshutil/bin/as
--with-gnu-ld --with-ld=/home/exshutil/bin/ld --enable-languages=c,c++,java
--disable-multilib
Thread model: posix
gcc version 3.3.2
 /home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/jc1 showargs.java
-fuse-divide-subroutine -fcheck-references -fuse-boehm-gc
-fkeep-inline-functions -quiet -dumpbase showargs.java -auxbase showargs -g1
-version -fencoding=UTF-8 -fclasspath= -o /var/tmp//ccSra4IQ.s
GNU Java version 3.3.2 (sparc-sun-solaris2.8)
        compiled by GNU C version 3.3.2.
GGC heuristics: --param ggc-min-expand=65 --param ggc-min-heapsize=65536
Class path starts here:
    ./
    /home/exshutil/gcc3/share/java/libgcj-3.3.2.jar/ (system) (zip)
 /home/exshutil/bin/as --traditional-format -V -Qy -s -o /var/tmp//ccsPFruL.o
/var/tmp//ccSra4IQ.s
GNU assembler version 2.9.1 (sparc-sun-solaris2.7), using BFD version 2.9.1
 /home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/jvgenmain
showargsmain /var/tmp//ccuNC3qK.i
 /home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/cc1
/var/tmp//ccuNC3qK.i -quiet -dumpbase showargsmain.c -g1 -version
-fdollars-in-identifiers -o /var/tmp//ccSra4IQ.s
GNU C version 3.3.2 (sparc-sun-solaris2.8)
        compiled by GNU C version 3.3.2.
GGC heuristics: --param ggc-min-expand=65 --param ggc-min-heapsize=65536
 /home/exshutil/bin/as --traditional-format -V -Qy -s -o /var/tmp//ccg3eqmM.o
/var/tmp//ccSra4IQ.s
GNU assembler version 2.9.1 (sparc-sun-solaris2.7), using BFD version 2.9.1
 /home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/collect2 -V -Y
P,/usr/ccs/lib:/usr/lib -Qy
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/crt1.o
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/crti.o
/usr/ccs/lib/values-Xa.o
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/crtbegin.o
-L/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2 -L/usr/ccs/bin
-L/usr/ccs/lib
-L/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/../../..
/var/tmp//ccg3eqmM.o /var/tmp//ccsPFruL.o -lgcc_s -lgcc -lgcj -lm -lpthread -lrt
-lsocket -ldl -lgcc_s -lgcc -lc -lgcc_s -lgcc -lgcj -lm -lpthread -lrt -lsocket
-ldl -lgcc_s -lgcc -lc
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/crtend.o
/home/exshutil/gcc3/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/crtn.o
GNU ld version 2.9.1 (with BFD 2.9.1)
  Supported emulations:
   elf32_sparc
$
$ cat showargs.java
import java.io.*;
import java.lang.*;

class
showargs
{
    public static void
    main(String args[])
    {
        for (int i = 0; i < args.length; i++)
        {
            String s = args[i];

            if (i > 0)
                System.err.print(' ');
            System.err.print(s);
            System.err.print(" (");
            for (int j = 0; j < s.length(); j++)
            {
                if (j > 0)
                    System.err.print(' ');
                System.err.print((int) s.charAt(j));
            }
            System.err.print(')');
        }
        System.err.println();
        System.err.flush();
    }
}
$
$ a.out x y z
?x (65279 120) y (121) z (122)
$
$ a.out -option
?-option (65279 45 111 112 116 105 111 110)

-- 
           Summary: Bug in conversion to Unicode of command line arguments
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: John dot Downey at ftid dot com
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org
 GCC build triplet: sparc-sun-solaris2.8
  GCC host triplet: sparc-sun-solaris2.8
GCC target triplet: sparc-sun-solaris2.8


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14722


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/14722] Bug in conversion to Unicode of command line arguments
  2004-03-24 18:28 [Bug java/14722] New: Bug in conversion to Unicode of command line arguments John dot Downey at ftid dot com
@ 2004-03-24 18:36 ` pinskia at gcc dot gnu dot org
  2004-03-24 20:45 ` ebotcazou at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-24 18:36 UTC (permalink / raw)
  To: java-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|java                        |libgcj


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14722


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/14722] Bug in conversion to Unicode of command line arguments
  2004-03-24 18:28 [Bug java/14722] New: Bug in conversion to Unicode of command line arguments John dot Downey at ftid dot com
  2004-03-24 18:36 ` [Bug libgcj/14722] " pinskia at gcc dot gnu dot org
@ 2004-03-24 20:45 ` ebotcazou at gcc dot gnu dot org
  2004-03-29 11:14 ` ebotcazou at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2004-03-24 20:45 UTC (permalink / raw)
  To: java-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14722


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/14722] Bug in conversion to Unicode of command line arguments
  2004-03-24 18:28 [Bug java/14722] New: Bug in conversion to Unicode of command line arguments John dot Downey at ftid dot com
  2004-03-24 18:36 ` [Bug libgcj/14722] " pinskia at gcc dot gnu dot org
  2004-03-24 20:45 ` ebotcazou at gcc dot gnu dot org
@ 2004-03-29 11:14 ` ebotcazou at gcc dot gnu dot org
  2004-04-02 12:52 ` John dot Downey at ftid dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2004-03-29 11:14 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2004-03-29 11:14 -------
I can't reproduce with GCJ 3.3.2 on Solaris 8:

gax% uname -a
SunOS gax 5.8 Generic_108528-27 sun4u sparc SUNW,Sun-Fire-V250

gax% gcj --encoding=UTF-8 -o pr14722 pr14722.java --main=showargs
gax% ./pr14722 x y z
x (120) y (121) z (122)
gax% ./pr14722 -option
-option (45 111 112 116 105 111 110)

And I can't reproduce on Solaris 7 and 9 either.  Which libiconv do you use?  If
 it's Sun libiconv, I'd tend to think of a Sun bug.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14722


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/14722] Bug in conversion to Unicode of command line arguments
  2004-03-24 18:28 [Bug java/14722] New: Bug in conversion to Unicode of command line arguments John dot Downey at ftid dot com
                   ` (2 preceding siblings ...)
  2004-03-29 11:14 ` ebotcazou at gcc dot gnu dot org
@ 2004-04-02 12:52 ` John dot Downey at ftid dot com
  2004-04-02 13:40 ` ebotcazou at gcc dot gnu dot org
  2004-04-26  3:47 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: John dot Downey at ftid dot com @ 2004-04-02 12:52 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From John dot Downey at ftid dot com  2004-04-02 12:52 -------
Subject: Re:  Bug in conversion to Unicode of command line
 arguments


Thanks for your reply.

on Solaris 8, the iconv family of routines appear to be in
/usr/lib/libc.a and /usr/lib/libc.so.1. I can't find a libiconv*
anywhere on this system.

So should I get a separate version of libiconv, from GNU or somewhere?

If so, maybe this should be listed as a prerequisite for using gcj on
Solaris?

Regards,

John Downey

+---------
|
| Additional Comments From ebotcazou at gcc dot gnu dot org  2004-03-29 11:14
|
| I can't reproduce with GCJ 3.3.2 on Solaris 8:
|
| gax% uname -a
| SunOS gax 5.8 Generic_108528-27 sun4u sparc SUNW,Sun-Fire-V250
|
| gax% gcj --encoding=UTF-8 -o pr14722 pr14722.java --main=showargs
| gax% ./pr14722 x y z
| x (120) y (121) z (122)
| gax% ./pr14722 -option
| -option (45 111 112 116 105 111 110)
|
| And I can't reproduce on Solaris 7 and 9 either. Which libiconv do you
| use? If it's Sun libiconv, I'd tend to think of a Sun bug.
|
+---------



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14722


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/14722] Bug in conversion to Unicode of command line arguments
  2004-03-24 18:28 [Bug java/14722] New: Bug in conversion to Unicode of command line arguments John dot Downey at ftid dot com
                   ` (3 preceding siblings ...)
  2004-04-02 12:52 ` John dot Downey at ftid dot com
@ 2004-04-02 13:40 ` ebotcazou at gcc dot gnu dot org
  2004-04-26  3:47 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2004-04-02 13:40 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2004-04-02 13:40 -------
No, I think it's a Sun bug.  You might want to see if there isn't a Solaris 8
patch for iconv and UTF-8.  We know of related problems on Solaris 7 that appear
to be fixed by

        Patch-ID# 112689-02
        Synopsis: SunOS 5.7: UTF-8 locale ICONV patch


Also note that you use a GNU binutils version known to be buggy, see
http://gcc.gnu.org/install/specific.html#*-*-solaris2*


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14722


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libgcj/14722] Bug in conversion to Unicode of command line arguments
  2004-03-24 18:28 [Bug java/14722] New: Bug in conversion to Unicode of command line arguments John dot Downey at ftid dot com
                   ` (4 preceding siblings ...)
  2004-04-02 13:40 ` ebotcazou at gcc dot gnu dot org
@ 2004-04-26  3:47 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-26  3:47 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-26 03:47 -------
Eric explained what patch fixes it so closing as invalid.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14722


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-04-26  3:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-24 18:28 [Bug java/14722] New: Bug in conversion to Unicode of command line arguments John dot Downey at ftid dot com
2004-03-24 18:36 ` [Bug libgcj/14722] " pinskia at gcc dot gnu dot org
2004-03-24 20:45 ` ebotcazou at gcc dot gnu dot org
2004-03-29 11:14 ` ebotcazou at gcc dot gnu dot org
2004-04-02 12:52 ` John dot Downey at ftid dot com
2004-04-02 13:40 ` ebotcazou at gcc dot gnu dot org
2004-04-26  3:47 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).