aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/test613.pl
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2007-07-17 21:53:38 +0000
committerDan Fandrich <dan@coneharvesters.com>2007-07-17 21:53:38 +0000
commit989dd9c34abd98ab061c4c29f6697d30111e73f4 (patch)
treee64e4bf83761313d376cfd15f128e73d7dafff20 /tests/libtest/test613.pl
parent1d728aae2a8211a7a9f9f66073bdd672e7a1d2cc (diff)
Fixed test cases 613 and 614 by improving the log postprocessor to handle
a new directory listing format that newer libssh2's can provide. This is probably NOT sufficient to handle all directory listing formats that server's can provide and should be revisited.
Diffstat (limited to 'tests/libtest/test613.pl')
-rwxr-xr-xtests/libtest/test613.pl18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/libtest/test613.pl b/tests/libtest/test613.pl
index 749763d4e..778c4a911 100755
--- a/tests/libtest/test613.pl
+++ b/tests/libtest/test613.pl
@@ -55,15 +55,25 @@ elsif ($ARGV[0] eq "postprocess")
rmdir $dirname || die "$!";
if ($logfile) {
- # 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)
+ # 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
+ # 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
+ # -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
my $newfile = $logfile . ".new";
open(IN, "<$logfile") || die "$!";
open(OUT, ">$newfile") || die "$!";
while (<IN>) {
- s/^(.)(..).(..).(..).(.{4}?).{6}?.{6}?(.{12}?)/\1\2?\3?\4?\5 U U\6/;
+ s/^(.)(..).(..).(..).\s*(\d+)\s+\S+ \S?.{5}?(\s+\d)+(.{12}?)/\1\2?\3?\4? \5 U U\6\7/;
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/;