You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Tetsuya Furukawa <te...@secom-sis.co.jp> on 1997/08/21 08:50:01 UTC

mod_rewrite/1029: RewriteMap programs don't work on FreeBSD

>Number:         1029
>Category:       mod_rewrite
>Synopsis:       RewriteMap programs don't work on FreeBSD
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache (Apache HTTP Project)
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Wed Aug 20 23:50:00 1997
>Originator:     tetsuya@secom-sis.co.jp
>Organization:
apache
>Release:        1.2.1, 1.2.3
>Environment:
FreeBSD 2.1.7.1-RELEASE and 2.2-STABLE
>Description:
On the FreeBSD operating system, flock() always fails in fd_lock() called by
lookup_map_program(), because flock() doesn't support pipes on the system.
Fcntl(fd, F_SETLKW, ...) doesn't too.

Additionally, the usage of flock() in fd_lock() seems improper.
The file descriptor given to flock() should be opened after fork().
So I think the locking for RewriteLogFile doesn't work if USE_FLOCK is defined.
Actually, there isn't any problem at RewriteLogFile, because the locking
is currently no use.
>How-To-Repeat:
In the configuration file on the FreeBSD machine, write
----
RewriteEngine on
RewriteMap testmap prg:/path/testmap
RewriteRule ^/test1/(.*) /test2/${testmap:$1|}
----
where the /path/testmap is a proper map program.

Then, if you access http://host/test1/foo, the accepted child process will print
----
flock: Operation not supported
Error getting lock. Exiting!
----
and die.
>Fix:
1. Create a temporary file for each map program.
2. Open the files after fork().
3. Give the file descriptors to fd_lock().
%0
>Audit-Trail:
>Unformatted: