Commit graph

6424 commits

Author SHA1 Message Date
Sylvestre Ledru
99764b8e6e Add "cuuser" to the spell ignore in tests 2021-09-05 18:54:43 +02:00
Sylvestre Ledru
1986d346dc Silent 'test_more_than_2_sets' on freebsd 2021-09-05 18:54:43 +02:00
Sylvestre Ledru
00221a4d36 Silent test_chown_only_group_id on freebsd 2021-09-05 18:54:43 +02:00
Sylvestre Ledru
7acdf31e2b freebsd: also fails the script when the tests fail 2021-09-05 18:54:43 +02:00
Sylvestre Ledru
fd4fd36a3e
Merge pull request #2637 from devnexen/fsext_obsd
fsext build fix for OpenBSD.
2021-09-05 16:11:45 +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
Mahmoud Soltan
9bc14a239c
Added support for ls -l --color to color symlink targets as well. (#2627)
* Fixed some documentation of display_item_long that was missed in #2623

* Implemented coloring of `ls -l` symlink targets( after the arrow `->`).

* Documented display_file_name to some extent.

* Ran rustfmt as part of mitigating CI chain errors.

* Removed unused variables and code in test_ls_long_format as per #2623

specifically, as per
https://github.com/uutils/coreutils/pull/2623#pullrequestreview-742386707

* Added a thorough test for `ls -laR --color` symlink coloring implemented in this branch.

* renamed test files and dirs to shorter names and ran rustfmt.

* Changed the order with which files are expected to match the change in their name.

* Bettered some comments.

* Removed needless borrow. Fixed that one clippy warning.

* Moved the cfg not windows up to the function level

because this function is meant to only run in non-windows OS (with
groups and unames).

Fixes the unused variable warning in CI.
2021-09-05 13:25:56 +02:00
Sylvestre Ledru
6226a03214
Merge pull request #2624 from miDeb/cp/acl
cp: correctly copy mode, ownership, acl and context
2021-09-03 20:18:13 +02:00
Sylvestre Ledru
ad2a3063b7
Merge pull request #2632 from miDeb/fixup-comment
uucore/perms: remove erroneous comment
2021-09-03 20:15:52 +02:00
Michael Debertol
b62d89e4bf
Merge pull request #2635 from blyxxyz/fix-ci
Update num-bigint to 0.4.2 to fix CI
2021-09-03 19:28:35 +02:00
Jan Verbeek
3f6ca4723e Update num-bigint to 0.4.2 to fix CI 2021-09-03 19:24:02 +02:00
Michael Debertol
6a6da71403 cp: add a test for #2631 2021-09-03 14:56:35 +02:00
Michael Debertol
d1c3a8f69a uucore/perms: remove erroneous comment 2021-09-03 14:37:47 +02:00
Sylvestre Ledru
499f10ca1f
Merge branch 'master' into ls/special-chars-in-double-quotes 2021-09-03 09:00:54 +02:00
Sylvestre Ledru
192380d0ba
Merge pull request #2629 from miDeb/chown-base
chown/chgrp: share more code & refactor
2021-09-03 08:59:40 +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
Sylvestre Ledru
0f5a3a6ac4
Merge pull request #2628 from miDeb/chgrp/no-x
uucore/perms: correct some error messages
2021-09-02 08:38:56 +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
Michael Debertol
a517671d55
Merge pull request #2621 from blyxxyz/filename-quoting
Implement proper quoting/escaping for filenames
2021-09-01 14:15:44 +02:00
Jan Verbeek
7bf85751b0 uucore::display: Fix tests 2021-09-01 00:37:21 +02:00
Michael Debertol
ef9c5d4fcf cp: canonicalize paths upfront
This way later code can assume `src` and `dest` to be the actual paths
of source and destination, and do not have to constantly check
`options.dereference`.

This requires moving the error context calculation to the beginning as
well, since later steps no longer operate with the same file paths as
supplied by the user.
2021-09-01 00:16:22 +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
Justin Tracey
575fbd4cb7 join: make autoformat actually construct a format
Makes the -o auto option construct a format at initialization, rather
than try to handle it as a special case when printing lines. Fixes bugs
when combined with -e, especially when combined with -a.
2021-08-31 23:55:15 +02:00
Jan Verbeek
7ca2f4989f ls: Hide unused variable warnings 2021-08-31 22:07:24 +02:00
Jan Verbeek
ffe63945b7 wc: Update path display 2021-08-31 22:07:24 +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
483a5fd1d4 ls: Process OsStrings instead of Strings 2021-08-31 22:07:24 +02:00
Jan Verbeek
4d6faae555 ls: Fix --{show, hide}-control-chars logic 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
b5550bc4dd ls: Accept badly-encoded filenames 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
03b2d40154 rmdir: use modern filename display 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
Sylvestre Ledru
2bd556e252
Merge pull request #2625 from miDeb/nightly-for-cov
CICD: use nightly rust for code coverage
2021-08-31 15:45:49 +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
Michael Debertol
1e78a40e20 CICD: use nightly rust for code coverage 2021-08-30 23:13:31 +02:00
Mahmoud Soltan
97a0c06ff4
Proper columns for ls -l (#2623)
* Used .as_path() and .as_str() when required:

when the argument required is a Path and not a PathBuf,
or an str and not a Path, respectively.

* Changed display_items to take Vec<PathData>, which is passed, instead of [PathData]

* Added a pad_right function.

* Implemented column-formating to mimic the behavior of GNU coreutils's ls

Added returns in display_dir_entry_size that keep track of uname and
group lengths.
Renamed variables to make more sense.
Changed display_item_long to take all the lengths it needs to render
correctly.
Implemented owner, group, and author padding right to mimic GNU ls.

* Added a todo for future quality-of-life cache addition.

* Documented display_item_long, as a first step in documenting all functions.

* Revert "Used .as_path() and .as_str() when required:"

This reverts commit b88db6a817.

* Revert "Changed display_items to take Vec<PathData>, which is passed, instead of [PathData]"

This reverts commit 0c690dda8d.

* Ran cargo fmt to get rid of Style/format `fmt` testing error.

* Added a test for `ls -l` and `ls -lan` line formats.

* Changed uname -> username for cspell. Removed extra blank line for rustfmt.
2021-08-30 23:09:16 +02:00
Terts Diepraam
67e7fdfc2e ls: use single quotes when $, \ or ` are present in a filename 2021-08-30 10:40:38 +02:00
Michael Debertol
d247cbd7e5
Merge pull request #2619 from uutils/sylvestre-patch-7
Update to freebsd-vm@v0.1.5
2021-08-29 19:49:14 +02:00
Sylvestre Ledru
3ed74df4a6 Update to freebsd-vm@v0.1.5 2021-08-29 18:35:08 +02:00
Sylvestre Ledru
5170427361
Merge pull request #2612 from jfinkels/seq-width-scientific-notation
seq: compute width of numbers after parsing
2021-08-29 10:30:36 +02:00
Jeffrey Finkelstein
5cd55391ec seq: compute width of numbers after parsing
Fix a bug in `seq` where the number of characters needed to print the
number was computed incorrectly in some cases. This commit changes the
computation of the width to be after parsing the number instead of
before, in order to accommodate inputs like `1e3`, which requires four
digits when printing the number, not three.
2021-08-28 17:43:36 -04:00
Sylvestre Ledru
64a65370b0
Merge pull request #2611 from sylvestre/freebsd-warnings
Remove some warnings on freebsd
2021-08-28 23:24:24 +02:00
Jan Verbeek
b4c95d49d8
pwd: Properly resolve logical working directory (#2604)
* pwd: Properly resolve logical working directory

* fixup! pwd: Properly resolve logical working directory

* fixup! pwd: Properly resolve logical working directory
2021-08-28 22:31:20 +02:00
Sylvestre Ledru
2c3e401b0b Remove some warnings on freebsd 2021-08-28 15:06:44 +02:00