6.0.0-beta1
7/8/25

[#6904] VFS_file::_getNativePath fails on Windows
Summary VFS_file::_getNativePath fails on Windows
Queue Horde Framework Packages
Queue Version HEAD
Type Bug
State No Feedback
Priority 1. Low
Owners Horde Developers (at)
Requester christian.ost (at) gmail (dot) com
Created 06/12/2008 (6235 days ago)
Due
Updated 06/26/2008 (6221 days ago)
Assigned 06/13/2008 (6234 days ago)
Resolved 06/26/2008 (6221 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
06/26/2008 09:13:06 PM Michael Rubinsky Comment #9
State ⇒ No Feedback
Reply to this comment
Probably a configuration error...will reopen if we receive useful feedback
06/24/2008 05:16:43 PM Michael Rubinsky Comment #8 Reply to this comment
ping?
06/18/2008 05:31:15 PM Michael Rubinsky Comment #7
Priority ⇒ 1. Low
Reply to this comment
Can the original requester verify that his VFS configuration is 
correct for a windows system and that this is an actual issue? (See 
comment below)
06/18/2008 05:30:04 PM Michael Rubinsky Deleted Original Message
 
06/15/2008 09:43:02 AM Jan Schneider Comment #6 Reply to this comment
..but another thought *did* occur to me, that realpath() seems to
actually perform a file_exists check on the path and returns FALSE if
it's not found (unless your on a BSD system - in which case it will
only return false if the path minus the trailing /xxx doesn't exist).
We have Util::realPath() for that purpose, but I agree that this 
probably is not the solution anyway.
06/14/2008 05:21:50 PM Michael Rubinsky Comment #5 Reply to this comment
...and thinking this through some more, I'm not even sure I see why 
this is failing for you at all.  If your on a windows system, 
shouldn't the path you configured for the vfsroot have the necessary 
drive specifier?  Can you provide the vfsroot your using as well as   
the path and filename you are providing to the_getNativePath() function?
06/14/2008 05:18:06 PM Michael Rubinsky Comment #4 Reply to this comment
I'm not an expert on this, but Windows uses '\' instead of '/' as
directory separator. You can see an example output if you look at the
documentation of realpath() in the comments here:
http://php.net/manual/de/function.realpath.php.
Well, according to the realpath() documentation, one of the points of 
realpath() is to convert unix-style to windows style when appropriate, 
so the result of realpath should be a windows friendly path.



..but another thought *did* occur to me, that realpath() seems to 
actually perform a file_exists check on the path and returns FALSE if 
it's not found (unless your on a BSD system - in which case it will 
only return false if the path minus the trailing /xxx doesn't exist).   
So.... I don't think this function is a viable option as it will break 
a lot of our VFS functionality.
06/13/2008 07:13:30 AM Thomas Jarosch Comment #3 Reply to this comment
if (substr($name, 0, 1) != '/') {
     $name = '/' . $name;
}

produces "/C:[...]", which in turn leads to a "Not a directory" error
(e.g. in _listFolder).
I'm not an expert on this, but Windows uses '\' instead of '/' as 
directory separator. You can see an example output if you look at the 
documentation of realpath() in the comments here: 
http://php.net/manual/de/function.realpath.php.

Maybe PHP accepts path using C:\ and C:/ notation, but our path 
building function is still wrong and will compute wrong paths, no?


06/13/2008 12:38:59 AM Michael Rubinsky State ⇒ Feedback
 
06/13/2008 12:38:20 AM Michael Rubinsky Comment #2
New Attachment: vfs.diff
Reply to this comment
if (substr($name, 0, 1) != '/') {
     $name = '/' . $name;
}

produces "/C:[...]", which in turn leads to a "Not a directory" error
(e.g. in _listFolder).
I'm not seeing how *this* code block would produce that since it's the 
file name and it gets appended to the actual path further down in the 
code...and it's *that* code that probably is causing the results your 
seeing.  Does wrapping the return values in realpath() as in the 
attached patch solve the issue for you?


06/12/2008 05:56:05 PM Chuck Hagenbuch Assigned to Horde DevelopersHorde Developers
State ⇒ Assigned
 
06/12/2008 02:27:55 PM christian (dot) ost (at) gmail (dot) com Comment #1
Priority ⇒ 2. Medium
State ⇒ Unconfirmed
Milestone ⇒
Queue ⇒ Horde Framework Packages
Summary ⇒ VFS_file::_getNativePath fails on Windows
Type ⇒ Bug
Reply to this comment
_getNativePath does not work on systems running php on top of MS Windows.



The code



if (substr($name, 0, 1) != '/') {

     $name = '/' . $name;

}



produces "/C:[...]", which in turn leads to a "Not a directory" error

(e.g. in _listFolder).



As the horde VFS lib is also included in the PEAR repository, this 
issue concerns a broad range

of users.



A possible workaround could use the PHP_OS variable (or 
PEAR::OS_Guess) for OS-dependent handling, or the realpath function of 
php (why a custom UNIX-only function here?)

Saved Queries