Skip to content

run-test262: handle scandir() results with DT_UNKNOWN d_type #1104

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pinotree
Copy link
Contributor

@pinotree pinotree commented Jun 16, 2025

In case the dirent items returned by scandir() have DT_UNKNOWN as d_type it is not possible to assume they are "non directories", and it is needed to stat() them to get the actual type.

Hence, tweak the existing bits to account for that:

  • create an helper enum for file type to distinguish whether something is for sure a file, whether it is for sure a directory, or it is not known
  • map d_type to the newly created enum
  • adapt consider_test_file() to use the newly created enum, and case the file type is not known also to stat() the file to get the actual type

On Windows the file type is always known, so there is no need to stat() files.

In case the dirent items returned by scandir() have DT_UNKNOWN as
d_type it is not possible to assume they are "non directories", and
it is needed to stat() them to get the actual type.

Hence, tweak the existing bits to account for that:
- create an helper enum for file type to distinguish whether something
  is for sure a file, whether it is for sure a directory, or it is not
  known
- map d_type to the newly created enum
- adapt consider_test_file() to use the newly created enum, and case
  the file type is not known also to stat() the file to get the actual
  type

On Windows the file type is always known, so there is no need to stat()
files.
@pinotree pinotree force-pushed the run-test262-dt_unknown branch from 8b44259 to 11cf91b Compare June 16, 2025 05:02
@saghul
Copy link
Contributor

saghul commented Jun 16, 2025

Out of curiosity, what files do you have that require filtering out?

@pinotree
Copy link
Contributor Author

Out of curiosity, what files do you have that require filtering out?

This is not about filtering, but rather collecting the tests to run using run-test262. In case a directory is specified using testdir (in config) or -d, then a recursive scan of the specified paths is done using scandir(), which thus needs to distinguish files (to be run) from directories (in which iterate further).

@saghul
Copy link
Contributor

saghul commented Jun 16, 2025

Yes, I know that. What I mean, is, what did you have in there which results in DT_UNKNOWN?

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