]> sourceware.org Git - automake.git/commitdiff
Fix for PR automake/38:
authorTom Tromey <tromey@redhat.com>
Sun, 19 Mar 2000 22:25:13 +0000 (22:25 +0000)
committerTom Tromey <tromey@redhat.com>
Sun, 19 Mar 2000 22:25:13 +0000 (22:25 +0000)
* automake.in (require_file_internal): Check for and handle
dangling symlinks.  Fixes symlink2.test.

ChangeLog
automake.in

index 39b7b47165e3789b40e52ff5189b0e2a17710a9e..403b70d6558c7248a5cc62f88c7e922bbd281af3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2000-03-19  Tom Tromey  <tromey@cygnus.com>
 
+       Fix for PR automake/38:
+       * automake.in (require_file_internal): Check for and handle
+       dangling symlinks.  Fixes symlink2.test.
+
        Fix for PR automake/45:
        * automake.texi (configure): Mention requirement to run
        AM_INIT_AUTOMAKE.
index e6db433fc64dc07a138b699a972d942fc0323611..87c269348969204fa4d7c8a0e55ec6f94020dc63 100755 (executable)
@@ -7432,7 +7432,7 @@ sub require_file_internal
 {
     local ($is_configure, $line, $mystrict, @files) = @_;
     local ($file, $fullfile);
-    local ($found_it, $errfile, $errdir);
+    local ($found_it, $dangling_sym, $errfile, $errdir);
     local ($save_dir);
 
     foreach $file (@files)
@@ -7442,6 +7442,7 @@ sub require_file_internal
        $require_file_found{$file} = 1;
 
        $found_it = 0;
+       $dangling_sym = 0;
        foreach $dir (@require_file_paths)
        {
            if ($dir eq '.')
@@ -7461,7 +7462,12 @@ sub require_file_internal
            # config_aux_path.
            $errfile = $errdir . '/' . $file;
 
-           if (-f $fullfile)
+           if (-l $fullfile && ! -f _)
+           {
+               $dangling_sym = 1;
+               last;
+           }
+           elsif (-f $fullfile)
            {
                $found_it = 1;
                &maybe_push_required_file ($dir, $file, $fullfile);
@@ -7479,6 +7485,11 @@ sub require_file_internal
        {
            if ($strictness >= $mystrict)
            {
+               if ($dangling_sym)
+               {
+                   unlink ($fullfile);
+               }
+
                local ($trailer) = '';
                local ($suppress) = 0;
 
@@ -7512,13 +7523,13 @@ sub require_file_internal
                            if (! symlink ($am_dir . '/' . $file, $errfile))
                            {
                                $suppress = 0;
-                               $trailer = "; error while making link: $!\n";
+                               $trailer = "; error while making link: $!";
                            }
                        }
                        elsif (system ('cp', $am_dir . '/' . $file, $errfile))
                        {
                            $suppress = 0;
-                           $trailer = "\n    error while copying\n";
+                           $trailer = "\n    error while copying";
                        }
                    }
 
This page took 0.045866 seconds and 5 git commands to generate.