From 3b2de5a0da3afdcd90aac7a11b10c0b0a07b193b Mon Sep 17 00:00:00 2001 From: mattmc3 Date: Thu, 18 Jul 2024 14:38:46 -0400 Subject: [PATCH] Ensure `rm` and `mv` always use the base command --- functions/antidote-purge | 4 ++-- functions/antidote-update | 6 +++++- tests/functions/t_setup_real | 6 +++--- tests/functions/t_teardown | 2 +- tools/buildman | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/functions/antidote-purge b/functions/antidote-purge index c4d16c0..6fe08f2 100644 --- a/functions/antidote-purge +++ b/functions/antidote-purge @@ -47,7 +47,7 @@ } if [[ ${REPLY:u} == "Y" ]]; then local dtstmp=$(date -u '+%Y%m%d_%H%M%S') - mv -f "${bundlefile:r}.zsh" "${bundlefile:r}.${dtstmp}.bak" + command mv -f "${bundlefile:r}.zsh" "${bundlefile:r}.${dtstmp}.bak" print "'"${bundlefile:r}.zsh"' backed up to '${bundlefile:t:r}.${dtstmp}.bak'" fi fi @@ -75,7 +75,7 @@ if [[ -e "$bundlefile" ]]; then local tmpfile="${bundlefile}.antidote.tmp" $__adote_awkcmd -v pat="$bundle" '$0~"^[[:blank:]]*"pat{print "# " $0;next}1' <$bundlefile >|$tmpfile - mv -f "$tmpfile" "$bundlefile" || rm -f "$tmpfile" + command mv -f "$tmpfile" "$bundlefile" || command rm -f "$tmpfile" print "Bundle '$bundle' was commented out in '$bundlefile'." fi fi diff --git a/functions/antidote-update b/functions/antidote-update index ff775eb..a72ce33 100644 --- a/functions/antidote-update +++ b/functions/antidote-update @@ -37,7 +37,11 @@ local bundledir url repo # remove zcompiled files - rm -rf -- $(antidote-home)/**/*.zwc(N) + command rm -rf -- $(antidote-home)/**/*.zwc(N) + + # remove check file + local loadable_check_path="$(antidote-home)/.antidote.load" + [[ -r "$loadable_check_path" ]] && command rm -- "$loadable_check_path" # update all bundles for bundledir in $(antidote-list --dirs); do diff --git a/tests/functions/t_setup_real b/tests/functions/t_setup_real index 93af2d5..1bfc0e7 100644 --- a/tests/functions/t_setup_real +++ b/tests/functions/t_setup_real @@ -17,12 +17,12 @@ # replace .zsh_plugins.txt with real versions local file for file in .zsh_plugins.txt .zsh_plugins.zsh; do - [[ -f $ZDOTDIR/$file ]] && rm -f -- "$ZDOTDIR/$file" - [[ -f $testdir/real/$file ]] && rm -f -- "$testdir/real/$file" + [[ -f $ZDOTDIR/$file ]] && command rm -f -- "$ZDOTDIR/$file" + [[ -f $testdir/real/$file ]] && command rm -f -- "$testdir/real/$file" done # clean out antidote home - [[ -d $ANTIDOTE_HOME ]] && rm -rf -- "$ANTIDOTE_HOME" + [[ -d $ANTIDOTE_HOME ]] && command rm -rf -- "$ANTIDOTE_HOME" mkdir -p "$ANTIDOTE_HOME" # source antidote diff --git a/tests/functions/t_teardown b/tests/functions/t_teardown index 684fd86..24eae4f 100644 --- a/tests/functions/t_teardown +++ b/tests/functions/t_teardown @@ -26,7 +26,7 @@ source <(printf '%s\n' $T_PREV_ZSTYLES) # remove tempdir - [[ -d "$T_TEMPDIR" ]] && rm -rf -- "$T_TEMPDIR" + [[ -d "$T_TEMPDIR" ]] && command rm -rf -- "$T_TEMPDIR" # remove vars for var in \ diff --git a/tools/buildman b/tools/buildman index 8f263e3..3c2e0b8 100755 --- a/tools/buildman +++ b/tools/buildman @@ -7,7 +7,7 @@ 0=${(%):-%x} BASEDIR=${0:a:h:h} TMPDIR=$BASEDIR/.tmp/buildman -[[ -d $TMPDIR ]] && rm -rf $TMPDIR +[[ -d $TMPDIR ]] && command rm -rf $TMPDIR mkdir -p $TMPDIR sedi() {