Skip to content

fix(plugins): cd into mktemp before git clone to survive dead cwd#2343

Open
Mic92 wants to merge 1 commit intonoctalia-dev:mainfrom
Mic92:plugin-fetch-diagnostics
Open

fix(plugins): cd into mktemp before git clone to survive dead cwd#2343
Mic92 wants to merge 1 commit intonoctalia-dev:mainfrom
Mic92:plugin-fetch-diagnostics

Conversation

@Mic92
Copy link
Copy Markdown

@Mic92 Mic92 commented Mar 29, 2026

Motivation

If noctalia-shell's working directory is removed while it runs (started from a temp dir, dotfiles manager relinks the launch dir, cd into a since-deleted build tree, ...), 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 redirected to /dev/null this surfaced only as Empty response from <source> — no hint at the actual cause, which made it look like a network/manifest problem.

This PR:

  • extracts a small sparseCloneCmd() helper shared by fetch and install that cds into the mktemp dir before running git, so the inherited cwd no longer matters;
  • stops discarding stderr and includes it in the error log/callback so future failures are diagnosable.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring

Related Issue

  • n/a

Testing

  • Tested on niri
  • Tested on Hyprland
  • Tested on sway
  • Tested with different bar positions and density settings
  • Tested at different interface scaling values
  • Tested with multiple monitors (if applicable)

Reproduced by launching noctalia-shell from 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

  • Code follows project style guidelines
  • Self-reviewed my code
  • No new warnings or errors
  • Documentation or comments updated (if relevant)

Additional Notes

Happy to split the stderr-surfacing into a separate PR if you'd prefer the cwd fix on its own.

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.
@Mic92 Mic92 force-pushed the plugin-fetch-diagnostics branch from fc0f467 to 9fba099 Compare April 21, 2026 17:57
@Mic92 Mic92 changed the title PluginService: survive dead cwd and surface git errors fix(plugins): cd into mktemp before git clone to survive dead cwd Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant