Shorten cache filenames to fit eCryptfs 143-byte NAME_MAX#566
Open
Chessing234 wants to merge 1 commit intoallenai:mainfrom
Open
Shorten cache filenames to fit eCryptfs 143-byte NAME_MAX#566Chessing234 wants to merge 1 commit intoallenai:mainfrom
Chessing234 wants to merge 1 commit intoallenai:mainfrom
Conversation
url_to_filename() was appending the full trailing URL path component (e.g. tfidf_vectors_sparse.npz) to the hash-based filename, producing names up to 154 characters. This exceeds the 143-byte NAME_MAX on eCryptfs-encrypted filesystems, causing OSError: File name too long. Now only the file extension is preserved (e.g. .npz), keeping the worst-case filename (including .json sidecar) under 143 bytes. _find_existing_cache_file() matches both old and new filename formats for backward compatibility. Fixes allenai#539 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
url_to_filename()was appending the full trailing URL path component (e.g.tfidf_vectors_sparse.npz) to the hash-based filename, producing names up to 154 charactersOSError: [Errno 36] File name too long.npz), keeping the worst-case filename (including.jsonmetadata sidecar) under 143 bytes_find_existing_cache_file()matches both old-format and new-format filenames for backward compatibility — existing caches continue to workFixes #539, related to #447
Changes
scispacy/file_cache.py:url_to_filename()now appends only the file extension instead of the full trailing path component; added_find_existing_cache_file()helper that supports both old and new filename formatstests/test_file_cache.py: Added test verifying all actual scispacy linker URLs produce filenames under the 143-byte limitTest plan
python -m pytest tests/test_file_cache.py -vpasses🤖 Generated with Claude Code