Bug 61702

Summary: flock() broke in php-4.0.6-13
Product: [Retired] Red Hat Linux Reporter: Alexander Kourakos <awk>
Component: phpAssignee: Joe Orton <jorton>
Status: CLOSED CURRENTRELEASE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: high    
Version: 7.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-04-05 12:28:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
flock() test script none

Description Alexander Kourakos 2002-03-23 05:56:11 UTC
Description of Problem: flock($open_fp, LOCK_EX) always returns a false value
(and fails to lock).

Version-Release number of selected component (if applicable): php-4.0.6-13

How Reproducible: I used the following command-line script (but the bug occurs
from within mod_php too):

#!/usr/bin/php -q
&lt;?php
  if (!($fp = fopen('/tmp/lock.file', 'r'))) {
    die(&quot;couldn't open file to lock\n&quot;);
  } else {
    flock($fp, LOCK_EX) or print &quot;couldn't get lock!!\n&quot;;
    print &quot;HELLO\n&quot;; sleep(5); print &quot;GOODBYE\n&quot;;
    flock($fp, LOCK_UN);
    fclose($fp);
  }
?&gt;

Additional Information:
It was working fine in php-4.0.6-9.7.0

Comment 1 Alexander Kourakos 2002-03-23 05:58:16 UTC
Created attachment 49807 [details]
flock() test script

Comment 2 Joe Orton 2004-04-05 12:28:02 UTC
Thanks for the report.  This seems to work OK in current release when
the test script is corrected to pass 'w' to fopen; please reopen if
there are still problems.