fix(desktop): keep durable CLI symlink when the bundle is ephemeral - #6185
Open
santhiprakash wants to merge 1 commit into
Open
fix(desktop): keep durable CLI symlink when the bundle is ephemeral#6185santhiprakash wants to merge 1 commit into
santhiprakash wants to merge 1 commit into
Conversation
`ensure_cli_symlink` removes and recreates `~/.local/bin/buzz` on every boot from `current_exe().parent()`. A Linux AppImage runs from an extract under the temp dir, so the link gets rewritten to `/tmp/appimage_extracted_*/usr/bin/buzz` (or `/tmp/.mount_*/...`). `/tmp` is tmpfs on many distros, so after the next reboot the target is gone and anything invoking `buzz` by name fails with nothing surfaced by desktop — agents and timers just stop posting. Refreshing the link unconditionally was deliberate (block#1357): the older code only updated targets containing `.app/Contents/MacOS`, so Linux links kept naming a moved bundle. Keep that, and carve out only the case that makes it lossy — when this boot's bundled CLI is itself ephemeral and the existing link still resolves to a durable binary, leave the link alone. A missing, dangling, unreadable, or itself-ephemeral target is still replaced, so an AppImage-only machine still gets the convenience link and a stale extract path still gets refreshed. The link directory and the ephemeral roots are now parameters of an inner `ensure_cli_symlink_in`, so the tests drive the real filesystem writes instead of restating the branch logic. Fixes block#6110 Signed-off-by: Santhi Prakash <b.santhiprakash@gmail.com>
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
ensure_cli_symlinkremoves and recreates~/.local/bin/buzzon every boot fromcurrent_exe().parent()(lib.rssetup). A Linux AppImage runs from an extract under the temp dir, so the link is rewritten to/tmp/appimage_extracted_*/usr/bin/buzz(or/tmp/.mount_*/…)./tmpis tmpfs on many distros, so after the next reboot the target is gone:buzzis still onPATH, still dangles, and desktop reports nothing — agents and timers just stop posting.Refreshing the link unconditionally is deliberate (#1357 — the older code only updated targets containing
.app/Contents/MacOS, so Linux links kept naming a moved bundle). This keeps that and carves out only the case that makes it lossy:/tmp, soTMPDIRpointing elsewhere still can't hide a/tmpextract) and the existing link resolves to a durable binary → leave the link alone.Regular files at the link path are still skipped, unchanged.
Deliberately out of scope: an AppImage-only machine with no durable CLI still ends up with a link into the extract, which still dangles after reboot. Making that durable means copying or hardlinking the sidecar out of the extract — a bigger behavior change than this bug needs, and worth its own issue.
The link directory and the ephemeral roots are now parameters of an inner
ensure_cli_symlink_in, so the new tests drive the realremove_file/symlinkwrites against a temp tree instead of restating the branch logic (the pre-existing tests could not call the function at all, because the link directory came straight fromdirs::home_dir()).Related issue
Fixes #6110
Duplicate search: none found.
ensure_cli_symlinkin PR search returns only merged #1357 and #1587; no open PR references #6110. Closest open issue is #3471 (the installer GUI wrapper namedbuzz), a different failure that the reporter also called out.Testing
cargo test --manifest-path desktop/src-tauri/Cargo.toml --lib nest::→ 46 passed, 0 failed (2490 filtered out), including the 8 new cases:ensure_cli_symlink_keeps_durable_link_when_bundle_is_ephemeral— the reported bug: on currentmaintheis_symlinkbranch removes and recreates the link unconditionally, so it ends up naming the extract.ensure_cli_symlink_refreshes_link_when_bundle_is_durable— guards fix: unconditionally replace CLI symlink on boot #1357's behavior.ensure_cli_symlink_creates_link_for_ephemeral_bundle_when_absentensure_cli_symlink_leaves_regular_file_alone_for_ephemeral_bundlekeeps_durable_relative_cli_symlink_when_bundled_cli_is_ephemeral— relative link targets resolve against the link's own directory.retargets_dangling_cli_symlink_when_bundled_cli_is_ephemeralretargets_stale_ephemeral_cli_symlink_when_bundled_cli_is_ephemeralephemeral_exe_roots_always_include_tmp_and_process_temp_dirrustfmt --checkclean on both touched files./Applicationsis durable and takes the unchanged path.