Harden symlink cleanup error handling - #3
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Conversation
Legacy symlink cleanup resolved relative link targets by cd-ing into the target's parent directory. When that directory was missing (an unrelated broken symlink in the skills dir), the cd failed under `set -e` and aborted the entire install/uninstall, leaving the rest of the run unfinished with only a cryptic cd error. - Resolve relative targets inside a guarded conditional so an unresolvable link is skipped with a clear warning instead of aborting. - Replace `rmdir ... 2>/dev/null || true`, which swallowed every failure, with an explicit empty-directory check so a genuine rmdir error (e.g. permissions) still surfaces while non-empty directories are left alone. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
The only executable code in this repo is
install.shanduninstall.sh; the rest is markdown skills. Two error-handling weaknesses in those scripts are fixed.1. Legacy cleanup aborted the whole run on an unresolvable symlink.
remove_link_if_targetresolves a relative link target by cd-ing into the target's parent dir. If that dir is missing (e.g. an unrelated broken symlink in~/.claude/skills), thecdfails underset -euo pipefailand the entire install/uninstall aborts with a crypticcd: No such file or directory, skipping all remaining cleanup. Now the resolution is guarded and an unresolvable link is skipped with a clear warning:2.
rmdirswallowed every error.rmdir "$DIR" 2>/dev/null || true(uninstall) discarded all failures, including real ones (permissions), not just the expected non-empty case. Replaced with an explicit empty check so genuine failures still propagate viaset -e:Applied the resolution guard to both scripts (the helper is duplicated).
Testing
bash -nclean on both scripts.Link to Devin session: https://app.devin.ai/sessions/c58c81d23fc54b15bd512e7da87bdb36
Requested by: @sidwood