Commit graph

3472 commits

Author SHA1 Message Date
Hanif Ariffin
0d3fa51d1e Add license headers
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2021-11-20 17:04:28 +08:00
Hanif Bin Ariffin
da46cc8015 Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-11-13 18:33:25 +08:00
Sylvestre Ledru
ca1156458e
Merge pull request #2714 from blyxxyz/os_display-crate
Move display::Quotable into its own crate
2021-11-12 21:17:59 +01:00
Sylvestre Ledru
177374aa5a
Merge pull request #2740 from jfinkels/seq-inf-width-spaces
seq: correct fixed-width spacing for inf sequences
2021-11-12 21:16:40 +01:00
nicoo
bed45602a7 factor/Cargo.toml: Document feature pending a MinRustV bump 2021-11-10 15:26:36 +01:00
nicoo
32b0178a72 factor: Update to current versions of smallvec
smallvec 1.0 and later wasn't compatible with Rust 1.33 but the
minimum supported Rust version for coreutils moved on.
2021-11-10 15:12:37 +01: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
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
equal-l2
cda3d5a29b ls: add possible value for --color= 2021-11-06 03:42:27 +09:00
Hanif Bin Ariffin
a9bc457d89 Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-11-04 16:55:55 +08: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
c58bd9f569
env: don't panic when name is empty 2021-11-02 16:40:03 -03:00
Hanif Bin Ariffin
5a056c2c93 Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-11-02 20:58:03 +08: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
Hanif Bin Ariffin
33b5e67bea Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-10-30 10:01:41 +08: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
Hanif Bin Ariffin
02fd7176b7 Merge branch 'master' of https://github.com/uutils/coreutils into hbina-tr-reimplement-expansion 2021-10-27 13:08:57 +08: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
Hanif Bin Ariffin
002584d0dd Merge branch 'hbina-tr-reimplement-expansion' of github.com:hbina/coreutils into hbina-tr-reimplement-expansion 2021-10-24 11:41:19 +08:00
Hanif Bin Ariffin
2dad536785 Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-10-24 11:40:42 +08: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
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
Smicry
0ffbf28cba uniq: use UResult in util 2021-10-24 02:02:49 +08:00
Sylvestre Ledru
59e9870c56 Prepare version 0.0.8 2021-10-23 19:21:50 +02:00
Sylvestre Ledru
3ffc4c07eb fix a map-clone warning 2021-10-23 19:19:52 +02:00
Sylvestre Ledru
4c8b74797f Silent question_mark clippy warnings 2021-10-23 19:19:36 +02:00
Sylvestre Ledru
610fde45ef
Merge pull request #2709 from jaggededgedjustice/support-symboli-modes
Add symbolic mode support to mkdir
2021-10-23 17:54:15 +02:00
Sylvestre Ledru
811698b658
Merge pull request #2712 from jfinkels/head-take-lines-reader
head: use std::io::copy() with TakeLines reader
2021-10-23 17:53:44 +02:00
Sylvestre Ledru
803c05cb4a
Merge pull request #2720 from Smicry/master
head: use UResult in util
2021-10-23 17:53:35 +02:00
Hanif Bin Ariffin
6c67f19df4 Merge branch 'master' of https://github.com/uutils/coreutils into hbina-tr-reimplement-expansion
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-10-21 13:31:51 +08:00
Jeffrey Finkelstein
858b0a9e9f head: use std::io::copy() with TakeLines reader
Replace the custom `split::walk_lines()` function with a call to
`std::io::copy()`, using a new `TakeLines` reader as the source and
`stdout` as the destination. The `TakeLines` reader is an adaptor that
scans the bytes being read for line ending characters and stops the
reading after a given number of lines has been read (similar to the
`std::io::Take` adaptor).

This change

* makes the `read_n_lines()` function more concise,
* allows it to mirror the implementation of `read_n_bytes()`,
* increases the speed of `head -n NUM`.
2021-10-20 20:59:44 -04:00
Smicry
b89b11f5da fix lint error 2021-10-21 00:22:36 +08:00
Smicry
396fa7a9b4 fix lint error 2021-10-21 00:13:28 +08:00
Smicry
2cbc2aa59b head: use UResult in util 2021-10-20 23:49:04 +08:00
Sylvestre Ledru
ede77c6099
Merge pull request #2711 from jfinkels/hashsum-crlf-windows-across-blocks
hashsum: fix handling of \r\n in Windows text mode
2021-10-19 20:50:16 +02:00
Smicry
cb34b660cb add tail usage 2021-10-19 00:15:17 +08:00
James Robson
0b2483452a Add symbolic mode support to mkdir 2021-10-16 12:57:55 +01:00
Sylvestre Ledru
40a895f79d
Merge pull request #2705 from adamreichold/tac-mmap
Minor improvements to tac
2021-10-12 21:51:38 +02:00