sindresorhus / globby

User-friendly glob matching
MIT License
2.53k stars 130 forks source link

followSymbolicLinks should not follow ignore items #136

Open atian25 opened 5 years ago

atian25 commented 5 years ago

Environment

Actual behavior

if one dir(which is start with '.' and ignore by default) has a loop symbolic links, fast-glob will throw:

Error: ENAMETOOLONG: name too long, scandir 'atian25/node-snippets/test/fixtures/.sff/node_modules/_@types_koa@2.0.50@@types/koa/node_modules/@types/koa-compose/node_modules/@types/koa/node_modules/@types/koa-compose/node_modules/@types/koa/node_modules/@types/koa-compose

Expected behavior

followSymbolicLinks should not follow ignore items

Steps to reproduce

see the test case: https://github.com/atian25/node-snippets/pull/1

  1. mkdir .sff
  2. use cnpm/npminstall to install a deps to .sff/node_modules
  3. the symbolic links is test/fixtures/.sff/node_modules/@types/koa -> ../_@types_koa@2.0.50@@types/koa
  4. globby

Code sample

    const result = await globby([ '*', '**' ], {
      cwd,
      ignore: [
        '**/node_modules',
      ],
    });
sindresorhus commented 4 years ago

Would you be able to submit a pull request with one or more failing tests? That would help getting this fixed faster.