Coder Social home page Coder Social logo

Comments (5)

phiresky avatar phiresky commented on September 28, 2024 1

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.

sindresorhus avatar sindresorhus commented on September 28, 2024

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.

ChristophP avatar ChristophP commented on September 28, 2024

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.

ChristophP avatar ChristophP commented on September 28, 2024

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.

florent-andre avatar florent-andre commented on September 28, 2024

👍
{suppressErrors:true} as option remove the error on Linux for a drwx------ 4 root root folder

from globby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.