Skip to content
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

Added '.' and '..' special folder t WASI fd_readdir return (for #3033) #3065

Merged
merged 1 commit into from
Aug 3, 2022

Conversation

ptitSeb
Copy link
Contributor

@ptitSeb ptitSeb commented Aug 2, 2022

Description

Simply adding "." and ".." to the returnned list from an WASI::fd_readdir call

@syrusakbary
Copy link
Member

This should fix #3033

Comment on lines +1326 to +1327
entry_vec.push((".".to_string(), __WASI_FILETYPE_DIRECTORY, 0));
entry_vec.push(("..".to_string(), __WASI_FILETYPE_DIRECTORY, 0));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ummm... what about the root? We shouldn't add .. to readdir in the root.
Can you also add a test case for this? Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But, isn't Root the next match here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, side comment. Do you have insight on why our fix is quite different from wasmtime's one?

https://github.com/bytecodealliance/wasmtime/pull/2494/files#diff-df2ef1370349b8385454adfabfe871fc51fd3c12debc7b0691b98ca19c5724deR309-R335

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I hesitated is adding "." to a root readdir

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the root cause was completly different: it's not a buffer size issue here, it's the missing "." and "..". All the 201 folder appears correctly, just missing the special folders

Copy link
Contributor Author

@ptitSeb ptitSeb Aug 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So no, adding "." to fd_readdir of root is a bad idea, it breaks things (tests that read root).

@@ -1321,6 +1321,10 @@ pub fn fd_readdir<M: MemorySize>(
(entry.name.to_string(), stat.st_filetype, stat.st_ino)
}),
);
// adding . and .. special folders
// TODO: inode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this TODO?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as line 1310

@syrusakbary syrusakbary merged commit e2de53c into master Aug 3, 2022
@bors bors bot deleted the fix_add_special_folders_to_readdir branch August 3, 2022 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants