Quantcast

autoconf: AC_SYS_LARGEFILE documentation misleading

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

autoconf: AC_SYS_LARGEFILE documentation misleading

Thorsten Glaser-2
found 158969 2.69-10
thanks

Hi *,

I have to reopen this because the documentation is plain wrong
and misleading still:

 -- Macro: AC_SYS_LARGEFILE
     Arrange for 64-bit file offsets, known as large-file support
     (http://www.unix-systems.org/version2/whatsnew/lfs20mar.html).  On
     some hosts, one must use special compiler options to build programs
     that can access large files.  Append any such options to the output
     variable 'CC'.  Define '_FILE_OFFSET_BITS' and '_LARGE_FILES' if
     necessary.

ii  autoconf              2.69-10         all             automatic configure script builder
ii  autoconf-doc          2.69-10         all             automatic configure script builder documentatio

Looking at the source, AC_SYS_LARGEFILE calls AC_DEFINE_UNQUOTED,
which appends to DEFS (which I agree with Tom Dickey is wrong) as
Florian Weimer said, but — even more confusingly — only when
AC_CONFIG_HEADERS is not used.

If AC_CONFIG_HEADERS is used, the definition is only written to
its output file (config.h by default).

This is even more unfortunate, because now, if any program includes
a glibc system header before "config.h", the definition will be
ignored, because it comes too late.

CPPFLAGS is r̲e̲a̲l̲l̲y̲ the correct place for this. Again.

But that’s a different bug. This issue is about the documentation
being wrong — please fix the documentation and raise this bug upstream
(and this time, don’t let them tell you it’s not a bug because it most
curtainly is).

Thanks,
//mirabilos (current hat: Debian Developer)
--
tarent solutions GmbH
Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/
Tel: +49 228 54881-393 • Fax: +49 228 54881-235
HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: autoconf: AC_SYS_LARGEFILE documentation misleading

Eric Blake-3
On 01/25/2017 10:45 AM, Thorsten Glaser wrote:
>
> This is even more unfortunate, because now, if any program includes
> a glibc system header before "config.h", the definition will be
> ignored, because it comes too late.

This is wrong. The manual clearly states that config.h MUST be included
prior to any system headers, precisely because config.h can influence
what system headers do.  In fact, gnulib offers a 'make syntax-check'
that, among other things, enforces that a project ALWAYS includes
config.h first.

> But that’s a different bug. This issue is about the documentation
> being wrong — please fix the documentation and raise this bug upstream
> (and this time, don’t let them tell you it’s not a bug because it most
> curtainly is).

Please propose a patch to the documentation, rather than just telling me
that it is wrong, so that we have a concrete proposal for a wording
improvement that we can discuss.

--
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf

signature.asc (617 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: autoconf: AC_SYS_LARGEFILE documentation misleading

Thorsten Glaser-2
On Wed, 25 Jan 2017, Eric Blake wrote:

> Please propose a patch to the documentation, rather than just telling me
> that it is wrong, so that we have a concrete proposal for a wording
> improvement that we can discuss.

Oh okay, I’ll cater for lazy upstreams this time ;-)
See the attached git format-patch.

bye
//mirabilos
--
tarent solutions GmbH
Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/
Tel: +49 228 54881-393 • Fax: +49 228 54881-235
HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg
_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf

0001-doc-Fix-incorrect-AC_SYS_LARGEFILE-documentation.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: autoconf: AC_SYS_LARGEFILE documentation misleading

Eric Blake-3
On 01/25/2017 11:30 AM, Thorsten Glaser wrote:
> On Wed, 25 Jan 2017, Eric Blake wrote:
>
>> Please propose a patch to the documentation, rather than just telling me
>> that it is wrong, so that we have a concrete proposal for a wording
>> improvement that we can discuss.
> Oh okay, I’ll cater for lazy upstreams this time ;-)

It's not necessarily laziness :)

> See the attached git format-patch.
>

Thanks; that's helpful.  I'm still thinking we may want to iterate on
the wording, in particular:

> +++ b/doc/autoconf.texi
> @@ -8584,8 +8584,8 @@ if the system supports @samp{#!}, @samp{no} if not.
>  Arrange for 64-bit file offsets, known as
>  @uref{http://@/www.unix-systems@/.org/@/version2/@/whatsnew/@/lfs20mar.html,
>  large-file support}.  On some hosts, one must use special compiler
> -options to build programs that can access large files.  Append any such
> -options to the output variable @code{CC}.  Define

You're deleting all mention that the macro may modify CC (true, it
doesn't do it on most platforms, but the code is still there that does
it for Irix); I don't think we want the change to be that drastic.

> +options to build programs that can access large files.  Define,
> +by calling @code{AC_DEFINE_UNQUOTED},
>  @code{_FILE_OFFSET_BITS} and @code{_LARGE_FILES} if necessary.

I also think we can try harder to point out the need for config.h to
appear first.  How about the following counter-proposal:

diff --git i/doc/autoconf.texi w/doc/autoconf.texi
index 55f96a3..2901937 100644
--- i/doc/autoconf.texi
+++ w/doc/autoconf.texi
@@ -8584,9 +8584,10 @@ System Services
 Arrange for 64-bit file offsets, known as
 @uref{http://@/www.unix-systems@/.org/@/version2/@/whatsnew/@/lfs20mar.html,
 large-file support}.  On some hosts, one must use special compiler
