https://bz.apache.org/bugzilla/show_bug.cgi?id=57876

            Bug ID: 57876
           Summary: logresolve.exe on any Windows immediately crashes (if
                    usage() doesn't get called)
           Product: Apache httpd-2
           Version: 2.4.12
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: regression
          Priority: P2
         Component: support
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 32704
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=32704&action=edit
Patch for logresolve.c to open stdin & -out buffered

main() from httpd-2.4.12/support/logresolve.c first opens stdin & -out
unbuffered using the plain apr_file_open_stdin() & -out() so no mutex will be
allocated in the apr_file_t structures, followed by calls to
apr_file_buffer_set() to assign two newly created buffers.

apr_file_buffer_set() from httpd-2.4.12/srclib/apr/file_io/win32/buffer.c
starts by trying to apr_thread_mutex_lock() the associated mutex which is still
NULL from the open above.

The easiest fix is to use apr_file_open_flags_stdin() & -out with the
APR_FOPEN_BUFFERED flag instead as shown in the attached patch.

The implementation for UNIX of apr_file_buffer_set() (in
httpd-2.4.12/srclib/apr/file_io/unix/buffer.c) differs by applying the
file_lock() & -unlock macros from
httpd-2.4.12/srclib/apr/include/arch/unix/apr_arch_file_io.h which in turn will
only call apr_thread_mutex_lock() & -unlock if the mutex exists.

Both variants are wrong as the documentation in
httpd-2.4.12/srclib/apr/include/apr_file_io.h states that apr_file_buffer_set()
can be used to assign a buffer to an unbuffered file *requiring* the use of a
mutex (#if APR_HAS_THREADS). Fixing the handling of the mutex in the APR
library would be the right thing and obsolete the patch given here.

logresolve.exe from httpd-2.2.x did work on Windows.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to