NetBSD Problem Report #51804

From www@NetBSD.org  Tue Jan 10 08:37:20 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 316217A16C
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 10 Jan 2017 08:37:20 +0000 (UTC)
Message-Id: <20170110083719.0ACE87A289@mollari.NetBSD.org>
Date: Tue, 10 Jan 2017 08:37:19 +0000 (UTC)
From: yaneurabeya@gmail.com
Reply-To: yaneurabeya@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Fix up #includes in tests/lib/libc/c063/...
X-Send-Pr-Version: www-1.0

>Number:         51804
>Category:       bin
>Synopsis:       Fix up #includes in tests/lib/libc/c063/...
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 10 08:40:00 +0000 2017
>Closed-Date:    Tue Feb 21 05:41:58 +0000 2017
>Last-Modified:  Tue Feb 21 05:41:58 +0000 2017
>Originator:     Ngie Cooper
>Release:        7.0.2-RELEASE
>Organization:
>Environment:
n/a
>Description:
Several of the tests/lib/libc/c063/... test cases require function definitions/macros in sys/stat.h which trip up FreeBSD when building the test cases. It works by accident on NetBSD via header pollution (FreeBSD, NetBSD, and POSIX all state that the headers are required for building with the macros/functions).

The attached patch does 2 things:
- Sorts sys/ headers before non-sys headers (it's a style(9) thing on FreeBSD, but it also makes the code a bit more portable if ported to other operating systems).
- Adds sys/stat.h #include.

Patch coming soon.
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/51804: Fix up #includes in tests/lib/libc/c063/...
Date: Tue, 10 Jan 2017 00:42:36 -0800

 --Apple-Mail=_3237E761-E80E-4572-9671-973632F43029
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii

 Patch attached.

 --Apple-Mail=_3237E761-E80E-4572-9671-973632F43029
 Content-Disposition: attachment;
 	filename=c063-header-fixup.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="c063-header-fixup.patch"
 Content-Transfer-Encoding: 7bit

 Index: t_faccessat.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/c063/t_faccessat.c,v
 retrieving revision 1.2
 diff -u -r1.2 t_faccessat.c
 --- t_faccessat.c	17 Mar 2013 04:46:06 -0000	1.2
 +++ t_faccessat.c	10 Jan 2017 08:31:01 -0000
 @@ -31,6 +31,8 @@
  #include <sys/cdefs.h>
  __RCSID("$NetBSD: t_faccessat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");

 +#include <sys/param.h>
 +#include <sys/stat.h>
  #include <atf-c.h>
  #include <errno.h>
  #include <fcntl.h>
 @@ -39,7 +41,6 @@
  #include <stdio.h>
  #include <string.h>
  #include <unistd.h>
 -#include <sys/param.h>

  #define DIR "dir"
  #define FILE "dir/faccessat"
 Index: t_fchmodat.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/c063/t_fchmodat.c,v
 retrieving revision 1.2
 diff -u -r1.2 t_fchmodat.c
 --- t_fchmodat.c	17 Mar 2013 04:46:06 -0000	1.2
 +++ t_fchmodat.c	10 Jan 2017 08:31:01 -0000
 @@ -31,6 +31,8 @@
  #include <sys/cdefs.h>
  __RCSID("$NetBSD: t_fchmodat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");

 +#include <sys/param.h>
 +#include <sys/stat.h>
  #include <atf-c.h>
  #include <errno.h>
  #include <fcntl.h>
 @@ -39,7 +41,6 @@
  #include <stdio.h>
  #include <string.h>
  #include <unistd.h>
 -#include <sys/param.h>

  #define DIR "dir"
  #define FILE "dir/fchmodat"
 Index: t_fchownat.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/c063/t_fchownat.c,v
 retrieving revision 1.3
 diff -u -r1.3 t_fchownat.c
 --- t_fchownat.c	17 Mar 2013 04:46:06 -0000	1.3
 +++ t_fchownat.c	10 Jan 2017 08:31:01 -0000
 @@ -31,6 +31,8 @@
  #include <sys/cdefs.h>
  __RCSID("$NetBSD: t_fchownat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $");

 +#include <sys/param.h>
 +#include <sys/stat.h>
  #include <atf-c.h>
  #include <errno.h>
  #include <fcntl.h>
 @@ -40,7 +42,6 @@
  #include <string.h>
  #include <unistd.h>
  #include <pwd.h>
 -#include <sys/param.h>

  #define DIR "dir"
  #define FILE "dir/fchownat"
 Index: t_fstatat.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/c063/t_fstatat.c,v
 retrieving revision 1.2
 diff -u -r1.2 t_fstatat.c
 --- t_fstatat.c	17 Mar 2013 04:46:06 -0000	1.2
 +++ t_fstatat.c	10 Jan 2017 08:31:01 -0000
 @@ -31,6 +31,8 @@
  #include <sys/cdefs.h>
  __RCSID("$NetBSD: t_fstatat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");

 +#include <sys/param.h>
 +#include <sys/stat.h>
  #include <atf-c.h>
  #include <errno.h>
  #include <fcntl.h>
 @@ -39,7 +41,6 @@
  #include <stdio.h>
  #include <string.h>
  #include <unistd.h>
 -#include <sys/param.h>

  #define DIR "dir"
  #define FILE "dir/fstatat"
 Index: t_openat.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/c063/t_openat.c,v
 retrieving revision 1.2
 diff -u -r1.2 t_openat.c
 --- t_openat.c	17 Mar 2013 04:46:06 -0000	1.2
 +++ t_openat.c	10 Jan 2017 08:31:01 -0000
 @@ -31,6 +31,8 @@
  #include <sys/cdefs.h>
  __RCSID("$NetBSD: t_openat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");

 +#include <sys/param.h>
 +#include <sys/stat.h>
  #include <atf-c.h>
  #include <errno.h>
  #include <fcntl.h>
 @@ -39,7 +41,6 @@
  #include <stdio.h>
  #include <string.h>
  #include <unistd.h>
 -#include <sys/param.h>

  #define DIR "dir"
  #define FILE "dir/openat"
 Index: t_readlinkat.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/c063/t_readlinkat.c,v
 retrieving revision 1.3
 diff -u -r1.3 t_readlinkat.c
 --- t_readlinkat.c	17 Mar 2013 04:46:06 -0000	1.3
 +++ t_readlinkat.c	10 Jan 2017 08:31:01 -0000
 @@ -31,6 +31,8 @@
  #include <sys/cdefs.h>
  __RCSID("$NetBSD: t_readlinkat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $");

 +#include <sys/param.h>
 +#include <sys/stat.h>
  #include <atf-c.h>
  #include <errno.h>
  #include <fcntl.h>
 @@ -39,7 +41,6 @@
  #include <stdio.h>
  #include <string.h>
  #include <unistd.h>
 -#include <sys/param.h>

  #define DIR "dir"
  #define FILE "dir/readlinkat"
 Index: t_unlinkat.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/c063/t_unlinkat.c,v
 retrieving revision 1.2
 diff -u -r1.2 t_unlinkat.c
 --- t_unlinkat.c	17 Mar 2013 04:46:06 -0000	1.2
 +++ t_unlinkat.c	10 Jan 2017 08:31:01 -0000
 @@ -31,6 +31,8 @@
  #include <sys/cdefs.h>
  __RCSID("$NetBSD: t_unlinkat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");

 +#include <sys/param.h>
 +#include <sys/stat.h>
  #include <atf-c.h>
  #include <errno.h>
  #include <fcntl.h>
 @@ -39,7 +41,6 @@
  #include <stdio.h>
  #include <string.h>
  #include <unistd.h>
 -#include <sys/param.h>

  #define DIR "dir"
  #define FILE "dir/unlinkat"
 Index: t_utimensat.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/c063/t_utimensat.c,v
 retrieving revision 1.5
 diff -u -r1.5 t_utimensat.c
 --- t_utimensat.c	17 Mar 2013 04:46:06 -0000	1.5
 +++ t_utimensat.c	10 Jan 2017 08:31:01 -0000
 @@ -31,6 +31,9 @@
  #include <sys/cdefs.h>
  __RCSID("$NetBSD: t_utimensat.c,v 1.5 2013/03/17 04:46:06 jmmv Exp $");

 +#include <sys/param.h>
 +#include <sys/stat.h>
 +#include <sys/time.h>
  #include <atf-c.h>
  #include <errno.h>
  #include <fcntl.h>
 @@ -39,8 +42,6 @@
  #include <stdio.h>
  #include <string.h>
  #include <unistd.h>
 -#include <sys/param.h>
 -#include <sys/time.h>

  #define DIR "dir"
  #define FILE "dir/utimensat"

 --Apple-Mail=_3237E761-E80E-4572-9671-973632F43029--

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51804 CVS commit: src/tests/lib/libc/c063
Date: Tue, 10 Jan 2017 10:13:56 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Tue Jan 10 15:13:56 UTC 2017

 Modified Files:
 	src/tests/lib/libc/c063: t_faccessat.c t_fchmodat.c t_fchownat.c
 	    t_fstatat.c t_openat.c t_readlinkat.c t_unlinkat.c t_utimensat.c

 Log Message:
 PR/51804: Ngie Cooper: Sort headers; include <sys/stat.h>. On NetBSD,
 <sys/stat.h> gets side-loaded from <sys/fcntl.h>. Should be fixed.


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/c063/t_faccessat.c \
     src/tests/lib/libc/c063/t_fchmodat.c src/tests/lib/libc/c063/t_fstatat.c \
     src/tests/lib/libc/c063/t_openat.c src/tests/lib/libc/c063/t_unlinkat.c
 cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/c063/t_fchownat.c \
     src/tests/lib/libc/c063/t_readlinkat.c
 cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/c063/t_utimensat.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 10 Jan 2017 18:10:56 +0000
State-Changed-Why:
christos committed it, please crosscheck that it works now


From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: re: bin/51804: Fix up #includes in tests/lib/libc/c063/...
Date: Wed, 11 Jan 2017 07:01:12 +1100

 > The attached patch does 2 things:
 > - Sorts sys/ headers before non-sys headers (it's a style(9) thing on Fr=
 eeBSD, but it also makes the code a bit more portable if ported to other o=
 perating systems).

 actually, this is netbsd style as well.  it comes from 4BSD or
 perhaps even earlier :-)


 .mrg.

From: Paul Goyette <paul@whooppee.com>
To: Ngie Cooper <yaneurabeya@gmail.com>
Cc: "gnats-bugs@NetBSD.org" <gnats-bugs@netbsd.org>, 
    "gnats-admin@netbsd.org" <gnats-admin@netbsd.org>, 
    "netbsd-bugs@netbsd.org" <netbsd-bugs@netbsd.org>
Subject: Re: bin/51804: Fix up #includes in tests/lib/libc/c063/...
Date: Tue, 21 Feb 2017 07:06:04 +0800 (PHT)

 On Mon, 20 Feb 2017, Ngie Cooper wrote:

 > Hi!
 >    Could this PR please be closed (the code's been committed to NetBSD head)?

 Feedback was requested - can you confirm that the problem is actually 
 fixed?

 :)

From: Ngie Cooper <yaneurabeya@gmail.com>
To: "gnats-bugs@NetBSD.org" <gnats-bugs@netbsd.org>
Cc: "gnats-admin@netbsd.org" <gnats-admin@netbsd.org>, 
	"netbsd-bugs@netbsd.org" <netbsd-bugs@netbsd.org>
Subject: Re: bin/51804: Fix up #includes in tests/lib/libc/c063/...
Date: Mon, 20 Feb 2017 15:00:13 -0800

 Hi!
     Could this PR please be closed (the code's been committed to NetBSD head)?
 Thanks,
 -Ngie

From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: bin/51804: Fix up #includes in tests/lib/libc/c063/...
Date: Mon, 20 Feb 2017 16:56:36 -0800

 --Apple-Mail=_9716E101-14F8-44C1-B462-03860CB96122
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=utf-8


 > On Feb 20, 2017, at 15:10, Paul Goyette <paul@whooppee.com> wrote:
 >=20
 > The following reply was made to PR bin/51804; it has been noted by =
 GNATS.
 >=20
 > From: Paul Goyette <paul@whooppee.com>
 > To: Ngie Cooper <yaneurabeya@gmail.com>
 > Cc: "gnats-bugs@NetBSD.org" <gnats-bugs@netbsd.org>,
 >    "gnats-admin@netbsd.org" <gnats-admin@netbsd.org>,
 >    "netbsd-bugs@netbsd.org" <netbsd-bugs@netbsd.org>
 > Subject: Re: bin/51804: Fix up #includes in tests/lib/libc/c063/...
 > Date: Tue, 21 Feb 2017 07:06:04 +0800 (PHT)
 >=20
 > On Mon, 20 Feb 2017, Ngie Cooper wrote:
 >=20
 >> Hi!
 >>   Could this PR please be closed (the code's been committed to NetBSD =
 head)?
 >=20
 > Feedback was requested - can you confirm that the problem is actually
 > fixed?

 Hi!
 	Yes, I can confirm that the problem is fixed =E2=80=94 the only =
 diff on the FreeBSD side now in tests/lib/libc/c063/... has to do with =
 NetBSD-specific behavior for faccessat(2).
 Thanks!
 -Ngie

 --Apple-Mail=_9716E101-14F8-44C1-B462-03860CB96122
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP using GPGMail

 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - https://gpgtools.org

 iQIcBAEBCgAGBQJYq5BEAAoJEPWDqSZpMIYVmpQP+gIR4d33JMPlQFSCxU46NV4h
 buqd6o0TEqnWdwutgubNwoLT0MYcuwcBbbB80xD9FOd5dwytaGWwm7e4YTBMHnu6
 5XQE1RztdK91wYTAxFej9lSJqqp8i2WzqSOyh6RwQpygxcOV5y7cKLa3S5veZKWr
 HpWoE1hLPXTTjMBXe12pAGiDQBbTZHMR4WlB/gY6bekkFnbPMjnph1OtAN6kwhCf
 GTbFBbDAXV4/tU5B8ggE+uZsBordzxuJFsYM4vMlZ40xgKC3nX+SXUgY9yY50DVk
 kMyxh5FAfL7xdykzhc1IcIbXZQmuesP9zQ7Jg4fnmzi6DWKmNgbmWDKOY/aT5AKI
 NtRUczeJXYY6de592Ui73gq61EYQsIXpCmRso7uUb2Vh5W6n6yp5xT6o2G0eov+4
 ijLvZ1NssAlMZPKvukdUm2dDmL1QqKvhV18H48OGBUNKciaa1svCvc6eVkGgx6cw
 9Y0wkR5AnGmDvmmXHNr1KdLYV8IPuCL1/s6b3BK2cGnMuprIbNFKwaPypItanf8a
 abM9MMwfN5KRmp0avXRfMzzNkhEh51CBgm1t/JyiYPRO3IRlcaxesLv83H14SiW6
 2qVp6nGcL8QdO/8H6CCKFw4GC5aMaCyrPRNNKJ0KlX4+Q6itiU735ZRuEw8gKErI
 IrtkaWlGLyakc1Ny1dKo
 =kHnD
 -----END PGP SIGNATURE-----

 --Apple-Mail=_9716E101-14F8-44C1-B462-03860CB96122--

State-Changed-From-To: feedback->closed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Tue, 21 Feb 2017 05:41:58 +0000
State-Changed-Why:
Confirmed fixed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.