Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print debug info size in bytes. #554

Conversation

marxin
Copy link
Contributor

@marxin marxin commented Sep 25, 2018

du default to 1024 bytes as default unit, that's not desired
as one can overwrite that with BLOCK_SIZE env variable.

du default to 1024 bytes as default unit, that's not desired
as one can overwrite that with BLOCK_SIZE env variable.
@pmatilai
Copy link
Member

Quoting http://pubs.opengroup.org/onlinepubs/9699919799/utilities/du.html:

By default, file sizes shall be written in 512-byte units, rounded up to the next 512-byte unit.

The same document kinda points out that -b is a non-standard extension. Whether it actually matters here ... I dunno if anybody is using dwz outside the Linux community, but it's a possible incompatibility that could be easily avoided by using -k instead, which is standard.

@marxin
Copy link
Contributor Author

marxin commented Sep 26, 2018

I bet it's non-standard due to --apparent-size option which -b enables.
That said, what about using -B1 (a.k.a. --block-size=1)?

@pmatilai
Copy link
Member

No need to bet or guess, just look at the opengroup specification I linked. -B is just as non-standard as is -b.

@pmatilai
Copy link
Member

...so if the point is to make the output independent of BLOCK_SIZE env variable (which is not part of the standard btw) then -k seems to be the only choice per standard. At least as of Linux coreutils, -k does override BLOCK_SIZE.

pmatilai added a commit that referenced this pull request Oct 1, 2018
By standard, 'du' defaults to 512 byte units, but this differs between
implementations: GNU du defaults to 1024 unless POSIXLY_CORRECT is set
and also allows overriding via number of environment variables. It also
supports various other ways of controlling the block size, but the
only standard means to control the size is -k, and we really don't
want to break portability for the sake of FYI statistics.

Inspired by Marxim Liska's patch at in #554.
@pmatilai
Copy link
Member

pmatilai commented Oct 1, 2018

Changed to report kilobytes instead in commit 62d901a, closing.
Thanks for the patch!

@pmatilai pmatilai closed this Oct 1, 2018
@marxin
Copy link
Contributor Author

marxin commented Oct 1, 2018

Thanks for the patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants