From 2d5c3abead3f72c457d886b92b3fbd977d273191 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Mon, 7 Jun 1999 03:34:04 +0000 Subject: [PATCH] * 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. --- ChangeLog | 7 +++++++ automake.in | 16 ++++++++++++---- m4/init.m4 | 4 ++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7f16ab78..585c28da9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 1999-06-07 Alexandre Oliva + * 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 diff --git a/automake.in b/automake.in index 80ed96d7f..9bf29e055 100755 --- a/automake.in +++ b/automake.in @@ -2612,8 +2612,7 @@ sub handle_dist_worker # 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 @@ sub handle_dist_worker . "\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 @@ sub initialize_global_constants # 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 ff0b2e04e..e503e8620 100644 --- a/m4/init.m4 +++ b/m4/init.m4 @@ -31,6 +31,10 @@ AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) 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 -- 2.47.2