[Tickets #8669] ssh2 VFS module stat() cache needs to be flushed in read() before checking file size

bugs at horde.org bugs at horde.org
Thu Oct 29 18:12:15 UTC 2009


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/8669
------------------------------------------------------------------------------
  Ticket             | 8669
  Created By         | lstewart at room52.net
  Summary            | ssh2 VFS module stat() cache needs to be flushed in
                     | read() before checking file size
  Queue              | Horde Base
  Version            | 3.3.5
  Type               | Bug
  State              | Unconfirmed
  Priority           | 1. Low
  Milestone          |
  Patch              | 1
  Owners             |
------------------------------------------------------------------------------


lstewart at room52.net (2009-10-29 14:12) wrote:

The remote file is able to be successfully retrieved by the ssh2 VFS  
module and stored in a local temp file. However, the  "$size =  
filesize($file);" line in the read() function returns the size of the  
local temp file as 0 which in turn results in no file content being  
returned.

This is caused by calling certain other PHP function(s) (which rely on  
the underlying OS stat() function) on the temp file prior to it  
actually being populated with remote content. The details of the first  
stat() on the temp file are cached in the PHP stat cache, so even  
though the temp file subsequently gets populated with content, the  
cache returns data for the temp file which is stale.

On a more general note, this type of bug seems like it may be relevant  
to any filesystem-based VFS modules, so it may be wise to audit the  
use of the functions listed here in the "Affected functions" list:
http://us2.php.net/manual/en/function.clearstatcache.php
and check if calls to clearstatcache() are required in other places  
within Horde as well.






More information about the bugs mailing list