]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix util/find-doc-nits' check_env_vars to look for files with 'git ls-files'
authorRichard Levitte <levitte@openssl.org>
Thu, 18 Sep 2025 10:04:41 +0000 (12:04 +0200)
committerNeil Horman <nhorman@openssl.org>
Thu, 30 Oct 2025 12:12:06 +0000 (08:12 -0400)
If that fails, it will fall back to finding the files with Find::file.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28601)

util/find-doc-nits

index 28573a6269424c5470f1903aac76c16f0227f4cd..cd9e502d53a912b6369fc52a9d28ce13694dd6d4 100755 (executable)
@@ -1309,6 +1309,7 @@ sub check_env_vars {
             if $debug;
         push @except_dirs, "$config{sourcedir}/$_";
     }
+    close $gs_pipe;
     # git call has failed, trying to parse .gitmodules manually
     if (!$git_ok) {
         print STDERR "DEBUG[check_env_vars]: .gitmodules parsing fallback\n"
@@ -1336,8 +1337,19 @@ sub check_env_vars {
     @except_env_files = map { realpath($_) } @except_env_files;
 
     # look for source files
-    find(sub { push @env_files, $File::Find::name if /\.c$|\.in$/; },
-         $config{sourcedir});
+    $git_ok = 0;
+    open my $glf_pipe, '-|', "git ls-files -- \"$config{sourcedir}\"";
+    while (<$glf_pipe>) {
+        $git_ok = 1;
+        s/\R$//; # better chomp
+        push @env_files, $_ if /\.c$|\.in$/;
+    }
+    close $glf_pipe;
+    # git call has failed, trying to find files manually
+    if (!$git_ok) {
+        find(sub { push @env_files, $File::Find::name if /\.c$|\.in$/; },
+             $config{sourcedir});
+    }
 
     foreach my $filename (@env_files) {
         my $realfilename = realpath($filename);