Fail upon install or ranlib failure, part two.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 7 Sep 2008 06:42:47 +0000 (08:42 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 7 Sep 2008 06:42:47 +0000 (08:42 +0200)
* lib/am/java.am (install-%DIR%JAVA): Fail upon install failure.
* lib/am/lisp.am (install-%DIR%LISP): Likewise.
* lib/am/ltlib.am (install-%DIR%LTLIBRARIES): Likewise.
* lib/am/libs.am (install-%DIR%LIBRARIES): Likewise, for
`install' as well as `ranlib'.
* lib/am/progs.am (install-%DIR%PROGRAMS): If `install' fails,
return its exit failure, not 1.
* tests/instfail.test: New test, for PROGRAMS (without libtool),
LIBRARIES, including nobase variants.
* tests/instfail-info.test: Likewise, for TEXINFOS.
* tests/instfail-java.test: Likewise, for JAVA.
* tests/instfail-libtool.test: Likewise, for PROGRAMS (with
libtool) and LTLIBRARIES.
* tests/Makefile.am: Adjust.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12 files changed:
ChangeLog
lib/am/java.am
lib/am/libs.am
lib/am/lisp.am
lib/am/ltlib.am
lib/am/progs.am
tests/Makefile.am
tests/Makefile.in
tests/instfail-info.test [new file with mode: 0755]
tests/instfail-java.test [new file with mode: 0755]
tests/instfail-libtool.test [new file with mode: 0755]
tests/instfail.test [new file with mode: 0755]

index cc4739e..382a11f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,22 @@
 2008-09-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
-       Exit upon `install' failure, part one.
+       Fail upon install or ranlib failure, part two.
+       * lib/am/java.am (install-%DIR%JAVA): Fail upon install failure.
+       * lib/am/lisp.am (install-%DIR%LISP): Likewise.
+       * lib/am/ltlib.am (install-%DIR%LTLIBRARIES): Likewise.
+       * lib/am/libs.am (install-%DIR%LIBRARIES): Likewise, for
+       `install' as well as `ranlib'.
+       * lib/am/progs.am (install-%DIR%PROGRAMS): If `install' fails,
+       return its exit failure, not 1.
+       * tests/instfail.test: New test, for PROGRAMS (without libtool),
+       LIBRARIES, including nobase variants.
+       * tests/instfail-info.test: Likewise, for TEXINFOS.
+       * tests/instfail-java.test: Likewise, for JAVA.
+       * tests/instfail-libtool.test: Likewise, for PROGRAMS (with
+       libtool) and LTLIBRARIES.
+       * tests/Makefile.am: Adjust.
 
+       Exit upon `install' failure, part one.
        * lib/am/data.am (install-%DIR%%PRIMARY%): Exit if any install
        command fails.
        * lib/am/python.am (install-%DIR%PYTHON): Likewise.
index 1031688..98a1fcf 100644 (file)
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1998, 1999, 2001, 2003, 2004, 2006 Free Software
+## Copyright (C) 1998, 1999, 2001, 2003, 2004, 2006, 2008 Free Software
 ## Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
@@ -52,7 +52,7 @@ install-%DIR%JAVA: class%DIR%.stamp
 ## directory.  This is not optimal, but will have to do for now.
        @test -z "$(%DIR%_JAVA)" || for p in *.class; do \
          echo " $(INSTALL_DATA) '$$p' '$(DESTDIR)$(%NDIR%dir)/$$p'"; \
-         $(INSTALL_DATA) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$p"; \
+         $(INSTALL_DATA) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$p" || exit $$?; \
        done
 endif %?INSTALL%
 
index 18d9642..6cd0988 100644 (file)
@@ -40,7 +40,7 @@ if %?BASE%
        done; \
        test -z "$$list2" || { \
          echo " $(%DIR%LIBRARIES_INSTALL) $$list2 '$(DESTDIR)$(%NDIR%dir)'"; \
-         $(%DIR%LIBRARIES_INSTALL) $$list2 "$(DESTDIR)$(%NDIR%dir)"; }
+         $(%DIR%LIBRARIES_INSTALL) $$list2 "$(DESTDIR)$(%NDIR%dir)" || exit $$?; }
 else !%?BASE%
 ## Funny invocation because Makefile variable can be empty, leading to
 ## a syntax error in sh.
