setup.sh: Fix cleanup in matching files

The original mechanism to identify files to cleanup
relied on glob matching from the output of 'echo'
piped to a grep.  This yields a case where some
objects can appear and picked up as matching because
other items on the same line matched the grep
string.   Changing this to use 'ls -1' which will
restrict the grep string matching to individual lines
thereby only picking up the entities the script
intended to do.

Change-Id: I020c80236fa68bcabeca0299fe7a27f3320de97b
Signed-off-by: Lance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/437380 (master)
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448456
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Lance Hartmann 2018-12-14 18:06:32 -05:00 committed by Darek Stojaczyk
parent fa3ea35e0f
commit adf1a5158e

View File

@ -251,7 +251,7 @@ function cleanup_linux {
done
shopt -u extglob nullglob
files_to_clean+="$(echo /dev/shm/* | egrep '(spdk_tgt|iscsi|vhost|nvmf|rocksdb|bdevtest|bdevperf)_trace|spdk_iscsi_conns' || true) "
files_to_clean+="$(ls -1 /dev/shm/* | egrep '(spdk_tgt|iscsi|vhost|nvmf|rocksdb|bdevtest|bdevperf)_trace|spdk_iscsi_conns' || true) "
files_to_clean="$(readlink -e assert_not_empty $files_to_clean || true)"
if [[ -z "$files_to_clean" ]]; then
echo "Clean"