Skip to content

Regression in fs.readdirSync on AIX introduced in 18.17.0#49499

@lux01

Description

@lux01

Version

v18.17.0

Platform

AIX huritmdemo 3 7 00F70A434C00

Subsystem

fs

What steps will reproduce the bug?

  1. Create a directory
  2. Create a file under that directory whose name is exactly the same as the directory name
  3. Create a second file under the directory whose name is not the same
  4. Run the following script passing in the path to the folder
constfs=require('node:fs')constpath=require('node:path')for(constentryoffs.readdirSync(process.argv[2],{withFileTypes: true})){console.log('Found entry',path.join(process.argv[2],entry.name))console.log('Is file?',entry.isFile())console.log('Is directory?',entry.isDirectory())console.log('')}

How often does it reproduce? Is there a required condition?

This reproduce is stable and does not depend on the precise name of the file/folder.

What is the expected behavior? Why is that the expected behavior?

The expected behaviour is that the file with the same name as the folder is correctly reported as a file

-bash-5.1$ ls -ld SameNameForFileAndFolder drwx------ 2 will staff 256 05 Sep 11:10 SameNameForFileAndFolder -bash-5.1$ ls -l SameNameForFileAndFolder/ total 0 -rw------- 1 will staff 0 05 Sep 11:10 AnotherEntry -rw------- 1 will staff 0 05 Sep 11:09 SameNameForFileAndFolder -bash-5.1$ ./node-v18.16.1-aix-ppc64/bin/node recreate.js SameNameForFileAndFolder Found entry SameNameForFileAndFolder/AnotherEntry Is file? true Is directory? false Found entry SameNameForFileAndFolder/SameNameForFileAndFolder Is file? true Is directory? false 

What do you see instead?

The actual behaviour is that the file with the same name as the folder is incorrectly reported to be a directory

-bash-5.1$ ls -ld SameNameForFileAndFolder drwx------ 2 will staff 256 05 Sep 11:10 SameNameForFileAndFolder -bash-5.1$ ls -l SameNameForFileAndFolder/ total 0 -rw------- 1 will staff 0 05 Sep 11:10 AnotherEntry -rw------- 1 will staff 0 05 Sep 11:09 SameNameForFileAndFolder -bash-5.1$ ./node-v18.17.1-aix-ppc64/bin/node recreate.js SameNameForFileAndFolder Found entry SameNameForFileAndFolder/AnotherEntry Is file? true Is directory? false Found entry SameNameForFileAndFolder/SameNameForFileAndFolder Is file? false Is directory? true 

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    aixIssues and PRs related to the AIX platform.fsIssues and PRs related to the fs subsystem / file system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions