Re: [xml] 2.6.22 xmlIO test hanging on AIX



On Thu, Oct 27, 2005 at 09:00:50AM -0500, Albert Chin wrote:
On Thu, Oct 27, 2005 at 09:55:46AM -0400, Daniel Veillard wrote:
On Thu, Oct 27, 2005 at 07:51:34AM -0500, Albert Chin wrote:
On Thu, Oct 27, 2005 at 06:07:33AM -0400, Daniel Veillard wrote:
Once I run the xmlIO test manually, the terminal window hangs after
the above command and the process exits. I don't see this behavior on
Solaris, Tru64 UNIX, IRIX, HP-UX, or Redhat Linux.

Any ideas?

  What fd number was used to build the buffer ?

n_fd: 0
fd: 0

  So apparently AIX dislikes when a child process might close its stdin
descriptor ... maybe a #ifndef AIX is in order and pass -1 instead in that
case...

I changed the for loop so n_fd started with 1 and encountered the same
hang. I'll try to look into it some more.

The following sample problem, when run on AIX, duplicates the hang:
  #include <stdio.h>
  #include <unistd.h>

  void
  main (void) {
    char *buffer;

    write (0, buffer, 0);
  }

The patch below to xmlIO.c works around this AIX oddity.

-- 
albert chin (china thewrittenword com)

-- snip snip
Index: xmlIO.c
===================================================================
--- xmlIO.c.orig        2005-08-05 08:53:39.000000000 -0500
+++ xmlIO.c     2005-10-28 00:45:10.779923000 -0500
@@ -610,10 +610,12 @@
  */
 static int
 xmlFdWrite (void * context, const char * buffer, int len) {
-    int ret;
+    int ret = 0;
 
-    ret = write((int) (long) context, &buffer[0], len);
-    if (ret < 0) xmlIOErr(0, "write()");
+    if (len > 0) {
+       ret = write((int) (long) context, &buffer[0], len);
+       if (ret < 0) xmlIOErr(0, "write()");
+    }
     return(ret);
 }
 #endif /* LIBXML_OUTPUT_ENABLED */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]