From: Kefu Chai Date: Thu, 11 Feb 2016 12:08:32 +0000 (+0800) Subject: tests: ceph-disk.sh: use "readlink -f" instead for fullpath X-Git-Tag: v10.1.0~408^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8f42f89937ffbc46936e27080dd561be1d794d1c;p=ceph.git 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 --- diff --git a/src/ceph-disk/tests/ceph-disk.sh b/src/ceph-disk/tests/ceph-disk.sh index b2b4faaa8bd3..9456ee364f30 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 <