NetBSD Problem Report #51868

From www@NetBSD.org  Sat Jan 14 03:12:33 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 499137A287
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 14 Jan 2017 03:12:33 +0000 (UTC)
Message-Id: <20170114031232.1B5B17A2AE@mollari.NetBSD.org>
Date: Sat, 14 Jan 2017 03:12:32 +0000 (UTC)
From: yaneurabeya@gmail.com
Reply-To: yaneurabeya@gmail.com
To: gnats-bugs@NetBSD.org
Subject: [PATCH] tests/lib/libc/c063/t_mkfifoat and tests/lib/libc/sys/t_unlock: mkfifo* fixes
X-Send-Pr-Version: www-1.0

>Number:         51868
>Category:       bin
>Synopsis:       [PATCH] tests/lib/libc/c063/t_mkfifoat and tests/lib/libc/sys/t_unlock: mkfifo* fixes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 14 03:15:00 +0000 2017
>Closed-Date:    Sun Jan 15 20:19:34 +0000 2017
>Last-Modified:  Sun Jan 15 20:19:34 +0000 2017
>Originator:     Ngie Cooper
>Release:        7.0.2
>Organization:
>Environment:
n/a
>Description:
mkfifo* returns 0 for success, -1 for failure, not a file descriptor on success.

The attached patch fixes that.


>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/51868: [PATCH] tests/lib/libc/c063/t_mkfifoat and
 tests/lib/libc/sys/t_unlock: mkfifo* fixes
Date: Fri, 13 Jan 2017 19:15:52 -0800

 --Apple-Mail=_2E3C2C95-EAF2-49F8-9B4B-83182D2B2EFB
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=utf-8

 Patched attached =E2=80=94 sorry for the t_unlink bug >_>=E2=80=A6
 -Ngie

 --Apple-Mail=_2E3C2C95-EAF2-49F8-9B4B-83182D2B2EFB
 Content-Disposition: attachment;
 	filename=t_mkfifoat-fix-incorrect-closing-of-mkfifoat-results.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_mkfifoat-fix-incorrect-closing-of-mkfifoat-results.patch"
 Content-Transfer-Encoding: 7bit

 Index: lib/libc/c063/t_mkfifoat.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/c063/t_mkfifoat.c,v
 retrieving revision 1.3
 diff -u -r1.3 t_mkfifoat.c
 --- lib/libc/c063/t_mkfifoat.c	10 Jan 2017 15:15:09 -0000	1.3
 +++ lib/libc/c063/t_mkfifoat.c	14 Jan 2017 03:09:52 -0000
 @@ -55,13 +55,11 @@
  ATF_TC_BODY(mkfifoat_fd, tc)
  {
  	int dfd;
 -	int fd;
  	mode_t mode = 0600;

  	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
  	ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1);
 -	ATF_REQUIRE((fd = mkfifoat(dfd, BASEFIFO, mode)) != -1);
 -	ATF_REQUIRE(close(fd) == 0);
 +	ATF_REQUIRE(mkfifoat(dfd, BASEFIFO, mode) != -1);
  	ATF_REQUIRE(access(FIFO, F_OK) == 0);
  	(void)close(dfd);
  }
 @@ -74,12 +72,10 @@
  }
  ATF_TC_BODY(mkfifoat_fdcwd, tc)
  {
 -	int fd;
  	mode_t mode = 0600;

  	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
 -	ATF_REQUIRE((fd = mkfifoat(AT_FDCWD, FIFO, mode)) != -1);
 -	ATF_REQUIRE(close(fd) == 0);
 +	ATF_REQUIRE(mkfifoat(AT_FDCWD, FIFO, mode) != -1);
  	ATF_REQUIRE(access(FIFO, F_OK) == 0);
  }

 @@ -91,10 +87,9 @@
  }
  ATF_TC_BODY(mkfifoat_fdcwderr, tc)
  {
 -	int fd;
  	mode_t mode = 0600;

 -	ATF_REQUIRE((fd = mkfifoat(AT_FDCWD, FIFOERR, mode)) == -1);
 +	ATF_REQUIRE(mkfifoat(AT_FDCWD, FIFOERR, mode) == -1);
  }

  ATF_TC(mkfifoat_fderr);
 @@ -110,7 +105,7 @@
  	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
  	ATF_REQUIRE((fd = open(FIFO, O_CREAT|O_RDWR, 0644)) != -1);
  	ATF_REQUIRE(close(fd) == 0);
 -	ATF_REQUIRE((fd = mkfifoat(-1, FIFO, mode)) == -1);
 +	ATF_REQUIRE(mkfifoat(-1, FIFO, mode) == -1);
  }

  ATF_TP_ADD_TCS(tp)

 --Apple-Mail=_2E3C2C95-EAF2-49F8-9B4B-83182D2B2EFB
 Content-Disposition: attachment;
 	filename=t_unlink-fix-bogus-mkfifo-result-closing.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_unlink-fix-bogus-mkfifo-result-closing.patch"
 Content-Transfer-Encoding: 7bit

 Index: lib/libc/sys/t_unlink.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/sys/t_unlink.c,v
 retrieving revision 1.3
 diff -u -r1.3 t_unlink.c
 --- lib/libc/sys/t_unlink.c	13 Jan 2017 19:33:03 -0000	1.3
 +++ lib/libc/sys/t_unlink.c	14 Jan 2017 03:10:22 -0000
 @@ -107,11 +107,8 @@

  ATF_TC_BODY(unlink_fifo, tc)
  {
 -	int fd;

 -	ATF_REQUIRE_MSG((fd = mkfifo(path, 0666)) == 0,
 -	    "mkfifo failed: %s", strerror(errno));
 -	(void)close(fd);
 +	ATF_REQUIRE(mkfifo(path, 0666) == 0);
  	ATF_REQUIRE(unlink(path) == 0);

  	errno = 0;

 --Apple-Mail=_2E3C2C95-EAF2-49F8-9B4B-83182D2B2EFB--

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51868 CVS commit: src/tests/lib/libc
Date: Sat, 14 Jan 2017 15:55:26 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sat Jan 14 20:55:26 UTC 2017

 Modified Files:
 	src/tests/lib/libc/c063: t_mkfifoat.c
 	src/tests/lib/libc/sys: t_unlink.c

 Log Message:
 PR/51868: Ngie Cooper: mkfifo does not return an fd


 To generate a diff of this commit:
 cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/c063/t_mkfifoat.c
 cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sys/t_unlink.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->closed
State-Changed-By: snj@NetBSD.org
State-Changed-When: Sun, 15 Jan 2017 20:19:34 +0000
State-Changed-Why:
christos committed it. thanks!


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