* stat: use chrono instead of time in fsext
This removes the dependency of `fsext` on `time` and it cleans up the code.
* stat: use chrono instead of time in fsext
This removes the dependency of `fsext` on `time` and it cleans up the code.
* stat: fix two errors from clippy & spell-checker
* stat: move fn to fix clippy error
* stat: print - if birth time unknown
* uucore/fsext: fix "unused import" error on Windows
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* Refactor to use options struct and make it public for Nushell
* Return the output for use in nushell
* wip:opt1
* Add UNameOutput struct instead
* Apply req changes
* change back to mod options
* uname: add empty line & fix position of comment
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* more handle errors with multiple files
* tests/more test refactor and new case
* tests/more new cases
* more: use show! and change exitstatus and adjust tests to new exitvalue
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
* stat: should fail without arguments #5928
* style and lint issue stat: should fail without arguments #5928
* style and lint issue stat: should fail without arguments #5928
* style and lint 2 issue stat: should fail without arguments #5928
---------
Co-authored-by: biplab5464 <biplab5464@outlook.com>
* refactor wc.rs to remove clippy's cognitive complexity lint
* fix for tracking line length and number of words correctly if chunking occurs within them
* removing more of the cognitive complexity from the Err variant in the match block
* running cargo clippy once
* wc: add empty line to separate functions
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
Change the behavior of `dd` so that it parses numbers that would be too
big and instead treats them as `u64::MAX`. This allows `dd` to run
without error on
dd count=00x9999999999999999999999999999999999999999999999999999999999999
This matches the behavior of GNU `dd`.
This adresses only those where the fix has less letters than the
original and is "trivial" (There are possibly a lot of std::string::ToString::to_string
and those may only be shortened with additional imports).
Found with clippy::redundant-closure-for-method-calls
* unexpand: should allow multiple files #5852 and unexpand: show error message if a directory is specified #5845
* test file added for #5845#5852
* test case test_multiple_files improve
* cakebaker suggestion for a better code #5845#5852
---------
Co-authored-by: biplab5464 <biplab5464@outlook.com>
* fix: return error when input is dir
* test: when tsort is given a dir
* fix: do not need to mention tsort in error message
* test: using concrete directory name
* tsort: fix formatting in test
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* Fix missing dependency to "process" to make it compile.
* fix issue of not forwarding stdout from strip program
* fix issue of applying "./" redundantly
* cargo fmt
* cp: --preserve should keep xattr
Should help with tests/cp/acl.sh
* Update tests/by-util/test_cp.rs
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* Update tests/by-util/test_cp.rs
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* Update tests/by-util/test_cp.rs
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* cksum: stops when one of given files doesn't exist #5809
* removed printld cksum: stops when one of given files doesn't exist #5809
* formatting the code cksum: stops when one of given files doesn't exist #5809
* formatting the code cksum: stops when one of given files doesn't exist #5809
* set exist status cksum: stops when one of given files doesn't exist #5809
* code quality formatting issue cksum: stops when one of given files doesn't exist #5809
* tertsdiepraam idea cksum: stops when one of given files doesn't exist #5809
* one new test case and deleted duplicate show cksum: stops when one of given files doesn't exist #5809
* formatting the test cases cksum: stops when one of given files doesn't exist #5809
* Revert "formatting the test cases cksum: stops when one of given files doesn't exist #5809"
This reverts commit 8c382f1e8f.
* reverting the changes and committing again due to a mistake cksum: stops when one of given files doesn't exist #5809
---------
Co-authored-by: biplab5464 <biplab5464@outlook.com>
* ls: if acl are used, show the + in the perms
Tested by tests/mkdir/p-acl.sh
* CICD.yml: fix small formatting issue
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* Made cksum to return an error if it is used on a directory regardless of the algorithm
* Added one more test for cksum on folders and deleted an old one that expected it to succeed instead of fail
* Made cksum work on more than one item if it fails and added a test for this case
* 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>
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>
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>
`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.
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.