Development record
rm-rf-root-or-home over-blocks an everyday clean line: `rm -rf "${1:-build}"/*`, `rm -rf ${1:-dist}/`, `rm -rf "${1:-dist}/"*` and `rm -rf ${@:-x}/` block, and `rm -rf ./${1:-dist}` warns, though no shell prints the empty value under `:-`. The empty text an emptyable parameter can print was kept under the colon operators.
issueresolvedmajoriss-2609300651127327
rm-rf-root-or-home over-blocks an everyday clean line: rm -rf "${1:-build}"/*, rm -rf ${1:-dist}/, rm -rf "${1:-dist}/"* and rm -rf ${@:-x}/ block, and rm -rf ./${1:-dist} warns, though no shell prints the empty value under :-. The empty text an emptyable parameter can print was kept under the colon operators.
Grounds
- pursued: rm -rf "${1:-build}"/, ${1:-dist}/, "${1:-dist}/" and ${@:-x}/ allow again and ./${1:-dist} no longer warns, while ${1:-/}, ${1-}/ and ${1-dist}/ block; a shell that prints the empty value under :- would show it wrong, and bash 3.2, /bin/sh, dash and bash 5.3 do not.
Frontmatter
| id | iss-2609300651127327 |
|---|---|
| type | issue |
| lifecycle | resolved |
| severity | major |
.abcd/work/issues/resolved/iss-2609300651127327-rm-rf-root-or-home-over-blocks-an.md
open on GitHub ↗ · commit history ↗
mentions1
- iss-2609300726419415The colon test of ${@:-w}, ${*:-w}, ${@:=w} and ${@:?} is taken on the parameter count, not on a joined value, but the guard read them as a single empty parameter does (the empty value never printed), a regression from iss-2609300651127327. With set -- "" "" (a script called as clean.sh "" "") bash 3.2, /bin/sh, dash and bash 5.3 hand rm the home for rm -rf $HOME${@:-x} and $HOME${*:?}, and / or /* for rm -rf ${@:-x}/*, ${*:-x}/ and ${@:?}/; all were allowed.