Re: [tin 2.4.0] snapshots - please test

Corinna Vinschen <[email protected]> Tue, 9 Aug 2016 16:10:07 +0200
Newsgroups gmane.network.tin.devel
Message-ID <[email protected]>
--===============2606305394274002635==
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature"; boundary="f6zlout3kkqb36p6"
Content-Disposition: inline


--f6zlout3kkqb36p6
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Urs,

On Aug  9 13:35, Urs Jan=C3=9Fen wrote:
> I've made snapshots of the upcomming 2.4.0 release (planned for
> August 23rd), please give them a try and report (or even fix) any
> issues:
>=20
> <ftp://ftp.tin.org/pub/news/clients/tin/v2.3/snapshots/tin-2.4.0.tar.xz>
> <ftp://ftp.tin.org/pub/news/clients/tin/v2.3/snapshots/tin-2.4.0.tar.bz2>
> <ftp://ftp.tin.org/pub/news/clients/tin/v2.3/snapshots/tin-2.4.0.tar.gz>

I encountered two build problems in the tin configury.

I was trying to build the snapshot on Cygwin and noticed lots of
warnings in terms of the strcasecmp function being undeclared.

To explain why I only noticed now, lately newlib and Cygwin had a major
revamp of the header files to align the feature macro handling closer to
the standards and ultimately to glibc as far as GNU extensions are
concerned.

When building on Cygwin, the tin configury sets -D_XOPEN_SOURCE=3D600.
However, tin.h contains this:

    #ifndef __QNX__
    #       ifdef HAVE_STRING_H
    #               include <string.h>
    #       else
    #               ifdef HAVE_STRINGS_H
    #                       include <strings.h>
    #               endif /* HAVE_STRINGS_H */
    #       endif /* HAVE_STRING_H */
    #else
    #       ifdef HAVE_STRING_H
    #               include <string.h>
    #       endif /* HAVE_STRING_H */
    #       ifdef HAVE_STRINGS_H
    #               include <strings.h>
    #       endif /* HAVE_STRINGS_H */
    #endif /* !__QNX__ */

So on non-__QNX__ systems, prefer to include string.h and only if
that's not available, include strings.h.

AFAICS this is incorrect.  POSIX-1.2008 requires to include strings.h
to get strcasecmp/strncasecmp.

Per the glibc man page the declarations are in string.h only on BSD
systems or in BSD compatiblity mode.  You won't notice this on Linux,
because on Linux the aclocal.m4 function CF_XOPEN_SOURCE will set the
compatibility mode to -D_GNU_SOURCE, rather than -D_XOPEN_SOURCE=3D600.

