Commit graph

6978 commits

Author SHA1 Message Date
Jeffrey Finkelstein
0454d3b243 truncate: prevent underflow when reducing size
Prevent usize underflow when reducing the size of a file by more than
its current size. For example, if `f` is a file with 3 bytes, then

    truncate -s-5 f

will now set the size of the file to 0 instead of causing a panic.
2022-01-28 22:44:07 -05:00
Jeffrey Finkelstein
c780c96e17 truncate: better error msg when dir does not exist
Improve the error message that gets printed when a directory does not
exist. After this commit, the error message is

    truncate: cannot open '{file}' for writing: No such file or directory

where `{file}` is the name of a file in a directory that does not
exist.
2022-01-28 21:21:37 -05:00
Terts Diepraam
2412e4cbf7 add some tests for Clap's InferLongArgs setting 2022-01-29 02:06:32 +01:00
Terts Diepraam
5f1933a89f df: no longer override help 2022-01-29 02:06:32 +01:00
Terts Diepraam
9c8e865b55 all: enable infer long arguments in clap 2022-01-29 02:06:29 +01:00
Terts Diepraam
50964c0ee7 README: restructuring 2022-01-29 01:42:18 +01:00
Terts Diepraam
0063c5e11a README: update intoduction and why? section 2022-01-29 01:42:03 +01:00
Sylvestre Ledru
96584027e5 selinux: add consistency in the dep declaration 2022-01-29 01:31:17 +01:00
Sylvestre Ledru
f1d72018d7
Merge pull request #2923 from jfinkels/seq-error-zero-increment-value
seq: correct error message for zero increment
2022-01-29 01:25:57 +01:00
Sylvestre Ledru
c702154a84
Merge pull request #2934 from jfinkels/truncate-division-by-zero
truncate: add a division by zero error
2022-01-29 01:25:10 +01:00
Terts Diepraam
0f76ca0ffa README: add links to documentation 2022-01-29 01:19:15 +01:00
Sylvestre Ledru
fed5ca4ba9
Merge pull request #2935 from tertsdiepraam/wc-unusual-files
wc: fix counting files from pseudo-filesystem
2022-01-29 01:09:02 +01:00
Sylvestre Ledru
68b6a3e5d8
Merge pull request #2937 from sylvestre/doc-ci
Fix the doc warnings and add a check to make sure we don't regress
2022-01-29 01:08:10 +01:00
Sylvestre Ledru
b94bd96bc6 ignore spelling issue 2022-01-29 00:35:16 +01:00
Sylvestre Ledru
170975aeaa run the build of the doc in the ci 2022-01-29 00:35:14 +01:00
Sylvestre Ledru
7f79fef2cd fix various doc warnings 2022-01-29 00:09:09 +01:00
Terts Diepraam
dd311b294b wc: fix counting files from pseudo-filesystem 2022-01-28 19:08:44 +01:00
electricboogie
72c53219e3 Prevent potential unwrap on a None value 2022-01-27 22:07:07 -06:00
Jeffrey Finkelstein
9dda23d8c6 seq: correct error message for zero increment
Change a word in the error message displayed when an increment value
of 0 is provided to `seq`. This commit changes the message from "Zero
increment argument" to "Zero increment value" to match the GNU `seq`
error message.
2022-01-27 21:17:27 -05:00
Jeffrey Finkelstein
b636ff04a0 split: implement -n option
Implement the `-n` command-line option to `split`, which splits a file
into a specified number of chunks by byte.
2022-01-27 21:16:27 -05:00
Jeffrey Finkelstein
1e5e637990 truncate: add a division by zero error
Add an error for division by zero. Previously, running `truncate -s /0
file` or `-s %0` would panic due to division by zero. After this
change, it writes an error message "division by zero" to stderr and
terminates with an error code.
2022-01-27 21:12:59 -05:00
Jeffrey Finkelstein
1074deeb03 truncate: make better use of UResult
Replace some uses of `crash!()` and move `UError` handling down into
the `truncate()` function. This does not change the behavior of the
program, just organizes the code to facilitate introducing code to
handle other types of errors in the future.
2022-01-27 21:05:34 -05:00
electricboogie
5e82d6069f Fix comments 2022-01-27 16:12:34 -06:00
Sylvestre Ledru
b816e80e2f
Merge pull request #2912 from jfinkels/truncate-create-non-existent-file
truncate: create non-existent file by default
2022-01-27 23:03:55 +01:00
electricboogie
8b6c1337aa Fix broken test in certain Linux containers 2022-01-27 15:36:55 -06:00
Sylvestre Ledru
53f2aab5be
Merge pull request #2919 from jtracey/patch-3
update GNU coreutils version in GnuTests workflow
2022-01-27 20:12:53 +01:00
electricboogie
463c1ac2ff Make suggested changes: Move logic into PathData struct, etc. 2022-01-27 11:57:19 -06:00
electricboogie
7512200ba2 Cleanup comments 2022-01-26 16:52:05 -06:00
electricboogie
1d629d8d66 Move more logic into md function, make enter_directory function clearer 2022-01-26 16:41:52 -06:00
Sylvestre Ledru
ac1ed328fe
Merge pull request #2921 from tertsdiepraam/fix-make-clean
make: use "cargo clean" instead of removing the target/$profile folder
2022-01-26 20:42:03 +01:00
Terts Diepraam
d12459563c make: use "cargo clean" instead of removing the target/$profile folder 2022-01-26 19:48:31 +01:00
Sylvestre Ledru
9dbff22101
Merge pull request #2918 from jfinkels/seq-format-option
seq: implement -f FORMAT option
2022-01-26 09:55:50 +01:00
Justin Tracey
2ccea4666d
update GNU coreutils version in GnuTests workflow 2022-01-26 05:23:28 +00:00
Jeffrey Finkelstein
4fbe2b2b5e seq: implement -f FORMAT option
Add support for the `-f FORMAT` option to `seq`. This option instructs
the program to render each value in the generated sequence using a
given `printf`-style floating point format. For example,

    $ seq -f %.2f 0.0 0.1 0.5
    0.00
    0.10
    0.20
    0.30
    0.40
    0.50