-options to build programs that can access large files.  Define,
-by calling @code{AC_DEFINE_UNQUOTED},
-@code{_FILE_OFFSET_BITS} and @code{_LARGE_FILES} if necessary.
+options to build programs that can access large files, and this macro
+modifies the output variable @code{CC} in that case.  This macro will
+additionally define @code{_FILE_OFFSET_BITS} and @code{_LARGE_FILES} if
+necessary, by calling @code{AC_DEFINE_UNQUOTED}.

 Large-file support can be disabled by configuring with the
 @option{--disable-largefile} option.
@@ -8595,7 +8596,9 @@ System Services
 @code{off_t} is wider than @code{long int}, since this is common when
 large-file support is enabled.  For example, it is not correct to print
 an arbitrary @code{off_t} value @code{X} with @code{printf ("%ld",
-(long int) X)}.
+(long int) X)}.  Also, when using this macro in concert with
+@code{AC_CONFIG_HEADERS}, be sure that @file{config.h} is included
+before any system header.

 The LFS introduced the @code{fseeko} and @code{ftello} functions to
 replace their C counterparts @code{fseek} and @code{ftell} that do not


--
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf

signature.asc (617 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: autoconf: AC_SYS_LARGEFILE documentation misleading

Zack Weinberg-2
On Wed, Jan 25, 2017 at 2:06 PM, Eric Blake <[hidden email]> wrote:
>
> I also think we can try harder to point out the need for config.h to
> appear first.  How about the following counter-proposal:
...

If we're going to warn people about this in the context of specific
macros we should do the same for AC_USE_SYSTEM_EXTENSIONS as well.  I
don't *think* there are any other stock macros that put
feature-selection #defines into config.h but I could have missed
something.

zw

_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: autoconf: AC_SYS_LARGEFILE documentation misleading

Thorsten Glaser-2
In reply to this post by Eric Blake-3
On Wed, 25 Jan 2017, Eric Blake wrote:

> Thanks; that's helpful.  I'm still thinking we may want to iterate on

Yes, of course; you know autoconf much better than I do.

> You're deleting all mention that the macro may modify CC (true, it
> doesn't do it on most platforms, but the code is still there that does
> it for Irix)

Ah, okay. Let’s change that then.

> I also think we can try harder to point out the need for config.h to
> appear first.  How about the following counter-proposal:
>
> diff --git i/doc/autoconf.texi w/doc/autoconf.texi
> index 55f96a3..2901937 100644
> --- i/doc/autoconf.texi
> +++ w/doc/autoconf.texi
> @@ -8584,9 +8584,10 @@ System Services
>  Arrange for 64-bit file offsets, known as
>  @uref{http://@/www.unix-systems@/.org/@/version2/@/whatsnew/@/lfs20mar.html,
>  large-file support}.  On some hosts, one must use special compiler
> -options to build programs that can access large files.  Define,
> -by calling @code{AC_DEFINE_UNQUOTED},
> -@code{_FILE_OFFSET_BITS} and @code{_LARGE_FILES} if necessary.
> +options to build programs that can access large files, and this macro
> +modifies the output variable @code{CC} in that case.  This macro will
> +additionally define @code{_FILE_OFFSET_BITS} and @code{_LARGE_FILES} if
> +necessary, by calling @code{AC_DEFINE_UNQUOTED}.

Nice, but I think I can improve on that a bit (later, I’m almost
dropping down due to tiredness), it still confuses me a bit ;)

>  Large-file support can be disabled by configuring with the
>  @option{--disable-largefile} option.
> @@ -8595,7 +8596,9 @@ System Services
>  @code{off_t} is wider than @code{long int}, since this is common when
>  large-file support is enabled.  For example, it is not correct to print
>  an arbitrary @code{off_t} value @code{X} with @code{printf ("%ld",
> -(long int) X)}.
> +(long int) X)}.  Also, when using this macro in concert with
> +@code{AC_CONFIG_HEADERS}, be sure that @file{config.h} is included
> +before any system header.

Making that explicit is good, yes. Thank you.


On Wed, 25 Jan 2017, Zack Weinberg wrote:

> If we're going to warn people about this in the context of specific
> macros we should do the same for AC_USE_SYSTEM_EXTENSIONS as well.  I

Feel free to… but that’s outside of my scope; I never heard of that
particular macro ;)

bye,
//mirabilos
--
tarent solutions GmbH
Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/
Tel: +49 228 54881-393 • Fax: +49 228 54881-235
HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: autoconf: AC_SYS_LARGEFILE documentation misleading

Thorsten Glaser-2
Dixi quod…

> On Wed, 25 Jan 2017, Eric Blake wrote:
>
> > I also think we can try harder to point out the need for config.h to
> > appear first.  How about the following counter-proposal:
[…]
> Nice, but I think I can improve on that a bit (later, I’m almost
> dropping down due to tiredness), it still confuses me a bit ;)

What do you think about this? I tried several variants and ended
up making it a bullet point list, and I think the result is quite
less ambiguous (especially if one is not a native English speaker)
than the original text.

I’ve also changed “be sure” to an imperative “ensure” in the
usage notes.

bye,
//mirabilos
--
>> Why don't you use JavaScript? I also don't like enabling JavaScript in
> Because I use lynx as browser.
+1
        -- Octavio Alvarez, me and ⡍⠁⠗⠊⠕ (Mario Lang) on debian-devel

_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: autoconf: AC_SYS_LARGEFILE documentation misleading

Thorsten Glaser-2
Dixi quod…

> What do you think about this? I tried several variants and ended

Arrgh, forgot the attachment, sorry.

bye,
//mirabilos
--
15:41⎜<Lo-lan-do:#fusionforge> Somebody write a testsuite for helloworld :-)
_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf

0001-doc-Fix-incorrect-AC_SYS_LARGEFILE-documentation.patch (3K) Download Attachment
Loading...