From 8f42f89937ffbc46936e27080dd561be1d794d1c Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 11 Feb 2016 20:08:32 +0800 Subject: [PATCH] tests: ceph-disk.sh: use "readlink -f" instead for fullpath if $PATH has ".." in it, and the program happen to be located in "..", `which program` will print `../program` instead of its fullpath, so we should always use `readlink -f` for the fullpath. Signed-off-by: Kefu Chai --- src/ceph-disk/tests/ceph-disk.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ceph-disk/tests/ceph-disk.sh b/src/ceph-disk/tests/ceph-disk.sh index b2b4faaa8bd34..9456ee364f300 100644 --- a/src/ceph-disk/tests/ceph-disk.sh +++ b/src/ceph-disk/tests/ceph-disk.sh @@ -132,8 +132,8 @@ function kill_daemons() { function command_fixture() { local command=$1 - - [ $(which $command) = `readlink -f ../$command` ] || [ $(which $command) = `readlink -f $(pwd)/$command` ] || return 1 + local fpath=`readlink -f $(which $command)` + [ "$fpath" = `readlink -f ../$command` ] || [ "$fpath" = `readlink -f $(pwd)/$command` ] || return 1 cat > $DIR/$command <