[openssl] OpenSSL_1_1_1-stable update

Richard Levitte levitte at openssl.org
Thu Jul 2 16:56:50 UTC 2020


The branch OpenSSL_1_1_1-stable has been updated
       via  a98fa843b8ab00e8f3b966a1f5321aaffe805100 (commit)
      from  bfbf06c4d29086f1c67ed38324a2c4a9f642d291 (commit)


- Log -----------------------------------------------------------------
commit a98fa843b8ab00e8f3b966a1f5321aaffe805100
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Jul 1 10:06:59 2020 +0200

    Configure: Check source and build dir equality a little more thoroughly
    
    'absolutedir' does a thorough job ensuring that we have a "real" path
    to both source and build directory, unencumbered by symbolic links.
    However, that isn't enough on case insensitive file systems on Unix
    flavored platforms, where it's possible to stand in, for example,
    /PATH/TO/Work/openssl, and then do this:
    
        perl ../../work/openssl/Configure
    
    ... and thereby having it look like the source directory and the build
    directory aren't the same.
    
    We solve this by having a closer look at the computed source and build
    directories, and making sure they are exactly the same strings if they
    are in fact the same directory.
    
    This is especially important when making symbolic links based on this
    directories, but may have other ramifications as well.
    
    Fixes #12323
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/12337)
    
    (cherry picked from commit 610e2b3b7019b11d97f1dcda13575254a2c65c3d)

-----------------------------------------------------------------------

Summary of changes:
 Configure | 35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/Configure b/Configure
index 29f8b4dd4b..1d73d06e1b 100755
--- a/Configure
+++ b/Configure
@@ -217,12 +217,22 @@ sub resolve_config;
 # Unified build supports separate build dir
 my $srcdir = catdir(absolutedir(dirname($0))); # catdir ensures local syntax
 my $blddir = catdir(absolutedir("."));         # catdir ensures local syntax
+
+# File::Spec::Unix doesn't detect case insensitivity, so we make sure to
+# check if the source and build directory are really the same, and make
+# them so.  This avoids all kinds of confusion later on.
+# We must check @File::Spec::ISA rather than using File::Spec->isa() to
+# know if File::Spec ended up loading File::Spec::Unix.
+$srcdir = $blddir
+    if (grep(/::Unix$/, @File::Spec::ISA)
+        && samedir($srcdir, $blddir));
+
 my $dofile = abs2rel(catfile($srcdir, "util/dofile.pl"));
 
 my $local_config_envname = 'OPENSSL_LOCAL_CONFIG_DIR';
 
-$config{sourcedir} = abs2rel($srcdir);
-$config{builddir} = abs2rel($blddir);
+$config{sourcedir} = abs2rel($srcdir, $blddir);
+$config{builddir} = abs2rel($blddir, $blddir);
 
 # Collect reconfiguration information if needed
 my @argvcopy=@ARGV;
@@ -3427,6 +3437,27 @@ sub absolutedir {
     return realpath($dir);
 }
 
+# Check if all paths are one and the same, using stat.  They must both exist
+# We need this for the cases when File::Spec doesn't detect case insensitivity
+# (File::Spec::Unix assumes case sensitivity)
+sub samedir {
+    die "samedir expects two arguments\n" unless scalar @_ == 2;
+
+    my @stat0 = stat($_[0]);    # First argument
+    my @stat1 = stat($_[1]);    # Second argument
+
+    die "Couldn't stat $_[0]" unless @stat0;
+    die "Couldn't stat $_[1]" unless @stat1;
+
+    # Compare device number
+    return 0 unless ($stat0[0] == $stat1[0]);
+    # Compare "inode".  The perl manual recommends comparing as
+    # string rather than as number.
+    return 0 unless ($stat0[1] eq $stat1[1]);
+
+    return 1;                   # All the same
+}
+
 sub quotify {
     my %processors = (
         perl    => sub { my $x = shift;


More information about the openssl-commits mailing list