Re: HP/UX 11 test_socket failure

Anders Qvist <[email protected]> Sun, 20 Oct 2002 11:11:22 +0200
Newsgroups gmane.comp.python.snake-farm.user
Message-ID <[email protected]>
On Sun, Oct 20, 2002 at 09:56:53AM +0200, Anders Qvist wrote:
> On Sat, Oct 19, 2002 at 07:08:35AM -0400, Guido van Rossum wrote:
> > > I'll patch and try this tomorrow, unless someone else does it before
> > > me.
> > 
> > Good sleuthing!  I didn't know there were platforms where O_NDELAY and
> > O_NONBLOCK differed. :-(  On Linux, they're two names for the same flag.
> 
> The diff would be thus:
> 
> ----8<--------------------------------------------------------------------
> Index: socketmodule.c
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
> retrieving revision 1.244
> diff -u -r1.244 socketmodule.c
> --- socketmodule.c	3 Sep 2002 19:10:18 -0000	1.244
> +++ socketmodule.c	20 Oct 2002 07:45:53 -0000
> @@ -480,9 +480,17 @@
>  #else /* !PYOS_OS2 */
>  	delay_flag = fcntl(s->sock_fd, F_GETFL, 0);
>  	if (block)
> +#if definded(__hpux)
            ^
> ----8<--------------------------------------------------------------------

Whoops. Wrong patch attached. Try this one without spelling errors for
better result:

----8<--------------------------------------------------------------------
Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.244
diff -u -r1.244 socketmodule.c
--- socketmodule.c	3 Sep 2002 19:10:18 -0000	1.244
+++ socketmodule.c	20 Oct 2002 07:45:53 -0000
@@ -480,9 +480,17 @@
 #else /* !PYOS_OS2 */
 	delay_flag = fcntl(s->sock_fd, F_GETFL, 0);
 	if (block)
+#if defined(__hpux)
+		delay_flag &= (~O_NONBLOCK);
+#else
 		delay_flag &= (~O_NDELAY);
+#endif
 	else
+#if defined(__hpux)
+		delay_flag |= O_NONBLOCK;
+#else
 		delay_flag |= O_NDELAY;
+#endif
 	fcntl(s->sock_fd, F_SETFL, delay_flag);
 #endif /* !PYOS_OS2 */
 #else /* MS_WINDOWS */
----8<--------------------------------------------------------------------
-- 
Anders "Quest" Qvist

"We've all heard that a million monkeys banging on a million typewriters
will eventually reproduce the entire works of Shakespeare. Now, thanks 
to the Internet, we know this is not true." -- Robert Wilensky