Skip to content

[Nexthop] Resolve symlinks for dotfiles when mounting into build container#1239

Open
zackary-nexthop wants to merge 2 commits into
facebook:mainfrom
nexthop-ai:no-nos-resolve-symlinks-dotfiles-when
Open

[Nexthop] Resolve symlinks for dotfiles when mounting into build container#1239
zackary-nexthop wants to merge 2 commits into
facebook:mainfrom
nexthop-ai:no-nos-resolve-symlinks-dotfiles-when

Conversation

@zackary-nexthop

Copy link
Copy Markdown

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

Running docker-build.py currently fails for users who manage their dotfiles via symlinks. During the bind-mount setup, the Docker daemon calls MkdirAll() on the source path without following symlinks. Because it sees the symlink as a non-directory, it attempts to mkdir over it, resulting in a "file exists" crash.

This PR fixes the issue by using os.path.realpath() to resolve the host path to its canonical directory before passing it to the Docker daemon.

Also includes a pre-commit lint cleanup of docker-build.py (typing imports, explicit subprocess.run(..., check=False), snake_case locals) in a separate commit, required to satisfy pre-commit run on the modified file.

Test Plan

With this change, the script executed successfully without the "file exists" error, and the dotfiles were correctly mounted inside the container.

pre-commit run --files fboss/oss/scripts/docker-build.py passes clean.

@meta-cla

meta-cla Bot commented May 28, 2026

Copy link
Copy Markdown

Hi @zackary-nexthop!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@zackary-nexthop zackary-nexthop marked this pull request as ready for review May 29, 2026 16:02
@zackary-nexthop zackary-nexthop requested a review from a team as a code owner May 29, 2026 16:02
@meta-cla

meta-cla Bot commented May 29, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed label May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant