Re: Compiling GNU Sharutils on NetBSD

Eric Blake <[email protected]> Mon, 06 Apr 2015 08:54:07 -0600
Newsgroups gmane.comp.gnu.utils.bugs,gmane.comp.lib.gnulib.bugs
Organization Red Hat, Inc.
Message-ID <[email protected]>
[adding gnulib, as owner of the file in question]

On 04/06/2015 03:47 AM, HIRAMATSU Yoshifumi wrote:
> Hello,
> 
> Compiling Sharutil on recent NetBSD fails. This mail describes shortly.
> 
> 
> In GNU Sharutil's lib/fseeko.c, line 134 starts comment about NetBSD.
> 
>  /* Use a union, since on NetBSD, the compilation flags
>     determine whether fpos_t is typedef'd to off_t or a struct
>     containing a single off_t member.  */
> 
> However, NetBSD changed definition of _offset from fpos_t struct to __off_t,
> which is typedef of __int64_t.

When did this change occur?  Yes, gnulib should be taught to support it.

> 
> So the following code does not match the definition of FILE, results in build fail.
> 
> See -> http://cvsweb.netbsd.org/bsdweb.cgi/src/include/stdio.h.diff?r1=1.79&r2=1.80&f=h
> 
> 
> This patch fixes compilation and "make check" succeed.

Thanks for the patch; hopefully someone with more NetBSD familiarity
will confirm if this works for both pre- and post-change NetBSD FILE
definitions; otherwise, we may need to be a bit more careful to ensure
that we aren't breaking older systems.

> 
> --- lib/fseeko.c.orig	2015-04-05 22:42:44.000000000 +0900
> +++ lib/fseeko.c	2015-04-05 22:42:52.000000000 +0900
> @@ -125,7 +125,7 @@
>        fp->_flags &= ~_IO_EOF_SEEN;
>        fp->_offset = pos;
>  #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
> -# if defined __CYGWIN__
> +# if defined __CYGWIN__ || defined __NetBSD__
>        /* fp_->_offset is typed as an integer.  */
>        fp_->_offset = pos;
>  # else
> 
> 
> Kind regards,
> HIRAMATSU, Yoshifumi
> 
> 
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc (application/pgp-signature, 604 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJVIp4PAAoJEKeha0olJ0Nqb5cH/1HZ4eTejqw4tu4z2pOf1dNV
WTc631dSoKBXsaUkt6xWthR7i7z/xuBv/cWL17dxRufN3mhvzwdAIIGqynvS9m7I
YlyKZ4+5ZWuvguWdn88yy/RkiqS47oi8x1yybkWlxS5+mlYDKfuAPGTgqBbcQ9xi
AvFE/oCwHpI5Bicf2uEhtK6c+7/jeZTeIoA1f3kqRNZfrZm+K8/KmwUpSihHJBep
LWY9VhZJWlD0Y5b4oVhshhd9YCG+rw4VTM3vPTn2fY+d3/WsFX1KbAcGfpVPMgqd
2ZinldA/jKNXryt/9+RnyDmM8MIov9Lz4ftfYnc9qUVNhxBT8EWclCF+uRfsF4c=
=af2I
-----END PGP SIGNATURE-----