Fixes issue #2616.
2022-01-25 20:48:26 -05:00
Sylvestre Ledru
f1dde86f9b
Merge pull request #2903 from jtracey/ls-test-clippy
ls: fix clippy lints in tests
2022-01-25 23:24:40 +01:00
Sylvestre Ledru
c7fc0a703b
Merge pull request #2893 from g-k/2888-rand-0.8
update rand crate to 0.8
2022-01-25 23:23:43 +01:00
Sylvestre Ledru
5932937952
Merge pull request #2777 from jfinkels/uucore-printf
uucore: move printf::memo module to uucore
2022-01-25 23:22:27 +01:00
Sylvestre Ledru
5c45911c13
Merge pull request #2915 from jfinkels/dd-status-noxfer
dd: correct behavior when status=noxfer
2022-01-25 23:19:53 +01:00
Jeffrey Finkelstein
e8df666c2e dd: support seek=N when destination is stdout
Add support for the `seek=N` argument when the destination is stdout
and not a file. Previously, the argument was ignored when writing to
stdout.
2022-01-25 12:34:13 -05:00
Sylvestre Ledru
630b5d8577
Merge pull request #2909 from jfinkels/dd-conv-ascii-unblock
dd: block/unblock on ebcdic/ascii conversions
2022-01-25 14:37:20 +01:00
Sylvestre Ledru
8f12b5b7ce
Merge pull request #2905 from jfinkels/update-main-branch-name-in-workflows
ci: update default branch to "main" in workflows
2022-01-25 14:34:22 +01:00
Sylvestre Ledru
b5df3723df
Merge pull request #2897 from tertsdiepraam/mdbook
Automatic mdBook Documentation
2022-01-25 14:33:41 +01:00
Sylvestre Ledru
1415ebc263
Merge pull request #2908 from cohosh/join_chkodr_default
join: fix default check order behaviour
2022-01-25 13:47:34 +01:00
Sylvestre Ledru
c74cfdc33e
Merge pull request #2916 from jfinkels/tail-follow-non-utf8-bytes
tail: don't error when following non-UTF-8 data
2022-01-25 13:47:16 +01:00
Sylvestre Ledru
e6733881d6
Merge pull request #2850 from sbentmar/numfmt-error-handling
numfmt: use UResult in more functions
2022-01-25 13:46:46 +01:00
Jeffrey Finkelstein
83f96ec29d tail: don't error when following non-UTF-8 data
Fix a bug where `tail -f` would terminate with an error due to failing
to parse a UTF-8 string from a sequence of bytes read from the
followed file. This commit replaces the call to `BufRead::read_line()`
with a call to `BufRead::read_until()` so that any sequence of bytes
regardless of encoding can be read.

Fixes #1050.
2022-01-24 21:32:52 -05:00
Greg Guthe
e6fdf0761f factor: ignore quickcheck tests using unhandled large vals
refs: #1559
2022-01-24 20:51:10 -05:00
Greg Guthe
e24ecea1da factor: tests: update Arbitrary impl for Factors
Upstream removed the Gen trait and made the gen method private in
d286e4db20
2022-01-24 20:41:22 -05:00
Greg Guthe
c037382df7 factor: update quickcheck dev dep to 1.0.3
quickcheck <1 uses rand 0.6.x which results in E0599 errors.  Upgrading resolves that error and lets
us remove the older rand version from our deps.

refs: https://stackoverflow.com/questions/56901973/errore0599-no-method-named-gen-found-for-type-mut-g-in-the-current-scope/56902740#56902740
2022-01-24 20:41:20 -05:00
Greg Guthe
2b19dd20ae cspell: add impls to abbrevs in acronyms+names list 2022-01-24 20:40:57 -05:00