| Summary | ssh2 VFS module stat() cache needs to be flushed in read() before checking file size |
| Queue | Horde Base |
| Queue Version | 3.3.5 |
| Type | Bug |
| State | Resolved |
| Priority | 1. Low |
| Owners | chuck (at) horde (dot) org |
| Requester | lstewart (at) room52 (dot) net |
| Created | 10/29/2009 (5855 days ago) |
| Due | |
| Updated | 11/01/2009 (5852 days ago) |
| Assigned | |
| Resolved | 11/01/2009 (5852 days ago) |
| Github Issue Link | |
| Github Pull Request | |
| Milestone | |
| Patch | Yes |
Assigned to Chuck Hagenbuch
State ⇒ Resolved
Clear the stat cache before reading the filesize of a temp file that
may already
be cached.
Bug: 8669Submitted by: lstewart (at) room52 (dot) net
http://cvs.horde.org/diff.php/framework/VFS/lib/VFS/ssh2.php?rt=horde&r1=1.15&r2=1.16&ty=u
New Attachment: horde_sshfilesizefix.diff
Priority ⇒ 1. Low
Patch ⇒ Yes
Milestone ⇒
Queue ⇒ Horde Base
Summary ⇒ ssh2 VFS module stat() cache needs to be flushed in read() before checking file size
Type ⇒ Bug
State ⇒ Unconfirmed
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.