glibc says "Too many levels of symbolic links", but BSD says "Too many
symbolic links encountered". Until it becomes a problem, allow any error
message.
---
 tests/find.test | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
From 8d4540c8c9b6171b08b46dead178d56bc6105581 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <e...@google.com>
Date: Thu, 15 Aug 2019 08:49:17 -0700
Subject: [PATCH] find.test: allow any error message about symlink loops.

glibc says "Too many levels of symbolic links", but BSD says "Too many
symbolic links encountered". Until it becomes a problem, allow any error
message.
---
 tests/find.test | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tests/find.test b/tests/find.test
index b3f798b8..dc228cac 100755
--- a/tests/find.test
+++ b/tests/find.test
@@ -73,8 +73,6 @@ testing "-perm (any success)" \
 testing "-perm (any failure)" \
   "find perm -type f -perm -0222" "" "" ""
 
-# Still fails
-
 testing "unterminated -exec {}" \
   "find dir -type f -exec ls {} 2>/dev/null || echo bad" "bad\n" "" ""
 testing "-exec {} +" \
@@ -105,10 +103,15 @@ testing "-printf" "find dir -name file -printf '%f %p %P %s'" \
 testing "-printf .N" "find dir -name file -printf %.2f" "fi" "" ""
 
 ln -s does-not-exist dir/dangler
+testing "-L dangling symlink silent" \
+  "LANG=C find -L dir -name file 2>&1" "dir/file\n" "" ""
+rm -f dir/dangler
+
 ln -s looper dir/looper
-testing "-L dangling link" \
-  "LANG=C find -L dir -name file 2>&1 | sort | sed s/\'//g" \
-  "dir/file\nfind: dir/looper: Too many levels of symbolic links\n" "" ""
+testing "-L symlink loop noisy" \
+  "LANG=C find -L dir -name file 2>err | sed s/\'//g ; grep -q dir/looper err || echo missing error" \
+  "dir/file\n" "" ""
+rm -f dir/looper
 
 testing "-false" "find dir -false" "" "" ""
 testing "-true" "find dir/file -true" "dir/file\n" "" ""
-- 
2.23.0.rc1.153.gdeed80330f-goog

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to