automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fail upon install or ranlib failure, part two.


From: Ralf Wildenhues
Subject: Fail upon install or ranlib failure, part two.
Date: Sun, 7 Sep 2008 08:55:24 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

This is the second part of the install failure fixes.
Nothing surprising really, but it differs from the first
part in a couple of details:

* The tests do not try to deal with a huge number of files.
Not sure if I want to change this later when all files are
installed efficiently, but simply building a lot of libraries
and programs and info files is quite expensive.

* For PROGRAMS, there was already code in place to fail with
exit status 1 if install failed.  I synced this with the other
instances to exit with install's exit status now.

* Installation will fail if ranlib fails for an installed library.
The GNU Coding Standards explicitly mention:

|    When you use `ranlib' or `ldconfig', you should make sure nothing
| bad happens if the system does not have the program in question.
| Arrange to ignore an error from that command, and print a message before
| the command to tell the user that failure of this command does not mean
| a problem.  (The Autoconf `AC_PROG_RANLIB' macro can help with this.)

But that's what we have and use AC_PROG_RANLIB for: to set RANLIB
to ':' on systems that do not have it.  Also, again the previous
behavior of Automake's rule was inconsistent: a ranlib failure
for the last installed library would cause an install failure,
for previous libraries it would not.  So this at least makes it
consistent.

Cheers,
Ralf

        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.

diff --git a/lib/am/java.am b/lib/am/java.am
index 1031688..98a1fcf 100644
--- a/lib/am/java.am
+++ b/lib/am/java.am
@@ -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%
 
diff --git a/lib/am/libs.am b/lib/am/libs.am
index 18d9642..6cd0988 100644
--- a/lib/am/libs.am
+++ b/lib/am/libs.am
@@ -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%
diff --git a/lib/am/lisp.am b/lib/am/lisp.am
index cdc0861..a7759d7 100644
--- a/lib/am/lisp.am
+++ b/lib/am/lisp.am
@@ -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
diff --git a/lib/am/ltlib.am b/lib/am/ltlib.am
index e114faf..3637ea0 100644
--- a/lib/am/ltlib.am
+++ b/lib/am/ltlib.am
@@ -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%
diff --git a/lib/am/progs.am b/lib/am/progs.am
index e8cdaea..83a8f1b 100644
--- a/lib/am/progs.am
+++ b/lib/am/progs.am
@@ -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%
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 54ac671..7a6b286 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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 \
diff --git a/tests/instfail-info.test b/tests/instfail-info.test
new file mode 100755
index 0000000..ba2b5b6
--- /dev/null
+++ b/tests/instfail-info.test
@@ -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
address@hidden info$n.info
address@hidden main
address@hidden Top
+Hello walls.
address@hidden
+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
index 0000000..44b5971
--- /dev/null
+++ b/tests/instfail-java.test
@@ -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
index 0000000..1b6bd2b
--- /dev/null
+++ b/tests/instfail-libtool.test
@@ -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
index 0000000..a09ca17
--- /dev/null
+++ b/tests/instfail.test
@@ -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
+
+:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]