php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2167 configure incorrectly identifies flock() as available
Submitted: 1999-08-26 13:41 UTC Modified: 1999-10-17 10:07 UTC
From: lyndon at messagingdirect dot com Assigned:
Status: Closed Package: Compile Failure
PHP Version: 3.0.12 OS: SunOS 5.7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lyndon at messagingdirect dot com
New email:
PHP Version: OS:

 

 [1999-08-26 13:41 UTC] lyndon at messagingdirect dot com
configure finds the flock() compatibility function on SunOS
5.7 and incorrectly assumes it's the real flock.

The flock() in SunOS 5.x is a compatibility wrapper around
fcntl(). It does not support the true semantics of flock().
In fact, it suffers from all the locking braindamage
inherent in fcntl(). In addition, PHP fails to compile
since SunOS 5.x puts the LOCK_* constants in sys/file.h
which isn't included in the C source files.

The fix is to not use flock() on SunOS 5.x. The following
patch disables the test for flock() when building on
SunOS. (Note: flock() does work on SunOS 4.x, but this
"fix" doesn't differentiate between 4.x and 5.x. Someone
with access to 4.x will need to modify the patched
configure to re-enable flock() there.)

XXX: BEWARE THE LINE BREAKS BELOW!
Index: configure.in
===================================================================
RCS file: /cvs/webserver/webserver/php/configure.in,v
retrieving revision 1.5
diff -u -r1.5 configure.in
--- configure.in        1999/08/26 03:55:46     1.5
+++ configure.in        1999/08/26 17:39:34
@@ -249,7 +249,14 @@
 
 dnl Checks for library functions.
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(memcpy memmove strdup strerror strcasecmp strstr flock lockf putenv tempnam usleep setlocale gettimeofday setvbuf srand48 lrand48 srandom random link symlink regcomp getlogin cuserid vsnprintf gcvt utime crypt setitimer rint unsetenv strftime setsockopt tzset statvfs statfs inet_aton shutdown truncate getpgid getsid getrlimit snprintf)
+AC_CHECK_FUNCS(memcpy memmove strdup strerror strcasecmp strstr lockf putenv tempnam usleep setlocale gettimeofday setvbuf srand48 lrand48 srandom random link symlink regcomp getlogin cuserid vsnprintf gcvt utime crypt setitimer rint unsetenv strftime setsockopt tzset statvfs statfs inet_aton shutdown truncate getpgid getsid getrlimit snprintf)
+dnl
+dnl Solaris implements flock on top of fcntl, thus flock doesn't
+dnl work as advertised there, so we ignore it.
+dnl
+if test "`uname -s 2>/dev/null`" != "SunOS"; then
+       AC_CHECK_FUNCS(flock)
+fi
 AC_FUNC_UTIME_NULL
 AC_FUNC_ALLOCA
 AC_BROKEN_SPRINTF

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-10-17 10:07 UTC] sas at cvs dot php dot net
Has been discussed on the mailing list.
 [2016-11-17 02:09 UTC] yohgaki@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=php-src.git;a=commit;h=7f196e321fa464075248eced7d0d2c046b686b24
Log: Fix bug #71038 - session_start() returns true even when it failed PR #2167
 [2017-01-12 09:12 UTC] krakjoe@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=php-src.git;a=commit;h=7f196e321fa464075248eced7d0d2c046b686b24
Log: Fix bug #71038 - session_start() returns true even when it failed PR #2167
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 20:00:02 2026 UTC