Code Monkey home page Code Monkey logo

Comments (7)

Arcterus avatar Arcterus commented on June 3, 2024 2

That explains why the results are the same then.

Basically, diskus can retrieve the metadata for a directory that can’t be read but can’t see the contents. Because the directories are empty, the size given in the metadata is the actual size of the directory, so everything works out.

However, if the directory contained other files, the reported size should include the size of the directory itself (which might be stuff like the number of entries and the permissions of the directory or whatever the OS decides to report) as well as the sizes of the files contained within (recursively). If diskus can’t read the contents of the directory, it can’t determine the sizes of the files contained within, so it just reports the size of the directory itself. This would lead to a different final size, so diskus displays warnings to indicate that the final reported size may not be completely accurate.

from diskus.

Arcterus avatar Arcterus commented on June 3, 2024

If the directories that can't be read are large enough, the results should be different. Are those directories empty?

from diskus.

dawidd6 avatar dawidd6 commented on June 3, 2024

Yes, they are.

from diskus.

sharkdp avatar sharkdp commented on June 3, 2024

It's just like @Arcterus said, yes.

We could potentially make this a bit more user-friendly, though. Maybe we could collect all access-errors while traversing the directory and then just print a single warning at the end that the result might be inaccurate since there were directories/files that could not be accessed.

from diskus.

Arcterus avatar Arcterus commented on June 3, 2024

I think it would be better to put the current behavior behind a --verbose flag and default to just mentioning the size may be inaccurate.

from diskus.

sharkdp avatar sharkdp commented on June 3, 2024

put the current behavior behind a --verbose flag

Yes, sounds good.

default to just mentioning the size may be inaccurate.

That's what I wanted to suggest, exactly. But I would only show the "may be inaccurate" warning if there were any I/O errors while traversing the directory.

from diskus.

Arcterus avatar Arcterus commented on June 3, 2024

Ah, that was what I meant. I should have been clearer.

from diskus.

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.