Commit graph

6961 commits

Author SHA1 Message Date
Terts Diepraam
0071442cba
Merge pull request #5783 from samueltardieu/printf-compatibility
printf compatibility
2024-01-10 16:33:37 +01:00
D9nni
9a76997b0a cksum: fixed clippy and fmt errors 2024-01-10 16:49:52 +02:00
Samuel Tardieu
a85a792c88 format: use the new number parser and fix the error messages
The error messages are more compliant with GNU coreutils.
Also, floating hexadecimal numbers are now supported in
`printf`.
2024-01-10 14:34:43 +01:00
Samuel Tardieu
00cd6fa347 format: new dedicated number parser
The parser can parse integral and floating point numbers as expected by
the coreutils `printf` command.
2024-01-10 14:34:43 +01:00
D9nni
911df1d76c cksum: code improvements for cksum --raw --algorithm 2024-01-10 15:15:23 +02:00
D9nni
c7b15ddce9 cksum: fixed cksum --raw --algorithm 2024-01-10 15:04:19 +02:00
D9nni
96271ffa3c cksum: added tests for --raw with each algorithm, not working for crc, sysv, bsd 2024-01-09 23:12:40 +02:00
Terts Diepraam
9858fef20e printf: use 0 instead of 0o as octal prefix 2024-01-09 10:34:08 +01:00
Samuel Tardieu
5dfeca9ff2 format: %c prints the first character of a string 2024-01-09 00:13:54 +01:00
Daniel Hofstetter
1c6bf6991c nl: don't exit if input is directory 2024-01-08 11:01:07 +01:00
Sylvestre Ledru
d72343bc64
Merge branch 'main' into cksum 2024-01-08 09:02:11 +01:00
D9nni
f03ef79bc8 cksum: added tests for --raw and fixed fmt whitespace error 2024-01-08 08:51:06 +02:00
Atomei Alexandru Constantin
288ad97878 Made cksum to return an error if the algorithm blake2b is used on a directory 2024-01-07 23:39:33 +02:00
D9nni
8c1fc8b287 Added --raw argument, with error for multiple files 2024-01-07 21:43:31 +02:00
Sylvestre Ledru
b309d64e78
Merge branch 'main' into issue-5766 2024-01-06 22:55:54 +01:00
Kostiantyn Hryshchuk
c867d6bfb1
shred: implemented "--remove" arg (#5790) 2024-01-06 22:50:21 +01:00
Sylvestre Ledru
247f2e55bd
seq: adjust some error messages. GNU's are better (#5798)
* seq: adjust some error messages. GNU's are better
tested by tests/seq/seq.pl

* uucore: remove todo

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-01-06 16:54:29 +01:00
Fabrice Fontaine
9f4330f94c uucore: add support for sparc64
Add support for sparc64 in uucore to avoid the following build failure
with nushell:

error[E0308]: mismatched types
   --> /home/autobuild/autobuild/instance-7/output-1/build/nushell-0.85.0/VENDOR/uucore/src/lib/features/fs.rs:121:16
    |
111 |     pub fn number_of_links(&self) -> u64 {
    |                                      --- expected `u64` because of return type
...
121 |         return self.0.st_nlink;
    |                ^^^^^^^^^^^^^^^ expected `u64`, found `u32`
    |
help: you can convert a `u32` to a `u64`
    |
121 |         return self.0.st_nlink.into();
    |                               +++++++

For more information about this error, try `rustc --explain E0308`.
error: could not compile `uucore` (lib) due to previous error

Fixes:
 - http://autobuild.buildroot.org/results/f9f0287a8e39c65895014ca513ed25071f020add

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2024-01-06 10:26:54 +01:00
Michel Lind
5de030f119
uuhelp_parser: add links to homepage and repo
When viewing the crate right now, apart from via looking at the dependencies
it's hard to find the associated project and repository.

Add the missing info.

Signed-off-by: Michel Lind <salimma@fedoraproject.org>
2024-01-05 22:21:28 -06:00
Daniel Hofstetter
e13f0d80ee
Merge pull request #5778 from RenjiSann/main
ls: Support QUOTING_STYLE environment variable
2024-01-05 15:55:23 +01:00
Samuel Tardieu
32f0256d7d uucore/num_format: properly display 10ᵖ where p is the precision
`seq --format %.2g 10 10` would display `1` because the precision would
not allow room for the decimal point, and the `0` in `10` would be
trimmed as an insignificant trailing `0`.

This has been fixed by only trimming trailing `0` in the presence of a
decimal point.
2024-01-05 15:40:20 +01:00
Samuel Tardieu
f5179290a6 uucore/num_format: replace saturating_sub by regular subtraction
Using `saturating_sub()` before converting to `usize` gives a wrong
feeling of security as it looks like it ensures that the value will
never go negative. However, since it is applied to `i32`, it can, and
converting it to `usize` would go horribly wrong anyway.

By following the code flow, `exponent` cannot be greater than
`precision`, or the `else` block would not have been taken.  A plain
subtraction will give the same result and will at least panic in debug
mode.
2024-01-05 15:04:12 +01:00
Samuel Tardieu
4c5326ffa3 uucore/num_format: the default precision for %g is 6 2024-01-05 15:00:12 +01:00
Sylvestre Ledru
e64a0b4a26 Various fixes
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-01-05 12:56:27 +01:00
Sylvestre Ledru
aabf5fa577 cp: manages target with trailing '/' 2024-01-05 12:56:27 +01:00
Sylvestre Ledru
cb27b9c9c3 path_ends_with_terminator: rustdoc + unittest 2024-01-05 12:56:27 +01:00
Sylvestre Ledru
108dc4a0cd Move path_ends_with_terminator from mv into uucore 2024-01-05 12:56:27 +01:00
Sylvestre Ledru
4c698d58e0 mv: support the case mkdir a && mv a e/ 2024-01-05 12:56:24 +01:00
Samuel Tardieu
e56682893f uucore: fix style in tests
- `Path::new()` returns a `&Path` and does not need to be dereferenced
- Some types can be deduced from the context and are well visible
  already (`parse_size_u128()` or `from_bytes()`)
2024-01-05 10:14:27 +01:00
Ikko Eltociear Ashimine
9dca071b69
Fix typo in signals.rs (#5781)
* Fix typo in signals.rs

occured -> occurred

* Remove "occurred" from spell-checker:ignore

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-01-05 07:30:23 +01:00
cre4ture
9b3cc5437c
head: head_backwards for non-seekable files like /proc/* or fifos (named pipes) (#5732)
* implement head_backwards for non-seekable files like /proc/* or pipes

Signed-off-by: Ulrich Hornung <hornunguli@gmx.de>
2024-01-05 00:25:59 +01:00
Dorian Péron
6760d63539 ls: Fix clippy warning 2024-01-04 16:51:30 +01:00
Dorian Péron
e30f191579 ls: Handle the use of QUOTING_STYLE variable 2024-01-03 18:37:51 +01:00
Daniel Hofstetter
e4fbc31714 du: ignore duplicate names with --files0-from 2024-01-03 09:39:16 +01:00
Sylvestre Ledru
8df064e1fa
Merge pull request #5772 from cakebaker/du_files0_from_zero_length_file_name
du: show error for nul names with `--files0-from`
2024-01-02 19:53:15 +01:00
Daniel Hofstetter
239e5426e6 du: show error for nul names with --files0-from 2024-01-02 16:06:41 +01:00
Daniel Hofstetter
9f257adf59
Merge pull request #5765 from sylvestre/handle-full
handle the error when stdout is full
2024-01-02 08:31:19 +01:00
Sylvestre Ledru
f53f9b6496 handle the error when stdout is full
Avoid panic when using
seq 1 >/dev/full

Should move tests/csplit/csplit-io-err.sh from ERROR to SKIP
2024-01-01 17:00:10 +01:00
Daniel Hofstetter
01e12120c1 mv: simplify condition 2024-01-01 16:48:06 +01:00
Daniel Hofstetter
7ddeba4b98 cp: show no "same file" error for --link a a 2024-01-01 14:30:27 +01:00
Daniel Hofstetter
5673f32c63 cp: show error if source & dest are same file 2023-12-31 16:01:34 +01:00
Daniel Hofstetter
902a128ea8 cp: rename function
is_forbidden_copy_to_same_file -> is_forbidden_to_copy_to_same_file
2023-12-31 14:36:18 +01:00
Daniel Hofstetter
2c42623b6e cp: backup dest symlink linking to source 2023-12-31 14:09:08 +01:00
Sylvestre Ledru
b07ea957d3 rm: improve the code a tiny bit 2023-12-31 12:03:42 +01:00
Sylvestre Ledru
5fc01f718a
Merge pull request #5747 from Ato2207/fix_docs
Fix docs issues.
2023-12-30 19:28:54 +01:00
Vardhan Patil
d990021572 cksum: remove redundant guard 2023-12-30 20:39:09 +05:30
Vardhan Patil
e7cb4e9ff0 cksum: properly handle cases where --lenghth is 0 or >512 2023-12-30 20:28:03 +05:30
Atomei Alexandru
5ade45f8e9
Merge branch 'main' into fix_docs 2023-12-30 15:43:54 +02:00
Vardhan Patil
aec0cfa6e3 cksum: remove commented code 2023-12-30 16:05:20 +05:30
Vardhan Patil
7caa0bcdea cksum: fix formatting in cksum.rs 2023-12-30 16:02:10 +05:30
Vardhan Patil
037073d852 cksum: make the output formatting match GNU 2023-12-30 15:59:29 +05:30
Sylvestre Ledru
138b11efbd
remove extra spaces 2023-12-30 09:53:32 +01:00
Vardhan Patil
231987b109 cksum: create initial implementation of the --length option 2023-12-30 12:48:19 +05:30
Matei Mantu
21d09dd404
ls: unquoted names should be indented with a space if there is a quoted name (#5740)
* ls: change indentation when file names include quotes to match GNU's

* display_grid: Changed order of parameters because it made more sense

* ls -l: Add padding for unquoted filenames

* Fix checking for quoted filenames

* Simplify if
2023-12-29 15:19:26 +01:00
Sylvestre Ledru
448e4c2224
Merge pull request #5745 from cakebaker/cp_adapt_warning
cp: adapt warning if source is used more than once
2023-12-29 15:09:24 +01:00
Alexandru-Constantin Atomei
d15981650a Fixed one typo 2023-12-29 15:08:50 +01:00
Alexandru-Constantin Atomei
1e5244765d Made one more modification to test usage string. 2023-12-29 15:08:50 +01:00
Alexandru-Constantin Atomei
e61318413e Added documentation for the vdir command. 2023-12-29 15:08:50 +01:00
Alexandru-Constantin Atomei
ce28ae5c02 Fixed more and test docs 2023-12-29 15:08:50 +01:00
Sylvestre Ledru
f8f82774c3
Merge pull request #5696 from dvalere/my-conts
src: Fixing typos in signatures for the argument parser
2023-12-29 15:08:39 +01:00
Daniel Hofstetter
7025619325 cp: adapt warning if source is used more than once 2023-12-29 10:24:08 +01:00
Daniel Hofstetter
9bb725cefc clippy: fix warnings introduced by Rust 1.75 2023-12-28 18:17:06 +01:00
Sylvestre Ledru
2c0f15be55 install: if run as root, revert the uid & gid to root 2023-12-28 10:06:13 +01:00
Sylvestre Ledru
0fb3ffb8ad install: document the need_copy function 2023-12-28 10:05:44 +01:00
Sylvestre Ledru
c0206c5ea4 install: document the need_copy function 2023-12-28 10:05:28 +01:00
Sylvestre Ledru
ce18f8a2a1 install: split the need_copy check 2023-12-28 10:03:42 +01:00
Daniel Hofstetter
179f0a7c3c
Merge pull request #5733 from sylvestre/getegid_geteuid
use our getegid & geteuid wrappers function instead of libc calls
2023-12-28 08:49:34 +01:00
Sylvestre Ledru
ad16313c59
head: -c allocate memory as needed (#5704)
* head: -c allocate memory as needed

Improve the execution of tests/head/head-c.sh

* simplify the code

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-12-28 07:15:01 +01:00
Sylvestre Ledru
c38a43210c use our getegid & geteuid wrappers function instead of libc calls 2023-12-28 00:35:20 +01:00
Daniel Hofstetter
0701f535ac cp: fix backup of destination symlink 2023-12-27 15:39:54 +01:00
Matei Mantu
bf26eda786
install: remove / from end of path if it exists so as not to mess with .exists() (#5730)
* remove / from end of path if it exists so as not to mess with .exists()

* install: fix / removal from path

* Fix clippy warnings

* Add test for install target ends with /
2023-12-27 13:37:17 +01:00
Darius
edbb7d5b02 join: fixed parameter
basenc: fixed parameter
cut: fixed parameter
mkdir: fixed parameter
nohup: fixed parameter
pr: fixed parameter
printenv: fixed parameter
printf: added parameters
runcon: fixed typo
shuf: fixed typo
sum: fixed typo
uniq: fixed parameter
unlink: fixed parameter
2023-12-26 16:13:18 +01:00
Sylvestre Ledru
167acb5147
Merge pull request #5484 from cakebaker/cp_l_with_dest_hardlink_to_source
cp --link: don't fail if destination is hardlink to source
2023-12-26 16:12:15 +01:00
Sylvestre Ledru
30eb77ac79
du: implement files0-from (#5721)
* du: implement files0-from

Should make tests/du/files0-from-dir pass

* du: prepare tests/du/files0-from.pl

* fix the build on Windows

* add testfile to the ignore list

* remove useless comment

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* mkdir is enough

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* address review comments

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-12-26 14:40:31 +01:00
Paul Houssel
eb3dd521ee
touch: address cognitive_complexity lint
Signed-off-by: Paul  Houssel <paul.houssel@telecom-sudparis.eu>
2023-12-26 13:02:00 +01:00
Paul Houssel
da43183fc7
cat: address cognitive_complexity lint
Signed-off-by: Paul  Houssel <paul.houssel@telecom-sudparis.eu>
2023-12-26 13:02:00 +01:00
Sylvestre Ledru
db9f4cc315
Merge pull request #5483 from cakebaker/mv_fix_5481
mv: fix subdir detection
2023-12-25 22:02:23 +01:00
Daniel Hofstetter
f10c6f1d56
Merge pull request #5699 from sylvestre/mv-cp-seen
cp/mv/ln: add support for the "will not overwrite just-created"
2023-12-25 14:58:50 +01:00
Daniel Hofstetter
03f1b8aa3a mv: fix subdir detection 2023-12-25 13:12:18 +01:00
Daniel Hofstetter
4946478409 cp: -l don't fail if dest is hardlink to source 2023-12-25 13:03:11 +01:00
Sylvestre Ledru
356023b055
Merge pull request #5431 from cakebaker/cp_remove_destination_shouldnt_fail_hardlink
cp --remove-destination: don't fail if destination is hardlink to source
2023-12-25 13:02:50 +01:00
Sylvestre Ledru
f86e314f46 Fix some obvious comment
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-12-25 11:17:04 +01:00
Sylvestre Ledru
840a5bf083
Merge pull request #5700 from cakebaker/ls_block_size_with_k
ls: set correct block size when -k is provided
2023-12-25 11:14:09 +01:00
Daniel Hofstetter
6475e6f148
Merge pull request #5660 from sylvestre/stat-free-color
ls: Improve the access to metadata of the files
2023-12-25 08:29:25 +01:00
Daniel Hofstetter
270ac90cc1 ls: set correct block size when -k is provided 2023-12-24 16:35:49 +01:00
Sylvestre Ledru
c5217b3136 ls: remove unused arg check_for_deref 2023-12-24 15:03:34 +01:00
Sylvestre Ledru
18035a5f82 update of the function names in the comment
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-12-24 14:57:06 +01:00
Sylvestre Ledru
53b3c782ef add a link to d_type doc 2023-12-24 14:57:06 +01:00
Sylvestre Ledru
a3c7359056 ls: refactor the code 2023-12-24 14:57:06 +01:00
Sylvestre Ledru
5120acb27a fix a clippy warning 2023-12-24 14:57:06 +01:00
Sylvestre Ledru
445d0af277 ls: rename get_metadata_with_deref_opt 2023-12-24 14:57:06 +01:00
Sylvestre Ledru
147721c24b ls: Improve the access to metadata of the files Should fix tests/ls/stat-free-color.sh 2023-12-24 14:57:06 +01:00
Sylvestre Ledru
95fa81250e ls/color_name: use the DirEntry if available 2023-12-24 14:57:06 +01:00
Sylvestre Ledru
1bd8ce5ddf ls/color_name: use PathData instead of a Path as we want to check for DirEntry 2023-12-24 14:57:06 +01:00
Sylvestre Ledru
c0c5ec25b6 ls: rename a function for something more explicit 2023-12-24 14:57:06 +01:00
Sylvestre Ledru
28d684b5ac ls: add a comment 2023-12-24 14:57:06 +01:00
Daniel Hofstetter
4d05f208e0
Merge pull request #5701 from sylvestre/debug
cp: debug with --update=none should show 'skipped'
2023-12-24 14:25:57 +01:00
Daniel Hofstetter
8ede675088
Merge pull request #5712 from sylvestre/shred
shred: improve some output to match GNU's
2023-12-24 14:05:35 +01:00
Daniel Hofstetter
0d05a41f46
Merge pull request #5702 from sylvestre/runcon
runcon: remove trailing '.'
2023-12-24 13:54:52 +01:00
Sylvestre Ledru
c5b08f1c4a shred: improve some output to match GNU's 2023-12-24 11:40:15 +01:00
Sylvestre Ledru
9b78016ac5 runcon: remove trailing '.'
Upstream doesn't have in:
https://github.com/coreutils/coreutils/blob/master/tests/runcon/runcon-no-reorder.sh#L22
2023-12-23 23:03:18 +01:00
Sylvestre Ledru
8685e05f4e cp: debug with --update=none should show 'skipped' 2023-12-23 17:58:05 +01:00
Daniel Hofstetter
be822009f0
Merge pull request #5686 from sylvestre/install-basic
install: with -t, check if we aren't passed a file
2023-12-23 15:33:45 +01:00
Sylvestre Ledru
2832694056
install: support when a hyphen is passed (#5697)
* install: support when a hyphen is passed

Should fix: tests/install/strip-program.sh

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-12-23 15:29:32 +01:00
Sylvestre Ledru
ceecac110c ln: manages the 'seen' file list before linking
Should help with tests/mv/childproof.sh
2023-12-23 13:53:26 +01:00
Sylvestre Ledru
c94773f522 mv: make sure it continues when hiting an error 2023-12-23 13:27:00 +01:00
Sylvestre Ledru
9c7fd5e8cb mv: rename the variable to match the name in cp 2023-12-23 13:07:54 +01:00
Sylvestre Ledru
3af8ad0fe6 mv: manages the 'seen' file list before moving
Should help with tests/mv/childproof.sh
2023-12-23 13:07:39 +01:00
Sylvestre Ledru
06c98fbdd3 cp: don't fail when --backup=numbered is passed 2023-12-23 12:48:38 +01:00
Sylvestre Ledru
837640bc02 cp: manages the 'seen' file list before copying
Should help with tests/mv/childproof.sh
2023-12-23 12:11:35 +01:00
Sylvestre Ledru
6b1f51385f
Merge pull request #5693 from cakebaker/ls_second_blocksize
ls: introduce 2nd blocksize & fix todos in tests
2023-12-23 09:57:08 +01:00
Sylvestre Ledru
9ca7c3e107 install: with -t, check if we aren't passed a file
Should pass tests/install/basic-1
2023-12-22 18:16:23 +01:00
Daniel Hofstetter
1c6317af76 mv: allow dest with slash when using --update 2023-12-22 17:03:59 +01:00
Daniel Hofstetter
a8a5931cae ls: introduce 2nd blocksize & fix todos in tests 2023-12-22 11:42:01 +01:00
Daniel Hofstetter
6510115d9e
Merge pull request #5680 from tertsdiepraam/fsext-refactor
Fsext refactor
2023-12-21 15:55:30 +01:00
Sylvestre Ledru
e071fd3042
Merge pull request #5684 from allaboutevemirolive/v10_expand
expand: fix duplicate flags
2023-12-21 11:03:09 +01:00
Sylvestre Ledru
95852dbaa5
Merge pull request #5687 from cakebaker/ls_remove_condition
ls: remove condition with unreachable "else" block
2023-12-21 10:44:58 +01:00
Daniel Hofstetter
f16a4ae9c9 ls: remove condition with unreachable "else" block 2023-12-21 09:37:36 +01:00
allaboutevemirolive
3e6187269e fix duplicate flags 2023-12-20 23:30:46 +02:00
Justin !
a6ba81db20
sort: allow -f to be pass multiple time
Fix #5667
2023-12-20 12:42:57 -05:00
Sylvestre Ledru
c20f009da4
Merge pull request #5676 from lcheylus/openbsd-fix
uucore: remove useless conversion for features/fs on OpenBSD
2023-12-20 15:44:34 +01:00
Terts Diepraam
f90713278f uucore/fsext: do not use dangerous macro for nul terminated UTF16 strings 2023-12-20 15:27:51 +01:00
Terts Diepraam
cc15876bb7 uucore/fsext: merge some windows imports 2023-12-20 15:27:51 +01:00
Terts Diepraam
d4a9d63ea2 uucore/fsext: refactor MountInfo construction 2023-12-20 15:27:51 +01:00
Daniel Hofstetter
d8709d2839 ls: recognize BLOCKSIZE env var 2023-12-19 15:00:06 +01:00
Sylvestre Ledru
6bcf4e2cec
tr: add 'boop' to the ignore spell check 2023-12-19 13:26:39 +01:00
Laurent Cheylus
b9d4f97e6d
uucore: remove useless conversion for features/fs on OpenBSD
- src/uucore/src/lib/features/fs.rs: in inode function, remove useless
    conversion for target_OS = OpenBSD

Signed-off-by: Laurent Cheylus <foxy@free.fr>
2023-12-19 12:13:20 +01:00
Sylvestre Ledru
9920f13a34
Merge pull request #5640 from tertsdiepraam/tr-no-output
`tr`: operate on bytes instead of chars
2023-12-19 11:42:44 +01:00
Sylvestre Ledru
3d42619027
Merge pull request #5674 from cakebaker/ls_ignore_invalid_block_size_from_env_vars
ls: ignore invalid block size from env vars
2023-12-19 11:11:11 +01:00
Daniel Hofstetter
d8f299eb48 ls: mention config.hyperlink in comment 2023-12-19 10:50:36 +01:00
Daniel Hofstetter
ebfbd8b1fe ls: rename display_file_name -> display_item_name 2023-12-19 10:50:36 +01:00
Daniel Hofstetter
a5606613bd ls: ignore invalid block size from env vars 2023-12-19 10:02:34 +01:00
Sylvestre Ledru
52af36d80b
Merge pull request #5673 from tertsdiepraam/expr-fix-comparison
`expr`: coerce to string before comparing values
2023-12-18 22:50:42 +01:00
Terts Diepraam
00b9cbe09e expr: coerce to string before comparing values 2023-12-18 22:24:31 +01:00
Sylvestre Ledru
b32c93ee5e
Merge pull request #5672 from cakebaker/ls_hyperlink_dirs
ls: support hyperlinks for dir names
2023-12-18 18:24:27 +01:00
Sylvestre Ledru
ece9e91593
Merge pull request #5671 from Yykz/wc_args_override
wc: fix arguments not overriding
2023-12-18 15:56:10 +01:00
Daniel Hofstetter
917c6a4743 ls: support hyperlinks for dir names 2023-12-18 15:26:09 +01:00
Daniel Hofstetter
8c6463c525 ls: extract "create_hyperlink" function 2023-12-18 14:25:13 +01:00
Sylvestre Ledru
0fa074fcba
Merge pull request #5629 from cakebaker/ls_hyperlink_encode
ls: encode path when using --hyperlink
2023-12-18 13:38:08 +01:00
Yykz
bd22aba03b make args of wc overriding 2023-12-18 12:47:37 +01:00
Daniel Hofstetter
e79eb097af
Merge pull request #5656 from sylvestre/ls-var
ls: manages the COLOR and COLORTERM variables
2023-12-18 07:16:38 +01:00
Sylvestre Ledru
5b45159996
Improve the comment 2023-12-17 17:40:44 +01:00
Sylvestre Ledru
af2625c8ce
fix order
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-12-17 17:39:02 +01:00
Akmal
052f38f14d
unexpand: remove crash! macro (#5588)
* unexpand_macro_fixed

* unexpand

* Remove crash

* Passed local test case

* Small changes

* unexpand: remove #[allow(clippy::cognitive_complexity)]

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-12-17 16:43:00 +01:00
Sylvestre Ledru
35ae43e71f
Merge pull request #5620 from lcheylus/openbsd-utmpx
Support unix feature on OpenBSD (utmpx not supported)
2023-12-16 18:15:11 +01:00
Daniel Hofstetter
9167a84358 ls: enable "colors" feature 2023-12-16 17:17:44 +01:00
Sylvestre Ledru
afc6ac8114
Apply change from c32e730a1f 2023-12-16 10:30:47 +01:00
Sylvestre Ledru
6621a1d6d6
Apply the change from c32e730a1f too 2023-12-16 10:30:17 +01:00
Sylvestre Ledru
1bfac9b25a
Merge branch 'main' into openbsd-utmpx 2023-12-16 10:29:16 +01:00
Sylvestre Ledru
f6d3f9afbf ls: manages the COLOR and COLORTERM variables
Should fix GNU tests/ls/color-term.sh
2023-12-16 09:50:37 +01:00
Sylvestre Ledru
01000a37a3 fix two minor clippy warnings 2023-12-16 09:40:38 +01:00
Daniel Hofstetter
f5b228d876
Merge pull request #5651 from tertsdiepraam/remove-parsemode
`mknod`: remove `parsemode.rs`
2023-12-15 16:36:32 +01:00
Daniel Hofstetter
88428cf5d7
Merge pull request #5649 from tertsdiepraam/remove-collect-lossy-and-ignore
all: remove `collect_{lossy,ignore}` calls where possible
2023-12-15 16:30:08 +01:00
Terts Diepraam
30c27c143c mknod: remove parsemode.rs
This file was entirely unused, so it's probably safe to remove it
2023-12-15 15:56:41 +01:00
Terts Diepraam
c32e730a1f all: remove collect_{lossy,ignore} calls where possible 2023-12-15 14:38:27 +01:00
Arpit Bhadauria
3a7a3bf639
fmt: remove crash! macro (#5589)
* fmt: remove crash! macro

* Fix styling in fmt

* Revert "Fix styling in fmt"

This reverts commit 002e02f50c.

* Revert "fmt: remove crash! macro"

This reverts commit d65a3f85a1.

* Replace crash! with unreachable! macro

* Remove crash! import

* Remove unreachable! from fmt

* keep the helpful comment

* Fix lint and format issues

* review fixes
2023-12-15 12:14:31 +01:00
Sylvestre Ledru
f248cc641c
Merge pull request #5614 from Arp-1/feat-refactor-expr
expr: Optimizing for integer values
2023-12-14 18:50:50 +01:00
Terts Diepraam
7f23faf899 expr: clean up conversion from bigint to usize 2023-12-14 16:35:56 +01:00
Daniel Hofstetter
42558344f1 ls: enable "args override self" 2023-12-12 14:23:51 +01:00
Daniel Hofstetter
89cb4acb99 ls: encode path when using --hyperlink 2023-12-12 10:03:55 +01:00
Arpit Bhadauria
3bf966df56 remove from trait for NumOrStr 2023-12-11 20:47:36 +00:00
Laurent Cheylus
e1032e1f06 who: tool unsupported on OpenBSD
- utmpx not supported on OpenBSD

  - add src/uu/who/src/platform directory and platform/mod.rs for conditional compilation according
    to target_os
  - platform/openbsd.rs: implementation on OpenBSD (unsupported tool)
  - platform/unix.rs: implementation on other OS
  - src/uu/who/src/who.rs: use platform module for uucore::main function
2023-12-11 18:23:35 +01:00
Laurent Cheylus
fdd6ecb713 users: tool unsupported on OpenBSD
- utmpx not supported on OpenBSD

  - add src/uu/users/src/platform directory and platform/mod.rs for conditional compilation
    according to target_os
  - platform/openbsd.rs: implementation on OpenBSD (unsupported tool)
  - platform/unix.rs: implementation on other OS
  - src/uu/users/src/users.rs: use platform module for uucore::main function
2023-12-11 18:23:35 +01:00
Laurent Cheylus
8c6d722916 uptime: tool unsupported on OpenBSD
- utmpx not supported on OpenBSD

  - add src/uu/uptime/src/platform directory and platform/mod.rs for conditional compilation
    according to target_os
  - platform/openbsd.rs: implementation on OpenBSD (unsupported tool)
  - platform/unix.rs: implementation on other OS
  - src/uu/uptime/src/uptime.rs: use platform module for uucore::main function
2023-12-11 18:23:35 +01:00
Laurent Cheylus
d3e6e7a947 pinky: tool unsupported on OpenBSD
- utmpx not supported on OpenBSD

  - add src/uu/pinky/src/platform directory and platform/mod.rs for conditional compilation
    according to target_os
  - platform/openbsd.rs: implementation on OpenBSD (unsupported tool)
  - platform/unix.rs: implementation on other OS
  - src/uu/pinky/src/pinky.rs: use platform module for uucore::main function
2023-12-11 18:23:35 +01:00
Laurent Cheylus
e6d12732f5 uucore: disable utmpx feature on OpenBSD
- See issue uutils/coreutils#5596 for details
2023-12-11 18:23:35 +01:00
Laurent Cheylus
38ea40d0bf nohup: fix for OpenBSD with _vprocmgr_detach_from_console function 2023-12-11 18:23:35 +01:00
Laurent Cheylus
94537d3b34 id: fix support for OpenBSD
- add target_os cfg for pline function
  - add target_os cfg for auditd function (void on OpenBSD)
2023-12-11 18:23:35 +01:00
Laurent Cheylus
d239b2f47b chroot: add OpenBSD support for set_groups function 2023-12-11 18:23:35 +01:00
Daniel Hofstetter
6711dd5694 ls: make --block-size and --human-readable/--si
override each other
2023-12-11 16:38:55 +01:00
Terts Diepraam
181cfc885b
Merge pull request #5634 from cakebaker/ls_use_show_dir_name
ls: use show_dir_name to output dir name
2023-12-11 14:38:47 +01:00
Daniel Hofstetter
3dad5d4d56
Merge pull request #5635 from tertsdiepraam/fix-echo-override
`echo`: make `-e` and `-E` override each other
2023-12-11 14:21:15 +01:00
Terts Diepraam
bc5b5e013a tr: operate on bytes instead of chars 2023-12-11 13:35:17 +01:00
Terts Diepraam
191eb9ac12 echo: make -e and -E override each other 2023-12-11 10:53:55 +01:00
Daniel Hofstetter
3dab2b7390 ls: use show_dir_name to output dir name 2023-12-11 09:33:36 +01:00
Sylvestre Ledru
4442b35370
Merge pull request #5626 from cakebaker/ls_invalid_block_size
ls: handle invalid block size as GNU does
2023-12-11 07:49:38 +01:00
Ian Douglas Scott
db91e12a1d Fix build on Redox, and add stat to Redox feature 2023-12-11 04:38:17 -08:00
Arpit Bhadauria
824371d884 style lint fixes 2023-12-11 02:12:24 +00:00
Arpit Bhadauria
fa0c64ddde review fixes 2023-12-11 02:05:55 +00:00
Arpit Bhadauria
17f2b830d8 Merge branch 'main' into feat-refactor-expr 2023-12-11 01:19:40 +00:00
Dorian Péron
673093f842
ls: set default quoting style to literal when not TTY (#5553)
* ls: set default quoting style to literal if output is not TTY

* tests/ls: Fix quoting tests that now run with Literal as default

* ls: Fix formatting/linting/spelling issues

* tests/ls: Fix windows escaped tests
2023-12-10 16:07:41 +01:00
Sylvestre Ledru
e071286eb0 address review comments 2023-12-09 13:10:41 +01:00
Sylvestre Ledru
268b180416 ls colors: create a stylemanager to carry the previous style to know if we need to reset or not 2023-12-09 13:10:38 +01:00
Sylvestre Ledru
b676216f9b ls: use the gnu_legacy feature from lscolors 2023-12-09 13:05:12 +01:00
Daniel Hofstetter
e9dc2930ee ls: handle invalid block size as GNU does 2023-12-08 19:19:51 +01:00
Daniel Hofstetter
7695fe3fb3
Merge pull request #5623 from tertsdiepraam/du-cleanup
`du` cleanup
2023-12-08 08:21:08 +01:00
Terts Diepraam
7861559f88 du: put excludes in traversaloptions and make size_format enum 2023-12-07 22:12:06 +01:00
Yury Zhytkou
0076c9f64c
Update src/uu/wc/src/count_fast.rs
Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
2023-12-07 12:13:34 -05:00
zhitkoff
a97b574fec wc: comments 2023-12-07 10:50:55 -05:00
zhitkoff
b7f708b233 wc: comments 2023-12-07 10:50:55 -05:00
zhitkoff
54ac5a7e1a wc: count_fast windows optimization 2023-12-07 10:50:55 -05:00
zhitkoff
9ff7b42d83 wc: stat casting 2023-12-07 10:50:55 -05:00
zhitkoff
9c4d88009d wc: clippy 2023-12-07 10:50:55 -05:00
zhitkoff
85e78376fe wc: count_fast seek optimization 2023-12-07 10:50:55 -05:00
zhitkoff
6186153a08 wc: count_fast optimization using seek 2023-12-07 10:50:55 -05:00
zhitkoff
253926f2e2 wc: unix input redirect 2023-12-07 10:50:55 -05:00
zhitkoff
054ca4a6b5 wc: better handle files in pseudo-filesystems 2023-12-07 10:50:55 -05:00
Sylvestre Ledru
ca024abe31
Merge pull request #5554 from cakebaker/mv_no_target_directory
mv: fix issue with -T and destination ending with "/"
2023-12-07 14:13:06 +01:00
Terts Diepraam
d6b10d4d72 du: split traversal and printing options 2023-12-07 11:26:44 +01:00
Terts Diepraam
6cae191569 du: remove ArgMatches from StatPrinter 2023-12-07 11:06:04 +01:00
Terts Diepraam
09999427cc du: merge imports 2023-12-07 10:02:29 +01:00
Sylvestre Ledru
fe730f8a49
Merge pull request #5611 from sylvestre/dirdb
dircolors: Move the static long string into structures.
2023-12-07 09:58:55 +01:00
Daniel Hofstetter
5a32ab8004 ls: implement --hyperlink 2023-12-07 08:14:25 +01:00
Sylvestre Ledru
80b1ccd665
Merge pull request #5609 from cakebaker/ls_ignore_value_of_posixly_correct
ls: ignore value of `POSIXLY_CORRECT`
2023-12-06 21:27:21 +01:00
Sylvestre Ledru
f99987bb35 fix rustfmt 2023-12-06 21:19:59 +01:00
Sylvestre Ledru
bd667efa7b
simplify the declaration
Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
2023-12-06 21:15:43 +01:00
Sylvestre Ledru
97ec99cf28
use a single push_str
Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
2023-12-06 21:14:59 +01:00
Arpit Bhadauria
4d2ae8485c impl from trait instead of into 2023-12-04 22:44:18 +00:00
Sylvestre Ledru
b0fdb1edef Rest of the comments 2023-12-04 23:39:10 +01:00
Sylvestre Ledru
1c9413e185 bring back the old format 2023-12-04 22:51:08 +01:00
Sylvestre Ledru
3e35410907 dircolors: fix comments 2023-12-04 22:47:42 +01:00
Sylvestre Ledru
dabbcff9fb dircolors: manage the --print-ls-colors pipe option 2023-12-04 22:41:03 +01:00
Sylvestre Ledru
f5776bc511
fix comment
Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
2023-12-04 22:40:18 +01:00
Daniel Hofstetter
cf853df2dc ls: remove "#[allow(unused_variables)]" 2023-12-04 14:48:25 +01:00
Arpit Bhadauria
9ecd6a296e Refactoring for lint issues 2023-12-03 23:32:51 +00:00
Arpit Bhadauria
21c041fa79 Fix lint issues in expr 2023-12-03 22:27:13 +00:00
Arpit Bhadauria
5672e3d9bd Fix errors 2023-12-03 22:07:56 +00:00
Arpit Bhadauria
f8573d5551 code and styling fixes in expr 2023-12-03 20:03:50 +00:00
Arpit Bhadauria
d8a64a90ec Formatting fixes in expr 2023-12-03 15:09:12 +00:00
Daniel Hofstetter
51fc2d7564 ls: ignore value of POSIXLY_CORRECT 2023-12-03 16:01:19 +01:00
Daniel Hofstetter
c77d389f5b ls: improve some var names related to block sizes 2023-12-03 14:58:14 +01:00
Daniel Hofstetter
a6d15d67ca ls: cleanup "spell-checker:ignore" entries 2023-12-03 14:58:14 +01:00
Arpit Bhadauria
117ab7737a Optimize expr for numerical values 2023-12-02 17:25:57 +00:00
Daniel Hofstetter
aee1fcade4
Merge pull request #5599 from lcheylus/openbsd-build
Add support in uucore for OpenBSD
2023-12-02 15:20:17 +01:00
Sylvestre Ledru
1a4ca7e65d fix clippy warnings 2023-12-02 15:19:37 +01:00
Sylvestre Ledru
e4b8750434 dircolors -p: generate it dynamically 2023-12-02 15:10:00 +01:00
Sylvestre Ledru
5d19f79cd0 dircolors should use the datastructures when printing 2023-12-02 15:04:39 +01:00
Sylvestre Ledru
0e8c171c80 dircolors: move the FILE_ATTRIBUTE_CODES datastructures and use it 2023-12-02 11:03:51 +01:00
Sylvestre Ledru
13a4c9114c create datastructures for colors 2023-12-02 10:29:02 +01:00
Sylvestre Ledru
e24d6b2fbd
Merge pull request #5604 from cakebaker/ls_fix_padding
ls: fix padding of size column when using `-l`
2023-12-02 09:40:18 +01:00
Daniel Hofstetter
0ec6802459 ls: fix padding of size column when using -l 2023-11-30 16:19:27 +01:00
clara swanson
9061b2ba7e
libstdbuf: remove crash macro (#5565)
* libstdbuf: remove crash macro

* libstdbuf: remove uucore macro/struct and use gnu messages

* libstdbuf: remove crash macro

* libstdbuf: remove uucore macro/struct and use gnu messages

* libstdbuf: remove :? from print by printing file descriptor instead of file

* merge main into libstdbuf-remove-crash-macro

* libstdbuf: remove uucore from dependencies
2023-11-30 11:01:31 +01:00
Laurent Cheylus
420df3db3d
Add support in uucore for OpenBSD
- uucore/src/lib/features/fs.rs: add target_os = OpenBSD when needed
  - uucore/src/lib/features/fsext.rs: implement FsUsage::new for OpenBSD

  - fixes uutils/coreutils#5448

  - initial code by n1000 https://github.com/n1000/coreutils/tree/openbsd_compile_fixes

Signed-off-by: Laurent Cheylus <foxy@free.fr>
2023-11-29 17:44:50 +01:00
Sylvestre Ledru
3cadeb734d
Merge pull request #5561 from tertsdiepraam/fixup-macros
all: reduce imports needed for `show` and `show_if_err` macros
2023-11-29 15:10:59 +01:00
Sylvestre Ledru
203e79d74b
Fix unused import: UError 2023-11-29 14:09:13 +01:00
Daniel Hofstetter
6eec4fe8f9 cut: add test & improve error message 2023-11-29 09:41:11 +01:00
Daniel Hofstetter
08998c0e40
Merge pull request #5593 from cakebaker/fmt_rename_var
fmt: rename `pfxind_end` -> `prefix_indent_end`
2023-11-29 08:08:55 +01:00
Dylan Aïssi
7383820354 uuhelp_parser: include missing LICENSE
Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
2023-11-28 16:51:20 +01:00
Daniel Hofstetter
2d5ea26410 fmt: rename pfxind_end -> prefix_indent_end 2023-11-28 14:42:28 +01:00
Daniel Hofstetter
32bc2e4bc8
Merge pull request #5592 from tertsdiepraam/fmt-small-refactor
`fmt`: a collection of small refactors
2023-11-28 14:15:30 +01:00
Terts Diepraam
2a8f4ec294 fmt: inline parse_arguments function 2023-11-28 12:42:23 +01:00
Terts Diepraam
0b4d4b610c fmt: put options into module and change static to const 2023-11-28 12:42:23 +01:00
Terts Diepraam
8a49453057 fmt: clean up imports 2023-11-28 12:42:23 +01:00
Terts Diepraam
96ca5e609e fmt: refactor width and goal calculation 2023-11-28 12:42:23 +01:00
Terts Diepraam
f5206ce783 fmt: merge prefix and use_prefix options (same for anti_prefix) 2023-11-28 12:42:20 +01:00
Terts Diepraam
d78923e4cc fmt: extract determining options to separate function 2023-11-28 12:37:09 +01:00
Terts Diepraam
01c32a5220 fmt: clean up some small bits 2023-11-28 11:40:33 +01:00
Sylvestre Ledru
b5ce876fef
Merge pull request #5580 from zhitkoff/split-r-chunk
split: passing GNU test r-chunk.sh
2023-11-28 10:38:00 +01:00
Sylvestre Ledru
14a8e8a452
Merge pull request #5128 from tertsdiepraam/printf-rewrite
`printf` rewrite (with a lot of `seq` changes)
2023-11-28 07:52:58 +01:00
Terts Diepraam
83784b2d96 expr: refactor AST and parsing 2023-11-27 15:18:14 +01:00