Bug 38251

Summary: [4.4/4.5 Regression] tools.zip doesn't build on systems with short command lines
Product: gcc Reporter: Rainer Orth <ro>
Component: libgcjAssignee: Rainer Orth <ro>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, htl10, java-prs, rwild
Priority: P4    
Version: 4.4.0   
Target Milestone: 4.4.4   
Host: alpha-dec-osf5.1b Target: alpha-dec-osf5.1b
Build: alpha-dec-osf5.1b Known to work:
Known to fail: Last reconfirmed: 2010-03-01 18:15:00

Description Rainer Orth 2008-11-24 17:53:18 UTC
As of trunk revision 142086, libgcj doesn't build any longer on Tru64 UNIX V5.1B:

(cd classes; \
	jar cf ../tools.zip `find . -name .svn -prune -o -type f -print`; \
	cd ..)
/usr/local/bin/bash: /vol/gnu/bin/jar: Arg list too long

I think such systems still need to be taken into account.

This was broken by this change:

2008-11-05  Andrew Haley  <aph@redhat.com>

	* tools/Makefile.am (UPDATE_TOOLS_ZIP, CREATE_TOOLS_ZIP): Exclude
	.svn directories.
Comment 1 Andrew Haley 2008-11-24 17:56:31 UTC
Please try

jar cf ../tools.zip `find . -name .svn -prune -o -type d -print`
Comment 2 Rainer Orth 2008-11-24 18:04:29 UTC
Subject: Re:  [4.4 Regression] tools.zip doesn't build on systems with short command lines

aph at gcc dot gnu dot org writes:

> Please try
> 
> jar cf ../tools.zip `find . -name .svn -prune -o -type d -print`

while this works, many files are added several times, e.g.

% jar tf ../tools.zip |grep classes/com/sun/javadoc/ProgramElementDoc.class
classes/com/sun/javadoc/ProgramElementDoc.class
classes/com/sun/javadoc/ProgramElementDoc.class
classes/com/sun/javadoc/ProgramElementDoc.class
classes/com/sun/javadoc/ProgramElementDoc.class
classes/com/sun/javadoc/ProgramElementDoc.class

If one wanted to go this path, one would need to prune all but the deepest
directories.

	Rainer
Comment 3 Andrew Haley 2008-11-24 18:29:39 UTC
Yes, of course.

jar has an update mode that adds files, so I can use that.  How long may an arglist be?
Comment 4 Rainer Orth 2008-11-24 18:37:15 UTC
Subject: Re:  [4.4 Regression] tools.zip doesn't build on systems with short command lines

aph at gcc dot gnu dot org writes:

> jar has an update mode that adds files, so I can use that.  How long may an
> arglist be?

% getconf ARG_MAX
38912

I'm astonished that it is so low; I thought only IRIX 6 had a limit this
close to the old 20k default.

Unfortunately, the version of jar I use reports

% jar u
/vol/gnu/bin/jar: `-u' mode unimplemented.
% jar --version
jar (fastjar) 0.92-gcc

Copyright 1999, 2000, 2001  Bryan Burns
Copyright 2002 Free Software Foundation
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Perhaps I should simply move it out of the way and use zip instead.

	Rainer
Comment 5 Andrew Haley 2008-11-24 18:48:48 UTC
Sure, if you can use zip instead, do that.
Comment 6 Andrew Haley 2008-11-24 18:52:47 UTC
I suggest

jar cf ... to create it, and
zip u ... to add to it

that way you'll get the correct META-INF directory.
Comment 7 Hin-Tak Leung 2009-07-28 17:53:41 UTC
I probably have a similiar bug about length of commend line with 4.4.1 which I shall file now.
Comment 8 Hin-Tak Leung 2009-07-28 18:06:32 UTC
I have a slightly different message on alphaev68-dec-osf5.1a with gcc 4.4.1, but possibly the same problem: (I can bootstrap 4.3.3, but no luck with 4.4.0/4.4.1):

------------------------
find ../../../../../gcc-4.4.1/libjava/classpath/tools/external/asm -name '*.java' -print > asm.lst
find ../../../../../gcc-4.4.1/libjava/classpath/tools/gnu/classpath/tools \
	     ../../../../../gcc-4.4.1/libjava/classpath/tools/com/sun/javadoc \
	     ../../../../../gcc-4.4.1/libjava/classpath/tools/com/sun/tools/doclets \
	     ../../../../../gcc-4.4.1/libjava/classpath/tools/com/sun/tools/javadoc \
	     ../../../../../gcc-4.4.1/libjava/classpath/tools/com/sun/tools/javac \
	     ../../../../../gcc-4.4.1/libjava/classpath/tools/com/sun/tools/javah \
	     ../../../../../gcc-4.4.1/libjava/classpath/tools/sun/rmi/rmic \
	     -path '*gnu/classpath/tools/gjdoc' -prune -o -path '*gnu/classpath/tools/doclets' -prune -o -path '*gnu/classpath/tools/taglets' -prune -o -path '*com/sun/javadoc' -prune -o -path '*com/sun/tools/doclets' -prune -o -path '*com/sun/tools/javadoc' -prune -o \
	     -name '*.java' -print > classes.lst
find: bad option -path
make[4]: *** [tools.zip] Error 1
make[4]: Leaving directory `/home/htl10/tmp-build/g41-dir/alphaev68-dec-osf5.1a/libjava/classpath/tools'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/htl10/tmp-build/g41-dir/alphaev68-dec-osf5.1a/libjava/classpath'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/htl10/tmp-build/g41-dir/alphaev68-dec-osf5.1a/libjava'
make[1]: *** [all-target-libjava] Error 2
make[1]: Leaving directory `/home/htl10/tmp-build/g41-dir'
make: *** [all] Error 2
bash-2.05a# 
--------------------------------------
The 'find: bad option -path' message probably means the command was truncated, I believe. It looks pretty long to me :-).
Comment 9 Hin-Tak Leung 2009-07-28 20:30:19 UTC
Sorry for the noise - the 'find: bad option -path' error message of mine is genuine - gcc 4.4 (classpath) requires GNU findutils syntax which doesn't work with DEC/Tru64 find. Am filing a separate bug now. 
Comment 10 Hin-Tak Leung 2009-07-28 20:42:15 UTC
The 'find bad option' problem was already reported for solaris as bug 38715 . just FYI. 
Comment 11 Rainer Orth 2009-07-29 08:20:22 UTC
Subject: Re:  [4.4/4.5 Regression] tools.zip doesn't build on systems with short command lines

htl10 at users dot sourceforge dot net writes:

> I have a slightly different message on alphaev68-dec-osf5.1a with gcc 4.4.1,
> but possibly the same problem: (I can bootstrap 4.3.3, but no luck with
> 4.4.0/4.4.1):
[...]
> find: bad option -path
[...]
> The 'find: bad option -path' message probably means the command was truncated,
> I believe. It looks pretty long to me :-).

No, that's a different problem: -path is a GNU find extension which Tru64
UNIX find doesn't support (nor do e.g. Solaris 10 and IRIX 6.5 find).  It's
simply unportable code.

	Rainer
Comment 12 Rainer Orth 2010-03-01 12:32:14 UTC
Subject: Bug 38251

Author: ro
Date: Mon Mar  1 12:32:02 2010
New Revision: 157137

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157137
Log:
	PR libgcj/38251
	* tools/Makefile.am (dist-hook): Prune .svn directories in asm and
	classes copies.
	* tools/Makefile.in: Regenerate.

	Revert:
	2008-11-05  Andrew Haley  <aph@redhat.com>

	* tools/Makefile.am (UPDATE_TOOLS_ZIP, CREATE_TOOLS_ZIP): Exclude
	.svn direcories.

Modified:
    trunk/libjava/classpath/ChangeLog
    trunk/libjava/classpath/tools/Makefile.am
    trunk/libjava/classpath/tools/Makefile.in

Comment 13 Rainer Orth 2010-03-01 18:15:37 UTC
Fixed for 4.5.0:

http://gcc.gnu.org/ml/java-patches/2010-q1/msg00021.html
Comment 14 Rainer Orth 2010-06-02 16:57:30 UTC
Subject: Bug 38251

Author: ro
Date: Wed Jun  2 16:57:10 2010
New Revision: 160168

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160168
Log:
	Backport from mainline:
	2010-03-01  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR libgcj/38251
	* tools/Makefile.am (dist-hook): Prune .svn directories in asm and
	classes copies.
	* tools/Makefile.in: Regenerate.

	Revert:
	2008-11-05  Andrew Haley  <aph@redhat.com>

	* tools/Makefile.am (UPDATE_TOOLS_ZIP, CREATE_TOOLS_ZIP): Exclude
	.svn direcories.

Modified:
    branches/gcc-4_4-branch/libjava/classpath/ChangeLog
    branches/gcc-4_4-branch/libjava/classpath/tools/Makefile.am
    branches/gcc-4_4-branch/libjava/classpath/tools/Makefile.in