Commit graph

355 commits

Author SHA1 Message Date
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
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