NetBSD-Bugs archive

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

misc/54902: libc O_SEARCH tests using incorrect modes



>Number:         54902
>Category:       misc
>Synopsis:       libc O_SEARCH tests using incorrect modes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 28 03:40:00 +0000 2020
>Originator:     Kyle Evans
>Release:        -CURRENT
>Organization:
>Environment:
>Description:
libc's O_SEARCH tests are using decimal modes instead of octal modes where octal was clearly intended (e.g. 644 instead of 0644) -- inline patch below. A version of this patch can also be found at [0] in case my browser somehow mangles it in transit.

[0] https://people.freebsd.org/~kevans/c063.diff 
>How-To-Repeat:

>Fix:
Index: tests/lib/libc/c063/t_o_search.c
===================================================================
RCS file: /cvsroot/src/tests/lib/libc/c063/t_o_search.c,v
retrieving revision 1.5
diff -u -r1.5 t_o_search.c
--- tests/lib/libc/c063/t_o_search.c	10 Jan 2017 22:25:01 -0000	1.5
+++ tests/lib/libc/c063/t_o_search.c	28 Jan 2020 03:26:57 -0000
@@ -79,7 +79,7 @@
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 	ATF_REQUIRE(close(fd) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 644) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1);
 	ATF_REQUIRE(errno == EACCES);
@@ -109,12 +109,12 @@
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 	ATF_REQUIRE(close(fd) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 644) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 	ATF_REQUIRE(close(fd) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 444) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0444) == 0);
 
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 
@@ -141,12 +141,12 @@
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 	ATF_REQUIRE(close(fd) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 644) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 	ATF_REQUIRE(close(fd) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 444) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0444) == 0);
 
 	ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 
@@ -173,7 +173,7 @@
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 644) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == -1);
 	ATF_REQUIRE(errno == EACCES);
@@ -202,11 +202,11 @@
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 644) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 444) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0444) == 0);
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
@@ -232,11 +232,11 @@
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 644) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
-	ATF_REQUIRE(fchmod(dfd, 444) == 0);
+	ATF_REQUIRE(fchmod(dfd, 0444) == 0);
 
 	ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 



Home | Main Index | Thread Index | Old Index