fix(plugins): cd into mktemp before git clone to survive dead cwd#2343
Open
Mic92 wants to merge 1 commit intonoctalia-dev:mainfrom
Open
fix(plugins): cd into mktemp before git clone to survive dead cwd#2343Mic92 wants to merge 1 commit intonoctalia-dev:mainfrom
Mic92 wants to merge 1 commit intonoctalia-dev:mainfrom
Conversation
If noctalia-shell's working directory is deleted while it runs (started from a temp dir, dotfiles manager relinks the launch dir, ...), the plugin fetch/install subprocesses inherit that dead cwd and git fails with: shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory With stderr sent to /dev/null this surfaced only as 'Empty response from <source>' — no hint at what went wrong. Extract a small sparseCloneCmd() helper that both fetch and install use. It cds into the mktemp dir before running git (so the dead cwd doesn't matter) and leaves stderr for the caller to collect. Both callers now capture stderr and include it in their error log/callback.
fc0f467 to
9fba099
Compare
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.
Motivation
If
noctalia-shell's working directory is removed while it runs (started from a temp dir, dotfiles manager relinks the launch dir,cdinto a since-deleted build tree, ...), the plugin fetch/install subprocesses inherit that dead cwd andgitfails with:With stderr redirected to
/dev/nullthis surfaced only asEmpty response from <source>— no hint at the actual cause, which made it look like a network/manifest problem.This PR:
sparseCloneCmd()helper shared by fetch and install thatcds into themktempdir before runninggit, so the inherited cwd no longer matters;Type of Change
Related Issue
Testing
Reproduced by launching
noctalia-shellfrom a directory, removing that directory, then triggering a plugin fetch from the UI. Before:Empty response from <source>. After: fetch succeeds; if git itself fails, its stderr is shown in the log/toast.Screenshots / Videos
n/a (no visual change)
Checklist
Additional Notes
Happy to split the stderr-surfacing into a separate PR if you'd prefer the cwd fix on its own.