Sylvestre Ledru
5bcc53ecde
Merge pull request #2771 from E3uka/next_prev
...
more: add next-line and prev-line command.
2021-12-15 23:39:09 +01:00
electricboogie
a1960f5da0
Fix cp bug: pre-write permission change ( #2769 )
2021-12-15 22:18:02 +01:00
Ebuka Agbanyim
d2095edf6c
more: add next-line and prev-line command.
2021-12-14 19:32:38 +00:00
Ebuka Agbanyim
0bf2266ef0
more: use UResult
2021-12-13 00:37:34 +00:00
electricboogie
c7f7a222b9
Fix mv bug: Should be able to stat files, but not able to mv if source and target are the same ( #2763 )
...
Closes #2760
2021-12-12 17:49:38 +01:00
Jan Verbeek
f2ddae93fa
uucore::entries: Make Passwd::locate and Group::locate thread-safe
2021-11-26 14:48:33 +01:00
Hanif Ariffin
c86cb91dee
Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
2021-11-26 16:39:27 +08:00
Sylvestre Ledru
fe286fa8c8
Merge pull request #2749 from thomasqueirozb/utils_uresult
...
basename+date+fold+nl+nproc+shuf+uname: use UResult
2021-11-25 13:43:46 +01:00
Smicry
81a1fde9f4
tail use UResult
2021-11-21 12:37:56 +08:00
Hanif Ariffin
38659de66d
Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
2021-11-20 17:06:36 +08:00
Hanif Ariffin
0d3fa51d1e
Add license headers
...
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2021-11-20 17:04:28 +08:00
Roy Ivy III
7e06ddaa92
fix/tee ~ repair 'unstable_name_collisions' compiler warning
2021-11-19 21:40:22 -06:00
Roy Ivy III
7784a252f2
fix/yes ~ revise to match 'nix' changes
2021-11-19 18:04:53 -06:00
Roy Ivy III
03e0cbb020
update 'nix' within workspace to force patched version
2021-11-19 17:55:03 -06:00
Roy Ivy III
f07a1749a1
fix spell-check errors
2021-11-19 17:55:02 -06:00
Roy Ivy III
f20aa49821
maint/CICD ~ (GHA) fix cargo-udeps
false positives (add 'ignore' exceptions to sub-crates)
2021-11-19 17:55:02 -06:00
Sylvestre Ledru
43bdcaf212
Merge pull request #2532 from hbina/hbina-rm-silently-accept-presume-input-tty
...
Silently accepts ---presume-input-tty
2021-11-19 21:42:41 +01:00
Sylvestre Ledru
b4416abc82
Merge pull request #2743 from thomasqueirozb/who_uresult
...
who: use UResult
2021-11-19 21:41:14 +01:00
Sylvestre Ledru
01440734a4
Merge pull request #2735 from thomasqueirozb/printenv_env_compat
...
env+printenv: use UResult + improve compatibility
2021-11-19 21:39:34 +01:00
Sylvestre Ledru
da69ab19db
Merge pull request #2745 from thomasqueirozb/chmod_uresult
...
chmod: use UResult
2021-11-19 21:38:31 +01:00
Smicry
fc851e036b
Implement tail -<number> ( #2747 )
...
And add obsolete_syntax test
2021-11-19 21:37:47 +01:00
Thomas Queiroz
ed3e6b5201
uname: use UResult
2021-11-16 20:35:28 -03:00
Thomas Queiroz
06f3db8c55
shuf: use UResult
2021-11-16 20:35:28 -03:00
Thomas Queiroz
bcef1d6cca
nproc: use UResult
2021-11-16 20:35:28 -03:00
Thomas Queiroz
f015b041ec
nl: use UResult
2021-11-16 20:35:28 -03:00
Thomas Queiroz
a7d18f43b4
fold: use UResult
2021-11-16 20:35:28 -03:00
Thomas Queiroz
abc93d6f17
date: use UResult
2021-11-16 20:35:28 -03:00
Thomas Queiroz
2dc4cba64a
basename: use UResult
2021-11-16 17:51:56 -03:00
Roy Ivy III
363453f5e4
tests ~ (factor) refactor divisor()
to return quickcheck::TestResult
...
- return standard quickcheck results
- drop `a == 0 && b == 0` from test domain via TestResult::discard()
- avoid divide by zero panics
- ref: #1589
2021-11-13 14:18:23 -06:00
Roy Ivy III
740d8e9bc5
docs/factor ~ (BENCHMARKING.md) fix formatting, returning missing newlines
2021-11-13 11:07:02 -06:00
Hanif Bin Ariffin
da46cc8015
Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
2021-11-13 18:33:25 +08:00
Thomas Queiroz
670ed6324b
chmod: use UResult
2021-11-12 18:29:08 -03:00
Sylvestre Ledru
177374aa5a
Merge pull request #2740 from jfinkels/seq-inf-width-spaces
...
seq: correct fixed-width spacing for inf sequences
2021-11-12 21:16:40 +01:00
nicoo
bed45602a7
factor/Cargo.toml: Document feature pending a MinRustV bump
2021-11-10 15:26:36 +01:00
nicoo
32b0178a72
factor: Update to current versions of smallvec
...
smallvec 1.0 and later wasn't compatible with Rust 1.33 but the
minimum supported Rust version for coreutils moved on.
2021-11-10 15:12:37 +01:00
Thomas Queiroz
cbe6d7d5c1
who: use UResult
2021-11-09 20:00:34 -03:00
Jeffrey Finkelstein
0b86afa858
seq: correct fixed-width spacing for inf sequences
...
Pad infinity and negative infinity values with spaces when using the
`-w` option to `seq`. This corrects the behavior of `seq` to match that
of the GNU version:
$ seq -w 1.000 inf inf | head -n 4
1.000
inf
inf
inf
Previously, it incorrectly padded with 0s instead of spaces.
2021-11-08 20:12:54 -05:00
jfinkels
2e12316ae1
seq: use BigDecimal to represent floats ( #2698 )
...
* seq: use BigDecimal to represent floats
Use `BigDecimal` to represent arbitrary precision floats in order to
prevent numerical precision issues when iterating over a sequence of
numbers. This commit makes several changes at once to accomplish this
goal.
First, it creates a new struct, `PreciseNumber`, that is responsible for
storing not only the number itself but also the number of digits (both
integer and decimal) needed to display it. This information is collected
at the time of parsing the number, which lives in the new
`numberparse.rs` module.
Second, it uses the `BigDecimal` struct to store arbitrary precision
floating point numbers instead of the previous `f64` primitive
type. This protects against issues of numerical precision when
repeatedly accumulating a very small increment.
Third, since neither the `BigDecimal` nor `BigInt` types have a
representation of infinity, minus infinity, minus zero, or NaN, we add
the `ExtendedBigDecimal` and `ExtendedBigInt` enumerations which extend
the basic types with these concepts.
* fixup! seq: use BigDecimal to represent floats
* fixup! seq: use BigDecimal to represent floats
* fixup! seq: use BigDecimal to represent floats
* fixup! seq: use BigDecimal to represent floats
* fixup! seq: use BigDecimal to represent floats
2021-11-06 15:44:42 +01:00
equal-l2
cda3d5a29b
ls: add possible value for --color=
2021-11-06 03:42:27 +09:00
Thomas Queiroz
a290c77cfc
env: add contributor
2021-11-04 20:18:59 -03:00
Hanif Bin Ariffin
ac68bc9ac7
Merge branch 'master' of github.com:uutils/coreutils into hbina-rm-silently-accept-presume-input-tty
2021-11-04 16:57:14 +08:00
Hanif Bin Ariffin
a9bc457d89
Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
2021-11-04 16:55:55 +08:00
Thomas Queiroz
8ad95c375a
env: force specifying command with --chdir
2021-11-02 20:06:23 -03:00
Thomas Queiroz
013405d1e6
env: change -c to -C
2021-11-02 19:51:45 -03:00
Thomas Queiroz
3d74e7b452
env: prevent panic when unsetting invalid variable
2021-11-02 19:42:52 -03:00
Thomas Queiroz
db00fab7e4
env: use UResult everywhere
2021-11-02 19:17:54 -03:00
Thomas Queiroz
b157a73a1f
printenv: change exit code when variable not found
...
GNU printenv has this behavior
2021-11-02 18:36:28 -03:00
Thomas Queiroz
f2a3a1f920
printenv: use UResult
2021-11-02 18:36:28 -03:00
Michael Debertol
a05628f018
Merge pull request #2731 from thomasqueirozb/env_empty_name
...
env: don't panic when name is empty
2021-11-02 21:33:42 +01:00
Thomas Queiroz
1afc7242a5
env: change comment
2021-11-02 17:23:34 -03:00
Thomas Queiroz
c58bd9f569
env: don't panic when name is empty
2021-11-02 16:40:03 -03:00
Hanif Bin Ariffin
5a056c2c93
Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
2021-11-02 20:58:03 +08:00
Michael Debertol
7c94bb082e
Merge pull request #2726 from thomasqueirozb/strip_pre_suffix
...
uu+tests: use strip_prefix and strip_suffix
2021-11-01 23:34:27 +01:00
Michael Debertol
3fdff304db
cp: handle edge cases when dest is a symlink
...
- Fail if dest is a dangling symlink
- Fail if dest is a symlink that was previously created by the same
invocation of cp
2021-11-01 22:48:48 +01:00
Michael Debertol
8696193b66
cat: use FileInformation from uucore
2021-11-01 22:42:15 +01:00
Hanif Bin Ariffin
33b5e67bea
Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
2021-10-30 10:01:41 +08:00
Kevin Burke
3e1c5c2d99
rm: allow -r flag to be specified multiple times
...
GNU rm allows the `-r` flag to be specified multiple times, but
uutils/coreutils would previously exit with an error.
I encountered this while attempting to run `make clean` on the
Postgres source tree (github.com/postgres/postgres).
Updates #1663 .
2021-10-28 22:47:07 -07:00
Hanif Bin Ariffin
02fd7176b7
Merge branch 'master' of https://github.com/uutils/coreutils into hbina-tr-reimplement-expansion
2021-10-27 13:08:57 +08:00
Thomas Queiroz
007f1b9f84
uu+tests: use strip_prefix and strip_suffix
2021-10-24 12:23:32 -03:00
Sylvestre Ledru
15fcbf3aac
Merge pull request #2728 from thomasqueirozb/uniq_uresult
...
uniq: use UResult
2021-10-24 09:46:22 +02:00
Hanif Bin Ariffin
002584d0dd
Merge branch 'hbina-tr-reimplement-expansion' of github.com:hbina/coreutils into hbina-tr-reimplement-expansion
2021-10-24 11:41:19 +08:00
Hanif Bin Ariffin
2dad536785
Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-10-24 11:40:42 +08:00
Thomas Queiroz
ea9b239841
uniq: use UResult
2021-10-24 00:03:33 -03:00
Thomas Queiroz
1f15b8fce4
cksum: use while loops instead of unroll!
2021-10-23 23:25:22 -03:00
Thomas Queiroz
21a2d0ce40
sort: use Range.is_empty
2021-10-23 23:22:21 -03:00
Thomas Queiroz
5e5bb91043
sort: remove unecessary implementation
2021-10-23 23:21:45 -03:00
Sylvestre Ledru
43e85ae9ce
install: Also import fs from uucore
2021-10-24 00:33:00 +02:00
Sylvestre Ledru
6946377e02
cp: Also import entries from uucore
2021-10-24 00:29:24 +02:00
Sylvestre Ledru
b5977021bc
Fix the uu_base32 dep
2021-10-24 00:12:05 +02:00
Sylvestre Ledru
995826e4a2
Merge pull request #2724 from sylvestre/silent-a-warning-2
...
Ignore two question-mark warnings
2021-10-23 23:46:59 +02:00
Sylvestre Ledru
d286c3ba4b
Merge pull request #2723 from Smicry/master
...
uniq: use UResult in util
2021-10-23 21:35:51 +02:00
Sylvestre Ledru
a5bc2211d5
Ignore two question-mark warnings
2021-10-23 20:59:19 +02:00
Sylvestre Ledru
f28da04fc5
Merge pull request #2722 from sylvestre/version
...
Prepare version 0.0.8
2021-10-23 20:56:27 +02:00
Smicry
0ffbf28cba
uniq: use UResult in util
2021-10-24 02:02:49 +08:00
Sylvestre Ledru
59e9870c56
Prepare version 0.0.8
2021-10-23 19:21:50 +02:00
Sylvestre Ledru
3ffc4c07eb
fix a map-clone warning
2021-10-23 19:19:52 +02:00
Sylvestre Ledru
4c8b74797f
Silent question_mark clippy warnings
2021-10-23 19:19:36 +02:00
Sylvestre Ledru
610fde45ef
Merge pull request #2709 from jaggededgedjustice/support-symboli-modes
...
Add symbolic mode support to mkdir
2021-10-23 17:54:15 +02:00
Sylvestre Ledru
811698b658
Merge pull request #2712 from jfinkels/head-take-lines-reader
...
head: use std::io::copy() with TakeLines reader
2021-10-23 17:53:44 +02:00
Sylvestre Ledru
803c05cb4a
Merge pull request #2720 from Smicry/master
...
head: use UResult in util
2021-10-23 17:53:35 +02:00
Hanif Bin Ariffin
6c67f19df4
Merge branch 'master' of https://github.com/uutils/coreutils into hbina-tr-reimplement-expansion
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-10-21 13:31:51 +08:00
Jeffrey Finkelstein
858b0a9e9f
head: use std::io::copy() with TakeLines reader
...
Replace the custom `split::walk_lines()` function with a call to
`std::io::copy()`, using a new `TakeLines` reader as the source and
`stdout` as the destination. The `TakeLines` reader is an adaptor that
scans the bytes being read for line ending characters and stops the
reading after a given number of lines has been read (similar to the
`std::io::Take` adaptor).
This change
* makes the `read_n_lines()` function more concise,
* allows it to mirror the implementation of `read_n_bytes()`,
* increases the speed of `head -n NUM`.
2021-10-20 20:59:44 -04:00
Smicry
b89b11f5da
fix lint error
2021-10-21 00:22:36 +08:00
Smicry
396fa7a9b4
fix lint error
2021-10-21 00:13:28 +08:00
Smicry
2cbc2aa59b
head: use UResult in util
2021-10-20 23:49:04 +08:00
Sylvestre Ledru
ede77c6099
Merge pull request #2711 from jfinkels/hashsum-crlf-windows-across-blocks
...
hashsum: fix handling of \r\n in Windows text mode
2021-10-19 20:50:16 +02:00
Smicry
cb34b660cb
add tail usage
2021-10-19 00:15:17 +08:00
James Robson
0b2483452a
Add symbolic mode support to mkdir
2021-10-16 12:57:55 +01:00
Sylvestre Ledru
40a895f79d
Merge pull request #2705 from adamreichold/tac-mmap
...
Minor improvements to tac
2021-10-12 21:51:38 +02:00
Hanif Bin Ariffin
c4de592e90
Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-10-12 07:39:06 +08:00
Jeffrey Finkelstein
429e1d0f12
head: use default() instead of new() for options
...
Remove the `HeadOptions::new()` function in favor of the `Default`
implementation. Both were implemented, but only `Default::default()` is
needed.
2021-10-11 18:30:03 -04:00
Jeffrey Finkelstein
d1e02665bf
fixup! hashsum: fix handling of \r\n in Windows text mode
2021-10-11 18:18:29 -04:00
Jeffrey Finkelstein
c50b5ac110
hashsum: fix handling of \r\n in Windows text mode
...
Fix a bug in which "\r\n" was not being replaced with "\n" in text mode
on Windows. This would happen only if one call to `write()` ended with a
"\r" character and the next call to `write()` started with a "\n"
character. This commit fixes the bug by buffering a "\r" character if it
appears at the end of one call to `write()` and only writing if the
first character in the next call to `write()` is *not* a "\n" character.
Fixes issue #2681 .
2021-10-11 17:36:08 -04:00
Adam Reichold
86d22aaa1d
tac: Add a simple how to for benchmarking
2021-10-10 14:29:37 +02:00
Adam Reichold
c526df57b8
tac: opportunistically use memory maps
...
Since tac must read its input files completely to start processing them
from the end, it is particularly suited to use memory maps to benefit
from the page cache maintained by the operating systems to bring the
necessary data into memory as required.
This does also include situations where the input is stdin, but not via
a pipe but for example a file descriptor set up by the user's shell
through an input redirection.
2021-10-10 13:20:31 +02:00
Adam Reichold
4eab275235
tac: buffer stdout more coarsely than line-based following the GNU tac implementation.
2021-10-10 13:20:31 +02:00
Adam Reichold
28b04fa899
tac: do not use a buffered read as fs::read is more efficient and io::Stdin is buffered internally
2021-10-10 13:20:31 +02:00
Adam Reichold
0d583754ca
tac: lock stdout only once instead for each line
2021-10-10 13:20:31 +02:00
Adam Reichold
e041fda51d
tac: do not re-compile regular expression for each file
2021-10-10 13:20:31 +02:00
Adam Reichold
b4864d760e
pr: fix locking of stdout
2021-10-10 11:33:46 +02:00
Jan Scheer
3e985cb029
Merge branch 'master' into fix_chroot_2687
2021-10-10 01:04:25 +02:00
Sylvestre Ledru
080d3d2fa7
Merge pull request #2697 from vulppine/cp-uresult
...
cp: uumain returns UResult, implements UError for Error enum in cp.rs
2021-10-09 11:03:33 +02:00
Sylvestre Ledru
03a037e8ea
Merge pull request #2701 from vulppine/seq-hex
...
seq: Adds hexadecimal integer parsing
2021-10-09 11:01:42 +02:00
vulppine
cddd40b4e1
seq: Updates hex parse readability, adds hex test
2021-10-05 18:41:28 -07:00
Hanif Bin Ariffin
c04a0185aa
Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-10-05 16:32:03 +08:00
Thomas Queiroz
e2fa6f9412
users: use UResult
2021-10-04 19:53:46 -03:00
Thomas Queiroz
00c9710206
uucore_procs+uu: specify uucore::show_error
...
This allows crates to use `#[uucore_procs::gen_uumain]` without `use uucore::show_error` or
#[macro_use]
extern crate uucore;
Removed unecessary usage
2021-10-04 19:53:16 -03:00
Sylvestre Ledru
368fa54520
Merge pull request #2703 from thomasqueirozb/base_uresult
...
base32 + base64 + basenc: use UResult
2021-10-03 17:34:56 +02:00
Thomas Queiroz
b924774c8a
basenc: use UResult
2021-10-02 23:17:16 -03:00
Thomas Queiroz
452329ad19
base64: use UResult
2021-10-02 23:15:40 -03:00
Thomas Queiroz
97df700d67
base32: use UResult
2021-10-02 23:12:09 -03:00
Thomas Queiroz
9dd401c358
base32: base_common use UResult
2021-10-02 23:10:00 -03:00
vulppine
d5caa0d9d8
seq: Adds hexadecimal integer parsing
2021-10-02 08:15:25 -07:00
Jeffrey Finkelstein
548a5121ae
dd: use assert! instead of if then panic!
2021-10-02 10:15:15 -04:00
Jeffrey Finkelstein
6aee05a0f1
od: use assert! instead of if then panic!
2021-10-02 09:46:43 -04:00
Jeffrey Finkelstein
de158c0122
sort: replace redundant closure with function itself
2021-10-02 09:46:43 -04:00
Jeffrey Finkelstein
06ae968ecf
csplit: use assert! instead of if then panic!
2021-10-02 09:46:43 -04:00
Jeffrey Finkelstein
71b7d6b57d
more: remove redundant mut from stdout accesses
2021-10-02 09:46:43 -04:00
Jeffrey Finkelstein
d013461a6f
ls: replace redundant closure with function itself
2021-10-02 09:46:43 -04:00
Sylvestre Ledru
b2fa51ddd9
Merge pull request #2656 from jhscheer/ls_selinux
...
`ls`: add support for showing SELinux context (--context/-Z)
2021-10-02 12:56:09 +02:00
Hanif Bin Ariffin
de605829bf
Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
2021-10-02 18:18:52 +08:00
vulppine
4319248bb6
cp: Changes '1' to 'EXIT_ERR' in UError impl
2021-10-01 16:45:19 -07:00
vulppine
c64f09dc59
cp: Adds a needed macro, changes a return
2021-10-01 15:18:05 -07:00
vulppine
4ff5fea502
cp: uumain returns UResult, UError for Error
2021-10-01 14:58:26 -07:00
Sylvestre Ledru
01d098993b
Merge pull request #2662 from Smicry/master
...
add kill -l final new line #2644
2021-09-29 09:58:50 +02:00
Thomas Queiroz
3882df5cdc
expr: use UResult
2021-09-25 15:36:04 -03:00
Jan Scheer
8cd8c25b0d
ls: silence clippy warnings if feat_selinx is not set
2021-09-22 13:49:08 +02:00
Jan Scheer
8f229aad87
ls: move SELinux String building logic to its own function
2021-09-22 12:24:27 +02:00
Jan Scheer
8c0b7d1314
chroot: move logic so it can be triggered by tests
...
* move the command building logic before the `chroot` syscall so it
will be reachable by tests that don't have root permissions.
2021-09-22 11:59:43 +02:00
Raphaël Thériault
6931dd11f1
Use non-yanked version of digest crate in hashsum
2021-09-19 12:38:56 -07:00
Hanif Bin Ariffin
f464879b12
Reduce MSRV to 1.47.0
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-09-19 23:15:28 +08:00
Hanif Bin Ariffin
9ab4f3de2f
Merge branch 'master' of github.com:uutils/coreutils into hbina-tr-reimplement-expansion
2021-09-19 23:01:48 +08:00
Jan Scheer
94fbe1edef
chroot
: quick fix for #2687
...
* fixes #2687
* change error message to better mimic GNU
2021-09-19 13:58:44 +02:00
Sylvestre Ledru
8d418cd61c
Merge pull request #2672 from oeble/kill_with_signal_name
...
Kill with signal name
2021-09-18 22:55:27 +02:00
Sylvestre Ledru
3e8b4045c8
Merge pull request #2675 from blyxxyz/whoami-cleanup
...
whoami: Cleanup
2021-09-18 17:20:09 +02:00
Sylvestre Ledru
b59bbddcbf
Merge pull request #2663 from jfinkels/hashsum-std-io-copy
...
hashsum: use std::io::copy() to simplify digest
2021-09-18 17:19:16 +02:00
Jan Verbeek
7ea2bfbe26
seq: replace loops with a single format string
...
Replace two loops that print leading and trailing 0s when printing a
number in fixed-width mode with a single call to `write!()` with the
appropriate formatting parameters.
2021-09-18 10:27:03 -04:00
Jeffrey Finkelstein
bfb1327ad4
seq: use print_seq_integers() regardless of last
...
Ensure that the `print_seq_integers()` function is called when the first
number and the increment are integers, regardless of the type of the
last value specified.
2021-09-18 10:27:03 -04: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
7fea771f32
hashsum: use std::io::copy() to simplify digest
...
Create a `DigestWriter` struct that implements `Write` by passing bytes
directly to `Digest::input()`, so that `hashsum` can use
`std::io::copy()`. Using `std::io::copy()` eliminates some boilerplate
code around reading and writing bytes. And defining `DigestWriter` makes
it easier to add a `#[cfg(windows)]` guard around the Windows-specific
replacement of "\r\n" with "\n".
2021-09-18 09:51:33 -04:00
Jeffrey Finkelstein
3854a97749
seq: remove unused Number::num_digits() function
...
Remove the `Number::num_digits()` function in favor of the
`digits::num_integral_digits()` functions.
2021-09-17 23:50:13 -04:00
Jeffrey Finkelstein
2ac5dc0a70
seq: compute correct width for scientific notation
...
Change the way `seq` computes the number of digits needed to print a
number so that it works for inputs given in scientific notation.
Specifically, this commit parses the input string to determine whether
it is an integer, a float in decimal notation, or a float in scientific
notation, and then computes the number of integral digits and the number
of fractional digits based on that. This also supports floating point
negative zero, expressed in both decimal and scientific notation.
2021-09-17 23:49:54 -04:00
Jan Scheer
79d838b1c3
Merge branch 'master' into ls_selinux
2021-09-17 14:14:47 +02:00
Sylvestre Ledru
88a689075c
Merge pull request #2682 from jfinkels/seq-simpler-terminator-check
...
seq: add is_first_iteration to avoid comparisons
2021-09-17 12:19:05 +02:00
Sylvestre Ledru
3d867fcf7c
Merge pull request #2684 from blyxxyz/hostname-cleanup
...
hostname: Cleanup
2021-09-16 22:22:34 +02:00
Jan Verbeek
5bb56ec528
whoami: Restrict scope of unsafe
...
Co-authored-by: Jan Scheer <jhscheer@users.noreply.github.com>
2021-09-15 15:37:15 +02:00
Jan Verbeek
3f37ddbd22
hostname: Cleanup
...
- Attach context to I/O errors
- Make flags override each other
- Support invalid unicode as argument
- Call WsaCleanup() even on panic
- Do not use deprecated std::mem::uninitialized()
2021-09-15 13:45:02 +02:00
Sylvestre Ledru
7eaae75bfc
add a github action job to identify unused deps
2021-09-15 12:06:50 +02:00
Jeffrey Finkelstein
53a91be2df
seq: add is_first_iteration to avoid comparisons
...
Add the `is_first_iteration` Boolean variable to the `print_seq()`
function in order to avoid unnecessary comparisons. Specifically, before
this change, the `done_printing()` function was called twice on each
iteration of the main loop. After this change, it is only called once
per iteration.
Furthermore, this change makes the `print_seq()` function similar in
structure to the `print_seq_integers()` function.
Co-authored-by: Jan Verbeek <jan.verbeek@posteo.nl>
2021-09-14 20:57:38 -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
1edd2bf3a8
Do not discard non-OS error messages
2021-09-14 15:11:54 +02:00
Jeffrey Finkelstein
60025800c3
seq: trim leading whitespace from inputs
2021-09-13 21:46:17 -04:00
Jan Verbeek
4555c85564
whoami: Cleanup
...
- Use modern conventions
- Restrict the scope of unsafe
- Do not use deprecated `std::mem::unitialized()`
- Do not bake unicode into design
2021-09-13 22:54:45 +02:00
Sylvestre Ledru
e9d63519dd
Merge pull request #2668 from sylvestre/unused-deps
...
Remove plenty of unused deps
2021-09-13 21:45:39 +02:00
Michael Debertol
570f23ac90
Merge pull request #2647 from jfinkels/seq-test-inf
...
seq: use stdout.write_all() instead of print!()
2021-09-13 18:34:24 +02:00
Sylvestre Ledru
a74e4bf095
shred: remove the unused dep on filetime
2021-09-13 18:15:51 +02:00
Sylvestre Ledru
a6c235bcd1
csplit: remove the unused dep on glob
2021-09-13 18:15:51 +02:00
Sylvestre Ledru
826c948234
ls: remove the unused dep on locale
2021-09-13 18:15:51 +02:00
Sylvestre Ledru
2d67252dc4
rm: only set the winapi dep on Windows
2021-09-13 18:15:51 +02:00
Sylvestre Ledru
cca2b19b4e
tail: only set the winapi dep on Windows
2021-09-13 18:15:49 +02:00
Michael Debertol
5faa4c41db
Merge pull request #2607 from jfinkels/tac-regex
...
tac: add support for --regex option to tac
2021-09-13 18:12:57 +02:00
Sylvestre Ledru
87b6aa89e3
pr: remove unused "time" dep ( #2667 )
2021-09-13 18:08:51 +02:00
Sylvestre Ledru
68df4de1a2
nice: update to use the same version of nix as other programs ( #2666 )
2021-09-13 18:08:41 +02:00
Sylvestre Ledru
ebe897e4d4
shred: remove unused "time" dep ( #2665 )
2021-09-13 18:05:06 +02:00
Jan Scheer
4dc6536bb9
Merge branch 'master' into ls_selinux
2021-09-13 13:42:51 +02:00
Jan Scheer
cd2153eac6
ls: (--context/-Z) add support for invalid utf8
...
If security context byte slice contains invalid utf8:
* issue warning
* show replacement characters for invalid utf8 sequences
2021-09-13 13:24:44 +02:00
Sylvestre Ledru
b4f45bcc1a
Merge pull request #2664 from jfinkels/wc-remove-mut-width
...
wc: remove mutable min_width parameter
2021-09-13 08:25:46 +02:00
Jan Verbeek
3e0b3c93ef
mktemp: Do not use unsafe
2021-09-12 21:50:36 +02:00
Jeffrey Finkelstein
7ec6452265
wc: remove mutable min_width parameter
...
Remove mutability from the `min_width` parameter to the `print_stats()`
function in `wc`.
2021-09-12 12:25:52 -04:00
Smicry
7e577476d8
add kill -l final new line #2644
2021-09-12 23:20:05 +08:00
Jan Verbeek
4a20ef1850
chcon: Remove unused Options.dereference to fix Clippy
2021-09-12 13:17:55 +02:00
Sylvestre Ledru
447d6f2b61
Merge pull request #2654 from blyxxyz/dedup-splice
...
Move common pipe and splice functions into uucore
2021-09-12 09:23:05 +02:00
Jeffrey Finkelstein
664c7a6ec5
tac: add support for --regex option to tac
...
Add support for `tac --regex`, where the line separator is interpreted
as a regular expression.
2021-09-11 22:54:55 -04:00
Olivier EBLÉ
df64c19107
kill: kill old form with signal name
...
This commit aim to correct #2645 .
The origin of the problem was that `handle_obsolete` was not looking for
named signals but only for numbers preceded by '-'. I have made a few
changes:
- Change `handle_obsolete` to use `signal_by_name_or_value` to parse the
possible signal.
- Since now the signal is already parsed return an `Option<usize>`
instead of `Option<&str>` to parse later.
- Change the way to decide the pid to use from a `match` to a `if`
because the tested element are actually not the same for each branch.
- Parse the signal from the `-s` argument outside of `kill` function for
consistency with the "obsolete" signal case.
- Again for consistency, parse the pids outside the `kill` function.
2021-09-12 00:44:11 +02:00
Jan Scheer
e018a45b54
test_ls: add/adjust tests for SELinux context
2021-09-11 04:13:30 +02:00
Jeffrey Finkelstein
96b8616a1a
seq: use stdout.write_all() instead of print!()
...
Change from using `print!()` to using `stdout.write_all()` in order to
allow the main function to handle broken pipe errors gracefully.
2021-09-10 20:00:26 -04:00
Jan Verbeek
b7d697753c
unlink: Simplify, remove unsafe, move to core
...
This makes it no longer possible to pass multiple filenames, but every
other implementation I tried (GNU, busybox, FreeBSD, sbase) also
forbids that so I think it's for the best.
2021-09-10 21:50:38 +02:00
Jan Scheer
fe3645d4d5
ls: add support for showing SELinux context (--context/-Z)
2021-09-10 21:33:34 +02:00
Jan Verbeek
23647be07a
cat: Use larger splice size
...
This raises performance by 10-20% or so.
2021-09-10 21:24:34 +02:00
Jan Verbeek
d002810a47
cat: Do not assume complete writes
2021-09-10 21:24:34 +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
Jan Verbeek
91d39de16e
sort: derive Default impl for FieldSelector
2021-09-10 19:25:54 +02:00
Jeffrey Finkelstein
fc77e51b64
printf: derive Default impl for FormatPrimitive
2021-09-10 19:24:59 +02:00
Jan Verbeek
d05410383f
chown: Fix clippy warning to fix CI
2021-09-10 18:56:31 +02:00
Sylvestre Ledru
75e5c42e40
chown: support '.' as 'user.group' separator (like ':') ( #2638 )
...
* chown: support '.' as 'user.group' separator (like ':')
It also manages the case:
user.name:group (valid too)
Should fix:
gnu/tests/chown/separator.sh
2021-09-10 08:15:23 +02:00
Sylvestre Ledru
ed258e3c9c
touch: add --ref as an alias ( #2641 )
2021-09-09 21:48:17 +02:00
Michael Debertol
2170d81621
Merge pull request #2633 from blyxxyz/update-quoting
...
Update filename quoting and printing
2021-09-09 20:42:00 +02:00
Michael Debertol
37c6b794c8
Merge pull request #2646 from 353fc443/uresult-uptime
...
uptime: added UResult
2021-09-09 20:32:06 +02:00
353fc443
e4aad6d971
uptime: added UResult
2021-09-09 17:59:02 +00:00
Jan Scheer
cd0d23752a
tail: add fixes to pass "gnu/tests/tail-2/tail-c.sh" from GNU's test suite
2021-09-08 13:10:19 +02:00
Sylvestre Ledru
ff5607c363
Merge pull request #2622 from tertsdiepraam/ls/special-chars-in-double-quotes
...
`ls`: always use single quotes when `$`, `\` or ` are present in a filename
2021-09-07 22:04:48 +02:00
Jan Verbeek
1ef2574b08
Replace backtick quoting
2021-09-07 20:16:45 +02:00
Jan Verbeek
918603909b
Update hashsum quoting FIXME instructions
2021-09-07 20:15:54 +02:00
Jan Verbeek
6d346b2307
Replace manual formatting by show_error!()/show_warning!()
2021-09-07 20:15:54 +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
353fc443
06ff6ac4f1
whoami: Added UResult
2021-09-07 08:10:06 +00:00
Sylvestre Ledru
a0be9811c6
Merge pull request #2513 from drocco007/test-parentheses
...
test: handle additional parentheses edge cases
2021-09-06 22:23:21 +02:00
Sylvestre Ledru
17a435c7a6
Fix clippy warnings
2021-09-06 20:42:14 +02:00
Sylvestre Ledru
90fd900b8f
Fix clippy warnings in test.rs
2021-09-06 20:41:41 +02:00
James Robson
625c3f2330
Add -e/-m to realpath
2021-09-05 22:50:23 +02: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
499f10ca1f
Merge branch 'master' into ls/special-chars-in-double-quotes
2021-09-03 09:00:54 +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
a517671d55
Merge pull request #2621 from blyxxyz/filename-quoting
...
Implement proper quoting/escaping for filenames
2021-09-01 14:15:44 +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
ffe63945b7
wc: Update path display
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
b5550bc4dd
ls: Accept badly-encoded filenames
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
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
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
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
2b9196d6fa
Merge pull request #2600 from 353fc443/env-uresult
...
env: added UResult
2021-08-28 12:38:32 +02:00
Sylvestre Ledru
85c7178b10
Merge pull request #2609 from jfinkels/seq-negative-zero-start
...
seq: print negative zero at start of integer sequence
2021-08-28 12:32:50 +02:00
Sylvestre Ledru
0525d9bf6a
Remove useless import of USimpleError
2021-08-28 11:44:34 +02:00
Sylvestre Ledru
0e49913b84
Merge branch 'master' into chmod/compat
2021-08-28 11:21:26 +02:00
Sylvestre Ledru
1493027f27
remove the env:
2021-08-28 09:55:15 +02:00
Sylvestre Ledru
aa07f4f3d6
Merge pull request #2608 from tertsdiepraam/ls/fix-tilde-hash-quote
...
ls: only quote ~ and # when they appear at the start of the name
2021-08-28 09:54:23 +02:00
Jeffrey Finkelstein
2c66d9e0a7
seq: print negative zero at start of integer seq.
2021-08-27 21:44:09 -04:00
Jeffrey Finkelstein
1df9a1691c
seq: combine first, inc, last parameters into type
...
Combine the `first`, `increment`, and `last` parameters of the
`print_seq()` and `print_seq_integers()` functions into a `RangeF64` or
`RangeInt` type, respectively.
2021-08-27 21:30:33 -04:00
Jan Verbeek
afb460f4ca
rmdir: match GNU
...
- Implement all of GNU's fiddly little details
- Don't assume Linux for error codes
- Accept badly-encoded filenames
- Report errors after the fact instead of checking ahead of time
- General cleanup
rmdir now passes GNU's tests.
2021-08-28 02:26:01 +02:00
Jan Verbeek
1c05183083
Move strip_errno to libcore
2021-08-28 02:26:01 +02:00
Terts Diepraam
d5dd4f6cff
ls: only quote ~ and # when they appear at the start of the name
...
For example, we quote '~a' and '~' but not a~
2021-08-27 15:39:04 +02:00
Jan Verbeek
94e33c97f3
wc: Add benchmarking documentation
2021-08-26 01:38:16 +02:00
Jan Verbeek
1358aeecdd
wc: Avoid unnecessary work in general loop
...
This gives a big speedup if e.g. only characters are being counted.
2021-08-26 01:38:16 +02:00
Jan Verbeek
0f1e79fe29
wc: Fix linters
2021-08-26 01:38:16 +02:00
Jan Verbeek
9972cd1327
wc: Report counts and failures correctly
...
If reading fails midway through then a count should be reported for
what could be read.
If opening a file fails then no count should be reported.
The exit code shouldn't report the number of failures, that's fragile
in case of many failures.
2021-08-26 01:38:16 +02:00
Jan Verbeek
c16e492cd0
wc: Make output width more consistent with GNU
2021-08-26 01:38:16 +02:00
Jan Verbeek
d0c0564947
wc: Swap order of characters and bytes in output
...
This way it matches GNU and busybox.
2021-08-26 01:38:16 +02:00
Jan Verbeek
657a04f706
wc: Stricter simpler error handling
...
Errors are now always shown with the corresponding filename.
Errors are no longer converted into warnings. Previously `wc < .`
would cause a loop.
Checking whether something is a directory is no longer done in
advance. This removes race conditions and the edge case where stdin is
a directory.
The custom error type is removed because io::Error is now enough.
2021-08-26 01:38:16 +02:00
Jan Verbeek
35793fc260
wc: Accept badly-encoded filenames
2021-08-26 01:38:16 +02:00
Jan Verbeek
6f7d740592
wc: Do a chunked read with proper UTF-8 handling
...
This brings the results mostly in line with GNU wc and solves nasty
behavior with long lines.
2021-08-26 01:38:16 +02:00
Jan Verbeek
48437fc49d
wc: Optimize, improve correctness
...
- Reuse allocations for read lines
- Increase splice size
- Check if /dev/null was opened correctly
- Do not discard read bytes after I/O error
- Add fast line counting with bytecount
2021-08-26 01:38:16 +02:00
353fc443
d4697d9883
env: added UResult
2021-08-25 22:02:35 +05:30
Andreas Hartmann
8ecef029f6
mv: Adapt to modified backup_control
interface
2021-08-25 16:33:50 +02:00
Andreas Hartmann
2a1a923acc
ln: Adapt to modified backup_control
interface
2021-08-25 16:33:50 +02:00
Andreas Hartmann
ce0d9bce28
install: Adapt to modified backup_control
interface
2021-08-25 16:33:50 +02:00
Andreas Hartmann
f2311f87f4
cp: Adapt to modified backup_control
interface
2021-08-25 16:33:50 +02:00
Andreas Hartmann
1755195251
uu: Replace return_if_err
with crash_if_err
...
Unify the usage of macros `return_if_err` and `crash_if_err`. As
`return_if_err` is used only in `uumain` routines of utilities, it
achieves the same thing as `crash_if_err`, which calls the `crash!`
macro to terminate function execution immediately.
2021-08-25 13:59:39 +02:00
Andreas Hartmann
229948ae45
uu: Replace safe_unwrap
with crash_if_err
...
Unify the usage of macros `safe_unwrap` and `crash_if_err` that are
identical to each other except for the assumption of a default error
code. Use the more generic `crash_if_err` so that `safe_unwrap` is now
obsolete and can be removed.
2021-08-25 13:59:39 +02:00
Michael Debertol
5ab05a9219
chmod: remove redundant cfg
...
redox is unix.
2021-08-25 13:52:09 +02:00
Michael Debertol
5121e2eec1
chmod: add check for quiet
2021-08-25 13:52:09 +02:00
Michael Debertol
38afdd6ab4
uucore/mode: add cast for some platforms
2021-08-25 13:52:09 +02:00
Michael Debertol
5825889931
chmod: correctly handle modes after --
2021-08-25 13:52:09 +02:00
Michael Debertol
b841a11421
chmod: fail if the operand list is empty
2021-08-25 13:52:09 +02:00
Michael Debertol
945e57ea22
chmod: show an error if a permission wasn't removed due to umask
2021-08-25 13:52:09 +02:00
Michael Debertol
15b40f6aa2
chmod: implement special handling of directory setuid/setgid
2021-08-25 13:52:09 +02:00
Michael Debertol
74958794c6
chmod: print change message to stdout, not stderr
2021-08-25 13:52:09 +02:00
Michael Debertol
080998b6ef
chmod: pad all file modes to 4 digits
2021-08-25 13:52:09 +02:00
Jeffrey Finkelstein
52cfd4c6cb
hashsum: don't copy input buffer on Windows
...
Remove a copy operation of the input buffer being read for digest when
reading in text mode on Windows. Previously, the code was copying the
buffer to a completely new `Vec`, replacing "\r\n" with "\n". Instead,
the code now scans for the indices at which each "\r\n" occurs in the
input buffer and inputs into the digest only the characters before the
"\r" and after it.
2021-08-25 13:50:19 +02:00
Jan Verbeek
e5d6c6970b
yes: Cleanup
...
Report errors properly instead of panicking.
Replace zero_copy by a simpler specialized private module.
Do not assume splices move all data at once.
Use the modern uutils machinery.
Remove the "latency" feature. The time it takes to prepare the buffer
is drowned out by the startup time anyway.
yes: Add tests
yes: Fix long input test on Windows
2021-08-25 13:45:44 +02:00
Sylvestre Ledru
111d3e37bb
Merge pull request #2570 from miDeb/chgrp/no-duplication
...
chgrp/chown: move common code to `uucore`
2021-08-24 21:58:15 +02:00
Jan Verbeek
acfd1ebe57
fixup! Run clippy on the full workspace
2021-08-24 17:28:10 +02:00
Jan Verbeek
d06c074829
Run clippy on the full workspace
...
These lints were cluttering up the "problems" tab in my VS
Code. `--workspace` fixes the disparity.
2021-08-24 17:10:16 +02:00
Michael Debertol
4e251706be
refactor: move shared chown logic to uucore
2021-08-24 15:22:05 +02:00
Michael Debertol
7153a595c6
chgrp: forward to chown
...
chgrp does mostly the same as chown.
By making chown a bit more configurable we can reuse its code for chgrp.
2021-08-24 15:22:05 +02:00
Sylvestre Ledru
68c9bfa658
Merge pull request #2581 from sylvestre/freebsd
...
Use github action for FreeBSD testing and remove cirrus CI
2021-08-24 14:47:34 +02:00
Michael Debertol
91a8f533b6
Merge pull request #2582 from jfinkels/tac-multi-char-separator-overlap
...
tac: support multi-character line separator with possible overlaps
2021-08-24 12:03:45 +02:00
Jan Verbeek
516c5311f7
Close file descriptors of pipes after use ( #2591 )
...
* Close file descriptors of pipes after use
* cat: Test file descriptor exhaustion
* fixup! cat: Test file descriptor exhaustion
2021-08-24 12:00:07 +02:00
Sylvestre Ledru
1126013dbb
Remove unused variables on Freebsd
2021-08-24 09:32:27 +02:00
Jeffrey Finkelstein
0e689e78aa
tac: support multi-char separator with overlap
...
Fix a bug in `tac` where multi-character line separators would cause
incorrect behavior when there was overlap between candidate matches in
the input string. This commit adds a dependency on `memchr` in order to
use the `memchr::memmem::rfind_iter()` function to scan for
non-overlapping instances of the specified line separator characters,
scanning from right to left.
Fixes #2580 .
2021-08-23 20:16:38 -04:00
jfinkels
bdc0f4b7c3
hashsum: support --check for algorithms with variable output length ( #2583 )
...
* hashsum: support --check for var. length outputs
Add the ability for `hashsum --check` to work with algorithms with
variable output length. Previously, the program would terminate with an
error due to constructing an invalid regular expression.
* fixup! hashsum: support --check for var. length outputs
2021-08-23 18:35:19 +02:00
Sylvestre Ledru
b828e922e5
Merge pull request #2553 from miDeb/sort/race
...
sort: prevent race when deleting files
2021-08-22 22:49:57 +02:00
Sylvestre Ledru
9f3debeda3
Merge pull request #2534 from jfinkels/basename-handle-slashes
...
basename: handle paths comprising only slashes
2021-08-22 22:49:30 +02:00
Koutheir Attouchi
7010dfd939
runcon: added implementation and tests.
2021-08-22 21:59:41 +02:00
jfinkels
4ef35d4a96
tac: correct behavior of -b option ( #2523 )
...
* tac: correct behavior of -b option
Correct the behavior of `tac -b` to match that of GNU coreutils
`tac`. Specifically, this changes `tac -b` to assume *leading* line
separators instead of the default *trailing* line separators.
Before this commit, the (incorrect) behavior was
$ printf "/abc/def" | tac -b -s "/"
def/abc/
After this commit, the behavior is
$ printf "/abc/def" | tac -b -s "/"
/def/abc
Fixes #2262 .
* fixup! tac: correct behavior of -b option
* fixup! tac: correct behavior of -b option
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2021-08-22 21:01:17 +02:00
Sylvestre Ledru
114c9a409c
Merge pull request #2471 from miDeb/real-exe-name
...
make executable!() return the real executable name
2021-08-22 16:55:06 +02:00
Sylvestre Ledru
5089214832
bump a few crates to simplify Debian packaging (second)
2021-08-22 00:42:03 +02:00
Sylvestre Ledru
724f67c5d0
Merge pull request #2576 from sylvestre/bump-crates
...
bump a few crates to simplify Debian packaging
2021-08-22 00:29:00 +02:00
Sylvestre Ledru
8337aeb4d6
bump a few crates to simplify Debian packaging
2021-08-21 23:34:45 +02:00
Jeffrey Finkelstein
ecf59b173d
wc: fix collapsible match clippy warning
2021-08-21 17:24:10 -04:00
Michael Debertol
5e07d58a4d
Merge pull request #2459 from jaggededgedjustice/realpath-add-physical-mode
...
Add Physical mode to realpath
2021-08-21 02:01:10 +02:00
Michael Debertol
1eb7193ee8
wc: fix clippy lint
2021-08-20 00:00:48 +02:00
Tyler
20c63caa0c
Merge branch 'master' of github.com:backwaterred/coreutils into dedup-dd-mideb
2021-08-18 17:11:58 -07:00
Tyler
6f6f6251e9
dd: apply @miDeb patch to address issue #2572
2021-08-18 17:08:01 -07:00
Michael Debertol
252220e9eb
refactor/uucore ~ make util_name and execution_phrase functions
...
Since util_name and execution_phrase no longer rely on features that are
only available to macros, they may as well be plain functions.
2021-08-14 17:55:18 +02:00
Michael Debertol
5f2335829a
refactor ~ revert to single quotes for "Try '{0 --help'"
...
This is a test expectation for gnu.
2021-08-14 17:22:09 +02:00
Michael Debertol
6ab3d27c4e
fix ~ remove redundant clone()
...
util_name!() and execution_phrare!() now return a String directly
2021-08-14 14:48:38 +02:00
Michael Debertol
813b477859
fix ~ fixes for newly added utilities
2021-08-14 14:10:35 +02:00
Michael Debertol
44981cab01
refactor/uucore ~ correct implementation of executable!() for multicall
...
- Use an atomic bool to track whether the utility name is the second
or the first argument.
- Add tests
2021-08-14 14:01:34 +02:00
Roy Ivy III
c0854000d1
refactor ~ use execution_phrase!()
for usage messaging
2021-08-14 14:01:33 +02:00
Roy Ivy III
23b68d80ba
refactor ~ usage()
instead of get_usage()
2021-08-14 13:58:43 +02:00
Roy Ivy III
894d9a068c
refactor ~ standardize on 'Try {} --help
...' messaging (common markdown-type formatting)
2021-08-14 13:55:11 +02:00
Roy Ivy III
c5792c2a0f
refactor ~ use util_name!()
as clap::app::App name argument for all utils
2021-08-14 13:53:13 +02:00
Hanif Bin Ariffin
9c6f2c765d
Removed bad test
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
0032f2c4a0
Fixed some spelling issues
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
df7da4e907
Fixed clippy issues
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
d813e00588
Don't convert octal if its not valid character
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
3fa56eabce
Fixed clippy issues
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
8c82cd660c
Fixing implementation to passes more GNU tests
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
dc033ab619
Tweaking error handling to use Error class
...
Also handles additional error cases in GNU
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
4fb4511da3
Fixed empty backslash
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
3fea69f9ed
inline some code
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
5657f5af3a
Simplified and extended parsing capabilities
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
2c8ba4ad2d
Fixing some issues discovered from tests...mostly to match GNU behavior
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
43dbff7c56
Something wrong with rust iterator...
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
5a0870bb30
Condensed many of the weird stuff in tr in a function...passes more GNU tests
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:07 +08:00
Hanif Bin Ariffin
279a7cf6b3
Attempting to fix star expansion
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
5def69d3ee
Trimming down files
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
0acc165720
Finally fixed parsing octal in char ranges
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
5aeeb6cfe9
Use delimited whenever possible and removed a duplicate parse
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
0254ceb48b
Removes some allocations
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
7424754725
Update traits name
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
4b45a2287c
Implement some more parsers
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
b0ef508b04
Some code cleanup
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
f13c0ba5a7
Remove new from struct names
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
6ff826b712
Some lint changes
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:38:06 +08:00
Hanif Bin Ariffin
671d355aeb
Removed unused dependencies
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:36:33 +08:00
Hanif Bin Ariffin
05d2973510
Reimplemented everything using new expansion module
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:36:33 +08:00
Hanif Bin Ariffin
c4e04c5384
Implemented squeeze operation
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:36:33 +08:00
Hanif Bin Ariffin
50167a33a8
Now all tr tests passes with the new translation impl!
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:36:33 +08:00
Hanif Bin Ariffin
572cbc6ba2
Some small cleanup to translation module
...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:36:33 +08:00
Hanif Bin Ariffin
840c6e7b91
tr
: Reimplementing set expansion
...
Hopefully will be feature parity with GNU `tr`.
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Implemented a bit of new expansion module
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Implemented delete operation
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Partially implemented delete operation
Will go through translate next.
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Fix formatting...
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Implemented translation feature
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-08-14 19:36:30 +08:00
Terts Diepraam
f9559fea80
Merge pull request #2569 from jtracey/master
...
join: add support for full outer joins
2021-08-13 14:38:15 +02:00
Justin Tracey
1bb0237281
join: add support for full outer joins
2021-08-12 23:52:35 -04:00
Sylvestre Ledru
a7797c01c0
Merge branch 'master' into chgrp/no-err
2021-08-13 01:35:21 +02:00
Sylvestre Ledru
01be7b356f
Merge pull request #2558 from fdanis-oss/fix-csplit-split_name
...
csplit: fix suffix support without flag
2021-08-13 01:34:30 +02:00
Sylvestre Ledru
ea5097e4a0
Merge pull request #2562 from tertsdiepraam/uucore/simpler-uerror
...
`uucore`: simpler `UResult` and `UError`
2021-08-13 01:33:23 +02:00
Sylvestre Ledru
5a0032c56e
Merge pull request #2563 from koutheir/master
...
chcon: reduce the number of unsafe blocks.
2021-08-13 01:32:42 +02:00
Sylvestre Ledru
8f55c79c9b
Merge pull request #2566 from miDeb/ls/width
...
ls: correct output width
2021-08-13 01:31:52 +02:00
Michael Debertol
21043d3605
sort: prevent race when deleting files
...
Move the creation of temporary files into next_file so that it happens
while the lock is taken.
Previously, only the computation of the new file path happened while
the lock was taken, while the creation happened later.
2021-08-12 13:50:56 +02:00
Frédéric Danis
6283dbe451
csplit: fix suffix support without flag
...
csplit fails when suffix has no flags:
$ csplit result.expected -f /tmp/EXPECT -b "%d" "/^## alternative ##$/" {*}
csplit: error: incorrect conversion specification in suffix
This is supported by original csplit
2021-08-12 10:27:56 +02:00
Michael Debertol
0af244ac42
ls: default to one-line output if stdout is not a tty
2021-08-11 22:03:41 +02:00
Michael Debertol
988cc49d4a
ls: print a single line when width is set to 0
...
This means that we treat a width=0 as infinite width.
2021-08-11 19:12:45 +02:00
Michael Debertol
13a62489c5
ls: correct fallbacks for terminal width
...
If options::WIDTH is not given, we should try to use the terminal width.
If that is unavailable, we should fall back to the 'COLUMNS' environment variable.
If that is unavailable (or invalid), we should fall back to a default of 80.
2021-08-11 19:12:37 +02:00
Michael Debertol
1c30fb42d2
chgrp: handle empty group
2021-08-11 19:03:41 +02:00
Koutheir Attouchi
83a515e4c3
chcon: reduce the number of unsafe blocks.
2021-08-10 13:50:51 -04:00
Terts Diepraam
14459cf611
rustfmt
2021-08-10 19:18:09 +02:00
Terts Diepraam
d12d4f760c
uucore: {USimpleError, UUsageError}::new take Into<String> instead of String
2021-08-10 17:55:37 +02:00
Terts Diepraam
1649217116
uucore: remove distinction between common and custom errors
...
As custom errors are prefered over wrapping around common errors, the
distinction between UCommonError and UCustomError is removed. This
reduces the number of types and makes the error handling easier to
understand.
2021-08-10 17:55:28 +02:00
Sylvestre Ledru
fe539a6dea
Merge pull request #2559 from miDeb/factor/line-buffered
...
factor: prevent writing incomplete lines
2021-08-10 15:25:11 +02:00
Sylvestre Ledru
ca0bae0dfd
Merge pull request #2500 from Funky185540/feature/install-use-uresult
...
install: Use UResult
2021-08-10 13:32:00 +02:00
Michael Debertol
0edc9b01b9
factor: prevent writing incomplete lines
...
This makes it possible to execute multiple `factor` instances that write
to the same output in parallel, without having them interfere.
2021-08-10 00:14:51 +02:00
David CARLIER
6e2f6b2845
nice little code simplification, included already in the libc
...
for all unixes
2021-08-09 21:56:12 +01:00
Sylvestre Ledru
966cf79747
Merge pull request #2551 from uutils/od-hang
...
od: fix reading from file while supplying a format argument
2021-08-09 12:36:31 +02:00
Sylvestre Ledru
ee98efd92e
Merge pull request #2552 from miDeb/cat/show-crlf
...
cat: show `\r\n` as `^M$` when `-E` is enabled
2021-08-09 12:23:59 +02:00
Sylvestre Ledru
ecb042a9a3
Merge pull request #2554 from miDeb/cat/out_is_in
...
cat: check if the input file is also the output file
2021-08-09 12:23:46 +02:00
Michael Debertol
312e1ce9e0
chgrp: don't output an empty error
2021-08-09 01:33:02 +02:00
Dean Li
0f39e7c101
id: use UResult
2021-08-08 18:09:25 +08:00
Michael Debertol
03ceb6750e
cat: check if the input file is also the output file
2021-08-08 01:32:22 +02:00
Michael Debertol
7229360217
cat: remove all per-file state
...
cat cannot keep per-file state, so move all remaining state (one_blank_kept)
to the global state.
2021-08-07 23:04:25 +02:00
Michael Debertol
5be4c48546
cat: show \r\n as ^M$ when -E is enabled
...
This functionality was recently added to GNU cat, but had a bug.
This implementation will be commpatible with gnu once the bug in gnu is fixed.
2021-08-07 21:18:15 +02:00
Jeremy Soller
6af3f774f1
od: fix reading from file while supplying a format argument
...
The following test case read stdin instead of file:
```
echo abcdefg > file
cargo run -- od --format x1 file
```
This is because the -t/--format argument was able to absorb multiple
arguments after it. This has now been fixed, and a test case is added
to ensure it will not happen again.
2021-08-06 15:07:38 -06:00
Jeremy Soller
134c1aa407
ls: do not use gid2grp on redox
2021-08-06 13:56:20 -06:00
Jeremy Soller
ed6a9d4c57
tail: remove unused redox platform
2021-08-06 13:56:20 -06:00
Jeremy Soller
53374207c1
pr: remove unused utmpx feature
2021-08-06 13:56:20 -06:00
Jeremy Soller
27f53aa0df
dd: only require signal-hook on linux
2021-08-06 13:56:20 -06:00
Jeremy Soller
7d07ffc47d
date: disable setting time on redox
2021-08-06 13:56:20 -06:00
Jeremy Soller
0474a2eadd
more, tail, test: Update redox_syscall to 0.2
2021-08-06 13:56:20 -06:00
Sylvestre Ledru
32d281bbcc
Merge pull request #2544 from miDeb/sort/delete-tmps
...
sort: delete temporary files when sort is terminated
2021-08-06 11:52:06 +02:00
Michael Debertol
0ae9e10ed3
sort: delete the temporary directory when sort is terminated
...
When hitting Ctrl+C sort now deletes any temporary files. To make this easier I
created a new struct `TmpDirWrapper` that handles the creation of new temporary
files and the registration of the signal handler.
2021-08-06 11:29:24 +02:00
Sylvestre Ledru
50b9d9f9a3
Merge branch 'master' into master
2021-08-06 09:26:39 +02:00
Sylvestre Ledru
76222d52ca
Merge pull request #2547 from miDeb/basenc
...
basenc: add utility
2021-08-06 08:48:49 +02:00
Sylvestre Ledru
a76be9cb1e
Merge pull request #2548 from miDeb/chown/test
...
chown: fix unit test
2021-08-06 08:43:07 +02:00
Koutheir Attouchi
090be5bb94
chcon: added implementation and integration tests
...
The ToDo list was updated to mark `chcon` as done.
Building and testing `chcon` requires enabling the `feat_selinux` feature. If `make` is used for building, then please specify `SELINUX_ENABLED=1` if building and testing on a system where SELinux is not enabled.
2021-08-05 22:57:57 -04:00
Michael Debertol
b8c383e210
basenc: add utility
...
basenc is a brand-new gnu core utility (added less than 3 years ago!),
which enables some more encodings.
2021-08-06 00:07:19 +02:00
Michael Debertol
ac6356087e
chown: fix unit test
2021-08-06 00:03:04 +02:00
Sylvestre Ledru
63fd139b04
Merge pull request #2524 from FelipeLema/uresult-cat-2464
...
migrate `cat` code to UResult #2464
2021-08-06 00:02:17 +02:00
backwaterred
2c41838166
Merge branch 'uutils:master' into master
2021-08-04 12:47:47 -07:00
Tyler
0864234e3d
Removes unused macros from windows & macos builds
2021-08-04 12:47:03 -07:00
Tyler
601c9fc620
Merge branch 'master' of https://github.com/uutils/coreutils into uutils-master-2
2021-08-03 17:33:43 -07:00
Tyler
7ed7c840bd
Fix clippy warnings and build issues. Defer NL to seperate issue.
2021-08-03 17:18:34 -07:00
Tyler
e1fcc85b0a
Merge branch 'master' of github.com:backwaterred/coreutils
2021-08-03 16:39:17 -07:00
Michael Debertol
9700f0503d
base32/64: adjust error message to match gnu
2021-08-04 00:04:25 +02:00
Michael Debertol
44ae927969
base32/64: print the first extra operand, not the one before
...
Only one operand is allowed, so when there are multiple arguments we
should print the second argument in the error.
2021-08-03 23:37:20 +02:00
Sylvestre Ledru
26cc2ed440
Merge pull request #2517 from jfinkels/tac-null-separator
...
tac: support null separator (-s "")
2021-08-03 09:22:50 +02:00
Jan Scheer
8232c1c64d
id: increase MSRV in order to compile selinux crate
...
* Bump MSRV from 1.43 to 1.47 in order to be able to compile
`selinux` crate 0.1.3
* Bump MSRV for clippy to 1.47
* Add "selinuxlib" to spell-checker
2021-08-02 20:36:06 +02:00
Jan Scheer
010565c8fb
Merge branch 'master' into id_selinux_context
2021-08-02 10:40:45 +02:00
Sylvestre Ledru
950076fd23
Merge pull request #2543 from miDeb/sort/uresult
...
sort: use UResult
2021-08-02 08:26:43 +02:00
Felipe Lema
5646c81332
correct clippy issues, RustFmt
2021-08-01 23:55:30 -04:00
Jeffrey Finkelstein
d74fb62df7
tac: support null separator
2021-08-01 19:47:21 -04:00
Sylvestre Ledru
24b1822cba
Merge pull request #2468 from thomasqueirozb/tail_stdin
...
tail: handle `-` as an alias for stdin
2021-08-02 00:24:28 +02:00
Michael Debertol
a4709c805c
sort: use UResult
2021-08-01 23:22:29 +02:00
Thomas Queiroz
940559f0e1
tail: handle -
as an alias for stdin
2021-08-01 17:20:24 -04:00
James Robson
0e04f959c2
Add Physical mode to realpath
...
This adds the 'Physical Mode' and 'Logical Mode' switches to realpath, which control when symlinks are resolved.
2021-08-01 17:06:09 +01:00
Michael Debertol
af47c66a00
sort: improve tests
2021-08-01 17:12:35 +02:00
Michael Debertol
3d23ace9b8
sort: remove redundant comment
2021-08-01 17:12:06 +02:00
Sylvestre Ledru
2d84c68f20
Merge branch 'master' into sort/input-is-output
2021-08-01 13:51:19 +02:00
Sylvestre Ledru
11d03bffd3
Merge pull request #2539 from miDeb/sort/args-exit-code
...
sort: do not exit with failure for "--version" or "--help"
2021-08-01 13:50:48 +02:00
Jeffrey Finkelstein
0d348f05f2
basename: handle paths comprising only slashes
...
Fix an issue where `basename` would print the empty path when provided
an input comprising only slashes (for example, "/" or "//" or
"///"). Now it correctly prints the path "/".
2021-07-31 18:57:02 -04:00
Yagiz Degirmenci
95a890e5f8
chore(ln): fix clippy errors
...
Signed-off-by: Yagiz Degirmenci <yagizcanilbey1903@gmail.com>
2021-08-01 01:42:12 +03:00
Yagiz Degirmenci
65dd6afa13
chore(ln): delete comment
...
Signed-off-by: Yagiz Degirmenci <yagizcanilbey1903@gmail.com>
2021-08-01 01:27:25 +03:00
Yagiz Degirmenci
55d1dc78b0
feat(ln): use UResult
...
Signed-off-by: Yagiz Degirmenci <yagizcanilbey1903@gmail.com>
2021-08-01 01:25:21 +03:00
Michael Debertol
663c9751a1
sort: do not exit with failure for "--version" or "--help"
2021-08-01 00:05:08 +02:00
Michael Debertol
418f5b7692
sort: handle empty merge inputs
2021-07-31 21:02:20 +02:00
Michael Debertol
5bf4536bdd
sort: ignore failure to truncate the output file
2021-07-31 21:02:20 +02:00
Michael Debertol
f29239beec
sort: buffer writes to the output
...
This fixes a regression from a33b6d87b5
2021-07-31 21:02:20 +02:00
Michael Debertol
849086e9c5
sort: handle cases where the output file is also an input file
...
In such cases we have to create a temporary copy of the input file to prevent
overwriting the input with the output. This only affects merge sort, because it
is the only mode where we start writing to the output before having read all inputs.
2021-07-31 21:02:18 +02:00
Sylvestre Ledru
103a9d52ff
Merge pull request #2521 from miDeb/sort/rand
...
sort: improve compatibility of --random-sort
2021-07-31 21:00:18 +02:00
Michael Debertol
3564dc5792
sort: compare strings before comparing hashes
...
Since lines that compare equal should be sorted together, we need to first
compare the lines (taking settings into account). Only if they do not compare
equal we should compare the hashes.
2021-07-31 20:07:05 +02:00
Michael Debertol
f851fb6454
sort: initialize the salt when the random setting is on a key as well
...
Additionall, change the type of `salt` from `String` to `Option<[u8; 16]>`.
2021-07-31 20:07:05 +02:00