borg icon indicating copy to clipboard operation
borg copied to clipboard

fix windows "file:" URLs, re-enable windows CI

Open ThomasWaldmann opened this issue 1 year ago • 8 comments

See there: https://github.com/borgbackup/borgstore/issues/82

Re-enable windows CI after fixing this.

ThomasWaldmann avatar Oct 15 '24 18:10 ThomasWaldmann

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

ThomasWaldmann avatar Apr 08 '25 16:04 ThomasWaldmann

There are two issues with this fix for windows:

  • it expects the first slash (after the drive letter) to be /; because of abspath, 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 as file://<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.

valtron avatar Oct 23 '25 00:10 valtron

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!

ThomasWaldmann avatar Oct 23 '25 15:10 ThomasWaldmann

@valtron can we close this, did you test the recent borg/borgstore code?

ThomasWaldmann avatar Nov 11 '25 11:11 ThomasWaldmann

I've had no issues with paths and file: urls, but as for the CI, there are still tests failing/erroring on windows.

valtron avatar Nov 11 '25 18:11 valtron

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

ThomasWaldmann avatar Nov 12 '25 18:11 ThomasWaldmann

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 avatar Nov 14 '25 05:11 valtron

@valtron Because the remote tests are all broken, the CI runs: python -m pytest -n4 --benchmark-skip -vv -rs -k "not remote".

ThomasWaldmann avatar Nov 14 '25 10:11 ThomasWaldmann