fix: swap arguments to isNotSpecial in tidy() to correctly preserve bin/ and current#1290
Merged
jfeingold35 merged 1 commit intooclif:mainfrom Mar 24, 2026
Merged
Conversation
…in/ and current The `isNotSpecial` function in `tidy()` was called with swapped arguments: `isNotSpecial(this.config.version, f.path)` instead of `isNotSpecial(f.path, this.config.version)`. This caused `isNotSpecial` to always return `true` for every entry, meaning the only protection against deletion was the 42-day age check. After 42 days, `tidy()` would delete all entries including `bin/` and `current`, breaking the CLI installation. The `bin/` directory is particularly vulnerable because `createBin()` overwrites the file inside it (via `writeFile`) which does not update the directory's mtime — so the directory retains its original mtime from installation and eventually exceeds the 42-day threshold. fixes: oclif#1289
jfeingold35
approved these changes
Mar 24, 2026
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.
What
The
isNotSpecialfunction intidy()was called with swapped arguments:isNotSpecial(this.config.version, f.path)instead ofisNotSpecial(f.path, this.config.version).This caused
isNotSpecialto always returntruefor every entry, meaning the only protection against deletion was the 42-day age check. After 42 days,tidy()would delete all entries includingbin/andcurrent, breaking the CLI installation.The
bin/directory is particularly vulnerable becausecreateBin()overwrites the file inside it (viawriteFile) which does not update the directory's mtime — so the directory retains its original mtime from installation and eventually exceeds the 42-day threshold.fixes: #1289
How to test
yalctouch -t $(date -v-43d +%Y%m%d%H%M.%S) ~/.local/share/myapp/client/bin