Commit graph

1380 commits

Author SHA1 Message Date
kimono-koans
016d5e72ad
ls: Fix padding for dangling links in non-Long formats (#2856)
* Fix padding for dangling links in non-long formats

Co-authored-by: electricboogie <32370782+electricboogie@users.noreply.github.com>
2022-01-11 12:01:54 +01:00
Terts Diepraam
f60c36f242
Merge pull request #2610 from miDeb/cp/abuse
cp: handle edge cases when dest is a symlink
2022-01-11 00:34:55 +01:00
Sylvestre Ledru
dcfdeb334d
Merge pull request #2854 from kimono-koans/ls_fix_errno_1
ls: Fix Errno 1, print errors at the md call point
2022-01-09 20:56:06 +01:00
moko256
5659bf8fae
ls: On Windows use DirEntry#metadata() instead of fs::metadata 2022-01-10 02:56:22 +09:00
electricboogie
4052d4ec6a Add test for double printing dangling link errors 2022-01-08 12:10:52 -06:00
kimono-koans
4ea61545c6
Merge branch 'uutils:master' into ls_fix_errno_1 2022-01-07 21:48:53 -06:00
Sylvestre Ledru
9922e48ba6
Merge pull request #2853 from kimono-koans/ls_fix_first_newline
ls: Fix newline when only dirs in base directory
2022-01-07 23:10:44 +01:00
Sylvestre Ledru
969f3cbf39
Merge pull request #2793 from tertsdiepraam/cksum-result-io-error
`cksum`: use `UIoError`
2022-01-07 21:47:01 +01:00
electricboogie
13d6d74fa3 Fix Windows test(?): inode request shouldn't error on Windows, b/c there are no inodes 2022-01-07 09:24:32 -06:00
electricboogie
882b8ddd7b Fix test dir names for Windows 2022-01-06 15:41:53 -06:00
electricboogie
30b2425541 Fix newline when only dirs in base directory, and test 2022-01-06 14:58:56 -06:00
kimono-koans
421330d07a
ls: Improve error handling and other improvements (#2809)
*  print error in the correct order by flushing the stdout buffer before printing an error
*  print correct GNU error codes
*  correct formatting for config.inode, and for dangling links
*  correct padding for Format::Long
*  remove colors after the -> link symbol as this doesn't match GNU
*  correct the major, minor #s for char devices, and correct padding
*  improve speed for all metadata intensive ops by not allocating metadata unless in a Sort mode
*  new tests, have struggled with how to deal with stderr, stdout ordering in a test though
*  tried to implement UIoError, but am still having issues matching the formatting of GNU


Co-authored-by: electricboogie <32370782+electricboogie@users.noreply.github.com>
2022-01-05 14:50:37 +01:00
Sebastian Holgersson
84798a520e numfmt: fix spelling and formatting issues in tests 2022-01-01 22:55:50 +01:00
Sebastian Holgersson
af5919e466 numfmt: implement missing --suffix option
adds support for the --suffix option from issue #1280.
2022-01-01 21:57:23 +01:00
Jeffrey Finkelstein
f6305e2a3e rm: return UResult from uumain() function 2021-12-29 15:57:55 -05:00
jfinkels
8a55205521
seq: return UResult from uumain() function (#2784) 2021-12-29 15:20:17 +01:00
jfinkels
3f18b98c9d
dd: return UResult from uumain() function (#2792)
* dd: return UResult from uumain() function

* fixup! dd: return UResult from uumain() function
2021-12-29 15:13:52 +01:00
Jeffrey Finkelstein
a882b0cf3e link: return UResult from uumain() function 2021-12-27 18:26:25 -05:00
Terts Diepraam
7ae9e0a7eb cksum: accept directories as empty files 2021-12-26 21:50:13 +01:00
Sylvestre Ledru
5f71e0c8c8
Merge pull request #2790 from jfinkels/comm-uresult
comm: return UResult from uumain() function
2021-12-25 10:41:39 +01:00
Jeffrey Finkelstein
2aebfc9f8d comm: return UResult from uumain() function 2021-12-24 13:40:18 -05:00
Jeffrey Finkelstein
294bde8e08 seq: correct width for certain negative decimals
Fix a bug in which a negative decimal input would not be displayed with
the correct width in the output. Before this commit, the output was
incorrectly

    $ seq -w -.1 .1 .11
    -0.1
    0.0
    0.1

After this commit, the output is correctly

    $ seq -w -.1 .1 .11
    -0.1
    00.0
    00.1

The code was failing to take into account that the input decimal "-.1"
needs to be displayed with a leading zero, like "-0.1".
2021-12-23 20:37:29 -05:00
kimono-koans
fd64e01d92
ls: Reduce binary size of ls by removing regex crate (#2781) 2021-12-22 18:31:45 +01:00
Sylvestre Ledru
59da0d8cd6 cp: add a unit test for issue 1665 2021-12-19 18:19:48 +01:00
electricboogie
a1960f5da0
Fix cp bug: pre-write permission change (#2769) 2021-12-15 22:18:02 +01:00
Sylvestre Ledru
52d2fe1d28 Try to unbreak the code coverage CI.
For some reasons, on windows, test_compress_fail is failing with a different
error. So, don't check the output on windows
2021-12-14 09:46:28 +01: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
Roy Ivy III
f07a1749a1 fix spell-check errors 2021-11-19 17:55:02 -06:00
Roy Ivy III
7133efd0a5 tests ~ fix cargo clippy complaint (clippy::needless_return) 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
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
fed596a23b
tests/chmod: change normal error to usage error 2021-11-12 19:07:37 -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
Thomas Queiroz
c9624725ab
tests: use CmdResult::usage_error 2021-11-09 17:37:05 -03:00
Thomas Queiroz
f43dfa9a61
tests/common: implement CmdResult::usage_error 2021-11-09 16:36:03 -03:00
Thomas Queiroz
0bbc805e43
tests/common: add util_name+bin_path to CmdResult 2021-11-09 16:36:03 -03:00
Thomas Queiroz
ab4573bde9
tests/common: create TestScenario::composite_cmd
This is made to call UCommand::new with Some(util_name)
2021-11-09 16:35:38 -03:00
Thomas Queiroz
d4ca4371d7
tests/common: add util_name+bin_path to UCommand 2021-11-09 04:04:56 -03:00
Thomas Queiroz
fc300dda24
tests/common: UCommand::new rename arg to bin_path
Merge and remove unecessary `.as_ref()`
2021-11-09 00:12:11 -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
Thomas Queiroz
124f929848
tests/env: change Windows test_change_directory
Invoke `cmd.exe /C cd` to determine the current working directory instead of relying on the output of
environment variables.
2021-11-07 23:11:39 -03: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
Hanif Bin Ariffin
7baa05b2db Add tests for silently accepting presume-input-tty
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-11-04 17:04:26 +08:00
Thomas Queiroz
c44b5952b8
tests/env: add unsetting invalid variables test 2021-11-02 19:51:37 -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
f9512e5a90
tests/env: add empty name test 2021-11-02 16:45:39 -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