]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
test613.pl: make tests 613 and 614 work with OpenSSH for Windows
authorMarc Hoersken <info@marc-hoersken.de>
Tue, 5 May 2020 20:05:49 +0000 (22:05 +0200)
committerMarc Hoersken <info@marc-hoersken.de>
Wed, 6 May 2020 17:33:20 +0000 (19:33 +0200)
OpenSSH for Windows shows group and other/world permissions as *,
because those concepts do not exist on Windows. It also does not
show the current or parent directory, so we just ignore those.

Reviewed-by: Daniel Stenberg
Closes #5328

tests/data/test613
tests/data/test614
tests/libtest/test613.pl

index fcb9837711328cb70e3ff952098a2b3d4bcb104c..0383987e52ff88f0fee56eafa79bd3b451513103 100644 (file)
@@ -10,8 +10,6 @@ directory
 # Server-side
 <reply>
 <datacheck>
-d?????????    N U         U               N ???  N NN:NN .
-d?????????    N U         U               N ???  N NN:NN ..
 d?????????    N U         U               N ???  N NN:NN asubdir
 -rw?rw?rw?    1 U         U              37 Jan  1  2000 plainfile.txt
 -r-?r-?r-?    1 U         U              47 Dec 31  2000 rofile.txt
index 95a86c5620c880905e0a2774e5f60cb5c841bcd2..c6fe4919da741dead47257c0856f269d63912727 100644 (file)
@@ -11,8 +11,6 @@ directory
 # Server-side
 <reply>
 <datacheck>
-d?????????    N U         U               N ???  N NN:NN .
-d?????????    N U         U               N ???  N NN:NN ..
 d?????????    N U         U               N ???  N NN:NN asubdir
 -r-?r-?r-?    1 U         U              37 Jan  1  2000 plainfile.txt
 -r-?r-?r-?    1 U         U              47 Dec 31  2000 rofile.txt
index ead1159ffe7c0b0c403767c93353cedf193d6220..8efc05ca047b1ce1f8c6a4db89049e4b283de7f8 100755 (executable)
@@ -97,15 +97,29 @@ elsif ($ARGV[0] eq "postprocess")
         my @canondir;
         open(IN, "<$logfile") || die "$!";
         while (<IN>) {
-            /^(.)(..).(..).(..).\s*(\S+)\s+\S+\s+\S+\s+(\S+)\s+(\S+\s+\S+\s+\S+)(.*)$/;
+            /^(.)(..).(..).(..).\s*(\S+)\s+\S+\s+\S+\s+(\S+)\s+(\S+\s+\S+\s+\S+)\s+(.*)$/;
             if ($1 eq "d") {
+                # Skip current and parent directory listing, because some SSH
+                # servers (eg. OpenSSH for Windows) are not listing those
+                if ($8 eq "." || $8 eq "..") {
+                    next;
+                }
                 # Erase all directory metadata except for the name, as it is not
                 # consistent for across all test systems and filesystems
-                push @canondir, "d?????????    N U         U               N ???  N NN:NN$8\n";
+                push @canondir, "d?????????    N U         U               N ???  N NN:NN $8\n";
             } elsif ($1 eq "-") {
+                # Replace missing group and other permissions with user
+                # permissions (eg. on Windows) due to them being shown as *
+                my ($u, $g, $o) = ($2, $3, $4);
+                if($g eq "**") {
+                    $g = $u;
+                }
+                if($o eq "**") {
+                    $o = $u;
+                }
                 # Erase user and group names, as they are not consistent across
                 # all test systems
-                my $line = sprintf("%s%s?%s?%s?%5d U         U %15d %s%s\n", $1,$2,$3,$4,$5,$6,$7,$8);
+                my $line = sprintf("%s%s?%s?%s?%5d U         U %15d %s %s\n", $1,$u,$g,$o,$5,$6,$7,$8);
                 push @canondir, $line;
             } else {
                 # Unexpected format; just pass it through and let the test fail