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

From: Nick Bowler <[email-masked]>
Date: Fri, 24 Feb 2012 13:34:36 -0500

On 2012-02-24 19:19 +0100, Stefano Lattarini wrote:
> On 02/24/2012 06:53 PM, Nick Bowler wrote:
> > On 2012-02-24 18:37 +0100, Stefano Lattarini wrote:
> > [...]
> >> 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).
> > 
> > In that case, the manual should include a note that you should not
> > expect "make dist" to work properly with a read-only source tree.
>
> But it's the package that expects its distributed files to be writable
> that is assuming too much; if such package wants its expectation to
> safely hold, it should add something like this in its 'dist-hook':
> 
>     find $(distdir) -exec chmod u+w '{}' ';'

So I've done this now, but note that this is actually harder than you
make it out to be.  If the package adds prerequisites to the dist-hook
target (I find it is generally good practice for -hook and -local
targets to use prerequisites with commands instead of putting commands
directly in those targets) to the dist-hook target, one would want the
permissions to be fixed *before* executing the prerequisite targets.
But this cannot be done by simply adding things directly to the
dist-hook target.

> > Distcheck should also refrain from testing this.
>
> Nope; distcheck testing that the distributed package builds correctly with
> a read-only source tree is a feature, not a bug, since the GCS require this.

I'm not talking about building the package, which absolutely should work
from a read-only source tree.  I'm talking about creating a distribution
tarball, with "make dist": something only package maintainers (that's
me!) will generally do.

As it stands, "make dist" currently does not work properly from a
read-only source tree.  The tarball generated by my minimal example (an
empty Makefile.am!) is clearly broken, and I would not want to be caught
distributing such a thing.

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