Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix[ux]: fix relpath compiler panic on windows #4228

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

charles-cooper
Copy link
Member

fix a bug where relpath raises an exception on window, when the source path and the destination path are on different drives.

What I did

fix #4227

How I did it

How to verify it

Commit message

Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

fix a bug where relpath raises an exception on window, when the source
path and the destination path are on different drives.
Copy link

codecov bot commented Sep 6, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 90.36%. Comparing base (9a208a6) to head (7ba1972).

Files with missing lines Patch % Lines
vyper/utils.py 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4228      +/-   ##
==========================================
- Coverage   91.35%   90.36%   -0.99%     
==========================================
  Files         109      109              
  Lines       15637    15641       +4     
  Branches     3443     3443              
==========================================
- Hits        14285    14134     -151     
- Misses        920     1043     +123     
- Partials      432      464      +32     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

try:
return os.path.relpath(path)
except ValueError:
# on Windows, if path and curdir are on different drives, an exception
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the path be an absolute path in this scenario?

Copy link
Collaborator

@cyberthirst cyberthirst Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I'm not sure about this

the reported issue targeted builtins, which use __path__, which is absolute, and thus, the approach should work. although safe_relpath which returns an abs path is a bit weird

but it might be that a relative path is in search paths, right? And that path could reference a different drive causing the exception. but in that case it's likely a user error?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relpath is also used even if a different search path is used to resolve a path, for instance for error reporting it is used to report relative to the user's current directory. but on windows if you can't construct the relpath, you can't construct the relpath

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.

Panic in Windows when running on different mounts
3 participants