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

[Plugin] Collect exact filesizes in add_dir_listing #3758

Merged

Conversation

pmoravec
Copy link
Contributor

@pmoravec pmoravec commented Aug 22, 2024

add_dir_listing method in #3664 hid exact filesizes in "ls -l" like outputs in favour of human readable output. That has two drawbacks:

  1. It provides less precise information, while particular filesizes for some files can be essential to know. E.g. 3.1K can mean 3075 or 3174 bytes and the difference can matter for some well known files with well known default sizes.
  2. It makes it difficult to parse the size by various analytical tools

sos tool should be data collectio tool rather than interpreting them. So let replace human readable filesize by exact one.

Resolves: #3758


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname email@example.com?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?
  • Are all passwords or private data gathered by this PR obfuscated?

Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-3758
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@TurboTurtle
Copy link
Member

Should this be a toggle? When I standardized the existing calls to add_dir_listing() there was no clear preference across plugins as to if -h was used or not in the "manual" ls collections.

I'm also fine with just dropping human sizes across the board, just a thought.

@pmoravec
Copy link
Contributor Author

Good point. Sometimes (e.g. https://github.com/sosreport/sos/pull/3664/files#diff-2e1b7ad69a0e01805218f011055c3ce7d123809531eed5ed157e004be5fe315bR175 or https://github.com/sosreport/sos/pull/3664/files#diff-b8035c7551e828c6ec017b8b2a986cce1884a2d87110a9edfa11bbdf4c40f561R57) the ls output is meant rather user-informative than precisely descriptive. But still I feel making the -h option toggle-able would "cost" us on code (execution) complexity more than users would gain. So until there would be a push back, I would stay with the -h drop.

I will just bump the PR to update the failing test.

add_dir_listing method hid exact filesizes in "ls -l" like outputs in
favour of human readable output. That provides less precise information
and makes it difficult to parse by various analytical tools.

Let replace human readable filesize by exact one.

Resolves: sosreport#3758

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
@pmoravec pmoravec force-pushed the sos-pmoravec-dir-listing-precise-size branch from 58ba9f0 to a9eab24 Compare August 22, 2024 14:47
@TurboTurtle TurboTurtle merged commit 86fc819 into sosreport:main Aug 23, 2024
36 checks passed
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.

3 participants