[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mingw lseek bug
From: |
Bruno Haible |
Subject: |
Re: mingw lseek bug |
Date: |
Mon, 28 May 2007 15:01:12 +0200 |
User-agent: |
KMail/1.5.4 |
Eric Blake wrote:
> > It should be possible to write a real test.
> > ...
> > I still don't see a proof that lseek is incorrect on mingw.
>
> I tested by writing test-lseek.c first, and using
>
> echo hi | test-lseek && echo failed
>
> then repeating that test with the benefit of the lseek module, and seeing
> the difference in output on mingw. If test-lseek succeeds when stdin is a
> pipe, then it is an indication of a bug in lseek.
> ...
> How? Mingw doesn't provide pipe(), socket() is a bear to get right in a
> configure test, and I don't know how to coerce autoconf into guaranteeing
> that conftest's stdin is either a file or a pipe.
Thanks for the explanations. I added this test. The trick is to realize
that inside AC_LINK_IFELSE, you can use the compiled conftest program. And
even if that was not possible you could use this idiom:
cat > conftest.$ac_ext <<EOF
...
EOF
AC_TRY_EVAL([ac_link])
if test -s conftest$ac_exeext; then
... ./conftest$ac_exeext ...
else
failed
fi
2007-05-28 Bruno Haible <address@hidden>
* m4/lseek.m4 (gl_FUNC_LSEEK): When not cross-compiling, perform a real
runtime test.
*** m4/lseek.m4 24 May 2007 16:59:21 -0000 1.1
--- m4/lseek.m4 28 May 2007 12:33:02 -0000
***************
*** 1,4 ****
! # lseek.m4 serial 1
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # lseek.m4 serial 2
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
***************
*** 9,20 ****
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe],
! [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>],
! [#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* mingw mistakenly returns 0 when trying to seek on pipes. */
Choke me.
! #endif])],
! [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])])
if test $gl_cv_func_lseek_pipe = no; then
gl_REPLACE_LSEEK
fi
--- 9,40 ----
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe],
! [if test $cross_compiling = no; then
! AC_LINK_IFELSE([
! #include <sys/types.h> /* for off_t */
! #include <stdio.h> /* for SEEK_CUR */
! #include <unistd.h>
! int main ()
! {
! /* Exit with success only if stdin is seekable. */
! return lseek (0, (off_t)0, SEEK_CUR) < 0;
! }],
! [if test -s conftest$ac_exeext \
! && ./conftest$ac_exeext < conftest.$ac_ext \
! && { echo hi | ./conftest$ac_exeext; test $? = 1; }; then
! gl_cv_func_lseek_pipe=yes
! else
! gl_cv_func_lseek_pipe=no
! fi],
! [gl_cv_func_lseek_pipe=no])
! else
! AC_LINK_IFELSE([
! #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* mingw mistakenly returns 0 when trying to seek on pipes. */
Choke me.
! #endif],
! [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
! fi])
if test $gl_cv_func_lseek_pipe = no; then
gl_REPLACE_LSEEK
fi
- mingw lseek bug, Eric Blake, 2007/05/24
- Re: mingw lseek bug, Brian Dessent, 2007/05/24
- Re: mingw lseek bug, Bruno Haible, 2007/05/24
- Re: mingw lseek bug, Eric Blake, 2007/05/24
- Re: mingw lseek bug, Eric Blake, 2007/05/24
- Re: mingw lseek bug, Bruno Haible, 2007/05/24
- Re: mingw lseek bug, Eric Blake, 2007/05/24
- Re: mingw lseek bug,
Bruno Haible <=
- Re: mingw lseek bug, Eric Blake, 2007/05/28
- Re: mingw lseek bug, Bruno Haible, 2007/05/28
- Re: mingw lseek bug, Bruno Haible, 2007/05/28
- Re: mingw lseek bug, Eric Blake, 2007/05/28
- Re: mingw lseek bug, Bruno Haible, 2007/05/28
- Re: mingw lseek bug, Eric Blake, 2007/05/28
- Re: mingw lseek bug, Bruno Haible, 2007/05/28
- Re: mingw lseek bug, Bruno Haible, 2007/05/28
- new module 'fseek' (Re: mingw lseek bug), Bruno Haible, 2007/05/28
- new module 'ftell' (was: Re: mingw lseek bug), Bruno Haible, 2007/05/28