@@ -53,7 +53,7 @@ else !%?BASE%
              echo "$(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
              $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
            echo " $(%DIR%%PRIMARY%_INSTALL) $$xfiles '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
-           $(%DIR%%PRIMARY%_INSTALL) $$xfiles "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
+           $(%DIR%%PRIMARY%_INSTALL) $$xfiles "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; }; \
        done
 endif !%?BASE%
 ## We do two loops here so that $(POST_INSTALL) can be empty.  If we
@@ -67,7 +67,7 @@ endif !%?BASE%
            %BASE?$(am__strip_dir):f=$$p;% \
 ## Must ranlib after installing because mod time changes.
            echo " $(RANLIB) '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
-           $(RANLIB) "$(DESTDIR)$(%NDIR%dir)/$$f"; \
+           $(RANLIB) "$(DESTDIR)$(%NDIR%dir)/$$f" || exit $$?; \
          else :; fi; \
        done
 endif %?INSTALL%
index cdc0861..a7759d7 100644 (file)
@@ -1,6 +1,6 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
-## Free Software Foundation, Inc.
+## Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+## 2007, 2008 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
@@ -95,11 +95,11 @@ install-%DIR%LISP: $(%DIR%_LISP) $(ELCFILES)
            if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
            %BASE?$(am__strip_dir):$(am__vpath_adj)% \
            echo " $(%DIR%LISP_INSTALL) '$$d$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
-           $(%DIR%LISP_INSTALL) "$$d$$p" "$(DESTDIR)$(%NDIR%dir)/$$f"; \
+           $(%DIR%LISP_INSTALL) "$$d$$p" "$(DESTDIR)$(%NDIR%dir)/$$f" || exit $$?; \
 ## Only install .elc file if it exists.
            if test -f $${p}c; then \
              echo " $(%DIR%LISP_INSTALL) '$${p}c' '$(DESTDIR)$(%NDIR%dir)/$${f}c'"; \
-             $(%DIR%LISP_INSTALL) "$${p}c" "$(DESTDIR)$(%NDIR%dir)/$${f}c"; \
+             $(%DIR%LISP_INSTALL) "$${p}c" "$(DESTDIR)$(%NDIR%dir)/$${f}c" || exit $$?; \
            else : ; fi; \
          done; \
        else : ; fi
index e114faf..3637ea0 100644 (file)
@@ -1,6 +1,6 @@
 ## automake - create Makefile.in from Makefile.am
 ## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004,
-## 2005, 2006, 2007 Free Software Foundation, Inc.
+## 2005, 2006, 2007, 2008 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
@@ -43,9 +43,9 @@ install-%DIR%LTLIBRARIES: $(%DIR%_LTLIBRARIES)
 ## Use INSTALL and not INSTALL_DATA because libtool knows the right
 ## permissions to use.
 ?LIBTOOL?          echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
-?LIBTOOL?          $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$f"; \
+?LIBTOOL?          $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$f" || exit $$?; \
 ?!LIBTOOL?         echo " $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
-?!LIBTOOL?         $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$f"; \
+?!LIBTOOL?         $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$f" || exit $$?; \
          else :; fi; \
        done
 endif %?INSTALL%
index e8cdaea..83a8f1b 100644 (file)
@@ -1,6 +1,6 @@
 ## automake - create Makefile.in from Makefile.am
 ## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004,
