Menu

#52 vfs::ftp keeps listing cache after unmount

open
nobody
5
2007-11-23
2007-11-23
Anonymous
No

vfs::ftp will keep listing caches even after the mount has been unmounted. This leads to wrong results if different ftp directories are mounted at the same local directory in quick succession (think automated download script)

Example:

package require vfs::ftp
set ::vfs::ftp::cache_listings 0
set fd [vfs::ftp::Mount user1:pass@host/~user1 ftp]
glob ftp/*
vfs::ftp::Unmount $fd ftp
set fd [vfs::ftp::Mount user2:pass@host/~user2/ ftp]
# this glob will display the cached results for user1
glob ftp/*
vfs::ftp::Unmount $fd ftp

Fix seems to be to clear the cache list at Unmount:

proc vfs::ftp::Unmount {fd local} {
vfs::filesystem unmount $local
unset -nocomplain ::vfs::ftp::cacheList
::ftp::Close $fd
}

Discussion

  • Mark Janssen

    Mark Janssen - 2007-11-23

    Logged In: YES
    user_id=1463011
    Originator: NO

    Issue was logged by me

     
  • Mark Janssen

    Mark Janssen - 2007-11-23

    Logged In: YES
    user_id=1463011
    Originator: NO

    Removing the complete cache (although it fixes the problem) is a bit over-aggressive. Really on the cached listings for the unmounted dir should be removed.

     
  • Mark Janssen

    Mark Janssen - 2007-11-24

    Logged In: YES
    user_id=1463011
    Originator: NO

    Removing the complete cache (although it fixes the problem) is a bit over-aggressive. Really on the cached listings for the unmounted dir should be removed.

     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2008-12-03

    This doesn't seem to be correct code for the latest ftpvfs.tcl. As a user, can you say how the actual cacheList items are ordered? Is sounds like an [array unset ...] with the right pattern ($local == $dir?) is needed.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.