After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 324943 - MinGW non-blocking socket communication fails
MinGW non-blocking socket communication fails
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other Windows
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-12-24 16:27 UTC by Mark Junker
Modified: 2006-01-04 09:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix for this bug (611 bytes, patch)
2005-12-24 16:30 UTC, Mark Junker
needs-work Details | Review
Second version of the patch fixing this problem. (640 bytes, patch)
2005-12-27 10:41 UTC, Mark Junker
none Details | Review

Description Mark Junker 2005-12-24 16:27:41 UTC
Please describe the problem:
The non-blocking socket communication using nanohttp doesn't work for the MinGW
platform because EWOULDBLOCK gets redefined to EAGAIN by errno.h if included
after wsockcompat.h. But it must be defined to WSAEWOULDBLOCK to ensure that the
connection doesn't fail.

Steps to reproduce:
1. xmlNanoHTTPOpen fails - regardless of the requested page


Actual results:
The returned handle is NULL.

Expected results:
The connection should be established.

Does this happen every time?
Yes

Other information:
I'll add a patch later.
Comment 1 Mark Junker 2005-12-24 16:30:30 UTC
Created attachment 56362 [details] [review]
Fix for this bug

The patch is quite simple. It ensures that <errno.h> gets included in wsockcompat.h and - to avoid warnings - undefines EWOULDBLOCK before the redefinition with WSAEWOULDBLOCK.

This has two effects:
1. <errno.h> doesn't get included later by other header files
2. The redefinition doesn't cause a warning

Tested with MinGW 5.0
Comment 2 Daniel Veillard 2005-12-24 17:54:51 UTC
Tested on MinGW 5.0, but on nothing else I assume.
Please provide patches making the fix *only* on MinGW and not perturbing
compilation with other compilers, as-is this doesn't look acceptable
because it forces to do the #include and redefine a core macro for all compilers.
I don't want thousands of failure reports from people using the usual compiler.

Daniel
Comment 3 Mark Junker 2005-12-27 10:36:21 UTC
Comment on attachment 56362 [details] [review]
Fix for this bug

Index: include/wsockcompat.h
===================================================================
RCS file: /cvs/gnome/libxml2/include/wsockcompat.h,v
retrieving revision 1.2
diff -u -r1.2 wsockcompat.h
--- include/wsockcompat.h	13 Oct 2005 23:12:42 -0000	1.2
+++ include/wsockcompat.h	27 Dec 2005 10:33:06 -0000
@@ -17,6 +17,13 @@
 #endif
 #endif
 
+#ifdef __MINGW32__
+/* Include <errno.h> here to ensure that it doesn't get included later
+ * (e.g. by iconv.h) and overwrites the definition of EWOULDBLOCK. */
+#include <errno.h>
+#undef EWOULDBLOCK
+#endif
+
 #if !defined SOCKLEN_T
 #define SOCKLEN_T int
 #endif
Comment 4 Mark Junker 2005-12-27 10:39:33 UTC
Comment on attachment 56362 [details] [review]
Fix for this bug

Don't use this patch. I'll attach a new version. BTW: How can I delete/modify this attachement?
Comment 5 Mark Junker 2005-12-27 10:41:41 UTC
Created attachment 56430 [details] [review]
Second version of the patch fixing this problem.

This patch is almost the same as the previous one but it'll only affect the MinGW platform (and not all Win32 ones).
Comment 6 Daniel Veillard 2006-01-04 09:52:41 UTC
Looks good, applied, will commit soon !

  thanks !

Daniel