Hi Daniel, thanks for the report. On Monday 15 August 2011, Daniel Richard wrote: > I am using Automake 1.11.1, and have recently encountered a subtle issue > that causes compilation of some Java programs to fail. > > Here is a typical build failure, produced from a minimal test case I've > assembled, using OpenJDK on Ubuntu's Natty release: > > make[3]: Entering directory `/tmp/automake-java-bug/org/gnu/bug' > CLASSPATH=../../..:./../../..:$CLASSPATH javac -d ../../.. Library.java Application.java > ./Library.java:5: duplicate class: org.gnu.bug.Library > public class Library > ^ > Application.java:9: cannot access Library > bad class file: RegularFileObject[./Library.java] > file does not contain class Library > Please remove or make sure it appears in the correct subdirectory of the classpath. > Library lib = new Library(); > ^ > 2 errors > make[3]: *** [classdist_noinst.stamp] Error 1 > > > If I copy-and-paste the javac invocation, edit it slightly, and run > it... > > env CLASSPATH=../../..:./../../..: javac -d ../../.. Library.java Application.java > > ...I get the same error. However, if I remove that trailing colon from > CLASSPATH, and try it again... > > env CLASSPATH=../../..:./../../.. javac -d ../../.. Library.java Application.java > > ...compilation succeeds. If I invoke the above build with > > env CLASSPATH=/does-not-exist make > > then compilation likewise succeeds. > > Note that I do not have CLASSPATH set in my environment. It would appear > that a trailing colon in the CLASSPATH environment variable has a > special meaning attached to it, which makes Automake's use of > CLASSPATH=mumblemumble:$$CLASSPATH in makefiles problematic. > > (The straightforward solution would be to replace that construct with > CLASSPATH=mumblemumble$${CLASSPATH:+:$$CLASSPATH}, but whether all > shells can handle that is an open question.) > Luckily, as far as I know, the above construct should be portable to all non-museum shells. So I've used it with only a minor modification (with the only purpose of making the contruct slighlty clearer): CLASSPATH=mumblemumble$${CLASSPATH:+":$$CLASSPATH"} > Attached is a tarball containing the minimal test case. > I can reproduce the problem using your test case, and fix it using your suggestion. I've preparad the attached patch, which I will push in a couple of days if there are no further comments. BTW, are you the same "Daniel Richard G." listed in THANKS with the address "danielg@teragram.com"? If yes, should I update your address there? Thanks, Stefano