From: Vince Darley Date: Sun, 6 Jul 2003 20:37:26 +0000 (+0000) Subject: ftpvfs fix X-Git-Tag: vfs-1-3~13 X-Git-Url: http://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=57a1be3112c94ddb27740635ab172d2264920068;p=tclvfs ftpvfs fix --- diff --git a/ChangeLog b/ChangeLog index 9a272a1..221abd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-07-06 Vince Darley + + * library/ftpvfs.tcl: fix to 'file stat' on a directory, which + fixes a variety of problems (e.g. recurisve 'file copy' in a + directory). Thanks to msofer for the detailed bug report and + test script. + 2003-07-03 Vince Darley * library/ftpvfs.tcl: added support for ports other than 21, diff --git a/library/ftpvfs.tcl b/library/ftpvfs.tcl index 779910b..1864ab6 100644 --- a/library/ftpvfs.tcl +++ b/library/ftpvfs.tcl @@ -28,7 +28,7 @@ proc vfs::ftp::Mount {dirurl local} { set port 21 } - set fd [::ftp::Open $host $user $pass -port $port -output ::vfs::log] + set fd [::ftp::Open $host $user $pass -port $port -output ::vfs::ftp::log] if {$fd == -1} { error "Mount failed" } @@ -54,6 +54,11 @@ proc vfs::ftp::Mount {dirurl local} { return $fd } +# Need this because vfs::log takes just one argument +proc vfs::ftp::log {args} { + ::vfs::log $args +} + proc vfs::ftp::Unmount {fd local} { vfs::filesystem unmount $local ::ftp::Close $fd @@ -89,15 +94,14 @@ proc vfs::ftp::stat {fd name} { ::vfs::log $ftpInfo set perms [lindex $ftpInfo 0] if {[string index $perms 0] == "d"} { - lappend res type directory + lappend res type directory size 0 set mtime 0 } else { - lappend res type file + lappend res type file size [ftp::FileSize $fd $name] set mtime [ftp::ModTime $fd $name] } lappend res dev -1 uid -1 gid -1 nlink 1 depth 0 \ - atime $mtime ctime $mtime mtime $mtime mode 0777 \ - size [ftp::FileSize $fd $name] + atime $mtime ctime $mtime mtime $mtime mode 0777 return $res } @@ -215,7 +219,7 @@ proc vfs::ftp::_parseListLine {line} { } proc vfs::ftp::matchindirectory {fd path actualpath pattern type} { - ::vfs::log "matchindirectory $path $pattern $type" + ::vfs::log "matchindirectory $fd $path $actualpath $pattern $type" set res [list] if {![string length $pattern]} { # matching a single file