Commit graph

511 commits

Author SHA1 Message Date
dependabot[bot]
68f2b44c88
build(deps): bump dunce from 1.0.2 to 1.0.3
Bumps [dunce](https://gitlab.com/kornelski/dunce) from 1.0.2 to 1.0.3.
- [Release notes](https://gitlab.com/kornelski/dunce/tags)
- [Commits](https://gitlab.com/kornelski/dunce/commits/v1.0.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-12 16:54:02 +00:00
Terts Diepraam
f15c4f2d3e Version 0.0.16 2022-10-11 23:03:39 +02:00
Daniel Hofstetter
9e8daf92dd Replace deprecated value_of() with get_one() 2022-09-26 16:42:42 +02:00
Niyaz Nigmatullin
90babe2775 uucore: remove is_symlink function
Since Rust 1.58 there is `is_symlink` method for `Path`
2022-09-23 20:32:09 +03:00
Terts Diepraam
975a1d170d change remaining usage codes of 2 to 1 for GNU compat 2022-09-10 20:24:24 +02:00
Jeffrey Finkelstein
8458bf1387 Clippy fixes in multiple crates 2022-08-23 18:30:43 -04:00
Terts Diepraam
15180249fc Version 0.0.15 2022-08-20 13:13:22 +02:00
dependabot[bot]
6193cdbba8
build(deps): bump libc from 0.2.131 to 0.2.132
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.131 to 0.2.132.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.131...0.2.132)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-19 12:22:35 +00:00
Sylvestre Ledru
b7ea400861
Merge pull request #3837 from tertsdiepraam/remove-more-error-macros
`uucore` & `cp`: remove `show_error_custom_description` macros `show_usage_error`
2022-08-19 10:01:49 +02:00
Sylvestre Ledru
fb4ddd5310
Merge pull request #3844 from tertsdiepraam/ranges-refactor
`uucore::ranges`: Refactor, document and test
2022-08-19 09:02:35 +02:00
Terts Diepraam
003b483705 uucore/ranges: refactor and test complement 2022-08-18 21:27:32 +02:00
Terts Diepraam
7890228f82 uucore/ranges: document and test merge operation 2022-08-18 19:45:56 +02:00
Terts Diepraam
e9e9a8166f uucore/ranges: refactor FromStr impl 2022-08-18 19:45:18 +02:00
Sylvestre Ledru
88261f36dd
Merge pull request #3834 from uutils/dependabot/cargo/once_cell-1.13.1
build(deps): bump once_cell from 1.13.0 to 1.13.1
2022-08-18 13:35:59 +02:00
Terts Diepraam
b983355bc4 uucore & cp: remove show_error_custom_description macros show_usage_error 2022-08-18 10:44:59 +02:00
Sylvestre Ledru
87e3899477
Merge pull request #3832 from tertsdiepraam/simplify-encoding-handling
Simplify invalid encoding handling
2022-08-17 18:59:59 +02:00
dependabot[bot]
e465d0520f
build(deps): bump once_cell from 1.13.0 to 1.13.1
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.13.0 to 1.13.1.
- [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.13.0...v1.13.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-17 16:20:25 +00:00
Terts Diepraam
ba713b6365 Simplify invalid encoding handling into two small methods of Args
The previous encoding handling was unnecessarily complex. This commit removes the enum that specifies the handling and instead has two separate methods to collect the strings either with lossy conversion or by ignoring invalidly encoded strings.
2022-08-17 15:20:20 +02:00
Terts Diepraam
5621502a95 all: remove accept_{any, complete, lossy} and ConversionResult
Outside of tests, only `accept_any` was used, meaning that this unnecessarily complicated the code. The behaviour of `accept_any` is now the default (and only) option.
2022-08-17 14:57:28 +02:00
Terts Diepraam
0ed8b97a3f uucore: remove panic encoding handling
We never want utilities to panic on invalid input and it is not currently in use, so it can be removed safely.
2022-08-17 14:29:53 +02:00
Niyaz Nigmatullin
9cd898b885 remove nix 0.24.2 dependency 2022-08-17 13:13:27 +03:00
Niyaz Nigmatullin
5af152be2c uucore/fs: add Not a directory cases handling, e.g. for trailing slashes 2022-08-15 22:47:03 +03:00
David Carlier
b5bb070777 while at it, let's do OpenBSD. 2022-08-13 10:21:30 +01:00
David Carlier
36561c9526 uucore fix NetBSD build. 2022-08-13 08:24:45 +01:00
Daniel Hofstetter
fcb7185279 Disable "broken intra doc links" lint 2022-08-12 14:48:59 +02:00
Daniel Hofstetter
c0c26c4c58 Replace deprecated values_of() with get_many() 2022-08-11 13:49:09 +02:00
Ackerley Tng
defde8c91e uucore: add parse_glob module 2022-08-09 10:36:23 +02:00
Daniel Hofstetter
7c3116330e Replace deprecated is_present() with contains_id() 2022-08-02 15:21:39 +02:00
Daniel Hofstetter
fc4544c42b bump clap from 3.1.18 to 3.2.15 2022-07-29 14:05:02 +02:00
Sylvestre Ledru
62305e67d1
Merge pull request #3719 from andrewbaptist/main
split: Don't overwrite files
2022-07-23 22:54:57 +02:00
Sylvestre Ledru
f82ada645e
Merge pull request #3731 from sylvestre/fs-doc
document some common fs functions
2022-07-22 13:29:15 +02:00
Andrew Baptist
f2cfc15a70 split: Don't overwrite files
Check that a file exists by calling create_new and changing the
interface of instantiate_current_writer to return a Result rather
than calling unwrap.
2022-07-21 12:06:13 -04:00
Sylvestre Ledru
ba44fd0e2b document some common fs functions 2022-07-20 17:51:53 +02:00
Niyaz Nigmatullin
9f2a9fa6ff uucore/fs: make function more generic 2022-07-19 17:34:52 +03:00
Niyaz Nigmatullin
80ff3b3b40 ln: change error messages, extract common code 2022-07-19 17:34:52 +03:00
Andrew Baptist
cc08e1cc3a Update to handle all the latest cargo warnings 2022-07-18 13:20:49 -04:00
dependabot[bot]
d15b95533e
build(deps): bump nix from 0.24.1 to 0.24.2
Bumps [nix](https://github.com/nix-rust/nix) from 0.24.1 to 0.24.2.
- [Release notes](https://github.com/nix-rust/nix/releases)
- [Changelog](https://github.com/nix-rust/nix/blob/v0.24.2/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/compare/v0.24.1...v0.24.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-18 06:41:18 +00:00
Niyaz Nigmatullin
4db08273b3 ln: error on --force when src=dst and dst is regular file 2022-07-18 08:17:37 +03:00
Sylvestre Ledru
882cd527ff
Merge pull request #3704 from Sciencentistguy/once_cell
Replace lazy_static with once_cell
2022-07-13 16:15:47 +02:00
Niyaz Nigmatullin
c829ecfd1d uucore/fs: get back to loop looking in windows as FileInformation
for directory is fixed
2022-07-12 17:15:16 +03:00
Jamie Quigley
1a270361c0
Replace lazy_static with once_cell 2022-07-12 14:08:30 +01:00
Terts Diepraam
6b00aec48e
Merge pull request #3602 from lendandgit/main
df: better error message when executed in a chroot without /proc #3601
2022-07-11 23:02:39 +02:00
Niyaz Nigmatullin
da5808d4ac
ls: add already listed message (#3707)
* ls: handle looping symlinks infinite printing

* ls: better coloring and printing symlinks when dereferenced

* tests/ls: add dereferencing and symlink loop tests

* ls: reformat changed using rustfmt

* ls: follow clippy advice for cleaner code

* uucore/fs: fix FileInformation to open directory handles in Windows as
well
2022-07-11 17:18:58 +02:00
Niyaz Nigmatullin
9d285e953d
Realpath symlinks handling, solves issue #3669 (#3703) 2022-07-10 16:49:25 +02:00
leon
9d554751ca df: better error message when executed in a chroot without /proc #3601 2022-07-07 15:24:00 +02:00
Sylvestre Ledru
38f5a47f76
Merge pull request #3698 from uutils/dependabot/cargo/once_cell-1.13.0
build(deps): bump once_cell from 1.12.0 to 1.13.0
2022-07-06 08:56:12 +02:00
dependabot[bot]
6a335236c1
build(deps): bump once_cell from 1.12.0 to 1.13.0
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.12.0 to 1.13.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.12.0...v1.13.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-07-05 06:51:26 +00:00
Sylvestre Ledru
7ca2ae4627
spell: Ignore backport 2022-07-05 08:31:45 +02:00
Jeffrey Finkelstein
df83d59b2d uucore: add backport for Path::is_symlink()
Add a `uucore::fs::is_symlink()` function that takes in a
`std::path::Path` and decides whether the given path is a symbolic
link. This is essentially a backport of the `Path::is_symlink()`
function that appears in Rust version 1.58.0. This commit also
replaces some now-duplicate code in `chmod`, `cp`, `ln`, and `rmdir`
that checks whether a path is a symbolic link with a call to
`is_symlink()`.

Technically, this commit slightly changes the behavior of
`cp`. Previously, there was a line of code like this

    if fs::symlink_metadata(&source)?.file_type().is_symlink() {

where the `?` operator propagates an error from `symlink_metadata()`
to the caller. Now the line of code is

    if is_symlink(source) {

in which any error from `symlink_metadata()` has been converted to
just be a `false` value. I believe this is a satisfactory tradeoff to
make, since an error in accessing the file will likely cause an error
later in the same code path.
2022-07-04 17:25:52 -04:00
Gergely Kalas
4f043ff57f Fix 'wc' gnu test-suite compatibility #3678
This change will extract a utility already present in ls to uucore.
This utility is used by dir and vdir too, which are adjusted to
look it up in uucode. No further changes to ls, dir or dirv intended.

The change here largely fiddles with the output of uu_wc to match
that of GNU wc. This is the case to the extent to make unit tests
pass, however, there are differences remaining. One specific
difference I did not tackle is that GNU wc will not align the
output columns (compute_number_width() -> 1) in the specific case
of the input for --files0-from=- being a named pipe, not real stdin.
This difference can be triggered using the following two invocations.
  - wc --files0-from=- < files0 # use a named pipe, GNU does align
  - cat files0- | wc --files0-from=- # use real stdin, GNU does not
    align.
2022-07-01 16:43:09 +02:00