Commit graph

2227 commits

Author SHA1 Message Date
Roy Ivy III
92075c7d14 refactor/polish ~ (factor) fix cargo clippy complaint (unused_imports) 2020-10-16 20:25:49 -05:00
Sylvestre Ledru
fba62f39c6
Merge pull request #1603 from rivy/fix.warnings
Fix `cargo clippy` warnings
2020-10-12 09:23:15 +02:00
Roy Ivy III
77a04546f0 fix/printf ~ use calculated VERSION 2020-10-11 17:39:50 -05:00
Wisha Wa
b387565ba3 ptx: remove unneeded regex and reduce repetitive regex compilations 2020-10-12 01:59:06 +07:00
Wisha Wa
351d1fc068 ptx: improve performance by removing N^2 routine. 2020-10-12 01:27:35 +07:00
Roy Ivy III
46f30f3836 refactor/polish ~ fix cargo clippy complaint (stable_sort_primitive) 2020-10-10 20:35:35 -05:00
Roy Ivy III
10b6926ccc refactor/polish ~ fix cargo clippy complaint (allow match_like_matches_macro) 2020-10-10 20:35:35 -05:00
Roy Ivy III
6fa16343f1 refactor/polish ~ fix cargo clippy complaint (same_item_push) 2020-10-10 20:35:35 -05:00
Roy Ivy III
7b4d81efd4 refactor/polish ~ fix cargo clippy complaint (needless_collect) 2020-10-10 20:35:35 -05:00
Roy Ivy III
4a041f95e3
Merge pull request #1598 from sylvestre/nproc
cleanup(nproc): remove some artifacts from the clap migration
2020-10-10 16:28:22 -05:00
Roy Ivy III
0fa249a944
Fix tr argument handling for missing arguments (#1601)
* tests/tr ~ confirm failure for missing argument(s)

* fix/tr ~ mimic GNU error reponse for missing argument(s)
2020-10-02 22:43:57 +02:00
Sylvestre Ledru
c660684a8c nproc: use the variable name 2020-09-26 23:09:08 +02:00
Sylvestre Ledru
805801ec39 nproc: remove the extern crate declaration 2020-09-26 23:09:02 +02:00
nicoo
9a1c560aba
factor: Refactor and optimise the Factors datastructure (#1572)
* factor: Introduce a type alias for exponents

This way, we can easily replace u8 with a larger type when moving to support
larger integers.

* factor::Factors: Split off a Decomposition type

The new type can be used to represent in-progress factorisations,
which contain non-prime factors.

* factor::Decomposition: Use a flat vector representation

~18% faster than BTreeMap, and ~5% faster than “master”.

* factor::Factors: Use a RefCell rather than copy data when printing

~2.9% faster than the previous commit, ~11% faster than “master” overall.
2020-09-21 21:44:50 +02:00
Jens Humrich
bfca334ec1 style issues 2020-09-17 12:40:48 +02:00
Katzmann1983
f322f72c34
Update src/uu/split/src/split.rs
Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
2020-09-17 10:27:40 +02:00
Jens Humrich
5a75905476 Add additional-suffix option to split 2020-09-16 17:59:39 +02:00
Roy Ivy III
2ff6b67077
stat: fix cargo clippy complaint (unnecessary_sort_by) (#1594) 2020-09-04 08:01:53 +02:00
Roy Ivy III
c33284f38b factor::numeric::gcd: modify divisor() test to return correct true/false results for all possible inputs 2020-09-03 14:56:14 -05:00
nicoo
07eaa7fe5a factor::numeric::gcd: Add explicit test for the 0 case 2020-09-03 14:56:14 -05:00
nicoo
c11cebc4d3 factor::numeric::gcd: Exclude the 0 case from test divisor 2020-09-03 14:56:10 -05:00
16yuki0702
19e967ef31
ls: deleting user defined max function (#1591)
This is trivial refactor.
```usize``` can call max method, so deleting user defined max function.
2020-08-26 09:42:27 +02:00
Roy Ivy III
74510d2fa4 refactor/polish ~ cargo fmt 2020-08-19 09:13:09 -05:00
Roy Ivy III
74200f368b tests ~ (sub-crate/mknod) fix WSL variation in expected test values 2020-08-19 09:13:09 -05:00
Roy Ivy III
2a50dc42c1 tests ~ (sub-crate/factor) fix divisor(0,0) test of factor::numeric::gcd() with early value check and return (fixes #1587) 2020-08-19 09:13:09 -05:00
Roy Ivy III
5478ca9108 tests ~ (sub-crate/od) fix expected f16 formatted test value 2020-08-10 10:19:42 -05:00
Roy Ivy III
b2483cb3c3 tests ~ (sub-crate/od) fix/remove inadvertent doc test (by using ignore) 2020-08-10 10:19:42 -05:00
Roy Ivy III
49d17f9587 tests ~ (sub-crate/od) fix compiler error (mismatched types) 2020-08-10 10:19:42 -05:00
Roy Ivy III
4fa27345be tests ~ (sub-crate/od) fix cargo clippy complaints (from deprecated half::consts to f16::...) 2020-08-10 10:19:42 -05:00
Roy Ivy III
c7cb5cbc37 tests ~ (sub-crate/cat) fix incorrect test attribute usage 2020-08-10 10:19:42 -05:00
Roy Ivy III
c3893edf94 tests ~ (sub-crates) fix 'edition=2018' module import errors
- ref: <https://users.rust-lang.org/t/imports-can-only-refer-to-extern-crate-names/24388> @@ <https://archive.is/iCaXp>
2020-08-10 10:19:42 -05:00
Roy Ivy III
925137afce tests ~ (sub-crate/od) fix cargo clippy complaints (unused imports) 2020-08-10 10:19:41 -05:00
Roy Ivy III
dd72893771 tests ~ (sub-crate/od) fix cargo clippy complaints (deprecated std::error::Error::description) 2020-08-10 10:19:41 -05:00
nicoo
dc6b9a8d62
CI: Improve annotations (#1584)
* CI: Only run rustfmt in one environment

- This displays clippy warnings even when rustfmt fails.
- This avoids displaying 3 copies of the same rustfmt warning as Github
  annotations.
- Avoids duplicated work.

* CI: Suppress warnings when building for the oldest toolchain version

We had cases of warnings emitted due to `rustc` bugs that were fixed
in non-obsolete versions.

* factor: Remove a workaround for warnings on obsolete rustc
2020-08-10 16:53:32 +02:00
Felipe Lema
ba6b55f117 feature[env]: Add support for --chdir=DIR in env (fixes #1568) (#1569) 2020-08-08 22:26:49 -05:00
nicoo
d9be24e354 factor: Make the implementation of GCD more readable (#1576)
* factor::numeric::gcd: Switch variable names to be more consistent

* factor::numeric::gcd: Improve comments

* factor::numeric::gcd: Extend loop invariant to v
2020-08-08 22:26:49 -05:00
nicoo
37f717f5e3 factor: Add tests against (random) numbers with known factorisations (#1573) (#1578)
* factor::Factors: Derive implementations of Eq and PartialEq

* factors::Factors: Implement quickcheck::Arbitrary

This generates uniformly-distributed integers with known factorisations,
and will enable further testing.

* factor: Test against random numbers with known factorisations

* factor::Factors::arbitrary: Simplify method signature
2020-08-08 22:26:25 -05:00
nicoo
34a5941ee9
factor::numeric: Add more property-based tests (#1577)
* factor::numeric::gcd: Rename test against the Euclidean algorithm

* factor::numeric::gcd: Add various property-based tests

* factor::numeric::modular_inverse: Rename test

* factor::numeric::modular_inverse: Add test on random values
2020-08-03 14:00:34 +02:00
nicoo
70828329ba
factor::miller_rabin: Deduplicate parametrized_check macro (#1575)
* factor::miller_rabin::tests::first_composite: Drop useless generic

* factor::miller_rabin::tests: Reuse parametrized_check macro
2020-08-03 13:58:09 +02:00
nicoo
1eabda91cf
factor: Split numeric.rs into multiple modules (#1567)
* factor::numeric: Start refactoring into multiple submodules

No change to the module's interface, but it should make it much easier to
keep the tests right next to the code they are related to.

Moreover, build.rs' dependency is now limited to numeric::{modular_inverse,
traits}, meaning that the rest of it can use build-time generated tables etc.

* factor::numeric: Move gcd (and its test) to a submodule

* factor::numeric: Move Montgomery arithmetic to its own module

Finally hollowed-out numeric.rs

* factor: Move numeric.rs to numeric/mod.rs

* factor::numeric: Fix an erroneous lint on obsolete Rust versions
2020-08-02 20:28:00 +02:00
Sylvestre Ledru
85e2e1d0ee
Merge pull request #1566 from nbraud/factor/miller-rabin/copyright
factor::miller_rabin: Add missing copyright header in source file
2020-08-02 14:09:44 +02:00
nicoo
645e9a24bd factor::miller_rabin: Add missing copyright header in source file 2020-07-26 14:59:30 +02:00
Roy Ivy III
c36d71ba43 refactor/polish ~ fix cargo clippy complaint (needless_lifetimes) 2020-07-25 11:09:10 -05:00
Roy Ivy III
305c3cbcdb refactor/polish ~ fix cargo clippy complaint (bind_instead_of_map) 2020-07-25 11:09:10 -05:00
Roy Ivy III
326ff36793 refactor/polosh ~ fix cargo clippy complaint (reversed_empty_ranges) 2020-07-25 11:09:10 -05:00
Roy Ivy III
a6d7379b97
Merge pull request #1563 from nbraud/factor/faster/gcd
factor/perf ~ speed up factor::numeric::gcd
2020-07-25 11:07:57 -05:00
nicoo
6bef6306c0 factor::numeric::gcd: Avoid redundant u64::trailing_zeros and shifts
7 to 10% faster, according to criterion.
2020-07-25 15:04:57 +02:00
nicoo
3e55139c13 factor::miller_rabbin::Result: Mark as #[must_use]
Ignoring a value of that type is a bug: they are only produced by
`miller_rabbin::test`, which is a pure, but expensive, function.

As such, an ignored value is always either a mistake, or an easy
optimisation opportunity (just remove the useless call to `test`).
2020-07-24 23:06:08 +02:00
nicoo
ecc3e2db24 factor::miller_rabin::test: Minor readability improvement 2020-07-24 23:06:08 +02:00
nicoo
e415b17c01 factor::miller_rabin: Remove duplicated work
The duplicate work was introduced in 2015.
2020-07-24 23:06:06 +02:00
nicoo
29d45e472d factor::numeric::gcd: Implement Stein's binary GCD algorithm
Also add a property-based test against the Euclidean implementation.

numeric::gcd got ~50-65% faster, according to criterion. The effect on the
overall system is small, but later PRs will use a lot more GCD computations.
2020-07-24 23:00:32 +02:00
nicoo
4f23767b85 factor::numeric::gcd: Add criterion-powered benchmark
The function had to be made `pub`, this is a [known limitation] of Criterion.

[known limitation]: https://bheisler.github.io/criterion.rs/book/user_guide/known_limitations.html
2020-07-24 22:58:26 +02:00
nicoo
1b593d94c9 factor: Update rand dependency to v0.7 2020-07-24 22:57:08 +02:00
nicoo
9a80ab7741 factor::numeric::DoubleInt: Document the DoubleWidth associated type 2020-07-24 11:28:26 -05:00
nicoo
17c69674eb factor::numeric::Int: Remove from_u128 method
It was unused, the debug assertions only need `to_u128`.
2020-07-24 11:28:26 -05:00
nicoo
1172af09c0 factor::numeric::DoubleInt: Clarify methods and associated types
- `DoubleInt::Double` renamed to `DoubleWidth`
- `{as,from}_double()` renamed to `{as,from}_double_width()`.

This should hopefully clarify that this is not a “double precision”
floating-point type, but an integer type with a larger range (used
for storing intermediate results, typ. from a multiplication)
2020-07-24 11:28:26 -05:00
nicoo
86a4749e3a factor::numeric: fix original "Generalise modular inverse computation" 2020-07-24 11:28:12 -05:00
nicoo
6e228d3184 Merge branches 'factor/faster/{centralise_logic, montgomery32}' 2020-07-05 00:20:16 +02:00
nicoo
4cfe754551 factor::miller_rabin::is_prime: Fix bug
Montgomery only works for odd n, so attempting to construct an instance
for an even number results in a panic!

The most obvious solution is to special-case even numbers.
2020-07-05 00:08:49 +02:00
nicoo
9b0f131135 Fix bug in factor::factor::factor (>_>")
Non-prime numbers, such as 0 or 1, shouldn't be inserted in the factorisation.
2020-07-05 00:07:38 +02:00
nicoo
e9e263ac66 factor::Factors: Derive Clone and Debug
Useful for printing out in-progress factorisations when debugging.
2020-07-05 00:07:33 +02:00
nicoo
7bdc81b882 factor: Add a first property-based test 2020-07-05 00:07:16 +02:00
nicoo
dcc22188ba factor: Fix clippy warnings 2020-07-05 00:05:45 +02:00
nicoo
f1d1cb80e4 factor::Factors: Generalise invariant check (from prime() to add()) 2020-07-05 00:05:45 +02:00
nicoo
2d2b6faab4 factor: Avoid moving data around in main factoring loop
Instead, the same `Factors` object is passed around through the execution.
~10% faster.
2020-07-05 00:05:45 +02:00
nicoo
6713d2ad62 factor: Move recursive factoring logic from rho to factor
No functional change, but prepares a coming optimisation.
2020-07-05 00:05:45 +02:00
nicoo
bd4d6fcac5 factor: Split the CLI and I/O code off the factoring logic 2020-07-05 00:05:45 +02:00
nicoo
6256750376 factor::miller_rabin: Use a macro to instantiate every test 2020-07-05 00:04:56 +02:00
nicoo
7a1b86c9c2 factor::numeric::tests: Use a macro to instantiate every test 2020-07-05 00:04:53 +02:00
nicoo
cbcc760f83 factor::miller_rabin: Squash another bug! >:3
Detected by the testsuite improvement just prior.
2020-07-05 00:04:49 +02:00
nicoo
3d6fdffe14 factor::miller_rabin: Generalise tests to 32 and 64b Montgomery 2020-07-05 00:04:29 +02:00
nicoo
9b149a759b factor::miller_rabin: Hoist edge-cases (even, <2) out of test()
test() takes a modulus that is known to not be even or <2 (otherwise the
Montgomery value could not be constructed), so those checks can be hoisted
into is_prime() and out of the critical path.
2020-07-05 00:04:26 +02:00
nicoo
4f08e28167 factor::miller_rabin: Add property-based test 2020-07-05 00:04:08 +02:00
nicoo
d2fa0fe63c factor::miller_rabin::tests: small_composites → small_semiprimes
This is more descriptive, as semiprime are the products of 2 primes;
all semiprimes are composite, but not all composite numbers are semiprime.
2020-07-05 00:01:48 +02:00
nicoo
1e4d824829 factor::miller_rabin: Add negative test over all small composites 2020-07-05 00:01:44 +02:00
nicoo
600268c6e4 factor::miller_rabin::tests: Refactor 2020-07-05 00:01:40 +02:00
nicoo
0a1200bdb8 factor::miller_rabin: Add test for the largest 64b composite numbers 2020-07-05 00:01:37 +02:00
nicoo
308290325a factor::miller_rabin::is_prime: Fix bug
Montgomery<_> only works for odd n, so attempting to construct an instance
for an even number results in a panic!

The most obvious solution is to special-case even numbers.
2020-07-05 00:01:33 +02:00
nicoo
d2b43f49f9 factor::numeric::OverflowingAdd: Generate impls with a macro 2020-07-05 00:01:21 +02:00
nicoo
b25c77c5f9 factor::numeric: Generate implementations of DoubleInt with a macro 2020-07-05 00:01:21 +02:00
nicoo
f95f977f98 factor::numeric: Generate implementations of Int with a macro 2020-07-05 00:01:21 +02:00
nicoo
53954badd7 factor::numeric: Refactor away the use of {To,From}Primitives 2020-07-05 00:01:21 +02:00
nicoo
19a8231fb2 factor::numeric::Arithmetic: Rename associated type I to ModInt 2020-07-05 00:01:21 +02:00
nicoo
caa79a1261 factor::numeric: Split Int and DoubleInt traits 2020-07-05 00:01:21 +02:00
nicoo
28244413d1 factor::numeric: Document when to remove OverflowingAdd trait 2020-07-05 00:01:21 +02:00
nicoo
3f79be0219 factor::numeric: Use debug_assert! for runtime assertions. 2020-07-05 00:01:21 +02:00
nicoo
774feb0a40 factor::numeric: Generalise tests for Arithmetic trait 2020-07-05 00:01:21 +02:00
Alex Lyon
4d28f48ad9 factor: combine Montgomery and Montgomery32 2020-07-05 00:01:21 +02:00
nicoo
a440807e6c factor::miller_rabin: Use a specialized basis for 32b integers
~3% faster
2020-07-05 00:01:21 +02:00
nicoo
e68bb192f2 factor::numeric: Add a 32b Montgomery variant [WiP]
~32% faster
2020-07-05 00:01:21 +02:00
nicoo
43ee92c40f factor::numeric: Generalise modular inverse computation 2020-07-05 00:01:21 +02:00
Alex Lyon
9de82d92b0
Merge pull request #1557 from nbraud/factor/issue_1556
factor::miller_rabin: Fix bug #1556
2020-06-24 04:53:32 -07:00
Alex Lyon
700d51a92b
Merge pull request #1528 from sylvestre/cp-no-deref
feature(cp) implement -P/--no-deference
2020-06-23 23:05:26 -07:00
nicoo
abf579975c factor::miller_rabin: Fix bug in primality test
Introduced in 6b9585b1 (#1525: Performance improvements for `factor`).
Closes #1556
2020-06-23 16:19:16 +02:00
nicoo
c5c86b00e9 factor::miller_rabin: Add tests reproducing #1556 2020-06-23 16:14:52 +02:00
nicoo
8e040bbf1a factor::table: Optimise the size of the precomputed table
A too-large precomputed table actually slows down the program: we spend
time fetching it from disk and from memory (into the CPU's cache), and
larger prime factors are more unlikely to occur in random integers (prime p
occurs with probability ~1/p when sampling 64b numbers uniformly-at-random)

The new value was chosen after measuring the execution time (for all
integers between 2 and 10⁷) for a broad set of values:

| n    | time (s) |
|------|----------|
| 16   | 40.84    |
| 32   | 34.491   |
| 64   | 29.044   |
| 128  | 25.121   |
| 192  | 23.98    |
| 256  | 23.102   |
| 256  | 24.93    |
| 272  | 23.57    |
| 288  | 23.85    |
| 304  | 23.91    |
| 320  | 23.24    |
| 329  | 23.45    |
| 336  | 23.55    |
| 352  | 23.09    |
| 368  | 23.65    |
| 384  | 23.32    |
| 384  | 23.36    |
| 400  | 23.30    |
| 416  | 23.38    |
| 432  | 23.42    |
| 448  | 23.95    |
| 448  | 24.00    |
| 464  | 23.81    |
| 480  | 23.55    |
| 496  | 24.10    |
| 512  | 24.101   |
| 512  | 24.23    |
| 1027 | 29.864   |
2020-06-20 22:22:55 +02:00
nicoo
9d992b77b2 factor: Keep the primes table size in a single place 2020-06-20 22:22:55 +02:00
nicoo
b956e632e1 factor::table: Coalesce accesses to the factors table
~5.6% faster
2020-06-20 22:22:55 +02:00
Sylvestre Ledru
2d62097843 feature(cp): Manage -P & -R 2020-06-20 10:49:15 +02:00
nicoo
0518e06053 factor::rho: Minor refactor for readability 2020-06-20 10:39:56 +02:00
nicoo
dacee413db factor::rho: Refactor to avoid unnecessary allocations 2020-06-20 10:39:56 +02:00
nicoo
71e1c52920 factor::Factors: Rename new() to one() 2020-06-20 10:39:56 +02:00
Sylvestre Ledru
280fafed8a feature(cp) implement -P/--no-deference 2020-06-20 09:38:39 +02:00
nicoo
45a1408fb0 fixup! factor: Add test exhibiting a bug in ρ 2020-06-19 15:28:01 +02:00
nicoo
9fe3de72f2 factor::rho: Fix very-unlikely bug (resulting in assertion failure)
This bug can only be triggered when:
- the Miller-Rabin test produces a divisor `d` (rare) ;
- n / d is prime.
2020-06-19 13:51:29 +02:00
nicoo
9eb944b6b9 factor: Add test exhibiting a bug in ρ
The test is repeated 20 times to make it overwhelmingly-likely to fail
(the bug itself is only triggered rarely)
2020-06-19 13:48:00 +02:00
nicoo
3a90e31307 factor::numeric::inv_mod_u64: Provide a more-helpful error message 2020-06-19 13:39:42 +02:00
nicoo
ef12991ee7 factors: Avoid repeatedly locking and flushing stdout
By default, stdout's LineWriter results one syscall per line, i.e. a billion
syscalls when factoring a billion numbers...

Buffering the output yields a ~28% speedup.
2020-06-18 16:45:40 -07:00
nicoo
2869248318 factor::Factors: Use a tree-based map internally
This eliminate the need for sorting the prime factors for display.
25% performance improvement after the changes from factor/montgomery.
2020-06-18 16:44:08 -07:00
nicoo
4b4d11b61a
factor: Add/update copyright notices as necessary (#1546) 2020-06-18 21:38:28 +02:00
Alex Lyon
6105cce69a
Merge pull request #1529 from nbraud/factor/montgomery
factor: Faster modular arithmetic with the Montgomery transform
2020-06-18 09:19:12 -07:00
nicoo
fb08d9ff9e factor::numeric::Montgomery::add: Deal with rare overflow case 2020-06-18 14:32:58 +02:00
Alex Lyon
e02b8a60f7
hashsum: switch from getopts to clap (#1542)
* hashsum: switch from getopts to clap

Additionally, slightly refactor.  This commit will be the first of
a series of commits refactoring (at the very least) `hashsum`.
2020-06-18 11:46:00 +02:00
Sylvestre Ledru
f17a112781
feature(ln): implement -r (#1540)
* bump the minimal version of rustc to 1.32

* feature(ln): implement -r

* fix two issues

* Use cow

* rustfmt the change

* with cargo.lock 1.31

* try to unbreak windows
2020-06-18 00:54:18 -07:00
nicoo
d1470dadf8 factor::numeric::gcd: Silence the (erroneous) dead code lint 2020-06-16 15:45:10 +02:00
nicoo
334e02786d factor: Run cargo fmt 2020-06-16 15:43:25 +02:00
Alex Lyon
8377abadb6
Fix to build on Rust 1.32.0 and formatting 2020-06-16 04:08:17 -05:00
Alex Lyon
110d6844ad
Use an iterator over OsString for uumain()
Additionally, restructure `uname` so that we don't need to find the
iterator's length.
2020-06-16 03:28:02 -05:00
nicoo
f1788d9e70 fixup! factor::numeric::Montgomery: Fix overflow bug 2020-06-16 01:17:16 +02:00
nicoo
4851619d62 factor::miller_rabin: Avoid repeatedly transforming 1 and -1
Approx. 25% speedup
2020-06-15 23:05:31 +02:00
nicoo
cb6051c580 factor::numeric::Montgomery: Fix overflow bug 2020-06-15 22:40:57 +02:00
nicoo
2238065c9d factor::numeric: Simplify Montgomery (remove superfluous Wrapping) 2020-06-15 19:18:34 +02:00
nicoo
19a0645a0a factor::numeric: Simplify inv_mod_u64
Just call `u64::wrapping_{mul,sub}` instead of (de)constructing Wrapping<u64>
values.
2020-06-15 19:18:34 +02:00
nicoo
918035e01e factor: Fix for old Rust 2020-06-15 19:18:34 +02:00
nicoo
f84d0f9398 factor::Factors::add: Make the precondition check a debug_assert 2020-06-15 19:18:34 +02:00
nicoo
33e18b4cd3 factor::numeric::Montgomery: Add debug assertions
In debug mode, checks that all arithmetic operations coincide with the
plain-u64 versions, as long as the latter does not overflow.
2020-06-15 19:18:34 +02:00
nicoo
8a4d0d30ad factor::numeric: Implement Montgomery's transform
This is a facter way to perform arithmetic mod n, when n is odd and a 64b
number.
2020-06-15 19:18:29 +02:00
nicoo
e91155519a factor::factor: Add integration tests 2020-06-15 19:10:16 +02:00
nicoo
bada7530fb factor::miller_rabin: Add tests 2020-06-15 19:10:16 +02:00
Roy Ivy III
813e57d225 fix cargo clippy complaint (redundant_clone) 2020-06-14 23:38:30 -05:00
Roy Ivy III
39e3c57198 fix cargo clippy complaint (clone_on_copy) 2020-06-14 23:38:30 -05:00
Sylvestre Ledru
7b452f3bfe style(nproc): reformat with rustfmt 2020-06-09 13:38:29 +02:00
Sylvestre Ledru
ac34d136f2 refactor(global): Move from tempdir to tempfile:
* the crate has been deprecated
2020-06-09 11:30:19 +02:00
Alex Lyon
80987250d2
Merge pull request #1521 from sylvestre/nproc
Add tests for nproc + clap migration
2020-06-08 19:18:00 -07:00
Alex Lyon
49771d4fda
Merge pull request #1535 from sylvestre/1.32
Move to 1.32 as minimal supported version
2020-06-08 14:31:02 -07:00
Sylvestre Ledru
5926315507 bump the minimal version of rustc to 1.32 2020-06-08 22:54:28 +02:00
Sylvestre Ledru
d0890b72cd
Merge pull request #1522 from sylvestre/groups
groups: clap migration
2020-06-08 22:19:08 +02:00
Sylvestre Ledru
851e25d134 refactor(logname): simplify the code 2020-06-07 17:54:30 +02:00
Sylvestre Ledru
5963b15746 refactor(nproc): fix some bugs and use clap 2020-06-02 23:29:21 +02:00
Sylvestre Ledru
ed1ebe09ff refactor(groups): move to clap 2020-06-02 23:16:18 +02:00
Sylvestre Ledru
78c04a254e refactor ~ rename MinSRV => MinRustV 2020-06-02 12:23:48 -05:00
Roy Ivy III
fbbd881ca9 docs ~ reduce sub-crate meta-information keywords to the maximum of five 2020-05-31 15:48:54 -05:00
Roy Ivy III
b2a566d50d fix/mknod ~ correct uucore feature dependency 2020-05-30 02:21:05 -05:00
Roy Ivy III
2fd7e15d63 fix/install ~ correct uucore feature dependency 2020-05-30 02:21:05 -05:00
Roy Ivy III
4b0dd73adb fix/chmod ~ correct uucore feature dependency 2020-05-30 02:21:05 -05:00
Roy Ivy III
923c47a408 refactor ~ remove outdated clippy attributes 2020-05-30 01:36:02 -05:00
Roy Ivy III
fb5ab86aee refactor help text and variable names 2020-05-30 01:36:02 -05:00
Roy Ivy III
8cf58de0a7 docs ~ polish/update comments 2020-05-30 01:36:02 -05:00
Roy Ivy III
619d0ab72b docs ~ add markdown-lint directives 2020-05-30 01:36:02 -05:00
Roy Ivy III
f82de13847 docs ~ spell-check repairs and addition of exceptions 2020-05-30 01:36:02 -05:00
Roy Ivy III
38ebc14b29 maint/build ~ remove .gitignore from sub-crate 'cut' 2020-05-29 22:59:48 -05:00
Roy Ivy III
21a4da905f fix cargo clippy complaint (single_component_path_imports) 2020-05-29 22:59:48 -05:00
Roy Ivy III
8fa8bb61ab change ~ install_sigpipe_hook() => mute_sigpipe_panic() (from uucore v0.0.4) 2020-05-29 22:59:48 -05:00
Roy Ivy III
ea3235c7e2 change ~ new_coreopts!() => app!() (from uucore v0.0.4) 2020-05-29 22:59:48 -05:00
Roy Ivy III
4b8fc7445b change ~ disp_err!() => show_usage_error!() (from uucore v0.0.4) 2020-05-29 22:59:48 -05:00
Roy Ivy III
6f465eeb9f deps ~ update utils to uucore/uucore_procs v0.0.4 2020-05-29 22:59:48 -05:00
Roy Ivy III
e3fd15e73c fix cargo clippy complaint (single_component_path_imports) 2020-05-29 22:59:48 -05:00
Roy Ivy III
156031b929 fix/sync ~ update to correct current WinAPI usage (ref #1496) 2020-05-29 22:59:48 -05:00
Roy Ivy III
fc9abdc179 fix/tail ~ update to correct current WinAPI usage (ref #1496) 2020-05-29 22:59:48 -05:00
Roy Ivy III
64f888d364 fix/cp ~ update to correct current WinAPI usage (ref #1496) 2020-05-29 22:59:48 -05:00
Roy Ivy III
251905da3d fix/du ~ update to correct WinAPI usage (fixes #1496) 2020-05-29 22:59:47 -05:00
Roy Ivy III
131bca3d53 fix/split ~ fix 'edition=2018' trait specification error 2020-05-29 22:59:47 -05:00
Roy Ivy III
3129c8fbe5 fix/od ~ fix 'edition=2018' trait specification error 2020-05-29 22:59:47 -05:00
Roy Ivy III
d4aa3a2231 fix 'edition="2018"' module import errors
- ref: <https://users.rust-lang.org/t/imports-can-only-refer-to-extern-crate-names/24388> @@ <https://archive.is/iCaXp>
2020-05-29 22:59:47 -05:00
Roy Ivy III
d70db1f7d2 docs ~ improve/update sub-crate meta information 2020-05-29 22:59:47 -05:00
Roy Ivy III
45a1609a38 update held/pinned dependencies (to maintain MinSRV v1.31.0) 2020-05-29 22:59:47 -05:00
Roy Ivy III
52ae491fcd change ~ rename base binary to 'coreutils' 2020-05-29 22:59:47 -05:00
Roy Ivy III
7cfa8be5f2 docs ~ add meta information to sub-crates 2020-05-29 22:59:47 -05:00
Roy Ivy III
6cb609aeee docs/codespell ~ fix spelling errors 2020-05-29 22:59:47 -05:00
Roy Ivy III
0cb5fbd6b5 change ~ remove transition-only and unneeded code for independent sub-crates 2020-05-29 22:59:46 -05:00
Roy Ivy III
db2e950918 change ~ make all sub-crates independent 2020-05-29 22:59:40 -05:00
Roy Ivy III
6606408ce9 refactor/polish ~ whitespace normalization (consistent indentation [either tabs *or* spaces], EOF EOLNs, no trailing whitespace) 2020-05-24 17:29:07 -05:00
Roy Ivy III
8263d31fbb change ~ improve help display for main multi-call binary 2020-05-24 17:29:07 -05:00
Roy Ivy III
c457dfbbc4 fix/uutils ~ support function/util (aka, applet) symlink aliasing where possible
## [why]

`std::env::current_exe()` has platform dependent behavior and will often
return the target binary, not the symlink name, when the binary is executed
via symlink. So, to support symlinking, the first (0th) arg from `std::env::args()`
is used, when possible, with fallback to `std::env::current_ext()` if args are
missing or empty.

- ref: <https://github.com/rust-lang/rust/issues/43617>
2020-05-24 17:29:07 -05:00
Roy Ivy III
bebf36bffb change/uutils ~ allow (almost) any name for the multi-binary container
- final multi-binary will now function correctly with any binary/executable name
- multi-binary container acts as the specified util IF EITHER ...
  1. the binary/executable name exactly matches the name of an applet/util
  2. the binary/exectuable name matches <PREFIX><UTIL_NAME> pattern
     * where the PREFIX is any string ending in a non-alphanumeric character
2020-05-24 17:29:07 -05:00
Roy Ivy III
09abcf8cbe
Merge pull request #1525 from nbraud/factor/faster
Performance improvements for `factor`
2020-05-24 16:54:04 -05:00
Nicolas Braud-Santoni
4c3682aec7
factor::Factors::add: Split up to work without NLL
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-05-24 19:14:37 +02:00
nicoo
36a2948959 factor::miller_rabin: Avoid unecessary exponentiation
Instead of computing a^r and a^(n-1) = a^(r 2ⁱ) separately,
compute the latter by repeatedly squaring the former.

33.6% performance improvement
2020-05-24 19:10:34 +02:00
nicoo
543c7b941a factor::rho: Small refactor 2020-05-24 19:10:29 +02:00
nicoo
30fd6a0309 factor::numeric: Replace lose functions with an Arithmetic trait 2020-05-24 18:16:21 +02:00
nicoo
29eb8fd77b format: Make clippy happy 2020-05-24 17:06:19 +02:00
nicoo
8241037690 factor::miller_rabin: Extract dividers from the primality test
Another 36% improvement.
2020-05-24 15:41:23 +02:00
nicoo
6b9585b1dc factor::miller_rabbin: Refactor before extracting dividers
Replace iterated division with u64::trailing_zeros, hoist the selection of `mul`
out of the loop, another cool 49.5% runtime improvement.
2020-05-24 15:41:23 +02:00
nicoo
e3ecc81d97 factor: Move the Miller-Rabin primality test to its own module. 2020-05-24 15:41:23 +02:00
nicoo
74054feb94 factor::factor: Remove extraneous call to the primality test
Another 6.97% runtime improvement
2020-05-24 15:41:23 +02:00
nicoo
e1a6dbe619 factor::table: Remove obsolete, commented code 2020-05-24 15:41:23 +02:00
nicoo
169740629b factor::table: Remove extraneous calls to the primality test
50% performance improvement on factoring all numbers between 2 and 10⁶.
2020-05-24 15:41:23 +02:00
nicoo
418fd61759 factor::factor: Short-circuit the fallback to Pollard's rho
When the remainder is smaller than the max. entry in the table,
it is guaranteed to be prime.
2020-05-24 15:41:23 +02:00
nicoo
bc11e57962 factor::factor: Use u64::trailing_zero instead of iterated division
No significant performance impact (most of the time is spent elsewhere),
but an easy and satisfying fix nevertheless.
2020-05-24 15:41:23 +02:00
nicoo
a1b2522750 factor: Move each factorisation method to its own module
Also decoupled the factorisation methods; now factor::factor contains
the logic that chains the different algorithms and aggregates results.

As a side-effect, rho::factor now performs extraneous allocations (as each
recursive step creates a new `Factors` value, which is then aggregated into
the previous one) but there is no significant performance impact.
2020-05-24 15:41:23 +02:00
nicoo
d9095a2539 factor: Refactor (eheh) around a Factors datatype
It is clearer to see what is going on, as opposed to passing around an
unmarked `Vec<u64>`, and there is a single place to add invariants checks.

This is also a more compact memory representation: each prime factor is
represented only once, with an additional byte for multiplicity.  The
performance impact is however not significant.
2020-05-24 15:41:23 +02:00
Sylvestre Ledru
75b7f768ea
fix(mv): Allow move across file systems (#1524)
Co-authored-by: Arni Dagur <arni@dagur.eu>
2020-05-24 12:49:56 +02:00
Sylvestre Ledru
272b66aac8
refactor(hostname): use clap instead of getopts for consistency (#1516)
* refactor(hostname): use clap instead of getopts for consistency

* deps ~ uucore/wide is required

Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-05-22 17:27:03 +02:00
Sylvestre Ledru
817a237821
Merge pull request #1513 from sylvestre/uptime-since
feature(uptime): add option --since
2020-05-21 22:18:52 +02:00
Sylvestre Ledru
2fe2fe7275
be less prescriptive with clap versions (#1514) 2020-05-21 22:18:13 +02:00
Sylvestre Ledru
0a02aeda71
refactor(hostname): rely on the hostname crate (#1517) 2020-05-21 10:58:38 +02:00
Sylvestre Ledru
3994af5678
Update src/uu/uptime/src/uptime.rs
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-05-21 10:58:23 +02:00
Sylvestre Ledru
340b5badda
Update src/uu/uptime/src/uptime.rs
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-05-21 10:58:15 +02:00
Sylvestre Ledru
6bc9b38fa9 fix(cp): Remove an unused dep to the getops crate 2020-05-17 12:09:55 +02:00
Sylvestre Ledru
719f2bf8ae feature(uptime): add option --since
For this, I:
* moved from getops to clap
* remove the millisecond maths
2020-05-17 11:50:08 +02:00
Roy Ivy III
8e886c30dc
Merge pull request #1511 from sylvestre/more
fix(more) handle no arguments without panic; add test and a FixME
2020-05-15 19:17:01 -05:00
Sylvestre Ledru
80203a7a02 fix(more) Return a proper error message when no argument is provided
Fix #1509
2020-05-15 17:48:35 -05:00
Roy Ivy III
9052bc4de7
Merge pull request #1503 from sylvestre/arch
test(arch): add tests and description text
2020-05-10 20:11:10 -05:00
Anuvrat Parashar
ce064dc62e feature(head): Introduce NLines to handle negative lines parameters 2020-05-10 21:32:48 +02:00
Sylvestre Ledru
1565f4d1d9
Update src/uu/arch/src/arch.rs
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-05-10 21:05:38 +02:00
Roy Ivy III
6e77f99f61
Merge pull request #1507 from sylvestre/id
add/id ~ long option variant and tests
2020-05-10 12:21:07 -05:00
Sylvestre Ledru
a83fe2f098
Merge pull request #1508 from muskuloes/master
Flush output buffer for expand/unexpand commands
2020-05-09 21:17:58 +02:00
muskuloes
c84f89257e fix clippy warning: extract function 2020-05-09 19:28:13 +02:00
muskuloes
b4752e079f flush output of unexpand command as well 2020-05-09 19:28:13 +02:00
muskuloes
fb8f3ebf96 expand: flush output buffer 2020-05-09 19:28:13 +02:00
Sylvestre Ledru
91ac5343db
remove artifact 2020-05-09 10:23:03 +02:00
Sylvestre Ledru
9fb00df9b3 test(id): add tests for id 2020-05-09 00:14:10 +02:00
Sylvestre Ledru
90dfa70bd3 feature(id): add --user, --group & --groups 2020-05-09 00:07:04 +02:00
Sylvestre Ledru
437e3aeab7 style(sort): Fix a clippy warning 2020-05-07 23:13:11 +02:00
elgris
71ba8b3fd6 sort: add "dictionary-order" flag.
The flag makes 'sort' command ignore non-dictionary symbols
(non-alphanumeric and non-spaces). The only difference with GNU sort is
that it takes ALL alphanumeric symbols, not only ASCII ones.
2020-05-07 23:08:24 +02:00
Sylvestre Ledru
f44e5465b8 cleanup(yes, whoami): remove some old workaround to force cargo rebuilds 2020-05-06 23:39:49 +02:00
Sylvestre Ledru
16bf4b1893 test(arch): Add some tests 2020-05-06 00:39:13 +02:00
E5ten
2a61fc7f72 feature(uname): Add -o/--operating-system flag
The code for the flag already existed it had just not been added to the argument parsing. Replace "print the operating system name." in -s help text with "print the kernel name." so the -o option can use the previous -s help text.
2020-05-05 13:23:42 +02:00
Roy Ivy III
ab0ef90b4a refact/cat ~ fix style issues 2020-05-04 13:04:02 -05:00
Sylvestre Ledru
6294736d79 Merge branch 'fix-cat' of https://github.com/phungleson/coreutils into phungleson-fix-cat 2020-05-04 13:09:21 +02:00
Sylvestre Ledru
7e3f32d4db style(df): rustfmt src/uu/df/src/df.rs 2020-05-04 10:56:16 +02:00
Sylvestre Ledru
06fe387c76
Merge pull request #1495 from orottier/wc
wc: Do not decode UTF8 when only counting bytes/newlines
2020-05-04 10:54:18 +02:00
Otto Rottier
dab1b9ba1a
rustfmt src/uu/wc/src/wc.rs
Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
2020-05-04 07:45:30 +02:00
Roy Ivy III
f12c27a57d
Merge pull request #1487 from sylvestre/df-human
refactor and fix some `df` build and cosmetic issues
2020-05-03 15:15:14 -05:00
Roy Ivy III
23b49101c0 fix/df ~ fix build script for sub-crate builds 2020-05-03 14:54:57 -05:00
Roy Ivy III
81d85f398b fix/df ~ missing windows imports 2020-05-03 14:54:57 -05:00
Roy Ivy III
091a356807 fix/df ~ correct number suffix display by using number_prefix PrefixNames::symbol() 2020-05-03 14:53:13 -05:00
Otto Rottier
e3bd6b6848 wc: Do not decode UTF8 when only counting bytes/newlines 2020-05-03 20:39:09 +02:00
Sylvestre Ledru
fc83024ebe refactor(df): use number_prefix like 'ls' instead of doing the display by hand 2020-05-03 13:29:55 -05:00
Sylvestre Ledru
90de33d5d7 maint/df: relax the dependencies 2020-05-03 12:27:55 -05:00
Sylvestre Ledru
850bd9c32d fix(date): fix the date
Date didn't work out of the box.
Refactor it a bit to match other programs
2020-05-03 12:26:17 -05:00
Roy Ivy III
2d5d0680d8 fix(df) ~ fix lint complaint (unused import) 2020-05-03 12:00:42 -05:00
Sylvestre Ledru
8d1f0edfc4 refact(df): follow the same directory pattern than the other software 2020-05-03 11:51:33 -05:00
Sylvestre Ledru
c85756e509 fix(df): Linux: Fix the mount path and type 2020-05-03 11:51:33 -05:00
Sylvestre Ledru
8f6770401d feat(df): Add the support of path for df. ex: df /boot 2020-05-03 11:51:33 -05:00
Sylvestre Ledru
6e8c901204 fix: typo fixes found by codespell 2020-05-01 23:36:33 +02:00
Sylvestre Ledru
2aed7cb035 fix(df): Fix Windows support
- add required handleapi feature for winapi crate
- remove unneeded 'unsafe' section
- remove unused import (GetDiskFreeSpaceExW)
- fix Windows df execution

Co-Authored-By: Roy Ivy III <rivy.dev@gmail.com>
2020-04-28 13:16:19 -05:00
Sylvestre Ledru
f9456e80c3 fix(df): Add support for freebsd 2020-04-28 13:11:22 -05:00
Sylvestre Ledru
8545f03e0f fix(df): Improve MacOSX support 2020-04-28 13:11:21 -05:00
Sylvestre Ledru
dd1a212550 style(df): Fix warnings + cargo fmt
Co-Authored-By: Roy Ivy III <rivy.dev@gmail.com>
2020-04-28 13:11:04 -05:00
Sylvestre Ledru
d5228b5a64 feat(df) add 'df' uutil 2020-04-28 13:05:55 -05:00
Roy Ivy III
5aa2b039a5 change ~ fixup paths (within workspace packages) to common code 2020-04-14 13:46:19 -05:00
Roy Ivy III
78c362c8b5 change ~ fixup paths (within workspace packages) 2020-04-14 13:46:18 -05:00
Roy Ivy III
f0b0e3b867 change ~ reorganize code files 2020-04-14 13:46:18 -05:00
Sylvestre Ledru
cf35d75491 rustfmt the tests 2020-04-13 20:36:03 +02:00
Roy Ivy III
08a2cd0fc8
Merge pull request #1449 from rivy/add.cicd
Improves build and maint; fixes all testing issues; adds GHA CICD; fixes a long list of lints
2020-04-13 10:12:24 -05:00
Roy Ivy III
6a18d7f7be update ~ (maint!) use fixed/patched uucore (v0.0.2); await upgrade upstream
- fixes musl (no-utmpx) build bug
- fixes failing windows real{link,path} tests
2020-04-12 22:39:55 -05:00
Roy Ivy III
b8da0d7a8c maint/docs ~ add license notation to all workspace packages 2020-04-12 16:57:11 -05:00
Roy Ivy III
d704fb2b61 printf: refactor ~ remove redundant string allocation 2020-04-12 16:56:05 -05:00
Roy Ivy III
3e3dff3a57 ls: refactor ~ improve line bundling of imports 2020-04-12 16:56:05 -05:00
Roy Ivy III
84f05f209c expand: refactor/polish ~ simplify if condition 2020-04-12 16:56:04 -05:00
Roy Ivy III
ecb8f2873a refactor ~ change repair of 'fix cargo clippy complaints (fatal/same if clause)'
.# [why]

The initial refactoring/repair led to comments within if conditions which is
objectionable to some of the devs. So, this changes the refactor to completely split
the if clauses into separate if statements (with corresponding commentary).

Note: this refactor is "less mechanical" and does increase the risk of changing the
actual effect of the code. But the change is small and the tests are passing.
2020-04-12 16:56:04 -05:00
Roy Ivy III
156502a332 refactor ~ reduce excessive use of scope prefixes 2020-04-12 16:56:04 -05:00
Roy Ivy III
78d55f0e32 refactor/polish ~ fix cargo clippy complaints (fix/remove allow range_plus_one) 2020-04-12 16:56:04 -05:00
Roy Ivy III
1c97a29a56 maint/build ~ refactor dependency specifications (sorted, single lines) of 'Cargo.toml' 2020-04-12 16:56:04 -05:00
Roy Ivy III
7e15375d82 refactor ~ clean up main directory (move '{mk,uu}main.rs' into src/#common) 2020-04-11 18:50:12 -05:00
Roy Ivy III
9675addc50 refactor/polish ~ fix cargo clippy complaints (skip_while_next) 2020-04-11 18:50:11 -05:00
Roy Ivy III
0cf704a1bf refactor/polish ~ fix cargo clippy complaints (wildcard_in_or_patt) 2020-04-11 18:50:11 -05:00
Roy Ivy III
5224c3cd49 refactor/polish ~ fix rustc complaints (unused_parens) 2020-04-11 18:50:11 -05:00
Roy Ivy III
ecc895e7a1 refactor/polish ~ fix cargo clippy complaints (iter_nth_zero) 2020-04-11 18:50:11 -05:00
Roy Ivy III
ce0bb218a7 refactor/polish ~ fix cargo clippy complaints (deprecated std::error::Error::description) 2020-04-11 18:50:11 -05:00
Roy Ivy III
0635c5fe93 refactor/polish ~ fix cargo clippy complaints (unused_parens) 2020-04-11 18:50:11 -05:00
Roy Ivy III
c484fb8065 refactor/polish ~ fix cargo clippy complaints (missing_safety_doc; with ToDO for safety note) 2020-04-11 18:50:10 -05:00
Roy Ivy III
0fdf27c5c2 refactor/polish ~ fix cargo clippy complaints (iter_skip_next) 2020-04-11 18:50:10 -05:00
Roy Ivy III
84e26b3d0b refactor/polish ~ fix cargo clippy complaints (or_fun_call) 2020-04-11 18:50:10 -05:00
Roy Ivy III
9b145bb6c4 refactor/polish ~ fix cargo clippy complaints (unreadable_literal) 2020-04-11 18:50:10 -05:00
Roy Ivy III
75f05df119 refactor/polish ~ fix cargo clippy complaints (redundant_static_lifetimes) 2020-04-11 18:50:10 -05:00
Roy Ivy III
c4a69f2f4e refactor/polish ~ fix cargo clippy complaints (allow trivially_copy_pass_by_ref) 2020-04-11 18:50:10 -05:00
Roy Ivy III
1d26e901f9 fix 32-bit/i686 target builds 2020-04-11 18:50:09 -05:00
Sylvestre Ledru
deda30e3f5
Merge pull request #1421 from felixonmars/patch-1
Correct some typos in printf.rs
2020-04-08 19:03:57 +02:00
Son
a573a24d28 Add test 0 to 8 and 10 to 31 2020-02-09 14:18:21 +11:00
Son
7c9cc92163 Test write tab 2020-02-09 13:41:12 +11:00
Son
76ff2f5480 Test new line 2020-02-09 13:26:51 +11:00
Son
29729818f0 Empty test to start with cat 2020-02-09 11:18:18 +11:00
Roy Ivy III
5af8503a5e cargo fmt 2020-01-28 00:05:06 -06:00
Roy Ivy III
15722e3ace refactor/polish ~ fix cargo clippy complaints (unused imports) 2020-01-28 00:04:41 -06:00
Roy Ivy III
daecc56d47 refactor/polish ~ fix cargo clippy complaints (unwrap_or_else) 2020-01-27 22:35:28 -06:00
Roy Ivy III
b4866afb9a refactor/polish ~ fix cargo clippy complaints (deprecated uint64_t) 2020-01-27 22:35:28 -06:00
Roy Ivy III
a6bdad314d refactor/polish ~ fix cargo clippy complaints (allow deprecated mem::uninitialized)
.# [why]

`std::mem::MaybeUninit` is likely preffered. But `MaybeUninit` was not
stabilized until rust v1.36.0 and conversion from `mem::uninitialized` is
not obviously straight-forward at the moment.

So, 'std::mem::uninitialized' is allowed instead of increasing MinSRV to v1.36.0.

* ref: https://github.com/rust-lang/rust/blob/master/RELEASES.md
2020-01-27 22:35:28 -06:00
Roy Ivy III
082f9520b2 refactor/polish ~ fix cargo clippy complaints (allow useless_let_if_seq) 2020-01-27 22:35:28 -06:00
Roy Ivy III
d82a170351 refactor/polish ~ fix cargo clippy complaints (allow unreadable_literal {for dynamic code}) 2020-01-27 22:35:28 -06:00
Roy Ivy III
372ddf9222 refactor/polish ~ fix cargo clippy complaints (allow too_many_args) 2020-01-27 22:35:28 -06:00
Roy Ivy III
6c7c4788d8 refactor/polish ~ fix cargo clippy complaints (allow single_match) 2020-01-27 22:35:28 -06:00
Roy Ivy III
6230ab302a refactor/polish ~ fix cargo clippy complaints (allow range_plus_one; clippy bug workaround)
* ref: <https://github.com/rust-lang/rust-clippy/issues/4898>
2020-01-27 22:35:28 -06:00
Roy Ivy III
522d3ae1b6 refactor/polish ~ fix cargo clippy complaints (allow ptr_arg) 2020-01-27 22:35:27 -06:00
Roy Ivy III
b8c0711273 refactor/polish ~ fix cargo clippy complaints (allow ptr_arg) 2020-01-27 22:35:27 -06:00
Roy Ivy III
e80970cb92 refactor/polish ~ fix cargo clippy complaints (allow module_inception) 2020-01-27 22:35:27 -06:00
Roy Ivy III
cc49983314 refactor/polish ~ fix cargo clippy complaints (allow missing_safety_doc) 2020-01-27 22:35:27 -06:00
Roy Ivy III
df68c396c4 refactor/polish ~ fix cargo clippy complaints (allow map_clone)
.# [why]

Although `copied()` is preffered, it was not stabilized until rust v1.35.0.
So, 'map_clone' is allowed instead of increasing MinSRV to v1.35.0.

* ref: https://github.com/rust-lang/rust/blob/master/RELEASES.md
2020-01-27 22:35:27 -06:00
Roy Ivy III
99ce03f259 refactor/polish ~ fix cargo clippy complaints (allow many_single_char_names) 2020-01-27 22:35:27 -06:00
Roy Ivy III
44a60f773f refactor/polish ~ fix cargo clippy complaints (allow 'let_and_return') 2020-01-27 22:35:27 -06:00
Roy Ivy III
a90e1abbd8 refactor/polish ~ fix cargo clippy complaints (allow enum_variant_names) 2020-01-27 22:35:27 -06:00
Roy Ivy III
5241eca084 refactor/polish ~ fix cargo clippy complaints (allow comparison_chain {for f64 comparisons}) 2020-01-27 22:35:27 -06:00
Roy Ivy III
784887cc84 refactor/polish ~ fix cargo clippy complaints (allow comparison_chain) 2020-01-27 22:35:27 -06:00
Roy Ivy III
5094d6ffcc refactor/polish ~ fix cargo clippy complaints (allow complexity) 2020-01-27 22:35:26 -06:00
Roy Ivy III
37c9b0e331 refactor/polish ~ fix cargo clippy complaints ('better' ref use/toplevel_ref_arg) 2020-01-27 22:35:26 -06:00
Roy Ivy III
58779be6bb refactor/polish ~ fix cargo clippy complaints (transmute_ptr_to_ptr) 2020-01-27 22:35:26 -06:00
Roy Ivy III
1deac8df87 refactor/polish ~ fix cargo clippy complaints (new_ret_no_self) 2020-01-27 22:35:26 -06:00
Roy Ivy III
6131f6f0e1 refactor/polish ~ fix cargo clippy complaints (borrowed_box) 2020-01-27 22:35:26 -06:00
Roy Ivy III
8f2cdcfcb5 refactor/polish ~ fix cargo clippy complaints (trivially_copy_pass_by_ref) 2020-01-27 22:35:26 -06:00
Roy Ivy III
37a3db1819 refactor/polish ~ fix cargo clippy complaints (flat_map_identity) 2020-01-27 22:35:26 -06:00
Roy Ivy III
bffea950d9 refactor/polish ~ fix cargo clippy complaints (zero_ptr) 2020-01-27 22:35:26 -06:00
Roy Ivy III
248dfbac08 refactor/polish ~ fix cargo clippy complaints (comparison_chain) 2020-01-27 22:35:16 -06:00
Roy Ivy III
2ef9c9a28e refactor/polish ~ fix cargo clippy complaints (unnecessary_unwrap) 2020-01-27 21:33:53 -06:00
Roy Ivy III
7cc3571657 refactor/polish ~ fix cargo clippy complaints (remove unit value as function arg) 2020-01-27 21:33:53 -06:00
Roy Ivy III
8ec50b72d1 refactor/polish ~ fix cargo clippy complaints (inefficient to_string()) 2020-01-27 21:33:53 -06:00
Roy Ivy III
334406028c refactor/polish ~ fix cargo clippy complaints (remove useless lint attribute) 2020-01-27 21:33:53 -06:00
Roy Ivy III
aa2ed76846 refactor/polish ~ fix cargo clippy complaints (unneeded transmute) 2020-01-27 21:33:53 -06:00
Roy Ivy III
f933c60a41 refactor/polish ~ fix cargo clippy complaints (filter_map => filter) 2020-01-27 21:33:53 -06:00
Roy Ivy III
de9d702a32 refactor/polish ~ fix cargo clippy complaints (use enumerate) 2020-01-27 21:33:53 -06:00
Roy Ivy III
33e5d8c813 refactor/polish ~ fix cargo clippy complaints (into_iter => iter) 2020-01-27 21:33:53 -06:00
Roy Ivy III
d343d533ba refactor/polish ~ fix cargo clippy complaints (avoid as ...) 2020-01-27 21:33:53 -06:00
Roy Ivy III
66124454e3 refactor/polish ~ fix cargo clippy complaints (remove ->()) 2020-01-27 21:33:53 -06:00
Roy Ivy III
55b3e4ea24 refactor/polish ~ fix cargo clippy complaints (simplify enum element names/NumberMode) 2020-01-27 21:33:53 -06:00
Roy Ivy III
82dc40f0af refactor/polish ~ fix cargo clippy complaints (simplify enum element names/InteractiveMode) 2020-01-27 21:33:52 -06:00
Roy Ivy III
fd8e5acd57 refactor/polish ~ fix cargo clippy complaints (loop/match => while let) 2020-01-27 21:33:52 -06:00
Roy Ivy III
98039f176d refactor/polish ~ fix cargo clippy complaints (String => str) 2020-01-27 21:33:52 -06:00
Roy Ivy III
3bddf84aec refactor/polish ~ fix cargo clippy complaints (match => if let) 2020-01-27 21:33:52 -06:00
Roy Ivy III
600c40490b refactor/polish ~ fix cargo clippy complaints (map => if let) 2020-01-27 21:33:52 -06:00
Roy Ivy III
739c2d5793 refactor/polish ~ fix cargo clippy complaints (use is_ok) 2020-01-27 21:33:52 -06:00
Roy Ivy III
8b18b7c206 refactor/polish ~ fix cargo clippy complaints (use is_null) 2020-01-27 21:33:52 -06:00
Roy Ivy III
bb15dcf1b8 refactor/polish ~ fix cargo clippy complaints (use is_empty / is_none) 2020-01-27 21:33:52 -06:00
Roy Ivy III
2931c808b6 refactor/polish ~ fix cargo clippy complaints (collapse equal if blocks) 2020-01-27 21:33:52 -06:00
Roy Ivy III
b003d55fe1 refactor/polish ~ fix cargo clippy complaints (collapse if-if) 2020-01-27 21:33:52 -06:00
Roy Ivy III
b8eb763e43 refactor/polish ~ fix cargo clippy complaints (collapse else-if) 2020-01-27 21:33:52 -06:00
Roy Ivy III
2db6fb20c9 refactor/polish ~ fix cargo clippy complaints (needless_lifetimes) 2020-01-27 21:33:51 -06:00
Roy Ivy III
8c97f0eebb refactor/polish ~ fix cargo clippy complaints ('better' match indirection) 2020-01-27 21:33:51 -06:00
Roy Ivy III
ab87a1ab5f refactor/polish ~ fix cargo clippy complaints ('better' ref indirection) 2020-01-27 21:33:51 -06:00
Roy Ivy III
94c088f452 refactor/polish ~ fix cargo clippy complaints (redundant return variable) 2020-01-27 21:33:51 -06:00
Roy Ivy III
88a45a157b refactor/polish ~ fix cargo clippy complaints (redundant return) 2020-01-27 21:33:51 -06:00
Roy Ivy III
564168ccfc refactor/polish ~ fix cargo clippy complaints (redundant clone) 2020-01-27 21:33:51 -06:00
Roy Ivy III
2e90c78fae refactor/polish ~ fix cargo clippy complaints (redundant closure) 2020-01-27 21:33:51 -06:00
Roy Ivy III
fa8540cb15 refactor/polish ~ fix cargo clippy complaints (DRY struct def) 2020-01-27 21:33:51 -06:00
Roy Ivy III
ea8ed8d5da refactor/polish ~ fix cargo clippy complaints (&Vec => &[]) 2020-01-27 21:33:50 -06:00
Roy Ivy III
a72422fb0e refactor/polish ~ fix cargo clippy complaints (Vec<> => []) 2020-01-27 21:33:50 -06:00
Roy Ivy III
ec5ca193ac refactor/polish ~ fix cargo clippy complaints (char not string) 2020-01-27 21:33:50 -06:00
Roy Ivy III
11d68d3e51 refactor/polish ~ fix cargo clippy complaints (number readability) 2020-01-27 21:33:50 -06:00
Roy Ivy III
3da2a69e11 refactor/polish ~ fix cargo clippy complaints (unneeded String::from) 2020-01-27 21:33:50 -06:00
Roy Ivy III
bf6368269c refactor/polish ~ fix cargo clippy complaints (unneeded parens) 2020-01-27 21:33:50 -06:00
Roy Ivy III
1216378c72 refactor/polish ~ fix cargo clippy complaints (unneeded ref for copiable) 2020-01-27 21:33:50 -06:00
Roy Ivy III
bc558f301a refactor/polish ~ fix cargo clippy complaints (unneeded mut) 2020-01-27 21:33:50 -06:00
Roy Ivy III
25b1f98cf8 refactor/polish ~ fix cargo clippy complaints (unneeded format) 2020-01-27 21:33:50 -06:00
Roy Ivy III
3bff70967c refactor/polish ~ fix cargo clippy complaints (use starts_with()) 2020-01-27 21:33:50 -06:00
Roy Ivy III
e676447b3d refactor/polish ~ fix cargo clippy complaints (while let ... = some => for ... in) 2020-01-27 21:33:49 -06:00
Roy Ivy III
8142ecf325 refactor/polish ~ fix cargo clippy complaints (default/tests => let ... = if ...) 2020-01-27 21:33:49 -06:00
Roy Ivy III
d192ebea5b refactor/polish ~ fix cargo clippy complaints (unwrap_or_else) 2020-01-27 21:33:49 -06:00
Roy Ivy III
4ddc65f255 refactor/polish ~ fix cargo clippy complaints (String => str) 2020-01-27 21:33:49 -06:00
Roy Ivy III
2d95cfdcbd refactor/polish ~ fix cargo clippy complaints (remove allow unused_must_use) 2020-01-27 21:33:49 -06:00
Roy Ivy III
90a64a831a refactor/polish ~ fix cargo clippy complaints (for in => iter.take) 2020-01-27 21:33:49 -06:00
Roy Ivy III
1642933275 refactor/polish ~ fix cargo clippy complaints (if is_none => as_ref()?) 2020-01-27 21:33:49 -06:00
Roy Ivy III
88db11a328 refactor/polish ~ fix cargo clippy complaints (negation instead of * -1) 2020-01-27 21:33:49 -06:00
Roy Ivy III
3c2e609bfe refactor/polish ~ fix cargo clippy complaints (use values()) 2020-01-27 21:33:49 -06:00
Roy Ivy III
c6e9808224 refactor/polish ~ fix cargo clippy complaints (match function signatures) 2020-01-27 21:33:49 -06:00
Roy Ivy III
c6817aefb3 refactor/polish ~ fix cargo clippy complaints (or_else) 2020-01-27 21:33:49 -06:00
Roy Ivy III
413c64fa12 refactor/polish ~ fix cargo clippy complaints ('better' as println!()) 2020-01-27 21:33:48 -06:00
Roy Ivy III
291d2f5d48 refactor/polish ~ fix cargo clippy complaints ('better' as println!(...)) 2020-01-27 21:33:48 -06:00
Roy Ivy III
ba5a2435be refactor/polish ~ fix cargo clippy complaints (unneeded _) 2020-01-27 21:33:48 -06:00
Roy Ivy III
493f5f1496 refactor/polish ~ fix cargo clippy complaints (use +=/-= notation) 2020-01-27 21:33:48 -06:00
Roy Ivy III
768ed71725 refactor/polish ~ fix cargo clippy complaints (use b'...' notation) 2020-01-27 21:33:48 -06:00
Roy Ivy III
b276f4758f refactor/polish ~ fix cargo clippy complaints (iter.collect => to_vec) 2020-01-27 21:33:48 -06:00
Roy Ivy III
a9b1a03b37 refactor/polish ~ fix cargo clippy complaints (fatal/write_all) 2020-01-27 21:33:48 -06:00
Roy Ivy III
662db61336 refactor/polish ~ fix cargo clippy complaints (fatal/unneeded drop) 2020-01-27 21:33:48 -06:00
Roy Ivy III
181c9d6cae refactor/polish ~ fix cargo clippy complaints (fatal/unneeded clone) 2020-01-27 21:33:48 -06:00
Roy Ivy III
6043ac1cbd refactor/polish ~ fix cargo clippy complaints (fatal/temporary_cstring_as_ptr) 2020-01-27 21:33:48 -06:00
Roy Ivy III
1f5749e304 refactor/polish ~ fix cargo clippy complaints (fatal/same if clause) 2020-01-27 21:33:48 -06:00
Roy Ivy III
1f137c245f refactor/polish ~ fix cargo clippy complaints (fatal/cast_ptr_alignment) 2020-01-27 21:33:47 -06:00
Roy Ivy III
c969becbf8 refactor ~ remove unneeded mem::uninitialized() code
.# [why]

`mem::ununitialized()` is deprecated as of rust v1.39.0.

And this use is likely a premature optimization attempting to avoid
initializing the byte array to 0, which is usually a *very* fast operation.

* ref: <https://github.com/rust-lang/rust/blob/master/RELEASES.md>
* ref: <https://stackoverflow.com/questions/3654905/faster-way-to-zero-memory-than-with-memset>
2020-01-27 21:33:47 -06:00
Roy Ivy III
244bdf3d4f who: fix ~ remove unneeded/incorrect time format size change 2020-01-27 21:33:47 -06:00
Roy Ivy III
9416709c9c stat: fix birth/created time transformation 2020-01-27 21:33:47 -06:00
Roy Ivy III
45a04ce5fc refactor ~ replace deprecated trim_{left,right}... with trim_{start,end}...
- `trim_{start,end}{,_matches}` stabilized in rust v1.30.0
- `trim_{start,end}{,_matches}` deprecated (with compiler warnings) in rust v1.33.0

+ requires MinSRV >= v1.30.0

* ref: https://github.com/rust-lang/rust/blob/master/RELEASES.md
2020-01-27 21:33:47 -06:00
Roy Ivy III
c22cf215ba refactor/polish ~ convert to inclusive range operator syntax (..=)
- convert to newer `..=` syntax, fixing compiler warnings

+ requires MinSRV >= v1.26.0

.# [why]

The inclusive range operator (`..=`) was stabilized in rust v1.26.0.

Warnings requesting conversion from the old `...` operator to `..=` were
introduced in rust v1.37.0.

* ref: <https://github.com/rust-lang/rust/blob/master/RELEASES.md>
2020-01-27 21:33:47 -06:00
Roy Ivy III
55209c6490 cp: use CreateFileW to increase legacy windows compatiblity 2020-01-27 21:33:46 -06:00
Alex Lyon
2dad625dfa
Merge pull request #1402 from GabrielGanne/master
ls: fix --color flag
2020-01-27 15:20:43 -08:00
Sylvestre Ledru
0420d0849f uptime: match the gnu version output 2020-01-03 22:58:11 +01:00
bippityboppity
3511aa987a Add the 'dyn' keyword where necessary
The keyword is needed for trait objects and is intended to improve
readability.
https://doc.rust-lang.org/edition-guide/rust-2018/trait-system/dyn-trait-for-trait-objects.html
2019-10-01 18:34:26 +02:00
Felix Yan
f4b5d6c881
Correct some typos in printf.rs 2019-08-23 00:43:03 +08:00
Gabriel Ganne
64009b090f ls: implement --color=auto behavior
The automatic behavior is to turn on colors only of connected to a
terminal.
Introduce new external crate isatty to handle this.

Signed-off-by: Gabriel Ganne <gabriel.ganne@gmail.com>
2019-06-23 10:38:39 +02:00
Gabriel Ganne
edaf2d85cb ls: implement --color flag
GNU coreutils ls command implements the --color option as follow:
  --color[=WHEN]
          colorize the output; WHEN can be 'always' (default if omitted),
          'auto', or 'never'

With --color=auto, ls emits color codes only when standard output is connected
to a terminal.

Also, add support for the following aliases:
  - ‘always’, ‘yes’, ‘force’
  - ‘never’, ‘no’, ‘none’
  - ‘auto’, ‘tty’, ‘if-tty’

Signed-off-by: Gabriel Ganne <gabriel.ganne@gmail.com>
2019-06-23 10:35:30 +02:00
dependabot-preview[bot]
427381fd87
build: bump aho-corasick from 0.6.10 to 0.7.3
Bumps [aho-corasick](https://github.com/BurntSushi/aho-corasick) from 0.6.10 to 0.7.3.
- [Release notes](https://github.com/BurntSushi/aho-corasick/releases)
- [Commits](https://github.com/BurntSushi/aho-corasick/compare/0.6.10...0.7.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-21 07:17:27 +00:00
Alex Lyon
33a112d64b
Merge pull request #1400 from uutils/dependabot/cargo/num_cpus-1.10.1
build: bump num_cpus from 1.10.0 to 1.10.1
2019-06-18 09:25:35 -07:00
dependabot-preview[bot]
4b5dbcf995
build: bump num_cpus from 1.10.0 to 1.10.1
Bumps [num_cpus](https://github.com/seanmonstar/num_cpus) from 1.10.0 to 1.10.1.
- [Release notes](https://github.com/seanmonstar/num_cpus/releases)
- [Changelog](https://github.com/seanmonstar/num_cpus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/num_cpus/compare/v1.10.0...v1.10.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-18 13:21:47 +00:00
dependabot-preview[bot]
642a2a4ecb
build: bump memchr from 1.0.2 to 2.2.0
Bumps [memchr](https://github.com/BurntSushi/rust-memchr) from 1.0.2 to 2.2.0.
- [Release notes](https://github.com/BurntSushi/rust-memchr/releases)
- [Commits](https://github.com/BurntSushi/rust-memchr/compare/1.0.2...2.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-17 16:21:06 +00:00
Alex Lyon
8575512895
Merge pull request #1389 from uutils/dependabot/cargo/glob-0.3.0
build: bump glob from 0.2.11 to 0.3.0
2019-06-17 09:18:43 -07:00
dependabot-preview[bot]
50aab8541d
build: bump glob from 0.2.11 to 0.3.0
Bumps [glob](https://github.com/rust-lang/glob) from 0.2.11 to 0.3.0.
- [Release notes](https://github.com/rust-lang/glob/releases)
- [Commits](https://github.com/rust-lang/glob/compare/0.2.11...0.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-15 22:35:35 +00:00
Alex Lyon
bc783edde7
Merge pull request #1388 from uutils/dependabot/cargo/byteorder-1.3.2
build: bump byteorder from 1.3.1 to 1.3.2
2019-06-15 15:34:20 -07:00
Alex Lyon
f1a4d5d4f7
Merge pull request #1393 from uutils/dependabot/cargo/itertools-0.8.0
build: bump itertools from 0.7.11 to 0.8.0
2019-06-15 15:33:56 -07:00
Alex Lyon
16daa41f38
Merge pull request #1392 from uutils/dependabot/cargo/regex-syntax-0.6.7
build: bump regex-syntax from 0.6.6 to 0.6.7
2019-06-15 15:33:45 -07:00
dependabot-preview[bot]
7a24f5e517
build: bump walkdir from 2.2.7 to 2.2.8
Bumps [walkdir](https://github.com/BurntSushi/walkdir) from 2.2.7 to 2.2.8.
- [Release notes](https://github.com/BurntSushi/walkdir/releases)
- [Commits](https://github.com/BurntSushi/walkdir/compare/2.2.7...2.2.8)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-13 12:59:42 +00:00
dependabot-preview[bot]
e7c3d2e381
build: bump itertools from 0.7.11 to 0.8.0
Bumps [itertools](https://github.com/bluss/rust-itertools) from 0.7.11 to 0.8.0.
- [Release notes](https://github.com/bluss/rust-itertools/releases)
- [Commits](https://github.com/bluss/rust-itertools/compare/0.7.11...0.8.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-13 12:59:16 +00:00
dependabot-preview[bot]
a0ca860f93
build: bump regex-syntax from 0.6.6 to 0.6.7
Bumps [regex-syntax](https://github.com/rust-lang/regex) from 0.6.6 to 0.6.7.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/regex-syntax-0.6.6...regex-syntax-0.6.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-13 12:59:04 +00:00
dependabot-preview[bot]
688e08127b
build: bump byteorder from 1.3.1 to 1.3.2
Bumps [byteorder](https://github.com/BurntSushi/byteorder) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/BurntSushi/byteorder/releases)
- [Changelog](https://github.com/BurntSushi/byteorder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/byteorder/compare/1.3.1...1.3.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-13 12:57:14 +00:00
Alex Lyon
ab8c2b021a env: fix build on Windows 2019-05-13 12:22:43 -07:00
Alex Lyon
18b19715f9 env: refactor and move away from pre-1.0 Rust conventions 2019-05-13 04:03:10 -07:00
Alex Lyon
b73a664677 Split off uucore into its own repository 2019-05-12 22:42:20 -07:00
Roy Ivy III
bbd0a26012 env: minor fixes and commentary polish 2019-05-09 19:06:32 -05:00
Alex Lyon
8a86c84461 uucore: allow the Linux zero-copy setup on Android 2019-05-01 21:15:01 -07:00
Alex Lyon
2019833fbb uucore: remove an inaccurate comment 2019-05-01 21:15:01 -07:00
Alex Lyon
b46e2289d6 uucore, yes: add zero-copy on supported platforms (only Linux currently) 2019-05-01 21:15:00 -07:00
Alex Lyon
7651d4d3fc Get rid of all warnings on Linux (or at least WSL) 2019-05-01 21:14:40 -07:00
Alex Lyon
db35eab23b Remove git dependencies 2019-05-01 21:14:39 -07:00
Alex Lyon
179de609b5 Replace trim_{left,right} with trim_{start,end} and co. (using Rerast) 2019-05-01 21:14:25 -07:00
Alex Lyon
c7d115b1ad Convert all try!() to ? 2019-05-01 21:14:25 -07:00
Alex Lyon
220e07dc95 Test on FreeBSD using Cirrus CI and link to the Discord in the README 2019-05-01 21:14:25 -07:00
Zachary Dremann
6fe687c84b Replace starts_with and slice with trim_left_matches 2019-04-30 21:02:29 -04:00
Zachary Dremann
34eceae2ef Don't allocate in signal_by_name_or_value 2019-04-29 21:53:14 -04:00
Zachary Dremann
8378c28242 Fix is_signal 2019-04-29 21:35:07 -04:00
Zachary Dremann
1ed8a016c1 Add tests for signals (including failing test for is_signal 2019-04-29 21:32:28 -04:00
Roy Ivy III
31655fc004 env: add support for new '--file' option (includes testing)
.# Discussion

This commit adds support for a '-f'/'--file' option which reads "KEY=VALUE" lines from
a config (or ini) style text file and sets the corresponding environment key. This is
modeled after the same option in the `dotenv` and `godotenv` commands. Notably, this
commit does *not* add automatic loading of ".env" configuration files.

The environment variables set by reading the configuration file are set prior to any
unset (eg, `-u BAR`) or set (eg, `FOO=bar`) actions. Files are loaded in order with
later files overwriting any overlapping environment variables, then, unset actions (in
command line order) are executed, then, finally, set actions (in command line order)
are executed.

[1] [`dotenv`](https://github.com/bkeepers/dotenv)
[2] [`godotenv`](https://github.com/joho/godotenv)
2019-04-29 09:50:22 -05:00
Roy Ivy III
9dc31cc1ce env: enhance support for windows commands (BAT/CMD, builtins)
.# Discussion

`env`/`uutils env` didn't support CMD built-in commands (dir, echo, erase, ...),
BAT/CMD files, nor the usual semantics for command search and execution via
PATHEXT (eg, it wouldn't find/execute `batch.BAT` when given just `batch`).

This patch executes the commands via a CMD subshell and fixes all of those issues.
2019-04-29 09:50:22 -05:00
Reto Habluetzel
905d01623d env: extend help for --null 2019-04-28 12:53:17 +02:00
Reto Habluetzel
2d2042c8fc env: reject program with --null, error stderr 2019-04-28 11:17:44 +02:00
Marcus Millin
7625878cd7 chown: change first file with --reference 2019-04-23 16:30:17 -05:00
Alex Lyon
01966e8aab
Merge pull request #1356 from Arcterus/echo-locked-stdout
echo: write using locked stdout
2019-04-08 15:57:02 -07:00
Alex Lyon
cefbe6c1f2
Merge pull request #1319 from rivy/fix.touch
fix ~ touch: fix and test for windows
2019-04-08 15:16:26 -07:00
Roy Ivy III
256a403caa touch: fix ~ use set_symlink_file_times() + remove unused code 2019-04-07 09:14:46 -05:00
Alex Lyon
42794e9f11 echo: write using locked stdout 2019-04-05 22:23:01 -07:00
Alex Lyon
23f6dbf2d3
Merge pull request #1306 from rinconjc/1235
tests: untrimmed stdout assertion (fix #1235)
2019-04-05 22:22:18 -07:00
Alex Lyon
dbc9527b00
Merge pull request #1336 from rinconjc/1321
Fix #1321 tsort handle self-loops
2019-04-05 19:15:23 -07:00
Alex Lyon
100f6df2bf
Merge pull request #1354 from ccbrown/rewrite-echo
echo: rewrite for readability and tests
2019-04-05 18:39:18 -07:00
Alex Lyon
5934666da3
Merge pull request #1338 from Arcterus/refactor-base32_64
base32, base64, uucore: merge base32/base64 code
2019-04-05 16:07:18 -07:00
Christopher Brown
1e223b0b58 echo: rewrite for readability and tests 2019-04-05 18:55:48 -04:00
Alex Lyon
94838dd54c
Merge pull request #1317 from rivy/fix.expr
fix ~ expr: update onig/onig_sys dependency (fixes windows compilation bug)
2019-04-03 16:03:26 -07:00
Alex Lyon
dd753e2c78
Merge pull request #1315 from rivy/fix.rm
fix ~ rm: fix dir-type symlink removal on windows
2019-04-03 15:53:00 -07:00
Alex Lyon
9817f297b7
Merge pull request #1304 from rivy/fix.cp
fix "`cp` always creates backup"
2019-04-03 15:51:18 -07:00
Alex Lyon
8d15f36977
Merge pull request #1305 from rivy/fix.mv
fix "`mv` fails transfers between dirs"
2019-04-03 15:50:32 -07:00
Roy Ivy III
e977e29d6a expr: fix ~ update onig/onig_sys dependency (fix windows compilation bugs)
* fixes compile bugs blocking compilation "onig_sys" (required for `expr`) on windows
  - MSVC/VS tools are no longer required to be prepped and available on the PATH (via
    `vsvarsall` or the "VCX command prompt")
  - GNU `gcc` compilation/targets are possible on windows
* restrict onig version to v4.3.2 (or later patches [only]; see discussion)

.# Discussion

onig v4.3.0/v4.3.1 inadvertently introduced a new minimum rust version (requiring
v1.31+; see https://github.com/rust-onig/rust-onig/issues/97). This was repaired with
v4.3.2 (requiring only v1.27.0+), and onig now specifies a rust minimum version that will
stay the same for patches, but may change between minor version increments.
2019-03-13 01:33:50 -05:00
Alex Lyon
f49395b1e8 base32, base64, uucore: merge base32/base64 code 2019-02-21 05:10:12 -08:00
Alex Lyon
39b5760f8e
Merge pull request #1307 from PaulCapron/master
Remove some useless BufReader wrappers around stdin
2019-02-21 04:26:32 -08:00
Julio Rincon
63bc9985e0 Fix #1321 tsort handle self-loops 2019-02-14 07:45:11 +11:00
Roy Ivy III
52c7f0aa34 mv: refactor try! to ? 2019-02-09 13:23:43 -06:00
Julio Rincon
29c6ad5f6a tests: untrimmed stdout assertion (fix #1235) 2019-02-08 07:54:48 +11:00
Roy Ivy III
41fb27e0a7 rm: fix dir-type symlink removal on windows 2019-02-07 08:30:51 -06:00
Roy Ivy III
1d64162218 cp: fix "cp always creates backup" 2019-02-07 08:22:41 -06:00
Roy Ivy III
fb1d844e14 mv: fix "mv fails transfers between dirs" 2019-02-07 08:19:22 -06:00
Roy Ivy III
556a96406c mv: improve error message 2019-02-07 08:19:22 -06:00
Roy Ivy III
e00d586af1 mv: fix failing tests 2019-02-07 08:19:22 -06:00
Alex Lyon
677953b2b6
Merge pull request #1314 from teresy/shorthand-fields
refactor: use shorthand fields
2019-02-07 00:41:00 -08:00
Alex Lyon
313ad332fa
Merge pull request #1290 from ArniDagur/ls-formatting
Change `ls -l -h` formatting to match GNU ls
2019-02-07 00:12:43 -08:00
Alex Lyon
8a7442d257
Merge pull request #1312 from E5ten/patch-3
Remove unused nlink
2019-02-07 00:08:46 -08:00
Alex Lyon
5a17daa963
Merge pull request #1281 from rivy/alt/win-cli-globbing
Add command line globbing to all utilities (for windows targets)
2019-02-06 23:21:53 -08:00
Rijnard van Tonder
436892269f refactor: use shorthand fields 2018-11-07 13:26:03 -05:00
E5ten
cc8899cb5b
Remove unused nlink
Now that --apparent-size does not use stat.nlink * stat.size, nlink is not used anywhere in du and can be removed from what I can see.
2018-10-30 10:49:08 -04:00
E5ten
13e57616b4
Fix --apparent-size on ext4 and MacOS
All credit goes to @JJJollyjim in this PR https://github.com/uutils/coreutils/pull/1294, but that PR needs to be rebased over master to be mergeable and hasn't been after multiple weeks.
2018-10-29 09:29:48 -04:00
Paul Capron
324cbad7a3 factor: Don’t wrap stdin in BufReader & use lock()
stdin() is already buffered.

Locking upfront explicitely avoid the overhead of mutex locking/unlocking
everytime a new line is read. See https://stackoverflow.com/a/17546731
and https://www.reddit.com/r/rust/comments/3rj54u/how_can_i_read_char_by_char_from_stdin/cwpojn1/

The code cannot be simplified to “for line in stdin().lock().lines()”
until non-lexical lifetimes are implemented. The compiler complains at
the moment about a temporary value not living long enough/being dropped
while still borrowed. See https://github.com/rust-lang/rust/issues/33520

This commit is related to issue #1103.
2018-10-24 15:21:05 +02:00
Paul Capron
bb9cc77858 Don’t wrap stdin in a BufReader when prompting
stdin() is already buffered.

stdin().read_line() calls stdin().lock() behind the hood (see
https://doc.rust-lang.org/src/std/io/stdio.rs.html#274)
Here we are reading user input, prompting them to confirm their action:
it seems useless to handle mutex locking/unlocking explicitely and
beforehand to avoid its overhead.

This commit is related to issue #1103.
2018-10-24 15:08:51 +02:00
Julio Rincon
4ac2de925d tee: handle '-' as filename (POSIX spec) fix #1278 2018-10-16 22:10:53 +11:00
Vinzent Steinberg
fe21c4b7fd Update to Rand 0.5 (#1288)
* factor: Update to Rand 0.5

* shuf: Update to Rand 0.5

* shred: Update to Rand 0.5

* mktemp: Update to Rand 0.5
2018-10-14 13:33:44 +04:00
cnd
1b1751d721
Merge pull request #1297 from E5ten/patch-1
Fix -b flag
2018-10-14 13:28:21 +04:00
Roy Ivy III
f56a7d30ba fix: remove unused parens 2018-10-14 00:41:14 -05:00
Roy Ivy III
c56f8f6807 fix: remove unused 'mut' 2018-10-14 00:41:14 -05:00
Roy Ivy III
16d39cafcc fix: remove unused imports 2018-10-14 00:41:14 -05:00
Roy Ivy III
197bd2e10c fix: gate unix-only macros (silences "unused" warnings) 2018-10-14 00:41:14 -05:00
Roy Ivy III
a66f7a7a53 fix: remove deprecated 'std::ascii::AsciiExt' 2018-10-14 00:41:14 -05:00
E5ten
9ff5d4f1f9
Update du.rs
Remove extra parentheses around 1
2018-10-09 21:35:13 -04:00
Alex Lyon
5008b4db2e
Merge pull request #1293 from JJJollyjim/master
numfmt: support neither or both of --to and --from
2018-10-09 18:06:49 -07:00
E5ten
4a0f3b31ab
Fix -b flag
Fixes #1295 , making -b act like `du --block-size=1 --apparent-size`, the reason it uses `stat.size` instead of `stat.nlink * stat.size` is explained in #1292 and the fix for that issue #1294 is mirrored by the use of `stat.size` here.
2018-09-30 22:24:01 -04:00
Ron Kuslak
b09ccaf6b1 Fix comparison of empty string to numeric f64 sort 2018-09-30 09:14:18 -05:00
Jamie McClymont
f3a71215bc numfmt: support neither or both of --to and --from
matches GNU behaviour
2018-09-25 01:42:11 +12:00
Marcus Millin
a19d6d9d7c hostid: remove old enum
Remove old arg parsing enum
2018-09-18 19:48:53 -05:00
Árni Dagur
3367d3d979
Switch to using rust-number-prefix from pretty-bytes 2018-09-18 22:16:34 +00:00
Árni Dagur
9207269791
Change 'ls -l -h' formatting to match GNU ls
Before:
-rw-r--r--  1 arni arni  2.02 kB 2018-09-14 21:07 CONTRIBUTING.md
-rw-r--r--  1 arni arni 78.75 kB 2018-09-14 23:41 Cargo.lock
-rw-r--r--  1 arni arni  6.92 kB 2018-09-14 21:07 Cargo.toml
-rw-r--r--  1 arni arni  1.05 kB 2018-09-14 21:07 LICENSE
-rw-r--r--  1 arni arni  5.98 kB 2018-09-14 21:07 Makefile
-rw-r--r--  1 arni arni 10.68 kB 2018-09-14 21:07 README.md
-rw-r--r--  1 arni arni  2.22 kB 2018-09-14 21:07 appveyor.yml
-rw-r--r--  1 arni arni   2.9 kB 2018-09-14 21:07 build.rs
-rw-r--r--  1 arni arni     15 B 2018-09-14 21:07 codecov.yml
drwxr-xr-x  2 arni arni   4.1 kB 2018-09-14 21:07 docs
-rw-r--r--  1 arni arni    973 B 2018-09-14 21:07 mkmain.rs
drwxr-xr-x 97 arni arni   4.1 kB 2018-09-14 21:07 src
drwxr-xr-x  3 arni arni   4.1 kB 2018-09-14 21:08 target
drwxr-xr-x  4 arni arni   4.1 kB 2018-09-14 21:07 tests
-rw-r--r--  1 arni arni     48 B 2018-09-14 21:07 uumain.rs

After:
-rw-r--r--  1 arni arni  2.02K 2018-09-14 21:07 CONTRIBUTING.md
-rw-r--r--  1 arni arni 78.68K 2018-09-16 20:39 Cargo.lock
-rw-r--r--  1 arni arni  6.92K 2018-09-14 21:07 Cargo.toml
-rw-r--r--  1 arni arni  1.05K 2018-09-14 21:07 LICENSE
-rw-r--r--  1 arni arni  5.98K 2018-09-14 21:07 Makefile
-rw-r--r--  1 arni arni 10.68K 2018-09-14 21:07 README.md
-rw-r--r--  1 arni arni  2.22K 2018-09-14 21:07 appveyor.yml
-rw-r--r--  1 arni arni   2.9K 2018-09-14 21:07 build.rs
-rw-r--r--  1 arni arni     15 2018-09-14 21:07 codecov.yml
drwxr-xr-x  2 arni arni   4.1K 2018-09-14 21:07 docs
-rw-r--r--  1 arni arni    973 2018-09-14 21:07 mkmain.rs
drwxr-xr-x 97 arni arni   4.1K 2018-09-14 21:07 src
drwxr-xr-x  3 arni arni   4.1K 2018-09-14 21:08 target
drwxr-xr-x  4 arni arni   4.1K 2018-09-14 21:07 tests
-rw-r--r--  1 arni arni     48 2018-09-14 21:07 uumain.rs
2018-09-16 20:42:11 +00:00
cnd
1f64d83d6f
Merge pull request #1284 from vks/clippy
Misc code clean up
2018-09-05 10:43:51 +04:00
cnd
35b1e47a63
Merge pull request #1285 from arsdragonfly/master
numfmt: add suffixes and fix negative numbers
2018-09-05 10:39:26 +04:00
Zheyu Shen
1af0484360 numfmt: add suffixes and fix negative numbers
Also refactors the code.
2018-09-04 18:27:21 -04:00
Vinzent Steinberg
bc78bcac7d Remove utf8 feature
All code it provides can be implemented with `std`.
2018-09-04 14:49:27 +02:00
Vinzent Steinberg
e46e3594d2 Fix more clippy warnings and remove redundant 'static 2018-09-04 14:33:36 +02:00
xplorld
47f5f12759 sort: treat "NaN" as string in numeric sort 2018-09-03 22:28:18 -07:00
Vinzent Steinberg
4034a322a2 Fix a few clippy warnings 2018-09-03 19:08:23 +02:00
Roy Ivy III
289c052600 uucore: fix: use updated 'wild' crate for globbing 2018-09-03 11:30:34 -05:00
Roy Ivy III
8684a148ca uucore: fix: use forked 'wild' crate with case-sensitivity + API fixes 2018-08-28 20:49:03 -05:00
Roy Ivy III
0af7fbbf3b uucore: Add globbing for Windows machines 2018-08-05 21:37:35 -05:00
Simon Vandel Sillesen
e30237a714 uniq: avoid allocations for the iterator 2018-07-24 10:53:09 +02:00
Simon Vandel Sillesen
781c9236e1 uniq: add more fast-paths to avoid work 2018-07-24 10:52:39 +02:00
Simon Vandel Sillesen
3288fa2cd2 uniq: avoid a upper-case map if we don't need to 2018-07-24 10:52:39 +02:00
Simon Vandel Sillesen
f233d8e5d7 uniq: avoid copying Strings all the time 2018-07-24 10:52:39 +02:00
Simon Vandel Sillesen
d624dbcfa0 uniq: do not allocate a new string in skip_fields
Instead, reuse the existing line and just view into that.
2018-07-24 10:48:52 +02:00
Simon Vandel Sillesen
caaea84097 uniq: refactor delimiters strings into enums 2018-07-11 23:16:42 +02:00
dependabot[bot]
19aea56351
Bump clippy from 0.0.211 to 0.0.212
Bumps [clippy](https://github.com/rust-lang-nursery/rust-clippy) from 0.0.211 to 0.0.212.
- [Release notes](https://github.com/rust-lang-nursery/rust-clippy/releases)
- [Changelog](https://github.com/rust-lang-nursery/rust-clippy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang-nursery/rust-clippy/compare/v0.0.211...v0.0.212)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-11 07:15:40 +00:00
Alex Lyon
6882558280
Merge pull request #1254 from bootandy/master
Fix expr
2018-07-10 21:42:28 -07:00
Alex Lyon
65d3812311
Merge pull request #1262 from uutils/dependabot/cargo/cpp_build-0.4.0
Bump cpp_build from 0.3.2 to 0.4.0
2018-07-10 21:40:50 -07:00
Alex Lyon
e528c38ac8
Merge pull request #1261 from uutils/dependabot/cargo/getopts-0.2.18
Bump getopts from 0.2.17 to 0.2.18
2018-07-10 21:40:38 -07:00
dependabot[bot]
20a236e39b
Bump cpp_build from 0.3.2 to 0.4.0
Bumps [cpp_build](https://github.com/mystor/rust-cpp) from 0.3.2 to 0.4.0.
- [Release notes](https://github.com/mystor/rust-cpp/releases)
- [Commits](https://github.com/mystor/rust-cpp/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-11 01:16:49 +00:00
dependabot[bot]
0b870c065f
Bump cpp from 0.3.2 to 0.4.0
Bumps [cpp](https://github.com/mystor/rust-cpp) from 0.3.2 to 0.4.0.
- [Release notes](https://github.com/mystor/rust-cpp/releases)
- [Commits](https://github.com/mystor/rust-cpp/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-09 07:50:33 +00:00
bootandy
4756eb5c19 Fix expr
expr now detects overflows and logs to stderr instead of overflowing the
input
https://github.com/uutils/coreutils/issues/1194
2018-07-08 21:24:25 +01:00
dependabot[bot]
2c796811ca
Bump getopts from 0.2.17 to 0.2.18
Bumps [getopts](https://github.com/rust-lang/getopts) from 0.2.17 to 0.2.18.
- [Release notes](https://github.com/rust-lang/getopts/releases)
- [Commits](https://github.com/rust-lang/getopts/compare/0.2.17...v0.2.18)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-06 07:17:46 +00:00
dependabot[bot]
e7d8f6b2d7
Bump clippy from 0.0.209 to 0.0.211
Bumps [clippy](https://github.com/rust-lang-nursery/rust-clippy) from 0.0.209 to 0.0.211.
- [Release notes](https://github.com/rust-lang-nursery/rust-clippy/releases)
- [Changelog](https://github.com/rust-lang-nursery/rust-clippy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang-nursery/rust-clippy/compare/v0.0.209...v0.0.211)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-01 19:17:17 +00:00
Alex Lyon
19253a066f
Merge pull request #1257 from uutils/dependabot/cargo/clap-2.32.0
Bump clap from 2.31.2 to 2.32.0
2018-07-01 12:13:52 -07:00
dependabot[bot]
bd556d9ae2
Bump aho-corasick from 0.6.4 to 0.6.5
Bumps [aho-corasick](https://github.com/BurntSushi/aho-corasick) from 0.6.4 to 0.6.5.
- [Release notes](https://github.com/BurntSushi/aho-corasick/releases)
- [Commits](https://github.com/BurntSushi/aho-corasick/compare/0.6.4...0.6.5)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-28 07:26:13 +00:00
dependabot[bot]
9883d82785
Bump clap from 2.31.2 to 2.32.0
Bumps [clap](https://github.com/kbknapp/clap-rs) from 2.31.2 to 2.32.0.
- [Release notes](https://github.com/kbknapp/clap-rs/releases)
- [Changelog](https://github.com/kbknapp/clap-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kbknapp/clap-rs/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-27 07:27:24 +00:00
Alex Lyon
d5e6259b4c
Merge pull request #1246 from uutils/dependabot/cargo/regex-1.0.1
Bump regex from 1.0.0 to 1.0.1
2018-06-25 09:24:46 -07:00
Alex Lyon
8c366cd4ea
Merge pull request #1251 from uutils/dependabot/cargo/half-1.1.1
Bump half from 1.1.0 to 1.1.1
2018-06-25 09:24:32 -07:00
dependabot[bot]
1ffebd1054
Bump chrono from 0.4.3 to 0.4.4
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.3 to 0.4.4.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/master/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.3...v0.4.4)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-25 07:25:17 +00:00
dependabot[bot]
1c38d5f97f
Bump half from 1.1.0 to 1.1.1
Bumps [half](https://github.com/starkat99/half-rs) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/starkat99/half-rs/releases)
- [Changelog](https://github.com/starkat99/half-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/starkat99/half-rs/compare/v1.1.0...v1.1.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-25 07:25:13 +00:00
dependabot[bot]
3e907e2a10
Bump regex from 1.0.0 to 1.0.1
Bumps [regex](https://github.com/rust-lang/regex) from 1.0.0 to 1.0.1.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.0.0...1.0.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-20 15:39:26 +00:00
dependabot[bot]
378292cdbd
Bump clippy from 0.0.208 to 0.0.209
Bumps [clippy](https://github.com/rust-lang-nursery/rust-clippy) from 0.0.208 to 0.0.209.
- [Release notes](https://github.com/rust-lang-nursery/rust-clippy/releases)
- [Changelog](https://github.com/rust-lang-nursery/rust-clippy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang-nursery/rust-clippy/compare/v0.0.208...v0.0.209)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-20 07:19:23 +00:00
dependabot[bot]
0cd807c404
Bump clippy from 0.0.207 to 0.0.208
Bumps [clippy](https://github.com/rust-lang-nursery/rust-clippy) from 0.0.207 to 0.0.208.
- [Release notes](https://github.com/rust-lang-nursery/rust-clippy/releases)
- [Changelog](https://github.com/rust-lang-nursery/rust-clippy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang-nursery/rust-clippy/compare/v0.0.207...v0.0.208)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-19 07:25:24 +00:00
Alex Lyon
5d22ae2af3
Merge pull request #1242 from TheGoddessInari/windows
uutils: Replace file_name with file_stem in symlink applet detection.
2018-06-18 08:53:30 -07:00
dependabot[bot]
c3423cdeff
Bump chrono from 0.4.0 to 0.4.3
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.0 to 0.4.3.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/master/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.0...v0.4.3)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-18 07:40:46 +00:00
TheGoddessInari
7cc0f1337c uutils: Replace file_name with file_stem in symlink applet detection.
This can get confused on Windows with powershell, where it passes .exe
for symlinks.
2018-06-17 23:07:28 -07:00
Alex Lyon
f0859c8094
Merge pull request #1239 from uutils/dependabot/cargo/unicode-width-0.1.5
Bump unicode-width from 0.1.4 to 0.1.5
2018-06-15 09:19:39 -07:00
Alex Lyon
cbc02b8a1a
Merge pull request #1238 from uutils/dependabot/cargo/clippy-0.0.207
Bump clippy from 0.0.206 to 0.0.207
2018-06-15 09:18:36 -07:00
Alex Lyon
5bea2624df
Merge pull request #1237 from uutils/dependabot/cargo/regex-1.0.0
Bump regex from 0.2.7 to 1.0.0
2018-06-15 09:18:15 -07:00
dependabot[bot]
f007268c9c
Bump unicode-width from 0.1.4 to 0.1.5
Bumps [unicode-width](https://github.com/unicode-rs/unicode-width) from 0.1.4 to 0.1.5.
- [Release notes](https://github.com/unicode-rs/unicode-width/releases)
- [Commits](https://github.com/unicode-rs/unicode-width/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-15 07:24:50 +00:00
dependabot[bot]
d5838b93dc
Bump clippy from 0.0.206 to 0.0.207
Bumps [clippy](https://github.com/rust-lang-nursery/rust-clippy) from 0.0.206 to 0.0.207.
- [Release notes](https://github.com/rust-lang-nursery/rust-clippy/releases)
- [Changelog](https://github.com/rust-lang-nursery/rust-clippy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang-nursery/rust-clippy/compare/v0.0.206...v0.0.207)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-15 07:24:45 +00:00
dependabot[bot]
be615fb7df
Bump regex from 0.2.7 to 1.0.0
Bumps [regex](https://github.com/rust-lang/regex) from 0.2.7 to 1.0.0.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/0.2.7...1.0.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-15 07:24:38 +00:00
dependabot[bot]
8ec1060de9
Bump itertools from 0.6.5 to 0.7.8
Bumps [itertools](https://github.com/bluss/rust-itertools) from 0.6.5 to 0.7.8.
- [Release notes](https://github.com/bluss/rust-itertools/releases)
- [Commits](https://github.com/bluss/rust-itertools/compare/0.6.5...0.7.8)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-15 07:24:33 +00:00
Alex Lyon
aab9a8a028
Merge pull request #1216 from uutils/dependabot/cargo/bit-set-0.5.0
Bump bit-set from 0.4.0 to 0.5.0
2018-06-14 17:34:48 -07:00
Alex Lyon
fe51245f54
Merge pull request #1232 from uutils/dependabot/cargo/regex-syntax-0.6.1
Bump regex-syntax from 0.6.0 to 0.6.1
2018-06-14 09:30:15 -07:00
dependabot[bot]
4a4877264c
Bump time from 0.1.39 to 0.1.40
Bumps [time](https://github.com/rust-lang/time) from 0.1.39 to 0.1.40.
- [Release notes](https://github.com/rust-lang/time/releases)
- [Commits](https://github.com/rust-lang/time/compare/0.1.39...0.1.40)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-14 07:22:03 +00:00
dependabot[bot]
ede1aa9ece
Bump regex-syntax from 0.6.0 to 0.6.1
Bumps [regex-syntax](https://github.com/rust-lang/regex) from 0.6.0 to 0.6.1.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/regex-syntax-0.6.0...regex-syntax-0.6.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-14 07:21:55 +00:00
dependabot[bot]
374fb4d4f1
Bump filetime from 0.1.15 to 0.2.1
Bumps [filetime](https://github.com/alexcrichton/filetime) from 0.1.15 to 0.2.1.
- [Release notes](https://github.com/alexcrichton/filetime/releases)
- [Commits](https://github.com/alexcrichton/filetime/compare/0.1.15...0.2.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-13 14:15:48 -07:00
dependabot[bot]
07cd07932d
Bump remove_dir_all from 0.2.0 to 0.5.1
Bumps [remove_dir_all](https://github.com/Aaronepower/remove_dir_all) from 0.2.0 to 0.3.0.
- [Release notes](https://github.com/Aaronepower/remove_dir_all/releases)
- [Changelog](https://github.com/Aaronepower/remove_dir_all/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Aaronepower/remove_dir_all/commits/v0.3.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-13 11:14:38 -07:00
Alex Lyon
bb27d74021
Merge pull request #1223 from uutils/dependabot/cargo/semver-0.9.0
Bump semver from 0.7.0 to 0.9.0
2018-06-13 07:04:37 -07:00
dependabot[bot]
2e22cbae9a
Bump quick-error from 1.2.1 to 1.2.2
Bumps [quick-error](https://github.com/tailhook/quick-error) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/tailhook/quick-error/releases)
- [Commits](https://github.com/tailhook/quick-error/compare/v1.2.1...v1.2.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-13 03:25:46 +00:00
dependabot[bot]
34aeb45d22
Bump semver from 0.7.0 to 0.9.0
Bumps [semver](https://github.com/steveklabnik/semver) from 0.7.0 to 0.9.0.
- [Release notes](https://github.com/steveklabnik/semver/releases)
- [Commits](https://github.com/steveklabnik/semver/compare/v0.7.0...v0.9.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-13 03:25:03 +00:00
Alex Lyon
443f600066
Merge pull request #1228 from uutils/dependabot/cargo/walkdir-2.1.4
Bump walkdir from 1.0.7 to 2.1.4
2018-06-12 20:22:54 -07:00
dependabot[bot]
c985387f5f
Bump walkdir from 1.0.7 to 2.1.4
Bumps [walkdir](https://github.com/BurntSushi/walkdir) from 1.0.7 to 2.1.4.
- [Release notes](https://github.com/BurntSushi/walkdir/releases)
- [Commits](https://github.com/BurntSushi/walkdir/compare/1.0.7...2.1.4)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-12 23:59:05 +00:00
Alex Lyon
f710d96edb
Merge pull request #1222 from uutils/dependabot/cargo/tempdir-0.3.7
Bump tempdir from 0.3.6 to 0.3.7
2018-06-12 16:58:52 -07:00
Alex Lyon
eedfc3ef57
Merge pull request #1219 from kupospelov/master
join: implement option to suppress joined lines
2018-06-12 09:50:06 -07:00
dependabot[bot]
be6754b7a8
Bump tempdir from 0.3.6 to 0.3.7
Bumps [tempdir](https://github.com/rust-lang/tempdir) from 0.3.6 to 0.3.7.
- [Release notes](https://github.com/rust-lang/tempdir/releases)
- [Commits](https://github.com/rust-lang/tempdir/compare/v0.3.6...v0.3.7)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-12 16:41:14 +00:00
Alex Lyon
f7d5858bdb
Merge pull request #1225 from uutils/dependabot/cargo/half-1.1.0
Bump half from 1.0.2 to 1.1.0
2018-06-12 09:38:55 -07:00
dependabot[bot]
9327f957bd
Bump rand from 0.3.22 to 0.4.2
Bumps [rand](https://github.com/rust-lang-nursery/rand) from 0.3.22 to 0.4.2.
- [Release notes](https://github.com/rust-lang-nursery/rand/releases)
- [Changelog](https://github.com/rust-lang-nursery/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang-nursery/rand/compare/0.3.22...0.4.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-12 07:26:39 +00:00
dependabot[bot]
485507be2b
Bump half from 1.0.2 to 1.1.0
Bumps [half](https://github.com/starkat99/half-rs) from 1.0.2 to 1.1.0.
- [Release notes](https://github.com/starkat99/half-rs/releases)
- [Changelog](https://github.com/starkat99/half-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/starkat99/half-rs/compare/v1.0.2...v1.1.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-12 07:26:12 +00:00
dependabot[bot]
fce51cec0b
Bump bit-set from 0.4.0 to 0.5.0
Bumps [bit-set](https://github.com/contain-rs/bit-set) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/contain-rs/bit-set/releases)
- [Commits](https://github.com/contain-rs/bit-set/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-11 19:57:56 +00:00
dependabot[bot]
3eea5703bf
Bump regex-syntax from 0.5.0 to 0.6.0
Bumps [regex-syntax](https://github.com/rust-lang/regex) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/regex-syntax-0.5.0...regex-syntax-0.6.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-11 17:51:25 +00:00
dependabot[bot]
c66dd59489
Bump libc from 0.2.39 to 0.2.42
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.39 to 0.2.42.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.39...0.2.42)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-11 17:13:54 +00:00
Konstantin Pospelov
e9fd9d623d join: implement option to suppress joined lines 2018-06-09 12:11:58 +03:00
Alex Lyon
2b063dd363
Merge pull request #1215 from uutils/dependabot/cargo/sha1-0.6.0
Bump sha1 from 0.2.0 to 0.6.0
2018-06-08 15:06:13 -07:00
dependabot[bot]
92727d3301
Bump sha1 from 0.2.0 to 0.6.0
Bumps [sha1](https://github.com/mitsuhiko/rust-sha1) from 0.2.0 to 0.6.0.
- [Release notes](https://github.com/mitsuhiko/rust-sha1/releases)
- [Commits](https://github.com/mitsuhiko/rust-sha1/compare/0.2.0...0.6.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-08 07:30:51 +00:00
dependabot[bot]
d1c18c01e9
Bump lazy_static from 1.0.0 to 1.0.1
Bumps [lazy_static](https://github.com/rust-lang-nursery/lazy-static.rs) from 1.0.0 to 1.0.1.
- [Release notes](https://github.com/rust-lang-nursery/lazy-static.rs/releases)
- [Commits](https://github.com/rust-lang-nursery/lazy-static.rs/commits/v1.0.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-08 07:30:48 +00:00
Alex Lyon
9b28029982
Merge pull request #1211 from uutils/dependabot/cargo/lazy_static-1.0.0
Bump lazy_static from 0.2.11 to 1.0.0
2018-06-07 09:08:24 -07:00
Alex Lyon
13aa3ede94
Merge pull request #1207 from uutils/dependabot/cargo/clippy-0.0.206
Bump clippy from 0.0.143 to 0.0.206
2018-06-07 08:45:23 -07:00
Alex Lyon
c814445c38
Merge pull request #1204 from uutils/dependabot/cargo/regex-syntax-0.5.0
Bump regex-syntax from 0.4.2 to 0.5.0
2018-06-07 08:44:07 -07:00
dependabot[bot]
c7fa56442a
Bump clippy from 0.0.143 to 0.0.206
Bumps [clippy](https://github.com/rust-lang-nursery/rust-clippy) from 0.0.143 to 0.0.206.
- [Release notes](https://github.com/rust-lang-nursery/rust-clippy/releases)
- [Changelog](https://github.com/rust-lang-nursery/rust-clippy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang-nursery/rust-clippy/compare/v0.0.143...v0.0.206)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-07 15:41:42 +00:00
dependabot[bot]
5b5aaa03c9
Bump lazy_static from 0.2.11 to 1.0.0
Bumps [lazy_static](https://github.com/rust-lang-nursery/lazy-static.rs) from 0.2.11 to 1.0.0.
- [Release notes](https://github.com/rust-lang-nursery/lazy-static.rs/releases)
- [Commits](https://github.com/rust-lang-nursery/lazy-static.rs/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-07 07:25:48 +00:00
dependabot[bot]
d2aa1e30d2
Bump regex-syntax from 0.4.2 to 0.5.0
Bumps [regex-syntax](https://github.com/rust-lang/regex) from 0.4.2 to 0.5.0.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/regex-syntax-0.4.2...regex-syntax-0.5.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-07 01:34:32 +00:00
dependabot[bot]
516ee396de
Bump clap from 2.31.1 to 2.31.2
Bumps [clap](https://github.com/kbknapp/clap-rs) from 2.31.1 to 2.31.2.
- [Release notes](https://github.com/kbknapp/clap-rs/releases)
- [Changelog](https://github.com/kbknapp/clap-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kbknapp/clap-rs/commits/v2.31.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-06-07 01:34:24 +00:00
Alex Lyon
f25d4e1114
uucore: update data_encoding and add wrap_write() 2018-05-22 09:55:05 -07:00
Alex Lyon
4d89c2d796
Merge pull request #1197 from c-edw/master
mkdir: Silently fail in recursive mode if unable to create directories.
2018-05-03 02:12:24 -07:00
Connor E
62632faa63 Clean up with changes from Arcterus. 2018-05-03 08:40:01 +01:00
Alex Lyon
974f5def20 uptime: error when uptime cannot be found 2018-05-02 19:11:37 -07:00
Alex Lyon
f91c84bc05
Merge pull request #1191 from ProgVal/chmod-human-friendly
chmod, ls, uucore: Make chmod display human-friendly permissions
2018-05-02 15:36:35 -07:00
Valentin Lorentz
43aafd2f1c chmod: show human-friendly permissions when --changes or --verbose is used.
Like GNU chmod.
2018-05-02 23:23:05 +02:00
Alex Lyon
c50e7b5bc4
Merge pull request #1189 from ProgVal/unlink-nul-terminator
unlink: Add a nul-terminator after the file name before calling lstat.
2018-05-02 11:45:32 -07:00
Valentin Lorentz
f06972ccfd unlink: Use a NUL-terminated string when calling unlink(). 2018-05-02 19:13:36 +02:00
Alex Lyon
2eaabae507
Merge pull request #1192 from ProgVal/chmod-unimplemented
chmod: Remove '(unimplemented)' from the opt help.
2018-05-02 08:50:23 -07:00
Connor E
9d5631228a mkdir: Use std create_dir_all for recursive operations. 2018-05-01 12:42:11 +01:00
Connor E
e03ab6b554 mkdir: Silently fail in recursive mode if unable to create directories. 2018-05-01 12:07:23 +01:00
Valentin Lorentz
4ba6f13c2b chmod: Remove '(unimplemented)' from the opt help.
They are implemented now.
2018-04-22 21:38:30 +02:00
Alex Jiang
58b4075566 hostname: bug fix for non-windows xgethostname and add test case
Cstr::from_bytes_with_nul needs input bytes null terminated. Current
version does not include the last null byte, hence
Cstr::from_bytes_with_nul will panic with error 'FromBytesWithNulError {
kind: NotNulTerminated }'
2018-04-22 21:04:51 +08:00
Valentin Lorentz
dd0d23839a unlink: Add a nul-terminator after the file name before calling lstat. 2018-04-22 10:32:43 +02:00
Alex Lyon
b50aaf6456
du: pick format for convert_size() once and reverse UNITS (again) 2018-04-20 03:56:47 -07:00
Alex Lyon
da301be35c
du: capitalize input block size (e.g. turn 'kB' into 'KB') 2018-04-20 01:26:29 -07:00
Alex Lyon
b619e363db
du: clean up block size parsing code 2018-04-20 00:54:49 -07:00
Alex Lyon
8498e33099
Merge pull request #1176 from bootandy/du_input_refactor3
du: read block size environment variables
2018-04-20 00:23:53 -07:00
Konstantin Pospelov
4b8d4bfc05 join: fix autoformat
There was an issue with autoformat when the files had a different
number of columns in the first line. This commit fixes the issue and
extends the related test to cover this case.
2018-04-15 17:42:52 +03:00
Konstantin Pospelov
cd98478ce9 join: minor improvements
Move the code to get the current key into a separate function.
Replace two 'combine' functions with one defined for Input.
2018-04-15 17:33:02 +03:00
Konstantin Pospelov
7dc8ff62cc join: support headers 2018-04-11 22:55:44 +03:00
Michael Aaron Murphy
dddc773200 [ls] Add "-1" Flag & Fix Needless Vec 2018-04-10 22:13:21 -04:00
bootandy
f1497e43ce du: read block size environment variables
blocksize env variables are read if -B is not specified as a command
line argument.
blocksize is now case insensitive (like gdu).

fn translate_to_pure_number() pulled out from existing code which
populated the block size variable
2018-04-06 21:30:59 +01:00
Alex Lyon
8db47690b2
Merge pull request #1171 from bootandy/du_h
du -h: support GB
2018-04-05 15:41:33 -07:00
bootandy
0840c20ef4 du: support G T P E on -h
Allow -h (human readable form) to show sizes larger than MB
(This mimics original du behaviour)

Code refactored to remove duplication
2018-04-03 06:58:38 -04:00
Alex Lyon
87d317e22f
Merge pull request #1169 from bootandy/du
Fix Du mac/inodes
2018-03-28 10:33:06 -07:00
bootandy
838ce7b3e3 Fix issues raised in review
spelling
use POSIXLY_CORRECT and BLOCKSIZE env variables to determine block size.
move statics to const
use show_error! not show_info!
2018-03-24 18:03:34 -04:00
Alex Lyon
948dbd324e yes: choose between throughput and latency at compile-time 2018-03-22 04:22:34 -07:00
Alex Lyon
4941604362 yes: use 16 KiB rather than 8 KiB for the buffer 2018-03-22 03:31:41 -07:00
bootandy
b6c7771087 du: Fix double counting of hard links.
hard linked files are no longer counted - this mimcs the behaviour of
the original du.
2018-03-20 16:59:29 -04:00
bootandy
e253406026 du: Fix incorrect block size assumption.
du and other tools like stat assume a 512 byte block. ls is the only
tool to use 1024.

Add Simple set of tests
2018-03-20 16:59:29 -04:00
Ian Douglas Scott
fa867e93ea
Port 'tail' to Redox 2018-03-18 22:00:00 -07:00
Ian Douglas Scott
f76b23e3df
Port 'more' to Redox 2018-03-18 18:55:42 -07:00
Ian Douglas Scott
727d4843b8
Change static to const 2018-03-16 20:14:50 -07:00
Ian Douglas Scott
187006f0d3
test: handle symlinks in main match 2018-03-16 18:47:11 -07:00
Ian Douglas Scott
301b9002ce
Port test to Redox 2018-03-16 18:39:53 -07:00
Alex Lyon
3015a19230
Merge pull request #1157 from bootandy/master
Fix edge case for du on mac
2018-03-15 12:26:42 -07:00
bootandy
8f67c8fef2 du: refactor to use ? shortcut 2018-03-15 14:58:21 -04:00
Ian Douglas Scott
6f4b91db93
Build hashsum, join, ln, ls, mkdir, mktemp, nl, ptx, sort on Redox 2018-03-14 22:10:28 -07:00
bootandy
be79a70572 Refactor Stat::new to return Result
This was to remove the double call to fs::symlink_metadata
2018-03-14 16:26:22 -04:00
Ian Douglas Scott
1471e95b22
Make the 'cat' utility build on Redox 2018-03-14 10:21:12 -07:00
bootandy
f0e25e5537 Fix edgecase for du on mac
When du encounters a file that cannot be read it logs an error and
continues to analysise the rest of the directory. This behaviour brings
it inline with the original du.
2018-03-13 16:05:34 -04:00
Alex Lyon
f359507b58 yes: match the speed of GNU yes (on my machine) and remove allocs 2018-03-12 21:14:52 -07:00
Alex Lyon
bd557c87fb uucore: make features opt-in rather than opt-out 2018-03-12 20:21:38 -07:00
Alex Lyon
7b1554cc2c whoami: switch to clap 2018-03-12 19:28:32 -07:00
Alex Lyon
155fea53b2 yes: switch to clap and try to decrease allocs 2018-03-12 16:27:21 -07:00
Alex Lyon
880a4973c1 Format everything using rustfmt 2018-03-12 01:20:58 -07:00
Alex Lyon
00a8b0b0f1 uucore: remove utsname.rs (and replace with platform-info) 2018-03-11 18:50:36 -07:00
Alex Lyon
0b70b151b8 hostname: refactor a bit 2018-03-07 03:34:04 -08:00
Alex Lyon
6330474b4f hostname: add support for Windows (and maybe other systems too) 2018-03-06 16:40:08 -08:00
Alex Lyon
15aaa8215e uucore: read from sys:uname on Redox 2018-03-05 17:31:33 -08:00
Alex Lyon
8ba5fae6e3 cp, tail: update winapi 2018-03-04 18:38:33 -08:00
Alex Lyon
2d798bd601 expr, sync, whoami: update Oniguruma and winapi 2018-03-04 18:07:38 -08:00
Alex Lyon
5d241da7ca arch: add support for building on Windows 2018-03-04 17:58:16 -08:00
Alex Lyon
d8e738c49b tests: disable some chgrp tests when part of the root group
Some tests failed when run using Docker because they assumed the
user would never be root.  This is more of a band-aid solution.
An actual fix would be to test see if something like these tests
were to succeed when the user is root.
2018-03-03 12:04:22 -08:00
Alex Lyon
8ece01d0ef
who: fix heading in containers 2018-03-01 22:20:23 -08:00
Konstantin Pospelov
642633fe3b join: check line order 2018-02-11 18:23:12 +03:00
king6cong
e3fedddd17 remove nightly complier warnings 2018-02-09 19:49:57 +08:00
mpkh
37f3e3a151
Merge pull request #1137 from Arcterus/realpath-relpath-fix
realpath, relpath: fix on stable and beta (whoops)
2018-01-18 10:36:41 +04:00
Alex Lyon
91b7ae44d6 realpath, relpath: fix on stable and beta (whoops) 2018-01-17 15:35:42 -08:00
Konstantin Pospelov
186cb8853f join: fix code formatting 2018-01-17 23:26:00 +03:00
Konstantin Pospelov
128a38965e join: support custom empty filler 2018-01-17 23:26:00 +03:00
mpkh
2db220e820
Merge pull request #1136 from Arcterus/realpath-relpath-fix
Fix build on nightly
2018-01-17 12:12:02 +04:00
James McCoy
c82e94cae5
stat: Remove hard-coded path for mount information 2018-01-16 20:48:03 -05:00
James McCoy
81eef5dabf
stat: Avoid parsing mount info when showing filesystem info 2018-01-16 20:47:52 -05:00
Alex Lyon
e9f32fe170 realpath, relpath, tests: fix build on nightly 2018-01-16 15:11:46 -08:00
Bulat Musin
cc66229f16 add #[allow(unused_imports)] to std::ascii::AsciiExt
explicit import of std::ascii::AsciiExt is deprecated since 1.23
2018-01-08 11:32:38 +03:00
Konstantin Pospelov
12c5c951fb join: implement the -o option 2018-01-06 22:49:07 +03:00
Alex Lyon
49cf7c2a5b
Merge pull request #1127 from bltnkl/echo_refine
Slight improvements to echo
2018-01-06 10:38:46 -08:00
Bulat Musin
ec543508bc echo: refactor slightly 2018-01-06 17:05:04 +03:00
Bulat Musin
26ad240572 echo: reorder of match patterns
People write \n \t and \r \v much more
often than other escape sequences, so
it makes more sense to optimise for common
case, as match scans from top to bottom.
2018-01-06 17:01:50 +03:00
Bulat Musin
7ebda2de44 echo: rewrite two functions as closures 2018-01-06 17:01:24 +03:00
Bulat Musin
6afddc4d6a tail: squashed two commits
commit ceaeb5ec2a284555e6c061070c74b050efb129f0
Author: Bulat Musin <bulatmusin@outlook.com>
Date:   Thu Jan 4 11:01:29 2018 +0300

    tail: fix typo

commit 50e3568e460c7ec9786835c9795d1496a2463901
Author: Bulat Musin <bulatmusin@outlook.com>
Date:   Thu Jan 4 10:54:17 2018 +0300

    collapse similar changes into one commit

    commit a54df8d92d534b801b364c2e74635dfe282441d8
    Author: Bulat Musin <bulatmusin@outlook.com>
    Date:   Wed Jan 3 21:05:33 2018 +0300

        tail: add --silent option

    commit 5c9aec7e5bb5ff79f1421e5b33bf82809795bc64
    Author: Bulat Musin <bulatmusin@outlook.com>
    Date:   Wed Jan 3 20:43:36 2018 +0300

        tail: add spaces after hashes
2018-01-06 16:49:23 +03:00
Alex Lyon
3eee1b9ad6
Merge pull request #1074 from Heather/pwd_lp
pwd: add support for -L and -P options
2017-12-30 23:53:01 -08:00
Alex Lyon
ffc3c1d262
Merge pull request #1087 from ProgVal/faster-yes
Make 'yes' 1000 times faster.
2017-12-30 23:40:20 -08:00
Alex Lyon
cf7582cbd2
stdbuf: make build more reliable and allow installation using Cargo 2017-12-29 23:25:51 -08:00
Alex Lyon
feaae12d0a
cp: lock winapi to 0.2 for now 2017-12-29 03:31:13 -08:00
Alex Lyon
4deef05880
stdbuf: fix build warning 2017-12-28 22:12:44 -08:00
Alex Lyon
8ed383941d
Add Sphinx documentation to generate man pages 2017-12-28 22:02:58 -08:00
Alex Lyon
6d61b6805d
Merge pull request #1113 from tsliang/master
uname: change sysname flag to kernel-name
2017-12-27 03:23:40 -08:00
Tai Sassen-Liang
e79f5277ed uname: add missing paren 2017-12-27 11:57:06 +01:00
Tai Sassen-Liang
5d4e404765 uname: convert to clap; support obsolete option aliases 2017-12-27 11:29:06 +01:00
Alex Lyon
bc6d748a9e
Merge pull request #1119 from KeenS/install-ignore--c
install: ignore -c option for compatibility
2017-12-27 02:29:04 -08:00
Tai Sassen-Liang
c210d8d8c9 uname: change sysname flag to kernel-name
The --sysname flag in GNU uname was deprecated in 2002 and replaced by --kernel-name.
2017-12-27 11:24:29 +01:00
Sunrin SHIMURA (keen)
956a6aa1fb install: ignore -c option for compatibility 2017-12-27 17:52:53 +09:00
Sunrin SHIMURA (keen)
ee34206520 install: allow to install a file to a file 2017-12-27 17:31:19 +09:00
Alex Lyon
a1cf262414 rm: exit normally when -f is used with no operand 2017-12-26 15:36:21 -08:00
Konstantin Pospelov
4e0a0cf7bb join: implement the -t option 2017-12-24 16:22:48 +03:00
Konstantin Pospelov
743a5b68ed join: simplify closure for line parsing 2017-12-18 10:40:15 +03:00
Konstantin Pospelov
2a6d550f4b join: switch to clap 2017-12-17 16:36:46 +03:00
Konstantin Pospelov
d28e09de04 join: do not wrap stdin in BufReader 2017-12-16 19:26:25 +03:00
Konstantin Pospelov
3aa63ad9dd join: minor review points 2017-12-16 16:11:39 +03:00
Konstantin Pospelov
a04a77a477 join: switch to auto-generated main.rs 2017-12-16 16:09:46 +03:00
Konstantin Pospelov
b33ce67d91 join: implement basic functionality
The basic implementation of join with some tests. The supported
options: -1, -2, -j, -a, -i.
2017-12-14 00:02:42 +03:00
Cynede
908eaf610e
pwd: drop unused import 2017-12-11 14:50:56 +04:00
Cynede
6ef16b9221
pwd: fixes for UNC paths on Windows, match instead of plain unwrap 2017-12-11 14:49:20 +04:00
Mikhail Pukhlikov
f8e24439c9 pwd: add support for -L and -P options 2017-12-11 14:11:42 +04:00
Alex Lyon
26d6742c11
mknod, stdbuf: fix build 2017-12-11 00:27:38 -08:00
Alex Lyon
2e7f969404
chmod, install, uucore: fix build on Windows 2017-12-10 21:21:24 -08:00
Alex Lyon
479aeed9f6
mknod: use mode parsing in uucore 2017-12-10 21:10:26 -08:00
Alex Lyon
7aea948473
Remove pipe_* macros 2017-12-10 20:57:39 -08:00
Alex Lyon
6829ca3d10
chmod, install: move mode parsing into uucore 2017-12-10 20:11:05 -08:00
Alex Lyon
e2e77f8c70
du: only use snake case 2017-12-10 10:03:14 -08:00
Alex Lyon
2efd2b38be
du: remove inefficient multi-threading 2017-12-10 09:52:22 -08:00
Alex Lyon
9316fb4603
Merge pull request #1095 from ids1024/travis-redox2
Add cross build targeting Redox to Travis CI
2017-12-09 19:12:06 -08:00
Ian Douglas Scott
75141f0382
Fix cp build on Redox 2017-12-08 21:04:02 -08:00
Alex Lyon
2b4a685286
stdbuf: stop using GNU make as part of the build process 2017-12-08 18:50:18 -08:00
Alex Lyon
75f11e9635
Handle SIGPIPE correctly and autogenerate main() for each util 2017-12-08 15:05:07 -08:00
Alex Lyon
ecdafd830f
stdbuf: fix install on Macs 2017-11-18 21:54:01 -08:00
Alex Lyon
4ef2ef29cd
Fix broken tests due to updating Cargo.lock 2017-11-18 17:52:28 -08:00
Alex Lyon
8c846e2aa9
stdbuf: build shared library on Macs 2017-11-18 17:37:37 -08:00
Alex Lyon
de07c6218b
stdbuf: build the shared library again and fix the Makefile 2017-11-18 17:37:32 -08:00
Alex Lyon
4e034b02bd
Merge pull request #1076 from emielbeinema/remove-rust-crypto
Replace rust-crypto
2017-11-18 15:06:39 -08:00
Emiel Beinema
1e7ebcb9e1 hashsum: use macro for Digest implementation 2017-11-18 13:06:11 +01:00
Emiel Beinema
5d0c8895d9 hashsum: replace rustc_serialize with hex crate 2017-11-18 13:06:11 +01:00
Emiel Beinema
ff1ef82d84 hashsum: clean up and lock new dependencies 2017-11-18 13:06:11 +01:00
Emiel Beinema
b425d03a6b hashsum: replace rust-crypto crate 2017-11-18 13:06:07 +01:00
Emiel Beinema
0944f7bf6d hashsum: introduct local Digest trait 2017-11-18 13:05:59 +01:00
Alex Lyon
fc0e4cb98b
Merge pull request #1090 from shutefan/chmod-cleanup
chmod: avoid passing all args through function hierarchy
2017-11-15 13:12:12 -08:00
Alex Lyon
f7b97dc3d4
Merge pull request #1089 from flyrry/fix_env
fix --help and --version
2017-11-15 13:06:31 -08:00
Nathan Ross
517a263e25
Merge pull request #1088 from flyrry/cleanup_help
make cp print usage correctly
2017-11-14 17:55:31 -05:00
Nathan Ross
4f3a1772cb
Merge pull request #1091 from ykrivopalov/numfmt
Add numfmt
2017-11-14 17:54:00 -05:00
Gerald E Butler
0268cf75cd Added a check to see if the input file/path that ls is run on when using -l or other long options, that if the path part ends with '/' then it does not show it as a soft-link if it is a soft-link but, instead shows the directory contents of the directory the soft-link points to - see https://github.com/uutils/coreutils/issues/1093 2017-11-13 21:34:40 -05:00
Yury Krivopalov
b2ad51839b Add numfmt 2017-11-09 00:23:24 +03:00
shutefan
26b52f7604 chmod: avoid passing all args through function hierarchy 2017-11-01 18:15:54 +01:00
Sergei Mironenko
f0aa68aa1e fix --help and --version 2017-10-28 17:42:40 +03:00
Sergei Mironenko
d8c75e5ae4 make cp print custom usage only once 2017-10-25 19:40:02 +03:00
Valentin Lorentz
fe87116431 Make 'yes' 1000 times faster. 2017-10-21 21:23:06 +02:00
Alex Lyon
f2b952db54 Merge pull request #1082 from flyrry/finish_basename
basename: add -a, -s and -z flags
2017-10-09 11:33:06 -07:00
Sergei Mironenko
0b5a2c8743 basename: add -a, -s and -z flags 2017-10-09 11:02:12 +03:00
Alex Lyon
8ed510d49a Merge pull request #1080 from shutefan/add-truncate-to-tr
tr: add truncate flag
2017-10-07 15:55:51 -07:00
Alex Lyon
42be38f98f Merge pull request #1078 from shutefan/fix-warnings-in-cp
cp: fix compiler warnings
2017-10-07 15:52:26 -07:00
shutefan
4a96b56d60 cp: keep --preserve related code but ignore "unused" warnings 2017-10-06 21:54:00 +02:00
shutefan
ddbfafa684 tr: add truncate flag 2017-10-06 01:09:17 +02:00
shutefan
14160cab86 mv: split up uumain 2017-10-06 01:09:06 +02:00
shutefan
e1d41b84f3 travis: fix compiler warnings for 1.22 2017-10-06 00:49:43 +02:00
Alex Lyon
618531b366 Merge pull request #1079 from shutefan/add-quiet-flag-to-tail
tail: suppress headers when --quiet flag is used
2017-10-05 14:43:12 -07:00
shutefan
bf2a591b0a tail: suppress headers when --quiet flag is used 2017-10-05 21:25:21 +02:00
shutefan
82d6d24a97 cp: cast st_ino and st_nlink to u64 2017-10-05 20:34:08 +02:00
shutefan
83d25c0c70 cp: cast nNumberOfLinks to u64 2017-10-04 23:17:11 +02:00
shutefan
c20ce9bf74 cp: fix compiler warnings
Fixes seven compiler warnings in cp.rs:
- unused imports: `c_char`, `c_int`
  -> removed
- value assigned to `inode` is never read
  -> no more default value, immutable
- value assigned to `nlinks` is never read
  -> no more default value, immutable
- unused variable: `src_path`
  -> removed
- unused `std::result::Result` which must be used
  -> only in error on unsupported platforms (Windows) which is
     already handled with #[cfg(unix)]
- variable `preserve_context` is assigned to, but never used
  -> removed
- value assigned to `preserve_context` is never read
  -> see above, remove
2017-10-04 21:43:06 +02:00
Ian Douglas Scott
1a28a48ca3
Merge branch 'master' into expr-regex 2017-10-01 10:09:06 -07:00
Alex Lyon
ab259194f3 Merge pull request #1066 from Matt8898/master
cp: add support for --attributes-only and setting timestamps, links and xattrs
2017-10-01 01:43:09 -07:00
Yury Krivopalov
ac375d8b7d tr: add squeeze option 2017-09-21 22:15:05 +03:00
Yury Krivopalov
b4d8265a07 tr: generaze translation 2017-09-21 22:15:01 +03:00
Yury Krivopalov
c59e375c7a tr: use as_bytes on whole output string
On my environment on 1MiB file with this fix tr takes 30ms,
instead of 44ms without fix.
2017-09-21 22:14:56 +03:00
Matt8898
e33de238ca cp: add support for --preserve=all. 2017-09-13 16:21:33 +02:00
Matteo Semenzato
6476f6e616 cp: add support for preserving links on windows. 2017-08-23 15:20:23 +02:00
Matt8898
f7072b7dfe cp: add support for preserving links on unix. 2017-08-19 13:43:37 +02:00
Matt8898
4cb727f80b cp: Add support for preserving xattrs. 2017-08-19 13:42:44 +02:00
Matt8898
6d3e9eabe4 cp: add support for --preserve. 2017-08-19 13:42:44 +02:00
Matt8898
38dd8c5836 cp: use filetime to set timestamps. 2017-08-19 13:42:44 +02:00
Matt8898
03432db951 Added support for preserving timestamps. 2017-08-19 13:42:44 +02:00
Matt8898
48ae9b64ba cp: add support for --attributes-only. 2017-08-19 13:42:44 +02:00
Ian Douglas Scott
2853905ebc
install: Fix verbose mode
- Do not mark as unimplemented
- Use ascii quotes
- Print newline
2017-08-14 13:16:50 -07:00
Ian Douglas Scott
79d5d14d11
Make install work on Redox, by using fs::set_permissions
This is the same change I made earlier to chmod
2017-08-12 15:20:50 -07:00
Ian Douglas Scott
de4bee2321
mktemp fix for Redox 2017-08-12 15:17:37 -07:00
Ian Douglas Scott
13d97ee1cc
Correct behavior of cp -r with non-existent dest 2017-08-09 15:35:13 -07:00
Alex Lyon
c827795d17 Merge pull request #1056 from Matt8898/master
cp: add support for --reflink.
2017-07-28 23:34:47 -07:00
Matt8898
a73c74ecbc cp: add support for --reflink. 2017-07-28 10:42:21 +02:00
mpkh
61b15f5c1c Merge pull request #1061 from Arcterus/ls-fix
ls: fix line that was forgotten in #1057
2017-07-27 11:40:08 +04:00
mpkh
678cb5f81a Merge pull request #1060 from Arcterus/rm-refactor
rm: massive refactor
2017-07-27 11:29:04 +04:00
Alex Lyon
86aa1eb47a ls: fix line that was forgotten in #1057 2017-07-27 00:09:42 -07:00
Alex Lyon
b39689ac37 rm: massive refactor 2017-07-26 23:21:23 -07:00
Alex Lyon
4a5b76f678 Merge pull request #1057 from ids1024/ls
Fix ordering of ls -t, which was backwards
2017-07-26 21:18:00 -07:00
Ian Douglas Scott
3c3f5ab2a3
Fix ordering of ls -t, which was backwards 2017-07-26 20:57:44 -07:00
Ian Douglas Scott
b9446c0766
Make ls build on Redox 2017-07-25 16:26:36 -07:00
Ian Douglas Scott
99af79a7fa
Cast umask result, and comment about Redox 2017-07-23 17:28:16 -07:00
Ian Douglas Scott
d8494974bc
Make chmod use std where possible instead of libc; compile for Redox 2017-07-22 20:46:15 -07:00
Matt8898
32bd2843d5 cp: add support for --update 2017-07-22 12:03:26 +02:00
Joshua Miller
7dafb649d5 implement many copy flags
- Refactored towards extensibility
2017-07-16 19:20:07 -05:00
Joshua Miller
e8073d2596 pin dependencies 2017-07-15 15:16:09 -05:00
Alex Lyon
7ef27acb05 Merge pull request #1046 from Matt8898/cp
cp: Add -r flag
2017-07-02 14:12:08 -07:00
Alex Lyon
0c3a816148 expr: update onig to compile on Windows 2017-06-29 21:25:40 -07:00
Alex Lyon
7cfe0465ee Update for changes in regex 2017-06-29 20:59:20 -07:00
Arcterus
9abc3208d3 expr: implement regular expressions 2017-06-29 20:58:16 -07:00
Alex Lyon
eb75085595 Merge pull request #1035 from shinh/ln
ln: Fix how it selects the form
2017-06-29 20:33:33 -07:00
mpkh
ee9013215b Merge pull request #1044 from Shnatsel/fnv-hash-map
tr: use FnvHashMap instead of default HashMap backed by SipHasher
2017-06-02 13:56:13 +00:00
Matt8898
f4ea1a9cc5 cp: added -r/--recursive flag 2017-06-02 13:19:33 +02:00
Hiroki Noda
a30d732463 nproc: fix conditional compilation 2017-05-29 12:08:47 +09:00
Hiroki Noda
5e95d3752e nproc: fix comment position 2017-05-29 11:36:26 +09:00
Hiroki Noda
57dd3703d0 nproc: fix compilation on windows 2017-05-29 10:06:45 +09:00
Hiroki Noda
adb39d411b nproc: fix windows 2017-05-29 09:41:29 +09:00
Hiroki Noda
3a4b5ff8ed nproc: counts CPU cores via affinity mask if available on Linux
* Upgrade num_cpus crate to 1.5.0.
* Use sysconf(_SC_NPROCESSORS_CONF) when `--all` query given.
2017-05-29 08:56:33 +09:00
Sergey "Shnatsel" Davidoff
44cf7798bd tr: use FnvHashMap instead of default HashMap backed by SipHasher. FnvHashMap is much faster for small inputs like intergers, and we literally have a hashmap with chars as keys 2017-05-26 18:49:39 +03:00
Sergey "Shnatsel" Davidoff
c47ce19620 tr: use streaming instead of buffering the entire input and output 2017-05-24 17:58:04 +03:00
Matt8898
2a045fae37 uucore: add support for optflagmulti and optmulti. 2017-04-22 21:36:01 +02:00
theGeekPirate
589847aa2f Ensure "Linux" not targeted instead of "Linu" =D
#[cfg(not(target_os = "linux"))] spelling mistake
2017-04-19 00:18:29 -07:00
Shinichiro Hamaji
d556c9e398 ln: Fix how it selects the form
ln had a bunch of problems:

1. `ln -s target` didn't work (2nd form in help).
2. `ln -t tmp` wasn't an error. We should check if files are
   empty first.
3. `ln -s file dir` didn't create dir/file.
4. `ln -s -T file dir` was removing `dir`.
5. Test cases for 4 say this is for compatibility with GNU
   coreutils but I couldn't find this feature.
2017-04-09 02:32:57 +09:00
Shinichiro Hamaji
416c2b7f89 rm: Remove invalid symlinks
Checking with file.exists() was not good for this purpose as
Path::exists() returns false for invalid symlinks.
2017-04-09 01:33:07 +09:00
Alex Lyon
5f1cb07df8 Merge pull request #1033 from shinh/rm-dir-link
rm: Remove symlinks to directories without -r
2017-04-03 08:35:37 -07:00
Shinichiro Hamaji
bb1d8956eb rm: Fail when symlink_metadata() fails 2017-04-04 00:10:45 +09:00
Alex Lyon
a2de3997b9 Merge pull request #1031 from shinh/mkdir-dup
mkdir: Fix the behavior for existing files
2017-04-02 20:50:22 -07:00
Alex Lyon
df960d211c Merge pull request #1034 from shinh/ls-n
ls: Implement -n option
2017-04-02 20:46:13 -07:00
Shinichiro Hamaji
36d26c0f0d ls: Implement -n option 2017-04-02 13:11:48 +09:00
mpkh
a304d9e97e Merge pull request #1032 from shinh/ln-basename
ln: Use basename when target directory is specfied
2017-04-01 22:11:33 +04:00
Shinichiro Hamaji
4f6841df32 rm: Remove symlinks to directories without -r
Path::is_dir follows symlinks so it returns true for symlinks
to directories. Use symlink_metadata instead so you can remove
symlinks to directories without -r flag.
2017-04-01 23:45:34 +09:00
Shinichiro Hamaji
fc235e360e mkdir: Fix the behavior for existing files
Currently, mkdir always succeeds for existing files and it
even modifies their mode. With this change, only mkdir -p for
existing directories will be allowed.
2017-04-01 23:43:13 +09:00
Shinichiro Hamaji
47acbb0e82 ln: Use basename when target directory is specfied
The following should work, but without this patch, it tries
to create the link as x/y and it fails with EEXIST.

$ mkdir -p x/y
$ ln -s -t . x/y
2017-04-01 23:22:14 +09:00
Shinichiro Hamaji
e4ad79f46e ls: Implement -B option 2017-04-01 19:47:52 +09:00
Anthony Deschamps
41d1dfaf44 Partial implemantion of date. 2017-03-26 23:43:29 -04:00
Jian Zeng
daba29b832 Merge pull request #1026 from evestera/cat-numlines-notrailing
cat: fix for numbered lines w/ no trailing newline
2017-01-23 06:39:31 -06:00
Erik Vesteraas
21d9152cfe cat: Collect output state into a struct 2017-01-23 11:07:47 +01:00
Erik Vesteraas
81996915df cat: fix for numbered lines w/ no trailing newline
Make at_line_start persist between printing each file. This fixes an
issue when numbering lines in the output and one of the input files
does not have a trailing newline.
2017-01-23 03:34:47 +01:00
Anthony Deschamps
6dc1eb54c0 sort: Implement ignore-case
Test included.
2017-01-21 13:30:22 -05:00
Alex Lyon
e0bfbc3c23 Merge pull request #1020 from KeenS/ls-inode
ls: implement -i option
2017-01-10 00:34:35 -08:00
Sunrin SHIMURA (keen)
20b336ed3c remove redundant space 2017-01-10 10:37:34 +09:00
Joshua Miller
133934f7cf add cat support for unix domain sockets
- adds conditional supports for unix domain sockets
   - adds unix domain socket test
   - adds Results to functions, removing unwraps
   - uutils `cat` used to panic on broken stdout pipes (e.g. `cat
     /dev/zero | head -c1`).  this is fixed in this PR
   - updated to exit 0 on success, and 1 if an error occurs.
   - adds docstrings
   - adds an error log on printing a directory
   - adds categorization of other filetypes for extensible
     differentiation of behaviors
   - adds OutputOptions struct to replace params for extensibility
   - adds correct status code on exit
2017-01-08 19:56:35 -06:00
Sunrin SHIMURA (keen)
59e4bc431a ls: return String, not Option<String> 2016-12-26 12:27:06 +09:00
Sunrin SHIMURA (keen)
8a51ddf6fb ls: implement -i option 2016-12-25 14:39:29 +09:00
Alexander Batischev
67ac0c13b8 mkdir: trying to create existing dir is fine
Fixes #1017.

test_mkdir_dup_dir asserted that creating an existing directory is an
error, but that's not how GNU coreutils behaves. This has been reported
in #121, but wasn't fixed (only the `-p` case was).
2016-12-23 18:47:38 +03:00
Alexander Batischev
f2166fed0a tail: implement --pid. Closes #846.
Kudos to zHz for helping out with Windows API part.
2016-12-22 01:32:09 +03:00
Lei Zhang
a34cd30f54 Enable compilation of ls on Fuchsia.
This updates the dependency of pretty-bytes to v0.2.
2016-12-14 23:29:38 -05:00