Hanif Bin Ariffin
4fb4511da3
Fixed empty backslash
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
3fea69f9ed
inline some code
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
5657f5af3a
Simplified and extended parsing capabilities
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
2c8ba4ad2d
Fixing some issues discovered from tests...mostly to match GNU behavior
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
43dbff7c56
Something wrong with rust iterator...
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
5a0870bb30
Condensed many of the weird stuff in tr in a function...passes more GNU tests
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
279a7cf6b3
Attempting to fix star expansion
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
5def69d3ee
Trimming down files
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
0acc165720
Finally fixed parsing octal in char ranges
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
5aeeb6cfe9
Use delimited whenever possible and removed a duplicate parse
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
0254ceb48b
Removes some allocations
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
7424754725
Update traits name
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
4b45a2287c
Implement some more parsers
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
b0ef508b04
Some code cleanup
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
f13c0ba5a7
Remove new from struct names
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
6ff826b712
Some lint changes
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
671d355aeb
Removed unused dependencies
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:36:33 +08:00
Hanif Bin Ariffin
05d2973510
Reimplemented everything using new expansion module
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:36:33 +08:00
Hanif Bin Ariffin
c4e04c5384
Implemented squeeze operation
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:36:33 +08:00
Hanif Bin Ariffin
50167a33a8
Now all tr tests passes with the new translation impl!
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:36:33 +08:00
Hanif Bin Ariffin
572cbc6ba2
Some small cleanup to translation module
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:36:33 +08:00
Hanif Bin Ariffin
840c6e7b91
tr
: Reimplementing set expansion
...
Hopefully will be feature parity with GNU `tr`.
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Implemented a bit of new expansion module
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Implemented delete operation
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Partially implemented delete operation
Will go through translate next.
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Fix formatting...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Implemented translation feature
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:36:30 +08:00
Terts Diepraam
f9559fea80
Merge pull request #2569 from jtracey/master
...
join: add support for full outer joins
2021-08-13 14:38:15 +02:00
Justin Tracey
1bb0237281
join: add support for full outer joins
2021-08-12 23:52:35 -04:00
Sylvestre Ledru
a7797c01c0
Merge branch 'master' into chgrp/no-err
2021-08-13 01:35:21 +02:00
Sylvestre Ledru
01be7b356f
Merge pull request #2558 from fdanis-oss/fix-csplit-split_name
...
csplit: fix suffix support without flag
2021-08-13 01:34:30 +02:00
Sylvestre Ledru
ea5097e4a0
Merge pull request #2562 from tertsdiepraam/uucore/simpler-uerror
...
`uucore`: simpler `UResult` and `UError`
2021-08-13 01:33:23 +02:00
Sylvestre Ledru
5a0032c56e
Merge pull request #2563 from koutheir/master
...
chcon: reduce the number of unsafe blocks.
2021-08-13 01:32:42 +02:00
Sylvestre Ledru
8f55c79c9b
Merge pull request #2566 from miDeb/ls/width
...
ls: correct output width
2021-08-13 01:31:52 +02:00
Michael Debertol
21043d3605
sort: prevent race when deleting files
...
Move the creation of temporary files into next_file so that it happens
while the lock is taken.
Previously, only the computation of the new file path happened while
the lock was taken, while the creation happened later.
2021-08-12 13:50:56 +02:00
Frédéric Danis
6283dbe451
csplit: fix suffix support without flag
...
csplit fails when suffix has no flags:
$ csplit result.expected -f /tmp/EXPECT -b "%d" "/^## alternative ##$/" {*}
csplit: error: incorrect conversion specification in suffix
This is supported by original csplit
2021-08-12 10:27:56 +02:00
Michael Debertol
0af244ac42
ls: default to one-line output if stdout is not a tty
2021-08-11 22:03:41 +02:00
Michael Debertol
988cc49d4a
ls: print a single line when width is set to 0
...
This means that we treat a width=0 as infinite width.
2021-08-11 19:12:45 +02:00
Michael Debertol
13a62489c5
ls: correct fallbacks for terminal width
...
If options::WIDTH is not given, we should try to use the terminal width.
If that is unavailable, we should fall back to the 'COLUMNS' environment variable.
If that is unavailable (or invalid), we should fall back to a default of 80.
2021-08-11 19:12:37 +02:00
Michael Debertol
1c30fb42d2
chgrp: handle empty group
2021-08-11 19:03:41 +02:00
Koutheir Attouchi
83a515e4c3
chcon: reduce the number of unsafe blocks.
2021-08-10 13:50:51 -04:00
Terts Diepraam
14459cf611
rustfmt
2021-08-10 19:18:09 +02:00
Terts Diepraam
d12d4f760c
uucore: {USimpleError, UUsageError}::new take Into<String> instead of String
2021-08-10 17:55:37 +02:00
Terts Diepraam
1649217116
uucore: remove distinction between common and custom errors
...
As custom errors are prefered over wrapping around common errors, the
distinction between UCommonError and UCustomError is removed. This
reduces the number of types and makes the error handling easier to
understand.
2021-08-10 17:55:28 +02:00
Sylvestre Ledru
fe539a6dea
Merge pull request #2559 from miDeb/factor/line-buffered
...
factor: prevent writing incomplete lines
2021-08-10 15:25:11 +02:00
Sylvestre Ledru
ca0bae0dfd
Merge pull request #2500 from Funky185540/feature/install-use-uresult
...
install: Use UResult
2021-08-10 13:32:00 +02:00
Michael Debertol
0edc9b01b9
factor: prevent writing incomplete lines
...
This makes it possible to execute multiple `factor` instances that write
to the same output in parallel, without having them interfere.
2021-08-10 00:14:51 +02:00
David CARLIER
6e2f6b2845
nice little code simplification, included already in the libc
...
for all unixes
2021-08-09 21:56:12 +01:00
Sylvestre Ledru
966cf79747
Merge pull request #2551 from uutils/od-hang
...
od: fix reading from file while supplying a format argument
2021-08-09 12:36:31 +02:00
Sylvestre Ledru
ee98efd92e
Merge pull request #2552 from miDeb/cat/show-crlf
...
cat: show `\r\n` as `^M$` when `-E` is enabled
2021-08-09 12:23:59 +02:00
Sylvestre Ledru
ecb042a9a3
Merge pull request #2554 from miDeb/cat/out_is_in
...
cat: check if the input file is also the output file
2021-08-09 12:23:46 +02:00
Michael Debertol
312e1ce9e0
chgrp: don't output an empty error
2021-08-09 01:33:02 +02:00
Dean Li
0f39e7c101
id: use UResult
2021-08-08 18:09:25 +08:00
Michael Debertol
03ceb6750e
cat: check if the input file is also the output file
2021-08-08 01:32:22 +02:00
Michael Debertol
7229360217
cat: remove all per-file state
...
cat cannot keep per-file state, so move all remaining state (one_blank_kept)
to the global state.
2021-08-07 23:04:25 +02:00
Michael Debertol
5be4c48546
cat: show \r\n as ^M$ when -E is enabled
...
This functionality was recently added to GNU cat, but had a bug.
This implementation will be commpatible with gnu once the bug in gnu is fixed.
2021-08-07 21:18:15 +02:00
Jeremy Soller
6af3f774f1
od: fix reading from file while supplying a format argument
...
The following test case read stdin instead of file:
```
echo abcdefg > file
cargo run -- od --format x1 file
```
This is because the -t/--format argument was able to absorb multiple
arguments after it. This has now been fixed, and a test case is added
to ensure it will not happen again.
2021-08-06 15:07:38 -06:00
Jeremy Soller
134c1aa407
ls: do not use gid2grp on redox
2021-08-06 13:56:20 -06:00
Jeremy Soller
ed6a9d4c57
tail: remove unused redox platform
2021-08-06 13:56:20 -06:00
Jeremy Soller
53374207c1
pr: remove unused utmpx feature
2021-08-06 13:56:20 -06:00
Jeremy Soller
27f53aa0df
dd: only require signal-hook on linux
2021-08-06 13:56:20 -06:00
Jeremy Soller
7d07ffc47d
date: disable setting time on redox
2021-08-06 13:56:20 -06:00
Jeremy Soller
0474a2eadd
more, tail, test: Update redox_syscall to 0.2
2021-08-06 13:56:20 -06:00
Sylvestre Ledru
32d281bbcc
Merge pull request #2544 from miDeb/sort/delete-tmps
...
sort: delete temporary files when sort is terminated
2021-08-06 11:52:06 +02:00
Michael Debertol
0ae9e10ed3
sort: delete the temporary directory when sort is terminated
...
When hitting Ctrl+C sort now deletes any temporary files. To make this easier I
created a new struct `TmpDirWrapper` that handles the creation of new temporary
files and the registration of the signal handler.
2021-08-06 11:29:24 +02:00
Sylvestre Ledru
50b9d9f9a3
Merge branch 'master' into master
2021-08-06 09:26:39 +02:00
Sylvestre Ledru
76222d52ca
Merge pull request #2547 from miDeb/basenc
...
basenc: add utility
2021-08-06 08:48:49 +02:00
Sylvestre Ledru
a76be9cb1e
Merge pull request #2548 from miDeb/chown/test
...
chown: fix unit test
2021-08-06 08:43:07 +02:00
Koutheir Attouchi
090be5bb94
chcon: added implementation and integration tests
...
The ToDo list was updated to mark `chcon` as done.
Building and testing `chcon` requires enabling the `feat_selinux` feature. If `make` is used for building, then please specify `SELINUX_ENABLED=1` if building and testing on a system where SELinux is not enabled.
2021-08-05 22:57:57 -04:00
Michael Debertol
b8c383e210
basenc: add utility
...
basenc is a brand-new gnu core utility (added less than 3 years ago!),
which enables some more encodings.
2021-08-06 00:07:19 +02:00
Michael Debertol
ac6356087e
chown: fix unit test
2021-08-06 00:03:04 +02:00
Sylvestre Ledru
63fd139b04
Merge pull request #2524 from FelipeLema/uresult-cat-2464
...
migrate `cat` code to UResult #2464
2021-08-06 00:02:17 +02:00
backwaterred
2c41838166
Merge branch 'uutils:master' into master
2021-08-04 12:47:47 -07:00
Tyler
0864234e3d
Removes unused macros from windows & macos builds
2021-08-04 12:47:03 -07:00
Tyler
601c9fc620
Merge branch 'master' of https://github.com/uutils/coreutils into uutils-master-2
2021-08-03 17:33:43 -07:00
Tyler
7ed7c840bd
Fix clippy warnings and build issues. Defer NL to seperate issue.
2021-08-03 17:18:34 -07:00
Tyler
e1fcc85b0a
Merge branch 'master' of github.com:backwaterred/coreutils
2021-08-03 16:39:17 -07:00
Michael Debertol
9700f0503d
base32/64: adjust error message to match gnu
2021-08-04 00:04:25 +02:00
Michael Debertol
44ae927969
base32/64: print the first extra operand, not the one before
...
Only one operand is allowed, so when there are multiple arguments we
should print the second argument in the error.
2021-08-03 23:37:20 +02:00
Sylvestre Ledru
26cc2ed440
Merge pull request #2517 from jfinkels/tac-null-separator
...
tac: support null separator (-s "")
2021-08-03 09:22:50 +02:00
Jan Scheer
8232c1c64d
id: increase MSRV in order to compile selinux crate
...
* Bump MSRV from 1.43 to 1.47 in order to be able to compile
`selinux` crate 0.1.3
* Bump MSRV for clippy to 1.47
* Add "selinuxlib" to spell-checker
2021-08-02 20:36:06 +02:00
Jan Scheer
010565c8fb
Merge branch 'master' into id_selinux_context
2021-08-02 10:40:45 +02:00
Sylvestre Ledru
950076fd23
Merge pull request #2543 from miDeb/sort/uresult
...
sort: use UResult
2021-08-02 08:26:43 +02:00
Felipe Lema
5646c81332
correct clippy issues, RustFmt
2021-08-01 23:55:30 -04:00
Jeffrey Finkelstein
d74fb62df7
tac: support null separator
2021-08-01 19:47:21 -04:00
Sylvestre Ledru
24b1822cba
Merge pull request #2468 from thomasqueirozb/tail_stdin
...
tail: handle `-` as an alias for stdin
2021-08-02 00:24:28 +02:00
Michael Debertol
a4709c805c
sort: use UResult
2021-08-01 23:22:29 +02:00
Thomas Queiroz
940559f0e1
tail: handle -
as an alias for stdin
2021-08-01 17:20:24 -04:00
James Robson
0e04f959c2
Add Physical mode to realpath
...
This adds the 'Physical Mode' and 'Logical Mode' switches to realpath, which control when symlinks are resolved.
2021-08-01 17:06:09 +01:00
Michael Debertol
af47c66a00
sort: improve tests
2021-08-01 17:12:35 +02:00
Michael Debertol
3d23ace9b8
sort: remove redundant comment
2021-08-01 17:12:06 +02:00
Sylvestre Ledru
2d84c68f20
Merge branch 'master' into sort/input-is-output
2021-08-01 13:51:19 +02:00
Sylvestre Ledru
11d03bffd3
Merge pull request #2539 from miDeb/sort/args-exit-code
...
sort: do not exit with failure for "--version" or "--help"
2021-08-01 13:50:48 +02:00
Jeffrey Finkelstein
0d348f05f2
basename: handle paths comprising only slashes
...
Fix an issue where `basename` would print the empty path when provided
an input comprising only slashes (for example, "/" or "//" or
"///"). Now it correctly prints the path "/".
2021-07-31 18:57:02 -04:00
Yagiz Degirmenci
95a890e5f8
chore(ln): fix clippy errors
...
Signed-off-by: Yagiz Degirmenci <yagizcanilbey1903@gmail.com>
2021-08-01 01:42:12 +03:00
Yagiz Degirmenci
65dd6afa13
chore(ln): delete comment
...
Signed-off-by: Yagiz Degirmenci <yagizcanilbey1903@gmail.com>
2021-08-01 01:27:25 +03:00
Yagiz Degirmenci
55d1dc78b0
feat(ln): use UResult
...
Signed-off-by: Yagiz Degirmenci <yagizcanilbey1903@gmail.com>
2021-08-01 01:25:21 +03:00
Michael Debertol
663c9751a1
sort: do not exit with failure for "--version" or "--help"
2021-08-01 00:05:08 +02:00
Michael Debertol
418f5b7692
sort: handle empty merge inputs
2021-07-31 21:02:20 +02:00
Michael Debertol
5bf4536bdd
sort: ignore failure to truncate the output file
2021-07-31 21:02:20 +02:00
Michael Debertol
f29239beec
sort: buffer writes to the output
...
This fixes a regression from a33b6d87b5
2021-07-31 21:02:20 +02:00
Michael Debertol
849086e9c5
sort: handle cases where the output file is also an input file
...
In such cases we have to create a temporary copy of the input file to prevent
overwriting the input with the output. This only affects merge sort, because it
is the only mode where we start writing to the output before having read all inputs.
2021-07-31 21:02:18 +02:00
Sylvestre Ledru
103a9d52ff
Merge pull request #2521 from miDeb/sort/rand
...
sort: improve compatibility of --random-sort
2021-07-31 21:00:18 +02:00
Michael Debertol
3564dc5792
sort: compare strings before comparing hashes
...
Since lines that compare equal should be sorted together, we need to first
compare the lines (taking settings into account). Only if they do not compare
equal we should compare the hashes.
2021-07-31 20:07:05 +02:00
Michael Debertol
f851fb6454
sort: initialize the salt when the random setting is on a key as well
...
Additionall, change the type of `salt` from `String` to `Option<[u8; 16]>`.
2021-07-31 20:07:05 +02:00
Michael Debertol
095e53aed2
sort: disallow equal lines for --check with --unique
2021-07-31 19:57:41 +02:00
Andreas Hartmann
ce037bdf55
install: remove obsolete function call
...
The `copy_file_to_file` function was only a wrapper to a `copy` function with
the exact same interface. It has now beed removed for clarity.
2021-07-31 13:06:37 +02:00
Andreas Hartmann
4f235e9e95
install: Use uio_error
to construct errors from std::io::Error
...
Use new macro to construct UIoError types from `std::io::Error` before
printing. This gives consistent error messages across all utilities as it
prepends custom errors to the error description for the respective application
and error type. This saves the developers from manually appending the
`std::io::Error`-specific error messages.
2021-07-31 13:06:37 +02:00
Andreas Hartmann
0461a45c9a
install: Use show! macro for noncritical errors during execution
...
Drop the previous flags that would tell whether a noncritical error occured
during execution in favor of the `show!` macro from the error submodule.
This allows us to generate regular error types during execution to signify
failures inside the program, but without prematurely aborting program execution
if not needed or specified.
Also make verbose outputs use `print!` and friends instead of `show_error!` to
ensure verbose output is redirected to stdout, not stderr.
2021-07-31 13:06:37 +02:00
Andreas Hartmann
2b18e45ece
install: Use UResult
...
Related to uutils#2464
2021-07-31 13:06:37 +02:00
Sylvestre Ledru
1eb3b62c46
Merge pull request #2537 from jfinkels/expand-improve-tabs-argument-2
...
expand: expand support for --tabs arguments
2021-07-31 10:33:08 +02:00
Sylvestre Ledru
e780fba2e5
fix a clippy warning
2021-07-31 10:27:51 +02:00
Sylvestre Ledru
638b31a877
Merge pull request #2520 from miDeb/sort/fixes
...
sort: fix some exit codes and error messages
2021-07-31 10:11:12 +02:00
Sylvestre Ledru
8620220298
Merge pull request #2511 from dezgeg/stat-t
...
stat: Support \t in --printf format
2021-07-31 09:52:42 +02:00
Sylvestre Ledru
82a02bf2eb
Merge pull request #2512 from syukronrm/df-uresult
...
df: add `UResult`
2021-07-31 09:52:22 +02:00
Sylvestre Ledru
fd02ef2dc1
Merge pull request #2516 from jfinkels/tac-read-dir-error-message
...
tac: correct error message when reading from directory
2021-07-31 09:49:54 +02:00
Sylvestre Ledru
00f6fce89d
Merge pull request #2518 from jfinkels/tac-no-line-separators-in-file
...
tac: handle no line separators in file
2021-07-31 09:44:29 +02:00
Sylvestre Ledru
938f79aebc
Merge branch 'master' into sort/fixes
2021-07-31 09:42:35 +02:00
Jeffrey Finkelstein
fb477360b2
expand: expand support for --tabs arguments
...
Add support for
* space-separated list of tab stops, like `--tabs="2 4 6"`,
* mixed comma- and space-separated lists, like `--tabs="2,4 6"`,
* the slash specifier in the last tab stop, like `--tabs=1,/5`,
* the plus specifier in the last tab stop, like `--tabs=1,+5`.
2021-07-30 23:46:02 -04:00
Michael Debertol
4759505024
sort: split a line to make rustfmt work again
2021-07-30 23:41:18 +02:00
Michael Debertol
1bb530eebb
sort: validate input files at startup
2021-07-30 23:41:18 +02:00
Michael Debertol
a33b6d87b5
sort: open the output file at the beginning
...
This causes us to print an error message about an invalid output file
right at the start of the invocation, but *after* verifying other arguments.
2021-07-30 23:40:53 +02:00
Michael Debertol
c6e044927c
sort: print check messages to stderr, not stdout
2021-07-30 23:37:35 +02:00
Michael Debertol
891d25cebd
sort: fix exit codes and error messages
2021-07-30 23:37:35 +02:00
Michael Debertol
a214ca60bd
sort: allow null bytes for -t
2021-07-30 23:30:52 +02:00
Sylvestre Ledru
12dc3db972
Merge pull request #2526 from miDeb/sort/usage
...
sort: remove duplication from usage string
2021-07-30 22:45:10 +02:00
Hanif Bin Ariffin
56f4e809fd
Silently accepts ---presume-input-tty
...
For whatever reason, the following is equivalent,
cargo run -- rm --presume-input-tty
cargo run -- rm ---presume-input-tty
cargo run -- rm -----presume-input-tty
cargo run -- rm ---------presume-input-tty
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-07-29 21:36:15 +08:00
Tyler
0cb5cff697
Build blockers
...
- cSpell valiantly vanquished
- fmt issues addressed
2021-07-28 14:29:07 -07:00
Michael Debertol
bd7d8fdde7
sort: remove duplication from usage string
...
The custom usage string does not have to include the "sort\nUsage:" part,
because this part is already printed by clap.
It prevents the following duplication:
USAGE:
sort
Usage:
sort [OPTION]... [FILE]..
Now, only the following is printed:
USAGE:
sort [OPTION]... [FILE]...
2021-07-27 23:58:44 +02:00
Felipe Lema
2106ddd088
migrate cat
code to UResult #2464
2021-07-27 00:07:32 -04:00
Tyler
0bbd4d4992
Merge branch 'master' of github.com:backwaterred/coreutils
2021-07-26 17:49:12 -07:00
backwaterred
b3e7ff9d04
Merge branch 'uutils:master' into master
2021-07-26 17:47:01 -07:00
Tyler
2ab238a0f1
Attempts to fix remaining checks.
...
- Adds more jargon to the spellchecker jargon file.
- Adds more ignores to the per-project ignores.
- Fixes clippy warnigns about uneeded clones on non-linux.
- Block/Unblock now account for system dependend newlines.
2021-07-26 17:43:49 -07:00
Sylvestre Ledru
978033a241
Merge pull request #2519 from jfinkels/pathchk-remove-double-negation
...
pathchk: remove double negation
2021-07-26 13:42:58 +02:00
Jeffrey Finkelstein
3c7940ddfd
pathchk: remove double negation
2021-07-25 16:22:22 -04:00
Jeffrey Finkelstein
2648f330e4
tac: handle no line separators in file
...
Change the behavior of `tac` when there are no line separators in the
input. Previously, it was appending an extra line separator; this commit
prevents that from happening. The input is now writted directly to
stdout.
2021-07-25 15:19:29 -04:00
Jeffrey Finkelstein
abf4c69b28
tac: correct error message when reading from dir.
...
Correct the error message produced by `tac` when trying to read from a
directory. Previously if the path 'a' referred to a directory, then
running `tac a` would produce the error message
dir: read error: Invalid argument
after this commit it produces
a: read error: Invalid argument
which matches GNU `tac`.
2021-07-25 13:55:24 -04:00
sagudev
4f4338f1c0
Delete all allow(nonstandard_macro_braces) and fix other clippy warnings
2021-07-25 18:51:16 +02:00
sagu
9702aa6414
Revert "silent buggy clippy warning"
2021-07-25 18:06:41 +02:00
Daniel Rocco
d8d71cc477
test: handle additional parentheses edge cases
...
Handle additional edge cases arising from test(1)’s lack of reserved words.
For example, left parenthesis followed by an operator could indicate
either
* string comparison of a literal left parenthesis, e.g. `( = foo`
* parenthesized expression using an operator as a literal, e.g. `( = != foo )`
2021-07-24 23:02:02 -04:00
Tyler
d1907edd65
Adds additional words to exclude list. Improves documentation in dd.rs.
2021-07-24 16:38:08 -07:00
Tyler
86245ec754
Adds spell checker ignores to remaining project files.
2021-07-24 15:03:17 -07:00
Syukron Rifail M
5c7afe7a6b
df: add UResult
2021-07-24 20:18:57 +07:00
Tyler
076ff32e85
Removes project-specific cspell files.
2021-07-23 14:53:24 -07:00
Tuomas Tynkkynen
46a2491727
stat: Support \t in --printf format
2021-07-23 19:04:18 +03:00
Tyler
885a875552
Addresses build errors
...
- Adds words to cspell exceptions
- Converts test macros to use Default trait.
- Converts parser to use Default trait.
- Adds Windows-friendly test files for block/unblock when nl is present
in test/spec file.
2021-07-22 16:04:35 -07:00
Tyler
989849eca7
Ignores linux-only tests on non-linux platforms.
2021-07-21 18:24:31 -07:00
Tyler
95d9f03cff
Merge branch 'master' of github.com:backwaterred/coreutils
2021-07-21 17:33:18 -07:00
backwaterred
7c94bbe238
Merge branch 'uutils:master' into master
2021-07-21 17:33:07 -07:00
Tyler
9d9267e08b
Addresses code-quality issues from testsdiepraam and miDeb.
...
- Removes dd from feat_require_unix (keeps it in feat_common_core)
- Changes name of make_linux_iflags parameter from oflags to iflags.
- Removes roughed out SIGINFO impl.
- Renames plen -> target_len.
- Removes internal fn def for build_blocks and replaces with a call to
chunks from std.
- Renames apply_ct to the more descriptive apply_conversion
- Replaces manual swap steps in perform_swab with call to swap from std.
- Replaces manual solution with chunks where appropriate (in Read, and Write impl).
- Renames xfer -> transfer (in local variable names).
- Improves documentation for dd_filout/dd_stdout issue.
- Removes commented debug_assert statements.
- Modifies ProdUpdate to contain ReadStat and WriteStat rather than
copying their fields.
- Addresses verbose return in `Output<File>::new(...)`
- Resoves compiler warning when built as release when signal handler fails to
register.
- Derives _Default_ trait on ReadStat.
- Adds comments for truncated lines in block unblock tests
- Removes `as u8` in block unblock tests.
- Removes unecessary `#[inline]`
- Delegates multiplier string parsing to uucore::parse_size.
- Renames 'unfailed' -> 'succeeded' for clairity.
- Removes #dead_code warnings. No clippy warnings on my local machine.
- Reworks signal handler to better accomodate platform-specific signals.
- Removes explicit references to "if" and "of" in dd.rs.
- Removes explicit references to "bs", "ibs", "cbs" and "status" in
parseargs.rs.
- Removes `#[allow(deadcode)]` for OFlags, and IFlags.
- Removes spellchecker ignore from all dd files.
- Adds tests for 'traditional' and 'modern' CLI.
2021-07-21 17:25:10 -07:00
Terts Diepraam
eae8c72793
Merge pull request #2467 from Funky185540/backup_mode_determination
...
backup_control: Fix backup mode determination
2021-07-20 13:27:04 +02:00
Andreas Hartmann
e07b4e9f59
install: Adapt to modified backup mode determination
2021-07-19 17:01:49 +02:00
Andreas Hartmann
2db1ec99f1
ln: Adapt to modified backup mode determination
2021-07-19 17:01:49 +02:00
Andreas Hartmann
3a0164310a
cp: Adapt to modified backup mode determination
2021-07-19 17:01:49 +02:00
353fc443
e9174f7d82
chown: code cleanup
2021-07-17 18:37:53 +00:00
353fc443
3c3daf5023
chown: added UResult
2021-07-17 08:52:17 +00:00
Terts Diepraam
f5ba8b1811
Merge pull request #2499 from 353fc443/uresult-kill
...
Add Uresult for false, echo, pwd, true and kill
2021-07-13 17:29:26 +02:00
353fc443
a6b0cf29e0
kill: added suggestions
2021-07-13 14:55:12 +00:00
353fc443
bd45fe26dc
true: added uresult
...
Related to #2464
2021-07-13 13:47:06 +00:00
Jan Scheer
6111cd6e1b
id: add note about conditional compiling to README section
2021-07-13 14:38:46 +02:00
353fc443
7d94121b95
kill: added uresult
...
Related to #2464
2021-07-13 09:49:39 +00:00
Jan Scheer
36a192c5f6
id: fix error handling for id_print()
2021-07-13 11:25:03 +02:00
353fc443
425de97650
pwd: added uresult
...
Related to #2464
2021-07-13 09:10:47 +00:00
353fc443
2845dd3140
echo: adding uresult
...
Related to #2464
2021-07-13 08:55:33 +00:00
353fc443
5730c8693f
sleep: fixing clippy warnings
2021-07-13 07:25:18 +00:00
353fc443
c48e623a80
false: addding uresult
...
Related to #2464
2021-07-13 06:56:27 +00:00
Jan Scheer
7abc6a665e
id: add conditional compilation for selinux
2021-07-13 00:22:10 +02:00
Tyler
94e0145d51
fixes more minor issues
2021-07-12 12:54:39 -07:00
Son Nguyen
6c26976edb
sleep: use UResult ( #2492 )
...
* sleep: use UResult in util
* sleep: add in error + test for it
* sleep: UResult - removed some verbosity
2021-07-12 20:20:23 +02:00
Tyler
bb0d70965d
Commits changed Cargo.toml in dd
2021-07-12 10:36:38 -07:00
Tyler
994b4d9a3e
Merge remote-tracking branch 'upstream/master'
2021-07-12 10:22:20 -07:00
Tyler
88363858d5
Minor changes.
2021-07-12 10:13:47 -07:00
Jan Scheer
92bc647ac3
Merge branch 'master' into id_selinux_context
2021-07-12 17:30:21 +02:00
Sylvestre Ledru
35a9b7f1fb
fix the base32 dep
2021-07-11 21:32:01 +02:00
Sylvestre Ledru
26a882551b
update the dep to uucore_procs 0.0.6
2021-07-11 21:04:11 +02:00
Sylvestre Ledru
1d8a66b7d3
Update to version 0.0.7
2021-07-11 18:04:56 +02:00
Sylvestre Ledru
d4f27f1454
rustfmt the recent change
2021-07-11 11:23:51 +02:00
Sylvestre Ledru
caf984bd55
fix various clippy issues
2021-07-11 11:22:33 +02:00
Sylvestre Ledru
52c6593ef5
Merge pull request #2486 from hbina/hbina-tr-return-err-when-extra-args
...
`tr` should error out when if user provides more than 2 sets
2021-07-10 20:51:27 +02:00
Hanif Bin Ariffin
15f6e35163
Use map/default instead of match
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-07-10 18:51:24 +08:00
Hanif Bin Ariffin
199b4e437b
Removed manual checks to just using clap instead
...
Also added tests for this.
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-07-10 18:49:13 +08:00
Jan Scheer
30b80d0c82
tr: fix squeeze and complement with two sets ( #2485 )
2021-07-09 23:05:00 +02:00
Hanif Bin Ariffin
c4c6819dae
Reimplemented simply using args
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-07-09 23:51:37 +08:00
Hanif Bin Ariffin
db79b5abb2
tr
should error out when if user provides more than 2 sets
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-07-09 23:22:12 +08:00
Jan Scheer
cf2c712e6b
Merge branch 'master' into id_selinux_context
2021-07-09 00:21:05 +02:00
Tyler
9aac61c672
Merge branch 'master' of github.com:backwaterred/coreutils
2021-07-08 11:12:25 -07:00
Tyler
47806ddd39
build issues
...
- Address Rust fmt issue
- ignores run-without-noatime test which fails on some build machines
- adds cspell:disable to all project files.
- adds .../dd/fixtures/cspell.json to ignore test fixtures.
2021-07-08 11:10:48 -07:00
backwaterred
fdfe2dcc1f
Merge branch 'uutils:master' into master
2021-07-08 10:47:51 -07:00
Tyler
4f7dda4be9
Completes final? issues barring PR
...
- Adds cspell.json. Hopefully this will make you happy, spellchecker.
- Removes non-functional spellchecker-ignore tags
- Adds a sleep call to the no noatime test. Some systems were did not notice a changed
atime without the option present.
- Adds a test with a unicode filename.
- Addresses clippy lints and rustfmt issues.
2021-07-07 17:34:31 -07:00
Sylvestre Ledru
cea0fc844a
Merge pull request #2476 from siebenHeaven/du_uresult
...
du: Use UResult
2021-07-07 15:44:11 +02:00
Sylvestre Ledru
df683f8c84
Merge pull request #2465 from miDeb/install-test
...
[: install test as [ as well
2021-07-07 15:43:38 +02:00
Sylvestre Ledru
7018ff8925
Merge pull request #2477 from dhodder/uname_target_env
...
uname: don't report OS as "GNU/Linux" without GNU
2021-07-07 08:46:50 +02:00
Tyler
74e0071cfe
fixes conv=nocreat test failure
2021-07-06 17:47:26 -07:00
backwaterred
96f93488ef
Merge branch 'uutils:master' into master
2021-07-06 15:59:03 -07:00
Dave Hodder
7a62d8e4e7
uname: add NetBSD to operating systems list
2021-07-06 23:42:16 +01:00
Tyler
d2cebad931
addresses a few more issues from PR#2474
...
- adds project header to multiple files
- updates spell check skip words
- removes linux only flags direct,noatime from mac_os build
- applies rustfmt to test_dd
2021-07-06 15:35:48 -07:00
Tyler
09acfce995
Merge branch 'master' of github.com:backwaterred/coreutils
2021-07-06 11:55:25 -07:00
Tyler
1ad89c5e89
Addresses issues raised in PR#2474
...
- runs rustfmt on test_dd.rs
- eliminates compiler warnings
- adds many words to spellchecker ignore list
- adds sanity test for vexing conv=nocreat issue. Still WIP.
2021-07-06 11:52:48 -07:00
Sylvestre Ledru
9ad70a4f5d
Merge pull request #2480 from miDeb/sort/key-args
...
sort: make -k only take one argument per flag
2021-07-06 18:58:50 +02:00
Michael Debertol
8ace291b32
sort: make -k only take one argument per flag
...
This makes it so that `sort -k 1 file` treats `file` as the input file
and not the second key.
2021-07-06 15:47:32 +02:00
Jan Scheer
e53f4db33a
Merge branch 'master' into id_selinux_context
2021-07-06 13:29:50 +02:00
Michael Debertol
bc0727cc4d
[: add support for --help and --version
...
I copied the help text verbatim from GNU, I hope that's ok.
2021-07-06 13:15:07 +02:00
Sylvestre Ledru
d5b2320a59
Fix clippy warning
...
Useless use of format
2021-07-06 12:44:33 +02:00
Sylvestre Ledru
16a5faf886
Silent buggy clippy warnings
2021-07-06 12:12:36 +02:00
Terts Diepraam
e253fb89db
Merge branch 'master' into hostname-uresult
2021-07-06 11:21:42 +02:00
Dave Hodder
c74b77aec8
uname: don't report OS as "GNU/Linux" without GNU
...
The `uname` `-o` switch reports the operating system used. If the GNU C
standard library (glibc) is not in use, for example if musl is being
used instead, report "Linux" instead of "GNU/Linux".
2021-07-05 22:42:42 +01:00
backwaterred
0b981d9dc3
Update src/uu/dd/src/datastructures.rs
...
Adds project header to conversion_tables.rs
Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
2021-07-05 11:34:22 -07:00
Tyler
418ecbe61a
Makes multiplier parsing system dependant
...
- multipler is now created as u128, then returned as usize after
conversion. Errors due to overflow now depend on the system on which
the code is run.
2021-07-05 11:27:17 -07:00
Andreas Hartmann
9d94307880
mv: Adapt for new backup_control utilities
2021-07-05 12:44:44 +02:00
Anup Mahindre
a9ba4c6d9f
du: Use UResult
2021-07-04 22:44:25 +05:30
Sylvestre Ledru
f2e12fee0a
Silent buggy clippy warnings
...
Fails with:
```
error: use of irregular braces for `write!` macro
--> src/uucore/src/lib/features/encoding.rs:19:17
|
19 | #[derive(Debug, Error)]
| ^^^^^
|
= note: `-D clippy::nonstandard-macro-braces` implied by `-D warnings`
help: consider writing `Error`
--> src/uucore/src/lib/features/encoding.rs:19:17
|
19 | #[derive(Debug, Error)]
| ^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonstandard_macro_braces
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info)
```
2021-07-04 19:06:37 +02:00
Sylvestre Ledru
1136221f6f
rustfmt the recent change
2021-07-04 13:01:31 +02:00
353fc443
d0805605e0
imported UUsageError
2021-07-04 16:09:55 +05:30
Sylvestre Ledru
38c0880989
fix the clippy warning
2021-07-04 12:03:36 +02:00
Sylvestre Ledru
e4204fcf07
Merge pull request #2436 from hbina/hbina-ls-refactor-options-module
...
ls: Refactored options and other long constants to fix formatting
2021-07-04 11:59:06 +02:00
Sylvestre Ledru
91078cfcb3
Merge pull request #2445 from syukronrm/du-inodes
...
du: add `--inodes`
2021-07-04 11:28:03 +02:00
Sylvestre Ledru
d3652cc3c0
Merge pull request #2457 from Funky185540/install-implement-backup
...
install: implement --backup, -b and -S
2021-07-04 09:57:45 +02:00
Tyler
860cbc6311
Removes or ignores all compiler warnings
2021-07-02 15:30:46 -07:00
Tyler
8e862b86dd
More minor cleanup.
...
- Runs rustfmt.
- Speel check help-text
2021-07-02 14:24:01 -07:00
Tyler
7f03ecf74b
Adds failures & tests for unimplmented flags.
2021-07-02 13:17:34 -07:00
Tyler
5b030b4855
Minor cleanup
...
- Removes compiler warnings.
- Renames conv=nocreat test to be more descriptive.
2021-07-02 11:50:33 -07:00
backwaterred
9c38583c6b
Merge pull request #2 from uutils/master
...
catchup with uutils main
2021-07-02 11:34:22 -07:00
Tyler
951d9c0822
Completes transition to clap
...
- fixes build issues in parser tests.
2021-07-02 11:31:06 -07:00
Tyler
8334d9f574
Build changes after merge with uutils main
2021-07-02 10:53:15 -07:00
353fc443
23f5f55560
Added UResult for dirname
2021-07-02 12:14:24 +00:00
353fc443
f66f10c4ed
Added UResult for hostid
2021-07-02 12:03:14 +00:00
353fc443
330db2eb3e
Added UResult for hostname
2021-07-02 08:19:33 +00:00
Tyler
92281585a7
Merge branch 'master' of https://github.com/uutils/coreutils into uutils-master
2021-07-01 14:33:30 -07:00
Terts Diepraam
5a40148602
Merge pull request #2463 from miDeb/wrap-help
...
all utils: enable wrap_help
2021-07-01 13:18:32 +02:00
Terts Diepraam
7a0a7aecc4
Merge pull request #2461 from miDeb/sort/check-no-out
...
sort: disable -o with -C and -c
2021-07-01 13:07:05 +02:00
Terts Diepraam
6213a2a967
Merge pull request #2462 from miDeb/sort/version
...
sort/ls: implement version cmp matching GNU spec
2021-07-01 13:02:59 +02:00
Tyler
17cfba41cc
Implements project testfing from root.
...
- conv=FLAG testing. (1) WIP conv=nocreat
- iflag & oflag testing.
- conv=CONV ascii,...,ucase,...,block,...sync tests at unit-test-level
(project root is todo)
2021-06-30 14:47:48 -07:00
Dean Li
b21e01bcb0
arch: match GNU error
...
Follow up for #2466 as suggested by @miDeb
2021-06-30 22:32:59 +08:00
Dean Li
92bfaea3fa
arch: use UResult
2021-06-29 19:48:20 +08:00
Michael Debertol
cd83aed89c
test: go into '[' mode when executable ends with [
...
This makes [ work even when installed with a custom prefix, e.g. as uu-[.
2021-06-29 00:28:01 +02:00
Terts Diepraam
0cfaaeceda
touch: adapt to standardized error handling
2021-06-28 13:55:55 +02:00
Terts Diepraam
73a7ead857
mktemp: adapt to standardized error handling
2021-06-28 13:55:55 +02:00
Terts Diepraam
8c5052fcb7
mkdir: adapt to standardized error handling
2021-06-28 13:55:37 +02:00
Terts Diepraam
e4eac825fb
ls: adapt to standardized error handling
2021-06-28 13:49:57 +02:00
Syukron Rifail M
27e0507844
du: more tests
2021-06-28 07:51:17 +07:00
Syukron Rifail M
d8a33da5b3
du: add --inodes
2021-06-28 07:51:17 +07:00
Andreas Hartmann
1a43a94e31
install: Apply rustfmt
2021-06-27 17:59:04 +02:00
Michael Debertol
d3732e08c4
sort: disable -o with -C and -c
2021-06-27 16:21:18 +02:00
Michael Debertol
2ebca384c6
all utils: enable wrap_help
...
This makes clap wrap the help text according to the terminal width,
which improves readability for terminal widths < 120 chars,
because clap defaults to a width of 120 chars without this feature.
2021-06-27 16:17:10 +02:00
Michael Debertol
233a778963
sort/ls: implement version cmp matching GNU spec
...
This reimplements version_cmp, which is used in sort and ls to sort
according to versions.
However, it is not bug-for-bug identical with GNU's implementation.
I reported a bug with GNU here:
https://lists.gnu.org/archive/html/bug-coreutils/2021-06/msg00045.html
This implementation does not contain the bugs regarding the handling of
file extensions and null bytes.
2021-06-27 15:29:17 +02:00
Andreas Hartmann
df41fed640
install: Mark '-S', '-b' and '--backup' as implemented
...
Removes the "unimplemented" notice from the respective help texts. Stop
printing errors if the options are supplied via CLI.
2021-06-27 09:54:55 +02:00
Andreas Hartmann
5437985705
install: Implement '--backup' and '-b'
...
Adds the ability to perform file backups before installing newer files on top
of existing ones. Adds a status message about backups to stdout if running in
verbose mode.
2021-06-27 09:54:17 +02:00
Andreas Hartmann
49a9f359bb
install: Make use of 'backup_controls' for '--backup' opts
...
Use the methods and types offered by the 'backup_controls' module to implement
the logic for backing up files instead of overwriting.
2021-06-27 09:54:07 +02:00
Hanif Bin Ariffin
4778a64989
ls: Refactored options and other long constants to fix formatting
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Keep one of the texts in-place
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Reduced the fix to just formatting changes
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-27 14:55:55 +08:00
Andreas Hartmann
a85adf3c3f
install: Internally rename short '-b' option
...
Rename from OPT_BACKUP_2 to a more descriptive name "OPT_BACKUP_NO_ARGS".
2021-06-26 00:27:08 +02:00
Andreas Hartmann
3155cd510f
install: Fix argument parsing for '--backup'
...
The '--backup' option would previously accept arguments separated from the
option either by a space or an equals sign. The GNU implementation strictly
requires an "equals" for argument separation.
As the argument to '--backup' is optional, the equals sign mustn't be ommited
as otherwise there is no way to tell a file argument apart from an argument
that's meant for the '--backup' option. This ensures that if '--backup' is
present it either has no further associated arguments (i.e. fallback to the
default), or the arguments are separated by an equals sign.
2021-06-26 00:27:08 +02:00
Michael Debertol
73cfcc27e7
cp: insert some spaces into the help text
2021-06-25 21:23:45 +02:00
Michael Debertol
2e027bf45d
true, false: enable --help and --version
2021-06-25 21:23:45 +02:00
Michael Debertol
0fec449de3
mkfifo: make rustfmt work
2021-06-25 21:23:45 +02:00
Michael Debertol
a8d62b9b23
fmt: fix indentation for help
2021-06-25 21:23:45 +02:00
Michael Debertol
0531153fa6
uutils: move clap::App creation to separate functions
2021-06-25 21:23:45 +02:00
Michael Debertol
004b5d1b38
format: formatting
2021-06-25 19:35:33 +02:00
Michael Debertol
548a895cd6
sort: compatibility of human-numeric sort
...
Closes #1985 .
This makes human-numeric sort follow the same algorithm as GNU's/FreeBSD's sort.
As documented by GNU in https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html ,
we first compare by sign, then by si unit and finally by the numeric value.
2021-06-25 18:19:00 +02:00
Sylvestre Ledru
fef8761ac1
Merge pull request #2443 from miDeb/sort/data-oriented
...
sort: separate additional data from the Line struct
2021-06-24 21:19:23 +02:00
Sylvestre Ledru
ab5d581fa4
Merge pull request #2439 from tertsdiepraam/numfmt/round-and-c-locale
...
`numfmt`: add `--round` and other minor improvements
2021-06-24 21:18:59 +02:00
Sylvestre Ledru
5d7cf61128
Merge pull request #2429 from miDeb/install/target-dir
...
install: support --target-directory
2021-06-24 21:06:44 +02:00
Michael Debertol
8bebfbb3e6
sort: don't store slices for general numeric sort
...
Gerenal numeric sort works by comparing pre-parsed floating point
numbers. That means that we don't have to store the &str the float was
parsed from.
As a result, memory usage was slightly reduced for general numeric sort.
2021-06-24 18:33:33 +02:00
Sylvestre Ledru
3b2d0d17fa
Merge pull request #2446 from jhscheer/groups_gnu_testsuite
...
groups: fixes to pass GNU's Testsuite
2021-06-23 20:15:12 +02:00
Sylvestre Ledru
44c770d234
Merge pull request #2450 from jhscheer/id_refactor_identifier
...
id: refactor identifiers
2021-06-23 19:05:57 +02:00
Jan Scheer
11f36eae3b
tests/groups: fix/add tests for (multiple) username(s)
2021-06-23 16:50:03 +02:00
Sylvestre Ledru
d40fc65ee6
Merge branch 'master' into numfmt/round-and-c-locale
2021-06-23 12:39:55 +02:00
Sylvestre Ledru
a73e71ba74
Merge pull request #2437 from miDeb/cp/reflink-auto
...
cp: default to --reflink=auto on linux and macos
2021-06-23 12:37:44 +02:00
Sylvestre Ledru
87eaf6e80a
Merge pull request #2447 from jhscheer/locale_c
...
fix some issues with locale (replace "LANGUAGE" with "LC_ALL")
2021-06-23 12:36:40 +02:00
Jan Scheer
4b3da59b0e
id: refactor identifiers
...
* change of identifier names and spelling according to the suggestions in the review of #2446
2021-06-23 12:27:01 +02:00
Jan Scheer
c0be979611
fix some issues with locale (replace "LANGUAGE" with "LC_ALL")
...
`LANGUAGE=C` is not enough, `LC_ALL=C` is needed as the environment
variable that overrides all the other localization settings.
e.g.
```bash
$ LANGUAGE=C id foobar
id: ‘foobar’: no such user
$ LC_ALL=C id foobar
id: 'foobar': no such user
```
* replace `LANGUAGE` with `LC_ALL` as environment variable in the tests
* fix the the date string of affected uutils
* replace `‘` and `’` with `'`
2021-06-23 11:30:28 +02:00
Sylvestre Ledru
178399c20e
Merge pull request #2449 from miDeb/temp-win
...
Make tests pass on a windows VM
2021-06-23 08:40:30 +02:00
Michael Debertol
d60afb8947
mkdir: note that -m is not supported on windows
2021-06-23 00:59:51 +02:00
Michael Debertol
4a956f38b9
sort: separate additional data from the Line struct
...
Data that was previously boxed inside the `Line` struct was moved to
separate vectors. Inside of each `Line` remains only an index that
allows to access that data.
This helps with keeping the `Line` struct small and therefore reduces
memory usage in most cases.
Additionally, this improves performance because one big allocation (the
vectors) are faster than many small ones (many boxes inside of each
`Line`). Those vectors can be reused as well, reducing the amount of
(de-)allocations.
2021-06-23 00:36:05 +02:00
Michael Debertol
622504467f
mktemp: note that windows uses a different env var for tmpdir
...
On windows `std::env::temp_dir` uses the `TMP` environment variable
instead of `TMPDIR`.
2021-06-22 17:44:45 +02:00
Sylvestre Ledru
e48ff9dd9e
Merge pull request #2441 from siebenHeaven/ls_dangling_symlinks
...
ls: Fix problems dealing with dangling symlinks
2021-06-21 22:34:15 +02:00
Sylvestre Ledru
a982030032
Merge pull request #2386 from youknowone/dircolors-double-scan
...
Prevent double scanning from dircolors
2021-06-21 22:31:24 +02:00
Sylvestre Ledru
97ce44b102
Merge pull request #2407 from hbina/hbina-more-terminal-resize
...
Improvements to `more`.
2021-06-21 22:30:07 +02:00
Tyler
47464f50a1
Begin project level testing. Minor fixes.
2021-06-21 11:17:47 -07:00
Anup Mahindre
4b3224dd82
ls: Fix clippy warning
2021-06-21 20:29:22 +05:30
Jan Scheer
25ef39472c
groups: fix to pass GNU Testsuite groups-process-all.sh
...
* add support for multiple users
* sync help text with GNU's `groups` manpage
2021-06-21 14:33:09 +02:00
Jan Scheer
30e45eefa4
groups: fix to pass GNU Testsuite groups-dash.sh
2021-06-21 13:19:57 +02:00
Rémi Lauzier
6aa79440f5
Fix a clippy warning
2021-06-20 21:21:50 -04:00
Michael Debertol
a91369bbff
cp: fix dead code warnings on windows
2021-06-20 19:10:51 +02:00
Jan Scheer
f1d317147b
id: add support for showing SELinux context (--context/-Z)
2021-06-20 13:44:41 +02:00
Anup Mahindre
3b641afadc
ls: Fix issue with Windows and dangling symbolic links
...
- Windows hidden file attribute determination would assume symbolic link
to be valid and would panic
- Check symbolic link's attributes if the link points to non-existing
file
2021-06-20 16:56:25 +05:30
Terts Diepraam
5ac0274c13
numfmt: fix doctest and spell check
2021-06-20 11:50:14 +02:00
Anup Mahindre
f6cb1324b6
ls: Fix problems dealing with dangling symlinks
...
- For dangling symlinks, errors should only be reported if
dereferencing options were passed and dereferencing was applicable to
the particular symlink
- With -i parameter, report '?' as the inode number for dangling
symlinks
2021-06-20 13:31:45 +05:30
Terts Diepraam
3086e95702
numfmt: add round and use C locale style for errors
2021-06-20 00:21:14 +02:00
Sylvestre Ledru
115eb5eb52
Merge pull request #2432 from dezgeg/test-bracket-syntax
...
test: Implement [ expr ] syntax
2021-06-19 19:14:20 +02:00
Michael Debertol
076c7fa501
cp: default to --reflink=auto on linux and macos
2021-06-19 18:59:57 +02:00
Michael Debertol
9fb927aa85
cp: always delete the destination for symlinks
2021-06-19 18:59:57 +02:00
Michael Debertol
6400cded54
cp: fix order of checks in copy_helper
2021-06-19 18:59:57 +02:00
Tuomas Tynkkynen
7b9814c778
test: Implement [ expr ] syntax
...
When invoked via '[' name, last argument must be ']' or we bail out with
syntax error. Then the trailing ']' is simply disregarded and processing
happens like usual.
2021-06-19 18:49:21 +03:00
Sylvestre Ledru
5ba69d4a35
Merge pull request #2412 from syukronrm/du-dereference
...
du: add `--dereference`
2021-06-19 12:05:18 +02:00
Sylvestre Ledru
ac98960f32
Merge pull request #2427 from miDeb/ln/recursive-relative
...
ln: don't return an empty path in `relative_path`
2021-06-19 12:03:59 +02:00
Sylvestre Ledru
65fe9beaad
bring back #[cfg(windows)]
2021-06-19 08:58:33 +02:00
Sylvestre Ledru
e2a00b67ed
Merge pull request #2428 from jhscheer/cut_2424
...
cut: fix `-d=` (#2424 )
2021-06-19 08:46:42 +02:00
Sylvestre Ledru
7739080e6e
Merge pull request #2430 from tertsdiepraam/cp/update-options
...
`cp`: use `options` module and update list op implemented args
2021-06-18 18:50:36 +02:00
Sylvestre Ledru
54ccfdfd9f
Merge pull request #2413 from deantvv/ls-show-control-if-tty
...
ls: set show-control-char if stdout is terminal
2021-06-18 18:26:22 +02:00
Terts Diepraam
f1e043ca1b
Merge pull request #2361 from jhscheer/id_zero_2351
...
id: revamp to pass more of GNU's Testsuite
2021-06-18 18:10:49 +02:00
Terts Diepraam
14520fb64e
cp: remove redundant newline in readme
2021-06-18 18:00:27 +02:00
Terts Diepraam
fdfa44cb5c
Merge branch 'master' into cp/update-options
2021-06-18 17:59:13 +02:00
Terts Diepraam
ab3f2cb672
cp: update list of implemented arguments
2021-06-18 17:56:22 +02:00
Terts Diepraam
cf1a7d0796
cp: use options module
2021-06-18 17:56:04 +02:00
Terts Diepraam
e273cb8e4f
Merge pull request #2426 from miDeb/cp/symlinks
...
cp: improve symlink handling
2021-06-18 17:27:50 +02:00
Michael Debertol
4e62c9db71
install: support target-directory
2021-06-18 16:45:36 +02:00
Jan Scheer
65f47be5ee
cut: fix -d=
( #2424 )
2021-06-18 12:10:40 +02:00
Michael Debertol
3d3af5c8ca
ln: don't return an empty path in relative_path
2021-06-18 11:53:29 +02:00
Michael Debertol
a371c03431
cp: only get the current directory once
2021-06-18 11:48:13 +02:00
Michael Debertol
32526e3048
cp: one more clippy fix
2021-06-18 11:45:04 +02:00
Michael Debertol
315bfd65a3
cp: move symlink check to the right place
2021-06-18 11:44:39 +02:00
Tyler
22265814ba
Cleans up compiler warnings.
2021-06-17 14:49:08 -07:00
Tyler
d14b5843a3
Implements libc file open flags (unix only)
2021-06-17 14:33:30 -07:00
Tuomas Tynkkynen
d05964a8cb
test: Implement -k
...
parser.rs already accepts this, finish the implementation.
2021-06-18 00:03:08 +03:00
Michael Debertol
12a1c87cb8
cp: improve symlink handling
2021-06-17 22:26:13 +02:00
Dean Li
c73ba1630e
ls: set show-control-char if stdout is terminal
2021-06-17 19:55:21 +08:00
Terts Diepraam
439b7e0ca5
Merge pull request #2415 from miDeb/touch/date-epoch
...
touch: support @<timestamp> date format
2021-06-17 10:36:03 +02:00
Syukron Rifail M
bc8415c9db
du: add --dereference
2021-06-17 14:06:41 +07:00
Michael Debertol
816c55dce4
sort: avoid sigpipe errors
...
By calling `unwrap` we get a panic instead of an abort, and since we
mute sigpipe panics for all utilites, no error message will be printed.
2021-06-17 00:06:39 +02:00
Terts Diepraam
ce6d439a1b
Merge pull request #2381 from miDeb/sort/merge-improvements
...
sort: delete temporary files as soon as possible
2021-06-17 00:00:59 +02:00
Jan Scheer
39aa5312ed
id/tests: skip tests for multiple_user feature if there's not at least coreutils id
version 8.31 in $PATH
2021-06-16 23:52:55 +02:00
Tyler
19996c10a9
Removes 'fast read' plumbing.
...
- The dd info page mentions a special fast-read framework if no conv=FLAG is
specified (see bs=N) which I left space for. As it turns out, this is performed already
so it does not need to be implemented.
2021-06-16 12:59:43 -07:00
Jan Scheer
88367c6fb4
Merge branch 'fix_getgrouplist' into id_zero_2351
2021-06-16 19:20:34 +02:00
Jan Scheer
54cbb69d37
id/tests: fix tests if run on macOS
2021-06-16 19:16:29 +02:00
Michael Debertol
4c5ee1dbd7
tty: correct exit code for write errrors
2021-06-16 17:55:48 +02:00
Michael Debertol
3c271304f5
tty: correct exit code for wrong args
2021-06-16 17:43:38 +02:00
Hanif Bin Ariffin
2a7209116d
Fixed cp --preserve accepting no args
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-16 11:26:52 +08:00
Michael Debertol
84affa2137
touch: support @<timestamp>
date format
...
parse `@<seconds since epoch>` as a valid date.
2021-06-15 22:43:40 +02:00
Tyler
06dcdc0f1f
Implements status=LEVEL parser.
2021-06-15 12:19:18 -07:00
Tyler
8141919064
Implements count=N
...
- Adds tests for count=READS and count=BYTES.
- Implements count logic for read count and bytes count limits.
2021-06-15 11:06:36 -07:00
Michael Debertol
4bd556d58e
sort: better convey that the return value should be ignored
2021-06-15 19:09:22 +02:00
Michael Debertol
6979b707c0
sort: fix clippy lints
2021-06-15 19:09:22 +02:00
Michael Debertol
047ced2c7f
sort: increase default merge batch size
...
I think we can attempt to open 32 files concurrently on all systems
without risking resource exhaustion.
2021-06-15 19:09:22 +02:00
Michael Debertol
6a3c1c19d9
sort: remove needless allow
2021-06-15 19:09:22 +02:00
Michael Debertol
956ff57e2e
sort
: delete temporary files as soon as possible
...
- When we have finished reading from a temproary file, we can immediately
delete it.
- Use one single directory for all temporary files.
- Only create the temporary directory when needed.
- Also compress temporary files created by the merge step if requested.
2021-06-15 19:09:22 +02:00
Daniel Rocco
22fbf16b2c
test: implement user, group ownership checks
...
closes #2337
2021-06-14 14:30:17 -04:00
Terts Diepraam
553f70b06a
Merge pull request #2408 from Foryah/issue-2346
...
touch: change the error message to match the GNU error message #2346
2021-06-14 13:43:44 +02:00
David Suilea
25240ba61c
touch: change the error message to match the GNU error message #2346
2021-06-14 13:03:14 +02:00
Terts Diepraam
dfe0314d8d
Merge pull request #2397 from miDeb/sort/args
...
sort: refactor command line arguments
2021-06-14 12:49:19 +02:00
Terts Diepraam
05c8883b1a
Merge pull request #2395 from miDeb/timeout/cmd-args
...
timeout: handle arguments for the command to run
2021-06-14 12:01:31 +02:00
Michael Debertol
13458b4806
sort: use values_of
2021-06-14 11:39:26 +02:00
Michael Debertol
7acb9373a6
kill: fix signal table printing
2021-06-14 11:10:41 +02:00
Jan Scheer
052202ca19
Merge branch 'master' into id_zero_2351
2021-06-13 11:30:43 +02:00
Jan Scheer
b4c47cc5bd
id: make id
pass GNU's testssuite for "tests/id/uid.sh" and
...
"tests/id/zero.sh"
2021-06-13 11:12:53 +02:00
Anup Mahindre
da7b02cf9d
du: Refactor threshold handling
2021-06-12 23:12:44 +05:30
Anup Mahindre
d6181ce7d4
du: Add threshold argument support
...
- Add --threshold parameter and corresponding logic to skip listing
entires that don't adhere to the threshold
2021-06-12 19:56:05 +05:30
Hanif Bin Ariffin
083e745976
Simplified page down implementation
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-12 20:34:21 +08:00
Hanif Bin Ariffin
9ed5091be6
Fixed hanging with smaller content
...
Using 'seq 10 | cargo run -- more' should no longer hangs.
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-12 20:30:15 +08:00
Michael Debertol
af6e92e012
Merge branch 'master' of https://github.com/uutils/coreutils into sort/args
2021-06-12 13:16:46 +02:00
Michael Debertol
a69c2d52f9
Merge branch 'master' of https://github.com/uutils/coreutils into timeout/cmd-args
2021-06-12 13:14:16 +02:00
Michael Debertol
a57313f01b
core: represent signal values by their index
2021-06-12 13:12:15 +02:00
Hanif Bin Ariffin
28c6fad6e3
Now displays the unknown key entered
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-12 18:25:14 +08:00
Hanif Bin Ariffin
ee6419f11c
Fixing display when resizing terminal
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-12 18:11:12 +08:00
Hanif Bin Ariffin
63ee42826b
Fixed numeric type
...
1. Its better to bump u16 to usize than the other way round.
2. Highly unlikely to have a terminal with usize rows...makes making sense of the code easier.
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-12 18:02:31 +08:00
Hanif Bin Ariffin
b335e7f2ae
Now stops at the last line first. Press down again to go to next file or quit
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-12 17:57:35 +08:00
Terts Diepraam
440eba628c
Merge pull request #2338 from miDeb/ln/dst-symlink
...
ln: canonicalize the parent directory of the destination, not the destination itself
2021-06-12 11:28:19 +02:00
Terts Diepraam
8afc923796
Merge pull request #2237 from wfscheper/wfscheper/issue2118
...
chgrp: replace getopts with clap (#2118 )
2021-06-12 11:20:24 +02:00
Terts Diepraam
7f754dc1a5
Merge pull request #2382 from tertsdiepraam/more/rewrite-drawing-logic
...
`more`: rewrite drawing logic
2021-06-12 11:12:29 +02:00
Jan Scheer
39f5f70f2b
Merge branch 'master' into refactoring_parse_size
2021-06-12 02:24:07 +02:00
Tyler
fc110bb656
Implements status=LEVEL
...
- Adds print fn's
- Modifies internal fn's as needed to track read/write state
- Modifies status update thread to respect status level
- Adds signal handler for SIGUSR1 (print xfer stats)
2021-06-11 17:00:25 -07:00
Terts Diepraam
b7460a61a9
Merge pull request #2398 from youknowone/err-return
...
clean up returning Err
2021-06-12 00:14:28 +02:00
Michael Debertol
b8d4411291
sort: fix ignore-leading-blanks long option
2021-06-11 20:46:23 +02:00
Michael Debertol
fb035aa049
sort: allow --check=<value> syntax
...
* --check=silent and --check=quiet, which are equivalent to -C.
* --check=diagnose-first, which is the same as --check
We also allow -c=<value>, which confuses GNU sort.
2021-06-11 20:46:23 +02:00
Michael Debertol
cc0df6ea43
sort: move options to the options
module
...
Be more consistent with other utilities
2021-06-11 20:46:23 +02:00
Michael Debertol
f909751155
timeout: don't kill the process if -k is not set
...
`timeout` used to set the timeout to 0 when -k was not set. This
collided with the behavior of 0 timeouts, which disable the timeout.
When -k is not set the process should not be killed.
2021-06-11 20:44:25 +02:00
Terts Diepraam
ddb196dd1d
chgrp: fix clippy and spell-check warnings
2021-06-11 17:24:12 +02:00
Jeong YunWon
6734d5df93
basename: trim separators with function
2021-06-11 23:35:15 +09:00
Jeong YunWon
6003d95974
comm: clean up line-end check
2021-06-11 23:35:15 +09:00
Jeong YunWon
9e8be3093f
chown: clean up parse_spec
2021-06-11 23:27:09 +09:00
Jeong YunWon
b59c1dae59
stdbuf: clean up returning Err
2021-06-11 23:26:58 +09:00
Jeong YunWon
9c56a40bcb
shuf: clean up returning Err
2021-06-11 23:26:58 +09:00
Jeong YunWon
2dd9822d57
rmdir: clean up returning Err
2021-06-11 23:26:58 +09:00
Jeong YunWon
7cc4bf6e36
pr: clean up returning Err
2021-06-11 23:26:58 +09:00
Jeong YunWon
e45f5404db
nl: fix clippy error
2021-06-11 23:26:58 +09:00
Jeong YunWon
3ea18173cb
od: clean up returning Err
2021-06-11 23:26:58 +09:00
Jeong YunWon
d329c7c864
install : clean up returning Err
2021-06-11 23:26:58 +09:00
Jeong YunWon
27ce4bb0a4
head: clean up returning Err
2021-06-11 23:26:58 +09:00
Jeong YunWon
bbae78db67
expr: clean up returning Err
2021-06-11 23:26:58 +09:00
Jeong YunWon
f01121f5b7
env: clean up returning Err
2021-06-11 23:26:58 +09:00
Jeong YunWon
6736faec4a
csplit: clean up returning Err
2021-06-11 23:26:58 +09:00
Jeong YunWon
7cc17c15c2
cp: clean up returning Err
2021-06-11 23:26:58 +09:00
Jeong YunWon
526ed7afdc
cksum: clean up returning Err
2021-06-11 23:26:58 +09:00
Jeong YunWon
a197d35039
chown: clean up returning Err
2021-06-11 23:26:58 +09:00
Jeong YunWon
c5594bc9bc
base32: clean up returning Err
2021-06-11 23:26:58 +09:00
Terts Diepraam
4abe4c4ac5
Merge branch 'master' into more/rewrite-drawing-logic
2021-06-11 14:03:11 +02:00
Terts Diepraam
f104f8868c
Merge pull request #2356 from syukronrm/du-x
...
du: add `--one-file-system`
2021-06-11 13:51:28 +02:00
Terts Diepraam
960828ba70
Merge pull request #2376 from deantvv/more-option-d
...
more: Implement option '-d'
2021-06-11 13:49:13 +02:00
Syukron Rifail M
0c364e635b
du: add --one-file-system
2021-06-11 16:18:57 +07:00
Walter Scheper
cff75f242a
chgrp: replace getopts with clap ( #2118 )
2021-06-10 16:38:44 -04:00
Michael Debertol
32f5e8baf8
Merge branch 'master' of https://github.com/uutils/coreutils into ln/dst-symlink
2021-06-10 21:48:43 +02:00
Yagiz Degirmenci
3347dacfc8
chroot: refactor undocumented features ( #2365 )
2021-06-10 21:46:17 +02:00
Sylvestre Ledru
e35cafd2f2
Merge pull request #2370 from tertsdiepraam/ln/update-arg-handling
...
`ln`: refactor argument handling and fix #2359
2021-06-10 21:39:43 +02:00
Sylvestre Ledru
d79268de05
Merge pull request #2374 from tertsdiepraam/who/cleanup-arg-handling
...
`who`: cleanup argument handling
2021-06-10 21:38:11 +02:00
Sylvestre Ledru
be9104b084
Merge pull request #2383 from tertsdiepraam/whoami/use-winapi
...
`whoami`: remove `advapi32-sys` dependency and use `winapi`
2021-06-10 21:34:50 +02:00
Sylvestre Ledru
667af7ea16
Merge pull request #2388 from youknowone/du-winapi
...
du winapi dependency only for windows
2021-06-10 21:31:08 +02:00
Sylvestre Ledru
de6829fec3
Merge pull request #2390 from youknowone/tr-reuse-chars
...
tr parse_sequence reuses chars iterator
2021-06-10 21:30:28 +02:00
Sylvestre Ledru
cadd7810ef
Merge pull request #2393 from youknowone/pathchk
...
bytes operation for pathchk
2021-06-10 21:30:14 +02:00
Jeong YunWon
0a1dcc27bb
prevent utf8 iteration for ascii str from shred ( #2389 )
2021-06-10 21:29:56 +02:00
Sylvestre Ledru
c6d8932698
Merge pull request #2392 from youknowone/tail
...
Remove unnessassary chars() and unwrap_or() from tail
2021-06-10 21:28:58 +02:00
Michael Debertol
b4efd5a749
timeout: disable pre-existing SIGCHLD handlers
...
Needed to make a GNU test pass
2021-06-10 21:24:43 +02:00
Michael Debertol
0f9bc8e974
timeout: disable timeout if it is set to zero
2021-06-10 21:24:43 +02:00
Michael Debertol
8e0ed2d20e
timeout: support --verbose
2021-06-10 21:24:43 +02:00
Michael Debertol
ed646090c2
timeout: fix usage string
2021-06-10 17:03:39 +02:00
Michael Debertol
c5d7cbda32
timeout: handle arguments for the command to run
...
To prevent clap from parsing flags for the command to run as flags for
timeout, remove the "args" positional argument, but allow to pass flags
via the "command" positional arg.
2021-06-10 17:03:32 +02:00
Michael Debertol
5997853cc4
Merge branch 'master' of https://github.com/uutils/coreutils into ln/dst-symlink
2021-06-10 16:06:32 +02:00
Dean Li
dc57e1535e
more: Implement option '-d'
...
Implement option '-d' (silent mode)
Related to #2320
2021-06-10 19:34:21 +08:00
Jeong YunWon
8433c7726d
tr parse_sequence reuses chars iterator
2021-06-10 19:16:55 +09:00
Jeong YunWon
b9611b71ee
use ? operator for od
2021-06-10 18:39:48 +09:00
Jeong YunWon
b21d189fcf
Remove trivially unnessessary unwrap() pr
2021-06-10 18:39:48 +09:00
Jeong YunWon
cc6c2f64b1
clean up fold, hashsum, kill, nl, printf, truncate
2021-06-10 18:39:48 +09:00
Jeong YunWon
3ee09fa783
only matches Some() in match
2021-06-10 18:39:11 +09:00
Jeong YunWon
1fecd98ebe
bytes operation for pathchk
2021-06-10 18:30:45 +09:00
Jeong YunWon
e3197bea39
dircolor purify forward match '#'
2021-06-10 18:14:23 +09:00
Jeong YunWon
8a03ac6caa
Prevent double scanning from dircolors
2021-06-10 18:08:54 +09:00
Jeong YunWon
357886b599
Remove unnessassary chars() and unwrap_or() from tail
2021-06-10 18:06:40 +09:00
Terts Diepraam
96dffc8700
Merge pull request #2384 from sylvestre/getopt
...
remove a legacy declaration to getopt
2021-06-10 10:45:16 +02:00
Jeong YunWon
9c6750252d
du winapi dependency only for windows
2021-06-10 15:07:46 +09:00
Jeong YunWon
ded92dbca0
clean up fold, hashsum, kill
2021-06-10 13:11:36 +09:00
Jeong YunWon
1ac4eb171e
move cmode rather than mut
2021-06-10 13:11:36 +09:00
Jeong YunWon
797c4a340e
Remove trivially unnessessary unwrap() from od
2021-06-10 13:11:36 +09:00
Jeong YunWon
da9558c684
Remove trivially unnessessary unwrap() from expr
2021-06-10 13:11:36 +09:00
Jeong YunWon
774c01f008
Remove trivially unnessessary unwrap() from du
2021-06-10 13:11:36 +09:00
Jeong YunWon
3eae399ec4
Remove trivially unnessessary unwrap() from base32/64
2021-06-10 13:11:36 +09:00
Jan Scheer
00c05b8687
id: add error handling (stderr/exit_code) for '-ugG'
2021-06-10 00:19:23 +02:00
Sylvestre Ledru
6d7d57e13c
remove a legacy declaration to getopt
2021-06-09 22:58:50 +02:00
Jan Scheer
026570ff9c
id: add more tests for '--zero'
...
* fix clippy warnings
2021-06-09 22:45:39 +02:00
Sylvestre Ledru
393164f4a7
Merge pull request #2377 from tertsdiepraam/use-atty
...
`cat`/`cut`/`tty`/`nohup`: replace `is_std{in, out, err}_interactive` with atty
2021-06-09 22:42:56 +02:00
Terts Diepraam
44f6dc6098
whoami: remove advapi32-sys dependency
2021-06-09 22:10:28 +02:00
Terts Diepraam
e73743eb0d
more: simpler page_down
2021-06-09 21:56:32 +02:00
Terts Diepraam
40720dc52d
more: rewrite drawing logic
2021-06-09 21:00:48 +02:00
Jeong YunWon
7009cb0486
Add "process" dependency to groups/Cargo.toml
2021-06-10 01:07:01 +09:00
Terts Diepraam
be8e5f5f30
use the same spec for atty everywhere
2021-06-09 17:15:42 +02:00
Terts Diepraam
394eb82af1
cat/cut/tty/nohup: replace is_std{in, out, err}_interactive with atty
2021-06-09 17:12:03 +02:00
Jan Scheer
1b824f4914
fix clippy warnings
2021-06-09 15:56:29 +02:00
Terts Diepraam
3818e54415
who: cleanup argument handling
2021-06-09 14:34:37 +02:00
Jan Scheer
be8650278b
Merge branch 'master' into refactoring_parse_size
2021-06-09 13:44:40 +02:00
Tyler
a511db504b
Minor optimization in calculation of lcm for internal r/w buffer.
2021-06-08 14:33:48 -07:00
Jan Scheer
babf6ecae4
Merge branch 'master' into id_zero_2351
2021-06-08 23:22:29 +02:00
Tyler
96fd665ce1
Implements internal read/write buffer optimization
...
- Spoiler Alert: Turns out it was just the lcm.
2021-06-08 14:14:19 -07:00
Sylvestre Ledru
4471335609
Merge pull request #2360 from rivy/fix+rf
...
build and *lots* of clippy fixes
2021-06-08 22:06:11 +02:00
Tyler
ef6c850833
Adds additional conv=sync test for short reads.
2021-06-08 12:37:03 -07:00
Jan Scheer
26ad05cbb4
uucore: fix order of group IDs returned from entries::get_groups()
...
As discussed here: https://github.com/uutils/coreutils/pull/2361
the group IDs returned for GNU's 'group' and GNU's 'id --groups'
starts with the effective group ID.
This implements a wrapper for `entris::get_groups()` which mimics
GNU's behaviour.
* add tests for `id`
* add tests for `groups`
* fix `id --groups --real` to no longer ignore `--real`
2021-06-08 18:39:05 +02:00
Tyler
841faebdac
Impl conv=sync
...
- Adds tests where ibs causes extention
- Impl conv=sync. All tests passing.
2021-06-07 16:13:46 -07:00
Terts Diepraam
448caa3d1c
ln: refactor argument handling
2021-06-07 14:53:18 +02:00
Jan Scheer
98225105af
id: implement '--zero' flag
...
* add tests for '--zero' flag
* add a bunch of requires/conflicts rules for flags (incl. tests)
2021-06-07 14:35:13 +02:00
Roy Ivy III
423f4f9bf1
fix/cp ~ correct cargo clippy
complaint exception (*allow* clippy::unnecessary_wraps)
2021-06-06 19:28:25 -05:00
Roy Ivy III
3f0ac06122
refactor/od ~ fix cargo clippy
complaint (*allow* clippy::enum_variant_names)
2021-06-06 19:28:25 -05:00
Roy Ivy III
8f0d42da39
refactor/wc ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
a8a2b3ec84
refactor/timeout ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
6e98ea78ac
refactor/stdbuf ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
c8c14ca40c
refactor/stat ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
79a33728ca
refactor/split ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
39dbcda66e
refactor/sort ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
08713d22ec
refactor/shred ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
2f7c488425
refactor/rmdir ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
84e08cd071
refactor/ptx ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
750b68a44c
refactor/printf ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
ad486a77dc
refactor/pr ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
f7028c4175
refactor/pinky ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
02f35c8965
refactor/pathchk ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
b3dd80d39c
refactor/printf ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
94f5011662
refactor/od ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
63112783b2
refactor/numfmt ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:24 -05:00
Roy Ivy III
ca50eae003
refactor/mv ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:23 -05:00
Roy Ivy III
768b343ff9
refactor/mktemp ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:23 -05:00
Roy Ivy III
5889d81fde
refactor/mkfifo ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:23 -05:00
Roy Ivy III
380e28dde5
refactor/mkdir ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:23 -05:00
Roy Ivy III
99fae850ae
refactor/ls ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:23 -05:00
Roy Ivy III
e8e28f1508
refactor/ln ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:23 -05:00
Roy Ivy III
4a09c72fe7
refactor/join ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:23 -05:00
Roy Ivy III
c66d67a0b9
refactor/install ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:23 -05:00
Roy Ivy III
9f2cb2e5e9
refactor/hashsum ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:23 -05:00
Roy Ivy III
2bf06c3104
refactor/fold ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:23 -05:00
Roy Ivy III
28e176cbba
refactor/expr ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:23 -05:00
Roy Ivy III
489f9e8386
refactor/expand ~ fix cargo clippy
complaint (clippy::manual_str_repeat)
2021-06-06 19:28:23 -05:00
Roy Ivy III
122d82e835
refactor/expand ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:23 -05:00
Roy Ivy III
9964a21fe3
refactor/env ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:23 -05:00
Roy Ivy III
b08c568748
refactor/echo ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:23 -05:00
Roy Ivy III
3409dc93e3
refactor/du ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:23 -05:00
Roy Ivy III
14bb9ec616
refactor/csplit ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:22 -05:00
Roy Ivy III
1e418e8d84
refactor/chroot ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:22 -05:00
Roy Ivy III
baa656ca8a
refactor/chown ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:22 -05:00
Roy Ivy III
35b360b8e4
refactor/chmod ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:22 -05:00
Roy Ivy III
c115ad4274
refactor/cat ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:22 -05:00
Roy Ivy III
777e3906f8
refactor/basename ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:22 -05:00
Roy Ivy III
c192550f22
refactor ~ polish spelling + add spelling exceptions
2021-06-06 19:28:22 -05:00
Roy Ivy III
1ef820212c
refactor/rm ~ fix cargo clippy
warning (clippy::upper_case_acronyms)
2021-06-06 19:17:18 -05:00
Roy Ivy III
3cfb956684
refactor/du ~ fix cargo clippy
warning (clippy::ptr_arg)
2021-06-06 19:17:18 -05:00
Jan Scheer
12de58aec0
Merge branch 'master' of github.com:uutils/coreutils into refactoring_parse_size
2021-06-06 22:54:02 +02:00
Jan Scheer
884f570125
du/od/sort: refactor - replace map_or_else with unwrap_or_else
2021-06-06 21:55:39 +02:00
Sylvestre Ledru
a3b520abde
Merge pull request #2363 from sylvestre/doc-hashsum
...
hashsum: document how to benchmark blake2
2021-06-06 21:28:23 +02:00
Michael Debertol
d6da143c4e
sort: ignore errors when waiting for child
2021-06-06 19:53:28 +02:00
Michael Debertol
7c9da82b39
sort: implement --batch-size
2021-06-06 18:01:08 +02:00
Michael Debertol
8d213219c7
sort: implement --compress-program
2021-06-06 18:01:08 +02:00
Michael Debertol
5a5c7c5a34
sort: properly check for empty reads
2021-06-06 18:01:08 +02:00
Michael Debertol
66359a0f56
sort: insert line separators after non-empty files
...
If files don't end witht a line separator we have to insert one,
otherwise the last line will be combined with the first line of the next
file.
2021-06-06 18:01:08 +02:00
Michael Debertol
2dd6824e76
sort: never use a bigger buffer than requested
...
A min buffer size of 8KB makes sense in practice, but decreases testability.
2021-06-06 18:01:08 +02:00
Sylvestre Ledru
7f07bd82d4
hashsum: document how to benchmark blake2
2021-06-06 13:26:45 +02:00
Sylvestre Ledru
27456fc8fb
Merge pull request #2296 from oconnor663/blake2b_simd
...
switch from blake2-rfc to blake2b_simd
2021-06-06 13:14:39 +02:00
Terts Diepraam
6324df890f
Merge pull request #2357 from deantvv/more-show-next-file
...
more: Show next file at bottom line
2021-06-06 10:52:03 +02:00
Dean Li
b9fe76ab92
more: Show next file at bottom line
...
Implement feature requested in #2318 .
2021-06-06 09:26:47 +08:00
Jan Scheer
74a7da7b52
id: clean-up of clap options and usage/help text
...
* add conflicts_with for '-G'
* add required flags for '-r' and '-n'
* add usage/help texts from BSD's `id`
2021-06-05 20:43:12 +02:00
Sylvestre Ledru
9ae3c7634c
Merge pull request #2354 from tertsdiepraam/more/fix-not-showing-last-line
...
`more`: Do not accidentically hide last line
2021-06-05 16:05:43 +02:00
Terts Diepraam
2760efb01d
more: fix test
2021-06-05 14:42:43 +02:00
Terts Diepraam
420e9322ea
more: do not accidentically hide last line
2021-06-05 14:07:09 +02:00
Sylvestre Ledru
285b27c9b3
du: add --app as alias of --apparent-size to match GNU
2021-06-05 11:04:42 +02:00
Sylvestre Ledru
4143e3f54f
Merge pull request #2332 from mitchellmebane/dircolors-clap
...
dircolors: replace getopts with clap
2021-06-05 10:12:57 +02:00
Tyler
f7eaf96eda
Fixes bugs. Prepares for conv=sync
...
- Splits read fn into conv=sync and standard (consecutive)
versions.
- Fixes bug in previous read/fill where short reads would copy to wrong
position in output buffer.
- Fixes bug in unit tests. Empty source would pass (since no bytes
failed to match).
2021-06-04 11:29:41 -07:00
Sylvestre Ledru
9712ecb4d5
Merge pull request #2340 from deantvv/more-unicode
...
more: fix unicode bug
2021-06-04 19:51:32 +02:00
Michael Debertol
e7fa6715a7
Merge branch 'master' of https://github.com/uutils/coreutils into ln/dst-symlink
2021-06-04 19:42:19 +02:00
Dean Li
acd290d11f
more: fix unicode bug for breakline
...
- Use `unicode_segmentation` and `unicode_width` to determine proper `break_line` position.
- Keep track of total_width as suggested by @tertsdiepraam.
- Add unittest for ZWJ unicode case
Related to #2319 .
2021-06-04 22:06:27 +08:00
Jan Scheer
f8e96150f8
fix clippy warnings and spelling
...
* add some missing LICENSE headers
2021-06-04 15:39:34 +02:00
Mitchell Mebane
754082886c
dircolors: Address code review comments
2021-06-03 20:49:25 -05:00
Jan Scheer
130bf49e5d
Merge branch 'master' of github.com:uutils/coreutils into refactoring_parse_size
2021-06-03 22:32:34 +02:00
Sylvestre Ledru
6a8d15f92e
gnu/rm: match gnu's output
2021-06-03 22:19:14 +02:00
Jan Scheer
db3ee61742
du/sort/od/stdbuf: make error handling of SIZE/BYTES/MODE arguments more consistent
...
* od: add stderr info for not yet implemented '--strings' flag
2021-06-03 21:00:03 +02:00
Jan Scheer
ad26b7a042
head/tail/split: make error handling of NUM/SIZE arguments more
...
consistent
* add tests for each flag that takes NUM/SIZE arguments
* fix bug in tail where 'quiet' and 'verbose' flags did not override each other POSIX style
2021-06-03 20:37:29 +02:00
Michael Debertol
6c46d09397
ln: canonicalize the parent directory of dst, not dst
...
dst may or may not exist. In case it exists it might already be a symlink.
In neither case we should try to canonicalize dst, only its parent directory.
https://www.gnu.org/software/coreutils/manual/html_node/ln-invocation.html
> Relative symbolic links are generated based on their canonicalized
> **containing directory**, and canonicalized targets.
2021-06-03 19:10:22 +02:00
Michael Debertol
af8f47ea6a
ln: remove redundant check
...
if `dst.exists()` and `settings.overwrite` is `OverwriteMode::Force`,
we already delete the file in the match above.
2021-06-03 16:30:45 +02:00
Sylvestre Ledru
841b689477
Merge pull request #2334 from sylvestre/crate_version
...
use crate_version!() instead of reading the env + rustfmt
2021-06-03 10:56:57 +02:00
Sylvestre Ledru
24032498ad
Merge pull request #2339 from sylvestre/gnu-compat
...
Improve the gnu compat and use it for "touch"
2021-06-03 10:53:47 +02:00
Sylvestre Ledru
963a0da0b4
Merge pull request #2288 from syukronrm/du-time
...
du: fix `--time` behavior
2021-06-03 07:56:41 +02:00
Syukron Rifail M
05aeaf3061
du: fix --time behavior
2021-06-03 08:18:23 +07:00
Tyler
787b9696cb
Implements Unblock
...
- Adds unit tests
- Implements unblock
- All tests passing
2021-06-02 15:11:14 -07:00
Sylvestre Ledru
31875a241f
touch/gnu compat: 'touch no-file' exit code should be 1
2021-06-02 23:50:35 +02:00
Sylvestre Ledru
eb2c06c37e
touch/gnu compat: when touch fails because of a permission error, change the error message
...
+ return 1 as error code when having this error
2021-06-02 23:48:16 +02:00
Jan Scheer
5898b99627
truncate: add error handling for SIZE argument
...
* add tests for SIZE argument
* fix clap argument handling for --size and --reference
2021-06-02 22:08:42 +02:00
Jan Scheer
2f5f7c6fa1
split: use "parse_size" from uucore
...
* make stderr of parsing SIZE/NUMBER argument consistent with GNU's behavior
* add error handling
* add tests
2021-06-02 21:32:41 +02:00
Michael Debertol
ed69d797b5
ln: reject --relative without --symbolic
2021-06-02 21:02:12 +02:00
Michael Debertol
87570bbc10
ln: remove redundant force
flag
...
This information is already encoded in the `OverwriteMode` enum.
2021-06-02 20:56:37 +02:00
Michael Debertol
efa89de463
ln: fix LINK_NAME in help output
2021-06-02 19:58:29 +02:00
Sylvestre Ledru
d8c06dd6bb
use clap::crate_version macro instead of the env variable
2021-06-02 19:00:19 +02:00
Michael Debertol
dfaaa8c787
Merge branch 'master' of https://github.com/uutils/coreutils into cp/close-fd
2021-06-02 11:37:37 +02:00
Sylvestre Ledru
132ddf98b6
Merge pull request #2328 from miDeb/seq/validator
...
seq: reject NaN arguments
2021-06-02 11:20:13 +02:00
Jan Scheer
6b8de1dd8b
sort: use "parse_size" from uucore
...
* make parsing of SIZE argument consistent with GNU's behavior
* add error handling
* add tests
2021-06-02 05:13:57 +02:00
Mitchell Mebane
850a56ccea
dircolors: rustfmt
2021-06-01 19:22:17 -05:00
Mitchell Mebane
efe1850087
dircolors: replace getopts with clap
...
Port argument parsing from getopts to clap.
The only difference I have observed is that clap auto-generates -h and
-V short options for help and version, and there is no way (in clap 2.x)
to disable them.
2021-06-01 19:22:08 -05:00
Michael Debertol
a323e9cda1
cp: show errors in cow on linux
2021-06-01 23:06:38 +02:00
Jan Scheer
a900c7421a
od: use "parse_size" from uucore
2021-06-01 22:07:29 +02:00
Michael Debertol
23f89d1494
cp: close file descriptors after cow on linux
...
Instead of using into_raw_fd(), which transfers ownership and
requires us to close the file descriptor manually,
use as_raw_fd(), which does not transfer ownership to us but drops the
file descriptor when the original file is dropped (in our case at the
end of the function).
2021-06-01 22:04:19 +02:00
Tyler
7bc151d561
Project structure refactor (cont'd)
...
- Move test macros to specific modules.
2021-06-01 13:02:02 -07:00
Tyler
ead3c8c8fc
Project structure refactor.
...
- Unit tests split into individual folders
- Parseargs test module renamed unit_tests to match new structure
2021-06-01 12:53:23 -07:00
Tyler
391a175dbb
Fix regression in converison logic.
2021-06-01 12:34:15 -07:00
Tyler
48374ab0a2
Imlements block. All tests passing.
2021-06-01 11:39:18 -07:00
Michael Debertol
5329d77cc2
seq: adapt output to GNU seq
2021-06-01 20:35:18 +02:00
Michael Debertol
9b29ac98a5
seq: reject NaN arguments
...
Move the validation logic to an argument validator.
2021-06-01 18:30:18 +02:00
Michael Debertol
67b83647ac
sort: simplify handling of negative zeros
...
We can simply parse the sign of negative zero as positive, instead of
handling the comparison of zeros differently.
2021-06-01 18:20:24 +02:00
Michael Debertol
06b3092f5f
sort: fix debug output for zeros / invalid numbers
...
We were reporting "no match" when sorting something like "0 ". This is
because we don't distinguish between 0 and invalid lines when sorting.
For debug output we have to get this information back.
2021-06-01 18:18:51 +02:00
Jan Scheer
cc659c8572
Merge branch 'master' of github.com:uutils/coreutils into refactoring_parse_size
2021-06-01 12:35:48 +02:00
Jan Scheer
3c7175f00d
head/tail: add fixes and tests for bytes/lines NUM arg (undocumented sign)
...
* change tail bytes/lines clap parsing to fix posix override behavior
* change tail bytes/lines NUM parsing logic to be consistent with head
2021-06-01 12:17:11 +02:00
Sylvestre Ledru
3625d98fc3
Merge pull request #2326 from tertsdiepraam/ls/hide-ignore-help-text
...
`ls`: add help text and value name for `--hide` and `--ignore`
2021-06-01 11:41:39 +02:00
Terts Diepraam
1dc4ab92d9
ls: add help text and value name for --hide and --ignore
2021-06-01 10:27:50 +02:00
Sylvestre Ledru
448c8419d3
Merge pull request #2325 from tertsdiepraam/fix-sum-help-text
...
`sum`: fix help text for System V argument
2021-06-01 10:25:35 +02:00
Terts Diepraam
c1f2d41a27
sum: fix help text for system v argument
2021-06-01 09:54:49 +02:00
Jan Scheer
84f2bff778
head: use "parse_size" from uucore
2021-06-01 09:30:43 +02:00
Sylvestre Ledru
a017c1b589
Merge pull request #2323 from miDeb/maint/spellcheck-all
...
maint: actually run spellcheck on all files
2021-05-31 23:36:56 +02:00
Sylvestre Ledru
8618771f2e
Merge pull request #2322 from miDeb/seq/improvements
...
seq: improve compatibility
2021-05-31 23:09:13 +02:00
Michael Debertol
46470fc607
refactor/rmdir: polish spelling
2021-05-31 22:46:06 +02:00
Michael Debertol
41878f1bf4
refactor/pr: polish spelling
2021-05-31 22:46:01 +02:00
Michael Debertol
4cf18e96f3
seq: change default value for -t and remove dubious escape sequences
...
GNU seq does not support -t, but always outputs a newline at the end.
Therefore, our default for -t should be \n.
Also removes support for escape sequences (interpreting a literal "\n"
as a newline). This is not what GNU seq is doing, and unexpected.
2021-05-31 21:20:19 +02:00
Michael Debertol
c78cc65421
seq: make arguments required
...
Right now seq panics when invoked without args.
2021-05-31 21:20:19 +02:00
Michael Debertol
6ccc305513
seq: implement integer sequences
...
If we notice that we can represent all arguments as BigInts, take a
different code path. Just like GNU seq this means we can print an
infinite amount of numbers in this case.
2021-05-31 21:20:12 +02:00
Sylvestre Ledru
badf7aacb7
Merge pull request #2300 from tertsdiepraam/pr
...
Implement `pr` (resurrection of the resurrected PR)
2021-05-31 21:14:57 +02:00
Sylvestre Ledru
15da98d84e
Merge pull request #2315 from rivy/maint.fmt+spell
...
Spell check and correct the project
2021-05-31 21:00:04 +02:00
Jan Scheer
8bf1e33b5d
Merge branch 'master' of github.com:uutils/coreutils into refactoring_parse_size
...
* truncate: use "parse_size" from uucore
* workaround fix for "test_reference"
2021-05-31 19:11:06 +02:00
Sylvestre Ledru
8d714b0ab0
Merge pull request #2317 from deantvv/fix-touch-parse-date
...
Fix touch parse date error
2021-05-31 18:18:44 +02:00
Dean Li
9d8e7b9acb
Fix touch parse date error
...
Now it can parse `touch -d 2000-01-23 file` and add test for parse date
error.
Related to #2311
2021-05-31 22:04:03 +08:00
Roy Ivy III
3f35e0a421
refactor ~ cargo make format
2021-05-31 08:23:58 -05:00
Roy Ivy III
98aff50d4b
docs/tail ~ fix markdownlint complaints
2021-05-31 08:23:58 -05:00
Roy Ivy III
ceda51dd5c
docs/ls ~ fix spelling + whitespace
2021-05-31 08:23:58 -05:00
Roy Ivy III
1ca44fbbc3
docs/factor ~ fix markdownlint complaints
2021-05-31 08:23:58 -05:00
Roy Ivy III
b418f19c2d
docs/date ~ convert usage text document to a markdown text segment
2021-05-31 08:23:57 -05:00
Roy Ivy III
5c9b474cc8
refactor/whoami ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:57 -05:00
Roy Ivy III
dff33a0edb
refactor/wc ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:57 -05:00
Roy Ivy III
3d42454ebc
refactor/users ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:57 -05:00
Roy Ivy III
954b3436d9
refactor/truncate ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:57 -05:00
Roy Ivy III
f6a079a77f
refactor/timeout ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:57 -05:00
Roy Ivy III
b1a2f6e044
refactor/tee ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:57 -05:00
Roy Ivy III
879ac263bd
refactor/test ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:57 -05:00
Roy Ivy III
8e824742a1
refactor/stat ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:57 -05:00
Roy Ivy III
451110bba0
refactor/split ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:57 -05:00
Roy Ivy III
00a2e17c80
refactor/splice ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:57 -05:00
Roy Ivy III
f8e04c562b
refactor/sort ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:57 -05:00
Roy Ivy III
a15f8af99f
refactor/shred ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:57 -05:00
Roy Ivy III
13561cb5ae
refactor/ptx ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:56 -05:00
Roy Ivy III
324605c78c
refactor/printf ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:56 -05:00
Roy Ivy III
aa385cf23c
refactor/od ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:56 -05:00
Roy Ivy III
5079972ba6
refactor/nl ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:56 -05:00
Roy Ivy III
00c02505a1
refactor/more ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:23:56 -05:00
Terts Diepraam
7690dc018f
Merge branch 'master' into pr
2021-05-31 15:23:06 +02:00
Sylvestre Ledru
13fd02862c
Merge pull request #2316 from deantvv/rmdir-match-gnu-error
...
rmdir: match GNU error output
2021-05-31 15:23:03 +02:00
Jan Scheer
f9a088cecf
du: use "parse_size" from uucore
...
* fix stderr to be the same than GNU's `du` in case of invalid SIZE
2021-05-31 15:22:37 +02:00
Roy Ivy III
57e342d2b2
refactor/mktemp ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:11:32 -05:00
Roy Ivy III
e3784eff47
refactor/mknod ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:11:32 -05:00
Roy Ivy III
5942ba05ef
refactor/ls ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:11:32 -05:00
Roy Ivy III
96faa4efb6
refactor/ln ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:11:32 -05:00
Roy Ivy III
785343db7f
refactor/head ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:11:32 -05:00
Roy Ivy III
a481e8230b
refactor/hashsum ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:11:32 -05:00
Roy Ivy III
1a37d502d1
refactor/factor ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:11:32 -05:00
Roy Ivy III
ba7939e142
refactor/env ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:11:32 -05:00
Roy Ivy III
6e1bd6027a
refactor/du ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:11:32 -05:00
Roy Ivy III
dfe594e918
refactor/date ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:11:32 -05:00
Roy Ivy III
1b1086146b
refactor/cp ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:11:32 -05:00
Roy Ivy III
fc5451b5e7
refactor/cksum ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:11:32 -05:00
Roy Ivy III
43f5c13a7f
refactor/chmod ~ polish spelling (comments, names, and exceptions)
2021-05-31 08:11:31 -05:00
Roy Ivy III
9c0c8eb59f
change ~ remove 'main.rs' spell-checker exceptions
2021-05-31 08:11:31 -05:00
Terts Diepraam
77a0a077b8
pr: update dependencies
2021-05-31 14:48:12 +02:00
Dean Li
9f1deb2df6
rmdir: match GNU error output
...
Related to #2258
2021-05-31 19:30:54 +08:00
Sylvestre Ledru
8c5dcd0765
Merge branch 'master' into implement-more
2021-05-31 10:17:15 +02:00
Jan Scheer
3a6605844f
uucore: move 'parse_time' to 'parser'
...
"parse_time" only uses stdlib and does not need to be feature gated.
A more suitable place is the newly created "src/uucore/src/lib/parser/"
2021-05-31 09:54:31 +02:00
Jan Scheer
1c41efd732
stdbuf: use "parse_size" from uucore
2021-05-31 09:35:46 +02:00
Anup Mahindre
898d325aea
ls: Fix minor output mismatch
...
When a single directory is passed to ls in recursive mode, uutils ls
won't print the directory name
======================
GNU ls:
z:
======================
======================
uutils ls:
======================
This commit fixes this minor inconsistency and adds corresponding test.
2021-05-30 18:00:52 +05:30
Sylvestre Ledru
3913731222
Revert "rmdir: match GNU error output"
2021-05-30 09:55:02 +02:00
Sylvestre Ledru
13b2a4afd3
Merge branch 'master' into blake2b_simd
2021-05-30 09:29:40 +02:00
Sylvestre Ledru
83bb8795bd
add a comment to explain the why
2021-05-30 09:16:46 +02:00
Dean Li
5b417e251d
rmdir: match GNU error output
...
Related to #2258
2021-05-30 10:45:54 +08:00
Terts Diepraam
f9bc80e42c
pr: remove comments that are obvious through types
2021-05-30 00:35:40 +02:00
Terts Diepraam
a54fc7a4ba
pr: remove unused asref implementations
2021-05-30 00:28:44 +02:00
Tyler
f2fa1e1be1
Adds additional test resources & unit tests for block.
2021-05-29 15:22:42 -07:00
Michael Debertol
dc63133f14
sort: correctly inherit global flags for keys ( #2302 )
...
Closes #2254 . We should only inherit global settings for keys when there
are absolutely no options attached to the key.
The default key (matching the whole line) is implicitly added only if no
keys are supplied.
Improved some error messages by including more context.
2021-05-29 23:25:56 +02:00
Michael Debertol
d821719c67
expr: support arbitrary precision integers ( #2271 )
...
* expr: support arbitrary precision integers
Instead of i64s we now use BigInts for integer operations. This means
that no result or input can be out of range.
The representation of integer flags was changed from i64 to u8 to make
their intention clearer.
* expr: allow big numbers as arguments as well
Also adds some tests
* expr: use num-traits to check bigints for 0 and 1
* expr: remove obsolete refs
match ergonomics made these avoidable.
* formatting
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2021-05-29 23:25:23 +02:00
Terts Diepraam
bc1870c0a7
Merge branch 'master' into pr
2021-05-29 19:21:31 +02:00
Terts Diepraam
4744b35796
pr: explicit none in match expressions
2021-05-29 19:09:50 +02:00
Terts Diepraam
2e1035b350
pr: static to const
2021-05-29 19:02:42 +02:00
Terts Diepraam
0913a77667
pr: let type inference do its works
2021-05-29 19:01:39 +02:00
Terts Diepraam
12287fcc9c
pr: fix clippy lints
2021-05-29 18:44:12 +02:00
Jeffrey Finkelstein
0999b00ff9
truncate: re-organize into one func for each mode
...
Reorganize the code in `truncate.rs` into three distinct functions
representing the three modes of operation of the `truncate` program. The
three modes are
- `truncate -r RFILE FILE`, which sets the length of `FILE` to match the
length of `RFILE`,
- `truncate -r RFILE -s NUM FILE`, which sets the length of `FILE`
relative to the given `RFILE`,
- `truncate -s NUM FILE`, which sets the length of `FILE` either
absolutely or relative to its curent length.
This organization of the code makes it more concise and easier to
follow.
2021-05-29 15:11:27 +02:00
Jeffrey Finkelstein
5129114ddc
truncate: create TruncateMode::to_size() method
...
Create a method that computes the final target size in bytes for the
file to truncate, given the reference file size and the parameter to the
`TruncateMode`.
2021-05-29 15:11:27 +02:00
Jeffrey Finkelstein
005bc259da
truncate: add parse_mode_and_size() helper func
...
Add a helper function to contain the code for parsing the size and the
modifier symbol, if any. This commit also changes the `TruncateMode`
enum so that the parameter for each "mode" is stored along with the
enumeration value. This is because the parameter has a different meaning
in each mode.
2021-05-29 15:11:27 +02:00
Jeffrey Finkelstein
b898e54d7a
truncate: remove read permissions from OpenOptions
...
Remove "read" permissions from the `OpenOptions` when opening a new file
just to truncate it. We will never read from the file, only write to
it. (Specifically, we will only call `File::set_len()`.)
2021-05-29 15:11:27 +02:00
Gilad Naaman
17b0939dee
Moved factor to use clap
...
Issue: https://github.com/uutils/coreutils/issues/2121
2021-05-29 15:11:27 +02:00
Jan Scheer
e4aa8ee159
users: fix long_help text and clippy warning
2021-05-29 15:11:27 +02:00
Jan Scheer
3aeccfd802
fix a lot of clippy warnings
2021-05-29 15:11:22 +02:00
Terts Diepraam
d94ee87d15
pr: move options into mod
2021-05-29 14:42:24 +02:00
Terts Diepraam
0487360507
pr: make tests compile again
2021-05-29 14:30:30 +02:00
Terts Diepraam
762da0bd37
more: comment out unimplemented arguments
2021-05-29 12:51:47 +02:00
Terts Diepraam
9d17c1fddf
more: add todo for unicode width
2021-05-29 12:45:12 +02:00
Terts Diepraam
40ee9023e8
more: simplify main loop
2021-05-29 12:42:46 +02:00
Terts Diepraam
101e55702c
more: simplify and fix logic for multiple files
2021-05-29 12:35:03 +02:00
Sylvestre Ledru
3d42d41a72
Merge pull request #2247 from jfinkels/truncate-split-three-functions
...
truncate: re-organize truncate() into one function for each mode of operation
2021-05-29 10:31:02 +02:00
Sylvestre Ledru
0746b3e1e6
Merge pull request #2292 from Gilnaa/2121-factor-clap
...
Moved factor to use clap
2021-05-29 10:30:06 +02:00
Jan Scheer
714661774b
users: fix long_help text and clippy warning
2021-05-29 02:34:43 +02:00
Jan Scheer
a2947f6897
fix clippy warning
2021-05-29 00:46:25 +02:00
Michael Debertol
bb268d1500
sort: crash when failing to open an input file ( #2265 )
...
* sort: crash when failing to open an input file
Instead of ignoring files we fail to open, crash.
The error message does not exactly match gnu, but that would require
more effort.
* use split_whitespace instead of a manual implementation
* fix expected error on windows
* sort: update expected error message
2021-05-28 22:39:33 +02:00
Michael Debertol
e9656a6c32
sort: make GNU test sort-debug-keys pass ( #2269 )
...
* sort: disable support for thousand separators
In order to be compatible with GNU, we have to disable thousands
separators. GNU does not enable them for the C locale, either.
Once we add support for locales we can add this feature back.
* sort: delete unused fixtures
* sort: compare -0 and 0 equal
I must have misunderstood this when implementing, but GNU considers
-0, 0, and invalid numbers to be equal.
* sort: strip blanks before applying the char index
* sort: don't crash when key start is after key end
* sort: add "no match" for months at the first non-whitespace char
We should put the "^ no match for key" indicator at the first
non-whitespace character of a field.
* sort: improve support for e notation
* sort: use maches! macros
2021-05-28 22:38:29 +02:00
Jan Scheer
0bf14da490
tail: use "parse_size" from uucore
2021-05-28 22:21:03 +02:00
Jan Scheer
b1b3475e11
truncate: use "parse_size" from uucore
2021-05-28 22:21:03 +02:00
Sylvestre Ledru
a2143dcfbf
Merge pull request #2293 from miDeb/maint-minrustv
...
maint: adapt code to new MinRustV
2021-05-28 21:48:51 +02:00
Jack O'Connor
80b9bfdd18
switch from blake2-rfc to blake2b_simd
2021-05-28 14:08:46 -04:00
Sylvestre Ledru
fe42808e9b
Merge branch 'master' into implement-more
2021-05-28 19:49:48 +02:00
Terts Diepraam
0a2f74fd8e
More: update crossterm dependency
2021-05-28 19:43:03 +02:00
Michael Debertol
b5cbd506bc
maint: remove trailing commas from matches
...
Trailing commas are only supported starting from 1.48.
2021-05-28 18:58:06 +02:00
Gilad Naaman
6a9ffee548
Moved factor to use clap
...
Issue: https://github.com/uutils/coreutils/issues/2121
2021-05-28 19:48:28 +03:00
Terts Diepraam
c7930a63f7
Merge pull request #2285 from blesson3/cp-backup-arg-fix
...
cp: fix regressed issue with `--backup` and `-b`
2021-05-28 18:44:09 +02:00
Michael Debertol
59a42f1254
maint: format recent changes
2021-05-28 18:03:47 +02:00
Michael Debertol
263b122540
maint: use the matches! macro when possible
2021-05-28 18:03:37 +02:00
Tyler
d0b4fe34c1
Refactor. Returns code to buildable
...
- Pushes file/stdout specific logic to trait objects.
- Extracts read/write helper
- Extracts conv/block/unblock helper
- Impl block
- WIP: Many failing tests!
2021-05-27 15:55:29 -07:00
Terts Diepraam
835a17d79f
mktemp: use tempfile instead of custom tempdir
2021-05-27 22:48:10 +02:00
Terts Diepraam
ebe6341ae3
chore: replace tempdir with tempfile
2021-05-27 22:47:03 +02:00
Matt Blessed
41bea72f23
cp: fix regressed issue with --backup
and -b
...
- add test for regressed issue
2021-05-26 18:29:03 -04:00
Matt Blessed
f11f5f3abb
mv: refactor backup logic to use shared uucore backup control
...
- add mv backup tests
2021-05-26 18:23:48 -04:00
Terts Diepraam
b4f6c81810
Merge pull request #2281 from deantvv/chmod-match-gnu-error
...
chmod: match GNU error
2021-05-26 21:13:05 +02:00
Terts Diepraam
658e52dde0
Merge pull request #2275 from blesson3/cp-backup-support
...
cp: implement backup support
2021-05-26 21:12:01 +02:00
Matt Blessed
25ed5eeb0e
cp: move option check to uumain and use show_usage_error
...
- add test for conflicting options `--backup` and `--no-clobber`
2021-05-26 11:10:04 -04:00
Dean Li
fe25b51a66
chmod: match GNU error
...
Related to #2260
Signed-off-by: Dean Li <deantvv@gmail.com>
2021-05-26 22:31:02 +08:00
Terts Diepraam
00dd8d29cb
Merge pull request #2213 from syukronrm/du-clap
...
du: replace getopts with clap
2021-05-26 16:15:36 +02:00
Syukron Rifail M
eda72b5208
du: replace getopts with clap
2021-05-26 11:23:05 +07:00
Matt Blessed
a8a1ec7faf
cp: implement backup control with tests
2021-05-25 23:22:32 -04:00
Yağız can Değirmenci
c78a7937f8
chore: delete show_info macro and replace with show_error
2021-05-26 02:27:10 +03:00
Yağız can Değirmenci
e5e7ca8dc5
fix: simplify logic
2021-05-24 21:20:59 +03:00
Yağız can Değirmenci
991fcc548c
fix: log error messages properly on permission errors
2021-05-24 21:07:45 +03:00
Terts Diepraam
da085eca98
Merge pull request #2259 from jfinkels/wc-compute-each-file-and-print
...
wc: print counts for each file as soon as computed
2021-05-24 17:55:10 +02:00
Michael Debertol
218f523e1b
expr: make substr infallible
...
Instead of returning an Err it should return the "null string"
(in our case that's the empty string) when the offset or length
is invalid.
2021-05-23 22:22:34 +02:00
Sylvestre Ledru
7bf076505f
Merge branch 'master' into who_fix_runlevel
2021-05-23 09:32:37 +02:00
Sylvestre Ledru
b175534a97
Merge pull request #2264 from miDeb/sort-sort-flag
...
sort: support --sort flag and check for conflicts
2021-05-23 09:30:03 +02:00
Sylvestre Ledru
41bd025d00
Merge pull request #2209 from jfinkels/head-ring-buffer
...
head: add abstractions for "all but last n lines"
2021-05-23 09:28:17 +02:00
Jeffrey Finkelstein
bc9db289e8
head: add abstractions for "all but last n lines"
...
Add some abstractions to simplify the `rbuf_but_last_n_lines()`
function, which implements the "take all but the last `n` lines"
functionality of the `head` program. This commit adds
- `RingBuffer`, a fixed-size ring buffer,
- `ZLines`, an iterator over zero-terminated "lines",
- `TakeAllBut`, an iterator over all but the last `n` elements of an
iterator.
These three together make the implementation of
`rbuf_but_last_n_lines()` concise.
2021-05-22 23:56:48 -04:00
Jeffrey Finkelstein
1f1cd3d966
truncate: re-organize into one func for each mode
...
Reorganize the code in `truncate.rs` into three distinct functions
representing the three modes of operation of the `truncate` program. The
three modes are
- `truncate -r RFILE FILE`, which sets the length of `FILE` to match the
length of `RFILE`,
- `truncate -r RFILE -s NUM FILE`, which sets the length of `FILE`
relative to the given `RFILE`,
- `truncate -s NUM FILE`, which sets the length of `FILE` either
absolutely or relative to its curent length.
This organization of the code makes it more concise and easier to
follow.
2021-05-22 23:54:39 -04:00
Jeffrey Finkelstein
c6d4d0c07d
truncate: create TruncateMode::to_size() method
...
Create a method that computes the final target size in bytes for the
file to truncate, given the reference file size and the parameter to the
`TruncateMode`.
2021-05-22 23:54:00 -04:00
Jeffrey Finkelstein
544ae87575
truncate: add parse_mode_and_size() helper func
...
Add a helper function to contain the code for parsing the size and the
modifier symbol, if any. This commit also changes the `TruncateMode`
enum so that the parameter for each "mode" is stored along with the
enumeration value. This is because the parameter has a different meaning
in each mode.
2021-05-22 23:53:59 -04:00
Jeffrey Finkelstein
5eb2a5c3e1
truncate: remove read permissions from OpenOptions
...
Remove "read" permissions from the `OpenOptions` when opening a new file
just to truncate it. We will never read from the file, only write to
it. (Specifically, we will only call `File::set_len()`.)
2021-05-22 23:45:05 -04:00
Jan Scheer
44c033a013
who: exclude --runlevel from non Linux targets ( fix #2239 )
2021-05-23 03:05:15 +02:00
Sylvestre Ledru
4aaeede3d8
rustfmt the recent change
2021-05-23 00:13:53 +02:00
Michael Debertol
c1f67ed775
sort: support --sort flag and check for conflicts
...
`sort` supports three ways to specify the sort mode: a long option
(e.g. --numeric-sort), a short option (e.g. -n) and the sort flag
(e.g. --sort=numeric).
This adds support for the sort flag.
Additionally, sort modes now conflict, which means that an error is
shown when multiple modes are passed, instead of silently picking a mode.
For consistency, I added the `random` sort mode to the `SortMode` enum,
instead of it being a bool flag.
2021-05-22 23:10:41 +02:00
Sylvestre Ledru
726f271273
Merge pull request #2239 from devnexen/fbsd_who_build_fix
...
who freebsd build fix unsupported RUN_LVL option only for other platf…
2021-05-22 21:34:09 +02:00
Jeffrey Finkelstein
4521aa2659
wc: print counts for each file as soon as computed
...
Change the behavior of `wc` to print the counts for a file as soon as
it is computed, instead of waiting to compute the counts for all files
before writing any output to `stdout`. The new behavior matches the
behavior of GNU `wc`.
The old behavior looked like this (the word "hello" is entered on
`stdin`):
$ wc emptyfile.txt -
hello
0 0 0 emptyfile.txt
1 1 6
1 1 6 total
The new behavior looks like this:
$ wc emptyfile.txt -
0 0 0 emptyfile.txt
hello
1 1 6
1 1 6 total
2021-05-22 14:27:37 -04:00
Sylvestre Ledru
73fb426b2b
Merge pull request #2252 from jfinkels/realpath-simplify
...
realpath: use uucore::fs::canonicalize() to reduce code duplication
2021-05-22 19:10:59 +02:00
David Carlier
fcb079e20e
who freebsd build fix unsupported RUN_LVL option only for other platforms.
2021-05-22 18:07:02 +01:00
Sylvestre Ledru
542deb8888
Merge pull request #2246 from miDeb/sort-automatic-extsort
...
sort: automatically fall back to extsort
2021-05-22 17:21:02 +02:00
Sylvestre Ledru
8055f26a73
Merge pull request #2228 from jfinkels/tail-obo-positive-bytes
...
tail: fix off-by-one issue for +NUM args
2021-05-22 17:18:55 +02:00
Jeffrey Finkelstein
4b5c3efe85
realpath: use uucore::fs::canonicalize()
...
Use the `uucore::fs::canonicalize()` function to simplify the
implementation of `realpath`.
2021-05-22 11:18:16 -04:00
Sylvestre Ledru
66cfdb8644
Merge pull request #2143 from nbraud/factor/faster/table
...
factor::table: Implement a batched version w/ improved performance
2021-05-22 17:18:07 +02:00
Sylvestre Ledru
66dd6dbeff
Merge pull request #2244 from jfinkels/truncate-fix-round-up-character
...
truncate: fix character used to indicate round up
2021-05-22 14:03:59 +02:00
Michael Debertol
088443276a
sort: improve handling of buffer size cmd arg
...
Instead of overflowing when calculating the buffer size, use
saturating_{pow, mul}.
When failing to parse the buffer size, we now crash instead of silently
ignoring the error.
2021-05-22 14:00:07 +02:00
Sylvestre Ledru
4d3be19de3
Merge pull request #2240 from jhscheer/macos_test_coreutils
...
who/stat/pinky: adjust tests to be compatible with running on macOS
2021-05-22 12:39:05 +02:00
Sylvestre Ledru
424a99f0e6
Merge pull request #2193 from jfinkels/2186-min-width-stdin
...
wc: compute minimum width to format counts up front
2021-05-22 12:37:42 +02:00
Michael Debertol
e7da8058dc
sort: automatically fall back to extsort
...
To make this work we make default sort a special case of external sort.
External sorting uses auxiliary files for intermediate chunks. However,
when we can keep our intermediate chunks in memory, we don't write them
to the file system at all. Only when we notice that we can't keep them
in memory they are written to the disk.
Additionally, we don't allocate buffers with the capacity of their
maximum size anymore. Instead, they start with a capacity of 8kb and are
grown only when needed.
This makes sorting smaller files about as fast as it was before
(I'm seeing a regression of ~3%), and allows us to seamlessly continue
with auxiliary files when needed.
2021-05-21 23:09:46 +02:00
Anup Mahindre
414c92eed7
ls: Fix printing paths behavior
...
For any commandline arguments, ls should print the argument as is (and
not truncate to just the file name)
For any other files it reaches (say through recursive exploration), ls
should print just the filename (as path is printed once when we enter
the directory)
2021-05-21 22:22:28 +05:30
Jan Scheer
007e0a4e7f
who/stat/pinky: adjust tests to be compatible with running on macOS
...
A lot of tests depend on GNU's coreutils to be installed in order
to obtain reference values during testing.
In these cases testing is limited to `target_os = linux`.
This PR installs GNU's coreutils on "github actions" and adjusts the
tests for `who`, `stat` and `pinky` in order to be compatible with macOS.
* `brew install coreutils` (prefix is 'g', e.g. `gwho`, `gstat`, etc.
* switch paths for testing to something that's available on both OSs,
e.g. `/boot` -> `/bin`, etc.
* switch paths for testing to the macOS equivalent,
e.g. `/dev/pts/ptmx` -> `/dev/ptmx`, etc.
* exclude paths when no equivalent is available,
e.g. `/proc`, `/etc/fstab`, etc.
* refactor tests to make better use of the testing API
* fix a warning in utmpx.rs to print to stderr instead of stdout
* fix long_usage text in `who`
* fix minor output formatting in `stat`
* the `expected_result` function should be refactored
to reduce duplicate code
* more tests should be adjusted to not only run on `target_os = linux`
2021-05-21 11:55:20 +02:00
Sylvestre Ledru
df45b20dc1
Merge pull request #2243 from jfinkels/truncate-min-max
...
truncate: use min() and max() instead of if/else statements
2021-05-21 10:09:43 +02:00
Jeffrey Finkelstein
a23555e857
truncate: fix character used to indicate round up
...
Fix a bug in which the incorrect character was being used to indicate
"round up to the nearest multiple" mode. The character was "*" but it
should be "%". This commit corrects that.
2021-05-20 23:19:58 -04:00
Jeffrey Finkelstein
17b95246cd
truncate: use min() and max() instead of if stmts
2021-05-20 21:24:43 -04:00
Jeffrey Finkelstein
fc29846b45
truncate: fix error message for file not found
...
Change the error message for when the reference file (the `-r` argument)
is not found to match GNU coreutils. This commit also eliminates a
redundant call to `File::open`; the file need not be opened because the
size in bytes can be read from the result of `std::fs::metadata()`.
2021-05-20 20:59:59 -04:00
Sylvestre Ledru
efb781f59a
Merge pull request #2221 from jfinkels/head-display-multiple-errors-2
...
head: display errors for each input file instead of terminating at the first error
2021-05-20 23:24:35 +02:00
Sylvestre Ledru
ca196a6dad
Merge pull request #2218 from miDeb/sort-chunks
...
sort: read files as chunks, off-thread
2021-05-20 23:24:02 +02:00