Subject: bug#10878: "make dist" with read-only srcdir generates read-only tarball

From: Nick Bowler <[email-masked]>
Date: Fri, 24 Feb 2012 10:09:38 -0500

Hi,

When using a read-only srcdir, "make dist" will generate a tarball whose
permissions have all files read-only (though directories are writable).
I noticed this because "dist-hook" targets cannot actually modify any
files in distdir as they're all read-only (without first running chmod,
anyway), causing distcheck failures.  While the GNU coding standards do
not demand write permissions on files in distribution tarballs (I'm not
really sure why), Automake's behaviour in the build directory should not
depend on whether or not srcdir is writable.

Tested with both automake-1.11.1 and git master.

Here's a simple example:

  % cat >configure.ac <<'EOF'
AC_INIT([test], [1.0])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
EOF

  % cat >Makefile.am <<'EOF'
EOF

  % autoreconf -is
  % ./configure && make dist
  % tar tvf test-1.0.tar.gz

drwxr-xr-x 550/509           0 2012-02-24 09:56 test-1.0/
-rw-r--r-- 550/509          89 2012-02-24 09:56 test-1.0/configure.ac
-rw-r--r-- 550/509       22000 2012-02-24 09:56 test-1.0/aclocal.m4
-rwxr-xr-x 550/509       98862 2012-02-24 09:56 test-1.0/configure
-rw-r--r-- 550/509           0 2012-02-24 09:56 test-1.0/Makefile.am
-rw-r--r-- 550/509       13264 2012-02-24 09:56 test-1.0/Makefile.in
-rwxr-xr-x 550/509       11419 2009-12-10 12:58 test-1.0/missing
-rwxr-xr-x 550/509       13663 2009-12-10 12:58 test-1.0/install-sh

  (notice correct user write permissions on all files)

  % tar xf test-1.0.tar.gz
  % chmod -R a-w test-1.0
  % mkdir build && cd build
  % ../test-1.0/configure && make dist
  % tar tvf test-1.0.tar.gz

drwxr-xr-x 550/509           0 2012-02-24 09:59 test-1.0/
-r--r--r-- 550/509          89 2012-02-24 09:56 test-1.0/configure.ac
-r--r--r-- 550/509       22000 2012-02-24 09:56 test-1.0/aclocal.m4
-r-xr-xr-x 550/509       98862 2012-02-24 09:56 test-1.0/configure
-r--r--r-- 550/509           0 2012-02-24 09:56 test-1.0/Makefile.am
-r--r--r-- 550/509       13264 2012-02-24 09:56 test-1.0/Makefile.in
-r-xr-xr-x 550/509       11419 2009-12-10 12:58 test-1.0/missing
-r-xr-xr-x 550/509       13663 2009-12-10 12:58 test-1.0/install-sh

  (notice that user write permissions are missing)

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).

Cheers,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)