-## 2006, 2007 Free Software Foundation, Inc.
+## 2006, 2007, 2008 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
@@ -47,9 +47,9 @@ install-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
 ## lossage if the install program doesn't have a name that libtool
 ## expects.
 ?LIBTOOL?         echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(%DIR%PROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
-?LIBTOOL?         $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(%DIR%PROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$f" || exit 1; \
+?LIBTOOL?         $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(%DIR%PROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$f" || exit $$?; \
 ?!LIBTOOL?        echo " $(INSTALL_PROGRAM_ENV) $(%DIR%PROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
-?!LIBTOOL?        $(INSTALL_PROGRAM_ENV) $(%DIR%PROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$f" || exit 1; \
+?!LIBTOOL?        $(INSTALL_PROGRAM_ENV) $(%DIR%PROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$f" || exit $$?; \
          else :; fi; \
        done
 endif %?INSTALL%
index 54ac671..7a6b286 100644 (file)
@@ -303,6 +303,10 @@ instsh3.test \
 instdat.test \
 instdat2.test \
 instexec.test \
+instfail.test \
+instfail-info.test \
+instfail-java.test \
+instfail-libtool.test \
 insthook.test \
 instman.test \
 instman2.test \
index 9dca1ae..914ebf8 100644 (file)
@@ -454,6 +454,10 @@ instsh3.test \
 instdat.test \
 instdat2.test \
 instexec.test \
+instfail.test \
+instfail-info.test \
+instfail-java.test \
+instfail-libtool.test \
 insthook.test \
 instman.test \
 instman2.test \
diff --git a/tests/instfail-info.test b/tests/instfail-info.test
new file mode 100755 (executable)
index 0000000..ba2b5b6
--- /dev/null
@@ -0,0 +1,66 @@
+#! /bin/sh
+# Copyright (C) 2008  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 3, 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/>.
+
+# The install rule should honor failures of the install program.
+# Some of these are already caught by instmany.test.
+
+# This test has a few sister tests, for java, info, libtool.
+
+
+# non-root should catch 'chmod a-r'-challenged file systems.
+required='non-root makeinfo'
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<END
+AC_OUTPUT
+END
+
+cat >Makefile.am <<'END'
+info_TEXINFOS = info1.texi info2.texi info3.texi
+END
+
+for n in 1 2 3; do
+  cat >info$n.texi <<END
+\input texinfo
+@setfilename info$n.info
+@settitle main
+@node Top
+Hello walls.
+@bye
+END
+done
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+instdir=`pwd`/inst
+./configure --prefix="$instdir"
+$MAKE
+
+$MAKE install
+$MAKE uninstall
+
+for file in info1.info
+do
+  chmod a-r $file
+  $MAKE install-data && Exit 1
+  chmod u+r $file
+done
+
+:
diff --git a/tests/instfail-java.test b/tests/instfail-java.test
new file mode 100755 (executable)
index 0000000..44b5971
--- /dev/null
@@ -0,0 +1,66 @@
+#! /bin/sh
+# Copyright (C) 2008  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 3, 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/>.
+
+# The install rule should honor failures of the install program.
+# Some of these are already caught by instmany.test.
+
+# This is the java sister test of instfail.test.
+
+
+# non-root should catch 'chmod a-r'-challenged file systems.
+required='non-root'
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<'END'
+AC_CHECK_PROG([HAS_JAVAC], [javac], [:], [exit])
+($HAS_JAVAC 77); $HAS_JAVAC 77
+AC_OUTPUT
+END
+
+cat >Makefile.am <<'END'
+javadir = $(datadir)/java
+java_JAVA = java1.java java2.java java3.java
+END
+
+for n in 1 2 3; do
+  cat >java$n.java <<END
+class java$n
+{
+}
+END
+done
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+instdir=`pwd`/inst
+./configure --prefix="$instdir"
+$MAKE
+
+$MAKE install
+$MAKE uninstall
+
+for file in java1.class
+do
+  chmod a-r $file
+  $MAKE install-data && Exit 1
+  chmod u+r $file
+done
+
+:
diff --git a/tests/instfail-libtool.test b/tests/instfail-libtool.test
new file mode 100755 (executable)
index 0000000..1b6bd2b
--- /dev/null
@@ -0,0 +1,83 @@
+#! /bin/sh
+# Copyright (C) 2008  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 3, 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/>.
+
+# The install rule should honor failures of the install program.
+# Some of these are already caught by instmany.test.
+
+# This is the libtool sister test of instfail.test
+
+
+# non-root should catch 'chmod a-r'-challenged file systems.
+required='non-root libtool libtoolize'
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<END
+AC_PROG_LIBTOOL
+AC_OUTPUT
+END
+
+cat >Makefile.am <<'END'
+bin_PROGRAMS = prog1 prog2 prog3
+nobase_bin_PROGRAMS = progn1 progn2 progn3
+lib_LTLIBRARIES = liblt1.la liblt2.la liblt3.la
+nobase_lib_LTLIBRARIES = libltn1.la libltn2.la libltn3.la
+unreadable-prog:
+       chmod a-r prog1$(EXEEXT)
+readable-prog:
+       chmod a+r prog1$(EXEEXT)
+unreadable-progn:
+       chmod a-r progn1$(EXEEXT)
+readable-progn:
+       chmod a+r progn1$(EXEEXT)
+END
+
+for n in 1 2 3; do
+  echo "int main () { return 0; }" > prog$n.c
+  echo "int main () { return 0; }" > progn$n.c
+  echo "int foolt$n () { return 0; }" > liblt$n.c
+  echo "int fooltn$n () { return 0; }" > libltn$n.c
+done
+
+libtoolize
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+instdir=`pwd`/inst
+./configure --prefix="$instdir"
+$MAKE
+
+$MAKE install
+$MAKE uninstall
+
+$MAKE unreadable-prog
+$MAKE install-exec && Exit 1
+$MAKE readable-prog
+
+$MAKE unreadable-progn
+$MAKE install-exec && Exit 1
+$MAKE readable-progn
+
+for file in liblt1.la libltn1.la
+do
+  chmod a-r $file
+  $MAKE install-exec && Exit 1
+  chmod u+r $file
+done
+
+:
diff --git a/tests/instfail.test b/tests/instfail.test
new file mode 100755 (executable)
index 0000000..a09ca17
--- /dev/null
@@ -0,0 +1,97 @@
+#! /bin/sh
+# Copyright (C) 2008  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 3, 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/>.
+
+# The install rule should honor failures of the install program.
+# Some of these are already caught by instmany.test.
+
+# This test has a few sister tests, for java, info, libtool.
+
+
+# non-root should catch 'chmod a-r'-challenged file systems.
+required=non-root
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<END
+AC_PROG_CC
+AC_PROG_RANLIB
+AM_PATH_LISPDIR
+AC_OUTPUT
+END
+
+cat >Makefile.am <<'END'
+bin_PROGRAMS = prog1 prog2 prog3
+nobase_bin_PROGRAMS = progn1 progn2 progn3
+lisp_LISP = lisp1.el lisp2.el lisp3.el
+nobase_lisp_LISP = lispn1.el lispn2.el lispn3.el
+lib_LIBRARIES = lib1.a lib2.a lib3.a
+nobase_lib_LIBRARIES = libn1.a libn2.a libn3.a
+unreadable-prog:
+       chmod a-r prog1$(EXEEXT)
+readable-prog:
+       chmod a+r prog1$(EXEEXT)
+unreadable-progn:
+       chmod a-r progn1$(EXEEXT)
+readable-progn:
+       chmod a+r progn1$(EXEEXT)
+END
+
+for n in 1 2 3; do
+  echo "int main () { return 0; }" > prog$n.c
+  echo "int main () { return 0; }" > progn$n.c
+  echo "int foo$n () { return 0; }" > lib$n.c
+  echo "int foon$n () { return 0; }" > libn$n.c
+  echo >lisp$n.el
+  echo >lispn$n.el
+done
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+instdir=`pwd`/inst
+./configure --prefix="$instdir"
+$MAKE
+
+$MAKE install
+$MAKE uninstall
+
+$MAKE unreadable-prog
+$MAKE install-exec && Exit 1
+$MAKE readable-prog
+
+$MAKE unreadable-progn
+$MAKE install-exec && Exit 1
+$MAKE readable-progn
+
+for file in lib1.a libn1.a
+do
+  chmod a-r $file
+  $MAKE install-exec && Exit 1
+  chmod u+r $file
+done
+
+if grep "^EMACS = no" Makefile; then :; else
+  for file in lisp1.el lisp1.elc
+  do
+    chmod a-r $file
+    $MAKE install-data && Exit 1
+    chmod u+r $file
+  done
+fi
+
+: