[LTP] [PATCH v1] rwtest: Confirm df is a symlink to busybox

Mengchi Cheng mengcc@amazon.com
Thu Nov 30 01:40:10 CET 2023


/bin/df can be a symlink to coreutils. It returns correct info with dir
arguments.
Just checking if df is a symlink will include such cases. Need to make
sure it is linking to busybox before ignoring options.

Signed-off-by: Mengchi Cheng <mengcc@amazon.com>
---
 testcases/kernel/fs/doio/rwtest | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/fs/doio/rwtest b/testcases/kernel/fs/doio/rwtest
index 6725e1426..26659e9d3 100644
--- a/testcases/kernel/fs/doio/rwtest
+++ b/testcases/kernel/fs/doio/rwtest
@@ -329,10 +329,10 @@ do
 		else
 			# If df is a symlink (to busybox) then do not pass the $dir and $dfOpts
 			# parameters because they don't work as expected
-                        if test -h $(which df)
-                           then
-                               dir=""; dfOpts="";
-                        fi
+			if [[ "$(readlink -f "$(which df)")" == *"busybox"* ]]
+			then
+				dir=""; dfOpts="";
+			fi
 
 			blks=$(df $dfOpts $dir |
 			(while read fs blks used avail cap mountpoint
-- 
2.25.1



More information about the ltp mailing list