fix: fall back to an absolute path when relpath crosses drives - #9268
Open
MohammedAlkindi wants to merge 1 commit into
Open
fix: fall back to an absolute path when relpath crosses drives#9268MohammedAlkindi wants to merge 1 commit into
MohammedAlkindi wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3474.
os.path.relpathraisesValueErroracross drives, sosam buildcrashes when the template and build directory are on different ones._resolve_relative_tonow falls back to the absolute path, as @wchengru suggested. Only the crashing case changes.make prpassesmake update-reproducible-reqsif dependencies were changedUnchecked items do not apply here. Not full
make pr:black,ruffandmypyare clean, and the three affected suites go 259 to 260 passed, same 3 pre-existing symlink failures.skipIf-guarded, so yourwindows-latestmatrix 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.