php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15583 thttpd patching fails
Submitted: 2002-02-15 20:13 UTC Modified: 2002-08-20 09:24 UTC
From: norny at yahoo dot com Assigned:
Status: Closed Package: Other web server
PHP Version: 4.1.1 OS: Slackware 8
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: norny at yahoo dot com
New email:
PHP Version: OS:

 

 [2002-02-15 20:13 UTC] norny at yahoo dot com
Patching of the thttpd source fails when I try to compile php as a sapi thttpd module. Tried with thttpd versions 2.19, 2.20c, and 2.22beta4. Report contents apply to thttpd-2.20c (the latest stable version), but I think the error is the same for all. 

Details:

unpackaged php-4.1.1 and thttpd into the same directory and cd to php-4.1.1.

./configure --with-thttpd=../thttpd-2.20c

configure works fine.

then do make install per the readme by Sascha

gcc gets a workout and then Hunks 1 & 2 fail on fdwatch.c on lines 460 and 472 and Hunks 6 & 7 fail on libhttpd.c at lines 2349 and 3025

****************************************
contents of fdwatch.c.rej

***************
*** 460,466 ****
  
      ridx = 0;
      for ( i = 0; i < npollfds; ++i )
- 	if ( pollfds[i].revents & ( POLLIN | POLLOUT ) )
  	    poll_rfdidx[ridx++] = pollfds[i].fd;
  
      return r;
--- 460,466 ----
  
      ridx = 0;
      for ( i = 0; i < npollfds; ++i )
+ 	if ( pollfds[i].revents & ( POLLIN | POLLOUT | POLLERR | POLLHUP | POLLNVAL ) )
  	    poll_rfdidx[ridx++] = pollfds[i].fd;
  
      return r;
***************
*** 472,479 ****
      {
      switch ( fd_rw[fd] )
  	{
- 	case FDW_READ: return pollfds[poll_fdidx[fd]].revents & POLLIN;
- 	case FDW_WRITE: return pollfds[poll_fdidx[fd]].revents & POLLOUT;
  	default: return 0;
  	}
      }
--- 472,479 ----
      {
      switch ( fd_rw[fd] )
  	{
+ 	case FDW_READ: return pollfds[poll_fdidx[fd]].revents & ( POLLIN | POLLERR | POLLHUP | POLLNVAL );
+ 	case FDW_WRITE: return pollfds[poll_fdidx[fd]].revents & (  POLLOUT | POLLERR | POLLHUP | POLLNVAL );
  	default: return 0;
  	}
      }

******************************
end contents of fdwatch.c.rej


******************************
contents of libhttpd.c.rej

***************
*** 2341,2347 ****
      {
      make_log_entry( hc, nowP );
  
-     if ( hc->file_address != (char*) 0 )
  	{
  	mmc_unmap( hc->file_address, &(hc->sb), nowP );
  	hc->file_address = (char*) 0;
--- 2349,2358 ----
      {
      make_log_entry( hc, nowP );
  
+     if ( hc->file_address == (char*) 1 )
+     {
+ 	thttpd_closed_conn(hc->conn_fd);
+     } else if ( hc->file_address != (char*) 0 )
  	{
  	mmc_unmap( hc->file_address, &(hc->sb), nowP );
  	hc->file_address = (char*) 0;
***************
*** 3014,3024 ****
  post_post_garbage_hack( httpd_conn* hc )
      {
      char buf[2];
-     int r;
  
-     r = recv( hc->conn_fd, buf, sizeof(buf), MSG_PEEK );
-     if ( r > 0 )
- 	(void) read( hc->conn_fd, buf, r );
      }
  
  
--- 3025,3033 ----
  post_post_garbage_hack( httpd_conn* hc )
      {
      char buf[2];
  
+ 	fcntl(hc->conn_fd, F_SETFL, O_NONBLOCK);
+ 	(void) read( hc->conn_fd, buf, 2 );
      }

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-17 00:44 UTC] norny at yahoo dot com
I did it again with a php4-latest from snaps.php.net against 
thttpd-2.22beta4.

It asked me if I wanted to patch fdimage.c cause it thinks it's already 
patched. I said no this time.

This is the output of the patching:

patching Makefile.in
Hunk #3 succeeded at 155 (offset 2 lines).
patching config.h
patching fdwatch.c
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
2 of 2 hunks ignored -- saving rejects to file fdwatch.c.rej
patching file libhttpd.c
Hunk #2 succeeded at 249 with fuzz 1 (offset 5 lines).
Hunk #3 succeeded at 255 (offset 2 lines).
Hunk #4 succeeded at 322 (offset 5 lines).
Hunk #5 succeeded at 396 with fuzz 2 (offset 5 lines).
Hunk #6 succeeded at 2401 (offset 40 lines).
Hunk #7 FAILED at 3077.
Hunk #8 succeeded at 3604 (offset 35 lines).
1 out of 8 hunks FAILED -- saving rejects to file libhttpd.c.rej
patching libhttpd.h
Hunk #1 succeeded at 1373 with fuzz 1 (offset 40 lines).
Hunk #3 succeeded at 1546 (offset 40 lines).
patching file mime_encodings.txt
patching file libhttpd.c
Hunk #1 succeeded at 3702 (offset 91 lines).
make[1]: ***[install-sapi] Error 1
make[1]: Leaving directory `/root/sources/php4-200202161800'
make: *** [install-recursive] Error 1

*******************************
start contents of fdwatch.c.rej

***************
*** 454,460 ****
  
      ridx = 0;
      for ( i = 0; i < npollfds; ++i )
- 	if ( pollfds[i].revents & ( POLLIN | POLLOUT ) )
  	    poll_rfdidx[ridx++] = pollfds[i].fd;
  
      return r;
--- 454,460 ----
  
      ridx = 0;
      for ( i = 0; i < npollfds; ++i )
+ 	if ( pollfds[i].revents & ( POLLIN | POLLOUT | POLLERR | POLLHUP | 
POLLNVAL ) )
  	    poll_rfdidx[ridx++] = pollfds[i].fd;
  
      return r;
***************
*** 466,473 ****
      {
      switch ( fd_rw[fd] )
  	{
- 	case FDW_READ: return pollfds[poll_fdidx[fd]].revents & POLLIN;
- 	case FDW_WRITE: return pollfds[poll_fdidx[fd]].revents & POLLOUT;
  	default: return 0;
  	}
      }
--- 466,473 ----
      {
      switch ( fd_rw[fd] )
  	{
+ 	case FDW_READ: return pollfds[poll_fdidx[fd]].revents & ( POLLIN | 
POLLERR | POLLHUP | POLLNVAL );
+ 	case FDW_WRITE: return pollfds[poll_fdidx[fd]].revents & (  
POLLOUT | POLLERR | POLLHUP | POLLNVAL );
  	default: return 0;
  	}
      }


**************************
end contents fdwatch.c.rej

**************************
start contents libhttpd.c.rej

***************
*** 3066,3076 ****
  post_post_garbage_hack( httpd_conn* hc )
      {
      char buf[2];
-     int r;
  
-     r = recv( hc->conn_fd, buf, sizeof(buf), MSG_PEEK );
-     if ( r > 0 )
- 	(void) read( hc->conn_fd, buf, r );
      }
  
  
--- 3077,3085 ----
  post_post_garbage_hack( httpd_conn* hc )
      {
      char buf[2];
  
+ 	fcntl(hc->conn_fd, F_SETFL, O_NONBLOCK);
+ 	(void) read( hc->conn_fd, buf, 2 );
      }
 [2002-02-17 04:23 UTC] norny at yahoo dot com
Ok, I see after picking through CVS that php 4.1.1 patches are for thttpd 2.21b. Perhaps if the php source isn't changed as a result of this bug report, there could be a note in the docs somewhere or a notice during/after ./configure
 [2002-08-20 09:24 UTC] edink@php.net
This is documented in sapi/thttpd/README.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 06 13:01:27 2024 UTC