Bug #71630 [Opn->Nab]: copy function does not work if destination file does not exist

From: Date: Fri, 19 Feb 2016 17:49:57 +0000
Subject: Bug #71630 [Opn->Nab]: copy function does not work if destination file does not exist
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199349@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71630&edit=1

 ID:                 71630
 Updated by:         cmb@php.net
 Reported by:        vladimir at volomp dot com
 Summary:            copy function does not work if destination file does
                     not exist
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            *General Issues
 Operating System:   linux/all
 PHP Version:        5.5.32
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

So closing as "not a bug".


Previous Comments:
------------------------------------------------------------------------
[2016-02-19 15:40:41] vladimir at volomp dot com

Danack, thanks for your input. I have solved the problem - it was indeed one of the custom patches
that was faulty, causing stat to return a bit unexpected value 2, that came from errno by mistake.

------------------------------------------------------------------------
[2016-02-19 14:28:17] danack@php.net

> When file does not exist, should -1 as 'non-statable stream' be expected,

I believe that is correct.

> Is it php_stream_stat_path_ex() supposed to return 0 if file is not found?

I believe the return values mirror those of standard system stat calls - 0 indicates success, other
values a errors. http://linux.die.net/man/2/stat


If you're not seeing the error on git 5.5.32, then you'll need to isolate where the error
has been introduced as we are unable to reproduce it.

------------------------------------------------------------------------
[2016-02-19 14:03:31] vladimir at volomp dot com

Seems that git 5.5.32 works just fine, as expected. I do have other patches inside, as this is
redhat based rpm. Sorry, off I go to check further. But still I do not understand how could it
possibly work with this switch/case?

When file does not exist, should -1 as 'non-statable stream' be expected, or some other
error code?

------------------------------------------------------------------------
[2016-02-19 13:56:09] vladimir at volomp dot com

I have patched my server with same check as in 5.2.17 and it now works flawlessly. Could somebody
explain how could this actually work? 

Is it php_stream_stat_path_ex() supposed to return 0 if file is not found?  This code just
doesn't seem right.

------------------------------------------------------------------------
[2016-02-19 13:48:27] danack@php.net

Please can you confirm that you don't have any security modules active that would prevent
creation of new files - such as SELinux or Suhosin?

I think it is far more likely that it is some problem unique to your computer rather than a general
bug with copy().

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=71630


--
Edit this bug report at https://bugs.php.net/bug.php?id=71630&edit=1


Thread (9 messages)

« previous php.bugs (#199349) next »