Bug #15583 Updated: thttpd patching fails

2002-02-17 Thread norny

 ID:   15583
 Updated by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
 Status:   Open
 Bug Type: Other web server
 Operating System: Slackware 8
 PHP Version:  4.1.1
 New Comment:

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


Previous Comments:


[2002-02-17 00:44:25] [EMAIL PROTECTED]

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-15 20:13:52] [EMAIL PROTECTED]

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

Bug #15583 Updated: thttpd patching fails

2002-02-16 Thread norny

 ID:   15583
 Updated by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
 Status:   Open
 Bug Type: Other web server
 Operating System: Slackware 8
 PHP Version:  4.1.1
 New Comment:

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 );
  }


Previous Comments:


[2002-02-15 20:13:52] [EMAIL PROTECTED]

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_