Skip to content

fix: use absolute_path() when computing workspace root to preserve symlinks#5059

Merged
baszalmstra merged 2 commits intoprefix-dev:mainfrom
claydugo:fix-symlink-workspace-root
Dec 4, 2025
Merged

fix: use absolute_path() when computing workspace root to preserve symlinks#5059
baszalmstra merged 2 commits intoprefix-dev:mainfrom
claydugo:fix-symlink-workspace-root

Conversation

@claydugo
Copy link
Contributor

@claydugo claydugo commented Dec 4, 2025

Description

Turns out my fix in #4912 was incomplete
I missed a second spot where the path gets canonicalized.

The absolute_path() method I added does the right thing, but Workspace::from_manifests() was still calling
dunce::canonicalize() directly on the manifest path before computing the workspace root.

This PR makes the workspace code use absolute_path() instead, which actually fixes the dotfiles workflow I
was trying to support in the first place.

I added a test that specifically verifies the workspace root ends up in the right place when using a
symlinked manifest but happy to remove or consolidate somehow (could use guidance here) if thats better.

Fixes the remaining issue from #4907.

How Has This Been Tested?

$ /home/clay/git/forks/pixi/target/pixi/release/pixi --version
pixi 0.60.0-fix-symlink-9942be0f

$ ls -la ~/pixi.toml
lrwxrwxrwx - clay  3 Dec 18:52 /home/clay/pixi.toml -> /home/clay/dotfiles/pixi.toml

$ /home/clay/git/forks/pixi/target/pixi/release/pixi run python -c "import sys; print('sys_executable', sys.executable); print('sys_exec_prefix', sys.exec_prefix)"
sys_executable /home/clay/.pixi/envs/default/bin/python
sys_exec_prefix /home/clay/.pixi/envs/default

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools: Claude Opus 4.5

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added sufficient tests to cover my changes.
  • I have verified that changes that would impact the JSON schema have been made in schema/model.py.

…mlinks

The fix in prefix-dev#4912 for symlinked manifest paths was incomplete. While
ManifestProvenance::absolute_path() correctly preserves symlinks by
only canonicalizing the parent directory, the Workspace::from_manifests()
function was re-canonicalizing the entire manifest path, which resolved
the symlink and caused the .pixi directory to be created in the wrong
location.

This change uses absolute_path() instead of dunce::canonicalize() when
computing the workspace root, ensuring that symlinked pixi.toml files
work correctly in dotfiles workflows.

Fixes the remaining issue from prefix-dev#4907.

fixup

lint
@baszalmstra
Copy link
Contributor

Thanks for the followup!

@baszalmstra baszalmstra enabled auto-merge (squash) December 4, 2025 10:29
@baszalmstra baszalmstra merged commit 1d0c5cb into prefix-dev:main Dec 4, 2025
38 checks passed
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.

2 participants