On 3/22/2011 4:59 PM, Eric Blake wrote:
On 03/20/2011 02:51 PM, Ken Brown wrote:
What's the status of the broken autoconf mmap test, which always fails
on Cygwin even though Cygwin has a working mmap?
Autoconf 2.65 and newer do not have the bug. But packages still exist
where configure was generated with< 2.65, so these packages still have
the bug unless you either rerun newer autoconf, or pre-seed the cache.
Was this ever resolved? I see that cygport is still using the workaround
export ac_cv_func_mmap_fixed_mapped=yes
This workaround is still necessary, as long as there are still packages
that don't run autoreconf and where configure was generated with a
too-old autoconf.
I'm still seeing failures when building both emacs and texlive, even
after autoreconf with the current (2.68) version installed. Attached is
the relevant portion of config.log from an emacs build. This is a build
of the current emacs trunk, after running 'autoreconf -I m4'. The same
thing happens if I build emacs-23.3. If you want to try to reproduce
it, here's the source:
wget http://ftp.gnu.org/pub/gnu/emacs/emacs-23.3.tar.gz
In case it's relevant, my system is 64-bit Windows 7, with the most
recent cygwin snapshot:
$ uname -a
CYGWIN_NT-6.1-WOW64 moufang 1.7.9s(0.236/5/3) 20110318 10:29:21 i686 Cygwin
Ken
configure:9314: checking for working mmap
configure:9461: gcc -o conftest.exe -g -O2 conftest.c >&5
configure:9461: $? = 0
configure:9461: ./conftest.exe
./configure: line 2146: 6404 Segmentation fault (core dumped)
./conftest$ac_exeext
configure:9461: $? = 139
configure: program exited with status 139
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "emacs"
| #define PACKAGE_TARNAME "emacs"
| #define PACKAGE_VERSION "24.0.50"
| #define PACKAGE_STRING "emacs 24.0.50"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "emacs"
| #define VERSION "24.0.50"
| #define MAIL_USE_POP 1
| #define SYNC_INPUT 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define HAVE_SYS_SOUNDCARD_H 1
| #define HAVE_SYS_SELECT_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_UTIME_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_PTY_H 1
| #define HAVE_SYS_MMAN_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_LOCALE_H 1
| #define HAVE_SYS_UTSNAME_H 1
| #define HAVE_PWD_H 1
| #define HAVE_UTMP_H 1
| #define HAVE_DIRENT_H 1
| #define STDC_HEADERS 1
| #define TIME_WITH_SYS_TIME 1
| #define HAVE_DECL_SYS_SIGLIST 0
| #define HAVE_DECL___SYS_SIGLIST 0
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_STRUCT_UTIMBUF 1
| #define RETSIGTYPE void
| #define HAVE_SPEED_T 1
| #define HAVE_TIMEVAL 1
| #define HAVE_SYS_SOCKET_H 1
| #define HAVE_NET_IF_H 1
| #define HAVE_DECL_TZNAME 1
| #define HAVE_TZNAME 1
| #define HAVE_STRUCT_IFREQ_IFR_FLAGS 1
| #define HAVE_STRUCT_IFREQ_IFR_HWADDR 1
| #define HAVE_STRUCT_IFREQ_IFR_NETMASK 1
| #define HAVE_STRUCT_IFREQ_IFR_BROADADDR 1
| #define HAVE_STRUCT_IFREQ_IFR_ADDR 1
| #define PROTOTYPES 1
| #define __PROTOTYPES 1
| #define POINTER_TYPE void
| #define HAVE_ATTRIBUTE_ALIGNED 1
| #define HAVE_LONG_FILE_NAMES 1
| #define HAVE_STDLIB_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_GETOPT_H 1
| #define HAVE_WCHAR_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_GETPAGESIZE 1
| /* end confdefs.h. */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| # include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| # include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| /* malloc might have been renamed as rpl_malloc. */
| #undef malloc
|
| /* Thanks to Mike Haertel and Jim Avera for this test.
| Here is a matrix of mmap possibilities:
| mmap private not fixed
| mmap private fixed at somewhere currently unmapped
| mmap private fixed at somewhere already mapped
| mmap shared not fixed
| mmap shared fixed at somewhere currently unmapped
| mmap shared fixed at somewhere already mapped
| For private mappings, we should verify that changes cannot be read()
| back from the file, nor mmap's back from the file at a different
| address. (There have been systems where private was not correctly
| implemented like the infamous i386 svr4.0, and systems where the
| VM page cache was not coherent with the file system buffer cache
| like early versions of FreeBSD and possibly contemporary NetBSD.)
| For shared mappings, we should conversely verify that changes get
| propagated back to all the places they're supposed to be.
|
| Grep wants private fixed already mapped.
| The main things grep needs to know about mmap are:
| * does it exist and is it safe to write into the mmap'd area
| * how to use it (BSD variants) */
|
| #include <fcntl.h>
| #include <sys/mman.h>
|
| #if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
| char *malloc ();
| #endif
|
| /* This mess was copied from the GNU getpagesize.h. */
| #ifndef HAVE_GETPAGESIZE
| # ifdef _SC_PAGESIZE
| # define getpagesize() sysconf(_SC_PAGESIZE)
| # else /* no _SC_PAGESIZE */
| # ifdef HAVE_SYS_PARAM_H
| # include <sys/param.h>
| # ifdef EXEC_PAGESIZE
| # define getpagesize() EXEC_PAGESIZE
| # else /* no EXEC_PAGESIZE */
| # ifdef NBPG
| # define getpagesize() NBPG * CLSIZE
| # ifndef CLSIZE
| # define CLSIZE 1
| # endif /* no CLSIZE */
| # else /* no NBPG */
| # ifdef NBPC
| # define getpagesize() NBPC
| # else /* no NBPC */
| # ifdef PAGESIZE
| # define getpagesize() PAGESIZE
| # endif /* PAGESIZE */
| # endif /* no NBPC */
| # endif /* no NBPG */
| # endif /* no EXEC_PAGESIZE */
| # else /* no HAVE_SYS_PARAM_H */
| # define getpagesize() 8192 /* punt totally */
| # endif /* no HAVE_SYS_PARAM_H */
| # endif /* no _SC_PAGESIZE */
|
| #endif /* no HAVE_GETPAGESIZE */
|
| int
| main ()
| {
| char *data, *data2, *data3;
| const char *cdata2;
| int i, pagesize;
| int fd, fd2;
|
| pagesize = getpagesize ();
|
| /* First, make a file with some known garbage in it. */
| data = (char *) malloc (pagesize);
| if (!data)
| return 1;
| for (i = 0; i < pagesize; ++i)
| *(data + i) = rand ();
| umask (0);
| fd = creat ("conftest.mmap", 0600);
| if (fd < 0)
| return 2;
| if (write (fd, data, pagesize) != pagesize)
| return 3;
| close (fd);
|
| /* Next, check that the tail of a page is zero-filled. File must have
| non-zero length, otherwise we risk SIGBUS for entire page. */
| fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600);
| if (fd2 < 0)
| return 4;
| cdata2 = "";
| if (write (fd2, cdata2, 1) != 1)
| return 5;
| data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED,
fd2, 0L);
| if (data2 == MAP_FAILED)
| return 6;
| for (i = 0; i < pagesize; ++i)
| if (*(data2 + i))
| return 7;
| close (fd2);
| if (munmap (data2, pagesize))
| return 8;
|
| /* Next, try to mmap the file at a fixed address which already has
| something else allocated at it. If we can, also make sure that
| we see the same garbage. */
| fd = open ("conftest.mmap", O_RDWR);
| if (fd < 0)
| return 9;
| if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
| MAP_PRIVATE | MAP_FIXED, fd, 0L))
| return 10;
| for (i = 0; i < pagesize; ++i)
| if (*(data + i) != *(data2 + i))
| return 11;
|
| /* Finally, make sure that changes to the mapped area do not
| percolate back to the file as seen by read(). (This is a bug on
| some variants of i386 svr4.0.) */
| for (i = 0; i < pagesize; ++i)
| *(data2 + i) = *(data2 + i) + 1;
| data3 = (char *) malloc (pagesize);
| if (!data3)
| return 12;
| if (read (fd, data3, pagesize) != pagesize)
| return 13;
| for (i = 0; i < pagesize; ++i)
| if (*(data + i) != *(data3 + i))
| return 14;
| close (fd);
| return 0;
| }
configure:9471: result: no
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple