Skip to content
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: copyfile()/symlinks on Linux, Matlab < R2020a #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

octomike
Copy link

@octomike octomike commented May 10, 2020

I tried running the SPM container on ds000001 which I pulled with datalad. It turns out that datalad is using symbolic links for the images in anat/ and func/ etc pointing to a .git-annex folder two levels above.

Unfortunately, copyfile() on Linux with Matlab <= 2019b does not dereference the file and when SPM is copying a relative symlink to the tmp/output folder, the link breaks.

This PR is checking if we are on Linux on Matlab < 2020a (with an ugly versioncmp hack) and uses system('cp -rL...') instead of copyfile().

Also, as I mention in the comment, it would probably be much nicer to keep the symbolic links for all platforms, but I'm having a hard time coming up with a portable solution for that. And I'm also not entirely sure this is compatible with SPM's behavior (would it modify source files in that case?)

@gllmflndn
Copy link
Collaborator

There is now a function spm_copy that could be used in spm_BIDS_App.m. The issue with symbolic links could then be dealt with there (spm_check_version might come handy) or we could just switch to the MATLAB Runtime R2020a as you mention.
It seems safer to make hard copies as sources could be modified.

@octomike
Copy link
Author

Okay, cool. So should I just revert the changes and change copyfile() to spm_copy() and leave this here until spm_copy is updated?

@gllmflndn
Copy link
Collaborator

Yes, spm_copy is just a wrapper around copyfile but it will also uncompress and move sidecar .json files as well. I will look building a new SPM12 standalone with R2020a that we could use here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants