check_file_permissions: probe inside target store, not its parent (#1098)#1676
Merged
LOCEANlloydizard merged 2 commits intoJun 9, 2026
Conversation
The probe path uses fsspec's forward-slash convention, so on Windows the parent-dir assertion compared '/'-separated paths against os.sep '\\'. Normalize both sides before comparing.
Collaborator
|
Hi @gaoflow, thanks! the fix and tests both look good to me! cheers! |
LOCEANlloydizard
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1098.
Problem
check_file_permissionswrites its probe file to the parent of the target directory instead of the target itself when given anFSMap(the zarr/cloud path). As reported in #1098, for a target of.../combined_filesthe probe was created at.../:This means the permission check validates the wrong directory, and (when parent and target permissions differ) can pass or fail incorrectly.
Cause
The
FSMapbranch usedbase_dir = os.path.dirname(FILE_DIR.root), which strips the last path component, so the probe lands one level up. ThePath/strbranch right below it correctly writes inside the target (andmkdir(parents=True)first).os.path.dirnamewas presumably used because the target store may not exist yet (e.g. a not-yet-written zarr store), and writing inside a missing directory raises — but that's exactly the case thePath/strbranch already handles by creating the directory first.Fix
Write the probe inside
FILE_DIR.rootandmakedirs(..., exist_ok=True)first, mirroring thePath/strbranch. This keeps the check on the actual target and still works when the store doesn't exist yet (it gets created, as the local-path branch already does).Tests
Added two regression tests (red before, green after):
test_check_file_permissions_fsmap_writes_inside_target— the probe is opened inside the target store, not its parent.test_check_file_permissions_fsmap_creates_missing_store— a not-yet-created store is created and passes the check.Full
test_utils_io.pypasses (47 passed, 2 xfailed).