Commit graph

6051 commits

Author SHA1 Message Date
Sylvestre Ledru
c91520768e
Merge pull request #4876 from shinhs0506/mkdir-p
mkdir: set correct permissions on dirs created by -p
2023-05-22 07:43:52 +02:00
Moïse Valvassori
0130a07579
chown: show message if file doesn't exist
* print the message "failed to change ownership of" when we try to change a non existing file.

* replace the 4-tuple returned by parse_gid_uid_and_filter by GidUidOwnerFilter struct.

* chain the test in one expression.

* chown: remove unused var "result" in test

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-05-21 17:54:32 +02:00
Jed Denlea
d58ee5a28a wc: skip String to measure number length
Sadly ilog10 isn't available until we use 1.67, but we can get close in
the meantime.
2023-05-20 23:29:48 -07:00
Jed Denlea
36b45e2249 wc: touch up errors, quote more like GNU
WcError should not hold Strings which are clones of `&'static str`s.
thiserror provides a convenient API to declare errors with their Display
messages.

wc quotes the --files0-from source slightly differently when reporting
errors about empty file names.
2023-05-20 23:29:48 -07:00
Jed Denlea
38b4825e7f wc: avoid excess String allocations
print_stats will now take advantage of the buffer built into
io::stdout().

We can also waste fewer lines on show! by making a helper macro.
2023-05-20 23:08:26 -07:00
Jed Denlea
c3b06e10a6 wc: clean up of settings
The Settings object did not need a QuotingStyle member, it was basically
a static.
2023-05-20 22:30:14 -07:00
Daniel Hofstetter
70765eea82
Merge pull request #4872 from Ideflop/more_implement_print_over_and_clean_print
more: add arguments print over and clean print
2023-05-20 15:32:50 +02:00
Ideflop
2d1a9f6709 fix behavior of -c and -p commands 2023-05-20 08:56:50 +02:00
Daniel Hofstetter
698fafad68 mktemp: prioritize TMPDIR over -p when using -t 2023-05-20 08:02:37 +02:00
John Shin
9e8575dadd mkdir: add documentation for the use of allow attribute 2023-05-19 08:13:33 -07:00
John Shin
f592dff46a mkdir: skip setting dir permissions on windows 2023-05-18 19:34:57 -07:00
John Shin
b05c05eb45 mkdir: chmod of parent directories created by -p 2023-05-18 19:11:49 -07:00
Daniel Hofstetter
932f44d3dc more: support PageDown/PageUp keys 2023-05-18 15:24:49 +02:00
Daniel Hofstetter
74e73bee06
Merge pull request #4832 from sylvestre/issue_4821
mktemp -t foo.XXXX should create in TMPDIR
2023-05-18 14:12:40 +02:00
Sylvestre Ledru
cd189b2391 Fix mktemp -t -p ~/projects/playground foo.XXXX 2023-05-18 11:08:55 +02:00
Sylvestre Ledru
35b5fd6a40 mktemp -t foo.XXXX should create in TMPDIR 2023-05-18 11:08:55 +02:00
Jed Denlea
db5696f64b rm: support non-UTF-8 paths
Addresses #4868.
2023-05-17 23:01:21 -07:00
Ideflop
1ce52903b0
Merge branch 'uutils:main' into more_implement_print_over_and_clean_print 2023-05-17 22:47:07 +02:00
Ideflop
b676875c0c more: add arguments print over and clean print 2023-05-17 20:38:03 +02:00
Jed Denlea
3870ee252a yes: support non-UTF-8 args
Also, tighten the creation of the output buffer.  Rather than copy "y\n"
8192 times, or any other input some number of times, it can be doubled
in place using Vec::extend_from_within.
2023-05-15 11:29:14 -07:00
Sylvestre Ledru
369a2a6631
Simplify the declaration
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-05-15 10:12:28 +02:00
Sylvestre Ledru
3e7594632b ls: when facing an invalid utf-8, don't panic
Fails with
```
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "invalid-\xE0-"', src/uu/ls/src/ls.rs:1932:53
```
2023-05-14 22:11:44 +02:00
Daniel Hofstetter
690fff2fc9 cksum: implement --untagged 2023-05-14 16:43:14 +02:00
John Shin
a817186e10 cp: preserve permissions on -r -p --parents 2023-05-12 11:34:51 -07:00
Sylvestre Ledru
64c49de0cc
Merge pull request #4432 from jfinkels/dd-nocache
dd: support the [io]flag=nocache option
2023-05-12 09:53:57 +02:00
Sylvestre Ledru
22a7f98a47
Merge pull request #4856 from cakebaker/cksum_fix_algorithm_output
cksum: fix output of --algorithm
2023-05-11 18:18:24 +02:00
John Shin
7a31d841ba
cp: preserve permission on -p --parents (#4853) 2023-05-11 16:44:23 +02:00
Daniel Hofstetter
0781ad0a65 cksum: fix output of --algorithm
for the algorithms md5, sha[1,224,256,384,512], blake2b, and sm3 from

<digest> <filesize> <filename>

to

<algo name> (<filename>) = <digest>

to use the same format as GNU cksum
2023-05-11 14:24:43 +02:00
SteveLauC
452be5a220
ls: device number for BSDs and solarishOS (#4841) 2023-05-11 12:58:36 +02:00
renovate[bot]
7983e23d53
fix(deps): update rust crate memmap2 to 0.6 2023-05-09 18:00:46 +00:00
Daniel Hofstetter
3f40ec4db7 basenc: add help texts for options 2023-05-09 09:44:48 +02:00
Daniel Hofstetter
49fd7c5697
Merge pull request #4847 from sylvestre/boc
doc: show a warning when no tldr example
2023-05-09 08:07:53 +02:00
renovate[bot]
30c166ad40
fix(deps): update rust crate libc to 0.2.144 2023-05-08 16:28:38 +00:00
Sylvestre Ledru
caf9bfcadc doc: show a warning when no tldr example 2023-05-08 17:48:23 +02:00
Daniel Hofstetter
d769871374
Merge pull request #4831 from sylvestre/mv-hardlink
mv: 'mv source hardlink' should fail
2023-05-08 16:12:23 +02:00
Sylvestre Ledru
594f81a88a mv --backup=simple a b on hard links should not fail
touch a
ln a b
./target/debug/coreutils mv --backup=simple a b

GNU: tests/mv/hard-4.sh
2023-05-08 13:08:20 +02:00
Daniel Hofstetter
f9536e9914
Merge pull request #4842 from sylvestre/aze
dd: fix some clippy warnings 'variable does not need to be mutable'
2023-05-08 07:44:55 +02:00
Sylvestre Ledru
1b99376d95 mv: split exec into smaller functions 2023-05-07 23:08:44 +02:00
Sylvestre Ledru
a5a39b6ba8 mv: 'mv source hardlink' should fail
fixes: tests/mv/force.sh
2023-05-07 23:08:41 +02:00
Sylvestre Ledru
b7cf825887 uucore::fs add an hardlink detection 2023-05-07 23:04:52 +02:00
Jeffrey Finkelstein
4ff318aee1 fixup! dd: support the [io]flag=nocache option 2023-05-07 16:33:21 -04:00
Sylvestre Ledru
916f014ef0 dd: fix some clippy warnings 'variable does not need to be mutable' 2023-05-07 18:46:08 +02:00
Jeffrey Finkelstein
bd18a2a344 dd: support the [io]flag=nocache option
Add support for the `iflag=nocache` and `oflag=nocache` to make `dd`
discard the filesystem cache for the processed portion of the input or
output file.
2023-05-07 11:43:13 -04:00
Jeffrey Finkelstein
cc2f97ba0d dd: add discard_cache() funcs for Input, Output
Add the `Input::discard_cache()` and `Output::discard_cache()`
functions. These allow discarding the filesystem cache when `dd` no
longer needs to access a specified portion of the input or output
file, respectively.
2023-05-07 11:43:13 -04:00
Jeffrey Finkelstein
12e4acaec3 dd: add bytes_total to ReadStat
Add the `bytes_total` field to the `ReadStat` struct. This lets the
main loop of `dd` keep track of the total number of bytes read.
2023-05-07 11:43:13 -04:00
renovate[bot]
214c027cfa
fix(deps): update rust crate libc to 0.2.143 2023-05-06 19:01:14 +00:00
Sylvestre Ledru
9dc8bc83a6
Merge pull request #4837 from m11o/tty-move-strings-to-md-file
tty: move help strings to markdown file
2023-05-06 19:51:23 +02:00
Daniel Hofstetter
93f28dacc0
Merge pull request #4834 from sylvestre/cognitive_complexity
Lower the clippy cognitive complexity & fix lines_filter_map_ok
2023-05-06 17:48:23 +02:00
Sylvestre Ledru
9ed7ac1481
Merge pull request #4826 from cakebaker/mv_4795
mv: if more than one of -i, -f, -n is specified, only the final one takes effect
2023-05-06 17:35:02 +02:00
m11o
1ac31ccfa0 tty: move help strings to markdown file 2023-05-07 00:27:16 +09:00
Sylvestre Ledru
d441d71aac
Merge pull request #4829 from m11o/tsort-move-strings-to-md-file
tsort: move help strings to markdown file
2023-05-06 14:55:49 +02:00
Sylvestre Ledru
cd688662ec fix some lines_filter_map_ok clippy warnings 2023-05-06 14:53:42 +02:00
Sylvestre Ledru
f8d7bebed3 ignore some cognitive_complexity for now 2023-05-06 14:50:55 +02:00
Daniel Hofstetter
40aaae003e
mv: improve help text
Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
2023-05-06 13:25:35 +02:00
Sylvestre Ledru
8f4367c3bc
to make it clearer 2023-05-06 10:32:18 +02:00
m11o
94daed8afb tsort: move help strings to markdown file 2023-05-06 00:34:55 +09:00
Daniel Hofstetter
4481604f87 cp: fix "after help" output 2023-05-05 16:12:34 +02:00
Daniel Hofstetter
ea2b725abb mv: fix help output 2023-05-05 15:17:37 +02:00
Daniel Hofstetter
93c8623da9 mv: if more than one of -i, -n, -f, latest "wins" 2023-05-05 15:17:37 +02:00
Daniel Hofstetter
4ee1118061
Merge pull request #4823 from shinhs0506/mv-i-dir-file
fix tests/mv/i-5.sh
2023-05-04 13:43:05 +02:00
Daniel Hofstetter
616a166e36
Merge pull request #4820 from sylvestre/thru-dangling-2
cp: fix cp -f f loop when loop is a symlink loop
2023-05-04 08:20:57 +02:00
m11o
a822890939 fix help message in chgrp 2023-05-04 08:41:56 +09:00
John Shin
1c8aac0883 mv: return err if response is negative when moving a dir to existing dest during an interactive mode 2023-05-03 16:05:21 -07:00
Sylvestre Ledru
832fd2d2c6 cp: fix cp -f f loop when loop is a symlink loop
Fix: tests/cp/thru-dangling.sh
2023-05-03 19:54:35 +02:00
Sylvestre Ledru
6547bec2ef uucore/detect_symlink_loop: add a function to detect symlink loops 2023-05-03 19:54:33 +02:00
Thomas Hurst
01a8623d21 dd: Add documentation to Alarm struct 2023-05-03 16:31:14 +00:00
Thomas Hurst
546631c8e7 dd: Tidy includes 2023-05-03 16:30:53 +00:00
Daniel Hofstetter
a97199f72a
Merge pull request #4796 from shinhs0506/mv-cp-update
mv, cp: add support for --update=none,all,older
2023-05-03 15:21:21 +02:00
Daniel Hofstetter
82eb04c5a9
Merge pull request #4777 from Joining7943/tail-change-text-static-to-const
'tail': Change static global variables to const
2023-05-03 09:31:34 +02:00
Sylvestre Ledru
aae3f2f99c Ride along: fix some trivial clippy warnings 2023-05-02 23:22:39 +02:00
John Shin
898628fa3a core: fix typo in update control 2023-05-02 13:54:31 -07:00
John Shin
3b8f3d04f4 core: remove unnecessary if statement in update control 2023-05-02 12:49:49 -07:00
Masahito Osako
90e0d3030f
test: move help strings to markdown file (#4816) 2023-05-02 21:48:59 +02:00
John Shin
460d346069 core: remove '' case for the update argument 2023-05-02 12:42:39 -07:00
John Shin
06d4603bea core: fix typo in update control 2023-05-02 12:40:04 -07:00
John Shin
36e93e12d6 core: add header notice for update control 2023-05-02 12:38:12 -07:00
Daniel Hofstetter
3f8e21c36c
Merge pull request #4812 from sylvestre/thru-dangling
cp: add support POSIXLY_CORRECT=1 when dealing with dangling links
2023-05-02 10:00:18 +02:00
John Shin
60c0b661c3 core: fix typo in update control 2023-05-01 17:22:08 -07:00
Daniel Hofstetter
6d89e9bfd7 cksum: remove "-a="s from markdown file 2023-05-01 15:57:56 +02:00
John Shin
6625cfe88a mv: fix documentation 2023-05-01 03:54:04 -07:00
John Shin
92e1b3f7c0 cp: fix documentation 2023-05-01 03:53:52 -07:00
John Shin
c5327cf0a0 core: add docs for update control 2023-05-01 03:48:37 -07:00
Sylvestre Ledru
2d4dfc3d7d cp: add support POSIXLY_CORRECT=1 when dealing with dangling links
GNU: tests/cp/thru-dangling.sh
2023-05-01 11:05:00 +02:00
John Shin
b707b690c5 cp: remove long help 2023-04-30 20:16:01 -07:00
John Shin
85ded232bc mv: resolve merge conflict 2023-04-30 20:09:32 -07:00
John Shin
f83468d530 mv: move after help to md file 2023-04-30 20:03:22 -07:00
John Shin
2f975e913e cp: move after help to md file 2023-04-30 20:02:53 -07:00
John Shin
ed3ff10540 cp: write tests for --update 2023-04-30 19:29:49 -07:00
John Shin
2f8df653c5 core mv cp: update help doc for 'update' functionality 2023-04-30 18:53:11 -07:00
iambasanta
70b69efadb
sort: Move help strings to markdown file (#4808)
* sort: Move help strings to markdown file

* Correction for spell check
2023-04-30 19:50:28 +02:00
Daniel Hofstetter
599e7a0645
Merge pull request #4805 from iambasanta/tr-move-help-strings-to-md-file
tr: move help string to markdown file
2023-04-30 14:26:22 +02:00
Masahito Osako
e46b05722f
timeout: move help strings to markdown file (#4806)
* timeout: move help strings to markdown file
2023-04-30 08:51:14 +02:00
iambasanta
22490ae978 tr: move help string to markdown file 2023-04-30 10:32:58 +05:45
Daniel Hofstetter
7cfdbe676c mv: validate --target arg 2023-04-29 16:16:00 +02:00
Sylvestre Ledru
c5fb6eac9f
Merge pull request #4794 from shinhs0506/mv-target-dir
mv: check if --target is a directory
2023-04-29 10:40:44 +02:00
m11o
bc7a01dd3b sync: move help strings to markdown file 2023-04-29 15:51:55 +09:00
Sylvestre Ledru
9f9847188d
Merge pull request #3661 from cakebaker/unescaped_backslash
paste: handle list ending with unescaped backslash
2023-04-28 16:53:26 +02:00
Daniel Hofstetter
c254900db9 paste: handle list ending with unescaped backslash 2023-04-28 14:33:53 +02:00
m11o
3ca1fa8dfd sum: move help strings to markdown file 2023-04-28 20:21:44 +09:00
Sylvestre Ledru
b33986de86
Merge pull request #4366 from BartMassey-upstream/name-weirdness
coreutils: fixed panic when multi-call binary has funny name
2023-04-28 09:27:05 +02:00
m11o
0391239273 fix cargo fmt 2023-04-27 22:17:37 +09:00
m11o
c49769865a stty: move help strings to markdown file 2023-04-27 22:14:52 +09:00
John Shin
9dc84e9061 cp: implement update=[switch] 2023-04-27 04:49:27 -07:00
John Shin
0e8dd894a3 mv: implement update=[switch] 2023-04-27 04:48:41 -07:00
John Shin
ecde4b6aa3 core: introduce update controller for mv and cp 2023-04-27 04:47:59 -07:00
Sylvestre Ledru
eb8f353a2f
date usage help: Remove the examples in the description table
we have a new column with examples
2023-04-27 09:17:39 +02:00
Masahito Osako
746331cc65
stdbuf: move help strings to markdown file (#4792) 2023-04-27 08:13:46 +02:00
Daniel Hofstetter
dffd2f082e
Merge pull request #4789 from sylvestre/doc
Improve the date md page
2023-04-27 07:19:45 +02:00
Sylvestre Ledru
474d391eb1
Merge pull request #4790 from sylvestre/date_use_humantime_to_duration
date -d supports - 1 year ago, 2 second, etc
2023-04-26 23:54:49 +02:00
Sylvestre Ledru
360cbda0c5
Merge pull request #4782 from cakebaker/mv_no_clobber_behavior_change
mv: adapt -n behavior to GNU mv 9.3
2023-04-26 22:47:12 +02:00
Sylvestre Ledru
111723aa84 rename date-usage.mkd => date-usage.md 2023-04-26 22:43:48 +02:00
Sylvestre Ledru
825d240ef0 date -d supports - 1 year ago, 2 second, etc 2023-04-26 22:14:15 +02:00
John Shin
aeeb3c90cf mv: check if --target is a directory 2023-04-26 11:15:41 -07:00
Sylvestre Ledru
0f268428fe
Merge pull request #4379 from ZauJulio/hotfix-mktemp
mktemp: fix PrefixContainsDirSeparator verification
2023-04-26 18:28:56 +02:00
Sylvestre Ledru
583a247d9d Improve the date md page 2023-04-26 08:48:13 +02:00
Sylvestre Ledru
4997851d5b
Merge pull request #4787 from shinhs0506/mv-verbose
mv: add 'renamed " in the beginning of the message when verbose flag is set
2023-04-26 08:34:42 +02:00
John Shin
d4630c83b4 mv: add 'renamed ' in the beginning when verbose flag is set 2023-04-25 21:27:52 -07:00
m11o
0b84aa52f3 fix check-spell 2023-04-25 22:26:47 +09:00
m11o
869614d343 fix cargo fmt 2023-04-25 22:01:10 +09:00
m11o
98dd31c00d split: move help strings to markdown file 2023-04-25 22:00:22 +09:00
Daniel Hofstetter
804274dbf4 mv: adapt -n behavior to GNU mv 9.3 2023-04-25 11:33:48 +02:00
Sylvestre Ledru
6115af6386
Merge pull request #4769 from sylvestre/touch
touch: improve support for dangling link
2023-04-25 08:26:23 +02:00
Sylvestre Ledru
d3fc670f65
Merge pull request #4781 from sunfishcode/sunfishcode/fix-warning
Fix a warning in upstream code on Rust nightly.
2023-04-25 07:57:02 +02:00
Daniel Hofstetter
714206dd25
Merge pull request #4778 from sylvestre/use_humantime_to_duration
Use the humantime_to_duration crate
2023-04-25 07:05:03 +02:00
Dan Gohman
f187a5ccff Fix a warning in upstream code on Rust nightly.
Rust nightly recently [started] issuing the following warning when
compiling coreutils:

[started]: https://github.com/rust-lang/rust/pull/109944

```
warning: getting the inner pointer of a temporary `CString`
   --> src/uucore/src/lib/features/entries.rs:324:67
    |
324 |                         let data = $fnam(CString::new(k).unwrap().as_ptr());
    |                                          ------------------------ ^^^^^^ this pointer will be invalid
    |                                          |
    |                                          this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
...
340 | f!(getpwnam, getpwuid, uid_t, Passwd);
    | ------------------------------------- in this macro invocation
    |
    = note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
    = help: for more information, see https://doc.rust-lang.org/reference/destructors.html
    = note: `#[warn(temporary_cstring_as_ptr)]` on by default
    = note: this warning originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
```

There doesn't seem to be an actual problem in this case, as the pointer is
only used within the statement.
2023-04-24 14:31:05 -07:00
Sylvestre Ledru
d1aa1ac963 Use the humantime_to_duration crate 2023-04-24 22:23:07 +02:00
m11o
dd89ec709b remove todo comment
`-f` option is implemented in #2918
2023-04-24 23:44:28 +09:00
m11o
1cb0a673a0 change static keyword to const keyword 2023-04-24 23:38:45 +09:00
m11o
fd02bd13a1 seq: move help strings to md file 2023-04-24 23:35:52 +09:00
Sylvestre Ledru
c262fa936c Improve the doc and simplify the code
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-04-24 12:03:21 +02:00
Sylvestre Ledru
84e0610487 touch: don't generate an error on 'touch -h -' 2023-04-24 12:03:21 +02:00
Sylvestre Ledru
aaea758b6a touch: -h should not fail when running on broken symlink
Fixes more of tests/touch/no-dereference.sh
2023-04-24 12:03:21 +02:00
Sylvestre Ledru
c3656e561c touch: -h -r should not fail when running on broken symlink
Fixes the beginning of:
tests/touch/no-dereference.sh
2023-04-24 12:03:21 +02:00
Sylvestre Ledru
417d238bba
Merge pull request #4773 from cakebaker/mv_fix_issue_4724
mv: show no error if overwriting is declined in interactive mode
2023-04-24 08:58:21 +02:00
Daniel Hofstetter
f9b60c4232
Merge pull request #4776 from vikiminki/factor_flush
Add flush after calculating factor
2023-04-24 08:09:17 +02:00
Masahito Osako
d18ccc6a2a
runcon: move help strings to markdown file (#4774) 2023-04-24 08:01:28 +02:00
Joining7943
d1454628e1 tail: Change static global variables to const 2023-04-23 23:11:20 +02:00
vix
f9b7423eef Add flush after calculating factor 2023-04-23 20:35:13 +02:00
Daniel Hofstetter
e94f1d8eb7 mv: -i show no error if overwriting is declined 2023-04-23 15:27:24 +02:00
m11o
31c1d9c956 fix format 2023-04-22 16:33:58 +09:00
m11o
b84a94b889 refactor: use override_help instead of override_usage 2023-04-22 16:11:36 +09:00
m11o
e82ba6e707 readlink: move help strings to markdown file 2023-04-22 16:10:26 +09:00
Sylvestre Ledru
48f9786164
Merge pull request #4761 from cakebaker/uudoc_fix_clippy_warnings
uudoc: fix clippy warnings
2023-04-21 15:52:19 +02:00
Daniel Hofstetter
3272d14fab uudoc: fix clippy warnings 2023-04-21 10:14:44 +02:00
Daniel Hofstetter
98fb8fa144 test,wc: use vars directly in format! strings 2023-04-21 08:33:56 +02:00
renovate[bot]
790958e4f3
fix(deps): update rust crate libc to 0.2.142 2023-04-20 17:09:10 +00:00
Terts Diepraam
19add3a4bd
Merge pull request #4398 from cakebaker/uudoc_simplify_about_text_generation
uudoc, uucore_procs: move markdown parsing to HelpParser
2023-04-20 11:29:16 +02:00
Terts Diepraam
d68fd68b5f
Merge pull request #4734 from Joining7943/tail-fix-args-parsing-follow-mode
tail/args: Fix parsing when -F is used together with --retry or --follow
2023-04-20 09:43:24 +02:00
renovate[bot]
54178d491c
fix(deps): update rust crate dunce to 1.0.4 2023-04-19 16:14:17 +00:00
Joining7943
20e32971dd tail/args: Fix parsing when -F is used together with --retry or --follow 2023-04-18 21:47:20 +02:00