fast-glob icon indicating copy to clipboard operation
fast-glob copied to clipboard

EACCES exception raised for directories without read permissions

Open gnikit opened this issue 2 years ago • 0 comments

Environment

  • OS Version: Linux x64 5.4.0-90-generic
  • Node.js Version: v14.18.1

Actual behavior

fast-glob throws a EACCES or hangs (i.e. fails silently) depending on if suppressErrors is set for directory with inadequate read permissions.

Expected behavior

Ignore directory and continue glob search, or have an option to ignore EACCES errors.

Steps to reproduce

  1. Create a some directories mkdir -p temp/{public,private}
  2. Revoke read permissions to one chmod -r temp/private
  3. Run code snippet

Code sample

I encountered this in TypeScript but it's the same code.

import * as fg from 'fast-glob';

const globIncPaths: string[] = fg.sync('temp/**', {
  cwd: 'your/cwd',
  onlyDirectories: true,
  suppressErrors: false, // set to true to trigger a race condition
});

Additional information

I have found a fix using glob and setting the option { strict: false }. Is there something equivalent for fast-glob?

gnikit avatar Nov 14 '21 16:11 gnikit