]> granicus.if.org Git - curl/commitdiff
Made the directory postprocessor more forgiving of input directory format
authorDan Fandrich <dan@coneharvesters.com>
Mon, 17 Sep 2007 17:22:46 +0000 (17:22 +0000)
committerDan Fandrich <dan@coneharvesters.com>
Mon, 17 Sep 2007 17:22:46 +0000 (17:22 +0000)
tests/data/test613
tests/data/test614
tests/libtest/test613.pl

index 40b5ddb2cc78bf0a9761223d7f4a99714010eb06..db0534a5f55cbad74c85d33d6a0c361f5f7d1ba1 100644 (file)
@@ -10,11 +10,11 @@ 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
+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
 </datacheck>
 </reply>
 
index 407e3e4a6b681a11976da3dd77dbe5dc163e2bd7..1767743cf70defb7faafc57ea37c1d39dc90bd99 100644 (file)
@@ -11,11 +11,11 @@ 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
+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
 </datacheck>
 </reply>
 
index 778c4a91178c889c9ec3c5f41deaeed17d1b40ca..19ef7d687f29df10af7e710fb772daea501a8ae4 100755 (executable)
@@ -58,27 +58,34 @@ elsif ($ARGV[0] eq "postprocess")
                # Process the directory file to remove all information that
                # could be inconsistent from one test run to the next (e.g.
                # file date) or may be unsupported on some platforms (e.g.
-               # Windows). Also, since >7.16.4, the sftp directory listing
+               # Windows). Also, since 7.17.0, the sftp directory listing
                # format can be dependent on the server (with a recent
                # enough version of libssh2) so this script must also
-               # canonicalize the format.  These are the two formats
-               # currently supported:
-               # -r--r--r--    1 ausername grp            47 Dec 31  2000 rofile.txt
+               # canonicalize the format.  Here are examples of the general
+               # format supported:
+               # -r--r--r--   12 ausername grp            47 Dec 31  2000 rofile.txt
                # -r--r--r--   1  1234  4321         47 Dec 31  2000 rofile.txt
-               # The "canonical" format is similar to the second (which is
-               # the one generated with an older libssh2):
-               # -r-?r-?r-?   1     U     U         47 Dec 31  2000 rofile.txt
+               # The "canonical" format is similar to the first (which is
+               # the one generated on a typical Linux installation):
+               # -r-?r-?r-?   12 U         U              47 Dec 31  2000 rofile.txt
 
                my $newfile = $logfile . ".new";
                open(IN, "<$logfile") || die "$!";
                open(OUT, ">$newfile") || die "$!";
                while (<IN>) {
-                       s/^(.)(..).(..).(..).\s*(\d+)\s+\S+ \S?.{5}?(\s+\d)+(.{12}?)/\1\2?\3?\4?   \5     U     U\6\7/;
+                       /^(.)(..).(..).(..).\s*(\S+)\s+\S+\s+\S+\s+(\S+)\s+(\S+\s+\S+\s+\S+)(.*)$/;
                        if ($1 eq "d") {
-                               # Erase inodes, size, mode, time fields for directories
-                               s/^.{14}?(.{12}?).{11}? ... .\d .\d:\d\d/d?????????   N\1          N ???  N NN:NN/;
+                               # Erase all directory metadata except for the name, as it is not
+                               # consistent for across all test systems and filesystems
+                               print OUT "d?????????    N U         U               N ???  N NN:NN$8\n";
+                       } elsif ($1 eq "-") {
+                               # Erase user and group names, as they are not consistent across
+                               # all test systems
+                               printf OUT "%s%s?%s?%s?%5d U         U %15d %s%s\n", $1,$2,$3,$4,$5,$6,$7,$8;
+                       } else {
+                               # Unexpected format; just pass it through and let the test fail
+                               print OUT $_;
                        }
-                       print OUT $_;
                }
 
                close(OUT);