On 1/15/22 11:55, Bernhard Voelker wrote:

yep, `make check-very-expensive` fails due to 3x segmentation faults:

   FAIL: tests/cp/cp-parents
   FAIL: tests/cp/parent-perm-race
   FAIL: tests/mv/hard-3

Yes, I think these were due to the fact that my initial tests used GCC with optimization levels so high that GCC optimized the bugs away (!). I installed commit f39a02a744ae97f6879ba1d20a528192772773e0 to try to fix the bugs.

Furthermore, 'make syntax-check' complains about:

   prohibit_readlink
   src/copy.c:1266:          if (0 <= readlinkat (dst_dirfd, dst_relname, 
dummy, sizeof dummy))
   maint.mk: do not use readlink(at); use via xreadlink or areadlink*
   make: *** [cfg.mk:446: sc_prohibit_readlink] Error 1

Thanks for mentioning that. I think this syntax-check is too strict, as I've found that it's useful to invoke readlinkat with a 1-byte destination buffer if one merely wants to test whether a file is a symbolic link and does not care where it points to. This approach can be better than fstatat since it needn't worry about EOVERFLOW issues. So I installed the attached to remove the check.
From 2ba6fb653c7d029e9ecef8e6d7d762674d2573ff Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Sat, 15 Jan 2022 12:12:21 -0800
Subject: [PATCH] build: allow readlinkat calls
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Problem reported by Bernhard Voelker in:
https://lists.gnu.org/r/coreutils/2022-01/msg00026.html
* cfg.mk (sc_prohibit_readlink): Remove.  It’s OK to call
readlinkat to determine whether a file is a symbolic link.
---
 cfg.mk | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index c6284256c..90066f19a 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -441,12 +441,6 @@ sc_prohibit_operator_at_end_of_line:
 	halt='found operator at end of line'				\
 	  $(_sc_search_regexp)
 
-# Don't use "readlink" or "readlinkat" directly
-sc_prohibit_readlink:
-	@prohibit='\<readlink(at)? \('					\
-	halt='do not use readlink(at); use via xreadlink or areadlink*'	\
-	  $(_sc_search_regexp)
-
 # Don't use address of "stat" or "lstat" functions
 sc_prohibit_stat_macro_address:
 	@prohibit='\<l?stat '':|&l?stat\>'				\
-- 
2.32.0

Reply via email to