Subject: Re: bug#14845: dist-hook does not execute just before tar gzip

From: Stefano Lattarini <[email-masked]>
Date: Sun, 21 Jul 2013 18:54:36 +0100

severity 14845 minor
tags 14845 wontfix
close 14845
stop

Hi Mohan, thanks for the report, and sorry for the delay.

Unfortunately, I have decided that the bug you are reporting
is actually a desired behaviour (see below for a rationale),
so I'm not going to change it, and I'm closing this report as
"Won't Fix".  However, if you want, you are still free to
continue the discussion here, or to further argue you point.
Just make sure to keep the list in the loop.

On 07/11/2013 11:30 PM, Mohan wrote:
> As per the documentation dist-hook is supposed to execute before the tar/gzip, but there are few other commands
> that execute after dist-hook that effectively nullifies the effect of dist-hook
> 
> automake --version
> automake (GNU automake) 1.11.1
>
> autoconf --version
> autoconf (GNU Autoconf) 2.63
>
Wow, those are very old versions.  The next time you report a bug,
you should make sure to be using the latest version of the tools you
are reporting the bug against.  In this case, it's no big deal, since
the behavior you are seeing hasn't changes since Automake 1.11; but
in other cases, you might end up reporting a bug that has been
already fixed in the newest version, which would waste your time
and the maintainer's time.

> dist-hook:
>     $(shell find $(distdir) -name openhpi.conf -exec chmod 600 "{}" ";")
>
FWIW, this is a useless use of the $(shell) builtin; the above should be
more portably and more clearly written as:

    dist-hook:
        find $(distdir) -name openhpi.conf -exec chmod 600 "{}" ";"

> Here's the output of the make portion that is relevant
> 
> 
> make  \
>           top_distdir="openhpi-3.2.1" distdir="openhpi-3.2.1" \
>           dist-hook
> make[1]: Entering directory `/root/mohan/openhpi/openhpi_3.2.x_latest_to_compile'
> make[1]: Nothing to be done for `dist-hook'.
> make[1]: Leaving directory `/root/mohan/openhpi/openhpi_3.2.x_latest_to_compile'
> test -n "" \
>         || find "openhpi-3.2.1" -type d ! -perm -755 \
>                 -exec chmod u+rwx,go+rx {} \; -o \
>           ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
>           ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
>           ! -type d ! -perm -444 -exec /bin/sh /root/mohan/openhpi/openhpi_3.2.x_latest_to_compile/install-sh -c -m a+r {} {} \; \
>         || chmod -R a+r "openhpi-3.2.1"
> tardir=openhpi-3.2.1 && /bin/sh /root/mohan/openhpi/openhpi_3.2.x_latest_to_compile/missing --run tar chof - "$tardir" | GZIP=--best gzip -c >openhpi-3.2.1.tar.gz
> { test ! -d "openhpi-3.2.1" || { find "openhpi-3.2.1" -type d ! -perm -200 -exec chmod u+w {} ';' && rm -fr "openhpi-3.2.1"; }; }
> 
> 
> Problem
> I want to make sure a file in the distribution is set to 600 or 400
> permission.
>
But Automake is a tool aimed at creating build systems that are compatible
with the GNU Coding Standards, and those standards explicitly mandate that
"all the files in the distribution must be world-readable, and directories
must be world-readable and world-searchable":

  <http://www.gnu.org/prep/standards/standards.html#Releases>

Enforcing this property in all Automake-created tarballs is thus a
feature rather than a limitation, and thus I'm not going to change
it (unless you give me a *very* good reason to do so).

> But that is not happening as read permission is turned on for
> all the files after dist-hook, but before GZIP.
> 

Best regards,
  Stefano