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

numfmt: invalid option #2

Closed
tanvp112 opened this issue Dec 27, 2023 · 1 comment
Closed

numfmt: invalid option #2

tanvp112 opened this issue Dec 27, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@tanvp112
Copy link

tanvp112 commented Dec 27, 2023

Describe the bug a clear and concise description of what the bug is.

First of all, thank you for this script which has been very helpful!

Recently I found an issue which I am not very sure why: The script failed at https://github.com/reefland/cri-purge/blob/master/cri-purge.sh#L193

numfmt: invalid option -- '2'
Try 'numfmt --help' for more information.
Disk Space Change:

What happened?

Commented line #193 and the script works as expected.

What you expected to happen?

I don't think this is a bug but probably numfmt has somehow changed its behavior in the following Ubuntu version.

How to reproduce it?

./cri-purge.sh -p

Anything else we need to know?

PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

@tanvp112 tanvp112 added the bug Something isn't working label Dec 27, 2023
@reefland
Copy link
Owner

Thanks for the report. I'm using same version of Ubuntu.

$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

To get that message, pruning images resulted in disk space being consumed; not freed while it was running. A negative amount of disk space freed, is a positive amount of disk space consumed. Perhaps nothing was purged, yet background processes still consumed disk space.

Small change in disk space:

$ START_DISK_SPACE=13884593975
$ END_DISK_SPACE=13884593973
$ echo Disk Space Change: "$(numfmt --to iec --format "%8.4f" $((START_DISK_SPACE-END_DISK_SPACE)) )"
Disk Space Change:   2.0000

No change in disk space:

$ START_DISK_SPACE=13884593975
$ END_DISK_SPACE=13884593975
$ echo Disk Space Change: "$(numfmt --to iec --format "%8.4f" $((START_DISK_SPACE-END_DISK_SPACE)) )"
Disk Space Change:   0.0000

What you observed, space was consumed during purge:

$ START_DISK_SPACE=13884593975
$ END_DISK_SPACE=13884593977
$ echo Disk Space Change: "$(numfmt --to iec --format "%8.4f" $((START_DISK_SPACE-END_DISK_SPACE)) )"
numfmt: invalid option -- '2'
Try 'numfmt --help' for more information.

I can add some additional checks for this, and make that still return a zero instead of negative value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants