Commit graph

3155 commits

Author SHA1 Message Date
Tyler
d2cebad931 addresses a few more issues from PR#2474
- adds project header to multiple files
- updates spell check skip words
- removes linux only flags direct,noatime from mac_os build
- applies rustfmt to test_dd
2021-07-06 15:35:48 -07:00
Tyler
09acfce995 Merge branch 'master' of github.com:backwaterred/coreutils 2021-07-06 11:55:25 -07:00
Tyler
1ad89c5e89 Addresses issues raised in PR#2474
- runs rustfmt on test_dd.rs
- eliminates compiler warnings
- adds many words to spellchecker ignore list
- adds sanity test for vexing conv=nocreat issue. Still WIP.
2021-07-06 11:52:48 -07:00
Sylvestre Ledru
9ad70a4f5d
Merge pull request #2480 from miDeb/sort/key-args
sort: make -k only take one argument per flag
2021-07-06 18:58:50 +02:00
Michael Debertol
8ace291b32 sort: make -k only take one argument per flag
This makes it so that `sort -k 1 file` treats `file` as the input file
and not the second key.
2021-07-06 15:47:32 +02:00
Jan Scheer
e53f4db33a Merge branch 'master' into id_selinux_context 2021-07-06 13:29:50 +02:00
Michael Debertol
bc0727cc4d [: add support for --help and --version
I copied the help text verbatim from GNU, I hope that's ok.
2021-07-06 13:15:07 +02:00
Sylvestre Ledru
d5b2320a59 Fix clippy warning
Useless use of format
2021-07-06 12:44:33 +02:00
Sylvestre Ledru
16a5faf886 Silent buggy clippy warnings 2021-07-06 12:12:36 +02:00
Terts Diepraam
e253fb89db Merge branch 'master' into hostname-uresult 2021-07-06 11:21:42 +02:00
Dave Hodder
c74b77aec8 uname: don't report OS as "GNU/Linux" without GNU
The `uname` `-o` switch reports the operating system used. If the GNU C
standard library (glibc) is not in use, for example if musl is being
used instead, report "Linux" instead of "GNU/Linux".
2021-07-05 22:42:42 +01:00
backwaterred
0b981d9dc3
Update src/uu/dd/src/datastructures.rs
Adds project header to conversion_tables.rs

Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
2021-07-05 11:34:22 -07:00
Tyler
418ecbe61a Makes multiplier parsing system dependant
- multipler is now created as u128, then returned as usize after
  conversion. Errors due to overflow now depend on the system on which
the code is run.
2021-07-05 11:27:17 -07:00
Andreas Hartmann
9d94307880 mv: Adapt for new backup_control utilities 2021-07-05 12:44:44 +02:00
Andreas Hartmann
a783d05101 backup_control: Add module tests
Adds a tests submodule that performs tests on the
`determine_backup_mode` function to ensure it handles backup options
like specified by [GNU][1].

[1]: https://www.gnu.org/software/coreutils/manual/html_node/Backup-options.html
2021-07-05 12:44:44 +02:00
Andreas Hartmann
89c6d32a20 backup_control: Refactor backup mode determination
Refactor the function that determines which backup mode to select based
on user input. It now complies with what the [GNU manual][1] specifies.

[1]: https://www.gnu.org/software/coreutils/manual/html_node/Backup-options.html
2021-07-05 12:44:40 +02:00
Andreas Hartmann
1309757d4d backup_control: Make utility functions private 2021-07-05 12:43:28 +02:00
Andreas Hartmann
fa0b4861b9 backup_control: Match abbreviated backup options
Add a function that takes a user-supplied backup option and checks if it
matches any of the valid backup options. This is because GNU allows to
abbreviate backup options, as long as they are valid and unambiguous.

In case a backup option is either invalid or ambiguous, an error type is
returned that contains a formatted error string for output to the user.
2021-07-05 12:43:28 +02:00
Andreas Hartmann
3b8f135842 backup_control: Add backup help string from GNU utils
The previous help string for the backup subroutines didn't comply with
the formatting found in the `--help` output of e.g. `mv` or `ln`.

Use the exact help string from these utilities instead.
2021-07-05 12:43:28 +02:00
Anup Mahindre
a9ba4c6d9f du: Use UResult 2021-07-04 22:44:25 +05:30
Sylvestre Ledru
f2e12fee0a Silent buggy clippy warnings
Fails with:
```
error: use of irregular braces for `write!` macro
  --> src/uucore/src/lib/features/encoding.rs:19:17
   |
19 | #[derive(Debug, Error)]
   |                 ^^^^^
   |
   = note: `-D clippy::nonstandard-macro-braces` implied by `-D warnings`
help: consider writing `Error`
  --> src/uucore/src/lib/features/encoding.rs:19:17
   |
19 | #[derive(Debug, Error)]
   |                 ^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonstandard_macro_braces
   = note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info)
```
2021-07-04 19:06:37 +02:00
Sylvestre Ledru
1136221f6f rustfmt the recent change 2021-07-04 13:01:31 +02:00
353fc443
d0805605e0
imported UUsageError 2021-07-04 16:09:55 +05:30
Sylvestre Ledru
38c0880989
fix the clippy warning 2021-07-04 12:03:36 +02:00
Sylvestre Ledru
e4204fcf07
Merge pull request #2436 from hbina/hbina-ls-refactor-options-module
ls: Refactored options and other long constants to fix formatting
2021-07-04 11:59:06 +02:00
Sylvestre Ledru
ec1a301c56
Merge pull request #2473 from tertsdiepraam/usage-error
uucore: add usage errors
2021-07-04 11:46:07 +02:00
Sylvestre Ledru
91078cfcb3
Merge pull request #2445 from syukronrm/du-inodes
du: add `--inodes`
2021-07-04 11:28:03 +02:00
Sylvestre Ledru
010919a9a9
Merge pull request #2460 from miDeb/completions-errors
coreutils: better errors for invalid args for completions
2021-07-04 11:27:26 +02:00
Sylvestre Ledru
d3652cc3c0
Merge pull request #2457 from Funky185540/install-implement-backup
install: implement --backup, -b and -S
2021-07-04 09:57:45 +02:00
Tyler
860cbc6311 Removes or ignores all compiler warnings 2021-07-02 15:30:46 -07:00
Tyler
8e862b86dd More minor cleanup.
- Runs rustfmt.
- Speel check help-text
2021-07-02 14:24:01 -07:00
Tyler
7f03ecf74b Adds failures & tests for unimplmented flags. 2021-07-02 13:17:34 -07:00
Tyler
5b030b4855 Minor cleanup
- Removes compiler warnings.
- Renames conv=nocreat test to be more descriptive.
2021-07-02 11:50:33 -07:00
backwaterred
9c38583c6b
Merge pull request #2 from uutils/master
catchup with uutils main
2021-07-02 11:34:22 -07:00
Tyler
951d9c0822 Completes transition to clap
- fixes build issues in parser tests.
2021-07-02 11:31:06 -07:00
Tyler
4d76cb45de Fixes odd build error in file I did not touch.
- Adds 'full' features required for imported struct.
- see https://docs.rs/syn/1.0.73/syn/struct.ItemFn.html
2021-07-02 11:09:51 -07:00
Tyler
8334d9f574 Build changes after merge with uutils main 2021-07-02 10:53:15 -07:00
Terts Diepraam
e46ce2947e add usage error 2021-07-02 19:31:16 +02:00
353fc443
23f5f55560
Added UResult for dirname 2021-07-02 12:14:24 +00:00
353fc443
f66f10c4ed
Added UResult for hostid 2021-07-02 12:03:14 +00:00
353fc443
330db2eb3e
Added UResult for hostname 2021-07-02 08:19:33 +00:00
Tyler
92281585a7 Merge branch 'master' of https://github.com/uutils/coreutils into uutils-master 2021-07-01 14:33:30 -07:00
Terts Diepraam
5a40148602
Merge pull request #2463 from miDeb/wrap-help
all utils: enable wrap_help
2021-07-01 13:18:32 +02:00
Terts Diepraam
7a0a7aecc4
Merge pull request #2461 from miDeb/sort/check-no-out
sort: disable -o with -C and -c
2021-07-01 13:07:05 +02:00
Terts Diepraam
6213a2a967
Merge pull request #2462 from miDeb/sort/version
sort/ls: implement version cmp matching GNU spec
2021-07-01 13:02:59 +02:00
Tyler
17cfba41cc Implements project testfing from root.
- conv=FLAG testing. (1) WIP conv=nocreat
- iflag & oflag testing.
- conv=CONV ascii,...,ucase,...,block,...sync tests at unit-test-level
  (project root is todo)
2021-06-30 14:47:48 -07:00
Dean Li
b21e01bcb0
arch: match GNU error
Follow up for #2466 as suggested by @miDeb
2021-06-30 22:32:59 +08:00
Dean Li
92bfaea3fa
arch: use UResult 2021-06-29 19:48:20 +08:00
Michael Debertol
cd83aed89c test: go into '[' mode when executable ends with [
This makes [ work even when installed with a custom prefix, e.g. as uu-[.
2021-06-29 00:28:01 +02:00
Terts Diepraam
0cfaaeceda touch: adapt to standardized error handling 2021-06-28 13:55:55 +02:00
Terts Diepraam
73a7ead857 mktemp: adapt to standardized error handling 2021-06-28 13:55:55 +02:00
Terts Diepraam
8c5052fcb7 mkdir: adapt to standardized error handling 2021-06-28 13:55:37 +02:00
Terts Diepraam
e4eac825fb ls: adapt to standardized error handling 2021-06-28 13:49:57 +02:00
Terts Diepraam
60e4621c3b uucore_procs: add temporary proc macro gen_uumain for standardized error handling 2021-06-28 13:49:56 +02:00
Terts Diepraam
43bfec7170 uucore/error: add macros for standardized error handling 2021-06-28 13:49:45 +02:00
Terts Diepraam
66b1ac019d uucore/error: add standardized error handling (adds UResult & UError) 2021-06-28 13:49:35 +02:00
Syukron Rifail M
27e0507844 du: more tests 2021-06-28 07:51:17 +07:00
Syukron Rifail M
d8a33da5b3 du: add --inodes 2021-06-28 07:51:17 +07:00
Andreas Hartmann
1a43a94e31 install: Apply rustfmt 2021-06-27 17:59:04 +02:00
Michael Debertol
d3732e08c4 sort: disable -o with -C and -c 2021-06-27 16:21:18 +02:00
Michael Debertol
2ebca384c6 all utils: enable wrap_help
This makes clap wrap the help text according to the terminal width,
which improves readability for terminal widths < 120 chars,
because clap defaults to a width of 120 chars without this feature.
2021-06-27 16:17:10 +02:00
Michael Debertol
0dda72eb60 coreutils: better errors for invalid args for completions
Use clap to extract command line arguments. This generates much better
error messages.
2021-06-27 16:07:43 +02:00
Michael Debertol
233a778963 sort/ls: implement version cmp matching GNU spec
This reimplements version_cmp, which is used in sort and ls to sort
according to versions.
However, it is not bug-for-bug identical with GNU's implementation.
I reported a bug with GNU here:
https://lists.gnu.org/archive/html/bug-coreutils/2021-06/msg00045.html
This implementation does not contain the bugs regarding the handling of
file extensions and null bytes.
2021-06-27 15:29:17 +02:00
Andreas Hartmann
df41fed640 install: Mark '-S', '-b' and '--backup' as implemented
Removes the "unimplemented" notice from the respective help texts. Stop
printing errors if the options are supplied via CLI.
2021-06-27 09:54:55 +02:00
Andreas Hartmann
5437985705 install: Implement '--backup' and '-b'
Adds the ability to perform file backups before installing newer files on top
of existing ones. Adds a status message about backups to stdout if running in
verbose mode.
2021-06-27 09:54:17 +02:00
Andreas Hartmann
49a9f359bb install: Make use of 'backup_controls' for '--backup' opts
Use the methods and types offered by the 'backup_controls' module to implement
the logic for backing up files instead of overwriting.
2021-06-27 09:54:07 +02:00
Hanif Bin Ariffin
4778a64989 ls: Refactored options and other long constants to fix formatting
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>

Keep one of the texts in-place

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>

Reduced the fix to just formatting changes

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-27 14:55:55 +08:00
Andreas Hartmann
a85adf3c3f install: Internally rename short '-b' option
Rename from OPT_BACKUP_2 to a more descriptive name "OPT_BACKUP_NO_ARGS".
2021-06-26 00:27:08 +02:00
Andreas Hartmann
3155cd510f install: Fix argument parsing for '--backup'
The '--backup' option would previously accept arguments separated from the
option either by a space or an equals sign. The GNU implementation strictly
requires an "equals" for argument separation.

As the argument to '--backup' is optional, the equals sign mustn't be ommited
as otherwise there is no way to tell a file argument apart from an argument
that's meant for the '--backup' option. This ensures that if '--backup' is
present it either has no further associated arguments (i.e. fallback to the
default), or the arguments are separated by an equals sign.
2021-06-26 00:27:08 +02:00
Andreas Hartmann
211af9a3ea backup_control: Add todo for gnu compliant behavior
The logic behind the file-backup implementation currently doesn't comply 100%
with what the GNU manual [1] describes. Adds a TODO so it isn't forgotten.

[1]: https://www.gnu.org/software/coreutils/manual/html_node/Backup-options.html
2021-06-26 00:27:08 +02:00
Michael Debertol
73cfcc27e7 cp: insert some spaces into the help text 2021-06-25 21:23:45 +02:00
Michael Debertol
2e027bf45d true, false: enable --help and --version 2021-06-25 21:23:45 +02:00
Michael Debertol
0fec449de3 mkfifo: make rustfmt work 2021-06-25 21:23:45 +02:00
Michael Debertol
a8d62b9b23 fmt: fix indentation for help 2021-06-25 21:23:45 +02:00
Michael Debertol
a9e79c72c7 uutils: enable shell completions
This adds a hidden `completion` subcommand to coreutils. When invoked with
`coreutils completion <utility> <shell>` a completion file will be printed
to stdout. When running `make install` those files will be created for all
utilities and copied to the appropriate locations.
`make install` will install completions for zsh, fish and bash; however,
clap also supports generating completions for powershell and elvish.

With this patch all utilities are required to have a publich uu_app function
that returns a clap::App in addition to the uumain function.
2021-06-25 21:23:45 +02:00
Michael Debertol
0531153fa6 uutils: move clap::App creation to separate functions 2021-06-25 21:23:45 +02:00
Michael Debertol
004b5d1b38 format: formatting 2021-06-25 19:35:33 +02:00
Michael Debertol
548a895cd6 sort: compatibility of human-numeric sort
Closes #1985.
This makes human-numeric sort follow the same algorithm as GNU's/FreeBSD's sort.
As documented by GNU in https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html,
we first compare by sign, then by si unit and finally by the numeric value.
2021-06-25 18:19:00 +02:00
Sylvestre Ledru
fef8761ac1
Merge pull request #2443 from miDeb/sort/data-oriented
sort: separate additional data from the Line struct
2021-06-24 21:19:23 +02:00
Sylvestre Ledru
ab5d581fa4
Merge pull request #2439 from tertsdiepraam/numfmt/round-and-c-locale
`numfmt`: add `--round` and other minor improvements
2021-06-24 21:18:59 +02:00
Sylvestre Ledru
5d7cf61128
Merge pull request #2429 from miDeb/install/target-dir
install: support --target-directory
2021-06-24 21:06:44 +02:00
Michael Debertol
8bebfbb3e6 sort: don't store slices for general numeric sort
Gerenal numeric sort works by comparing pre-parsed floating point
numbers. That means that we don't have to store the &str the float was
parsed from.

As a result, memory usage was slightly reduced for general numeric sort.
2021-06-24 18:33:33 +02:00
Sylvestre Ledru
3b2d0d17fa
Merge pull request #2446 from jhscheer/groups_gnu_testsuite
groups: fixes to pass GNU's Testsuite
2021-06-23 20:15:12 +02:00
Sylvestre Ledru
44c770d234
Merge pull request #2450 from jhscheer/id_refactor_identifier
id: refactor identifiers
2021-06-23 19:05:57 +02:00
Jan Scheer
11f36eae3b tests/groups: fix/add tests for (multiple) username(s) 2021-06-23 16:50:03 +02:00
Sylvestre Ledru
d40fc65ee6
Merge branch 'master' into numfmt/round-and-c-locale 2021-06-23 12:39:55 +02:00
Sylvestre Ledru
a73e71ba74
Merge pull request #2437 from miDeb/cp/reflink-auto
cp: default to --reflink=auto on linux and macos
2021-06-23 12:37:44 +02:00
Sylvestre Ledru
87eaf6e80a
Merge pull request #2447 from jhscheer/locale_c
fix some issues with locale (replace "LANGUAGE" with "LC_ALL")
2021-06-23 12:36:40 +02:00
Jan Scheer
4b3da59b0e id: refactor identifiers
* change of identifier names and spelling according to the suggestions in the review of #2446
2021-06-23 12:27:01 +02:00
Jan Scheer
c0be979611 fix some issues with locale (replace "LANGUAGE" with "LC_ALL")
`LANGUAGE=C` is not enough, `LC_ALL=C` is needed as the environment
variable that overrides all the other localization settings.

e.g.
```bash
$ LANGUAGE=C id foobar
id: ‘foobar’: no such user

$ LC_ALL=C id foobar
id: 'foobar': no such user
```

* replace `LANGUAGE` with `LC_ALL` as environment variable in the tests
* fix the the date string of affected uutils
* replace `‘` and `’` with `'`
2021-06-23 11:30:28 +02:00
Sylvestre Ledru
178399c20e
Merge pull request #2449 from miDeb/temp-win
Make tests pass on a windows VM
2021-06-23 08:40:30 +02:00
Michael Debertol
d60afb8947 mkdir: note that -m is not supported on windows 2021-06-23 00:59:51 +02:00
Michael Debertol
4a956f38b9 sort: separate additional data from the Line struct
Data that was previously boxed inside the `Line` struct was moved to
separate vectors. Inside of each `Line` remains only an index that
allows to access that data.
This helps with keeping the `Line` struct small and therefore reduces
memory usage in most cases.
Additionally, this improves performance because one big allocation (the
vectors) are faster than many small ones (many boxes inside of each
`Line`). Those vectors can be reused as well, reducing the amount of
(de-)allocations.
2021-06-23 00:36:05 +02:00
Michael Debertol
622504467f mktemp: note that windows uses a different env var for tmpdir
On windows `std::env::temp_dir` uses the `TMP` environment variable
instead of `TMPDIR`.
2021-06-22 17:44:45 +02:00
Sylvestre Ledru
e48ff9dd9e
Merge pull request #2441 from siebenHeaven/ls_dangling_symlinks
ls: Fix problems dealing with dangling symlinks
2021-06-21 22:34:15 +02:00
Sylvestre Ledru
a982030032
Merge pull request #2386 from youknowone/dircolors-double-scan
Prevent double scanning from dircolors
2021-06-21 22:31:24 +02:00
Sylvestre Ledru
97ce44b102
Merge pull request #2407 from hbina/hbina-more-terminal-resize
Improvements to `more`.
2021-06-21 22:30:07 +02:00
Tyler
47464f50a1 Begin project level testing. Minor fixes. 2021-06-21 11:17:47 -07:00
Anup Mahindre
4b3224dd82
ls: Fix clippy warning 2021-06-21 20:29:22 +05:30
Jan Scheer
25ef39472c groups: fix to pass GNU Testsuite groups-process-all.sh
* add support for multiple users
* sync help text with GNU's `groups` manpage
2021-06-21 14:33:09 +02:00
Jan Scheer
30e45eefa4 groups: fix to pass GNU Testsuite groups-dash.sh 2021-06-21 13:19:57 +02:00
Rémi Lauzier
6aa79440f5
Fix a clippy warning 2021-06-20 21:21:50 -04:00
Michael Debertol
a91369bbff cp: fix dead code warnings on windows 2021-06-20 19:10:51 +02:00
Jan Scheer
f1d317147b id: add support for showing SELinux context (--context/-Z) 2021-06-20 13:44:41 +02:00
Anup Mahindre
3b641afadc ls: Fix issue with Windows and dangling symbolic links
- Windows hidden file attribute determination would assume symbolic link
  to be valid and would panic
- Check symbolic link's attributes if the link points to non-existing
  file
2021-06-20 16:56:25 +05:30
Terts Diepraam
5ac0274c13 numfmt: fix doctest and spell check 2021-06-20 11:50:14 +02:00
Anup Mahindre
f6cb1324b6 ls: Fix problems dealing with dangling symlinks
- For dangling symlinks, errors should only be reported if
dereferencing options were passed and dereferencing was applicable to
the particular symlink
- With -i parameter, report '?' as the inode number for dangling
symlinks
2021-06-20 13:31:45 +05:30
Roy Ivy III
b11e9a057e docs/spell ~ (uucore) add spelling exceptions 2021-06-19 18:37:13 -05:00
Terts Diepraam
3086e95702 numfmt: add round and use C locale style for errors 2021-06-20 00:21:14 +02:00
Sylvestre Ledru
115eb5eb52
Merge pull request #2432 from dezgeg/test-bracket-syntax
test: Implement [ expr ] syntax
2021-06-19 19:14:20 +02:00
Michael Debertol
076c7fa501 cp: default to --reflink=auto on linux and macos 2021-06-19 18:59:57 +02:00
Michael Debertol
9fb927aa85 cp: always delete the destination for symlinks 2021-06-19 18:59:57 +02:00
Michael Debertol
6400cded54 cp: fix order of checks in copy_helper 2021-06-19 18:59:57 +02:00
Tuomas Tynkkynen
7b9814c778 test: Implement [ expr ] syntax
When invoked via '[' name, last argument must be ']' or we bail out with
syntax error. Then the trailing ']' is simply disregarded and processing
happens like usual.
2021-06-19 18:49:21 +03:00
Sylvestre Ledru
5ba69d4a35
Merge pull request #2412 from syukronrm/du-dereference
du: add `--dereference`
2021-06-19 12:05:18 +02:00
Sylvestre Ledru
ac98960f32
Merge pull request #2427 from miDeb/ln/recursive-relative
ln: don't return an empty path in `relative_path`
2021-06-19 12:03:59 +02:00
Sylvestre Ledru
65fe9beaad
bring back #[cfg(windows)] 2021-06-19 08:58:33 +02:00
Sylvestre Ledru
e2a00b67ed
Merge pull request #2428 from jhscheer/cut_2424
cut: fix `-d=` (#2424)
2021-06-19 08:46:42 +02:00
Sylvestre Ledru
7739080e6e
Merge pull request #2430 from tertsdiepraam/cp/update-options
`cp`: use `options` module and update list op implemented args
2021-06-18 18:50:36 +02:00
Sylvestre Ledru
54ccfdfd9f
Merge pull request #2413 from deantvv/ls-show-control-if-tty
ls: set show-control-char if stdout is terminal
2021-06-18 18:26:22 +02:00
Terts Diepraam
f1e043ca1b
Merge pull request #2361 from jhscheer/id_zero_2351
id: revamp to pass more of GNU's Testsuite
2021-06-18 18:10:49 +02:00
Terts Diepraam
14520fb64e cp: remove redundant newline in readme 2021-06-18 18:00:27 +02:00
Terts Diepraam
fdfa44cb5c Merge branch 'master' into cp/update-options 2021-06-18 17:59:13 +02:00
Terts Diepraam
ab3f2cb672 cp: update list of implemented arguments 2021-06-18 17:56:22 +02:00
Terts Diepraam
cf1a7d0796 cp: use options module 2021-06-18 17:56:04 +02:00
Terts Diepraam
e273cb8e4f
Merge pull request #2426 from miDeb/cp/symlinks
cp: improve symlink handling
2021-06-18 17:27:50 +02:00
Michael Debertol
4e62c9db71 install: support target-directory 2021-06-18 16:45:36 +02:00
Jan Scheer
65f47be5ee cut: fix -d= (#2424) 2021-06-18 12:10:40 +02:00
Michael Debertol
3d3af5c8ca ln: don't return an empty path in relative_path 2021-06-18 11:53:29 +02:00
Michael Debertol
a371c03431 cp: only get the current directory once 2021-06-18 11:48:13 +02:00
Michael Debertol
32526e3048 cp: one more clippy fix 2021-06-18 11:45:04 +02:00
Michael Debertol
315bfd65a3 cp: move symlink check to the right place 2021-06-18 11:44:39 +02:00
Tyler
22265814ba Cleans up compiler warnings. 2021-06-17 14:49:08 -07:00
Tyler
d14b5843a3 Implements libc file open flags (unix only) 2021-06-17 14:33:30 -07:00
Tuomas Tynkkynen
d05964a8cb test: Implement -k
parser.rs already accepts this, finish the implementation.
2021-06-18 00:03:08 +03:00
Michael Debertol
12a1c87cb8 cp: improve symlink handling 2021-06-17 22:26:13 +02:00
Dean Li
c73ba1630e
ls: set show-control-char if stdout is terminal 2021-06-17 19:55:21 +08:00
Terts Diepraam
439b7e0ca5
Merge pull request #2415 from miDeb/touch/date-epoch
touch: support @<timestamp> date format
2021-06-17 10:36:03 +02:00
Terts Diepraam
de069190b9
Merge pull request #2417 from miDeb/sort/no-sigpipe-panic
sort: avoid sigpipe errors
2021-06-17 10:34:13 +02:00
Syukron Rifail M
bc8415c9db du: add --dereference 2021-06-17 14:06:41 +07:00
Terts Diepraam
1f4d5827ec
Merge pull request #2416 from jhscheer/fix_getgrouplist
uucore/entries: fix `getgrouplist` wrapper to handle a bug in macOS's `getgrouplist` implementation
2021-06-17 00:14:20 +02:00
Michael Debertol
b87387964d core: mute all BrokenPipe errors
On windows the error message does not contain `Broken pipe`, so let's
try to find the error `kind` which should be `BrokenPipe` in all cases.
2021-06-17 00:06:43 +02:00
Michael Debertol
816c55dce4 sort: avoid sigpipe errors
By calling `unwrap` we get a panic instead of an abort, and since we
mute sigpipe panics for all utilites, no error message will be printed.
2021-06-17 00:06:39 +02:00
Terts Diepraam
ce6d439a1b
Merge pull request #2381 from miDeb/sort/merge-improvements
sort: delete temporary files as soon as possible
2021-06-17 00:00:59 +02:00
Jan Scheer
39aa5312ed id/tests: skip tests for multiple_user feature if there's not at least coreutils id version 8.31 in $PATH 2021-06-16 23:52:55 +02:00
Tyler
19996c10a9 Removes 'fast read' plumbing.
- The dd info page mentions a special fast-read framework if no conv=FLAG is
  specified (see bs=N) which I left space for. As it turns out, this is performed already
  so it does not need to be implemented.
2021-06-16 12:59:43 -07:00
Jan Scheer
88367c6fb4 Merge branch 'fix_getgrouplist' into id_zero_2351 2021-06-16 19:20:34 +02:00
Jan Scheer
54cbb69d37 id/tests: fix tests if run on macOS 2021-06-16 19:16:29 +02:00
Michael Debertol
4c5ee1dbd7 tty: correct exit code for write errrors 2021-06-16 17:55:48 +02:00
Michael Debertol
3c271304f5 tty: correct exit code for wrong args 2021-06-16 17:43:38 +02:00
Hanif Bin Ariffin
2a7209116d Fixed cp --preserve accepting no args
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-16 11:26:52 +08:00
Michael Debertol
84affa2137 touch: support @<timestamp> date format
parse `@<seconds since epoch>` as a valid date.
2021-06-15 22:43:40 +02:00
Jan Scheer
996e1b8539 uucore/entries: fix getgrouplist wrapper to handle a bug in macOS's
`getgrouplist` implementation

* add documentation
2021-06-15 22:13:52 +02:00
Tyler
06dcdc0f1f Implements status=LEVEL parser. 2021-06-15 12:19:18 -07:00
Tyler
8141919064 Implements count=N
- Adds tests for count=READS and count=BYTES.
- Implements count logic for read count and bytes count limits.
2021-06-15 11:06:36 -07:00
Michael Debertol
4bd556d58e sort: better convey that the return value should be ignored 2021-06-15 19:09:22 +02:00
Michael Debertol
6979b707c0 sort: fix clippy lints 2021-06-15 19:09:22 +02:00
Michael Debertol
047ced2c7f sort: increase default merge batch size
I think we can attempt to open 32 files concurrently on all systems
without risking resource exhaustion.
2021-06-15 19:09:22 +02:00
Michael Debertol
6a3c1c19d9 sort: remove needless allow 2021-06-15 19:09:22 +02:00
Michael Debertol
956ff57e2e sort: delete temporary files as soon as possible
- When we have finished reading from a temproary file, we can immediately
delete it.
- Use one single directory for all temporary files.
- Only create the temporary directory when needed.
- Also compress temporary files created by the merge step if requested.
2021-06-15 19:09:22 +02:00
Daniel Rocco
22fbf16b2c test: implement user, group ownership checks
closes #2337
2021-06-14 14:30:17 -04:00
Terts Diepraam
553f70b06a
Merge pull request #2408 from Foryah/issue-2346
touch: change the error message to match the GNU error message #2346
2021-06-14 13:43:44 +02:00
David Suilea
25240ba61c
touch: change the error message to match the GNU error message #2346 2021-06-14 13:03:14 +02:00
Terts Diepraam
dfe0314d8d
Merge pull request #2397 from miDeb/sort/args
sort: refactor command line arguments
2021-06-14 12:49:19 +02:00
Terts Diepraam
05c8883b1a
Merge pull request #2395 from miDeb/timeout/cmd-args
timeout: handle arguments for the command to run
2021-06-14 12:01:31 +02:00
Michael Debertol
13458b4806 sort: use values_of 2021-06-14 11:39:26 +02:00
Michael Debertol
7acb9373a6 kill: fix signal table printing 2021-06-14 11:10:41 +02:00
Jan Scheer
052202ca19 Merge branch 'master' into id_zero_2351 2021-06-13 11:30:43 +02:00
Jan Scheer
b4c47cc5bd id: make id pass GNU's testssuite for "tests/id/uid.sh" and
"tests/id/zero.sh"
2021-06-13 11:12:53 +02:00
Jan Scheer
9af9343745 uucore: entries: add documentation 2021-06-13 10:12:00 +02:00
Anup Mahindre
da7b02cf9d du: Refactor threshold handling 2021-06-12 23:12:44 +05:30
Anup Mahindre
d6181ce7d4 du: Add threshold argument support
- Add --threshold parameter and corresponding logic to skip listing
entires that don't adhere to the threshold
2021-06-12 19:56:05 +05:30
Hanif Bin Ariffin
083e745976 Simplified page down implementation
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-12 20:34:21 +08:00
Hanif Bin Ariffin
9ed5091be6 Fixed hanging with smaller content
Using 'seq 10 | cargo run -- more' should no longer hangs.

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-12 20:30:15 +08:00
Michael Debertol
af6e92e012 Merge branch 'master' of https://github.com/uutils/coreutils into sort/args 2021-06-12 13:16:46 +02:00
Michael Debertol
a69c2d52f9 Merge branch 'master' of https://github.com/uutils/coreutils into timeout/cmd-args 2021-06-12 13:14:16 +02:00
Michael Debertol
a57313f01b core: represent signal values by their index 2021-06-12 13:12:15 +02:00
Hanif Bin Ariffin
28c6fad6e3 Now displays the unknown key entered
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-12 18:25:14 +08:00
Hanif Bin Ariffin
ee6419f11c Fixing display when resizing terminal
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-12 18:11:12 +08:00
Hanif Bin Ariffin
63ee42826b Fixed numeric type
1. Its better to bump u16 to usize than the other way round.
2. Highly unlikely to have a terminal with usize rows...makes making sense of the code easier.

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-12 18:02:31 +08:00
Hanif Bin Ariffin
b335e7f2ae Now stops at the last line first. Press down again to go to next file or quit
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-12 17:57:35 +08:00
Terts Diepraam
440eba628c
Merge pull request #2338 from miDeb/ln/dst-symlink
ln: canonicalize the parent directory of the destination, not the destination itself
2021-06-12 11:28:19 +02:00
Terts Diepraam
8afc923796
Merge pull request #2237 from wfscheper/wfscheper/issue2118
chgrp: replace getopts with clap (#2118)
2021-06-12 11:20:24 +02:00
Terts Diepraam
7f754dc1a5
Merge pull request #2382 from tertsdiepraam/more/rewrite-drawing-logic
`more`: rewrite drawing logic
2021-06-12 11:12:29 +02:00
Jan Scheer
39f5f70f2b Merge branch 'master' into refactoring_parse_size 2021-06-12 02:24:07 +02:00
Tyler
fc110bb656 Implements status=LEVEL
- Adds print fn's
- Modifies internal fn's as needed to track read/write state
- Modifies status update thread to respect status level
- Adds signal handler for SIGUSR1 (print xfer stats)
2021-06-11 17:00:25 -07:00
Terts Diepraam
b7460a61a9
Merge pull request #2398 from youknowone/err-return
clean up returning Err
2021-06-12 00:14:28 +02:00
Michael Debertol
b8d4411291 sort: fix ignore-leading-blanks long option 2021-06-11 20:46:23 +02:00
Michael Debertol
fb035aa049 sort: allow --check=<value> syntax
* --check=silent and --check=quiet, which are equivalent to -C.
* --check=diagnose-first, which is the same as --check

We also allow -c=<value>, which confuses GNU sort.
2021-06-11 20:46:23 +02:00
Michael Debertol
cc0df6ea43 sort: move options to the options module
Be more consistent with other utilities
2021-06-11 20:46:23 +02:00
Michael Debertol
f909751155 timeout: don't kill the process if -k is not set
`timeout` used to set the timeout to 0 when -k was not set. This
collided with the behavior of 0 timeouts, which disable the timeout.
When -k is not set the process should not be killed.
2021-06-11 20:44:25 +02:00
Terts Diepraam
ddb196dd1d chgrp: fix clippy and spell-check warnings 2021-06-11 17:24:12 +02:00
Jeong YunWon
6734d5df93 basename: trim separators with function 2021-06-11 23:35:15 +09:00
Jeong YunWon
6003d95974 comm: clean up line-end check 2021-06-11 23:35:15 +09:00
Jeong YunWon
9e8be3093f chown: clean up parse_spec 2021-06-11 23:27:09 +09:00
Jeong YunWon
e985131c83 uucore: remove unused warning of sort_groups 2021-06-11 23:26:58 +09:00
Jeong YunWon
fb67e54e20 uucore: clean up returning Err 2021-06-11 23:26:58 +09:00
Jeong YunWon
b59c1dae59 stdbuf: clean up returning Err 2021-06-11 23:26:58 +09:00
Jeong YunWon
9c56a40bcb shuf: clean up returning Err 2021-06-11 23:26:58 +09:00
Jeong YunWon
2dd9822d57 rmdir: clean up returning Err 2021-06-11 23:26:58 +09:00
Jeong YunWon
7cc4bf6e36 pr: clean up returning Err 2021-06-11 23:26:58 +09:00
Jeong YunWon
e45f5404db nl: fix clippy error 2021-06-11 23:26:58 +09:00
Jeong YunWon
3ea18173cb od: clean up returning Err 2021-06-11 23:26:58 +09:00
Jeong YunWon
d329c7c864 install : clean up returning Err 2021-06-11 23:26:58 +09:00
Jeong YunWon
27ce4bb0a4 head: clean up returning Err 2021-06-11 23:26:58 +09:00
Jeong YunWon
bbae78db67 expr: clean up returning Err 2021-06-11 23:26:58 +09:00
Jeong YunWon
f01121f5b7 env: clean up returning Err 2021-06-11 23:26:58 +09:00
Jeong YunWon
6736faec4a csplit: clean up returning Err 2021-06-11 23:26:58 +09:00
Jeong YunWon
7cc17c15c2 cp: clean up returning Err 2021-06-11 23:26:58 +09:00
Jeong YunWon
526ed7afdc cksum: clean up returning Err 2021-06-11 23:26:58 +09:00
Jeong YunWon
a197d35039 chown: clean up returning Err 2021-06-11 23:26:58 +09:00
Jeong YunWon
c5594bc9bc base32: clean up returning Err 2021-06-11 23:26:58 +09:00
Terts Diepraam
4abe4c4ac5 Merge branch 'master' into more/rewrite-drawing-logic 2021-06-11 14:03:11 +02:00
Terts Diepraam
f104f8868c
Merge pull request #2356 from syukronrm/du-x
du: add `--one-file-system`
2021-06-11 13:51:28 +02:00
Terts Diepraam
960828ba70
Merge pull request #2376 from deantvv/more-option-d
more: Implement option '-d'
2021-06-11 13:49:13 +02:00
Syukron Rifail M
0c364e635b du: add --one-file-system 2021-06-11 16:18:57 +07:00
Walter Scheper
cff75f242a chgrp: replace getopts with clap (#2118) 2021-06-10 16:38:44 -04:00
Michael Debertol
32f5e8baf8 Merge branch 'master' of https://github.com/uutils/coreutils into ln/dst-symlink 2021-06-10 21:48:43 +02:00
Yagiz Degirmenci
3347dacfc8
chroot: refactor undocumented features (#2365) 2021-06-10 21:46:17 +02:00
Sylvestre Ledru
e35cafd2f2
Merge pull request #2370 from tertsdiepraam/ln/update-arg-handling
`ln`: refactor argument handling and fix #2359
2021-06-10 21:39:43 +02:00
Sylvestre Ledru
d79268de05
Merge pull request #2374 from tertsdiepraam/who/cleanup-arg-handling
`who`: cleanup argument handling
2021-06-10 21:38:11 +02:00
Sylvestre Ledru
be9104b084
Merge pull request #2383 from tertsdiepraam/whoami/use-winapi
`whoami`: remove `advapi32-sys` dependency and use `winapi`
2021-06-10 21:34:50 +02:00
Sylvestre Ledru
667af7ea16
Merge pull request #2388 from youknowone/du-winapi
du winapi dependency only for windows
2021-06-10 21:31:08 +02:00
Sylvestre Ledru
de6829fec3
Merge pull request #2390 from youknowone/tr-reuse-chars
tr parse_sequence reuses chars iterator
2021-06-10 21:30:28 +02:00
Sylvestre Ledru
cadd7810ef
Merge pull request #2393 from youknowone/pathchk
bytes operation for pathchk
2021-06-10 21:30:14 +02:00
Jeong YunWon
0a1dcc27bb
prevent utf8 iteration for ascii str from shred (#2389) 2021-06-10 21:29:56 +02:00
Sylvestre Ledru
c6d8932698
Merge pull request #2392 from youknowone/tail
Remove unnessassary chars() and unwrap_or() from tail
2021-06-10 21:28:58 +02:00
Sylvestre Ledru
249ac23aab
Merge pull request #2394 from youknowone/cleanup-trivial
clean up to remove unnessessary unwraps and to use ? operators
2021-06-10 21:28:37 +02:00
Michael Debertol
b4efd5a749 timeout: disable pre-existing SIGCHLD handlers
Needed to make a GNU test pass
2021-06-10 21:24:43 +02:00
Michael Debertol
0f9bc8e974 timeout: disable timeout if it is set to zero 2021-06-10 21:24:43 +02:00
Michael Debertol
8e0ed2d20e timeout: support --verbose 2021-06-10 21:24:43 +02:00
Michael Debertol
b0b937dc3e core: add signal name lookup by value 2021-06-10 21:24:43 +02:00
Michael Debertol
ceb5a2998c core: add EXIT signal
EXIT is supported by GNU (see 993ca832d2/lib/sig2str.c (L258)),
so we have to support it too to pass GNU tests.
2021-06-10 18:28:37 +02:00
Michael Debertol
ed646090c2 timeout: fix usage string 2021-06-10 17:03:39 +02:00
Michael Debertol
c5d7cbda32 timeout: handle arguments for the command to run
To prevent clap from parsing flags for the command to run as flags for
timeout, remove the "args" positional argument, but allow to pass flags
via the "command" positional arg.
2021-06-10 17:03:32 +02:00
Michael Debertol
5997853cc4 Merge branch 'master' of https://github.com/uutils/coreutils into ln/dst-symlink 2021-06-10 16:06:32 +02:00
Sylvestre Ledru
3e8c009a50
Merge pull request #2379 from youknowone/rotate
get_groups_gnu sort with rotate_right
2021-06-10 16:05:54 +02:00
Dean Li
dc57e1535e
more: Implement option '-d'
Implement option '-d' (silent mode)

Related to #2320
2021-06-10 19:34:21 +08:00
Jeong YunWon
8433c7726d tr parse_sequence reuses chars iterator 2021-06-10 19:16:55 +09:00
Jeong YunWon
b9611b71ee use ? operator for od 2021-06-10 18:39:48 +09:00
Jeong YunWon
b21d189fcf Remove trivially unnessessary unwrap() pr 2021-06-10 18:39:48 +09:00
Jeong YunWon
cc6c2f64b1 clean up fold, hashsum, kill, nl, printf, truncate 2021-06-10 18:39:48 +09:00
Jeong YunWon
3ee09fa783 only matches Some() in match 2021-06-10 18:39:11 +09:00
Jeong YunWon
1fecd98ebe bytes operation for pathchk 2021-06-10 18:30:45 +09:00
Jeong YunWon
e3197bea39 dircolor purify forward match '#' 2021-06-10 18:14:23 +09:00
Jeong YunWon
8a03ac6caa Prevent double scanning from dircolors 2021-06-10 18:08:54 +09:00
Jeong YunWon
357886b599 Remove unnessassary chars() and unwrap_or() from tail 2021-06-10 18:06:40 +09:00
Terts Diepraam
96dffc8700
Merge pull request #2384 from sylvestre/getopt
remove a legacy declaration to getopt
2021-06-10 10:45:16 +02:00
Jeong YunWon
9c6750252d du winapi dependency only for windows 2021-06-10 15:07:46 +09:00
Jeong YunWon
ded92dbca0 clean up fold, hashsum, kill 2021-06-10 13:11:36 +09:00