-
Notifications
You must be signed in to change notification settings - Fork 11
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
add check for case collision intollerance #49
Comments
bids-standard/bids-specification#858 has been merged, so the corresponding check in the validator could/should be worked on. Suggestions on where to start would be very welcome @rwblair :-) |
I think we need to think through the logic of the check before we worry about where to implement. Here's a proposal that only cares about collisions within directories: def check_dir(dirname):
files = listdir(dirname)
if len(set(fname.lower() for fname in files)) != len(files):
# report collision
for fname in files:
if isdir(fname):
check_dir(fname) It should catch colliding subjects, but not something like Here's another edge case: |
Since the issue is relatively rare, I think it might suffice to just operate on a full list of files/directories in the dataset def check_paths(paths):
lowered = defaultdict(list)
for path in paths:
path = path.rstrip('/') # just to harnomize among possible directories with/without trailing /?
lowered[path.lower()].append(path)
for lower, origs in lowered.items():
if len(origs) > 1:
# report/return collision for `origs` -> `lower` note: paths better not to be "dereferenced" (so git-annex'ed symlinks remain symlinks) |
Regardless of if the validator is run via browser or node we create a dictionary with all the files as keys in the There is precedent for some validation happening in the . |
Would either of these checks catch @mattcieslak's motivating use case? |
This check should consider ignored files, so it will need to be near the start of fullTest before they are removed. |
In our case there were two subjects that had the same ID but with different capitalization (sub-ndar, sub-NDAR) in the root bids directory. All the files within their directories matched the case of their subject directory name |
"not sure" it should anyhow consult ignored files -- the problem from the collisions happens at the filesystem level, so even if e.g. |
original proposal as a PR in BIDS: bids-standard/bids-specification#858 seems to be getting approved and if merged soon will enter a release after v1.6.0-203-g811e17e2 ,
The text was updated successfully, but these errors were encountered: