-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: don't use op.realpath when reading raw #9227
Conversation
I think it’s the right fix |
@agramfort any idea why |
This looks correct. I agree that all parts of a file need to be in the same folder, symlink or not. I don't see the reason why we resolved symlinks previously, this shouldn't be necessary at all. |
This looks correct. I agree that all parts of a file need to be in the
same folder, symlink or not. I don't see the reason why we resolved
symlinks previously, this shouldn't be necessary at all.
agreed.
Sorry no I don't remember. Maybe @larsoner knows.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@larsoner I let you merge if happy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a regression test for the linked issue, then added a general io
test for the chdir
case I mentioned. It exposed problems in many readers, so I fixed those, too, by making more uniform use of _check_fname
, which always returns an abspath
now.
CIs complain |
Failure is just a timeout, feel free to merge if you're happy @agramfort |
closes #9221
This one-line fix is almost certainly too simplistic and will probably break something, so I'm hoping for some intense scrutiny here. Here's my understanding of the problem and solution(?):
datalad
usesgit-annex
to manage large data files (datalad
is the recommended access method for OpenNeuro, so it's really something we should support)os.path.realpath()
on the filename, so something likesub-01/ses-day1/meg/sub-01_ses-day1_task-AVLearn_run-01_part-01_meg.fif
becomes/home/user/Desktop/test-datalad/ds002598/.git/annex/objects/Xz/5P/MD5E-s2146079382--dca9c1e4ee05b6b32bdcd4b5aef8c9bb.fif/MD5E-s2146079382--dca9c1e4ee05b6b32bdcd4b5aef8c9bb.fif
realpath
-transformed fname.my solution is to just not call
realpath()
. Doing so doesn't seem to hurt much as far as I can tell; I can still load sample data, and after creating a symlink on my desktop to a random.fif
file on another drive, passing the symlink intoread_raw()
loads it just fine.The only case I can think of where this will break something that previously worked, is if you had this:
...and you tried to load the symlink in
bar
. This would fail because now we would look for...part-02...
inbar/
instead of inbar/foo/
. But honestly that seems like an edge case that we shouldn't support anyway --- allowing users to access all parts of a split raw by providing a symlink to just the first part (when symlinks to the other parts aren't also present).