bug-gnulib
[Top][All Lists]
Advanced

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

Re: open MinGW failure


From: Bruno Haible
Subject: Re: open MinGW failure
Date: Sat, 9 Jan 2010 12:33:40 +0100
User-agent: KMail/1.9.9

Hi Simon,

Simon Josefsson wrote:
> I got this when cross-compiling to MinGW with Wine:
> 
> test-open.h:34: assertion failed
> FAIL: test-open.exe

Whereas on a real Windows XP SP3, I get:

  skipping test: symlinks not supported on this file system
  SKIP: test-open.exe

(which is a bit misleading: only part of the test was skipped).

> 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'.

This must be a bug in Wine, then. Please report it. This test program

===============================================================
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
int main ()
{
  int ret = open ("nonexist.ent/", O_CREAT | O_RDONLY, 0600);
  printf ("ret=%d errno=%d\n", ret, errno);
  return 0;
}
===============================================================

when run on Windows (via Cygwin 1.5.x), yields:

$ gcc -mno-cygwin foo.c
$ ./a.exe 
ret=-1 errno=22

> 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.

Hmm, you and Paolo explained to me on 2009-08-21 that Wine should be
considered as a platform of its own. But I still don't fully agree. Can
you first report the bug to the Wine people and come back to patching
gnulib only if they are not fixing it within two months?

> 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.

'pw32' is Paul Sokolovsky's "POSIX over Win32" package [1], which was
developed in 2000-2001 and appears to be abandoned now [2].

Bruno

[1] http://pw32.sourceforge.net/manual/main.html
[2] http://gcc.gnu.org/ml/gcc-patches/2008-06/msg00120.html




reply via email to

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