GNU bug report logs - #8461
Defining `java_JAVA' doesn't cause errors even if $(javadir) is indefined

Previous Next

Package: automake;

Reported by: Stefano Lattarini <stefano.lattarini <at> gmail.com>

Date: Sat, 9 Apr 2011 20:35:01 UTC

Severity: normal

Tags: patch

Done: Stefano Lattarini <stefano.lattarini <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8461 in the body.
You can then email your comments to 8461 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-automake <at> gnu.org:
bug#8461; Package automake. (Sat, 09 Apr 2011 20:35:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefano Lattarini <stefano.lattarini <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Sat, 09 Apr 2011 20:35:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: bug-automake <at> gnu.org
Subject: Defining `java_JAVA' doesn't cause errors even if $(javadir) is
	indefined
Date: Sat, 9 Apr 2011 22:34:33 +0200
Well, the subject says it all.  The following example exposes the bug:

  $ cat > configure.ac <<'END'
  AC_INIT([x], [0])
  AM_INIT_AUTOMAKE([foreign])
  AC_CONFIG_FILES([Makefile])
  END
  $ cat > Makefile.am <<'END'
  java_JAVA = foo.java
  END
  $ aclocal
  $ automake -a
  configure.ac:2: installing `./install-sh'
  configure.ac:2: installing `./missing'
  $ grep '^ *javadir' Makefile.in || echo 'javadir undefined!'
  javadir undefined!

I can suggest three possibilities to fix this issue:

  1. Define `javadir' to `$(pkgdatadir)/java' in lib/am/java.am.
 
  2. Define `javadir' and `pkgjavadir' to respectively to `$(datadir)/java'
     and `$(pkgdatadir)/java' in `lib/am/java.am', and add "pkgjava" to the
     @prefixes passed to am_primary_prefixes() and am_install_var() calls
     in handle_java() in automake.in.

  3. Remove "java" from the @prefixes passed to the am_primary_prefixes()
     and am_install_var() calls in handle_java() in automake.in.

In the first two cases, the Automake manual should be adjusted accordingly.
My preference lies with option 3.  Opinions?

Regards,
  Stefano




Information forwarded to bug-automake <at> gnu.org:
bug#8461; Package automake. (Sun, 18 Sep 2011 21:53:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: bug-automake <at> gnu.org
Cc: 8461 <at> debbugs.gnu.org, automake-patches <at> gnu.org
Subject: Re: bug#8461: Defining `java_JAVA' doesn't cause errors even if
	$(javadir) is indefined
Date: Sun, 18 Sep 2011 23:46:48 +0200
[Message part 1 (text/plain, inline)]
tags 8461 patch
close 8461
thanks

Reference:
 <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8461>

I've decided to go with the third option listed there; attached is the
patch I've pushed to maint.

Regards,
  Stefano
[0001-java-complain-if-java_JAVA-is-used-but-javadir-is-un.patch (text/x-patch, inline)]
From c9dfc368a623178f32b67b164f051e9ab65edd99 Mon Sep 17 00:00:00 2001
Message-Id: <c9dfc368a623178f32b67b164f051e9ab65edd99.1316382331.git.stefano.lattarini <at> gmail.com>
From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Date: Sun, 18 Sep 2011 23:32:38 +0200
Subject: [PATCH] java: complain if java_JAVA is used but $(javadir) is undefined

Fixes automake bug#8461.

