-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Ensure the ino we give to readdir matches the ino we give to stat #23139
Ensure the ino we give to readdir matches the ino we give to stat #23139
Conversation
Fix problem with directory permissions
Okay I updated this again, but now it conflicts with #23058, like several other changes I want to make. So ideally we should merge that one first and then I can update this PR to reflect those changes. |
This rule was lost in the recent switch from flake8. This change brings back that rule which is currently in preview in ruff. See #23139 (comment)
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 wonder if we can make this test part of an existing readdir
test that than being its own one? Maybe not.. but just a thought.
LGTM % comments
Maybe |
|
Yes we should fix that. Perhaps add a comment to this new test that it should be merges one day if possible. |
Okay I think I addressed all the comments here. |
This rule was lost in the recent switch from flake8. This change brings back that rule which is currently in preview in ruff. See emscripten-core#23139 (comment)
It seems that if the node working directory does not have execute permissions, this makes |
IIRC that is exactly what the execute bit on a directory means: "can this directory be listed" |
void setup() { | ||
// If the node working directory does not have execute permissions, then | ||
// `fs.readdir` will fail. For that reason we have to work in a subdirectory | ||
// and remove execute permissions from that. |
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 don't understand.. fs.readdir
should fail on any directory that doesn't have the execute bit set, regardless of weather that is CWD or a sub directory, right?
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.
Apparently not.
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 suppose I can drop the chmod, but cding into a subdirectory does fix the test, at least when I run it locally. I don't really have a clear theory as to why since it seems a bit illogical.
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.
Ah, yes, I misremembered. The x
bit is about traversing the heirachy, not list-ability. You can list directory than don't have the x
bit set. That is what the r
bit is for.
If we stat a file in the nodefs it gives a different value for the inode than if we use readdir. Readdir gives the inode in the host file system, stat gives the inode in the native file system. Ideally they should agree about what the inode is.