[tin-dev] [tin 2.4.0] snapshots - please test

Corinna Vinschen vinschen at redhat.com
Tue Aug 9 16:10:07 CEST 2016


Hi Urs,

On Aug  9 13:35, Urs Jan├čen 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:
> 
> <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=600.
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=600.

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

====================================================================
--- 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 */
 
 /*
  * FIXME: make this autoconf
====================================================================

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:

====================================================================
--- 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 };
 
+#ifdef HAVE_VASPRINTF
+#	define _GNU_SOURCE
+#endif
 #include <stdio.h>
 #ifdef HAVE_ERRNO_H
 #	include <errno.h>
====================================================================

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:

====================================================================
--- 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="-D_ALL_SOURCE"
 	;;
-(cygwin|msys)
+(msys)
 	cf_XOPEN_SOURCE=600
 	;;
 (darwin[[0-8]].*)
@@ -5627,7 +5627,7 @@ case $host_os in
 	cf_xopen_source="-D_SGI_SOURCE"
 	cf_XOPEN_SOURCE=
 	;;
-(linux*|gnu*|mint*|k*bsd*-gnu)
+(linux*|gnu*|mint*|k*bsd*-gnu|cygwin)
 	CF_GNU_SOURCE
 	;;
 (minix*)
====================================================================


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.tin.org/pipermail/tin-dev/attachments/20160809/bae40fe1/attachment.sig>


More information about the tin-dev mailing list