Commit graph

6369 commits

Author SHA1 Message Date
Thomas Queiroz
f43dfa9a61
tests/common: implement CmdResult::usage_error 2021-11-09 16:36:03 -03:00
Thomas Queiroz
0bbc805e43
tests/common: add util_name+bin_path to CmdResult 2021-11-09 16:36:03 -03:00
Thomas Queiroz
ab4573bde9
tests/common: create TestScenario::composite_cmd
This is made to call UCommand::new with Some(util_name)
2021-11-09 16:35:38 -03:00
Thomas Queiroz
d4ca4371d7
tests/common: add util_name+bin_path to UCommand 2021-11-09 04:04:56 -03:00
Thomas Queiroz
fc300dda24
tests/common: UCommand::new rename arg to bin_path
Merge and remove unecessary `.as_ref()`
2021-11-09 00:12:11 -03:00
Jeffrey Finkelstein
0b86afa858 seq: correct fixed-width spacing for inf sequences
Pad infinity and negative infinity values with spaces when using the
`-w` option to `seq`. This corrects the behavior of `seq` to match that
of the GNU version:

    $ seq -w 1.000 inf inf | head -n 4
    1.000
      inf
      inf
      inf

Previously, it incorrectly padded with 0s instead of spaces.
2021-11-08 20:12:54 -05:00
Jan Verbeek
77e1570ea0 Move display::Quotable into its own crate
The standalone version has a number of bugfixes compared to the old
version.
2021-11-08 23:07:40 +01:00
Thomas Queiroz
124f929848
tests/env: change Windows test_change_directory
Invoke `cmd.exe /C cd` to determine the current working directory instead of relying on the output of
environment variables.
2021-11-07 23:11:39 -03:00
jfinkels
2e12316ae1
seq: use BigDecimal to represent floats (#2698)
* seq: use BigDecimal to represent floats

Use `BigDecimal` to represent arbitrary precision floats in order to
prevent numerical precision issues when iterating over a sequence of
numbers. This commit makes several changes at once to accomplish this
goal.

First, it creates a new struct, `PreciseNumber`, that is responsible for
storing not only the number itself but also the number of digits (both
integer and decimal) needed to display it. This information is collected
at the time of parsing the number, which lives in the new
`numberparse.rs` module.

Second, it uses the `BigDecimal` struct to store arbitrary precision
floating point numbers instead of the previous `f64` primitive
type. This protects against issues of numerical precision when
repeatedly accumulating a very small increment.

Third, since neither the `BigDecimal` nor `BigInt` types have a
representation of infinity, minus infinity, minus zero, or NaN, we add
the `ExtendedBigDecimal` and `ExtendedBigInt` enumerations which extend
the basic types with these concepts.

* fixup! seq: use BigDecimal to represent floats

* fixup! seq: use BigDecimal to represent floats

* fixup! seq: use BigDecimal to represent floats

* fixup! seq: use BigDecimal to represent floats

* fixup! seq: use BigDecimal to represent floats
2021-11-06 15:44:42 +01:00
Michael Debertol
a7aa6b8e3a
Merge pull request #2738 from equal-l2/ls-fix-color-comp
ls: add possible value for `--color=`
2021-11-05 21:04:05 +01:00
equal-l2
cda3d5a29b ls: add possible value for --color= 2021-11-06 03:42:27 +09:00
Thomas Queiroz
a290c77cfc
env: add contributor 2021-11-04 20:18:59 -03:00
Hanif Bin Ariffin
7baa05b2db Add tests for silently accepting presume-input-tty
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-11-04 17:04:26 +08:00
Hanif Bin Ariffin
ac68bc9ac7 Merge branch 'master' of github.com:uutils/coreutils into hbina-rm-silently-accept-presume-input-tty 2021-11-04 16:57:14 +08:00
Thomas Queiroz
8ad95c375a
env: force specifying command with --chdir 2021-11-02 20:06:23 -03:00
Thomas Queiroz
013405d1e6
env: change -c to -C 2021-11-02 19:51:45 -03:00
Thomas Queiroz
c44b5952b8
tests/env: add unsetting invalid variables test 2021-11-02 19:51:37 -03:00
Thomas Queiroz
3d74e7b452
env: prevent panic when unsetting invalid variable 2021-11-02 19:42:52 -03:00
Thomas Queiroz
db00fab7e4
env: use UResult everywhere 2021-11-02 19:17:54 -03:00
Thomas Queiroz
b157a73a1f
printenv: change exit code when variable not found
GNU printenv has this behavior
2021-11-02 18:36:28 -03:00
Thomas Queiroz
f2a3a1f920
printenv: use UResult 2021-11-02 18:36:28 -03:00
Michael Debertol
a05628f018
Merge pull request #2731 from thomasqueirozb/env_empty_name
env: don't panic when name is empty
2021-11-02 21:33:42 +01:00
Thomas Queiroz
1afc7242a5
env: change comment 2021-11-02 17:23:34 -03:00
Thomas Queiroz
f9512e5a90
tests/env: add empty name test 2021-11-02 16:45:39 -03:00
Sylvestre Ledru
276a4deacc
Merge pull request #2734 from palfrey/fix-freebsd
Fix FreeBSD build by downgrading MacOS version
2021-11-02 20:44:52 +01:00
Thomas Queiroz
c58bd9f569
env: don't panic when name is empty 2021-11-02 16:40:03 -03:00
Tom Parker-Shemilt
0c33905e60 Fix FreeBSD build by downgrading MacOS version 2021-11-02 18:56:01 +00:00
Michael Debertol
7c94bb082e
Merge pull request #2726 from thomasqueirozb/strip_pre_suffix
uu+tests: use strip_prefix and strip_suffix
2021-11-01 23:34:27 +01:00
Michael Debertol
3fdff304db cp: handle edge cases when dest is a symlink
- Fail if dest is a dangling symlink
- Fail if dest is a symlink that was previously created by the same
invocation of cp
2021-11-01 22:48:48 +01:00
Michael Debertol
8696193b66 cat: use FileInformation from uucore 2021-11-01 22:42:15 +01:00
Michael Debertol
bb35b0c37b uucore: add FileInformation 2021-11-01 22:38:44 +01:00
Sylvestre Ledru
8fef0c6f31
Merge pull request #2732 from kevinburke/rm-multiple-r
rm: allow -r flag to be specified multiple times
2021-10-29 13:30:14 +02:00
Kevin Burke
3e1c5c2d99
rm: allow -r flag to be specified multiple times
GNU rm allows the `-r` flag to be specified multiple times, but
uutils/coreutils would previously exit with an error.

I encountered this while attempting to run `make clean` on the
Postgres source tree (github.com/postgres/postgres).

Updates #1663.
2021-10-28 22:47:07 -07:00
Sylvestre Ledru
1b39a10938
Merge pull request #2694 from jhscheer/clippy_warnings
tests: silence clippy warnings for unused_imports
2021-10-24 19:09:09 +02:00
Thomas Queiroz
007f1b9f84
uu+tests: use strip_prefix and strip_suffix 2021-10-24 12:23:32 -03:00
Sylvestre Ledru
15fcbf3aac
Merge pull request #2728 from thomasqueirozb/uniq_uresult
uniq: use UResult
2021-10-24 09:46:22 +02:00
Sylvestre Ledru
c883fbc311
Merge pull request #2727 from thomasqueirozb/msrv_1.47.0
Use features stabilized for msrv 1.47.0
2021-10-24 09:45:19 +02:00
Thomas Queiroz
1d8381064a
tests/uniq: update test 2021-10-24 02:59:50 -03:00
Thomas Queiroz
ea9b239841
uniq: use UResult 2021-10-24 00:03:33 -03:00
Thomas Queiroz
1f15b8fce4
cksum: use while loops instead of unroll! 2021-10-23 23:25:22 -03:00
Thomas Queiroz
21a2d0ce40
sort: use Range.is_empty 2021-10-23 23:22:21 -03:00
Thomas Queiroz
5e5bb91043
sort: remove unecessary implementation 2021-10-23 23:21:45 -03:00
Sylvestre Ledru
d72a135b42 improve the publish script 2021-10-24 00:51:27 +02:00
Sylvestre Ledru
43e85ae9ce install: Also import fs from uucore 2021-10-24 00:33:00 +02:00
Sylvestre Ledru
6946377e02 cp: Also import entries from uucore 2021-10-24 00:29:24 +02:00
Sylvestre Ledru
b5977021bc Fix the uu_base32 dep 2021-10-24 00:12:05 +02:00
Sylvestre Ledru
995826e4a2
Merge pull request #2724 from sylvestre/silent-a-warning-2
Ignore two question-mark warnings
2021-10-23 23:46:59 +02:00
Sylvestre Ledru
d286c3ba4b
Merge pull request #2723 from Smicry/master
uniq: use UResult in util
2021-10-23 21:35:51 +02:00
Sylvestre Ledru
a5bc2211d5 Ignore two question-mark warnings 2021-10-23 20:59:19 +02:00
Sylvestre Ledru
f28da04fc5
Merge pull request #2722 from sylvestre/version
Prepare version 0.0.8
2021-10-23 20:56:27 +02:00