Commit graph

527 commits

Author SHA1 Message Date
Terts Diepraam
55a47f6fc0
Merge pull request #2863 from tertsdiepraam/clap-3
Clap 3
2022-01-20 23:14:52 +01:00
Roy Ivy III
2e251f91f1 0.0.12 2022-01-19 05:35:00 -06:00
Terts Diepraam
e345768484 base64: remove clap dependency again 2022-01-18 12:56:58 +01:00
Terts Diepraam
8872485922 Merge branch 'main' into clap-3 2022-01-17 13:25:51 +01:00
Sylvestre Ledru
3dfb9a23c0 update pretty_assertions to version 1 2022-01-17 12:55:16 +01:00
Sylvestre Ledru
7e9ed4b346
Merge pull request #2869 from tertsdiepraam/rust-1.54
Bump MSRV to 1.54.0
2022-01-16 23:18:50 +01:00
Sylvestre Ledru
1fbda8003c coreutils 0.0.8 => 0.0.9, uucore_procs 0.0.7 => 0.0.8, uucore 0.0.10 => 0.0.11 2022-01-16 17:05:48 +01:00
Terts Diepraam
783170c9d8 change msrv to 1.54 2022-01-15 11:08:07 +01:00
Terts Diepraam
fc3c82ffdc update cargo.lock for clap 3.0 2022-01-11 19:16:48 +01:00
Terts Diepraam
f60c36f242
Merge pull request #2610 from miDeb/cp/abuse
cp: handle edge cases when dest is a symlink
2022-01-11 00:34:55 +01:00
Roy Ivy III
05a2f0ca70 update 'Cargo.lock' 2022-01-09 18:57:25 -06:00
Terts Diepraam
7fa720d311 fix lint, fmt & udeps errors 2022-01-01 19:43:44 +01:00
kimono-koans
fd64e01d92
ls: Reduce binary size of ls by removing regex crate (#2781) 2021-12-22 18:31:45 +01:00
Sylvestre Ledru
a3041843c9 bump the platform-info dep 2021-12-18 00:04:03 +01:00
Roy Ivy III
7834d9ffaf update Cargo.lock 2021-11-19 17:55:03 -06: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
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
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
Michael Debertol
bb35b0c37b uucore: add FileInformation 2021-11-01 22:38:44 +01:00
Sylvestre Ledru
59e9870c56 Prepare version 0.0.8 2021-10-23 19:21:50 +02: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
Adam Reichold
c526df57b8 tac: opportunistically use memory maps
Since tac must read its input files completely to start processing them
from the end, it is particularly suited to use memory maps to benefit
from the page cache maintained by the operating systems to bring the
necessary data into memory as required.

This does also include situations where the input is stdin, but not via
a pipe but for example a file descriptor set up by the user's shell
through an input redirection.
2021-10-10 13:20:31 +02:00
Sylvestre Ledru
b2fa51ddd9
Merge pull request #2656 from jhscheer/ls_selinux
`ls`: add support for showing SELinux context (--context/-Z)
2021-10-02 12:56:09 +02:00
Raphaël Thériault
6931dd11f1 Use non-yanked version of digest crate in hashsum 2021-09-19 12:38:56 -07:00
Jan Scheer
79d838b1c3
Merge branch 'master' into ls_selinux 2021-09-17 14:14:47 +02:00
Jan Verbeek
4555c85564 whoami: Cleanup
- Use modern conventions
- Restrict the scope of unsafe
- Do not use deprecated `std::mem::unitialized()`
- Do not bake unicode into design
2021-09-13 22:54:45 +02:00
Sylvestre Ledru
e9d63519dd
Merge pull request #2668 from sylvestre/unused-deps
Remove plenty of unused deps
2021-09-13 21:45:39 +02:00
Sylvestre Ledru
a74e4bf095 shred: remove the unused dep on filetime 2021-09-13 18:15:51 +02:00
Sylvestre Ledru
a6c235bcd1 csplit: remove the unused dep on glob 2021-09-13 18:15:51 +02:00
Sylvestre Ledru
826c948234 ls: remove the unused dep on locale 2021-09-13 18:15:51 +02:00
Michael Debertol
5faa4c41db
Merge pull request #2607 from jfinkels/tac-regex
tac: add support for --regex option to tac
2021-09-13 18:12:57 +02:00
Sylvestre Ledru
87b6aa89e3
pr: remove unused "time" dep (#2667) 2021-09-13 18:08:51 +02:00
Sylvestre Ledru
68df4de1a2
nice: update to use the same version of nix as other programs (#2666) 2021-09-13 18:08:41 +02:00
Sylvestre Ledru
ebe897e4d4
shred: remove unused "time" dep (#2665) 2021-09-13 18:05:06 +02:00
Jan Scheer
4dc6536bb9
Merge branch 'master' into ls_selinux 2021-09-13 13:42:51 +02:00
Sylvestre Ledru
447d6f2b61
Merge pull request #2654 from blyxxyz/dedup-splice
Move common pipe and splice functions into uucore
2021-09-12 09:23:05 +02:00
Jeffrey Finkelstein
664c7a6ec5 tac: add support for --regex option to tac
Add support for `tac --regex`, where the line separator is interpreted
as a regular expression.
2021-09-11 22:54:55 -04:00
Jan Verbeek
b7d697753c unlink: Simplify, remove unsafe, move to core
This makes it no longer possible to pass multiple filenames, but every
other implementation I tried (GNU, busybox, FreeBSD, sbase) also
forbids that so I think it's for the best.
2021-09-10 21:50:38 +02:00
Jan Scheer
fe3645d4d5
ls: add support for showing SELinux context (--context/-Z) 2021-09-10 21:33:34 +02:00
Jan Verbeek
c1079e0b1c Move common pipe and splice functions into uucore
This cuts down on repetitive unsafe code and repetitive code in
general.
2021-09-10 21:24:34 +02:00
Jan Verbeek
60df3c6b7c uucore: Cache args_os(), util_name(), execution_phrase()
And remove args() because there's no valid use for it, invalid unicode
handling is specified in a different way.
2021-09-07 18:51:25 +02:00
Sylvestre Ledru
6226a03214
Merge pull request #2624 from miDeb/cp/acl
cp: correctly copy mode, ownership, acl and context
2021-09-03 20:18:13 +02:00
Jan Verbeek
3f6ca4723e Update num-bigint to 0.4.2 to fix CI 2021-09-03 19:24:02 +02:00
Michael Debertol
8b74562820 cp: correctly copy mode, ownership, acl and context
Fix a mix-up between ownership and mode. The latter (mode / file permissions)
can also be set on windows (which however only affects the read-only flag),
while there doesn't seem to be a straight-forward way to change file ownership
on windows.

Copy the acl as well when copying the mode. This is a non-default feature and can be
enabled with --features feat_acl, because it doesn't seem to work on CI.
It is only available for unix so far.

Copy the SELinux context if possible.
2021-09-01 00:16:22 +02:00
Jan Verbeek
afb460f4ca rmdir: match GNU
- Implement all of GNU's fiddly little details
- Don't assume Linux for error codes
- Accept badly-encoded filenames
- Report errors after the fact instead of checking ahead of time
- General cleanup

rmdir now passes GNU's tests.
2021-08-28 02:26:01 +02:00
Jan Verbeek
657a04f706 wc: Stricter simpler error handling
Errors are now always shown with the corresponding filename.

Errors are no longer converted into warnings. Previously `wc < .`
would cause a loop.

Checking whether something is a directory is no longer done in
advance. This removes race conditions and the edge case where stdin is
a directory.

The custom error type is removed because io::Error is now enough.
2021-08-26 01:38:16 +02:00
Jan Verbeek
6f7d740592 wc: Do a chunked read with proper UTF-8 handling
This brings the results mostly in line with GNU wc and solves nasty
behavior with long lines.
2021-08-26 01:38:16 +02:00
Jan Verbeek
48437fc49d wc: Optimize, improve correctness
- Reuse allocations for read lines
- Increase splice size
- Check if /dev/null was opened correctly
- Do not discard read bytes after I/O error
- Add fast line counting with bytecount
2021-08-26 01:38:16 +02:00
Jeffrey Finkelstein
52cfd4c6cb hashsum: don't copy input buffer on Windows
Remove a copy operation of the input buffer being read for digest when
reading in text mode on Windows. Previously, the code was copying the
buffer to a completely new `Vec`, replacing "\r\n" with "\n". Instead,
the code now scans for the indices at which each "\r\n" occurs in the
input buffer and inputs into the digest only the characters before the
"\r" and after it.
2021-08-25 13:50:19 +02:00