Skip to content

fix(storage): accept paths in a file store located in the working directory on fsspec before 2024 - #1686

Merged
dimitri-yatsenko merged 1 commit into
masterfrom
fix/file-store-root
Nov 20, 2026
Merged

dimitri-yatsenko merged 1 commit into
masterfrom
fix/file-store-root

Conversation

@dimitri-yatsenko

Copy link
Copy Markdown
Member

master CI fails in two jobs since the last merges. This fixes both.

Minimum dependency versions. fsspec before 2024 leaves . segments in a resolved local path. A file store whose location is "" or "." therefore rejected every path, including paths inside it (data/inside.txt). The location check in StorageBackend._full_path now compares normalized paths (posixpath.normpath on both sides). Stores with any other location were not affected.

The working-directory test in test_path_confinement.py asserted that file: and local: paths are rejected. That holds on current fsspec only: fsspec 2023 does not read some of these forms as a protocol and resolves them to names inside the working directory. The test now checks what the store does with each path: either it is rejected, or it resolves inside the store, and a write and read through it leave the file outside the store unchanged.

Windows unit tests. test_download_into_directory_uses_last_component_only[drive] expected FileNotFoundError for a missing source file. Windows raises OSError (Errno 22) for a source path containing :, so the test now accepts OSError, of which FileNotFoundError is a subclass.

The same change is on maint/2.3 (de9d28a).

Tested locally: the full unit suite with current dependencies and with the CI minimum pins (fsspec 2023.1.0), and the attach, object and hash-storage integration tests on MySQL and PostgreSQL. Windows runs in CI here.

fsspec before 2024 leaves "." segments in a resolved path, so a store whose
location is "" or "." rejected every path, including ones inside it. Compare
normalized paths instead.

The working-directory test now checks what the store does with each path: it
is rejected, or fsspec resolves it inside the store and I/O stays there. Old
fsspec does not read some "file:" and "local:" forms as a protocol, so it
accepts them as names inside the store. The Windows download test accepts
OSError, which Windows raises for a source path containing ":".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants