Skip to content

Fix path resolution to dpd for MacOS#10098

Open
k-cross wants to merge 1 commit intooxidecomputer:mainfrom
k-cross:dpd-path
Open

Fix path resolution to dpd for MacOS#10098
k-cross wants to merge 1 commit intooxidecomputer:mainfrom
k-cross:dpd-path

Conversation

@k-cross
Copy link

@k-cross k-cross commented Mar 19, 2026

First of all, sorry if this is noise. I was trying to get a better understanding of omicron and had trouble running it through the simulated environment. If there is a different process I should use for PRs, I'm willing to go through that too, but might need to be pointed to a doc I missed.

On macOS, std::env::current_exe() does not resolve symlinks.

The dendrite-stub download creates a symlink:

  • out/dendrite-stub/bin -> out/dendrite-stub/root/opt/oxide/dendrite/bin
  • dpd's built-in infer_p4_dir() walks up from its path expecting .../opt/oxide/dendrite/bin/dpd, but through the symlink it sees ".../dendrite-stub/bin/dpd and fails.

The real dpd path is resolved and then derive P4_DIR from it to bypass this.

I couldn't run the tests locally due to issues pointed out in docs already about trying this on MacOS. Thanks for your time!

@david-crespo
Copy link
Contributor

If I’m understanding the issue correctly, my workaround for this has been to add the directory to my path.

https://github.com/david-crespo/dotfiles/blob/2c704013a781968bbc1845ede4054ebc7ddee539/.zprofile#L284

It would certainly be nice not to have to do that. In theory, the .envrc also does this but I haven’t been able to get it to work. I’ll take a look at this.

@david-crespo
Copy link
Contributor

Actually this might explain why the .envrc never worked for me — it relies on the symlink path, while my PATH thing does straight to the real thing.

@david-crespo
Copy link
Contributor

david-crespo commented Mar 19, 2026

I looked into why it's a symlink in the first place. Before #2904 (April 2023), the dendrite stub was unpacked so that out/dendrite-stub/bin/dpd was the real binary. In #2904, dendrite was updated so that dpd infers P4_DIR by walking up from its own executable path. This required preserving the full root/opt/oxide/dendrite/... directory structure from the tarball (previously the download script flattened it).

The symlink out/dendrite-stub/binout/dendrite-stub/root/opt/oxide/dendrite/bin was added so that existing PATH entries (including the .envrc) would keep working. So the symlink is backwards compat for a directory layout change from 2023. It has probably never worked on mac without the real dir in the path. Before #9312 I used a script that I shared with people that would build dpd from source, and it included a recommendation to add the bin dir to PATH.

I suspect the cleanest fix would be to remove the symlink altogether and update .envrc and env.sh to point at the real path (out/dendrite-stub/root/opt/oxide/dendrite/bin) and just make everyone update their stuff. I will have to see if other people find this tolerable.

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