severity 10878 wishlist tags 10878 wontfix close 10878 thanks
On 02/24/2012 08:09 AM, Nick Bowler wrote: > > Automake should at least add user write permissions to all files in > distdir prior to running dist-hook (and hence prior to generating the > distribution tarball). > I disagree; in case the user wants to change the permission of the distributed files from the ones that they have in the builddir/srcdir, he can do so in the dist-hook already, with full control (I've just added a tiny test to verify this behaviour, see attached patch). So we don't need to change the automake behaviour in this respect (but a documentation improvement might be nice, in case someone feels like writing it). On 02/24/2012 05:12 PM, Eric Blake replied: > > Automake must not add write permissions to files that were intended to > be shipped as read-only. For example, coreutils intentionally converts > generated-but-distributed files to read-only, so that users are more > likely to notice that they should edit the source that generates the > file, and not the generated file itself. > > So how do you propose to tell automake which files are supposed to be > read-only, vs. those that should be writable even if the tarball was > re-created from a read-only srcdir? > With a dist-hook ;-) Regards, Stefano
>From d3957b27c205145e026e62fcf23f8bef969edeb8 Mon Sep 17 00:00:00 2001 Message-Id: <d3957b27c205145e026e62fcf23f8bef969edeb8.1330104845.git.stefano.lattar...@gmail.com> From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Fri, 24 Feb 2012 18:34:04 +0100 Subject: [PATCH] coverage: test that dist-hook can modify file permission See automake bug#10878. * tests/dist-hook-perms.test: New test, checking that the user can use the 'dist-hook' target to modify permissions of distributed files before putting them in the distribution tarball. * tests/list-of-tests.mk: Add it. --- tests/disthook-perms.test | 59 +++++++++++++++++++++++++++++++++++++++++++++ tests/list-of-tests.mk | 1 + 2 files changed, 60 insertions(+), 0 deletions(-) create mode 100755 tests/disthook-perms.test diff --git a/tests/disthook-perms.test b/tests/disthook-perms.test new file mode 100755 index 0000000..a5f0acb --- /dev/null +++ b/tests/disthook-perms.test @@ -0,0 +1,59 @@ +#! /bin/sh +# Copyright (C) 2012 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/>. + +# Check that the user can use the 'dist-hook' target to modify +# permissions of distributed files before putting them in the +# distribution tarball. See automake bug#10878. + +. ./defs || Exit 1 + +echo AC_OUTPUT >> configure.ac + +cat > Makefile.am <<'END' +EXTRA_DIST = write execute +dist-hook: + chmod u+w $(distdir)/write + chmod u+x $(distdir)/execute +END + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +./configure + +echo Will be clobbered > write +cat > execute <<'END' +#!/bin/sh +echo I run successfully +END + +chmod a-w write +chmod a-x execute + +$MAKE +$MAKE dist + +test -f $distdir.tar.gz +gzip -dc $distdir.tar.gz | tar xvf - + +cd $distdir +echo clobber clobber > write +cat write | grep 'clobber clobber' +./execute +./execute | grep 'I run successfully' + +: diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk index eaaa888..0e586d5 100644 --- a/tests/list-of-tests.mk +++ b/tests/list-of-tests.mk @@ -353,6 +353,7 @@ distcom2.test \ distcom3.test \ distcom4.test \ distcom5.test \ +dist-hook-perms.test \ distcom-subdir.test \ distdir.test \ distlinks.test \ -- 1.7.9