Commit graph

716 commits

Author SHA1 Message Date
Devin Gunay
103dffc12e
touch: implement - (#3158) 2022-03-06 23:00:42 +01:00
xxyzz
281ec190e0
chmod: replace walkdir with std::fs
walkdir filters some files that need to be modified, for example, files inside an unreadable folder.
2022-03-06 08:40:36 +08:00
Terts Diepraam
75b3cbcfd9 pr: move from getopts to clap
fixes
2022-03-05 10:26:12 +01:00
Alex Tibbles
00d3c36e8c
update SHA1, SHA2, SHA3 crates 2022-02-21 16:55:59 -05:00
Alex Tibbles
41e9719d6b
upgrade to RustCrypto Hashes MD5 "MD-5" 0.10.1 2022-02-21 16:51:00 -05:00
Alex Tibbles
c8346fd720
hashsum: update hex to 0.4.3
Update to API change.
2022-02-21 15:35:46 -05:00
Alex Tibbles
0d5dd27e71
uniq: update strum to 0.23 latest 2022-02-21 12:34:25 -05:00
alextibbles
cd450cc591
expr: update onig crate to 6.3 (#3136)
* expr: update onig crate to 6.3
2022-02-21 17:13:27 +01:00
Terts Diepraam
69a94e412b docs: use rust libraries for downloading and unzipping tldr 2022-02-19 01:27:19 +01:00
alextibbles
d9c2acc2ed
update to sha 0.10.0 (#3110)
* update to sha 0.10.0

* correct formatting
2022-02-12 18:12:02 +01:00
Sylvestre Ledru
6b6d5ee7db
Merge pull request #2827 from jfinkels/split-std-io-copy
split: use std::io::copy() with new writer implementation to improve maintainability and speed
2022-02-12 11:33:12 +01:00
Sylvestre Ledru
080cb2b6f9
Merge pull request #3108 from DestroyerXyz/blake3
hashsum: Add BLAKE3 to Hashing Algorithms
2022-02-11 11:40:10 +01:00
Shreyans Jain
30d7a4b167
hashsum: Add BLAKE3 to Hashing Algorithms
Signed-off-by: Shreyans Jain <shreyansthebest2007@gmail.com>
2022-02-10 12:46:44 +05:30
Jeffrey Finkelstein
b31d63eaa9 split: add ByteChunkWriter and LineChunkWriter
Add the `ByteChunkWriter` and `LineChunkWriter` structs and
implementations, but don't use them yet. This structs offer an
alternative approach to writing chunks of output (contrasted with
`ByteSplitter` and `LineSplitter`). The main difference is that
control of which underlying file is being written is inside the writer
instead of outside.
2022-02-08 22:53:56 -05:00
Justin Tracey
f33e058a5a join: faster field parsing and representation
Using indexes into the line instead of Vec<u8>s means we don't have to copy
the line to store the fields (indexes instead of slices because it avoids
self-referential structs). Using memchr also empirically saves a lot of
intermediate allocations.
2022-02-06 23:37:17 -05:00
Narasimha Prasanna HN
1194a8ce53
Fix: Update quick-error crate version from 1.2.3 to 2.0.1 in src/uu/cp (#2947)
fix: update quick-error crate from 1.2.3 to 2.0.1 for src/uu/cp tool, fixes:  #2941
2022-01-31 21:56:47 +01:00
Allan Douglas R. de Oliveira
f22051a4e1 Updated sha libraries 2022-01-30 17:23:02 -03:00
Sylvestre Ledru
fa7a0ecf3f
Merge pull request #2962 from Dr-Emann/phf_dispatch
Use a PHF map for util_map()
2022-01-30 18:24:30 +01:00
Sylvestre Ledru
2f6f6867c5
Merge branch 'main' into 2940 2022-01-30 13:33:35 +01:00
Zachary Dremann
bb41f4ffe5 Use a PHF map for util_map()
Rather than building a HashMap at compile time, use the phf (and phf_codegen) crate to build the map
at compile time in build.rs
2022-01-30 06:58:33 -05:00
Dan Klose
bb7f37e8b4 fix: update itertools 0.8.0 -> 0.10.0
Targets https://github.com/uutils/coreutils/issues/2940

* since versions were mxing versions of x.y and x.y.z I changed all to x.y.z
* minor whitespace formatting
2022-01-29 22:35:51 +00:00
Terts Diepraam
eb82015b23 all: change macros
- Change the main! proc_macro to a bin! macro_rules macro.
- Reexport uucore_procs from uucore
- Make utils to not import uucore_procs directly
- Remove the `syn` dependency and don't parse proc_macro input (hopefully for faster compile times)
2022-01-29 15:26:32 +01:00
Sylvestre Ledru
c7fc0a703b
Merge pull request #2893 from g-k/2888-rand-0.8
update rand crate to 0.8
2022-01-25 23:23:43 +01:00
Sylvestre Ledru
5932937952
Merge pull request #2777 from jfinkels/uucore-printf
uucore: move printf::memo module to uucore
2022-01-25 23:22:27 +01:00
Greg Guthe
c037382df7 factor: update quickcheck dev dep to 1.0.3
quickcheck <1 uses rand 0.6.x which results in E0599 errors.  Upgrading resolves that error and lets
us remove the older rand version from our deps.

refs: https://stackoverflow.com/questions/56901973/errore0599-no-method-named-gen-found-for-type-mut-g-in-the-current-scope/56902740#56902740
2022-01-24 20:41:20 -05:00
Greg Guthe
cae6bc5e82 deps: update rand to 0.8
fix: #2888
2022-01-24 20:40:29 -05:00
Terts Diepraam
9ddd61ab6b Merge branch 'main' into hbina-tr-reimplement-expansion 2022-01-21 14:42:30 +01:00
Terts Diepraam
55a47f6fc0
Merge pull request #2863 from tertsdiepraam/clap-3
Clap 3
2022-01-20 23:14:52 +01:00
Terts Diepraam
da728dd2b6 Merge branch 'main' into hbina-tr-reimplement-expansion 2022-01-19 19:34:13 +01:00
Roy Ivy III
2e251f91f1 0.0.12 2022-01-19 05:35:00 -06:00
Terts Diepraam
e345768484 base64: remove clap dependency again 2022-01-18 12:56:58 +01:00
Jeffrey Finkelstein
d9afdf0527 uucore: move printf::memo module to uucore
Move the `printf::memo` module to `uucore` so that it can be used by
other programs, not just `printf`. For example, the `-f` option to `seq`
requires parsing and formatting numbers according to the same logic as
`printf`.
2022-01-17 08:46:45 -05:00
Terts Diepraam
8872485922 Merge branch 'main' into clap-3 2022-01-17 13:25:51 +01:00
Sylvestre Ledru
3dfb9a23c0 update pretty_assertions to version 1 2022-01-17 12:55:16 +01:00
Sylvestre Ledru
7e9ed4b346
Merge pull request #2869 from tertsdiepraam/rust-1.54
Bump MSRV to 1.54.0
2022-01-16 23:18:50 +01:00
Sylvestre Ledru
1fbda8003c coreutils 0.0.8 => 0.0.9, uucore_procs 0.0.7 => 0.0.8, uucore 0.0.10 => 0.0.11 2022-01-16 17:05:48 +01:00
Terts Diepraam
783170c9d8 change msrv to 1.54 2022-01-15 11:08:07 +01:00
Terts Diepraam
fc3c82ffdc update cargo.lock for clap 3.0 2022-01-11 19:16:48 +01:00
Terts Diepraam
f60c36f242
Merge pull request #2610 from miDeb/cp/abuse
cp: handle edge cases when dest is a symlink
2022-01-11 00:34:55 +01:00
Roy Ivy III
05a2f0ca70 update 'Cargo.lock' 2022-01-09 18:57:25 -06:00
Terts Diepraam
7fa720d311 fix lint, fmt & udeps errors 2022-01-01 19:43:44 +01:00
kimono-koans
fd64e01d92
ls: Reduce binary size of ls by removing regex crate (#2781) 2021-12-22 18:31:45 +01:00
Sylvestre Ledru
a3041843c9 bump the platform-info dep 2021-12-18 00:04:03 +01:00
Hanif Ariffin
c86cb91dee Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion 2021-11-26 16:39:27 +08:00
Roy Ivy III
7834d9ffaf update Cargo.lock 2021-11-19 17:55:03 -06:00
Hanif Bin Ariffin
eec5ad8c76 Fixing incompatible Cargo version issue with CI/CD
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-11-18 18:45:14 +08:00
Hanif Bin Ariffin
9a09b8a06c Merge branch 'master' of https://github.com/uutils/coreutils into hbina-tr-reimplement-expansion 2021-11-18 18:25:29 +08:00
Sylvestre Ledru
ca1156458e
Merge pull request #2714 from blyxxyz/os_display-crate
Move display::Quotable into its own crate
2021-11-12 21:17:59 +01:00
nicoo
32b0178a72 factor: Update to current versions of smallvec
smallvec 1.0 and later wasn't compatible with Rust 1.33 but the
minimum supported Rust version for coreutils moved on.
2021-11-10 15:12:37 +01:00
Jan Verbeek
77e1570ea0 Move display::Quotable into its own crate
The standalone version has a number of bugfixes compared to the old
version.
2021-11-08 23:07:40 +01:00
jfinkels
2e12316ae1
seq: use BigDecimal to represent floats (#2698)
* seq: use BigDecimal to represent floats

Use `BigDecimal` to represent arbitrary precision floats in order to
prevent numerical precision issues when iterating over a sequence of
numbers. This commit makes several changes at once to accomplish this
goal.

First, it creates a new struct, `PreciseNumber`, that is responsible for
storing not only the number itself but also the number of digits (both
integer and decimal) needed to display it. This information is collected
at the time of parsing the number, which lives in the new
`numberparse.rs` module.

Second, it uses the `BigDecimal` struct to store arbitrary precision
floating point numbers instead of the previous `f64` primitive
type. This protects against issues of numerical precision when
repeatedly accumulating a very small increment.

Third, since neither the `BigDecimal` nor `BigInt` types have a
representation of infinity, minus infinity, minus zero, or NaN, we add
the `ExtendedBigDecimal` and `ExtendedBigInt` enumerations which extend
the basic types with these concepts.

* fixup! seq: use BigDecimal to represent floats

* fixup! seq: use BigDecimal to represent floats

* fixup! seq: use BigDecimal to represent floats

* fixup! seq: use BigDecimal to represent floats

* fixup! seq: use BigDecimal to represent floats
2021-11-06 15:44:42 +01:00
Michael Debertol
bb35b0c37b uucore: add FileInformation 2021-11-01 22:38:44 +01:00
Jan Scheer
63e9cd9202
Merge branch 'master' into tail_notify 2021-10-26 16:45:46 +02:00
Hanif Bin Ariffin
2dad536785 Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-10-24 11:40:42 +08:00
Sylvestre Ledru
59e9870c56 Prepare version 0.0.8 2021-10-23 19:21:50 +02:00
Jeffrey Finkelstein
858b0a9e9f head: use std::io::copy() with TakeLines reader
Replace the custom `split::walk_lines()` function with a call to
`std::io::copy()`, using a new `TakeLines` reader as the source and
`stdout` as the destination. The `TakeLines` reader is an adaptor that
scans the bytes being read for line ending characters and stops the
reading after a given number of lines has been read (similar to the
`std::io::Take` adaptor).

This change

* makes the `read_n_lines()` function more concise,
* allows it to mirror the implementation of `read_n_bytes()`,
* increases the speed of `head -n NUM`.
2021-10-20 20:59:44 -04:00
Adam Reichold
c526df57b8 tac: opportunistically use memory maps
Since tac must read its input files completely to start processing them
from the end, it is particularly suited to use memory maps to benefit
from the page cache maintained by the operating systems to bring the
necessary data into memory as required.

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

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

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

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

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

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

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

Replace zero_copy by a simpler specialized private module.

Do not assume splices move all data at once.

Use the modern uutils machinery.

Remove the "latency" feature. The time it takes to prepare the buffer
is drowned out by the startup time anyway.

yes: Add tests

yes: Fix long input test on Windows
2021-08-25 13:45:44 +02:00
Michael Debertol
4e251706be refactor: move shared chown logic to uucore 2021-08-24 15:22:05 +02:00
Michael Debertol
7153a595c6 chgrp: forward to chown
chgrp does mostly the same as chown.
By making chown a bit more configurable we can reuse its code for chgrp.
2021-08-24 15:22:05 +02:00
Jeffrey Finkelstein
0e689e78aa tac: support multi-char separator with overlap
Fix a bug in `tac` where multi-character line separators would cause
incorrect behavior when there was overlap between candidate matches in
the input string. This commit adds a dependency on `memchr` in order to
use the `memchr::memmem::rfind_iter()` function to scan for
non-overlapping instances of the specified line separator characters,
scanning from right to left.

Fixes #2580.
2021-08-23 20:16:38 -04:00
Koutheir Attouchi
7010dfd939 runcon: added implementation and tests. 2021-08-22 21:59:41 +02:00
Sylvestre Ledru
5089214832 bump a few crates to simplify Debian packaging (second) 2021-08-22 00:42:03 +02:00
Sylvestre Ledru
8337aeb4d6 bump a few crates to simplify Debian packaging 2021-08-21 23:34:45 +02:00
Hanif Bin Ariffin
403910aed2 Updated Cargo.lock
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:04 +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
Koutheir Attouchi
83a515e4c3 chcon: reduce the number of unsafe blocks. 2021-08-10 13:50:51 -04:00
Michael Debertol
03ceb6750e cat: check if the input file is also the output file 2021-08-08 01:32:22 +02: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
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
Tyler
601c9fc620 Merge branch 'master' of https://github.com/uutils/coreutils into uutils-master-2 2021-08-03 17:33:43 -07: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
24b1822cba
Merge pull request #2468 from thomasqueirozb/tail_stdin
tail: handle `-` as an alias for stdin
2021-08-02 00:24:28 +02:00
Thomas Queiroz
940559f0e1 tail: handle - as an alias for stdin 2021-08-01 17:20:24 -04: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
backwaterred
7c94bbe238
Merge branch 'uutils:master' into master 2021-07-21 17:33:07 -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
250bcaf7c5 backup_control: Run tests in series
Make all tests lock a mutex to ensure that they're run in series rather than
parallel. We must take this precaution due to the fact that all tests are run
in parallel as threads of one parent process. As all threads in a process share
e.g. environment variables, we use the Mutex to ensure they're run one after
another.

This way we can guarantee that tests that rely on environment variables to have
specific values will see these variables, too.

An alternative implementation could have used the [rusty fork][1] crate to run
all tests that need env variables in separate processes rather than threads.
However, rusty fork likely wouldn't run on all platforms that the utilities are
supposed to run on.
2021-07-19 17:01:49 +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
Jan Scheer
92bc647ac3
Merge branch 'master' into id_selinux_context 2021-07-12 17:30:21 +02:00
Sylvestre Ledru
1bb23cdf73 refresh cargo.lock with recent updates 2021-07-11 21:09:38 +02:00
Sylvestre Ledru
1d8a66b7d3 Update to version 0.0.7 2021-07-11 18:04:56 +02: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
Jan Scheer
e53f4db33a Merge branch 'master' into id_selinux_context 2021-07-06 13:29:50 +02: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
8334d9f574 Build changes after merge with uutils main 2021-07-02 10:53:15 -07: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
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
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
Michael Debertol
a9e79c72c7 uutils: enable shell completions
This adds a hidden `completion` subcommand to coreutils. When invoked with
`coreutils completion <utility> <shell>` a completion file will be printed
to stdout. When running `make install` those files will be created for all
utilities and copied to the appropriate locations.
`make install` will install completions for zsh, fish and bash; however,
clap also supports generating completions for powershell and elvish.

With this patch all utilities are required to have a publich uu_app function
that returns a clap::App in addition to the uumain function.
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
Jan Scheer
f1d317147b id: add support for showing SELinux context (--context/-Z) 2021-06-20 13:44:41 +02:00
Tyler
d14b5843a3 Implements libc file open flags (unix only) 2021-06-17 14:33:30 -07:00
Jan Scheer
88367c6fb4 Merge branch 'fix_getgrouplist' into id_zero_2351 2021-06-16 19:20:34 +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
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
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
Walter Scheper
cff75f242a chgrp: replace getopts with clap (#2118) 2021-06-10 16:38:44 -04: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
Michael Debertol
b4efd5a749 timeout: disable pre-existing SIGCHLD handlers
Needed to make a GNU test pass
2021-06-10 21:24:43 +02: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
Sylvestre Ledru
6d7d57e13c remove a legacy declaration to getopt 2021-06-09 22:58:50 +02:00
Terts Diepraam
44f6dc6098 whoami: remove advapi32-sys dependency 2021-06-09 22:10:28 +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
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
Roy Ivy III
9cdfa06f3a maint/CICD ~ (MinRustV) update 'Cargo.lock' for rust v1.43 2021-06-06 19:16:50 -05:00
Michael Debertol
6ee6082cf8 update Cargo.lock 2021-06-06 18:04:55 +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
Sylvestre Ledru
4143e3f54f
Merge pull request #2332 from mitchellmebane/dircolors-clap
dircolors: replace getopts with clap
2021-06-05 10:12:57 +02:00
Sylvestre Ledru
9712ecb4d5
Merge pull request #2340 from deantvv/more-unicode
more: fix unicode bug
2021-06-04 19:51:32 +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
Michael Debertol
e5c4681e04 tests: add the ability to set resource limits 2021-06-02 19:21:12 +02: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
Sylvestre Ledru
8618771f2e
Merge pull request #2322 from miDeb/seq/improvements
seq: improve compatibility
2021-05-31 23:09:13 +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
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
Terts Diepraam
7690dc018f Merge branch 'master' into pr 2021-05-31 15:23:06 +02:00
Terts Diepraam
77a0a077b8 pr: update dependencies 2021-05-31 14:48:12 +02:00
Sylvestre Ledru
8c5dcd0765
Merge branch 'master' into implement-more 2021-05-31 10:17:15 +02:00
Sylvestre Ledru
13b2a4afd3
Merge branch 'master' into blake2b_simd 2021-05-30 09:29:40 +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
Gilad Naaman
17b0939dee Moved factor to use clap
Issue: https://github.com/uutils/coreutils/issues/2121
2021-05-29 15:11:27 +02:00
Terts Diepraam
0487360507 pr: make tests compile again 2021-05-29 14:30:30 +02:00
Jan Scheer
fb812ff9d0 Cargo.toml: remove factor_benches in order to be able to run clippy
linting for all targets
2021-05-29 14:29:46 +02:00
Terts Diepraam
1c2540a613 Add atty to dev-deps for more tests 2021-05-28 21:07:38 +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
Gilad Naaman
6a9ffee548 Moved factor to use clap
Issue: https://github.com/uutils/coreutils/issues/2121
2021-05-28 19:48:28 +03:00
Sylvestre Ledru
222bd81190
Merge pull request #2291 from tertsdiepraam/remove-tempdir
Replace `tempdir` with `tempfile`
2021-05-28 10:45:19 +02: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
Terts Diepraam
825476f573 Update tempfile 2021-05-27 20:25:24 +02:00
Syukron Rifail M
eda72b5208 du: replace getopts with clap 2021-05-26 11:23:05 +07: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
628684af4f refresh cargo.lock with recent updates 2021-05-22 12:20:13 +02:00
Arijit Dey
1596c65dfd
Downgrade crossterm version 2021-05-18 22:29:59 +05:30
nicoo
9afed1f25f Update Cargo.lock
Adding array-init v2.0.0
Updating cast v0.2.5 -> v0.2.6
  Adding pest v2.1.3
Updating rustc_version v0.2.3 -> v0.3.3
  Adding semver v0.11.0
  Adding semver-parser v0.10.2
Updating serde v1.0.125 -> v1.0.126
Updating serde_derive v1.0.125 -> v1.0.126
  Adding ucd-trie v0.1.3
  Adding uu_factor_benches v0.0.0 (#tests/benches/factor)
2021-05-17 19:45:02 +02:00
Michael Debertol
fcd48813e0 sort: read files as chunks, off-thread
Instead of using a BufReader and reading each line separately,
allocating a String for each one, we read to a chunk. Lines are
references to this chunk. This makes the allocator's job much easier
and yields performance improvements.

Chunks are read on a separate thread to further improve performance.
2021-05-16 21:13:37 +02:00
Arijit Dey
22ba21d8ab
Fix bug with terminal getting weird 2021-05-16 22:26:54 +05:30
Jan Scheer
a4fc2b5106 who: fix --lookup
This closes #2181.

`who --lookup` is failing with a runtime panic (double free).
Since `crate::dns-lookup` already includes a safe wrapper for `getaddrinfo`
I used this crate instead of further debugging the existing code in
utmpx::canon_host().

* It was neccessary to remove the version constraint for libc in uucore.
2021-05-13 22:16:15 +02:00
Sylvestre Ledru
019f1b1a88
Merge pull request #2203 from sylvestre/travis
Remove travis CI
2021-05-11 20:01:59 +02:00
Sylvestre Ledru
b9d44facb9 refresh cargo.lock with recent updates 2021-05-11 10:27:13 +02:00
Sylvestre Ledru
881bbf512e refresh cargo.lock with recent updates 2021-05-10 08:59:45 +02:00
Gilad Naaman
8747800697 Switched 'arch' to use clap instead of getopts 2021-05-09 21:53:03 +03:00
Michael Debertol
c38373946a sort: optimize the Line struct 2021-05-07 21:51:25 +02:00
Sylvestre Ledru
704c6865b1 refresh cargo.lock with recent updates 2021-05-07 10:35:50 +02:00
Idan Attias
b24b9d501b logname: replace getopts with clap 2021-05-06 14:19:47 +02:00
Sylvestre Ledru
9f9735694d refresh cargo.lock with recent updates 2021-05-06 08:22:23 +02:00
Anup Mahindre
7d2b051866
Implement Total size feature (#2170)
* ls: Implement total size feature

- Implement total size reporting that was missing
- Fix minor formatting / readability nits

* tests: Add tests for ls total sizes feature

* ls: Fix MSRV build errors due to unsupported attributes for if blocks

* ls: Add windows support for total sizes feature

- Add windows support (defaults to file size as block sizes related
infromation is not avialable on windows)
- Renamed some functions
2021-05-05 23:03:25 +02:00
rethab
231bb7be93
Migrate mknod to clap, closes #2051 (#2056)
* mknod: add tests for fifo

* mknod: add test for character device
2021-05-05 22:59:40 +02:00
Sylvestre Ledru
f83316f36e
Merge pull request #2156 from miDeb/sort-no-json-extsort
sort: don't rely on serde-json for extsort
2021-05-05 22:33:18 +02:00
Sylvestre Ledru
482e340e11
Merge branch 'master' into implement-more 2021-05-04 13:35:38 +02:00
Sylvestre Ledru
6dff9f00a3 refresh cargo.lock with recent updates 2021-05-04 10:02:40 +02:00
Sylvestre Ledru
6c04d0d21e
Merge pull request #2155 from nthery/kill_clap
kill: migrate to clap
2021-05-02 18:45:29 +02:00
Michael Debertol
e99f157e6a Merge branch 'master' of https://github.com/uutils/coreutils into sort-no-json-extsort 2021-05-02 18:08:15 +02:00
Nicolas Thery
1dccbfd21e kill: migrate to clap
Fixes #2122.
2021-05-02 12:31:41 +02:00
Sylvestre Ledru
d0512618d5 refresh cargo.lock with recent updates 2021-05-02 09:43:32 +02:00
Sylvestre Ledru
2d0f4daf5b
Merge pull request #2152 from deantvv/link-clap
link: replace getopts with clap
2021-05-02 09:33:11 +02:00
Dean Li
f5c7d9bd80 link: replace getopts with clap 2021-05-02 10:40:48 +08:00
Ricardo Iglesias
f307de22d0 base64: Refactor argument parsing
Moved most of the argument parsing logic to `base32/base_common.rs` to
allow for significant code reuse.
2021-05-01 11:36:46 -07:00