* automake.in (handle_java): Remove inappropriate "java" argument
from the calls to `&am_install_var' and `&am_primary_prefixes'.
* tests/instdir-java.test (Makefile.am): Define `$(javadir)'.
* tests/javadir-undefined.test: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS: Update.
---
 ChangeLog                    |   11 +++++++++++
 NEWS                         |    4 ++++
 automake.in                  |    4 ++--
 tests/Makefile.am            |    1 +
 tests/Makefile.in            |    1 +
 tests/instdir-java.test      |    1 +
 tests/javadir-undefined.test |   37 +++++++++++++++++++++++++++++++++++++
 7 files changed, 57 insertions(+), 2 deletions(-)
 create mode 100755 tests/javadir-undefined.test

diff --git a/ChangeLog b/ChangeLog
index 56a8d1c..8a697e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-09-18  Stefano Lattarini  <stefano.lattarini <at> gmail.com>
+
+	java: complain if java_JAVA is used but $(javadir) is undefined
+	Fixes automake bug#8461.
+	* automake.in (handle_java): Remove inappropriate "java" argument
+	from the calls to `&am_install_var' and `&am_primary_prefixes'.
+	* tests/instdir-java.test (Makefile.am): Define `$(javadir)'.
+	* tests/javadir-undefined.test: New test.
+	* tests/Makefile.am (TESTS): Add it.
+	* NEWS: Update.
+
 2011-09-12  Stefano Lattarini  <stefano.lattarini <at> gmail.com>
 
 	cosmetics: fix various typos and grammaros
diff --git a/NEWS b/NEWS
index f26b332..9d3f46d 100644
--- a/NEWS
+++ b/NEWS
@@ -93,6 +93,10 @@ Bugs fixed in 1.11.0a:
   - Java sources specified with check_JAVA are not compiled anymore upon
     "make all", but only upon "make check".
 
+  - An usage like "java_JAVA = foo.java" will now cause Automake to warn
+    and error out if `javadir' is undefined, instead of silently producing
+    a broken Makefile.in.
+
   - Now aclocal and automake, when they've to spawn autoconf or autom4te
     processes, honour the configure-time definitions of AUTOCONF and
     AUTOM4TE.
diff --git a/automake.in b/automake.in
index 208a66b..215881b 100755
--- a/automake.in
+++ b/automake.in
@@ -5104,11 +5104,11 @@ sub handle_java
 {
     my @sourcelist = &am_install_var ('-candist',
 				      'java', 'JAVA',
-				      'java', 'noinst', 'check');
+				      'noinst', 'check');
     return if ! @sourcelist;
 
     my @prefixes = am_primary_prefixes ('JAVA', 1,
-				      'java', 'noinst', 'check');
+				        'noinst', 'check');
 
     my $dir;
     my @java_sources = ();
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c2dbf23..6c7139d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -453,6 +453,7 @@ java2.test \
 java3.test \
 java-check.test \
 java-empty-classpath.test \
+javadir-undefined.test \
 javaprim.test \
 javasubst.test \
 java-clean.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index ad4f2c9..ab73658 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -731,6 +731,7 @@ java2.test \
 java3.test \
 java-check.test \
 java-empty-classpath.test \
+javadir-undefined.test \
 javaprim.test \
 javasubst.test \
 java-clean.test \
diff --git a/tests/instdir-java.test b/tests/instdir-java.test
index 9d9a03c..94a6a25 100755
--- a/tests/instdir-java.test
+++ b/tests/instdir-java.test
@@ -26,6 +26,7 @@ AC_OUTPUT
 END
 
 cat >Makefile.am <<'END'
+javadir = $(datarootdir)/java
 java_JAVA = foo.java
 END
 
diff --git a/tests/javadir-undefined.test b/tests/javadir-undefined.test
new file mode 100755
index 0000000..9b6d1f3
--- /dev/null
+++ b/tests/javadir-undefined.test
@@ -0,0 +1,37 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Use of JAVA primary should not allow the use of the `java_' prefix
+# when $(javadir) is undefined.  Otherwise, we could silently end up
+# with a broken Makefile.in (where "make install" doesn't install
+# the *.class files).
+# See automake bug#8461.
+
+. ./defs || Exit 1
+
+set -e
+
+$ACLOCAL
+
+echo java_JAVA = a.java > Makefile.am
+AUTOMAKE_fails
+grep '^Makefile\.am:1:.*java_JAVA.*javadir.* undefined' stderr
+$EGREP '(uninitialized|line) ' stderr && Exit 1
+
+echo javadir = a-dummy-value >> Makefile.am
+$AUTOMAKE
+
+:
-- 
1.7.2.3


Information forwarded to bug-automake <at> gnu.org:
bug#8461; Package automake. (Sun, 18 Sep 2011 21:53:02 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Stefano Lattarini <stefano.lattarini <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 18 Sep 2011 21:58:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 8461 <at> debbugs.gnu.org and Stefano Lattarini <stefano.lattarini <at> gmail.com> Request was from Stefano Lattarini <stefano.lattarini <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 18 Sep 2011 21:58:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-automake <at> gnu.org:
bug#8461; Package automake. (Mon, 19 Sep 2011 16:31:02 GMT) Full text and rfc822 format available.

Message #18 received at 8461 <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: bug-automake <at> gnu.org
Cc: 8461 <at> debbugs.gnu.org, automake-patches <at> gnu.org
Subject: Re: bug#8461: Defining `java_JAVA' doesn't cause errors even if
	$(javadir) is indefined
