* automake.in (dist_header): Avoid changing permissions of files
in the source tree, trying a complex `find/chmod' command before
falling back to plain chmod.
(handle_dist_worker): Do not create directories with mode 777, the
find above will take care of that.
* m4/init.m4: Set install_sh for find/chmod above.
diff --git a/ChangeLog b/ChangeLog
index b7f16ab..585c28d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
1999-06-07 Alexandre Oliva <oliva@dcc.unicamp.br>
+ * automake.in (dist_header): Avoid changing permissions of files
+ in the source tree, trying a complex `find/chmod' command before
+ falling back to plain chmod.
+ (handle_dist_worker): Do not create directories with mode 777, the
+ find above will take care of that.
+ * m4/init.m4: Set install_sh for find/chmod above.
+
* THANKS: Added Shuhei Amakawa.
1999-06-07 Shuhei Amakawa <sa264@cam.ac.uk>
diff --git a/automake.in b/automake.in
index 80ed96d..9bf29e0 100755
--- a/automake.in
+++ b/automake.in
@@ -2612,8 +2612,7 @@
# Create dist directory.
$output_rules .= ("\t-rm -rf \$(distdir)\n"
- . "\tmkdir \$(distdir)\n"
- . "\t-chmod 777 \$(distdir)\n");
+ . "\tmkdir \$(distdir)\n");
}
# Only run automake in `dist' target if --include-deps and
@@ -2745,7 +2744,6 @@
. "\t" . ' test -d $(distdir)/$$subdir ' . "\\\n"
. "\t" . ' || mkdir $(distdir)/$$subdir ' . "\\\n"
. "\t" . ' || exit 1; ' . "\\\n"
- . "\t" . ' chmod 777 $(distdir)/$$subdir; ' . "\\\n"
. "\t" . ' (cd $$subdir'
. ' && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$('
. (($relative_dir eq '.') ? 'distdir' : 'top_distdir')
@@ -6707,9 +6705,19 @@
# PARTICULAR PURPOSE.
";
+ # This complex find command will try to avoid changing the modes of
+ # links into the source tree, in case they're hard-linked. It will
+ # also make directories writable by everybody, because some
+ # brain-dead tar implementations change ownership and permissions of
+ # a directory before extracting the files, thus becoming unable to
+ # extract them.
# Ignore return result from chmod, because it might give an error
# if we chmod a symlink.
- $dist_header = "\t" . '-chmod -R a+r $(distdir)' . "\n";
+ $dist_header = ' -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \\
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \\
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \\
+ || chmod -R a+r $(distdir)
+';
$dist{'dist-bzip2'} = ("\t"
. '$(AMTAR) ch$(AMTARFLAGS)f - $(distdir) | bzip --best -c > $(distdir).bz2'
. "\n");
diff --git a/m4/init.m4 b/m4/init.m4
index ff0b2e0..e503e86 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -31,6 +31,10 @@
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
+dnl Set install_sh for make dist
+install_sh="$missing_dir/install-sh"
+test -f "$install_sh" || install_sh="$missing_dir/install.sh"
+AC_SUBST(install_sh)
dnl We check for tar when the user configures the end package.
dnl This is sad, since we only need this for "dist". However,
dnl there's no other good way to do it. We prefer GNU tar if