Repository navigation
FileSystem: a file system is named only at the start of a filename - #28
Merged
Merged
Conversation
getFilePath() and fsMutex() took "local/" or "sd/" anywhere in a filename as naming the file system, so "logs/sd/x.csv" on the local file system was opened as /logs/sd/x.csv (not /local/logs/sd/x.csv), and because fsMutex() checked "sd/" first, a local file in a folder called sd was written holding the SD card's lock rather than the local one. fileSystemNamedIn() recognises "local" or "sd" only at the start of the name (after an optional /), followed by / or nothing, and both use it, so the path and the lock always agree. Clients that name the file system send "/<fs>/<path>" (RaftCLI, raftjs), which is unchanged. Co-Authored-By: Claude Opus 5.5 <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
getFilePath()andfsMutex()tooklocal/orsd/anywhere in a filename as naming the file system:sdon the local file system was looked up at the wrong path. For example,filehash/local/test~sd~x.txtlooked for/test/sd/x.txt, not/local/test/sd/x.txt.fsMutex()checkedsd/first, so a local file in a folder calledsdwas written holding the SD card's lock rather than the local one.The new
fileSystemNamedIn()recogniseslocalorsdonly at the start of the name, after an optional/, followed by/or nothing.getFilePath()andfsMutex()both use it, so the path and the lock always agree. Clients that name the file system send/<fs>/<path>(RaftCLI, raftjs), which is unchanged.Testing
New
test_file_system_paths(Linux), covering:local/a,/sd/a, the baresd;logs/sd/x.csv,/data/local/x,backup/nonlocal/x,sdcard/x.make checkpasses.On an Axiom:
test/sd/x.txtwith RaftCLIfileread/local/test~sd~x.txtfilehashcheck gotnofilenofile🤖 Generated with Claude Code