NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/51844: [PATCH] tests/lib/libc/sys/t_truncate: use root-owned file created during build instead of /usr/bin/fpr



The following reply was made to PR bin/51844; it has been noted by GNATS.

From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/51844: [PATCH] tests/lib/libc/sys/t_truncate: use root-owned
 file created during build instead of /usr/bin/fpr
Date: Thu, 12 Jan 2017 21:11:14 -0800

 --Apple-Mail=_D46F3DB3-E3C8-4D1A-8057-4FA1DEF1671E
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii
 
 Patch attached.
 -Ngie
 
 --Apple-Mail=_D46F3DB3-E3C8-4D1A-8057-4FA1DEF1671E
 Content-Disposition: attachment;
 	filename=t_truncate-use-root-owned-file-instead-of-usr-bin-fpr.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_truncate-use-root-owned-file-instead-of-usr-bin-fpr.patch"
 Content-Transfer-Encoding: 7bit
 
 Index: lib/libc/sys/Makefile
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/sys/Makefile,v
 retrieving revision 1.45
 diff -u -r1.45 Makefile
 --- lib/libc/sys/Makefile	11 Nov 2016 15:30:44 -0000	1.45
 +++ lib/libc/sys/Makefile	13 Jan 2017 05:06:31 -0000
 @@ -84,6 +84,18 @@
  
  CPPFLAGS.t_lwp_create.c += -D_KERNTYPES
  
 +FILESGROUPS+=		truncate_test_FILES
 +
 +truncate_test_FILES=	truncate_test.root_owned
 +truncate_test_FILESDIR=	${TESTSDIR}
 +truncate_test_FILESMODE= 0600
 +truncate_test_FILESOWNER= root
 +truncate_test_FILESGRP= wheel
 +
 +CLEANFILES=	truncate_test.root_owned
 +truncate_test.root_owned:
 +	dd if=/dev/null bs=1 count=1 of=${.TARGET}
 +
  WARNS=			4
  
  .include <bsd.test.mk>
 Index: lib/libc/sys/t_truncate.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/sys/t_truncate.c,v
 retrieving revision 1.2
 diff -u -r1.2 t_truncate.c
 --- lib/libc/sys/t_truncate.c	18 Aug 2011 19:48:03 -0000	1.2
 +++ lib/libc/sys/t_truncate.c	13 Jan 2017 05:06:31 -0000
 @@ -36,6 +36,7 @@
  #include <atf-c.h>
  #include <errno.h>
  #include <fcntl.h>
 +#include <limits.h>
  #include <stdio.h>
  #include <string.h>
  #include <unistd.h>
 @@ -149,6 +150,7 @@
  
  ATF_TC_BODY(truncate_err, tc)
  {
 +	char buf[PATH_MAX];
  
  	errno = 0;
  	ATF_REQUIRE_ERRNO(EFAULT, truncate((void *)-1, 999) == -1);
 @@ -160,7 +162,9 @@
  	ATF_REQUIRE_ERRNO(ENOENT, truncate("/a/b/c/d/e/f/g", 999) == -1);
  
  	errno = 0;
 -	ATF_REQUIRE_ERRNO(EACCES, truncate("/usr/bin/fpr", 999) == -1);
 +	snprintf(buf, sizeof(buf), "%s/truncate_test.root_owned",
 +	    atf_tc_get_config_var(tc, "srcdir"));
 +	ATF_REQUIRE_ERRNO(EACCES, truncate(buf, 999) == -1);
  }
  
  ATF_TP_ADD_TCS(tp)
 
 --Apple-Mail=_D46F3DB3-E3C8-4D1A-8057-4FA1DEF1671E--
 


Home | Main Index | Thread Index | Old Index