Skip to content

Use index rather than telldir/seekdir to represent fd_readdir cookie #298

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

Merged
merged 4 commits into from
May 29, 2025

Conversation

CPunisher
Copy link
Contributor

Fixes: nodejs/node#47193

How telldir and seekdir work depends on the operating system. For example, in ubuntu, telldir returns a relative pos of current dirent iterator. But in macos, telldir returns a self-incrementing counter, which is only valid for one DIR*.

The issue is that every single call to fd_readdir opens and closes the dir, so the cookie becomes invalid on the next call, thus getting infinite loop.

@cjihrig
Copy link
Collaborator

cjihrig commented May 29, 2025

@CPunisher can you rebase this or force push. GitHub isn't giving me the option to start the CI.

@CPunisher CPunisher force-pushed the 04-20-fix/mac-fd_readdir branch from e40e42f to 830670a Compare May 29, 2025 05:36
@cjihrig cjihrig merged commit 392e1f1 into nodejs:main May 29, 2025
7 of 8 checks passed
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.

WASI preview 1: fd_readdir ignores cookie argument
2 participants