fix windows "file:" URLs, re-enable windows CI
See there: https://github.com/borgbackup/borgstore/issues/82
Re-enable windows CI after fixing this.
This was fixed in borgstore recently.
Windows: file:/// + full windows path including drive letter (using fwd slashes)
Everything else: file:// + full absolute path, starting with a slash
There are two issues with this fix for windows:
- it expects the first slash (after the drive letter) to be
/; because ofabspath, this will always be\ - it expects
file:///(three slashes) but because of this, paths will start with the drive letter; basically, the file URI scheme is better thought asfile://<host><path>, where<path>must always start with/(true for absolute POSIX paths, not for windows paths!)
Changing
windows_file_regex = r"""
file:// # only empty host part is supported.
(?P<drive_and_path>([a-zA-Z]:[/\\].*)) # path must be an absolute path.
"""
makes it work. ([a-zA-Z]:[/\\] is roughly the windows equivalent of /, i.e. is what determines whether a path is absolute.)
I can make a PR to borgstore if you'd like.
Hi Valtron, thanks for helping with the windows stuff.
Yes, improvements for borgstore (first) and borg (second) so that it works on windows would be great.
I just added Windows CI testing for borgstore and there is a failing test now visible in CI. Maybe that is related and should be fixed first.
In general, I think in URLs, there are always forward slashes (including on Windows), see https://en.wikipedia.org/wiki/File_URI_scheme .
Also, guess quite some code in borg expects forward slashes in paths and URLs also.
Please try to make a minimal good fix in borgstore first, thanks!
@valtron can we close this, did you test the recent borg/borgstore code?
I've had no issues with paths and file: urls, but as for the CI, there are still tests failing/erroring on windows.
I have enabled the windows CI tests in PR #9170 and a lot of tests are failing with:
ValueError: Invalid location format: "file://D:/a/_temp/msys64/tmp/..."
https://github.com/borgbackup/borg/actions/runs/19305612385/job/55212157157?pr=9170
That's weird that only 25 fail in the CI, I have >10x as many failures locally so I can't say for sure it's fixed, but anyway here's a PR that might fix the file: failures.
@valtron Because the remote tests are all broken, the CI runs: python -m pytest -n4 --benchmark-skip -vv -rs -k "not remote".