Commit graph

1990 commits

Author SHA1 Message Date
Sylvestre Ledru
e331186fee
unbreak build with rustc 1.32: force tempfile 3.1.0 (#1695) 2021-01-19 08:15:53 +01:00
Sylvestre Ledru
013bb285cd
bug(chmod): chmod on symlink pointing to non existing file is failing (#1694) 2021-01-18 23:09:00 +01:00
Felipe Lema
88911be6e0
--filter argument for split (#1681) 2021-01-18 14:42:44 +01:00
Gaurang Tandon
ac7cac2910
tail: moving to clap from getopt (#1689) 2021-01-12 17:44:11 +01:00
Sylvestre Ledru
04b92f3e94
Replaces failure by thiserror. (#1688)
Failure isn't maintained anymore:
https://github.com/rust-lang-nursery/failure/pull/347
https://rustsec.org/advisories/RUSTSEC-2020-0036.html
2021-01-11 22:01:14 +01:00
Sylvestre Ledru
b8e886ad1a bump the minimal version of uucore & uucore_procs 2021-01-10 18:27:20 +01:00
Sylvestre Ledru
57e24c9118 also update uucore & uucore_procs versions to 0.0.5 2021-01-10 18:24:43 +01:00
Sylvestre Ledru
d9ae043a05
update of the version 0.0.1 => 0.0.2 (#1686) 2021-01-10 18:16:04 +01:00
Sylvestre Ledru
d9580c2f3a
ls: move from isatty (deprecated) to atty (#1685) 2021-01-09 21:21:02 +01:00
jaggededgedjustice
18c39daed7
fold: Handle input with newlines (#1680)
The read_line function appends to the given buffer which is never
cleared. This leads to lines being duplicated.
2021-01-05 09:10:01 +01:00
Sylvestre Ledru
4a23a1a218 feature(ln): Implement -n 2021-01-03 18:55:53 +01:00
Sylvestre Ledru
7f1d47b77a refactor(ln): move to clap 2021-01-02 22:35:21 +01:00
Sylvestre Ledru
105e2cb26f feature(mktemp): implement -t
Deprecated but used in various places:
https://sources.debian.org/src/libreoffice/1:7.0.4-1/solenv/gbuild/platform/solaris.mk/?hl=22#L22
https://sources.debian.org/src/glibc/2.31-6/malloc/memusage.sh/?hl=225#L225
https://sources.debian.org/src/sbox-dtc/1.11.7-1/debian/postinst/?hl=20#L20
2021-01-02 13:07:27 +01:00
Sylvestre Ledru
66b503a77e refactor(mktemp): move to clap 2021-01-02 09:40:40 +01:00
Sylvestre Ledru
7942a64231 Remove 'extern crate'
Not necessary anymore. See:
https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html#no-more-extern-crate
2020-12-31 15:44:00 +01:00
Sylvestre Ledru
bc4c82b132 Fix some clippy warnings 2020-12-29 00:47:59 +01:00
Sylvestre Ledru
7955d346a8 csplit - rustfmt 2020-12-28 17:22:46 +01:00
Sylvestre Ledru
3a1eb1e05f Various fixes before landing csplit 2020-12-28 17:22:02 +01:00
Stéphane Campinas
89bf7a726e csplit: refresh of the previous PR 2020-12-28 17:21:29 +01:00
Kevin Burke
10cd480a01
rm: allow "-f" to be specified multiple times (#1667)
This matches the behavior of GNU rm.

Fixes #1663.

Co-authored-by: Kevin Burke <kevin@burke.dev>
2020-12-25 12:41:48 +01:00
Sylvestre Ledru
36d903e611
number-prefix: Move from 0.2 to 0.4 (#1670) 2020-12-22 13:53:20 +01:00
Diego Magdaleno
8b12686888
ls: On Windows don't display files hidden by NTFS (#1662)
This little check, allows us to hide the files that
shouldn't be shown on the listing on Windows operating
systems.

Just like the "dot" in UNIX based operating systems
Windows uses its own file attributes to determine if a file
is hidden or not.

The lack of support for this option is normally an annoyance
for many users, this commit adds full support for this feature
2020-12-19 17:54:28 +01:00
Sylvestre Ledru
469abf2427 bug(seq) - Allow 'seq 6 -1 0'
Was failing with
```
Found argument '-1' which wasn't expected, or isn't valid in this context
```
otherwise
2020-12-19 11:55:43 +01:00
Sylvestre Ledru
dbc716546b fix(mkdir) - Add --parent as alias of --parents
It is used this way sometimes:
https://sources.debian.org/src/php-symfony-polyfill/1.21.0-2/debian/rules/?hl=49#L49
https://sources.debian.org/src/firebird3.0/3.0.7.33374.ds4-1/debian/functions.sh/?hl=24#L24
https://sources.debian.org/src/postfix/3.5.6-1/debian/configure-instance.sh/?hl=67#L67
2020-12-18 14:41:59 +01:00
Sylvestre Ledru
718695d541 fix(install) - Install was failing with '-m 0333'
The parse_numeric was getting ' 0333' as input
and showing 'mode is too large ( 0333 > 7777) as error

Syntax used: https://sources.debian.org/src/firebird3.0/3.0.7.33374.ds4-1/debian/functions.sh/?hl=145#L145
2020-12-18 13:36:55 +01:00
Sylvestre Ledru
c506b5402b fix clippy warnings 2020-12-17 21:34:10 +01:00
Sylvestre Ledru
5a62dcafaa bug(cp): like gnu/cp, don't show any message when --no-clobber is used
Simple example:
touch bar
rm -rf /tmp/foo
mkdir -p /tmp/foo
cp -pnL -v bar /tmp/foo
echo $?
cp -pnL -v bar /tmp/foo
echo $?

rm -rf /tmp/foo
mkdir -p /tmp/foo
./target/debug/coreutils cp -pnL -v bar /tmp/foo
echo $?
./target/debug/coreutils cp -pnL bar /tmp/foo
echo $?
2020-12-17 20:50:38 +01:00
Sylvestre Ledru
1e9820a7c4
Merge pull request #1659 from sylvestre/base-non-utf8
base32/base64: tolerate non-utf8 encoded inputs
2020-12-16 08:46:48 +01:00
Gabriel Ganne
607b70a896 base32/base64: tolerate non-utf8 encoded inputs
For inputs that are valid base64 but that encode non-utf8 strings (like
garbage), base64 panicks when trying to unwrap the result from
String::from_utf8().
Instead of interpreting the byte stream as utf8, simply dump the raw
bytes to stdout.

Since the test assert that all io is valid utf8, this does not come with
a unit test. See run() in tests/common/utils.rs.

Eg.
"gD63hSj3ScS+wuOeGrubXlq35N1c5Lby/S+T7MNTjxo=" -> ">(Iľ^Z\/S"
2020-12-16 00:14:18 +01:00
Hiroki Noda
2916e8d811 tee: implement ignore-interrupts option 2020-12-15 23:50:43 +01:00
Sylvestre Ledru
d9cf0374be fix(sync) - Remove 'unused import' on mac 2020-12-13 18:02:33 +01:00
Sylvestre Ledru
ba126afe54 fix(ls): follow the display of GNU ls 2020-12-13 12:12:19 +01:00
Sylvestre Ledru
8a1628cf89 fix(ls): When a file doesn't exist, exit early and fails ls
Currently, running
$ ls doesntexist
will return 0
while it should return 1

Ditto for
$ ls doesntexist a
2020-12-13 12:12:19 +01:00
Sylvestre Ledru
f287309b72 perms: add some docs 2020-12-12 14:43:56 +01:00
Sylvestre Ledru
dca1f28085 install: various improvements in output & tests 2020-12-12 14:36:23 +01:00
Sylvestre Ledru
3024ade071 refactor(chgrp, install): Show the error in the program instead of the lib 2020-12-12 14:28:50 +01:00
Sylvestre Ledru
55c660b986 feature(install): move chown functions into uucore and have install owner support use it 2020-12-12 14:27:59 +01:00
Sylvestre Ledru
015e18731f feature(install): install group support 2020-12-12 14:27:03 +01:00
Sylvestre Ledru
763de90fda refactor(chgrp): move chgrp perms function into the uucore to reuse it into install
Will move chown later
2020-12-12 14:26:32 +01:00
Sylvestre Ledru
431a4e9f2f cosmetic: consistency in the clap cargo declaration 2020-12-12 13:12:13 +01:00
Sylvestre Ledru
e19010e9fe cosmetic: consistency in the walkdir cargo declaration 2020-12-12 13:10:57 +01:00
Sylvestre Ledru
d8e345df0a
refactor(whoami): only use advapi32/winapi on Windows (#1653) 2020-12-12 11:04:39 +01:00
Sylvestre Ledru
576aa29f0f
refactor(chmod): move from walker to walkdir, simplify the code and add tests (#1645) 2020-12-12 10:31:12 +01:00
Sylvestre Ledru
49b32ea68d
refactor(chown): move to clap & add tests (#1648) 2020-12-12 00:14:00 +01:00
Sylvestre Ledru
068fee2ebd
feature(uname): Implement -p & -i (#1649)
Just return 'unknown' for both

Closes: #1636
2020-12-11 22:46:36 +01:00
Sylvestre Ledru
516839e081
refactor(mv): move to clap (#1652) 2020-12-10 22:28:17 +01:00
Piyush Jaipuriayar
3ca8ba997c
hashsum: added blake2 as a hashing algorithm (#1651) 2020-12-08 23:32:02 +01:00
Sylvestre Ledru
d21acc4621
cosmetic(cp): use the variable instead of the string 2020-12-08 23:19:51 +01:00
Sylvestre Ledru
0cfb83a040
Merge pull request #1580 from sylvestre/archive3
feature(cp): implement archive & -L
2020-12-06 17:15:56 +01:00
Sylvestre Ledru
5f47d1249d use the same version of clap everywhere 2020-12-01 22:59:14 +01:00
Sylvestre Ledru
c483fa501b feature(cp): also implement --dereference/-L 2020-11-29 20:48:29 +01:00
Sylvestre Ledru
f76a0ec972 feature(cp): implement archive + add missing tests 2020-11-29 20:48:23 +01:00
Sylvestre Ledru
b07f496b70 fix(install): 'install file_a file_b' should just copy the file 2020-11-29 16:33:46 +01:00
Sylvestre Ledru
261b4e24d6 feature(install): remove a duplicate check.
Already done in is_new_file_path
2020-11-29 16:33:46 +01:00
Sylvestre Ledru
11ecf80a25
feature(sync): add --data & --file-system (#1639) 2020-11-29 16:32:21 +01:00
Sylvestre Ledru
89f8624936
bug(install) - install -d can be run on an existing directory (#1643)
GNU:
$ install -d foo
$ install -d foo

Rust:
$ install -d foo
$ install -d foo
install: cannot create directory 'foo': File exists
install: foo: File exists (os error 17)
2020-11-29 16:31:26 +01:00
Sylvestre Ledru
8ef7f394c1
address some new clippy warnings (#1642) 2020-11-29 16:26:38 +01:00
Sylvestre Ledru
adc9b12f32 install: fix a typo 2020-11-25 13:09:28 +01:00
Sylvestre Ledru
bfba889f8e
refactor(touch): Move to clap + add a test (#1629) 2020-11-21 09:53:13 +01:00
Sylvestre Ledru
5efaa0bf32
refactor(id) - move to clap and add more tests (#1628) 2020-11-21 09:52:50 +01:00
Sylvestre Ledru
41ba5ed913
refactor(uniq): Move to clap + add a test (#1626) 2020-11-21 09:52:40 +01:00
Sylvestre Ledru
7bbb4c98e8
Merge pull request #1623 from sylvestre/clap-pwd
refactor(pwd): move to clap + add a test
2020-11-21 00:49:30 +01:00
Sylvestre Ledru
6870d81b33
Merge pull request #1631 from sylvestre/clap-version
Remove version mgmt, it is done by clap
2020-11-20 10:02:33 +01:00
Sylvestre Ledru
6fc4129daf
Merge pull request #1624 from sylvestre/uptime-refresh
refactor(uptime): some minor improvements
2020-11-20 10:02:13 +01:00
Sylvestre Ledru
641aba5bd7 maint/hostname: Fix a clippy warning 'single_char_push_str' 2020-11-19 23:16:31 +01:00
Sylvestre Ledru
8271faf3a2
Merge branch 'master' into clap-pwd 2020-11-19 22:32:02 +01:00
Sylvestre Ledru
252f527b55
Merge branch 'master' into uptime-refresh 2020-11-19 22:30:33 +01:00
Sylvestre Ledru
62265656b4
Merge pull request #1630 from sylvestre/clap-mkdir
refactor(mkdir): Move to clap + add a test
2020-11-17 13:01:09 +01:00
Sylvestre Ledru
5eaab5327c
Merge pull request #1632 from sylvestre/clap-rm
refactor(rm): Move to clap + add a test
2020-11-17 13:00:35 +01:00
Sylvestre Ledru
eada6e58e5
Merge pull request #1637 from sylvestre/clap-install
refactor(install): move to clap
2020-11-17 13:00:04 +01:00
Sylvestre Ledru
27d5256cb6
Use the correct syntax to define the mode 2020-11-16 22:02:06 +01:00
Sylvestre Ledru
55221a18b4
change order + remove useless import 2020-11-15 22:53:49 +01:00
Sylvestre Ledru
f55d8a22ec
remove useless mut
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-15 22:49:26 +01:00
Sylvestre Ledru
5718af023b
use the OPT_VERBOSE
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-15 22:49:01 +01:00
Sylvestre Ledru
4fec824421
change the position of the TODO
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-15 22:48:39 +01:00
Sylvestre Ledru
d268bda28e
Merge pull request #1635 from sylvestre/clap-sync
refactor(sync): Move to clap + add tests
2020-11-15 22:40:46 +01:00
Sylvestre Ledru
2edfe32c48 refactor(install): move to clap 2020-11-13 18:21:56 +01:00
Sylvestre Ledru
2febd13733 refactor(sync): Move to clap + add tests 2020-11-11 22:57:55 +01:00
Sylvestre Ledru
61520546a5 refactor(rm): Move to clap + add a test 2020-11-09 10:27:58 +01:00
Roy Ivy III
e493ad1f26 refactor/uucore_procs ~ revise 'Cargo.toml' towards repo norms 2020-11-08 20:53:18 -06:00
Roy Ivy III
688db0d4a2 refactor/uucore ~ revise 'Cargo.toml' towards repo norms 2020-11-08 20:53:18 -06:00
Roy Ivy III
2b4b31a9ee uucore/refactor ~ fix cargo clippy complaints (*allow* temporary_cstring_as_ptr; added FixME note)
* otherwise, unsure how to fix this; the following change

```rust
let res = unsafe { utmpxname(CString::new(f).unwrap().as_ptr()) };
```

to

```rust
let string_ptr = CString::new(f).unwrap().as_ptr();
let res = unsafe { utmpxname(string_ptr) };
```

causes three `who` tests (test_who::test_all, test_who::test_boot, and test_who::test_login)
to fail by generating no output.
2020-11-08 20:53:18 -06:00
Roy Ivy III
3dc9f76c7f uucore/refactor ~ fix cargo clippy complaints (*allow* type_complexity) 2020-11-08 20:53:18 -06:00
Roy Ivy III
66dfd73ffe uucore/refactor ~ fix cargo clippy complaints (iter_nth_zero) 2020-11-08 20:53:18 -06:00
Roy Ivy III
9473abf3ba uucore/polish ~ fix cargo clippy complaints (missing_safety_doc; with ToDO for safety note) 2020-11-08 20:53:18 -06:00
Roy Ivy III
3941d3f18c uucore/refactor ~ fix cargo clippy complaints (len_zero) 2020-11-08 20:53:18 -06:00
Roy Ivy III
bc1084a9f5 uucore/refactor ~ fix cargo clippy complaints (or_fun_call) 2020-11-08 20:53:18 -06:00
Roy Ivy III
6539b8c6b9 maint/deps ~ change version specification for dependencies between sub-packages
- refactor internal version specifications to be ">=M.m.p" (where M.m.p is *already published*)

## [why]

Loosening internal version dependencies decreases the coupling between packages such
that packages can be published in a looser order. It allows the packages to be version
updated and published in tandem (ie, by using `cargo workspace ...`). Once published,
the internal versions can then be updated (again, to an *already published* package
version), as needed.
2020-11-08 20:26:46 -06:00
Roy Ivy III
c17307c757 fix ~ update workspace pointers to 'uucore' and 'uucore_procs' 2020-11-08 20:26:46 -06:00
Roy Ivy III
e15df35e87 Merge 'uucore' repository source code back into 'coreutils' 2020-11-08 19:58:25 -06:00
Roy Ivy III
aed6f296cf change ~ prepare 'uucore' for grafting/re-merge into 'coreutils' 2020-11-08 19:57:28 -06:00
Alex Lyon
46e2c14f07 Formatting 2020-11-08 19:56:57 -06:00
Alex Lyon
e8dcca1872 Use OsString for arguments rather than String 2020-11-08 19:56:57 -06:00
Sylvestre Ledru
121ab6d847 build/deps ~ relax/update the wild dep
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-08 19:56:57 -06:00
Roy Ivy III
00779a1fb5 refactor macro variable names (fixes spell-checker/unknown word warnings) 2020-11-08 19:56:57 -06:00
Roy Ivy III
7aa0c92cf8 docs/spell ~ configure VSCode cSpell 2020-11-08 19:56:57 -06:00
Roy Ivy III
d52fb5c484 docs/spell ~ spell-check and addition of exceptions 2020-11-08 19:56:57 -06:00
Roy Ivy III
88e5631fa4 docs/polish ~ polish/update commentary and copyrights 2020-11-08 19:56:57 -06:00
Roy Ivy III
70871edac9 docs/polish ~ remove outdated commentary 2020-11-08 19:56:57 -06:00
Roy Ivy III
b9642a0253 0.0.4 2020-11-08 19:56:57 -06:00
Roy Ivy III
16d367a418 fix 'edition=2018' module import errors 2020-11-08 19:56:56 -06:00
Roy Ivy III
c57a933412 change ~ use crate configuration 'edition=2018' 2020-11-08 19:56:56 -06:00
Roy Ivy III
2f840eedef docs ~ update meta information 2020-11-08 19:56:56 -06:00
Roy Ivy III
fc6370e160 change/API! ~ new_coreopts!() => app!() 2020-11-08 19:56:56 -06:00
Roy Ivy III
0c4d314544 change/API! ~ disp_err!() => show_usage_error!() 2020-11-08 19:56:56 -06:00
Roy Ivy III
d6b1052f3f 0.0.3 2020-11-08 19:56:56 -06:00
Roy Ivy III
1013b760c4 fix cargo clippy warning (no_effect) 2020-11-08 19:56:56 -06:00
Roy Ivy III
b8c22496bb change/uucore_procs ~ add work-around for attribute/macro name collision during testing
- proc_macro "main" collides with attribute "#[main]" during testing (for rust < v1.38.0; fixed in v1.38.0+)
- ref: GH:rust-lang/rust#62127
2020-11-08 19:56:56 -06:00
Roy Ivy III
e35bd4b79c update deps (Cargo.toml); MinSRV == v1.31.0 2020-11-08 19:56:56 -06:00
Roy Ivy III
18b13ed4b4 build/uucore_procs ~ fix proc_dbg!() for MinSRV of v1.31.0 2020-11-08 19:56:56 -06:00
Roy Ivy III
14df9d2df3 docs/build ~ polish crate meta-information (uucore_procs) 2020-11-08 19:56:56 -06:00
Roy Ivy III
246e4427e4 docs/build ~ polish descriptions and crate meta-information in Cargo.toml 2020-11-08 19:56:56 -06:00
Roy Ivy III
ad30781c0c build/uucore_procs ~ add debugging statements 2020-11-08 19:56:56 -06:00
Roy Ivy III
a352657e1f build/uucore_procs ~ add/improve debug infrastructure
- add proc_dbg! macro
- use debug feature to trigger debug traits for the syn crate
2020-11-08 19:56:56 -06:00
Roy Ivy III
cf2fcd8dc1 docs/uucore_macros ~ improve commentary/documentation 2020-11-08 19:56:56 -06:00
Roy Ivy III
c32ff9e8bb change ~ use updated SIGPIPE in procs 2020-11-08 19:56:56 -06:00
Roy Ivy III
0432063479 change ~ add proc-macros module (uucore_procs) with uucore_procs::main()
- `uucore_procs::main!(UUTIL_NAME)` allows simple, consistent instantiation of `main()` for uutils
2020-11-08 19:56:55 -06:00
Roy Ivy III
503cc53014 change ~ improve naming and documentation of default SIGPIPE handling 2020-11-08 19:56:55 -06:00
Roy Ivy III
b0d02e7f43 change ~ reorganize code layout/structure 2020-11-08 19:56:55 -06:00
Roy Ivy III
6a8a677e8b refactor/polish ~ cargo fmt 2020-11-08 19:56:55 -06:00
Roy Ivy III
099b0a2074 0.0.2 2020-11-08 19:56:55 -06:00
Roy Ivy III
5b2c2bdfca maint/CICD ~ fix FreeBSD build on Cirrus CI 2020-11-08 19:56:55 -06:00
Roy Ivy III
16157f57eb maint/build ~ refactor (reorganize) and improve comments within 'Cargo.toml' 2020-11-08 19:56:55 -06:00
Roy Ivy III
ceee0ec09e fix build failure caused by imprecise libc version specification
- more precisely describe permissable libc versions

.# [why]

- libc >= v0.2.15 is needed for utmp support.
- libc <= v0.2.66 is required to avoid build errors for MinSRV == 1.31.0.

Intermittant build failures were being caused by `cargo` using early libc versions.
2020-11-08 19:56:55 -06:00
Roy Ivy III
c08674da28 fix build failure caused by data-encoding v2.2.0
- hold data-encoding to known working "<= 2.1.2"

.# [why]

data-encoding v2.2.0 causes a build error for '1.31.0-i686-pc-windows-msvc'.

```
cargo +1.31.0-i686-pc-windows-msvc build --target=i686-pc-windows-msvc --all-features
...
error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130)
   --> C:\Users\appveyor\.cargo\registry\src\github.com-1ecc6299db9ec823\data-encoding-2.2.0\src\lib.rs:194:5
    |
187 | / mod prelude {
188 | |     pub use std::borrow::Cow;
189 | | }
    | |_- not an extern crate passed with `--extern`
...
194 |   use prelude::*;
    |       ^^^^^^^
    |
...
```
2020-11-08 19:56:55 -06:00
Roy Ivy III
96a92b3533 refactor ~ pin all crate versions < v1.0.0
. #[why]

Technically, by semver rules, projects with versions < v1.0.0 may make breaking
changes with *any* version change. So, for some protection, pin all crates with
version < v1.0.0 to a specific version.

* ref: <https://semver.org> @@ <https://archive.is/LTGHB>
2020-11-08 19:56:55 -06:00
Roy Ivy III
84d8473e1a fix forced MinSRV increase (using pinned 'backtrace' version)
- hotfix transitive bug in 'failure' forcing MinSRV increase to rust v1.33.0 by pinning 'backtrace' to <= 0.3.31
- [rustlang/nursery#340](https://github.com/rust-lang-nursery/failure/issues/340) is now open on 'failure' to address this issue

.# [why]

'failure' was using 'backtrace' `version = "0.3.3"`, which by semantic version
auto-upgrade was pulling in 'backtrace' > v0.3.30 (specifically, v0.3.40 most
recently). 'backtrace' v0.3.31 introduces use of `#[cfg(target_vendor = ...)]`
which requires rust v1.33.0. So, 'backtrace' is forcing an upgrade of MinSRV
to rust v1.33.0 with the change from backtrace v0.3.30 to backtrace v0.3.31.

Technically, by being less than v1.0.0, 'backtrace' has no semantic version
requirement. And there is debate about whether increasing MinSRV is a semantic
change. But, in my strong opinion, breaking our MinSRV statement is definitely
a semantic change.

* ref: <https://github.com/rust-lang/rust/blob/master/RELEASES.md>
2020-11-08 19:56:55 -06:00
Roy Ivy III
667ed39ece fix uucore::fs for windows
- standardize the return value of `std::env::current_dir()` by using `canonicalize()`

.# [why]

`std::env::current_dir()` will, in some situations on windows hosts, return
"short"-type paths (eg, "C:\Progra~1\..."). Using `canonicalize()` transforms
the path in a standard long form but may also require removing a leading
"\\?\" prefix.
2020-11-08 19:56:55 -06:00
Roy Ivy III
2792d85865 fix ~ 'musl' environment doesn't support utmpx 2020-11-08 19:56:55 -06:00
Alex Lyon
217d83526b Set up for release on crates.io 2020-11-08 19:56:54 -06:00
Alex Lyon
12ce90d9cb Fix doc-test for entries on macOS 2020-11-08 19:56:54 -06:00
Alex Lyon
cdafcce400 Redox is not tested currently, so don't mention it 2020-11-08 19:56:54 -06:00
Alex Lyon
12129d1b1c Separate uucore into its own repository 2020-11-08 19:56:54 -06:00
Alex Lyon
76aef60d80 uucore: allow the Linux zero-copy setup on Android 2020-11-08 19:56:54 -06:00
Alex Lyon
f79f0716ee uucore: remove an inaccurate comment 2020-11-08 19:56:54 -06:00
Alex Lyon
72c322a882 uucore, yes: add zero-copy on supported platforms (only Linux currently) 2020-11-08 19:56:54 -06:00
Alex Lyon
d81d3e3c71 Get rid of all warnings on Linux (or at least WSL) 2020-11-08 19:56:54 -06:00
Zachary Dremann
77cc8d39c6 Replace starts_with and slice with trim_left_matches 2020-11-08 19:56:54 -06:00
Zachary Dremann
c15b18bf5b Don't allocate in signal_by_name_or_value 2020-11-08 19:56:54 -06:00
Zachary Dremann
30df2210f0 Fix is_signal 2020-11-08 19:56:54 -06:00
Zachary Dremann
44550ee5b6 Add tests for signals (including failing test for is_signal 2020-11-08 19:56:54 -06:00
Alex Lyon
4e0025cb17 base32, base64, uucore: merge base32/base64 code 2020-11-08 19:56:54 -06:00
Roy Ivy III
6600993c3e fix: gate unix-only macros (silences "unused" warnings) 2020-11-08 19:56:53 -06:00
Vinzent Steinberg
5f582c05e1 Remove utf8 feature
All code it provides can be implemented with `std`.
2020-11-08 19:56:53 -06:00
Vinzent Steinberg
5160f47a9f Fix more clippy warnings and remove redundant 'static 2020-11-08 19:56:53 -06:00
Vinzent Steinberg
de7a6b5afa Fix a few clippy warnings 2020-11-08 19:56:53 -06:00
Roy Ivy III
bd450ebb94 uucore: fix: use updated 'wild' crate for globbing 2020-11-08 19:56:53 -06:00
Roy Ivy III
9e8b002735 uucore: fix: use forked 'wild' crate with case-sensitivity + API fixes 2020-11-08 19:56:53 -06:00
Roy Ivy III
03d6e733e4 uucore: Add globbing for Windows machines 2020-11-08 19:56:53 -06:00
dependabot[bot]
99da2451ab 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>
2020-11-08 19:56:53 -06:00
dependabot[bot]
b21bd0bea3 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>
2020-11-08 19:56:53 -06:00
dependabot[bot]
a31b1047c1 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>
2020-11-08 19:56:53 -06:00
Alex Lyon
40738bfb0a uucore: update data_encoding and add wrap_write() 2020-11-08 19:56:53 -06:00
Valentin Lorentz
2ad767586b chmod: show human-friendly permissions when --changes or --verbose is used.
Like GNU chmod.
2020-11-08 19:56:53 -06:00
Ian Douglas Scott
eedf7cb28a Make the 'cat' utility build on Redox 2020-11-08 19:56:53 -06:00
Alex Lyon
07de3eda6e uucore: make features opt-in rather than opt-out 2020-11-08 19:56:53 -06:00
Alex Lyon
f74a1b6333 Format everything using rustfmt 2020-11-08 19:56:53 -06:00
Alex Lyon
1c0b1ab375 uucore: remove utsname.rs (and replace with platform-info) 2020-11-08 19:56:53 -06:00
Alex Lyon
ca3393bd86 uucore: read from sys:uname on Redox 2020-11-08 19:56:52 -06:00
Alex Lyon
7559c0d83d cp, tail: update winapi 2020-11-08 19:56:52 -06:00
Alex Lyon
f575b8f4f2 arch: add support for building on Windows 2020-11-08 19:56:52 -06:00
Alex Lyon
3cec199da1 Add Sphinx documentation to generate man pages 2020-11-08 19:56:52 -06:00
Alex Lyon
64c2c2055b chmod, install, uucore: fix build on Windows 2020-11-08 19:56:52 -06:00
Alex Lyon
5544def54e Remove pipe_* macros 2020-11-08 19:56:52 -06:00
Alex Lyon
f0bd170996 chmod, install: move mode parsing into uucore 2020-11-08 19:56:52 -06:00
Alex Lyon
fd555c6d21 Handle SIGPIPE correctly and autogenerate main() for each util 2020-11-08 19:56:52 -06:00
Joshua Miller
6998949c06 pin dependencies 2020-11-08 19:56:52 -06:00
Matt8898
e7940828f9 uucore: add support for optflagmulti and optmulti. 2020-11-08 19:56:52 -06:00
Arcterus
e2b8741a35 uucore: compile on Windows again 2020-11-08 19:56:52 -06:00
Arcterus
f61f30f52b uucore: read symlinked directories correctly in resolve_relative_path() 2020-11-08 19:56:52 -06:00
Joseph Crail
f3639b9453 Fix comment spelling 2020-11-08 19:56:52 -06:00
Lei Zhang
3f4dba0de9 Turn off utmpx and signals for Fuchsia.
Fuchsia uses musl as its libc; musl only has stub implementation
for utmpx. From their wiki, that is deliberately chosen.

Fuchsia doesn't have signals mechanism.
2020-11-08 19:56:52 -06:00
Will Wykeham
cf2be8a6b1 Fix a number of Windows build warnings 2020-11-08 19:56:52 -06:00
knight42
09b0b9ad78 chown,chgrp: fix bug in option --preserve-root 2020-11-08 19:56:51 -06:00
knight42
b6dcafc675 uucore::fs: add fn resolve_relative_path 2020-11-08 19:56:51 -06:00
Nathan Ross
22fab1444e uucore: allow 'wrong number of arguments' macro to be more precise 2020-11-08 19:56:51 -06:00
Nathan Ross
8cb2edecb1 uucore: add support for optflagopt to coreopts 2020-11-08 19:56:51 -06:00
Nathan Ross
35951ebf66 uucore: fix utility name in coreopts parsing error messages 2020-11-08 19:56:51 -06:00
Knight
1dab4510b5 Remove uucore::c_types 2020-11-08 19:56:51 -06:00
Knight
d22814201e Add uucore::utsname to get system info 2020-11-08 19:56:51 -06:00
Knight
05b5317605 uucore::process: add functions to obtain uid/gid, euid/egid 2020-11-08 19:56:51 -06:00
Knight
5bc2276775 Add uucore::entries 2020-11-08 19:56:51 -06:00
Knight
434aae76bc uucore::utmpx: fix doctest errors 2020-11-08 19:56:51 -06:00
Knight
0277848de7 uucore: make libc optional 2020-11-08 19:56:51 -06:00
nathanross
50887566ea uucore: coreopts alignment, spacing, and optional usage 2020-11-08 19:56:51 -06:00
Nathan Ross
73d36a1d88 uucore: require version; syntax; summary; longhelp 2020-11-08 19:56:51 -06:00
Knight
6a22120d7b uucore::utmpx: change API and fix error 2020-11-08 19:56:51 -06:00
Knight
58b6ac9393 uucore::utmpx: refine implementation 2020-11-08 19:56:51 -06:00
Knight
3751142ccb coreopts: fix error when using msg_wrong_number_of_arguments macro 2020-11-08 19:56:50 -06:00
Knight
68ad14f3c4 uucore: conditional enable different features 2020-11-08 19:56:50 -06:00
Knight
25018b112b uucore: export latest libc 2020-11-08 19:56:50 -06:00
Knight
789141d926 coreopts: display package name instead of module path 2020-11-08 19:56:50 -06:00
Nathan Ross
bcec54f572 uucore: CoreOptions error and version message templates 2020-11-08 19:56:50 -06:00
Nathan Ross
76952579ac uucore: add message templates 2020-11-08 19:56:50 -06:00
Knight
2c78b92801 uucore: add module encoding 2020-11-08 19:56:50 -06:00
Corey Farwell
bcdb682bf8 Remove unused imports. 2020-11-08 19:56:50 -06:00
Corey Farwell
c6909951aa Cleanup logic around wait_or_timeout exit status handling. 2020-11-08 19:56:50 -06:00
Corey Farwell
72d2ab208c Prefer handling Duration over f32 when dealing with times.
Also refactored out usage of the `time` crate in `uucore`.
2020-11-08 19:56:50 -06:00
Knight
463c6af4e3 uucore: update utmpx 2020-11-08 19:56:50 -06:00
Knight
79b6835612 pinky: cleanup the code 2020-11-08 19:56:50 -06:00
Knight
6e2c3ede40 uucore::utmpx: revert the changes 2020-11-08 19:56:50 -06:00
Knight
967babd1e6 pinky: implement short format 2020-11-08 19:56:50 -06:00
Knight
b0588e482e uucore: add disp_err macro 2020-11-08 19:56:50 -06:00
Shiroy
713770c9ae Add missing lib.name for uucore
Fix build on Linux
2020-11-08 19:56:50 -06:00
Arcterus
a149efe45a uucore: don't follow symlinks when examining them (fixes #799) 2020-11-08 19:56:49 -06:00
Michael Gehring
512a6a3201 expand, unexpand: fix build on stable 2020-11-08 19:56:49 -06:00
Michael Gehring
0a3a2ca935 Fix clippy warnings 2020-11-08 19:56:49 -06:00
Michael Gehring
ce733b38a9 Fix arm build
Fixes #719
2020-11-08 19:56:49 -06:00
Joseph Crail
bde309a29f Remove trait shim needed before Path stabilized
Now that Path has stabilized in Rust 1.5, I removed the UUPathExt trait
needed to support stable, beta, and nightly.
2020-11-08 19:56:49 -06:00
Joseph Crail
0678332a1f Add macro to properly find program name. 2020-11-08 19:56:49 -06:00
Joseph Crail
b8ee12f703 More import fixes for Windows. 2020-11-08 19:56:49 -06:00
Joseph Crail
3863842fae Fix errors with bools represented as ints. 2020-11-08 19:56:49 -06:00
Joseph Crail
9c4c9f6782 Refactor check for standard stream interactivity.
Since several utilities check if the standard streams are interactive, I
moved this into the uucore::fs library as is_std*_interactive(). I also
added Windows support for these methods, which only return false (or at
least until someone finds a way to support this).
2020-11-08 19:56:49 -06:00
Joseph Crail
14eccb4335 uucore: specify a few modules to be Unix-only 2020-11-08 19:56:49 -06:00
Michael Gehring
23e0315262 Remove deprecated lint 2020-11-08 19:56:49 -06:00
Joseph Crail
6095dfee66 Split utility files into separate library.
Everything in src/common has been moved to src/uucore. This is defined
as a Cargo library, instead of directly included. This gives us
flexibility to make the library an external crate in the future.

Fixes #717.
2020-11-08 19:56:42 -06:00
Sylvestre Ledru
5c8e47a4d1 Remove version mgmt, it is done by clap 2020-11-08 17:55:31 +01:00
Sylvestre Ledru
897bcb2e67 refactor(mkdir): Move to clap + add a test 2020-11-08 17:51:04 +01:00
Sylvestre Ledru
92d5d47434 refactor(pwd): move to clap + add a test 2020-11-03 23:12:16 +01:00
Sylvestre Ledru
8bd533ffe8 refactor(uptime): some minor improvements 2020-11-03 23:10:32 +01:00
Sylvestre Ledru
a3f3a050a8
Merge pull request #1618 from sylvestre/wc-clap
refactor(wc): use clap instead of getopts
2020-11-03 09:39:53 +01:00
Sylvestre Ledru
38e90b9a03
Merge pull request #1621 from sylvestre/clap-stat
refactor(stat): Move to clap
2020-11-03 08:37:39 +01:00
Sylvestre Ledru
57c83db6b6
Merge pull request #1616 from sylvestre/users
refactor(users): move to clap and simplify the code a bit
2020-11-03 08:37:16 +01:00
Sylvestre Ledru
bd41cb621b
Merge pull request #1620 from sylvestre/clap-printenv
refactor(printenv): use clap instead of getopts
2020-11-03 08:36:56 +01:00
Sylvestre Ledru
32ccd7d54d
Merge pull request #1619 from sylvestre/rmdir-clap
refactor(rmdir): use clap instead of getopts
2020-11-03 08:36:25 +01:00
Sylvestre Ledru
daf0f96b94
Update of the about description
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-02 22:47:55 +01:00
Sylvestre Ledru
2ad587ccbd
Update of the about description
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-02 22:32:44 +01:00
Sylvestre Ledru
1e37c29b1f refactor(stat): Move to clap 2020-11-02 22:18:51 +01:00
Sylvestre Ledru
58099f4203 refactor(wc): use clap instead of getopts 2020-10-29 20:40:00 +01:00
Roy Ivy III
114fda0519 tests ~ (sub-crate factor) refactor divisor() test for improved readability 2020-10-26 15:06:29 -05:00
Roy Ivy III
ae06368cd8 polish/factor ~ correct spelling 2020-10-26 15:06:29 -05:00
Roy Ivy III
6a525c950d perf/factor ~ tune number of stack inlined decomposition values (~1% time improvement) 2020-10-26 15:06:29 -05:00
Roy Ivy III
6eea8c5f30 perf/factor ~ improve factor() quotient and loop comparison (~6% time improvement) 2020-10-26 15:06:28 -05:00
Roy Ivy III
368f47381b fix/factor ~ fix fault when factoring number composed of a squared factor 2020-10-26 15:06:28 -05:00
Roy Ivy III
8593b4c46c tests ~ (sub-crate/factor) add tests for known prior factorization failures 2020-10-26 15:06:28 -05:00
Roy Ivy III
3bb3080170 factor/refactor ~ fix cargo clippy complaints (allow many_single_char_names) 2020-10-26 15:06:28 -05:00
nicoo
0d39732300 factor::Decomposition: Inline a small number (4) of factors
This avoids allocating on the heap when factoring most numbers,
without using much space on the stack.

This is ~3.5% faster than the previous commit, and ~8.3% faster than “master”.
2020-10-26 15:06:28 -05:00
nicoo
78ae0cca31 factor: Slightly refactor main loop, fix bug 2020-10-26 15:06:28 -05:00
nicoo
b7b0c76b8e factor::Decomposition: Optimise as a factor is never added twice
The invariant is checked by a debug_assert!, and follows from the previous
commit, as `dec` and `factors` only ever contains coprime numbers:
  - true at the start: factor = ∅ and dec = { n¹ } ;
  - on every loop iteration, we pull out an element `f` from `dec` and either:
    - discover it is prime, and add it to `factors` ;
    - split it into a number of coprime factors, that get reinserted into `dec`;
      the invariant is maintained, as all divisors of `f` are coprime with all
      numbers in `dec` and `factors` (as `f` itself is coprime with them.

As we only add elements to `Decomposition` objects that are coprime with the
existing ones, they are distinct.
2020-10-26 15:06:28 -05:00
nicoo
ce218e01b6 factor: Ensure we only need to find every single factor once [WiP]
~17% faster, many optimisation opportunities still missed  >:)
2020-10-26 15:06:28 -05:00
nicoo
3743a3e1e7 factor: Derecursify and refactor
~7% slowdown, paves the way for upcoming improvements
2020-10-26 15:06:28 -05:00
nicoo
8643489096 factor::Factors: Use a RefCell rather than copy data when printing
~2.9% faster than the previous commit, ~11% faster than “master” overall.
2020-10-26 15:06:28 -05:00
nicoo
30f9cf32f2 factor::Decomposition: Use a flat vector representation
~18% faster than BTreeMap, and ~5% faster than 'master'
2020-10-26 15:06:27 -05:00
nicoo
b8ef58c002 factor::Factors: Split off a Decomposition type
The new type can be used to represent in-progress factorisations,
which contain non-prime factors.
2020-10-26 15:06:27 -05:00
nicoo
6158cd5714 factor: Introduce a type alias for exponents
This way, we can easily replace u8 with a larger type when moving to support
larger integers.
2020-10-26 15:06:27 -05:00
Sylvestre Ledru
af151703b3 refactor(rmdir): use clap instead of getopts 2020-10-26 09:53:55 +01:00
Sylvestre Ledru
17a99f8e53 refactor(printenv): use clap instead of getopts 2020-10-26 09:52:53 +01:00
Roy Ivy III
5837bc4fc9
Merge pull request #1610 from sylvestre/sort-clap
refactor(sort): move to use of 'clap'
2020-10-25 18:56:58 -05:00
Roy Ivy III
a9fb64abb4
Merge pull request #1612 from sylvestre/clap-seq
Move seq to use of 'clap'
2020-10-25 18:56:24 -05:00
Sylvestre Ledru
dc4eb79329 refactor/sort ~ changes based on PR feedback
- change `const`=>`static` and remove unneeded help/version (supplied by default by `clap`)
- update of the ABOUT description
- move to alphabetical order (where reasonable)
- rename OPT_FILES => ARG_FILES
- change the order of the declarations
2020-10-25 11:14:15 -05:00