Open mih opened 4 years ago
I have configured my win10 system to support symlinks and I can now replicate this error
This seems to be a problem of the test rather than the underlying tested functionality. The test uses the patter Path(absolute windows path).as_uri()
to generate a file URL. However, that doesn't work, hence we have get_local_file_url()
:
(Pdb) Path(store).as_uri()
'file:///C:/Users/mih/AppData/Local/Temp/datalad_temp_fgdgus62'
(Pdb) get_local_file_url(store)
'file://C/Users/mih/AppData/Local/Temp/datalad_temp_fgdgus62'
(Pdb) get_local_file_url(store, compatibility='git')
'file:///C/Users/mih/AppData/Local/Temp/datalad_temp_fgdgus62'
With this change we get the next error:
[{'action': 'create-sibling-ria',
'message': 'initremote failed.\n'
'stdout: initremote store-storage \n'
'failed\n'
'\n'
'stderr: git-annex: Non-absolute object tree base path '
'configuration: '
'\\C\\Users\\mih\\AppData\\Local\\Temp\\datalad_temp_m0zkr4q8\r\n'
'git-annex: initremote: 1 failed\n',
'path': 'C:\\Users\\mih\\AppData\\Local\\Temp\\datalad_temp_g7onyebf\\ds',
'status': 'error',
'type': 'dataset'}]
This test in ora_remote.py
is wrong. It uses Path(lastsegment of URL).is_absolute()
, but Path
on Windows is WindowsPath
, and the trailing end of a URL will never be a valid absolute windows path.
Using PurePosixPath
for the test makes create-sibling-ria
work on windows.
The previous change wasn't enough to get git annex copy
to work, because the store base path is used to derive all relevant locations from it. Hence stuff like an annex key location was a PurePosixPath
that does not support .exists()
, for example. Explicitly converting to Path
when doing LocalIO
makes git annex copy
work.
Next issue is that the RIA store in the test on windows has a functional annex remote, but no git remote...
Sooo, turns out that
get_local_file_url(store, compatibility='git')
'file:///C/Users/mih/AppData/Local/Temp/datalad_temp_fgdgus62'
"works" but does do what is desired. It actually points to C:\C\Users\mih...
, where as
(Pdb) get_local_file_url(store)
'file://C/Users/mih/AppData/Local/Temp/datalad_temp_fgdgus62'
Really translates to C:\Users\mih...
.
We have to critically examine each use of compatibility='git'
. These wrong path will not lead to any failure in the tests, except when they are tested by other means that the path we generated them from. But they will still be in the wrong place!
I will propose a fix for this in a second, but a complete solution is blocked by datalad/datalad#5134 (i.e. the tests won't pass without this problem being solved too).
It seems all blockers are removed.
is this still an issue?
the test is marked as known failure
❯ git grep -B3 'def test_ria_postclonecfg'
datalad/core/distributed/tests/test_clone.py-# TODO?: make parametric again on _test_ria_postclonecfg
datalad/core/distributed/tests/test_clone.py-@known_failure_windows # https://github.com/datalad/datalad/issues/5134
datalad/core/distributed/tests/test_clone.py-@slow # 14 sec on travis
datalad/core/distributed/tests/test_clone.py:def test_ria_postclonecfg():
so among dozens of other similar ones... is there a point to keep this issue open?
Revealed by datalad/datalad#5080
Possibly same as datalad/datalad#5084.
On a real win10 box this test is skipped with
SKIP: Can't create symlinks
on bothmaint
andmaster
.