This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Broken autoconf mmap test (was Re: 1.7] BUG - GREP slows to a crawl with large number of matches on a single file)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Corinna Vinschen on 11/9/2009 4:59 AM:
>>> I just found that the latest autoconf *still* has this broken test
>>> for mmap, which basically calls
>>>
>>>   data2 = malloc (size);
>>>   mmap(data2, ...);
>>>
>>> Why has this test never been fixed?  Chuck?
>> ...err, 'cause I didn't realize it was a problem. I see that cygport has
>> hidden this for years:
>>
>>     # AC_HAVE_MMAP fails despite a working mmap, so we force this to yes
>>     # (see http://www.cygwin.com/ml/cygwin/2004-09/msg00741.html
>>     # and following thread for details)
>>     export ac_cv_func_mmap_fixed_mapped=yes;
>>
>> NTTAWWT, but it never triggered my "gee I ought to fix that" reflex. I
>> agree this should be fixed, but I'm leery of changing an autoconf test
>> without knowing how that change will affect the other 9,236 platforms
> 
> The problem in this testcase is the fact that it calls malloc, then
> computes the next page-aligned free address after the mallocated area
> and then tries to mmap to this address with MAP_FIXED set.  Sure, this
> *might* work, and it works on most systems, but there's no reason at all
> to *expect* that it works since it only works by chance.  The memory
> addresses can be taken by anything and to require that an arbitrary
> fixed address is available to mmap is just plain wrong.  From the
> Linux man page:
> 
> MAP_FIXED
>   [...]
>   If the specified address cannot be used, mmap() will fail.  Because
>   requiring a fixed address for a mapping is less portable, the use of
>   this option is discouraged.
> 
> Since autoconf is supposed to help applications to be more portable,
> it's not really feasible, IMHO, that autoconf requires a non-portable
> feature to work.
> 
> It's frustrating that mmap() and even mmap(MAP_FIXED)
> works fine on Cygwin, just not in the non-portable way it's tested
> in the autoconf test.  Maybe we need two mmap tests in autconf, one
> for mmap in general, the other for MAP_FIXED iisues.
> 
>> I think this is an issue for the autoconf list as a whole.  Would you --
>> or Eric -- care to raise it there?  Especially as you seemed to have
>> quite strong feelings about it back in 2004:
>> http://www.cygwin.com/ml/cygwin/2004-09/msg00753.html
> 
> I had hoped that you, as the autoconf maintainer, would put this
> upstream...

It's an upstream issue now ;)

The problem is that I need some more advice from the cygwin list on how
best to fix the test to pass on cygwin by default.  I'm hoping to release
autoconf 2.65 this week, so a speedy fix to help this issue go away before
the release would be extra nice.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkr4D/sACgkQ84KuGfSFAYCOjwCghVcvxtUrAPxqB7w+/6gaT+Y/
H0EAoIUsDfqQ42NzKa8olQtBdhkvVS1f
=36fe
-----END PGP SIGNATURE-----

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]