bug-gnulib
[Top][All Lists]
Advanced

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

open MinGW failure


From: Simon Josefsson
Subject: open MinGW failure
Date: Fri, 08 Jan 2010 10:47:13 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux)

I got this when cross-compiling to MinGW with Wine:

test-open.h:34: assertion failed
FAIL: test-open.exe

The relevant code is:

  /* Cannot create directory.  */
  errno = 0;
  ASSERT (func ("nonexist.ent/", O_CREAT | O_RDONLY, 0600) == -1);

Open returns 3 for me, and it has created a file 'nonexist.ent'.

I see there is some code for this in lib/open.c, however it is not used
because:

/* Define to 1 if open() fails to recognize a trailing slash. */
/* #undef OPEN_TRAILING_SLASH_BUG */

Defining it makes the self-test work, which argues there is a bug in the
open.m4 detection code, indeed it is not run at all for MinGW:

  case "$host_os" in
    mingw* | pw*)
      gl_REPLACE_OPEN
      ;;
    *)

A simple fix to the problem is attached.

I wonder if the code is correct for the 'pw*' system though, it will not
trigger the trailing slash test on it.  I don't know what pw* is, and
can't test it, so I'll leave that to others.

Thoughts?

/Simon

diff --git a/m4/open.m4 b/m4/open.m4
index d705b3a..823d548 100644
--- a/m4/open.m4
+++ b/m4/open.m4
@@ -8,7 +8,7 @@ AC_DEFUN([gl_FUNC_OPEN],
 [
   AC_REQUIRE([AC_CANONICAL_HOST])
   case "$host_os" in
-    mingw* | pw*)
+    pw*)
       gl_REPLACE_OPEN
       ;;
     *)
@@ -40,6 +40,7 @@ changequote(,)dnl
                freebsd*)        gl_cv_func_open_slash="guessing no" ;;
                solaris2.[0-9]*) gl_cv_func_open_slash="guessing no" ;;
                hpux*)           gl_cv_func_open_slash="guessing no" ;;
+               mingw*)          gl_cv_func_open_slash="guessing no" ;;
                *)               gl_cv_func_open_slash="guessing yes" ;;
              esac
 changequote([,])dnl




reply via email to

[Prev in Thread] Current Thread [Next in Thread]