Fix Linux uninstall script failing with a relative path#49592
Conversation
systemd-run runs the detached child as a transient unit with WorkingDirectory=/, so a relative $0 (e.g. ./uninstall-fleetd-linux.sh per the uninstall guide) couldn't be found and the removal silently never ran. Resolve $0 to an absolute path before re-exec. Fixes #49411
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe Linux uninstall script now resolves its absolute path before spawning the detached child process. Both the 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@it-and-security/lib/linux/scripts/uninstall-fleetd-linux.sh`:
- Line 55: Update the non-systemd background uninstall command around
SCRIPT_PATH to invoke the resolved script directly with its remove argument,
rather than interpolating it into bash -c. Preserve the existing output
redirection, stdin handling, background execution, and root-privileged behavior
while avoiding a second shell parse of SCRIPT_PATH.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 79d5826a-e72c-4607-83ff-d7814e960fcd
📒 Files selected for processing (1)
it-and-security/lib/linux/scripts/uninstall-fleetd-linux.sh
|
@jakestenger Did you test if it still works when deployed from Fleet with this update? |
@spalmesano0 Yes |
systemd-run runs the detached child as a transient unit with
WorkingDirectory=/, so a relative $0 (e.g. ./uninstall-fleetd-linux.sh
per the uninstall guide) couldn't be found and the removal silently
never ran. Resolve $0 to an absolute path before re-exec.
Fixes #49411
Summary by CodeRabbit