I think the right thing to do is to change tin.h to always include
string.h and strings.h when they are available, i. e.:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- include/tin.h.ORIG	2016-08-09 15:39:15.828993933 +0200
+++ include/tin.h	2016-08-09 15:39:28.731060140 +0200
@@ -242,22 +242,12 @@ enum rc_state { RC_IGNORE, RC_CHECK, RC_
 /*
  * FIXME: make this autoconf
  */
-#ifndef __QNX__
-#	ifdef HAVE_STRING_H
-#		include <string.h>
-#	else
-#		ifdef HAVE_STRINGS_H
-#			include <strings.h>
-#		endif /* HAVE_STRINGS_H */
-#	endif /* HAVE_STRING_H */
-#else
-#	ifdef HAVE_STRING_H
-#		include <string.h>
-#	endif /* HAVE_STRING_H */
-#	ifdef HAVE_STRINGS_H
-#		include <strings.h>
-#	endif /* HAVE_STRINGS_H */
-#endif /* !__QNX__ */
+#ifdef HAVE_STRING_H
+#	include <string.h>
+#endif /* HAVE_STRING_H */
+#ifdef HAVE_STRINGS_H
+#	include <strings.h>
+#endif /* HAVE_STRINGS_H */
=20
 /*
  * FIXME: make this autoconf
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

The second problem I encountered is a missing declaration of vasprintf.
The reason here is that configure checks for the existence of vasprintf,
but then the tin headers don't define _GNU_SOURCE before using
vasprintf, even though vasprintf is a GNU extension.

I think the right thing to do here is to define _GNU_SOURCE as soon
as HAVE_VASPRINTF is defined.  E. g:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- include/tin.h.ORIG	2016-08-09 15:39:15.828993933 +0200
+++ include/tin.h	2016-08-09 15:52:22.208046323 +0200
@@ -104,6 +104,9 @@ enum icontext { cNone, cGetline, cPrompt
 enum resizer { cNo, cYes, cRedraw };
 enum rc_state { RC_IGNORE, RC_CHECK, RC_UPGRADE, RC_DOWNGRADE, RC_ERROR };
=20
+#ifdef HAVE_VASPRINTF
+#	define _GNU_SOURCE
+#endif
 #include <stdio.h>
 #ifdef HAVE_ERRNO_H
 #	include <errno.h>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

A Cygwin-specific workaround for both problems would be to change
CF_XOPEN_SOURCE to use the same mechanism to set _GNU_SOURCE as on
Linux etc, and to regenerate configure:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- aclocal.m4.ORIG	2016-08-09 15:35:17.983772427 +0200
+++ aclocal.m4	2016-08-09 16:06:06.794538386 +0200
@@ -5599,7 +5599,7 @@ case $host_os in
 (aix[[4-7]]*)
 	cf_xopen_source=3D"-D_ALL_SOURCE"
 	;;
-(cygwin|msys)
+(msys)
 	cf_XOPEN_SOURCE=3D600
 	;;
 (darwin[[0-8]].*)
@@ -5627,7 +5627,7 @@ case $host_os in
 	cf_xopen_source=3D"-D_SGI_SOURCE"
 	cf_XOPEN_SOURCE=3D
 	;;
-(linux*|gnu*|mint*|k*bsd*-gnu)
+(linux*|gnu*|mint*|k*bsd*-gnu|cygwin)
 	CF_GNU_SOURCE
 	;;
 (minix*)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D


Thanks,
Corinna

--=20
Corinna Vinschen
Cygwin Maintainer
Red Hat

--f6zlout3kkqb36p6
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXqeQ/AAoJEPU2Bp2uRE+gy5IP/iJ3zjnqEqw+3UAKQHBd0LXX
Jyp8rVNCLF9lQAvCP8H+0+C6v/T9BNwJcCuI+w5+YCNtbPYIbI/2CxHyeRKv6OC/
YqiK6vegL1Cz5nAB3txBv9Sz8E05f5zgjoxdhANSRTWdL/7pAs5M0b1+i5HyiGiI
BuAtm03Q0yLVIgG6UEy/Ghnhtu6kDQJaVt55pWorouRIIbjLgTSq8N7B6gJRyLKm
VH0rXqdOilol1TSJTvd+yD5miMUmTeEr+zpOJtodW/0mvDsXYN7dOX/t5Bn7tcsS
9cJibkvKNYaFMcrcpXcHc71ndHVCR1qTMCJ0PEYSBXmS5c/5kk0NOciIOfgdnPaW
mmll66WF16TXdnNrr4P3qyPQ3XnnRjsGT+qaXngHA7JPXu+4DSvVye1qLrxlFbfM
NwwNhLk9C1yITLyu+zf2AOH3SYc1RvzRVsoUo0P8cd2am5l7xPZU7EtNh36T0x7F
37LwudEnkgiquwl6qXyj93TRpC35jV8ItqB0irw4Ve09czK1AL1rHDqM+RfK+HRl
MPFNCvJ5A6PfmgbDQe1xbBm+ZEZnQUUruNNnVlQpn36+XdgCKays3E5Br7Ztg99a
G5L/lUV2jnmvDGug8WiMptAHYnSmjGqCg8n4gxI9UU0P6kuZ4t7ZZkzncrIiMWxf
edUpM82ip90ql0CPat4a
=8Gga
-----END PGP SIGNATURE-----

--f6zlout3kkqb36p6--


--===============2606305394274002635==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KdGluLWRldiBt
YWlsaW5nIGxpc3QKdGluLWRldkB0aW4ub3JnCmh0dHA6Ly9saXN0cy50aW4ub3JnL2NnaS1iaW4v
bWFpbG1hbi9saXN0aW5mby90aW4tZGV2Cg==

--===============2606305394274002635==--