php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63241 PHP fails to open Windows deduplicated files
Submitted: 2012-10-08 16:17 UTC Modified: 2012-10-10 08:27 UTC
From: daniel dot stelter-gliese at innogames dot de Assigned: mattficken
Status: Closed Package: Win32API related
PHP Version: 5.4.7 OS: Windows Server 2012
Private report: No CVE-ID:
 [2012-10-08 16:17 UTC] daniel dot stelter-gliese at innogames dot de
Description:
------------
Opening a file that was deduplicated by Windows Server 2012 deduplication fails 
with "No such file or directory".
The behavior can be reproduced locally and through SMB shares (on Win7 and Win8 
clients). I've tried 5.3.15 and 5.4.7 - judging from the code latest snapshots are 
affected, too.

I could trace this to a problem with reparse points: deduplication adds the new 
reparse tag  IO_REPARSE_TAG_DEDUP. There seems to be no documentation on this tag, 
so I could only interpret it as a flag to be ignored.
The attached patch simply treats a IO_REPARSE_TAG_DEDUP file as a substitute on 
the same path, which worked well.

Test script:
---------------
$path = 'S:\\test.exe';
var_dump(filesize($path));
var_dump(realpath($path));
var_dump(strlen(file_get_contents($path)));
var_dump(fopen($path, 'rb'));

Expected result:
----------------
int(5448704)
string(50) "S:\test.exe"
int(5448704)
resource(6) of type (stream)

Actual result:
--------------
int(5448704)
bool(false)

Warning: file_get_contents(S:\test.exe):
failed to open stream: No such file or directory in C:\php-sdk\php54dev\vc9\x64\
php-5.4.7-src\x64\Release\test.php on line 6
int(0)

Warning: fopen(S:\test.exe): failed to op
en stream: No such file or directory in C:\php-sdk\php54dev\vc9\x64\php-5.4.7-sr
c\x64\Release\test.php on line 7
bool(false)


Patches

php_fix_dedup.patch (last revision 2012-10-12 13:52 UTC) by daniel dot stelter-gliese at innogames dot de)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-09 08:03 UTC] pajoye@php.net
Matt, can you try to reproduce it please?
 [2012-10-09 08:03 UTC] pajoye@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: mattficken
 [2012-10-10 08:27 UTC] pajoye@php.net
Thanks for the very good report :) We can reproduce it and added it to our tests 
suite.

I'd to see how to deal with deduplicated files, if we have to cache them the same 
way we do for links or mounted volumes (necessary for require_once and the likes).
 [2012-10-10 21:53 UTC] mattficken@php.net
The patch doesn't compile.

Fixing the missing }, the patch doesn't work for me. I can still reproduce the bug.
 [2012-10-12 13:56 UTC] daniel dot stelter-gliese at innogames dot de
Sorry for the compile error, I was in a bit of a hurry when I uploaded it.
Not only was a } missing, but also an assignment to isabsolute. Looking at the 
code this might be the reason why it fails.

I've updated the patch.
 [2012-10-12 21:59 UTC] mattficken@php.net
The most recent patch fixes this bug for me using 5.4.7 TS and Win7sp1x64 and Win2k12.
 [2012-10-31 17:53 UTC] daniel dot stelter-gliese at innogames dot de
Any updates on this issue? Will it be merged?
 [2012-10-31 22:03 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a2e4404bc8155e6b6d9deefa22a172857d4b5e08
Log: Fixed bug #63241 PHP fails to open Windows deduplicated files.
 [2012-10-31 22:03 UTC] ab@php.net
-Status: Assigned +Status: Closed
 [2012-10-31 22:11 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a2e4404bc8155e6b6d9deefa22a172857d4b5e08
Log: Fixed bug #63241 PHP fails to open Windows deduplicated files.
 [2012-10-31 22:54 UTC] mattficken@php.net
Your patch has been committed to all PHP branches (5.3, 5.4, master(php 5.5))

If its not included in the next release (because it may be committed after the revision chosen for release), it should be in the one after that.

Thank you very much for noticing this problem and fixing it. Thank you for making PHP better.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 21:01:56 2014 UTC