* automake.in (dist_header): Avoid changing permissions of files
authorAlexandre Oliva <oliva@dcc.unicamp.br>
Mon, 7 Jun 1999 03:34:04 +0000 (03:34 +0000)
committerAlexandre Oliva <oliva@dcc.unicamp.br>
Mon, 7 Jun 1999 03:34:04 +0000 (03:34 +0000)
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
automake.in
m4/init.m4

index b7f16ab..585c28d 100644 (file)
--- 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>
index 80ed96d..9bf29e0 100755 (executable)
@@ -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");
index ff0b2e0..e503e86 100644 (file)
@@ -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