Date: Mon, 19 Sep 2011 18:25:42 +0200
[Message part 1 (text/plain, inline)]
On Sunday 18 September 2011, Stefano Lattarini wrote:
> tags 8461 patch
> close 8461
> thanks
> 
> Reference:
>  <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8461>
> 
> I've decided to go with the third option listed there; attached is the
> patch I've pushed to maint.
> 
> Regards,
>   Stefano
> 
That change has caused a minor fallout in a test case, which I've fixed with
the attached patch.

Regards,
  Stefano
[0001-tests-fix-spurious-failure-in-primary-prefix-valid-c.patch (text/x-patch, inline)]
From d5ebf21cccd0597f53e7b3c4063dff4704e454a6 Mon Sep 17 00:00:00 2001
Message-Id: <d5ebf21cccd0597f53e7b3c4063dff4704e454a6.1316449298.git.stefano.lattarini <at> gmail.com>
From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Date: Mon, 19 Sep 2011 18:21:25 +0200
Subject: [PATCH] tests: fix spurious failure in 'primary-prefix-valid-couples.test'

* tests/primary-prefix-valid-couples.test: After commit
v1.11-464-gc9dfc36, `java_JAVA' is not a valid prefix/primary
combination by default anymore: one has to explicitly define
$(javadir) to make it so.  So just drop `java_JAVA' from our
Makefile.am  Also, since we are at it, ...
(configure.in): ... remove AM_PROG_GCJ from here, as it's not
really required.
---
 ChangeLog                               |   11 +++++++++++
 tests/primary-prefix-valid-couples.test |    2 --
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8a697e6..6c66f9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-09-19  Stefano Lattarini  <stefano.lattarini <at> gmail.com>
+
+	tests: fix spurious failure in 'primary-prefix-valid-couples.test'
+	* tests/primary-prefix-valid-couples.test: After commit
+	v1.11-464-gc9dfc36, `java_JAVA' is not a valid prefix/primary
+	combination by default anymore: one has to explicitly define
+	$(javadir) to make it so.  So just drop `java_JAVA' from our
+	Makefile.am  Also, since we are at it, ...
+	(configure.in): ... remove AM_PROG_GCJ from here, as it's not
+	really required.
+
 2011-09-18  Stefano Lattarini  <stefano.lattarini <at> gmail.com>
 
 	java: complain if java_JAVA is used but $(javadir) is undefined
diff --git a/tests/primary-prefix-valid-couples.test b/tests/primary-prefix-valid-couples.test
index f326808..36ff5d8 100755
--- a/tests/primary-prefix-valid-couples.test
+++ b/tests/primary-prefix-valid-couples.test
@@ -25,7 +25,6 @@ cat >> configure.in <<'END'
 AC_PROG_CC
 AC_PROG_RANLIB
 AC_PROG_LIBTOOL
-AM_PROG_GCJ
 AM_PATH_PYTHON
 AM_PATH_LISPDIR
 END
@@ -78,7 +77,6 @@ done
 echo "info_TEXINFOS = foo.texi" >> Makefile.am
 echo "lisp_LISP = foo.el" >> Makefile.am
 echo "python_PYTHON = foo.py" >> Makefile.am
-echo "java_JAVA = foo.java" >> Makefile.am
 
 awk '{print NR ":" $0}' Makefile.am # For debugging.
 
-- 
1.7.2.3


Information forwarded to bug-automake <at> gnu.org:
bug#8461; Package automake. (Mon, 19 Sep 2011 16:32:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 18 Oct 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 326 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.