-
Notifications
You must be signed in to change notification settings - Fork 5
Failures on Windows #13
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
Comments
@jaraco ping re https://github.com/jaraco/path.py which depends on this. |
@jayvdb does it make any sense to even try to run this on Python 3? IMHO the native fsencode/fsdecode should be used there and not the backport. Furthermore, IMHO the whole bytes vs. unicode is a not an issue on Windows as long as you always feed unicode to path operations. |
https://github.com/PiDelport/backports.os/blob/master/.travis.yml has lots of Python 3 targets, so I added one to AppVeyor. However I am more concerned about the Python 2 results. One approach would be for these functions to reject bytes as inputs on Windows, and the relevant tests to be disabled. That would at least show whether all of the errors are bytes related, or if some are also present when unicode is used. |
It is failing to roundtrip unicode->fs->unicode on Windows, which is the core functionality needed for any sane Python 2 code which is mostly working in unicode and only switching to bytes when necessary. |
In jayvdb@5975cd0 I split the os tests, and remove the extra tests, so it is easier to see the main problem. Results at https://ci.appveyor.com/project/jayvdb/backports-os/builds/23554348/job/ak61ymmy6ej40erp In short backports.os.fsdecode(backports.os.fsencode(u'unicode\u0141')) != u'unicode\u0141' As a result, the safest thing to do is not use this backport library on Windows until someone digs into these problems. It is useful on Linux, but it has marginal/negligible benefits on Windows/etc and it is better to just not use these backported functions on Windows, instead always use unicode when interacting with the FS functions as @pombredanne explains above, or use the routines we used to use before os.fsencode/decode, as explained at https://github.com/henrysher/duplicity/blob/4ac4322/duplicity/util.py (fwiw, they have a decent collection of homegrown backports, e.g. https://github.com/henrysher/duplicity/blob/master/duplicity/tempdir.py , and file ops e.g. https://github.com/henrysher/duplicity/blob/master/duplicity/selection.py) And someone should check this backport on Mac and other platforms before using it on those platforms too. |
In my experience, macOS and Windows do handle Unicode filenames well, and it's only on Linux that bytes handling is still relied upon, so I agree with the instinct. What I'd really like is for the interface, whatever it is, to be uniform. It shouldn't be the responsibility of each client to write Looking at the stdlib on Python 3.7.3, I see this on macOS:
Similar on Windows:
So if the backport isn't handling those conditions similarly, that does seem like a bug to me. |
Could someone on macos try |
@jayvdb https://dev.azure.com/tech-alchemy/backports.os/_build/results?buildId=3 I set up an azure pipeline for this, as @jaraco rightly pointed out (and he would definitely know this as well as anyone, go look at some of the libraries he has written) this is just an implementation bug. |
- Mirrors the new python 3.7 implementation - Taken from `vistir` (my other library) -> discussion over at sarugaku/vistir#54 - Fixes PiDelport#13 - Fixes PiDelport#6 (I think?) Signed-off-by: Dan Ryan <[email protected]>
Here's what I see on macOS on Python 3.4 and 2.7:
|
@techalchemy master...techalchemy:bugfix/os-fs-encode is looking really good . https://dev.azure.com/tech-alchemy/backports.os/_build/results?buildId=8 has most problems fixed except for Python 3 on Windows. 👍 |
- Mirrors the new python 3.7 implementation - Taken from `vistir` (my other library) -> discussion over at sarugaku/vistir#54 - Fixes PiDelport#13 - Fixes PiDelport#6 (I think?) Signed-off-by: Dan Ryan <[email protected]>
Copying the same .appveyor.yml from PiDelport/backports.test.support#5 exposes lots of Windows failures.
e.g. py27 https://ci.appveyor.com/project/jayvdb/backports-os/build/job/6kr6vh0cirw1kos5
And extras
test_text_roundtrip
,test_encode_surrogates
&test_decode_surrogates
On Python 3.6
test_decode_binary
andtest_encode_text
fail.The text was updated successfully, but these errors were encountered: