Samuel Tardieu
47e908bc6c
printf: output of double-quote should not be escaped
...
This is obtained by escaping the sequence `\"` as `"`.
2024-01-10 19:17:42 +01:00
Terts Diepraam
0071442cba
Merge pull request #5783 from samueltardieu/printf-compatibility
...
printf compatibility
2024-01-10 16:33:37 +01: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
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
Sylvestre Ledru
b309d64e78
Merge branch 'main' into issue-5766
2024-01-06 22:55:54 +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
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
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
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
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
6510115d9e
Merge pull request #5680 from tertsdiepraam/fsext-refactor
...
Fsext refactor
2023-12-21 15:55:30 +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
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
Laurent Cheylus
e6d12732f5
uucore: disable utmpx feature on OpenBSD
...
- See issue uutils/coreutils#5596 for details
2023-12-11 18:23:35 +01:00
Ian Douglas Scott
db91e12a1d
Fix build on Redox, and add stat
to Redox feature
2023-12-11 04:38:17 -08: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
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
f5776bc511
fix comment
...
Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
2023-12-04 22:40:18 +01:00
Sylvestre Ledru
1a4ca7e65d
fix clippy warnings
2023-12-02 15:19:37 +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
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
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
8eb66ab7ea
printf: remove whitespace, remove redundant spelling ignore and revert matching on result
2023-11-27 11:53:26 +01:00
zoze0
550f3b0c48
uucore: add support for loongarch64 ( #5574 )
...
* uucore: add support for loongarch64
* add loongarch
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2023-11-23 17:41:11 +01:00
Terts Diepraam
e95add7940
uucore/format: fix license headers and improve docs
2023-11-22 14:06:03 +01:00
renovate[bot]
3425ee8d59
fix(deps): update rust crate data-encoding-macro to 0.1.14
2023-11-22 06:09:44 +00:00
renovate[bot]
18b5c22567
fix(deps): update rust crate data-encoding to 2.5
2023-11-21 22:24:11 +00:00
Terts Diepraam
da7c168f9d
all: reduce imports needed for show and show_if_err macros
2023-11-21 12:49:07 +01:00
Terts Diepraam
5c04283d6e
printf: address fmt, clippy, spelling and failing test
2023-11-21 00:42:02 +01:00
Terts Diepraam
6d2698b802
Merge branch 'main' into printf-rewrite
2023-11-20 13:53:11 +01:00
Terts Diepraam
68d036c9a2
printf: basic support for unicode escape sequences
2023-11-20 13:45:02 +01:00
Terts Diepraam
066d8ba73d
printf: coerce missing and invalid arguments to 0
2023-11-20 13:25:20 +01:00
Terts Diepraam
c43ee01d19
printf: allow precision in string
2023-11-20 12:38:26 +01:00
Terts Diepraam
5f2374b339
printf: fix negative hex argument parsing
2023-11-17 14:57:09 +01:00
Terts Diepraam
955640aac8
printf: fix and test float formatting
2023-11-17 14:46:38 +01:00
Terts Diepraam
76eca8d999
uucore/format: fix doctests
2023-11-17 14:43:25 +01:00