-
Notifications
You must be signed in to change notification settings - Fork 49
feat: Refactor to support generalised directory symlink traversal #852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks so much for going ahead and refactoring Rex! Appreciate it a lot. Added a few comments, but minor nits + maybe adding more tests.
isWhiteout: false, | ||
mode: filePermission, | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can add another test that checks for symlink directories? Unless I missed that somewhere. Ex:
{
name: "open file that is symlinked via directory from filled tree",
chainfs: populatedChainFS,
path: "/symlink-dir/foo,
// "/symlink-dir" resolves to "/dir1", so we should get the virtual file with path "/dir1/foo"
wantVirtualFile: &virtualFile{
virtualPath: "/dir1/foo",
isWhiteout: false,
mode: filePermission,
},
},
In the setUpChainFS
function, we can define another virtual file:
"/symlink-dir": &virtualFile{
virtualPath: "/symlink-dir",
isWhiteout: false,
mode: fs.ModeSymlink,
targetPath: "/dir1",
},
We could also go another step further and add multiple directory symlinks tests? We could add that on another PR given there's already lots of moving parts here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reused the symlink dir to /dir2
, and then added some more test cases. PTAL! (fyi if you didn't know, you can filter by changes since last review)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for covering those cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
isWhiteout: false, | ||
mode: filePermission, | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for covering those cases.
This PR enables full symlink directory traversal, and sets up the code to make it easier to implement ReadLinkFS in the future.
Here's the list of specific changes:
Node
intoRootNode
andNode
.Some of this might need to be refactored back out, if we need to implement Readlink, as during symlink resolving, we will need to differentiate the final file being a symlink, vs the directories on the way to the file being symlinks. Since currently we don't exactly need the functionality of the full readlink, I'll leave it as is for now.