[Intel-gfx] [PATCH 5/8] dim: avoid errors with rm $foo/ expanding to /
Jani Nikula
jani.nikula at intel.com
Tue Mar 21 10:14:31 UTC 2017
Fix shellcheck SC2115: Use "${var:?}" to ensure this never expands to /.
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
dim | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/dim b/dim
index 0fe125335a67..8bbff67b3f80 100755
--- a/dim
+++ b/dim
@@ -461,18 +461,26 @@ function rr_cache_dir
function update_rerere_cache
{
+ local rerere
+
+ rerere=$(rr_cache_dir)
+
cd $DIM_PREFIX/drm-rerere/
git pull
- mkdir $(rr_cache_dir) &> /dev/null || true
- cp rr-cache/* $(rr_cache_dir) -r
+ mkdir ${rerere:?} &> /dev/null || true
+ cp rr-cache/* ${rerere:?} -r
cd - > /dev/null
}
function dim_revert_rerere
{
+ local rerere
+
+ rerere=$(rr_cache_dir)
+
cd $DIM_PREFIX/drm-rerere/
git revert $1
- rm $(rr_cache_dir)/* -Rf
+ rm -Rf ${rerere:?}/*
}
dim_alias_rebuild_nightly=rebuild-tip
@@ -974,7 +982,7 @@ function dim_remove_branch
cd $DIM_PREFIX/$DIM_DRM_INTEL
if [[ -d $DIM_PREFIX/$branch ]] ; then
- rm -R $DIM_PREFIX/$branch
+ rm -R ${DIM_PREFIX:?}/$branch
git worktree prune &> /dev/null || true
fi
--
2.1.4
More information about the Intel-gfx
mailing list