Skip to content

fix: fall back to an absolute path when relpath crosses drives - #9268

Open
MohammedAlkindi wants to merge 1 commit into
aws:developfrom
MohammedAlkindi:fix/relpath-cross-drive
Open

fix: fall back to an absolute path when relpath crosses drives#9268
MohammedAlkindi wants to merge 1 commit into
aws:developfrom
MohammedAlkindi:fix/relpath-cross-drive

Conversation

@MohammedAlkindi

Copy link
Copy Markdown

Fixes #3474.

os.path.relpath raises ValueError across drives, so sam build crashes when the template and build directory are on different ones. _resolve_relative_to now falls back to the absolute path, as @wchengru suggested. Only the crashing case changes.

  • Review the generative AI contribution guidelines
  • Add type hints to new functions/methods
  • Write/update unit tests
  • Write design document if needed
  • Write/update integration tests
  • Write/update functional tests if needed
  • make pr passes
  • make update-reproducible-reqs if dependencies were changed
  • Write documentation

Unchecked items do not apply here. Not full make pr: black, ruff and mypy are clean, and the three affected suites go 259 to 260 passed, same 3 pre-existing symlink failures. skipIf-guarded, so your windows-latest matrix runs it.

AI-assisted; I reproduced the crash and ran the tests myself.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

os.path.relpath raises ValueError when the two paths are on different
drives or UNC mounts, so _resolve_relative_to crashed sam build whenever
the template and the build directory were not on the same drive. Return
the absolute path in that case, which is what a relative path cannot
express anyway.

Closes aws#3474.
@MohammedAlkindi
MohammedAlkindi requested a review from a team as a code owner September 9, 2026 20:44
@github-actions github-actions Bot added pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SAM Build: path is on mount 'D:', start on mount 'C:'

1 participant