Comments (5)
It seems like the underlying issue here is more that globby indiscriminately recursively searches for .gitignore files everywhere before doing anything else, which seems to mean it scans through all sorts of directories that are deeply nested inside dirs that are gitignored, which eem like a large perf issue in addition to causing this read permission error (i don't want it to scan 1 million files in my gitignored node_modules folder just because there might be a gitignore file somewhere in there
from globby.
I would say this is a bug. The gitignore: true
functionality should simply ignore a directory if it's not readable as the globbing would not find anything there anyway.
from globby.
Yes, I agree. Ignored und readable directories would be a sensible default behavior.
Maybe along with a warning that a certain directory could not be read.
from globby.
I started looking into this a bit.
To me the best way to fix this would be to pass suppressErrors
as true
always in this line.
https://github.com/sindresorhus/globby/blob/main/ignore.js#L68
That even seems to be intented according to the fast-glob README.
Can be useful when the directory has entries with a special level of access.
However, I am not sure if this has unwanted side effects such as other errors that users would want to know about not being reported.
Also, this might mean that it's worth mentioning in the globby
README that suppressErrors
is true
by default.
Do you think this would be a solution worth implementing or not?
The actual implementation could probably be as simple as changing the default value of suppressErrors
to true if it's not passed in this line
const normalizeOptions = (options = {}) => ({
cwd: toPath(options.cwd) || process.cwd(),
- suppressErrors: Boolean(options.suppressErrors),
+ suppressErrors: options.suppressErrors === false ? false : true, // make sure supressErrors is aways true unless explicitly passed as false
deep:
typeof options.deep === "number" ? options.deep : Number.POSITIVE_INFINITY,
});
from globby.
👍
{suppressErrors:true}
as option remove the error on Linux for a drwx------ 4 root root
folder
from globby.
Related Issues (20)
- Change `isGitIgnoredSync` and `isGitIgnored` HOT 1
- The directory contains spaces. The file cannot be found HOT 2
- Unknown file extension ".ts" HOT 1
- SyntaxError: require() of ES Module HOT 1
- not auto expand glob in subdirectory
- Error with generateGlobTasks HOT 1
- [Suggestion] Autocomplete directory path
- feat: priority between given patterns and .gitignore
- Nested .gitignore is not correctly applied to sub directories
- Invalid Syntax HOT 1
- Multimatch ignore file not supported HOT 1
- Prevent search of ignore files in ignored files list HOT 1
- `toPath` imported from `unicorn-magic` is not exported by the `0.1.0` dependency of that package in non-"node" context causing Webpack failures HOT 7
- Allow abort glob progress HOT 1
- ignore is broken when it is not array (regression) HOT 6
- globby 14.0.1 breaks bun compatibility HOT 3
- `Options.fs` is bypassed in some places and `node:fs` APIs are invoked directly, leading to incorrect behavior HOT 1
- can GitignoreOptions add fields supported by fastGlob
- Type imports from `fast-glob` are incorrect
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from globby.