`seq --format %.2g 10 10` would display `1` because the precision would
not allow room for the decimal point, and the `0` in `10` would be
trimmed as an insignificant trailing `0`.
This has been fixed by only trimming trailing `0` in the presence of a
decimal point.
Using `saturating_sub()` before converting to `usize` gives a wrong
feeling of security as it looks like it ensures that the value will
never go negative. However, since it is applied to `i32`, it can, and
converting it to `usize` would go horribly wrong anyway.
By following the code flow, `exponent` cannot be greater than
`precision`, or the `else` block would not have been taken. A plain
subtraction will give the same result and will at least panic in debug
mode.
- `Path::new()` returns a `&Path` and does not need to be dereferenced
- Some types can be deduced from the context and are well visible
already (`parse_size_u128()` or `from_bytes()`)
* fuzz: use thread to bypass the limitation of output
Closes: #5724
many thanks to @samueltardieu
* fuzz: enable seq as the stalled issue is fixed
* fuzz: add 4 more fuzzers
* fuzz: enable the 4 new fuzzers in the CI
* remove old import
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* remove comment
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* remove comment
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* add more flags
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* add space
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* add a comment about sort local
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* wrong copy/paste
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* fuzz: import "std::env"
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
- util/show-utils.sh script is used by FreeBSD workflow => use realpath
command from GNU coreutils instead of FreeBSD realpath.
- install GNU coreutils (FreeBSD package coreutils) in style job
Signed-off-by: Laurent Cheylus <foxy@free.fr>
- Use /usr/bin/env bash instead of /bin/sh to use OSTYPE
- Define variables for GNU version of make, nproc, readlink and use them on BSD.
Signed-off-by: Laurent Cheylus <foxy@free.fr>
- Use /usr/bin/env bash instead of /bin/sh to use OSTYPE
- Use readlink from GNU coreutils on BSD OS in util/build-code_coverage.sh and
util/show-code_coverage.sh scripts
Signed-off-by: Laurent Cheylus <foxy@free.fr>
- Use /usr/bin/env bash instead of /bin/sh to define OSTYPE
- Use GNU realpath on BSD OS (FreeBSD and OpenBSD)
Signed-off-by: Laurent Cheylus <foxy@free.fr>
- Define variables for GNU version of make, nproc, readlink and sed and use them on BSD.
- In specific cases (option -z not available on BSD and with command /c), use GNU sed instead of
BSD sed.
- For xargs, --no-run-if-empty option is a GNU extension. Replace it by -r to be compatible with
FreeBSD and OpenBSD xargs command.
Signed-off-by: Laurent Cheylus <foxy@free.fr>
- For shell scripts using bash, use #!/usr/bin/env bash instead of #!/bin/bash.
On some OS, bash is not the default shell and is not installed as /bin/bash
Signed-off-by: Laurent Cheylus <foxy@free.fr>