Commit graph

6008 commits

Author SHA1 Message Date
Jan Scheer
3f4b0146a1
test_tail: add test_follow_descriptor_vs_rename1-2 2021-10-24 22:28:30 +02:00
Jan Scheer
07eb50248b
test_tail: add test_retry8-9 2021-10-24 22:21:36 +02:00
Jan Scheer
016291b92e
test_tail: add test_retr7 2021-10-24 22:19:10 +02:00
Jan Scheer
c7c5deb3d8
test_tail: add test_retry6 2021-10-24 22:17:54 +02:00
Jan Scheer
4bfb462387
test_tail: add test_retry5 2021-10-24 22:15:14 +02:00
Jan Scheer
5770921f52
test_tail: add test_retry4 2021-10-24 22:13:58 +02:00
Jan Scheer
8c5c52801d
test_tail: add test_retry3 2021-10-24 22:12:40 +02:00
Jan Scheer
9338b3fd77
test_tail: add test_retry1-2 2021-10-24 22:03:00 +02:00
Jan Scheer
e3b35867a5
test_tail: clean up tests for --follow=name 2021-10-10 00:07:59 +02:00
Jan Scheer
a1206154b1
tail: fix the behavior for -f and rename events
This makes uu_tail pass the "gnu/tests/tail-2/descriptor-vs-rename" test.

* add tests for descriptor-vs-rename (with/without verbose)
* fix some minor error messages
2021-10-08 23:36:41 +02:00
Jan Scheer
23d3e58f33
tail: improve file handling for --follow=name
* Change data structure from Vec to HashMap in order to better
keep track of files while watching them with `--follow=name`.
E.g. file paths that were removed while watching them and exit
if no files are remaining, etc.

* Move all logic related to file handling into a FileHandling trait

* Simplify handling of the verbose flag.
2021-10-07 14:37:02 +02:00
Jan Scheer
22b59289e8
Merge branch 'master' into tail_notify 2021-10-02 12:48:54 +02:00
Sylvestre Ledru
fb5650951e
Merge pull request #2696 from jhscheer/fix_check_coreutil_version
common/util: fix parsing of coreutil version
2021-10-02 09:03:23 +02:00
Jan Scheer
e9371dc57d
common/util: fix parsing of coreutil version
For the CICD on macOS, this fixes:

```
---- common::util::tests::test_check_coreutil_version stdout ----
---- common::util::tests::test_expected_result stdout ----
thread 'common::util::tests::test_expected_result' panicked at
'byte index 4 is out of bounds of `9.0`', tests/common/util.rs:1172:41
```
2021-10-02 00:58:04 +02:00
Jan Scheer
94cc966535
tail: change notify backend on macOS from FSEvents to kqueue
On macOS only `kqueue` is suitable for our use case because `FSEvents`
waits until file close to delivers modify events.
2021-10-01 21:33:30 +02:00
Sylvestre Ledru
01d098993b
Merge pull request #2662 from Smicry/master
add kill -l final new line #2644
2021-09-29 09:58:50 +02:00
Jan Scheer
22f78b113b
tail: update README
* add stub for `--max-unchanged-stats`
2021-09-28 21:25:04 +02:00
Jan Scheer
e935d40480
tail: implement handling of truncate event for --follow=name 2021-09-28 20:05:09 +02:00
Jan Scheer
d9cd28fab6
test_tail: add tests for --follow=name --disable-inotify (polling) 2021-09-28 00:16:23 +02:00
Jan Scheer
5615ba9fe1
test_tail: add tests for --follow=name 2021-09-27 23:18:00 +02:00
Jan Scheer
c70b7a0501
tail: implement --follow=name
This implements `--follow=name` for create/move/delete events.
Under the hood crate `notify` provides a cross-platform notification
library.
2021-09-27 23:08:37 +02:00
Sylvestre Ledru
df42fed3b3
Merge pull request #2693 from thomasqueirozb/expr_uresult
expr: use UResult
2021-09-26 16:14:17 +02:00
Thomas Queiroz
3882df5cdc
expr: use UResult 2021-09-25 15:36:04 -03:00
Jan Scheer
a9066e2d0c
tail: switch from Notify 4.0.17 to 5.0.0-pre.13
* treat input filenames as PathBuf instead of String
2021-09-23 13:34:20 +02:00
Sylvestre Ledru
a0f538f2e8
Merge pull request #2679 from blyxxyz/uucore-inspection
uucore: Minor cleanup
2021-09-19 22:28:16 +02:00
Sylvestre Ledru
629e446da4
Merge pull request #2691 from raftario/yanked-digest
Use non-yanked version of digest crate in hashsum
2021-09-19 22:27:41 +02:00
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
Jan Scheer
fe3d020f6f
tail: use crate notify for polling (implement --disable-inotify) 2021-09-18 18:07:57 +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 Scheer
a727b2e666
tail: handle file NotFound error correctly 2021-09-16 21:40:15 +02:00
Jan Scheer
1f24b1f59c
tail: implement sub-second sleep interval e.g. -s.1 2021-09-16 17:14:23 +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