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 path separator on Windows distributions #275

Merged
merged 8 commits into from
Aug 4, 2023

Conversation

andysham
Copy link
Contributor

@andysham andysham commented Jul 20, 2023

Description

I'm experiencing a bug that doesn't allow me to unpack environments on Windows machines, the error presents like so

Screenshot 2023-07-27 at 13 09 01

This reproduction is quite minimal, and it seems to affect all packed files with mode="text", so I can only assume it's caused by a mismatching path separator - the prefix is defined here using the Windows separator \, and the suffix is modified here to use the separator /, resulting in the mismatch. This PR also modifies the prefix in the same manner, so that the entire path uses the separator / in these cases.

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@conda-bot
Copy link
Contributor

We require contributors to sign our Contributor License Agreement and we don't have one on file for @andysham.

In order for us to review and merge your code, please e-sign the Contributor License Agreement PDF. We then need to manually verify your signature, merge the PR (conda/infrastructure#793), and ping the bot to refresh the PR.

@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Jul 21, 2023
@andysham andysham marked this pull request as ready for review July 27, 2023 12:30
@andysham andysham requested review from a team and xhochy as code owners July 27, 2023 12:30
@andysham
Copy link
Contributor Author

andysham commented Jul 27, 2023

The failing test on (macos-latest, 3.8) does not seem related to the change introduced in this PR, it also appears in #271.

@andysham
Copy link
Contributor Author

andysham commented Aug 3, 2023

@jezdez @dbast @kenodegard @jaimergp
Apologies for the notification spam - could any one of you help me in getting this PR merged? Comments are welcome

update_prefix(os.path.join(new_prefix, path), new_prefix,
placeholder, mode=mode)
new_path = os.path.join(new_prefix, path)
if on_win:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if on_win:
if on_win and mode == 'text':

Do we need the same construct here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried this, and found some instances that raised the same error, so I believe now that the issue is more general.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In that case should the other instance of this if clause be adjusted to not have the mode == 'text' check?

Copy link
Contributor Author

@andysham andysham Aug 3, 2023

Choose a reason for hiding this comment

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

Perhaps, although given the failure is rising in particular from open(...), where new_prefix (from this scope) is never used, I would suggest these conversions serve different purposes - I would imagine altering the representation of Windows filepaths to Linux filepaths isn't as well supported in Windows binary applications as in Python. Regardless, I feel more comfortable making the minimal change, and the above change doesn't propagate further than the current Python process.

Copy link
Collaborator

@jaimergp jaimergp left a comment

Choose a reason for hiding this comment

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

Let's give it a try

@jaimergp
Copy link
Collaborator

jaimergp commented Aug 3, 2023

Ugh, this is a bit annoying - that test is part of the "required" test suite and I can't override 😓 We'll have to skip or xfail that particular one.

@jaimergp
Copy link
Collaborator

jaimergp commented Aug 3, 2023

Raised issue at #276

@jaimergp jaimergp merged commit 7312257 into conda:main Aug 4, 2023
17 of 18 checks passed
@andysham
Copy link
Contributor Author

andysham commented Aug 4, 2023

@jaimergp Thanks for helping me get this merged! What would be required before a conda-pack==0.7.1 can be released with this change?

@jaimergp
Copy link
Collaborator

jaimergp commented Aug 4, 2023

I am going to see if there are some "easy wins" in the PR list and try to bundle a few ones together, but let's aim for "whatever we have in main next week". Does that sound reasonable?

@andysham
Copy link
Contributor Author

andysham commented Aug 4, 2023

More than reasonable. Thanks for the help!

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Aug 4, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed [bot] added once the contributor has signed the CLA locked [bot] locked due to inactivity
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants