bug-gnulib
[Top][All Lists]
Advanced

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

Re: ensure that generated files are read-only


From: Ralf Wildenhues
Subject: Re: ensure that generated files are read-only
Date: Thu, 7 Sep 2006 18:31:02 +0200
User-agent: Mutt/1.5.13 (2006-09-01)

[ adding automake-patches ]

* Simon Josefsson wrote on Thu, Sep 07, 2006 at 04:56:02PM CEST:
> Bruce Korb <address@hidden> writes:
> > Ralf Wildenhues wrote:
> >
> >> The fix is to
> >>   find FOOPKG-x.y.z -exec chmod u+rwx \{\} \; && rm -rf FOOPKG-x.y.z

> I was just about to suggest that the above command should be added as
> a documented short-cut...
> 
> make distcheck-clean

IMHO a nice suggestion, except I think distdir-clean fits better.
OK to install the patch below?

> Or can ^C be trapped, and it could clean up after itself?  That might
> not be a good idea though.  You'd might want to investigate something
> in the distcheck directory...  OTOH, there is ^Z.

Probably a trap could be used, but I don't think that is too useful.
IIRC it's all too common that you need to hit ^C several times with
some vendor `make' implementations in recursive makefile setups, in
order to properly interrupt a build.  (Admittedly I'm waving hands
here -- I've never done the effort of finding out which component
wasn't reacting the way I expected it.)  An explicit cleaning target
also helps if you're too slow to hit ^Z before the files are gone
again.  I would be.  ;-)

Cheers,
Ralf

        * lib/am/distdir (distdir-clean): New target.
        * doc/automake.texi (Dist): New section `When something goes
        wrong'.
        * tests/distdir2.test: New test.
        * tests/Makefile.am: Update.
        * NEWS: Update.
        Suggested by Simon Josefsson.

Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.315
diff -u -r1.315 NEWS
--- NEWS        5 Sep 2006 18:58:16 -0000       1.315
+++ NEWS        7 Sep 2006 16:28:02 -0000
@@ -6,6 +6,9 @@
     a package to work correctly.  The permissions may have been lost
     by work of a patch or version control tool.
 
+  - New target `distdir-clean' to clean up left-over files after an
+    incomplete `dist-*' or `distcheck'.
+
 New in 1.9b:
 
 * Version requirements:
Index: doc/automake.texi
===================================================================
RCS file: /cvs/automake/automake/doc/automake.texi,v
retrieving revision 1.150
diff -u -r1.150 automake.texi
--- doc/automake.texi   28 Aug 2006 16:04:24 -0000      1.150
+++ doc/automake.texi   7 Sep 2006 16:28:15 -0000
@@ -8194,6 +8219,16 @@
 create archives in all the enabled formats, @ref{Options}.  By
 default, only the @code{dist-gzip} target is hooked to @code{dist}.
 
address@hidden When something does wrong
+
address@hidden @samp{make distdir-clean}
+
address@hidden distdir-clean
+Sometimes one of the @code{dist-*} or @code{distcheck} rules may stop with
+an error, leaving you behind with leftover files.  You can use the
address@hidden rule from your top-level directory in order to clean
+up after these rules.
+
 
 @node Tests
 @chapter Support for test suites
Index: lib/am/distdir.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/distdir.am,v
retrieving revision 1.68
diff -u -r1.68 distdir.am
--- lib/am/distdir.am   19 Aug 2006 15:55:52 -0000      1.68
+++ lib/am/distdir.am   7 Sep 2006 16:28:15 -0000
@@ -225,6 +225,11 @@
 endif %?FILENAME_FILTER%
 endif %?TOPDIR_P%
 
+if %?TOPDIR_P%
+.PHONY: distdir-clean
+distdir-clean:
+       $(am__remove_distdir)
+endif %?TOPDIR_P%
 
 
 ## --------------------------------------- ##
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.609
diff -u -r1.609 Makefile.am
--- tests/Makefile.am   30 Aug 2006 20:35:56 -0000      1.609
+++ tests/Makefile.am   7 Sep 2006 16:28:53 -0000
@@ -215,6 +215,7 @@
 distcom6.test \
 distcom7.test \
 distdir.test \
+distdir2.test \
 distname.test \
 dollar.test \
 double.test \
--- /dev/null   2006-05-22 13:44:12.000000000 +0200
+++ tests/distdir2.test 2006-09-07 18:28:48.000000000 +0200
@@ -0,0 +1,44 @@
+#! /bin/sh
+# Copyright (C) 2006  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test distdir-clean.
+
+. ./defs || exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+cat > Makefile.am << 'END'
+TESTS = foo
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+# Fails because `foo' is missing, with read-only leftover.
+$MAKE distcheck && exit 1
+
+$MAKE distdir-clean
+test ! -d distdir3-1.0
+
+exit 0




reply via email to

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