Skip to content

Calling fs.readDirSync fails #26

@3cooper

Description

@3cooper

I have a file system implemented using Fuse-Native that I can navigate via OS X Finder. I am making a tester for the file system to ensure it works after making changes. I am trying to get the contents of a directory using a script in Node.js, but it is failing.

Example dir: /Users/me/Documents/fusemount/virtualDir

The error: 'EPERM: operation not permitted, scandir '/Users/me/Documents/fusemount/virtualDir'

The code I am using:

  fs.readdirSync('/Users/me/Documents/fusemount/virtualDir').forEach(file => {
    console.log(file);
  });

When I run this I have successful requests for:

  1. access('\')
  2. getAttr('\virtualDir')
  3. getAttr('\')

The debug console shows:

unique: 9, opcode: ACCESS (34), nodeid: 1, insize: 48, pid: 37685
access / 01
   unique: 9, success, outsize: 16
unique: 3, opcode: LOOKUP (1), nodeid: 1, insize: 48, pid: 37685
LOOKUP /virtualDir
getattr /[Mounted Part of Path]
   NODEID: 28
   unique: 3, success, outsize: 160
unique: 4, opcode: GETXATTR (22), nodeid: 28, insize: 71, pid: 0
getxattr /virtualDir com.apple.macl 0 0
   unique: 4, error: -45 (Operation not supported), outsize: 16
unique: 11, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 37685
getattr /
   unique: 11, success, outsize: 136
unique: 2, opcode: GETXATTR (22), nodeid: 1, insize: 71, pid: 0
getxattr / com.apple.macl 0 0
   unique: 2, error: -45 (Operation not supported), outsize: 16

I have not implemented the following operations:

  • releaseDir
  • ftruncate
  • fgetAttr
  • utimens
  • fsync
  • fsyncDir

My statfs operation is returning the same information found in the readme for this project.

getAttr returns the following for folders:

{
  mtime: new Date(2020, 8, 16, 3, 20, 0),
  atime: new Date(2020, 8, 16, 3, 20, 0),
  ctime: new Date(2020, 8, 16, 3, 20, 0),
  nlink: 1,
  size: 100,
  mode: 0o40777,
  uid: process.getuid ? process.getuid() : 0,
  gid: process.getgid ? process.getgid() : 0
};

Any help would be great. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions