Commit graph

5971 commits

Author SHA1 Message Date
Raphaël Thériault
6931dd11f1 Use non-yanked version of digest crate in hashsum 2021-09-19 12:38:56 -07:00
Sylvestre Ledru
8d418cd61c
Merge pull request #2672 from oeble/kill_with_signal_name
Kill with signal name
2021-09-18 22:55:27 +02:00
Sylvestre Ledru
3e8b4045c8
Merge pull request #2675 from blyxxyz/whoami-cleanup
whoami: Cleanup
2021-09-18 17:20:09 +02:00
Sylvestre Ledru
b59bbddcbf
Merge pull request #2663 from jfinkels/hashsum-std-io-copy
hashsum: use std::io::copy() to simplify digest
2021-09-18 17:19:16 +02:00
Sylvestre Ledru
81c2dc74e8
Merge pull request #2676 from jfinkels/seq-format-padding
seq: replace loops with a single format string
2021-09-18 17:18:35 +02:00
Jan Verbeek
7ea2bfbe26 seq: replace loops with a single format string
Replace two loops that print leading and trailing 0s when printing a
number in fixed-width mode with a single call to `write!()` with the
appropriate formatting parameters.
2021-09-18 10:27:03 -04:00
Jeffrey Finkelstein
bfb1327ad4 seq: use print_seq_integers() regardless of last
Ensure that the `print_seq_integers()` function is called when the first
number and the increment are integers, regardless of the type of the
last value specified.
2021-09-18 10:27:03 -04:00
Sylvestre Ledru
522d4d39e3
Merge pull request #2680 from blyxxyz/utmpx-safety
uucore::utmpx: Make thread-safe
2021-09-18 16:15:52 +02:00
Jeffrey Finkelstein
7fea771f32 hashsum: use std::io::copy() to simplify digest
Create a `DigestWriter` struct that implements `Write` by passing bytes
directly to `Digest::input()`, so that `hashsum` can use
`std::io::copy()`. Using `std::io::copy()` eliminates some boilerplate
code around reading and writing bytes. And defining `DigestWriter` makes
it easier to add a `#[cfg(windows)]` guard around the Windows-specific
replacement of "\r\n" with "\n".
2021-09-18 09:51:33 -04:00
Sylvestre Ledru
7fb1fcfac5
Merge pull request #2686 from jfinkels/hashsum-window-text-mode
hashsum: add tests for Windows text mode
2021-09-18 09:16:48 +02:00
Sylvestre Ledru
77cfafa511
Merge pull request #2613 from jfinkels/seq-width-fractional
seq: correctly compute width due to decimal places
2021-09-18 09:16:35 +02:00
Jeffrey Finkelstein
3854a97749 seq: remove unused Number::num_digits() function
Remove the `Number::num_digits()` function in favor of the
`digits::num_integral_digits()` functions.
2021-09-17 23:50:13 -04:00
Jeffrey Finkelstein
2ac5dc0a70 seq: compute correct width for scientific notation
Change the way `seq` computes the number of digits needed to print a
number so that it works for inputs given in scientific notation.
Specifically, this commit parses the input string to determine whether
it is an integer, a float in decimal notation, or a float in scientific
notation, and then computes the number of integral digits and the number
of fractional digits based on that. This also supports floating point
negative zero, expressed in both decimal and scientific notation.
2021-09-17 23:49:54 -04:00
Jeffrey Finkelstein
cd5f676903 hashsum: add tests for Windows text mode 2021-09-17 21:24:43 -04:00
Sylvestre Ledru
88a689075c
Merge pull request #2682 from jfinkels/seq-simpler-terminator-check
seq: add is_first_iteration to avoid comparisons
2021-09-17 12:19:05 +02:00
Sylvestre Ledru
3e458f524c
Merge pull request #2683 from jfinkels/uucore-panic-capture-broken-pipe
uucore(panic): guard against "Broken pipe" panics
2021-09-16 22:24:15 +02:00
Sylvestre Ledru
3d867fcf7c
Merge pull request #2684 from blyxxyz/hostname-cleanup
hostname: Cleanup
2021-09-16 22:22:34 +02:00
Jan Verbeek
5bb56ec528
whoami: Restrict scope of unsafe
Co-authored-by: Jan Scheer <jhscheer@users.noreply.github.com>
2021-09-15 15:37:15 +02:00
Jan Verbeek
3f37ddbd22 hostname: Cleanup
- Attach context to I/O errors
- Make flags override each other
- Support invalid unicode as argument
- Call WsaCleanup() even on panic
- Do not use deprecated std::mem::uninitialized()
2021-09-15 13:45:02 +02:00
Sylvestre Ledru
b1317c589e
Merge pull request #2674 from sylvestre/udeps
Add a github check to verify useless dependencies
2021-09-15 12:31:05 +02:00
Sylvestre Ledru
7eaae75bfc add a github action job to identify unused deps 2021-09-15 12:06:50 +02:00
Jeffrey Finkelstein
f95ab2f43c uucore(panic): guard against "Broken pipe" panics
Add "Broken pipe" to the set of panic messages used to determine whether
a panic is caused by a broken pipe error.
2021-09-14 21:26:50 -04:00
Jeffrey Finkelstein
53a91be2df seq: add is_first_iteration to avoid comparisons
Add the `is_first_iteration` Boolean variable to the `print_seq()`
function in order to avoid unnecessary comparisons. Specifically, before
this change, the `done_printing()` function was called twice on each
iteration of the main loop. After this change, it is only called once
per iteration.

