Commit graph

522 commits

Author SHA1 Message Date
Terts Diepraam
4701ea0c95 uucore: use split_once in canon_host 2022-04-02 15:18:34 +02:00
Terts Diepraam
b7809bd889 version 0.0.13 2022-04-02 11:04:27 +02:00
Hanif Ariffin
5c85f5a9d4
Fix incorrect usage of CString because it didn't come from us (#3279) 2022-03-30 09:53:09 +02:00
Jeffrey Finkelstein
6a8ce447b7 uucore: no uppercase suffixes in parse_time
Disallow uppercase unit suffixes "S", "M", "H", and "D" in
`uucore::parse_time::from_str()` to match the behavior of GNU `sleep`
and `timeout`.
2022-03-26 10:39:00 -04:00
Jeffrey Finkelstein
e357d2650c clippy fixes from nightly rust 2022-03-22 21:44:33 -04:00
Terts Diepraam
fc1fa8d1f7
Merge pull request #3027 from shoriminimoe/2986-cp
cp: only allow directory for -t
2022-03-22 23:08:54 +01:00
Sylvestre Ledru
c19a8feb22
Merge pull request #3291 from devnexen/illumos_build_fix
fsext solaris/illumos build fix
2022-03-22 20:07:47 +01:00
Jeffrey Finkelstein
f4af226820 uucore: error on negative interval in parse_time
Return an error when a negative interval is provided as the argument
to `uucore::parse_time::from_str()`, since a `Duration` should only be
non-negative.
2022-03-21 21:11:31 -04:00
David Carlier
d8102503bf fsext solaris/illumos build fix 2022-03-21 23:20:22 +00:00
Sylvestre Ledru
7963287c6c
Merge pull request #3282 from uutils/dependabot/cargo/libc-0.2.121
build(deps): bump libc from 0.2.113 to 0.2.121
2022-03-21 17:49:11 +01:00
Sylvestre Ledru
435c983b36
Merge pull request #3087 from water-ghosts/printf-general
printf - Update %g formatting to match GNU
2022-03-21 13:23:28 +01:00
dependabot[bot]
34d2d1d05e
build(deps): bump libc from 0.2.113 to 0.2.121
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.113 to 0.2.121.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.113...0.2.121)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-20 18:14:52 +00:00
Sam Caldwell
f40fecf86d Add UError impl for clap::Error 2022-03-20 13:50:39 +01:00
Terts Diepraam
d90a81fb46 all utils: remove short help flag if another -h flag is present 2022-03-20 11:16:20 +01:00
Eli Youngs
a0bd88b51b Add comments and an additional test 2022-03-20 00:44:09 -07:00
Sylvestre Ledru
3c88fb460b
Merge branch 'main' into dependabot/cargo/clap-3.1.6 2022-03-19 09:26:05 +01:00
Jeffrey Finkelstein
388cb6c83a uucore: use Duration::saturating_mul in parse_time
Use `Duration::saturating_mul()` to avoid a panic due to overflow in
`uucore::parse_time::from_str()`. This change prevents panic on very
large arguments to timeout and sleep.
2022-03-18 23:15:02 -04:00
Terts Diepraam
04de1251dd
Merge branch 'main' into dependabot/cargo/clap-3.1.6 2022-03-18 09:54:04 +01:00
Benjamin Bouvier
ba5b2dc2ed
Remove unused dependencies by individual crates (#3264) 2022-03-17 22:48:17 +01:00
Terts Diepraam
20212be4c8 fix clippy errors related to clap upgrade from 3.0.10 to 3.1.6 2022-03-17 22:46:56 +01:00
dependabot[bot]
59440d35c0
build(deps): bump clap from 3.0.10 to 3.1.6
Bumps [clap](https://github.com/clap-rs/clap) from 3.0.10 to 3.1.6.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v3.0.10...v3.1.6)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-17 13:06:29 +00:00
Eli Youngs
2afa9cd1a0 printf - Update %g formatting to match GNU 2022-03-11 23:43:59 +01:00
Sylvestre Ledru
2e860e7048
Merge pull request #3116 from nickd0/printf-round-fix
printf: fix printf sci notation round up
2022-03-09 19:47:52 +01:00
Nick Donald
a74ffac19e printf: fix printf sci notation round up 2022-03-07 07:01:21 +01:00
dependabot[bot]
2e50eade7f
build(deps): bump once_cell from 1.9.0 to 1.10.0
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-06 22:35:33 +00:00
Sylvestre Ledru
54a10e955a Update of the cargo.lock url to point to the right branch 2022-03-06 22:13:17 +01:00
Davide Cavalca
19af43222b Include license text in all published crates 2022-03-05 21:21:46 +01:00
Hanif Ariffin
30a174e6e4
realpath: Error when resolved symlink is absolute and ENOENT (#3037)
* realpath: Match behavior where resolving symlinks with absolute path is an error if ENOENT

This PR changes `realpath` to match the behavior in GNU where,

```shell
hbina@akarin ~/Documents> mkdir dir1
hbina@akarin ~/Documents> mkdir dir2
hbina@akarin ~/Documents> touch dir2/bar
hbina@akarin ~/Documents> ln -s ../dir2/bar dir1/foo1
hbina@akarin ~/Documents> ln -s /dir2/bar dir1/foo2
hbina@akarin ~/Documents> ln -s ../dir2/baz dir1/foo3
hbina@akarin ~/Documents> realpath ./dir1/foo1 ./dir1/foo2 ./dir1/foo3
/home/hbina/Documents/dir2/bar
realpath: ./dir1/foo2: No such file or directory
/home/hbina/Documents/dir2/baz
```

Currently, our `realpath` will happily print the second one out,

```shell
hbina@akarin ~/Documents> ~/git/uutils/target/debug/coreutils realpath ./dir1/foo1 ./dir1/foo2 ./dir1/foo3
/home/hbina/Documents/dir2/bar
/dir2/bar
/home/hbina/Documents/dir2/baz
```

Closes https://github.com/uutils/coreutils/issues/3036

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-03-03 23:06:15 +01:00
Omer Tuchfeld
b6c952c46e Fix parse_size to use u64 rather than usize for better 32-bit support
Using usize limits 32-bit platforms to operate only on sizes of 4GiB
or less. While 32-bit platforms only have 4GiB of addressable memory,
not all operations require the data to be entirely in memory, so this
limitation can be lifted if we use u64 instead of usize.

This only fixes the core function, further commits fix the utilities
making use of this function.
2022-02-22 11:09:40 +01:00
Terts Diepraam
53070141c1
all: add format_usage function (#3139)
This should correct the usage strings in both the `--help` and user documentation. Previously, sometimes the name of the utils did not show up correctly.
2022-02-21 17:14:03 +01:00
ndd7xv
f04f22b012 uucore(memo): refactor error propogation with new SubError enum 2022-02-17 22:43:30 -05:00
ndd7xv
1e12c46c24 uucore(memo): replace err_conv with result 2022-02-17 22:43:30 -05:00
Davide Cavalca
11688408a1 uucore, uucore_procs: use the correct URLs in the crate manifest 2022-02-12 21:31:39 -08:00
Sylvestre Ledru
0ed5e2c884
Merge pull request #2957 from jfinkels/head-preserve-no-final-newline
head: don't add trailing newline to end of file that didn't originally have one
2022-02-12 19:03:13 +01:00
Sylvestre Ledru
e76818bb19
Merge pull request #3083 from jfinkels/df-table-module
df: refactor data table into Row, Header structs
2022-02-12 11:30:28 +01:00
Eli Youngs
6e0fedc277 Fix panic when canonicalizing a nonexistent path 2022-02-08 20:19:13 -08:00
Jeffrey Finkelstein
44772a8dbb uucore: set meaningless FsUsage.ffree value to 0
Set the value of the `FsUsage.ffree` value to 0 on Windows, because
even though it is meaningless, it should not exceed the
`FsUsage.files` value so that client code can rely on the guarantee
that `FsUsage.ffree <= FsUsage.files`.
2022-02-06 21:54:58 -05:00
Eli Youngs
162f85773e printf: Support leading zeroes with %0n formatting 2022-02-05 00:43:09 -08:00
Sylvestre Ledru
b4c85b2c17
Merge pull request #2997 from tertsdiepraam/cp-allow-hyphen-suffix
`uucore`: allow backup suffix with hyphen value
2022-02-04 10:29:21 +01:00
Daniel Eades
4f8d1c5fcf add additional lints 2022-01-31 20:40:47 +01:00
Terts Diepraam
184b65df20 uucore: allow backup suffix with hyphen value 2022-01-31 12:10:57 +01:00
Jeffrey Finkelstein
b9c2066ee9 uucore: move lines.rs to be a uucore feature
Refactor the `lines.rs` module to be a feature in `uucore`. It was
common to both `head` and `tail`.
2022-01-30 22:15:35 -05:00
Daniel Eades
41e2197188 squash some repeated match blocks 2022-01-30 18:32:09 +01:00
Sylvestre Ledru
de07df5992
Merge pull request #2963 from danieleades/refactor/code-quality
Refactor/code quality
2022-01-30 18:26:16 +01:00
Daniel Eades
ba45fe312a use 'Self' and derive 'Default' where possible 2022-01-30 15:08:26 +01:00
Daniel Eades
2f85610cc3 remove explicit iter loops 2022-01-30 15:08:26 +01:00
Daniel Eades
784f2e2ea1 use semicolons if nothing returned 2022-01-30 15:08:26 +01:00
Daniel Eades
a2d5f06be4 remove needless pass by value 2022-01-30 15:08:26 +01:00
Daniel Eades
f2074140ec use 'char' instead of 'str' for single character patterns 2022-01-30 14:01:21 +01:00
Daniel Eades
5af66753af remove needless borrows 2022-01-30 14:01:21 +01:00
Sylvestre Ledru
2f6f6867c5
Merge branch 'main' into 2940 2022-01-30 13:33:35 +01:00
Dan Klose
bb7f37e8b4 fix: update itertools 0.8.0 -> 0.10.0
Targets https://github.com/uutils/coreutils/issues/2940

* since versions were mxing versions of x.y and x.y.z I changed all to x.y.z
* minor whitespace formatting
2022-01-29 22:35:51 +00:00
Terts Diepraam
eb82015b23 all: change macros
- Change the main! proc_macro to a bin! macro_rules macro.
- Reexport uucore_procs from uucore
- Make utils to not import uucore_procs directly
- Remove the `syn` dependency and don't parse proc_macro input (hopefully for faster compile times)
2022-01-29 15:26:32 +01:00
Sylvestre Ledru
7f79fef2cd fix various doc warnings 2022-01-29 00:09:09 +01:00
Sylvestre Ledru
5932937952
Merge pull request #2777 from jfinkels/uucore-printf
uucore: move printf::memo module to uucore
2022-01-25 23:22:27 +01:00
Sylvestre Ledru
c4a74c2231
Fix doc warnings in entries.rs (#2901) 2022-01-21 23:13:54 +01:00
Terts Diepraam
55a47f6fc0
Merge pull request #2863 from tertsdiepraam/clap-3
Clap 3
2022-01-20 23:14:52 +01:00
Roy Ivy III
2e251f91f1 0.0.12 2022-01-19 05:35:00 -06:00
Jeffrey Finkelstein
d9afdf0527 uucore: move printf::memo module to uucore
Move the `printf::memo` module to `uucore` so that it can be used by
other programs, not just `printf`. For example, the `-f` option to `seq`
requires parsing and formatting numbers according to the same logic as
`printf`.
2022-01-17 08:46:45 -05:00
Terts Diepraam
8872485922 Merge branch 'main' into clap-3 2022-01-17 13:25:51 +01:00
Sylvestre Ledru
1fbda8003c coreutils 0.0.8 => 0.0.9, uucore_procs 0.0.7 => 0.0.8, uucore 0.0.10 => 0.0.11 2022-01-16 17:05:48 +01:00
Terts Diepraam
37ab05bd7a cp: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
c76a06e6ea uucore: clap 3 2022-01-11 19:16:47 +01:00
Sylvestre Ledru
6723a54610
Merge pull request #2862 from rivy/fix.whitespace
refactor/polish ~ whitespace fixup
2022-01-11 17:51:37 +01:00
Terts Diepraam
f60c36f242
Merge pull request #2610 from miDeb/cp/abuse
cp: handle edge cases when dest is a symlink
2022-01-11 00:34:55 +01:00
Roy Ivy III
7a760cae99 refactor/polish ~ re-normalize whitespace
* minimize inconsistent/invisible whitespace

- consistent indentation (either spaces-only, tabs, *or* tabs with following spaces [for indentation])
- no internal/invisible tabs
- no trailing whitespace
- EOF EOLNs
2022-01-09 21:35:39 -06:00
Roy Ivy III
774e72551b change ~ relax 'nix' version and remove 'nix' patch
- code coverage compilation on MacOS latest (MacOS-11+) now works with newer 'nix' versions
2022-01-09 18:57:25 -06:00
Sylvestre Ledru
969f3cbf39
Merge pull request #2793 from tertsdiepraam/cksum-result-io-error
`cksum`: use `UIoError`
2022-01-07 21:47:01 +01:00
Terts Diepraam
7fa720d311 fix lint, fmt & udeps errors 2022-01-01 19:43:44 +01:00
Terts Diepraam
62341112df remove cut-specific macros 2022-01-01 18:50:34 +01:00
Terts Diepraam
c075f105a4 remove unnecessary and unused macros 2022-01-01 18:31:47 +01:00
Jeffrey Finkelstein
f2bf1a7ff7 fixes suggested by nightly version of clippy 2021-12-26 15:45:33 -05:00
Terts Diepraam
8885263ad5 cksum: use UIoError 2021-12-26 18:41:25 +01:00
Ryan Gonzalez
23c0734a62 uucore::fsext: Fix mountinfo parsing w/ multiple optional fields
proc(5) mentions the following for the fields section and hyphen:

> (7)  optional fields: zero or more fields of the form "tag[:value]";
> see below.
> (8)  separator: the end of the optional fields is marked by a single
> hyphen.

IOW, there may actually be multiple optional fields, not just one, in
which case the previously hardcoded indexes for the filesystem type and
device name are now incorrect. Now, the filesystem type and device name
are parsed relative to the hypen's location, ensuring that they will be
correct regardless of the number of optional fields.

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
2021-12-20 08:46:22 -06:00
Jan Verbeek
ceff2690d2 getgroups: Reuse buffer, add comment about performance 2021-11-26 14:48:34 +01:00
Jan Verbeek
b125159535 getgroups: Handle race conditions properly 2021-11-26 14:48:34 +01:00
Jan Verbeek
412a81e7bf uucore::entries: Remove unnecessary unsafe Vec operations 2021-11-26 14:48:33 +01:00
Jan Verbeek
f2ddae93fa uucore::entries: Make Passwd::locate and Group::locate thread-safe 2021-11-26 14:48:33 +01:00
Roy Ivy III
03e0cbb020 update 'nix' within workspace to force patched version 2021-11-19 17:55:03 -06:00
Sylvestre Ledru
6c6e047453
Merge pull request #2586 from Funky185540/docs/document-macros
macros: Add documentation with examples to macros
2021-11-19 21:50:38 +01:00
Sylvestre Ledru
b4416abc82
Merge pull request #2743 from thomasqueirozb/who_uresult
who: use UResult
2021-11-19 21:41:14 +01:00
Thomas Queiroz
235152a6b7
uucore/utmpx: remove unwrap in cannon_host
Default to hostname if getaddrinfo fails
2021-11-09 20:00:34 -03:00
Jan Verbeek
77e1570ea0 Move display::Quotable into its own crate
The standalone version has a number of bugfixes compared to the old
version.
2021-11-08 23:07:40 +01:00
Michael Debertol
bb35b0c37b uucore: add FileInformation 2021-11-01 22:38:44 +01:00
Thomas Queiroz
007f1b9f84
uu+tests: use strip_prefix and strip_suffix 2021-10-24 12:23:32 -03:00
Sylvestre Ledru
59e9870c56 Prepare version 0.0.8 2021-10-23 19:21:50 +02:00
James Robson
0b2483452a Add symbolic mode support to mkdir 2021-10-16 12:57:55 +01:00
Sylvestre Ledru
a0f538f2e8
Merge pull request #2679 from blyxxyz/uucore-inspection
uucore: Minor cleanup
2021-09-19 22:28:16 +02:00
Sylvestre Ledru
522d4d39e3
Merge pull request #2680 from blyxxyz/utmpx-safety
uucore::utmpx: Make thread-safe
2021-09-18 16:15:52 +02:00
Jeffrey Finkelstein
f95ab2f43c uucore(panic): guard against "Broken pipe" panics
Add "Broken pipe" to the set of panic messages used to determine whether
a panic is caused by a broken pipe error.
2021-09-14 21:26:50 -04:00
Jan Verbeek
519c0d16b3 uucore::utmpx: Make thread-safe 2021-09-14 21:17:50 +02:00
Michael Debertol
5c97c1ccc4
Merge pull request #2678 from blyxxyz/io-error-detect-os
Do not discard non-OS error messages
2021-09-14 20:21:48 +02:00
Jan Verbeek
601ea3ef19 uucore::process: Add a few notes 2021-09-14 19:55:00 +02:00
Jan Verbeek
cc652c7fe9 uucore::mode: Add notes about umask and platform support 2021-09-14 19:54:40 +02:00
Jan Verbeek
8cfe0290cd uucore::fsext: Avoid unnecessary allocations 2021-09-14 18:28:09 +02:00
Jan Verbeek
9d5133157a uucore::fsext: Replace some unsafe calls
GetLastError() and libc::stat() were unnecessary as libstd offered
equivalents.

LPWSTR2String() was technically unsafe if passed a slice without
zeroes, but it's a private function and was probably always called
correctly in practice.
2021-09-14 18:28:09 +02:00
Jan Verbeek
1edd2bf3a8 Do not discard non-OS error messages 2021-09-14 15:11:54 +02:00
Sylvestre Ledru
2a4422997d Restrict some crates to specific OS 2021-09-13 22:45:55 +02:00
Jan Verbeek
d6a8485115 uucore::pipes: Expand documentation 2021-09-10 22:03:51 +02:00
Jan Verbeek
c1079e0b1c Move common pipe and splice functions into uucore
This cuts down on repetitive unsafe code and repetitive code in
general.
2021-09-10 21:24:34 +02:00
Andreas Hartmann
6fec0bfe24 macros: Add documentation with examples to macros 2021-09-10 08:39:49 +02:00
Jan Verbeek
259f18fcab Update message quoting and filename printing 2021-09-07 19:49:01 +02:00
Jan Verbeek
60df3c6b7c uucore: Cache args_os(), util_name(), execution_phrase()
And remove args() because there's no valid use for it, invalid unicode
handling is specified in a different way.
2021-09-07 18:51:25 +02:00
Jan Verbeek
7791207870 Preserve error message for "other" I/O errors
These errors still have a unique message even if the ErrorKind enum
doesn't classify them.
2021-09-06 23:24:31 +02:00
David Carlier
5587face61 fsext build fix for OpenBSD.
prioritising statfs over statvfs for this platform.
2021-09-05 13:06:25 +01:00
Sylvestre Ledru
6226a03214
Merge pull request #2624 from miDeb/cp/acl
cp: correctly copy mode, ownership, acl and context
2021-09-03 20:18:13 +02:00
Michael Debertol
d1c3a8f69a uucore/perms: remove erroneous comment 2021-09-03 14:37:47 +02:00
Michael Debertol
435b7a22fb uucore/perms: add more information to an error message
This reverts part of https://github.com/uutils/coreutils/pull/2628,
because (even though it got the test passing) it was the wrong bug fix.
2021-09-03 00:50:04 +02:00
Michael Debertol
a7f6b4420a uucore/perms: take traverse_symlinks into account 2021-09-03 00:50:04 +02:00
Michael Debertol
a4fca2d4fc uucore/perms: remove flags in favor of enums
Part of the code was transliterated from GNU's implementation in C,
and used flags to store settings. Instead, we can use enums to avoid
magic values or binary operations to extract flags.
2021-09-03 00:50:04 +02:00
Michael Debertol
195f827cd4 chown/chgrp: share more code
Also share argument parsing code between `chgrp` and `chown`
2021-09-03 00:50:04 +02:00
Michael Debertol
18fc4076cf uucore/perms: correct some error messages
- prevent duplicate errors from both us and `walkdir` by instructing `walkdir'
  to skip directories we failed to read metadata for.
- don't directly display `walkdir`'s errors, but format them ourselves to
  match gnu's format
2021-09-01 18:40:06 +02:00
Jan Verbeek
7bf85751b0 uucore::display: Fix tests 2021-09-01 00:37:21 +02:00
Michael Debertol
8b74562820 cp: correctly copy mode, ownership, acl and context
Fix a mix-up between ownership and mode. The latter (mode / file permissions)
can also be set on windows (which however only affects the read-only flag),
while there doesn't seem to be a straight-forward way to change file ownership
on windows.

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

Copy the SELinux context if possible.
2021-09-01 00:16:22 +02:00
Jan Verbeek
3dd6f79880 uucore::display: Remove escape_control, tweak special characters 2021-08-31 22:07:24 +02:00
Jan Verbeek
f0f13fe1f0 uucore::display: Simplify
The different quoting implementations are similar enough to merge
parts of them.
2021-08-31 22:07:24 +02:00
Jan Verbeek
a93959aa44 uucore::display: impl Quotable for Cow<str>, add escape_control 2021-08-31 22:07:24 +02:00
Jan Verbeek
13bb263a50 uucore::display: Support unquoted text 2021-08-31 22:07:24 +02:00
Jan Verbeek
0e1f8f7b34 Move verbatim path printing to uucore::Display 2021-08-31 22:07:24 +02:00
Jan Verbeek
4f891add5a uucore: Add a Quotable extension trait for displaying filenames 2021-08-31 22:07:24 +02:00
Michael Debertol
b82401e744 uucore: fall back to stripping the error message for unexpected io error kinds
Rust recently added new error kinds, which causes tests to fail on beta/nightly.
However, we can't match for these new error kinds because they are marked as unstable.
As a workaround we call `.to_string()` on the original error and strip
the ` (os error XX)` bit. The downside of this is that
the error messages are not capitalized.
2021-08-31 00:36:35 +02:00
Sylvestre Ledru
0e49913b84
Merge branch 'master' into chmod/compat 2021-08-28 11:21:26 +02:00
Sylvestre Ledru
33055f7152
Merge pull request #2597 from miDeb/resolve-dangling
uucore/fs: use the latest resolution that did not fail
2021-08-28 09:55:44 +02:00
Jan Verbeek
1c05183083 Move strip_errno to libcore 2021-08-28 02:26:01 +02:00
Andreas Hartmann
c756878b20 backup_control: Use C-locale quotes in outputs 2021-08-25 16:33:50 +02:00
Andreas Hartmann
6c86957a24 backup_control: Fix internal tests
Adapt the tests to work with the changed function interfaces. Added a
convenience function to construct a `clap` application that's used to test the
functions from a "user"-perspective.
2021-08-25 16:33:50 +02:00
Andreas Hartmann
6f4e43e7c6 backup_control: Update docs
Add documentation to the module itself and update existing documentations for
functions whose interfaces changed. Add more doctests.
2021-08-25 16:33:50 +02:00
Andreas Hartmann
e132fd49d9 backup_control: Rework function interfaces
Change all relevant functions to return `UResult`s from `BackupError` instead
of error strings. Make `determine_backup_mode/suffix` accept `clap::ArgMatches`
as input argument to parse for the arguments themselves, using the arguments
with are defined in the `arguments` submodule.

This way the user only needs to include the pre-defined arguments from the
`arguments` module and passes a reference to the applications `ArgMatches` into
the respective functions here. The functions then take care of handling the
arguments. It is recommended to use the arguments provided in the `arguments`
module over custom-defined ones.
2021-08-25 16:33:50 +02:00
Andreas Hartmann
54086ef4c5 backup_control: Implement custom error type
Implements an error type based on `UError` that replaces the previously used
error strings. The errors are currently returned when determining the backup
mode, but extensions for future uses are already in place as comments.
2021-08-25 16:33:50 +02:00
Andreas Hartmann
2c6410f4d8 backup_control: Add arguments module
Contains functions that create the CLI arguments associated with the backup
functionality.
2021-08-25 16:33:50 +02:00
Sylvestre Ledru
baebefcb6a
Merge pull request #2442 from sylvestre/doc
Document the source documentation + document some modules
2021-08-25 14:09:01 +02:00
Andreas Hartmann
4fbb741314 macros: Remove obsolete macros
Removes the `return_if_err!` and `safe_unwrap!` macros, which have now
been replaces by `crash_if_err!` throughout the whole code and thus
aren't used any longer.
2021-08-25 13:59:39 +02:00
Michael Debertol
38afdd6ab4 uucore/mode: add cast for some platforms 2021-08-25 13:52:09 +02:00
Michael Debertol
945e57ea22 chmod: show an error if a permission wasn't removed due to umask 2021-08-25 13:52:09 +02:00
Michael Debertol
15b40f6aa2 chmod: implement special handling of directory setuid/setgid 2021-08-25 13:52:09 +02:00
Michael Debertol
9697c89d17 uucore/mode: handle mode 0
Trimming all '0' characters results in an invalid string if the string
contained only '0's.
2021-08-25 13:52:09 +02:00
Jan Verbeek
e5d6c6970b yes: Cleanup
Report errors properly instead of panicking.

Replace zero_copy by a simpler specialized private module.

Do not assume splices move all data at once.

Use the modern uutils machinery.

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

yes: Add tests

yes: Fix long input test on Windows
2021-08-25 13:45:44 +02:00
Sylvestre Ledru
eb6ab9f883 Document some modules 2021-08-24 23:00:00 +02:00
Sylvestre Ledru
111d3e37bb
Merge pull request #2570 from miDeb/chgrp/no-duplication
chgrp/chown: move common code to `uucore`
2021-08-24 21:58:15 +02:00
Sylvestre Ledru
7c62337229
Merge pull request #2589 from devnexen/itmpx_netbsd
uucore netbsd update
2021-08-24 21:57:22 +02:00
Michael Debertol
ea41cc0ff6 uucore/fs: use the latest resolution that did not fail
When we ignore failures resolving symbolic links we should keep the
latest resolution that did not fail, not the original path.
2021-08-24 21:18:10 +02:00
Jan Verbeek
d06c074829 Run clippy on the full workspace
These lints were cluttering up the "problems" tab in my VS
Code. `--workspace` fixes the disparity.
2021-08-24 17:10:16 +02:00
Michael Debertol
4e251706be refactor: move shared chown logic to uucore 2021-08-24 15:22:05 +02:00
Michael Debertol
7153a595c6 chgrp: forward to chown
chgrp does mostly the same as chown.
By making chown a bit more configurable we can reuse its code for chgrp.
2021-08-24 15:22:05 +02:00
David Carlier
554d53c0ed uucore netbsd update
fsext build fix and utmpx implementation proposal.
2021-08-23 16:21:18 +01:00
Sylvestre Ledru
114c9a409c
Merge pull request #2471 from miDeb/real-exe-name
make executable!() return the real executable name
2021-08-22 16:55:06 +02:00
Sylvestre Ledru
8337aeb4d6 bump a few crates to simplify Debian packaging 2021-08-21 23:34:45 +02:00
Michael Debertol
5e07d58a4d
Merge pull request #2459 from jaggededgedjustice/realpath-add-physical-mode
Add Physical mode to realpath
2021-08-21 02:01:10 +02:00
Michael Debertol
252220e9eb refactor/uucore ~ make util_name and execution_phrase functions
Since util_name and execution_phrase no longer rely on features that are
only available to macros, they may as well be plain functions.
2021-08-14 17:55:18 +02:00
Michael Debertol
5f2335829a refactor ~ revert to single quotes for "Try '{0 --help'"
This is a test expectation for gnu.
2021-08-14 17:22:09 +02:00