Fix read permission error on ignore files search#259
Merged
sindresorhus merged 2 commits intosindresorhus:mainfrom Feb 11, 2024
nicolas-goudry:fix/no-read-dir
Merged
Fix read permission error on ignore files search#259sindresorhus merged 2 commits intosindresorhus:mainfrom nicolas-goudry:fix/no-read-dir
sindresorhus merged 2 commits intosindresorhus:mainfrom
nicolas-goudry:fix/no-read-dir
Conversation
Contributor
Author
|
To fix #254 with the provided steps to reproduce, would give the following: mkdir someproject
cd someproject
npm init -y && npm i globby
mkdir testdir
chmod -r testdir # remove read access
# Notice the addition of "ignore: ['testdir']" option
node --input-type=module -e "const { globby } = await import('globby'); console.log(await globby('test', { gitignore: true, ignore: ['testdir'] }))" |
Contributor
Author
|
@sindresorhus could you please take a look at this? |
azu
added a commit
to secretlint/secretlint
that referenced
this pull request
Feb 17, 2024
- update globby@14.0.1 which Fix read permission error on ignore files search refs sindresorhus/globby#259 closes #460
azu
added a commit
to secretlint/secretlint
that referenced
this pull request
Feb 17, 2024
- update globby@14.0.1 which Fix read permission error on ignore files search refs sindresorhus/globby#259 closes #460
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR should fix #254 and fix #258. As well as
xo’s #737 whenglobby’s dependency gets upgraded.It allows to forward the
ignoreoption field passed toglobby’sisIgnoredByIgnoreFilestofast-glob.To give some more context, this function is used to find all
.gitignorefiles relative to the current working directory. If any subdirectory of the current working directory is not readable,fast-globexits with an error.By forwarding the
ignoreoption tofast-globwhen searching for ignore files, we prevent this behavior.A few things that should be considered before this gets merged:
Documentation
There are currently no docs about this, but since the readme file mentions that the
optionsobject extends thefast-globoptions, I’m not sure if it’s worth to document.Tests
When a directory is not readable, the behavior of
fast-globis to exit, not to throw.So, if we remove the
ignoreoption of the test,avawill fail all tests run with the following error:Some side nodes about the test:
.notThrowsAsyncis used, but as said above:fast-globdoesn’t throw, it exits ; so this might be wrong. You tell me.serialis used to prevent other tests to fail because of the bad directory permissions.teardownis used to revert the directory permissions to something readable