Furthermore, this change makes the `print_seq()` function similar in
structure to the `print_seq_integers()` function.

Co-authored-by: Jan Verbeek <jan.verbeek@posteo.nl>
2021-09-14 20:57:38 -04:00
Jan Verbeek
519c0d16b3 uucore::utmpx: Make thread-safe 2021-09-14 21:17:50 +02:00
Michael Debertol
5c97c1ccc4
Merge pull request #2678 from blyxxyz/io-error-detect-os
Do not discard non-OS error messages
2021-09-14 20:21:48 +02:00
Michael Debertol
1cfed70da5
Merge pull request #2673 from sylvestre/more-dep-cleanup
Restrict some crates to specific OS
2021-09-14 20:09:39 +02:00
Michael Debertol
8fec7f38a1
Merge pull request #2658 from jfinkels/seq-whitespace-inputs
seq: trim leading whitespace from inputs
2021-09-14 20:00:45 +02:00
Jan Verbeek
1edd2bf3a8 Do not discard non-OS error messages 2021-09-14 15:11:54 +02:00
Jan Verbeek
0a3785bf84 whoami: Run tests on Windows 2021-09-14 14:13:58 +02:00
Jeffrey Finkelstein
60025800c3 seq: trim leading whitespace from inputs 2021-09-13 21:46:17 -04: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
2a4422997d Restrict some crates to specific OS 2021-09-13 22:45:55 +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
Michael Debertol
5d7e7ed4c0
Merge pull request #2651 from jhscheer/ls_small_fix_for_test_from_2627
test_ls: add features for uutils called by ccmd
2021-09-13 18:35:32 +02:00
Michael Debertol
570f23ac90
Merge pull request #2647 from jfinkels/seq-test-inf
seq: use stdout.write_all() instead of print!()
2021-09-13 18:34:24 +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
Sylvestre Ledru
2d67252dc4 rm: only set the winapi dep on Windows 2021-09-13 18:15:51 +02:00
Sylvestre Ledru
cca2b19b4e tail: only set the winapi dep on Windows 2021-09-13 18:15:49 +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
7712fd02f2
Merge pull request #2670 from sylvestre/freebsd3
Fixed a warning on freebdsd
2021-09-13 18:09:00 +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
Sylvestre Ledru
2203e5ea78
Merge pull request #2671 from jhscheer/fix_tests_with_expected_result
tests/common: make call to `host_name_for` idempotent
2021-09-13 13:31:19 +02:00
Sylvestre Ledru
450a3faf9f
Add to the spell ignore list 2021-09-13 12:29:28 +02:00
Jan Scheer
deedb73bcb
tests/common: make call to host_name_for idempotent
This fixes an issue on macOS/bsd where multiple calls
to `host_name_for` each added a prefix 'g'.
The issue led to some tests being skipped because `util_name` was
renamed to e.g. "ggid" instead of "gid".
2021-09-13 12:28:47 +02:00
Sylvestre Ledru
b4f45bcc1a
Merge pull request #2664 from jfinkels/wc-remove-mut-width
wc: remove mutable min_width parameter
2021-09-13 08:25:46 +02:00
Sylvestre Ledru
fd22feb090
Merge pull request #2669 from blyxxyz/mktemp-unsafe
mktemp: Do not use unsafe
2021-09-13 08:25:28 +02:00