Repository navigation
Conversation
This branch has not been deployed
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.
Problem
pkg/fs.MkdirAll0treated everyEEXISTfromMkdiras success whenexistOKwas true.EEXISTalso occurs when a regular file occupies the target path. The call reported success while the file remained in place. A caller that then tried to create a child under that path gotENOTDIRlater.The Python SDK's
Client.makedirs(path, exist_ok=True)forwards the flag throughlibjfsand returned normally in this case. For example, after creating/fileas a regular file,client.makedirs("/file", exist_ok=True)appeared to create or confirm a directory. The SDK now raisesOSErrorwitherrno.ENOTDIRat themakedirscall.Change
On
EEXISTwithexistOK=true, look up the original path withStatand accept it if it resolves to a directory. ReturnENOTDIRfor a non-directory and propagate lookup failures such asEACCES. If the lookup returnsENOENT, keep the creation errorEEXIST, as with a dangling symlink. Update the Python SDK docstring to describe the error.Validation
Ran the Python SDK against separate
libjfsbuilds from before and after the fix on macOS arm64 with Python 3.14, SQLite metadata and local file storage./filewas a regular file,/dirwas a directory and/linkpointed to/file.makedirs('/file', exist_ok=True)OSError,errno.ENOTDIRmakedirs('/file/', exist_ok=True)OSError,errno.ENOTDIRmakedirs('/link', exist_ok=True)OSError,errno.ENOTDIRmakedirs('/dir', exist_ok=True)makedirs('/file/child', exist_ok=True)OSError,errno.ENOTDIROSError,errno.ENOTDIRmakedirs('/file')ormakedirs('/dir')with the defaultexist_ok=FalseOSError,errno.EEXISTOSError,errno.EEXISTBoth builds left
/fileas a regular file with its original contents.TestLastComponentcases failed before the fix and passed after it. They also cover directory symlinks, dangling symlinks and lookup permission errors.go test ./pkg/fs ./pkg/gateway ./pkg/sync ./sdk/go -count=1passed.make test.pkgcould not complete locally because the Gluster build requirespkg-config.