Conversation
…st (tw93#742) Regression from tw93#714. `grep -c` exits 1 on zero matches, so the `|| echo "0"` fallback fires even when grep already printed "0", producing "0\n0" and breaking the `[[ -gt ]]` comparison. Switches to the `awk '{count++} END {print count+0}'` pattern already used in lib/clean/dev.sh — exit-code independent, always emits a single integer. Adds regression tests for the zero-sim and populated-sim DRY_RUN paths.
The help text in lib/core/help.sh documents the --permanent flag with a string containing "rm -rf", triggering a false positive in the security check. Add "echo " to the grep exclusion filter.
Owner
|
@sebastianbreguel thanks for fixing the simulator count arithmetic error, merged and will be in the next release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #742. Regression from #714.
grep -cexits 1 on zero matches, so the|| echo \"0\"fallback fires even when grep already printed "0", producing "0\n0" and breaking the[[ -gt ]]comparison inclean_xcode_tools.Switches to the
awk '/pattern/ { count++ } END { print count+0 }'pattern already used inlib/clean/dev.sh:778,818— exit-code independent, always emits a single integer. Keeps a numeric sanity regex as a belt-and-suspenders guard.Changes
lib/clean/app_caches.sh: replacegrep -cE ... || echo "0"withcommand awkcounter + numeric validation.tests/clean_app_caches.bats: add two regression tests (zero unavailable sims + populated DRY_RUN path).Verification
Credit to @yetval for identifying the exact root cause in the issue thread.