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

YABS assumes 'bc' will be installed #79

Closed
goetzk opened this issue Nov 25, 2023 · 3 comments
Closed

YABS assumes 'bc' will be installed #79

goetzk opened this issue Nov 25, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@goetzk
Copy link

goetzk commented Nov 25, 2023

Hi,
yabs appears to use 'bc' for some calculations, but only when zfs is in use.

free_space=$(bc <<< "$free_space*1024")

bc is not installed by default so there can be cases where its invoked but not installed.


# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
#              Yet-Another-Bench-Script              #
#                     v2023-11-24                    #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #

Sat 25 Nov 2023 21:02:05 UTC

Basic System Information:
---------------------------------
Uptime     : 32 days, 31 hours, 0 minutes
Processor  : AMD Turion(tm) II Neo N40L Dual-Core Processor
CPU cores  : 2 @ 1500.000 MHz
AES-NI     : ❌ Disabled
VM-x/AMD-V : ✔ Enabled
RAM        : 15.6 GiB
Swap       : 0.0 KiB
Disk       : 109.5 GiB
Distro     : Debian GNU/Linux 11 (bullseye)
Kernel     : 5.10.0-21-amd64
VM Type    : NONE
IPv4/IPv6  : ✔ Online / ✔ Online
bash: line 549: bc: command not found
bash: line 556: bc: command not found

I see various command checks around line 90 so hopefully this will be able to follow a similar idiom.

thanks,
Karl.

@masonr masonr added the bug Something isn't working label Nov 30, 2023
@masonr masonr self-assigned this Nov 30, 2023
@masonr
Copy link
Owner

masonr commented Nov 30, 2023

Good catch! I'll get the bc usage swapped out with vanilla bash arithmetic instead.

masonr added a commit that referenced this issue Nov 30, 2023
@masonr
Copy link
Owner

masonr commented Nov 30, 2023

Pushed a new commit that hopefully resolves this and retains the same functionality. Please give it a test when you are able and let me know if you have any further issues!

@masonr masonr closed this as completed Nov 30, 2023
@DonneyF
Copy link

DonneyF commented Dec 23, 2023

I believe there is a bug here since bash only does integers. In my case I have a ZFS drive with 3.7T free space, so free_space gets value 3.7 and we get a bug on the following adjusted line:

free_space=$((free_space * 1024))

Since we assume awk is installed we can maybe use something like this:

free_space=$(awk "BEGIN {print $free_space * 1024}")
free_space=${free_space%.*}

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

3 participants