Commit graph

1839 commits

Author SHA1 Message Date
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
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
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
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
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
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
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