Kourosh
775682508a
more: move from getopts to clap ( #1962 )
2021-03-30 20:39:58 +02:00
Sylvestre Ledru
a5402eed41
Merge pull request #1967 from jhscheer/iss1775
...
chmod: fixed behavior for dangling symlinks (#1775 )
2021-03-30 20:30:16 +02:00
Jan Scheer
2647a72e9e
chmod: fixed behavior for dangling symlinks ( #1775 )
2021-03-29 22:07:09 +02:00
Yagiz Degirmenci
25df51a525
fix(cksum): check metadata of the path ( #1951 )
...
* fix: check metadata of the path
* chore: use existing path
2021-03-29 18:44:42 +02:00
Raymond Wang
d88de3c6a6
tr: more explicit flag names ( #1966 )
2021-03-29 17:16:48 +02:00
Ricardo Iglesias
5f17719a59
Implemented --indicator-style flag on ls. ( #1907 )
...
* Implemented --indicator-style flag on ls.
* Rust fmt
* Grouped indicator_style args.
* Added tests for sockets and pipes.
Needed to modify util.rs to add support for pipes (aka FIFOs).
* Updated util.rs to remove FIFO operations on Windows
* Fixed slight error in specifying (not(windows))
* Fixed style violations and added indicator_style test for non-unix systems
2021-03-29 13:10:13 +02:00
Mikadore
8320b1ec5f
Rewrote head ( #1911 )
...
See https://github.com/uutils/coreutils/pull/1911
for the details
2021-03-29 13:08:48 +02:00
electricboogie
da5f2f3a6c
sort: Add a GNU-style Random Sorter ( #1922 )
2021-03-29 13:05:52 +02:00
Yagiz Degirmenci
8cc7a90d7c
sum: fix crash on invalid inputs, move to clap, add tests ( #1952 )
2021-03-29 13:03:56 +02:00
Raymond Wang
ab5b6dd844
tr: move from getopts to claps #1929 ( #1954 )
2021-03-29 13:03:24 +02:00
Sylvestre Ledru
acb57ecbd0
Merge pull request #1955 from jhscheer/chmod2clap
...
chmod: move from getopts to clap
2021-03-29 13:02:13 +02:00
Dominik Bittner
3714e2201b
tty: Move from getopts to clap ( #1956 )
...
+ tty: Add some tests
2021-03-29 13:00:47 +02:00
Jan Scheer
a9a3794d5a
chmod: add tests
2021-03-28 20:56:37 +02:00
Craig Pastro
6d4f70ccb2
shuf: move from getopts to clap ( #1950 )
2021-03-28 15:08:37 +02:00
Jan Scheer
43c6a52b63
chmod: move from getopts to clap
2021-03-28 13:11:39 +02:00
k0ur0x
bcb1828ad6
comm: move from getopts to clap
2021-03-28 05:51:43 +04:30
Sylvestre Ledru
dc879634cb
Merge pull request #1839 from jhscheer/iss1769
...
rm: fix for -d to match GNU's output #1769
2021-03-27 22:56:16 +01:00
Ivan
500771c78d
tee: should match GNU's output if used with /dev/full ( #1944 )
...
+ aligned 'tee' output with GNU tee when one of the files is '/dev/full'
+ don't stop tee when one of the outputs fails; just continue and return
error status from tee in the end
Co-authored-by: Ivan Rymarchyk <irymarchyk@arlo.com>
2021-03-27 20:02:49 +01:00
Yagiz Degirmenci
f66a188414
mkfifo: general refactor, move to clap, add tests ( #1945 )
...
* mkfifo: general refactor, move to clap, add unimplemented flags
* chore: update Cargo.lock
* chore: delete unused variables, simplify multiple lines with crash
* test: add tests
* chore: revert the use of crash
* test: use even more invalid mod mode
2021-03-27 20:00:59 +01:00
Yagiz Degirmenci
0bdd61af5e
cksum: use clap for argument management ( #1943 )
2021-03-27 13:31:29 +01:00
Yagiz Degirmenci
ac7edcc4fa
ptx: delete getopts dependency ( #1942 )
...
* chore: delete getopts dependency
* deps: update Cargo.lock
2021-03-27 13:31:06 +01:00
Sylvestre Ledru
faef7e9214
fix(install): Unbreak the CI by bringing the old behavior for install of /dev/null
2021-03-27 10:08:06 +01:00
Antonio Gurgel
35675fdfe7
install: implement -C
/ --compare
( #1811 )
...
* install: implement `-C` / `--compare`
GNU coreutils [1] checks the following: whether
- either file is nonexistent,
- there's a sticky bit or set[ug]id bit in play,
- either file isn't a regular file,
- the sizes of both files mismatch,
- the destination file's owner differs from intended, or
- the contents of both files mismatch.
[1] https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/install.c?h=v8.32#n174
* Add test: non-regular files
* Forgot a #[test]
* Give up on non-regular file test
* `cargo fmt` install.rs
2021-03-27 09:18:47 +01:00
Rein F
3ca21940f8
nl: move from getopts to clap ( #1921 )
2021-03-27 08:55:31 +01:00
Terts Diepraam
955c547adf
ls: overrideable -n
option ( #1917 )
2021-03-26 19:12:01 +01:00
Yagiz Degirmenci
83f8140aaf
cat: move cat to clap ( #1910 )
2021-03-26 17:26:37 +01:00
Max Semenik
9e759267ee
pr: Remove commented out stuff from Cargo.toml
2021-03-26 18:19:52 +03:00
Max Semenik
bc2b385744
pr: Fix a bunch of Clippy problems
2021-03-26 17:57:21 +03:00
Max Semenik
62fe68850e
pr: Fixes after rebasing
...
Only the minimum needed to:
* Make everything compile without warnings
* Move files according to the new project structure
* Make tests pass
2021-03-26 17:57:19 +03:00
tilakpatidar
054c05d5d8
pr: refactor get_lines_for_printing, write_columns, recreate_arguments
...
pr: extract recreate_arguments
pr: refactor get_line_for_printing
pr: refactor get_lines_for_printing
pr: refactor fetch_indexes generate for write_columns
pr: refactor write_columns
pr: refactor write_columns
2021-03-26 14:11:15 +03:00
tilakpatidar
f87ada5a11
pr: refactor logic for -n <path>
2021-03-26 14:11:15 +03:00
tilakpatidar
a7def9386b
pr: refactor common iterator between pr and mpr
...
pr: refactor common iterator between pr and mpr
pr: remove fill lines in mpr
2021-03-26 14:11:15 +03:00
tilakpatidar
aefc2eb540
pr: reformat with rustfmt
...
pr: refactor batching of pages in pr
2021-03-26 14:11:15 +03:00
tilakpatidar
40e7f3d900
pr: add -J and -S option
...
pr: add -J option
pr: add -S option
2021-03-26 14:11:15 +03:00
tilakpatidar
a4b723233a
pr: add more tests for form feed and include page_width option W
2021-03-26 14:11:15 +03:00
tilakpatidar
4bf5b86cde
pr: add last page option in +page
2021-03-26 14:11:15 +03:00
tilakpatidar
3be5dc6923
pr: fix form feed
...
pr: fix form feed
pr: Rustfmt
pr: add test for ff and -l option
2021-03-26 14:11:15 +03:00
Tilak Patidar
8f9b322897
pr: fix file not found in pr and mpr
2021-03-26 14:11:15 +03:00
Tilak Patidar
87227addc1
pr: fix printing form feed
2021-03-26 14:11:14 +03:00
Tilak Patidar
847046f3de
pr: add +page and -column
2021-03-26 14:11:14 +03:00
Tilak Patidar
5c6c524334
pr: refactor and fmt fill_missing_lines and error checks
...
pr: Remove unwanted brancing in fill_missing_lines
pr: Remove unnecessary error check
pr: Rename key to group_key in FileLine
pr: Reformat test_pr with rustfmt
2021-03-26 14:11:14 +03:00
Tilak Patidar
5956894d00
pr: add -m and -o option
...
pr: Add -o option
2021-03-26 14:11:14 +03:00
Tilak Patidar
dd07aed4d1
pr: add column separator option
2021-03-26 14:11:14 +03:00
Tilak Patidar
f497fb9d88
pr: read from stdin
2021-03-26 14:11:14 +03:00
Tilak Patidar
d9084a7399
pr: implement across option and fix tests
2021-03-26 14:11:14 +03:00
Tilak Patidar
5705ed142f
pr: write pagination logic of reading file using iterators
2021-03-26 14:11:14 +03:00
Tilak Patidar
f3676573b5
pr: print padded string for each column and handle tab issues
...
pr: Print fixed padded string for each column
pr: Fix display length vs str length due to tabs
2021-03-26 14:11:14 +03:00
Tilak Patidar
b578bb6563
pr: add test for -t -l -r option
...
pr: Add test for -l option
pr: Add test for -r suppress error option
2021-03-26 14:11:14 +03:00
Tilak Patidar
b742230dbb
pr: fix page ranges
...
pr: Fix page ranges
2021-03-26 14:11:14 +03:00
Tilak Patidar
88ec02a61c
pr: add suport for -n [char][width] and -N
...
pr: Fix long name for -n
pr: Add -N first line number option
pr: Add -n[char][width] support
2021-03-26 14:11:14 +03:00
Tilak Patidar
afc58eb6ea
pr: add tests for -n -h -d option
...
pr: Add test for -h option
pr: Add test for -d option
2021-03-26 14:11:14 +03:00
tilakpatidar
64e2e1dbac
pr: remove parameter header and get_input_type
...
pr: Remove parameter header from build_options
pr: Remove unnecessary get_input_type
2021-03-26 14:11:14 +03:00
tilakpatidar
f799d22b7d
pr: add multi column printing
2021-03-26 14:11:14 +03:00
tilakpatidar
2897039000
pr: fix number of lines printed per page and short pages getting skipped
...
pr: Fix number of lines printed per page
pr: Fix first short page getting skipped due to page range
2021-03-26 14:11:14 +03:00
tilakpatidar
0098cfe5b7
pr: add ColumnModeOptions and fix reading of input after page range is finished
2021-03-26 14:11:14 +03:00
tilakpatidar
fd4447785b
pr: add -r option to suppress errors and -F to use form feed separator
...
pr: Add -F to print line feed character for page separator
2021-03-26 14:11:14 +03:00
tilakpatidar
9e023b8a91
pr: add -t option to not print header, trailer and -l to print line numbers
...
pr: Add -l option set number of lines
pr: Refactor opts
2021-03-26 14:11:14 +03:00
tilakpatidar
55043d7a15
pr: print only 28 lines if double spaced option is used
2021-03-26 14:11:14 +03:00
tilakpatidar
9a3c572de8
pr: add --page option
2021-03-26 14:11:14 +03:00
tilakpatidar
c58ee96abf
pr: add long names for -d and -h
2021-03-26 14:11:14 +03:00
tilakpatidar
420a066312
pr: add read buffer size and fix unused Result types
2021-03-26 14:11:14 +03:00
tilakpatidar
8c7cbf65a5
pr: throw error on reading from socket
2021-03-26 14:11:14 +03:00
tilakpatidar
1cf84a7305
pr: refactor option flags into constants
2021-03-26 14:11:14 +03:00
tilakpatidar
77d3d08f0b
pr: show current time for stdin input
2021-03-26 14:11:14 +03:00
tilakpatidar
781d77eb3c
pr: add support for -d option
2021-03-26 14:11:14 +03:00
tilakpatidar
2d609b2cd1
pr: add custom errors
...
pr: code refactoring for references
2021-03-26 14:11:14 +03:00
tilakpatidar
e69c9ada34
pr: read from stdin
2021-03-26 14:11:14 +03:00
tilakpatidar
7f87e42ad1
pr: add support for multiple files
2021-03-26 14:11:14 +03:00
tilakpatidar
9111f168aa
pr: add -h to print header and -n to print line numbers
...
pr: Add -h to print custom header instead of file name
pr: Add -n to print line numbers
2021-03-26 14:11:14 +03:00
tilakpatidar
2ee90ab09a
pr: print pr header with file last modified time, path and page number
2021-03-26 14:11:14 +03:00
tilakpatidar
2d58ea5f8b
pr: print 56 lines of content with 5 blank trailer and header lines
2021-03-26 14:11:14 +03:00
Max Semenik
035f811dd0
Fix "panic message is not a string literal" warnings ( #1915 )
...
New in Rust 1.51.
Closes #1914
2021-03-26 11:09:16 +01:00
Jan Scheer
aac79d13b3
Merge branch 'master' into iss1769
2021-03-25 23:23:08 +01:00
Jan Scheer
61eb4f250d
rm: add more tests
2021-03-25 23:04:02 +01:00
Terts Diepraam
23b70001a8
ls: version sort ( #1898 )
2021-03-25 20:24:53 +01:00
Sivachandran
52997b63fb
pathchk: move from getopts to clap ( #1897 )
2021-03-25 11:27:34 +01:00
Mekka
99da9ea6ec
Cleanup: Fix grammar in "cp" macro comments. ( #1905 )
...
Replaced "they if" with "if they" in the comments above the "prompt_yes" macro.
2021-03-25 10:36:48 +01:00
Yagiz Degirmenci
63317b3529
ptx: move from getopts to clap ( #1893 )
...
* ptx: move from getopts to clap
* chore: delete comment
* chore: fix some clippy warnings
2021-03-24 21:46:17 +01:00
Jan Scheer
bdf603a65e
rm: make -d/-r obligatory for removing symlink_dir (windows)
2021-03-24 12:42:23 +01:00
Kevin Burke
4873c8a24b
mv: ensure line prints ( #1890 )
...
Previously this used `print` instead of `println`, and as a result the
prompt would never appear and the command would hang. The Rust docs
note this about print:
> Note that stdout is frequently line-buffered by default so it may be
> necessary to use io::stdout().flush() to ensure the output is emitted
> immediately.
Changing to `println` fixes the issue.
Fixes #1889 .
Co-authored-by: Kevin Burke <kevin@burke.dev>
2021-03-23 21:49:35 +01:00
Alessandro Stoltenberg
b54f0b1ff2
echo: Refactored help message. ( #1886 )
2021-03-23 11:55:18 +01:00
Yagiz Degirmenci
545fe7d887
feat(unexpand): move from getopts to clap ( #1883 )
...
* feat: move unexpand to clap
* chore: allow muliple files
* test: add test fixture, test reading from a file
* test: fix typo on file name, add test for multiple inputs
* chore: use 'success()' instead of asserting
* chore: delete unused variables
* chore: use help instead of long_help, break long line
2021-03-23 09:42:05 +01:00
Yagiz Degirmenci
5e2e2e8ab6
echo: allow leading hyphens ( #1887 )
...
* fix: use settings to allow leading hyphen and trailing var arg
fixes: https://github.com/uutils/coreutils/issues/1873
* test: add test cases
* test: add more test cases with different order in hyphen values
* chore: add comment to explain why we need TrailingVarArg
2021-03-23 09:40:05 +01:00
Yagiz Degirmenci
e5ef7486d5
feat: move echo to clap ( #1884 )
2021-03-22 22:42:14 +01:00
Neculai Balaban
a1b50ae0f4
nohup: move from getopts to clap ( #1871 )
...
- changed some error return codes to match GNU implementation
- changed warning/error messages to match GNU nohup
- replaced getopts dependency with clap
- added a test
2021-03-22 20:09:00 +01:00
Yagiz Degirmenci
20dec4cbba
fix: fix clippy warnings ( #1876 )
2021-03-22 20:08:07 +01:00
Terts Diepraam
de3f9b8186
ls: across & commas formats and width parameter ( #1869 )
2021-03-22 18:24:23 +01:00
Yagiz Degirmenci
d86ee34bc6
tsort: move from getopts to clap ( #1867 )
2021-03-22 18:16:28 +01:00
Sylvestre Ledru
f593cf53b2
Merge pull request #1870 from nomius10/document_macros
...
documentation for usual macros
2021-03-22 11:59:11 +01:00
Neculai Balaban
93c7cbe65e
documentation for usual macros
...
- removed repeat_str helper as it's now part of std
- added docstrings for usual macros and test utils
2021-03-22 12:13:38 +02:00
Yagiz Degirmenci
27b7552ef4
fix(tail): add support for negative indexing ( #1865 )
...
closes: https://github.com/uutils/coreutils/issues/1860
2021-03-22 10:01:54 +01:00
Sylvestre Ledru
21be280c5a
rustfmt the od changes
2021-03-21 22:22:21 +01:00
Yagiz Degirmenci
6c98415340
fix(head): check the whether file exists before unwrap ( #1858 )
...
closes https://github.com/uutils/coreutils/issues/1800
2021-03-21 21:27:44 +01:00
pedrohjordao
ca8fbc37bf
od: Changes command line parser to clap ( #1849 )
2021-03-21 16:19:30 +01:00
Yagiz Degirmenci
f60790dd41
chroot: move to clap from getopts ( #1792 )
...
+ add tests
2021-03-21 16:18:47 +01:00
Terts Diepraam
25d4a08387
ls: long format author, group and owner ( #1850 )
...
This PR adds the options to customize what information is shown in long format regarding author, group & owner. Specifically it adds:
- `--author`: shows the author, which is always the same as the owner. GNU has this feature because GNU/Hurd supports a difference between author and owner, but I don't think Rust supports GNU/Hurd, so I just used the owner.
- `-G` & `--no-group`: hide the group information.
- `-o`: hide the group and use long format (equivalent to `-lG`).
- `-g`: hide the owner and use long format.
The `-o` and `-g` options have some interesting behaviour that I had to account for. Some examples:
- `-og` hides both group and owner.
- `-ol` still hides the group. Same behaviour with variations such as `-o --format=long`, `-gl`, `-g --format=long` and `-ogl`.
- They even retain some information when overridden by another format: `-oCl` (or `-o --format=vertical --format=long`) still hides the group.
My previous solution for handling the behaviour where `-l1` shows the long format did not fit with these additions, so I had to rewrite that as well.
The tests only cover the how many names (author, group and owner) are present in the output, so it can't distinguish between, for example, author & group and group & owner.
2021-03-21 16:18:06 +01:00
Sylvestre Ledru
45acb087b8
Merge pull request #1848 from nomius10/install_bugfix
...
install: fix bug #1823
2021-03-20 20:53:57 +01:00
Neculai Balaban
f8125a1040
install: match GNU warning output
2021-03-20 16:11:29 +02:00
Neculai Balaban
0f7423dfa6
install: fix bug #1823
2021-03-20 14:49:22 +02:00
nicoo
8b9ac0c7c3
Revert #1571 “perf/factor ~ deduplicate divisors” ( #1842 )
...
It was a draft PR, not ready for merging, and its premature inclusion
caused repeated issues, see 368f47381b
& friends.
Close #1841 .
This reverts commits 3743a3e1e7
,
ce218e01b6
, and
b7b0c76b8e
.
2021-03-20 11:46:58 +01:00
Alex Lyon
e9adc5067b
cksum: generate CRC table in a const fn ( #1744 )
2021-03-20 10:33:04 +01:00
Jan Scheer
0e217e202a
tee: move from getopts to clap ( #1814 )
2021-03-19 22:58:50 +01:00
Sylvestre Ledru
e76ce1e908
Merge pull request #1844 from tertsdiepraam/ls/si
...
ls: --si flag and more compatible size formatting
2021-03-19 21:18:25 +01:00
Neculai Balaban
c6927d97c8
cp: add support for -x/--one-file-system ( #1840 )
2021-03-19 21:15:35 +01:00
Terts Diepraam
118b802fe8
ls: --si and more compatible size formatting
2021-03-19 15:14:25 +01:00
Sylvestre Ledru
976fa95ce8
fix(ls): fix a clippy warning
...
"this `if` has identical blocks"
2021-03-19 14:25:07 +01:00
Sylvestre Ledru
e521b46c09
Merge pull request #1820 from tertsdiepraam/master
...
ls: move from getopts to clap and structure configuration
2021-03-19 09:55:27 +01:00
Marco Satti
5ec87dc70a
date: Implement setting the date on Unix & Windows ( #1798 )
...
* date: implement set date for unix and windows
Parsing the date string is not fully implemented yet, as in it relies
on the internals of chrono - things like "Mon, 14 Aug 2006 02:34:56 -0600"
do not work, nor does "2006-08-14 02:34:56" (no TZ / local time). This
is no different to using the "--date" option however, and will get fixed
when `parse_date` is a bit smarter.
Only supports unix and Windows platforms for now.
2021-03-19 09:54:01 +01:00
Sylvestre Ledru
fcccc2a973
Merge pull request #1826 from pfnsec/master
...
head: add support for -z/--zero-terminated
2021-03-18 21:37:12 +01:00
Jan Scheer
58b9372dbe
rm: fix for -d to match GNU's output #1769
2021-03-18 14:46:56 +01:00
Sylvestre Ledru
22e22bc074
Merge pull request #1835 from aspenluxxxy/update-nix
...
Update nix to 0.13 in uu_more
2021-03-18 14:37:54 +01:00
aspen
4e29b693f8
uutils: change every target_os = "macos"
to target_vendor = "apple"
2021-03-18 08:42:53 -04:00
aspen
ed7e24c5b0
uu_more: update nix to 0.13
2021-03-18 08:39:06 -04:00
Sylvestre Ledru
99be7a3172
Merge pull request #1810 from jeckersb/nice-clap
...
nice: move from getopts to clap #1794
2021-03-17 22:03:42 +01:00
Sylvestre Ledru
44a7adc9a0
Merge pull request #1812 from konomith/feature/preserve_timestamps_#1758
...
install: Implement --preserve-timestamps (-p)
2021-03-17 22:02:54 +01:00
Sylvestre Ledru
a690ffde41
Merge pull request #1821 from deantvv/expand-clap
...
expand: replace getopts with clap
2021-03-17 22:01:31 +01:00
Sylvestre Ledru
6a109a5069
Merge pull request #1834 from jhscheer/patch-3
...
rm: add an additional flag -R for --recursive
2021-03-17 21:52:02 +01:00
Sylvestre Ledru
ba55ef166e
Merge pull request #1827 from drocco007/numfmt-delimiter
...
numfmt: implement --delimiter
2021-03-17 21:50:47 +01:00
Jan Scheer
d9adec3496
add comment
2021-03-17 14:46:25 +01:00
nicoo
955fa74a42
factor::tests: Check that powers of known-factorization numbers are factored correctly ( #1831 )
...
* factor::tests::recombines_factors: Minor refactor (skip useless bool)
* factor::tests: Check factorizations of powers of factored numbers
* factor::Factors: Add debug assertions to (Factor ^ Exponent)
* factor::tests: Drop obsoleted tests
`factor_correctly_recombines_prior_test_failures` was replaced with
`factor_2044854919485649` as this was the only test not subsumed.
* factor::tests::2044854919485649: Check the expected factorisation
2021-03-17 13:58:53 +01:00
John Eckersberg
64b8c8aac7
nice: move from getopts to clap #1794
2021-03-17 08:52:13 -04:00
Daniel Rocco
fbb9c50050
tr: process octal escape sequences
...
closes #1817
2021-03-17 08:04:45 -04:00
Jan Scheer
97f40b0aee
rm: add an additional flag -R for --recursive
...
make clap support -R in addition to -r
2021-03-17 10:16:31 +01:00
Peter Sherman
e3e5bf0178
Format head.rs
2021-03-15 20:48:49 +00:00
Peter Sherman
13e61c3234
head: add support for -z/--zero-terminated
2021-03-15 15:56:11 +00:00
Daniel Rocco
52f2ab6898
numfmt: implement --delimiter
...
closes #1454
2021-03-15 11:55:56 -04:00
Daniel Rocco
02e9ffecdd
numfmt: split implementation into modules
2021-03-15 11:55:17 -04:00
Hari
406cd865eb
install: run rustfmt
...
Fix formatting issues based on PR review comments
2021-03-15 11:00:30 -04:00
Dean Li
cd775ed704
Expand: use mod::options
2021-03-15 21:28:47 +08:00
Chirag Jadwani
116e253cc0
uniq: Fix skip fields
...
Current implementation of the skip fields logic does not handle
multibyte code points correctly. It assumes each code point (`char`) is
one byte. If the skipped part of the input line has any multibyte code
points then this can cause fields not being skipped correctly (field
start index is calculated to be before it actually starts).
2021-03-15 18:48:54 +05:30
Chirag Jadwani
ce4342d12e
uniq: Fix panic on invalid utf-8 input
2021-03-15 18:48:54 +05:30
Terts Diepraam
10135dccef
ls: fix unused import and improve coverage
2021-03-15 13:46:21 +01:00
Terts Diepraam
20094127c3
ls: --color back on windows as noop
2021-03-15 12:21:08 +01:00
Terts Diepraam
f28d5f4a73
ls: attempt to fix windows sorting issues
2021-03-15 12:07:10 +01:00
Terts Diepraam
a4c79c92ae
ls: fix windows issues
2021-03-15 10:24:24 +01:00
Terts Diepraam
01fd207c81
ls: remove list of missing features
2021-03-15 09:53:19 +01:00
Terts Diepraam
5656a717c9
ls: make name sort case insensitive
2021-03-15 09:31:13 +01:00
Terts Diepraam
61a95239ce
ls: rename display to format, set arg overrides
2021-03-15 09:30:50 +01:00
Terts Diepraam
7bde2e78a9
ls: simplify --color and remove it on windows
2021-03-14 23:34:52 +01:00
Terts Diepraam
c86c18cbb5
ls: implement -c and -u
2021-03-14 23:11:11 +01:00
Terts Diepraam
c454d2640c
ls: structure options some more
2021-03-14 21:32:21 +01:00
Terts Diepraam
5d7a851471
ls: fix --color behaviour
2021-03-14 21:30:21 +01:00
Sylvestre Ledru
10d55c5696
Merge pull request #1796 from ttrunck/fix-busytest
...
Fix `make busytest`
2021-03-14 20:58:05 +01:00
Dean Li
6829e7f359
expand: replace getopts with clap
...
expand has one odd behavior that allows two format for tabstop
From expand --help
```
-t, --tabs=N have tabs N characters apart, not 8
-t, --tabs=LIST use comma separated list of tab positions
```
This patch use one `value_name("N, LIST")` for tabstop and
deal with above behavior in `parse_tabstop`.
Close #1795
2021-03-14 20:47:53 +08:00
Terts Diepraam
0717a5f301
ls: formatting
2021-03-14 13:32:15 +01:00
Terts Diepraam
8df239a4e2
Merge branch 'master' of github.com:tertsdiepraam/coreutils
2021-03-14 12:22:38 +01:00
Terts Diepraam
7c8e8b2d4c
ls: refactor arguments into a config struct
2021-03-14 12:22:32 +01:00
Terts Diepraam
225c1be28d
Merge pull request #1 from uutils/master
...
Sync
2021-03-13 23:52:42 +01:00
Terts Diepraam
9e98d24f5f
ls: move from getopts to clap
2021-03-13 23:43:36 +01:00
Andre Julius
2158b2c5b4
sleep: move from getopts to clap #1735 ( #1777 )
...
and Add some sleep test cases #1735
2021-03-13 23:11:11 +01:00
Terts Diepraam
fd5ec099d0
touch: use an ArgGroup for sources and turn macros into functions ( #1813 )
...
* touch: use arggroup for sources
* tests/touch: add tests for multiple sources
* touch: turn macros into functions
* test/touch: fmt
* touch: constant for the sources ArgGroup
2021-03-13 17:20:39 +01:00
Terts Diepraam
44c390c290
touch: constant for the sources ArgGroup
2021-03-13 13:52:08 +01:00
Terts Diepraam
86422a70d2
touch: turn macros into functions
2021-03-13 12:47:20 +01:00
Terts Diepraam
5ec1bba5e8
touch: use arggroup for sources
2021-03-13 12:42:52 +01:00
Hari
8471088d6d
Merge branch 'master' of github.com:uutils/coreutils into feature/preserve_timestamps_#1758
2021-03-12 17:47:02 -05:00
Hari
68ec2ed0f3
install: Implement --preserve-timestamps (-p)
...
Last access and last modify timestamps are extracted from the
existing file metadata and are applied to the newly created file.
2021-03-12 16:51:47 -05:00
Michael Kefeder
e1626b8c64
ptx: ignore empty regex ( #1808 )
...
* ptx: ignore empty -W regex
* ptx: test to verify empty -W regex is ignored
* tests/ptx: verify word regexp from cmd-line is used
2021-03-12 21:52:37 +01:00
Ali
5ced3a670b
paste: cleanup multi-stdin support ( #1803 )
...
cleaner impl for multi-stdin support
2021-03-12 13:26:09 +01:00
Craig Pastro
3ab114f283
cp: Implement --parents & --parent ( #1797 )
2021-03-12 13:25:15 +01:00
Theophile Trunck
8bafcbab7a
Update the binary usage to match busybox
...
New tests in busybox are based on the fact that the function
appears in the usage of the busybox binary.
Because the tests are searching for an exact string they don't see
the function defined by coreutils.
By using the exact same string as busybox we can now also run the new
busybox tests
2021-03-10 23:52:33 +01:00
Ali
374a4fde86
paste: support multi-stdin ( #1791 )
...
- added `-` as the default input, since `paste` reads stdin if no file
is provided
- `paste` also supports providing `-` multiple times
- added a test for it
2021-03-10 23:19:12 +01:00
Mikadore
734ef0a8a1
uniq: fixed #550 ( #1790 )
2021-03-10 21:54:31 +01:00
John Eckersberg
08eb56f120
Fix some clippy warnings
2021-03-10 08:42:00 -05:00
Sylvestre Ledru
517b2a6a22
Merge pull request #1767 from FelipeLema/mod_opt
...
Group OPT_ARGUMENTS into mods
2021-03-09 22:57:30 +01:00
Sylvestre Ledru
955b7ee6d5
Merge pull request #1785 from ali5h/paste-clap
...
paste: move from getopts to clap
2021-03-09 22:52:16 +01:00
Felipe Lema
d1addc97cc
missing OPT_ s
2021-03-09 18:10:04 -03:00
Ali Shariat
54eebebff8
paste: move from getopts to clap
...
closes #1734
2021-03-09 12:46:27 -08:00
Sylvestre Ledru
a96ca1359e
Merge pull request #1772 from foxbenjaminfox/master
...
cp: implement --strip-trailing-slashes
2021-03-09 20:10:06 +01:00
Edward Betts
e1a9c19b6f
Correct spelling
2021-03-09 15:19:35 +00:00
Benjamin Fox
5446ea2abf
cp: implement --strip-trailing-slashes
2021-03-09 12:59:26 +02:00
Daniel Rocco
0e02607dc7
numfmt: implement --field
2021-03-08 10:53:34 -05:00
Felipe Lema
75b3bc02eb
uniq
2021-03-08 12:02:46 -03:00
Felipe Lema
3e0a10d732
update wc
2021-03-08 11:50:26 -03:00
Sylvestre Ledru
6ad8528b99
update of the uucore dep to 0.0.7
2021-03-07 11:29:38 +01:00
Sylvestre Ledru
8772d81236
Update to platform-info 0.1
2021-03-07 11:29:38 +01:00
Sylvestre Ledru
6481c5a247
Prepare version 0.0.4
2021-03-07 11:29:38 +01:00
Chad Brewbaker
c820329efd
muted test not for windows and added windows temp file convention ( #1748 )
...
* muted test not for windows and added windows temp file convention
* Update mktemp.rs
Revert windows mktmp template difference
Co-authored-by: Chad Brewbaker <chad@flyingdogsolutions.com>
2021-03-06 18:26:55 +01:00
Daniel Rocco
d06f91fbe2
numfmt: align format output values with GNU ( #1745 )
...
When converting to SI or IEC, produce values that align with the conventions
used by GNU numfmt.
- values > 10 are represented without a decimal place, so 10000 becomes 10K
instead of 10.0K
- when truncating, take the ceiling of the value, so 100001 becomes 101K
- values < 10 are truncated to the highest tenth, so 1001 becomes 1.1K
closes #1726
2021-03-06 18:26:05 +01:00
Felipe Lema
e4d9d1868a
remove markers
...
this can be improved in the future. this branch is just the kick-off
2021-03-04 15:38:01 -03:00
Felipe Lema
975e9ea565
separate options into modules for chown
2021-03-04 15:37:27 -03:00
Sylvestre Ledru
c06967a45a
rustfmt two files
2021-02-23 20:56:41 +01:00
Alex Lyon
5935876f38
od: remove Vec::set_len() usage in InputDecoder ( #1739 )
2021-02-23 12:35:17 +01:00
Alex Lyon
7341a1a033
shred: remove usage of Vec::set_len() ( #1738 )
...
* shred: use a fixed-size array for BytesGenerator
2021-02-23 12:34:49 +01:00
Chad Brewbaker
bb54669a5d
Fix macOS aarch64 compile errors ( #1724 )
2021-02-23 10:25:06 +01:00
Alex Lyon
5431e947bc
uucore: process: fix exit status processing ( #1743 )
...
* uucore: process: fix exit status processing
* tests: timeout: check whether subcommand exit codes are returned
2021-02-23 10:21:01 +01:00
Alex Lyon
7e5d9ee32d
factor, stdbuf, timeout, uname, uptime: update dependencies ( #1746 )
2021-02-22 15:07:51 +01:00
Alex Lyon
c8977a78a4
uucore: fix potential use-after-free in utmpx iterator ( #1737 )
2021-02-19 08:38:57 +01:00
Alex Lyon
15eaaa9473
Merge pull request #1731 from jaggededgedjustice/seq-check-for-zero-step
...
Do not allow seq to run with an increment of zero
2021-02-18 18:28:35 -08:00
James Robson
0dbed0fd59
Do not allow seq to run with an increment of zero
2021-02-18 21:10:53 +00:00
Sylvestre Ledru
4bdd7a5e42
trivial(truncate): remove old comments
2021-02-18 22:05:11 +01:00
Alex Lyon
39d62c6c1f
od: remove potential unsoundness and an allocation in PartialReader ( #1730 )
2021-02-18 08:23:13 +01:00
Daniel Rocco
e2b58051e6
yes: correct a typo ( #1727 )
...
Improve readability by fixing an inadvertent rename during a performance
enhancement (b46e228
).
2021-02-16 23:40:23 +01:00
Daniel Rocco
f595164063
numfmt: prohibit --header=0 to align with GNU
...
Adjust header option handling to prohibit passing a value of 0 to align
with GNU numfmt. Also report header option parse errors as GNU does.
closes #1708
2021-02-15 08:14:44 +01:00
Daniel Rocco
f8006f47df
numfmt: handle leading whitespace & implied padding ( #1721 )
...
Align with GNU numfmt by trimming leading whitespace from supplied values.
If the user did not specify a padding, calculate an implied padding from
the leading whitespace and the value.
Also track closer to GNU numfmt’s error message format.
2021-02-14 09:04:29 +01:00
Sylvestre Ledru
bd6b958655
Moved to atty
2021-02-12 11:37:32 +01:00
Kevin Burke
26aa1f346e
ls: only print colors if stdout is a tty
...
Previously if no --color argument was input, we would always print
colors in the output. This breaks `configure` scripts which run `ls`
and then compare the output against what they expect to see, since the
left side has ANSI escape sequences and the right side doesn't.
Instead, only print escape sequences if a TTY is present, or if
`--color=always` is specified.
Fixes #1638 .
2021-02-12 11:37:32 +01:00
Daniel Rocco
9081e120d6
numfmt: replace getopts with clap ( #1717 )
2021-02-11 23:58:26 +01:00
Felipe Lema
35a7f01d15
Refactor(split) - migrate from getopts to clap ( #1712 )
2021-02-11 20:45:23 +01:00
Sylvestre Ledru
51383e10e6
Fix: install /dev/null target ( #1646 )
...
* fix(install): workaround the /dev/null bug
Caused by a limitation of fs::copy in rust. see:
https://github.com/rust-lang/rust/issues/79390
2021-02-11 15:59:58 +01:00
Sylvestre Ledru
6c8af26e7f
fix(cp) - make "cp /dev/null target" work ( #1674 )
2021-02-11 15:59:20 +01:00
Sylvestre Ledru
b8987f3d5f
fix(mktemp) - Make mktemp --tempdir foo.XXXXXX works ( #1716 )
...
Used by apt-key
2021-02-11 00:03:23 +01:00
Chad Brewbaker
6c2bca110d
Fixed wc -L no end of line LF bug ( #1714 )
2021-02-08 21:54:48 +01:00
Sylvestre Ledru
beda329a21
Fix some clippy warnings
2021-02-07 15:12:15 +01:00
Sylvestre Ledru
2bb9a85dde
bug(tee) - needs libc from uucore
2021-02-02 09:23:01 +01:00
Sylvestre Ledru
858ea108ce
bug(ln) - needs fs from uucore too
2021-02-02 00:18:46 +01:00
Sylvestre Ledru
d7a6bfa76c
bug(install) - needs entries from uucore too
2021-02-02 00:09:25 +01:00
Sylvestre Ledru
262b508b89
update the dep to uucore 0.0.6
2021-02-01 23:55:43 +01:00
Sylvestre Ledru
87428b9c32
update uucore to 0.0.6
2021-02-01 23:53:17 +01:00
Sylvestre Ledru
f0b302d716
refactor(fmt) move to clap
2021-01-25 21:48:52 +01:00
Sylvestre Ledru
cacaf0cde8
bug(fmt): just like the GNU version, fails when -W is bigger than 2500
...
Closes : #1704
2021-01-25 08:45:33 +01:00
Sylvestre Ledru
992c113f09
Remove some old code
2021-01-22 09:40:38 +01:00
Sylvestre Ledru
a807fc623a
Update to version 0.0.3
2021-01-22 09:40:38 +01:00
nicoo
ea20b22d12
factor::numeric::gcd: Refactor divisor
test
...
Should be clearer; does not handle the `gcd(0, 0)` case, which is already
covered by the `zero` test.
2021-01-21 15:28:28 +01:00
nicoo
42b048d316
factor: Get rid of the custom OverflowingAdd
trait ( #1697 )
...
* factor: Confine knowledge of num_traits to numeric::traits
This should make it easier to deal with API changes of num_traits,
or eventually switching to an abstraction provided in the stdlib.
2021-01-21 15:27:22 +01:00
Sylvestre Ledru
9f7259b986
refactor(realpath): move to clap
2021-01-19 20:56:27 +01:00
Sylvestre Ledru
e331186fee
unbreak build with rustc 1.32: force tempfile 3.1.0 ( #1695 )
2021-01-19 08:15:53 +01:00
Sylvestre Ledru
013bb285cd
bug(chmod): chmod on symlink pointing to non existing file is failing ( #1694 )
2021-01-18 23:09:00 +01:00
Felipe Lema
88911be6e0
--filter
argument for split
(#1681 )
2021-01-18 14:42:44 +01:00
Gaurang Tandon
ac7cac2910
tail: moving to clap from getopt ( #1689 )
2021-01-12 17:44:11 +01:00
Sylvestre Ledru
04b92f3e94
Replaces failure by thiserror. ( #1688 )
...
Failure isn't maintained anymore:
https://github.com/rust-lang-nursery/failure/pull/347
https://rustsec.org/advisories/RUSTSEC-2020-0036.html
2021-01-11 22:01:14 +01:00
Sylvestre Ledru
b8e886ad1a
bump the minimal version of uucore & uucore_procs
2021-01-10 18:27:20 +01:00
Sylvestre Ledru
57e24c9118
also update uucore & uucore_procs versions to 0.0.5
2021-01-10 18:24:43 +01:00
Sylvestre Ledru
d9ae043a05
update of the version 0.0.1 => 0.0.2 ( #1686 )
2021-01-10 18:16:04 +01:00
Sylvestre Ledru
d9580c2f3a
ls: move from isatty (deprecated) to atty ( #1685 )
2021-01-09 21:21:02 +01:00
jaggededgedjustice
18c39daed7
fold: Handle input with newlines ( #1680 )
...
The read_line function appends to the given buffer which is never
cleared. This leads to lines being duplicated.
2021-01-05 09:10:01 +01:00
Sylvestre Ledru
4a23a1a218
feature(ln): Implement -n
2021-01-03 18:55:53 +01:00
Sylvestre Ledru
7f1d47b77a
refactor(ln): move to clap
2021-01-02 22:35:21 +01:00
Sylvestre Ledru
105e2cb26f
feature(mktemp): implement -t
...
Deprecated but used in various places:
https://sources.debian.org/src/libreoffice/1:7.0.4-1/solenv/gbuild/platform/solaris.mk/?hl=22#L22
https://sources.debian.org/src/glibc/2.31-6/malloc/memusage.sh/?hl=225#L225
https://sources.debian.org/src/sbox-dtc/1.11.7-1/debian/postinst/?hl=20#L20
2021-01-02 13:07:27 +01:00
Sylvestre Ledru
66b503a77e
refactor(mktemp): move to clap
2021-01-02 09:40:40 +01:00
Sylvestre Ledru
7942a64231
Remove 'extern crate'
...
Not necessary anymore. See:
https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html#no-more-extern-crate
2020-12-31 15:44:00 +01:00
Sylvestre Ledru
bc4c82b132
Fix some clippy warnings
2020-12-29 00:47:59 +01:00
Sylvestre Ledru
7955d346a8
csplit - rustfmt
2020-12-28 17:22:46 +01:00
Sylvestre Ledru
3a1eb1e05f
Various fixes before landing csplit
2020-12-28 17:22:02 +01:00
Stéphane Campinas
89bf7a726e
csplit: refresh of the previous PR
2020-12-28 17:21:29 +01:00
Kevin Burke
10cd480a01
rm: allow "-f" to be specified multiple times ( #1667 )
...
This matches the behavior of GNU rm.
Fixes #1663 .
Co-authored-by: Kevin Burke <kevin@burke.dev>
2020-12-25 12:41:48 +01:00
Sylvestre Ledru
36d903e611
number-prefix: Move from 0.2 to 0.4 ( #1670 )
2020-12-22 13:53:20 +01:00
Diego Magdaleno
8b12686888
ls: On Windows don't display files hidden by NTFS ( #1662 )
...
This little check, allows us to hide the files that
shouldn't be shown on the listing on Windows operating
systems.
Just like the "dot" in UNIX based operating systems
Windows uses its own file attributes to determine if a file
is hidden or not.
The lack of support for this option is normally an annoyance
for many users, this commit adds full support for this feature
2020-12-19 17:54:28 +01:00
Sylvestre Ledru
469abf2427
bug(seq) - Allow 'seq 6 -1 0'
...
Was failing with
```
Found argument '-1' which wasn't expected, or isn't valid in this context
```
otherwise
2020-12-19 11:55:43 +01:00
Sylvestre Ledru
dbc716546b
fix(mkdir) - Add --parent as alias of --parents
...
It is used this way sometimes:
https://sources.debian.org/src/php-symfony-polyfill/1.21.0-2/debian/rules/?hl=49#L49
https://sources.debian.org/src/firebird3.0/3.0.7.33374.ds4-1/debian/functions.sh/?hl=24#L24
https://sources.debian.org/src/postfix/3.5.6-1/debian/configure-instance.sh/?hl=67#L67
2020-12-18 14:41:59 +01:00
Sylvestre Ledru
718695d541
fix(install) - Install was failing with '-m 0333'
...
The parse_numeric was getting ' 0333' as input
and showing 'mode is too large ( 0333 > 7777) as error
Syntax used: https://sources.debian.org/src/firebird3.0/3.0.7.33374.ds4-1/debian/functions.sh/?hl=145#L145
2020-12-18 13:36:55 +01:00
Sylvestre Ledru
c506b5402b
fix clippy warnings
2020-12-17 21:34:10 +01:00
Sylvestre Ledru
5a62dcafaa
bug(cp): like gnu/cp, don't show any message when --no-clobber is used
...
Simple example:
touch bar
rm -rf /tmp/foo
mkdir -p /tmp/foo
cp -pnL -v bar /tmp/foo
echo $?
cp -pnL -v bar /tmp/foo
echo $?
rm -rf /tmp/foo
mkdir -p /tmp/foo
./target/debug/coreutils cp -pnL -v bar /tmp/foo
echo $?
./target/debug/coreutils cp -pnL bar /tmp/foo
echo $?
2020-12-17 20:50:38 +01:00
Sylvestre Ledru
1e9820a7c4
Merge pull request #1659 from sylvestre/base-non-utf8
...
base32/base64: tolerate non-utf8 encoded inputs
2020-12-16 08:46:48 +01:00
Gabriel Ganne
607b70a896
base32/base64: tolerate non-utf8 encoded inputs
...
For inputs that are valid base64 but that encode non-utf8 strings (like
garbage), base64 panicks when trying to unwrap the result from
String::from_utf8().
Instead of interpreting the byte stream as utf8, simply dump the raw
bytes to stdout.
Since the test assert that all io is valid utf8, this does not come with
a unit test. See run() in tests/common/utils.rs.
Eg.
"gD63hSj3ScS+wuOeGrubXlq35N1c5Lby/S+T7MNTjxo=" -> ">(Iľ^Z\/S"
2020-12-16 00:14:18 +01:00
Hiroki Noda
2916e8d811
tee: implement ignore-interrupts option
2020-12-15 23:50:43 +01:00
Sylvestre Ledru
d9cf0374be
fix(sync) - Remove 'unused import' on mac
2020-12-13 18:02:33 +01:00
Sylvestre Ledru
ba126afe54
fix(ls): follow the display of GNU ls
2020-12-13 12:12:19 +01:00
Sylvestre Ledru
8a1628cf89
fix(ls): When a file doesn't exist, exit early and fails ls
...
Currently, running
$ ls doesntexist
will return 0
while it should return 1
Ditto for
$ ls doesntexist a
2020-12-13 12:12:19 +01:00
Sylvestre Ledru
f287309b72
perms: add some docs
2020-12-12 14:43:56 +01:00
Sylvestre Ledru
dca1f28085
install: various improvements in output & tests
2020-12-12 14:36:23 +01:00
Sylvestre Ledru
3024ade071
refactor(chgrp, install): Show the error in the program instead of the lib
2020-12-12 14:28:50 +01:00
Sylvestre Ledru
55c660b986
feature(install): move chown functions into uucore and have install owner support use it
2020-12-12 14:27:59 +01:00
Sylvestre Ledru
015e18731f
feature(install): install group support
2020-12-12 14:27:03 +01:00
Sylvestre Ledru
763de90fda
refactor(chgrp): move chgrp perms function into the uucore to reuse it into install
...
Will move chown later
2020-12-12 14:26:32 +01:00
Sylvestre Ledru
431a4e9f2f
cosmetic: consistency in the clap cargo declaration
2020-12-12 13:12:13 +01:00
Sylvestre Ledru
e19010e9fe
cosmetic: consistency in the walkdir cargo declaration
2020-12-12 13:10:57 +01:00
Sylvestre Ledru
d8e345df0a
refactor(whoami): only use advapi32/winapi on Windows ( #1653 )
2020-12-12 11:04:39 +01:00
Sylvestre Ledru
576aa29f0f
refactor(chmod): move from walker to walkdir, simplify the code and add tests ( #1645 )
2020-12-12 10:31:12 +01:00
Sylvestre Ledru
49b32ea68d
refactor(chown): move to clap & add tests ( #1648 )
2020-12-12 00:14:00 +01:00
Sylvestre Ledru
068fee2ebd
feature(uname): Implement -p & -i ( #1649 )
...
Just return 'unknown' for both
Closes : #1636
2020-12-11 22:46:36 +01:00
Sylvestre Ledru
516839e081
refactor(mv): move to clap ( #1652 )
2020-12-10 22:28:17 +01:00
Piyush Jaipuriayar
3ca8ba997c
hashsum: added blake2 as a hashing algorithm ( #1651 )
2020-12-08 23:32:02 +01:00
Sylvestre Ledru
d21acc4621
cosmetic(cp): use the variable instead of the string
2020-12-08 23:19:51 +01:00
Sylvestre Ledru
0cfb83a040
Merge pull request #1580 from sylvestre/archive3
...
feature(cp): implement archive & -L
2020-12-06 17:15:56 +01:00
Sylvestre Ledru
5f47d1249d
use the same version of clap everywhere
2020-12-01 22:59:14 +01:00
Sylvestre Ledru
c483fa501b
feature(cp): also implement --dereference/-L
2020-11-29 20:48:29 +01:00
Sylvestre Ledru
f76a0ec972
feature(cp): implement archive + add missing tests
2020-11-29 20:48:23 +01:00
Sylvestre Ledru
b07f496b70
fix(install): 'install file_a file_b' should just copy the file
2020-11-29 16:33:46 +01:00
Sylvestre Ledru
261b4e24d6
feature(install): remove a duplicate check.
...
Already done in is_new_file_path
2020-11-29 16:33:46 +01:00
Sylvestre Ledru
11ecf80a25
feature(sync): add --data & --file-system ( #1639 )
2020-11-29 16:32:21 +01:00
Sylvestre Ledru
89f8624936
bug(install) - install -d can be run on an existing directory ( #1643 )
...
GNU:
$ install -d foo
$ install -d foo
Rust:
$ install -d foo
$ install -d foo
install: cannot create directory 'foo': File exists
install: foo: File exists (os error 17)
2020-11-29 16:31:26 +01:00
Sylvestre Ledru
8ef7f394c1
address some new clippy warnings ( #1642 )
2020-11-29 16:26:38 +01:00
Sylvestre Ledru
adc9b12f32
install: fix a typo
2020-11-25 13:09:28 +01:00
Sylvestre Ledru
bfba889f8e
refactor(touch): Move to clap + add a test ( #1629 )
2020-11-21 09:53:13 +01:00
Sylvestre Ledru
5efaa0bf32
refactor(id) - move to clap and add more tests ( #1628 )
2020-11-21 09:52:50 +01:00
Sylvestre Ledru
41ba5ed913
refactor(uniq): Move to clap + add a test ( #1626 )
2020-11-21 09:52:40 +01:00
Sylvestre Ledru
7bbb4c98e8
Merge pull request #1623 from sylvestre/clap-pwd
...
refactor(pwd): move to clap + add a test
2020-11-21 00:49:30 +01:00
Sylvestre Ledru
6870d81b33
Merge pull request #1631 from sylvestre/clap-version
...
Remove version mgmt, it is done by clap
2020-11-20 10:02:33 +01:00
Sylvestre Ledru
6fc4129daf
Merge pull request #1624 from sylvestre/uptime-refresh
...
refactor(uptime): some minor improvements
2020-11-20 10:02:13 +01:00
Sylvestre Ledru
641aba5bd7
maint/hostname: Fix a clippy warning 'single_char_push_str'
2020-11-19 23:16:31 +01:00
Sylvestre Ledru
8271faf3a2
Merge branch 'master' into clap-pwd
2020-11-19 22:32:02 +01:00
Sylvestre Ledru
252f527b55
Merge branch 'master' into uptime-refresh
2020-11-19 22:30:33 +01:00
Sylvestre Ledru
62265656b4
Merge pull request #1630 from sylvestre/clap-mkdir
...
refactor(mkdir): Move to clap + add a test
2020-11-17 13:01:09 +01:00
Sylvestre Ledru
5eaab5327c
Merge pull request #1632 from sylvestre/clap-rm
...
refactor(rm): Move to clap + add a test
2020-11-17 13:00:35 +01:00
Sylvestre Ledru
eada6e58e5
Merge pull request #1637 from sylvestre/clap-install
...
refactor(install): move to clap
2020-11-17 13:00:04 +01:00
Sylvestre Ledru
27d5256cb6
Use the correct syntax to define the mode
2020-11-16 22:02:06 +01:00
Sylvestre Ledru
55221a18b4
change order + remove useless import
2020-11-15 22:53:49 +01:00
Sylvestre Ledru
f55d8a22ec
remove useless mut
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-15 22:49:26 +01:00
Sylvestre Ledru
5718af023b
use the OPT_VERBOSE
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-15 22:49:01 +01:00
Sylvestre Ledru
4fec824421
change the position of the TODO
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-15 22:48:39 +01:00
Sylvestre Ledru
d268bda28e
Merge pull request #1635 from sylvestre/clap-sync
...
refactor(sync): Move to clap + add tests
2020-11-15 22:40:46 +01:00
Sylvestre Ledru
2edfe32c48
refactor(install): move to clap
2020-11-13 18:21:56 +01:00
Sylvestre Ledru
2febd13733
refactor(sync): Move to clap + add tests
2020-11-11 22:57:55 +01:00
Sylvestre Ledru
61520546a5
refactor(rm): Move to clap + add a test
2020-11-09 10:27:58 +01:00
Roy Ivy III
e493ad1f26
refactor/uucore_procs ~ revise 'Cargo.toml' towards repo norms
2020-11-08 20:53:18 -06:00
Roy Ivy III
688db0d4a2
refactor/uucore ~ revise 'Cargo.toml' towards repo norms
2020-11-08 20:53:18 -06:00
Roy Ivy III
2b4b31a9ee
uucore/refactor ~ fix cargo clippy
complaints (*allow* temporary_cstring_as_ptr; added FixME note)
...
* otherwise, unsure how to fix this; the following change
```rust
let res = unsafe { utmpxname(CString::new(f).unwrap().as_ptr()) };
```
to
```rust
let string_ptr = CString::new(f).unwrap().as_ptr();
let res = unsafe { utmpxname(string_ptr) };
```
causes three `who` tests (test_who::test_all, test_who::test_boot, and test_who::test_login)
to fail by generating no output.
2020-11-08 20:53:18 -06:00
Roy Ivy III
3dc9f76c7f
uucore/refactor ~ fix cargo clippy
complaints (*allow* type_complexity)
2020-11-08 20:53:18 -06:00
Roy Ivy III
66dfd73ffe
uucore/refactor ~ fix cargo clippy
complaints (iter_nth_zero)
2020-11-08 20:53:18 -06:00
Roy Ivy III
9473abf3ba
uucore/polish ~ fix cargo clippy
complaints (missing_safety_doc; with ToDO for safety note)
2020-11-08 20:53:18 -06:00
Roy Ivy III
3941d3f18c
uucore/refactor ~ fix cargo clippy
complaints (len_zero)
2020-11-08 20:53:18 -06:00
Roy Ivy III
bc1084a9f5
uucore/refactor ~ fix cargo clippy
complaints (or_fun_call)
2020-11-08 20:53:18 -06:00
Roy Ivy III
6539b8c6b9
maint/deps ~ change version specification for dependencies between sub-packages
...
- refactor internal version specifications to be ">=M.m.p" (where M.m.p is *already published*)
## [why]
Loosening internal version dependencies decreases the coupling between packages such
that packages can be published in a looser order. It allows the packages to be version
updated and published in tandem (ie, by using `cargo workspace ...`). Once published,
the internal versions can then be updated (again, to an *already published* package
version), as needed.
2020-11-08 20:26:46 -06:00
Roy Ivy III
c17307c757
fix ~ update workspace pointers to 'uucore' and 'uucore_procs'
2020-11-08 20:26:46 -06:00
Roy Ivy III
e15df35e87
Merge 'uucore' repository source code back into 'coreutils'
2020-11-08 19:58:25 -06:00
Roy Ivy III
aed6f296cf
change ~ prepare 'uucore' for grafting/re-merge into 'coreutils'
2020-11-08 19:57:28 -06:00
Alex Lyon
46e2c14f07
Formatting
2020-11-08 19:56:57 -06:00
Alex Lyon
e8dcca1872
Use OsString for arguments rather than String
2020-11-08 19:56:57 -06:00
Sylvestre Ledru
121ab6d847
build/deps ~ relax/update the wild dep
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-08 19:56:57 -06:00
Roy Ivy III
00779a1fb5
refactor macro variable names (fixes spell-checker/unknown word warnings)
2020-11-08 19:56:57 -06:00
Roy Ivy III
7aa0c92cf8
docs/spell ~ configure VSCode cSpell
2020-11-08 19:56:57 -06:00
Roy Ivy III
d52fb5c484
docs/spell ~ spell-check and addition of exceptions
2020-11-08 19:56:57 -06:00
Roy Ivy III
88e5631fa4
docs/polish ~ polish/update commentary and copyrights
2020-11-08 19:56:57 -06:00
Roy Ivy III
70871edac9
docs/polish ~ remove outdated commentary
2020-11-08 19:56:57 -06:00
Roy Ivy III
b9642a0253
0.0.4
2020-11-08 19:56:57 -06:00
Roy Ivy III
16d367a418
fix 'edition=2018' module import errors
2020-11-08 19:56:56 -06:00
Roy Ivy III
c57a933412
change ~ use crate configuration 'edition=2018'
2020-11-08 19:56:56 -06:00
Roy Ivy III
2f840eedef
docs ~ update meta information
2020-11-08 19:56:56 -06:00
Roy Ivy III
fc6370e160
change/API! ~ new_coreopts!()
=> app!()
2020-11-08 19:56:56 -06:00
Roy Ivy III
0c4d314544
change/API! ~ disp_err!()
=> show_usage_error!()
2020-11-08 19:56:56 -06:00
Roy Ivy III
d6b1052f3f
0.0.3
2020-11-08 19:56:56 -06:00
Roy Ivy III
1013b760c4
fix cargo clippy
warning (no_effect)
2020-11-08 19:56:56 -06:00
Roy Ivy III
b8c22496bb
change/uucore_procs ~ add work-around for attribute/macro name collision during testing
...
- proc_macro "main" collides with attribute "#[main]" during testing (for rust < v1.38.0; fixed in v1.38.0+)
- ref: GH:rust-lang/rust#62127
2020-11-08 19:56:56 -06:00
Roy Ivy III
e35bd4b79c
update deps (Cargo.toml); MinSRV == v1.31.0
2020-11-08 19:56:56 -06:00
Roy Ivy III
18b13ed4b4
build/uucore_procs ~ fix proc_dbg!() for MinSRV of v1.31.0
2020-11-08 19:56:56 -06:00
Roy Ivy III
14df9d2df3
docs/build ~ polish crate meta-information (uucore_procs)
2020-11-08 19:56:56 -06:00
Roy Ivy III
246e4427e4
docs/build ~ polish descriptions and crate meta-information in Cargo.toml
2020-11-08 19:56:56 -06:00
Roy Ivy III
ad30781c0c
build/uucore_procs ~ add debugging statements
2020-11-08 19:56:56 -06:00
Roy Ivy III
a352657e1f
build/uucore_procs ~ add/improve debug infrastructure
...
- add proc_dbg! macro
- use debug feature to trigger debug traits for the syn crate
2020-11-08 19:56:56 -06:00
Roy Ivy III
cf2fcd8dc1
docs/uucore_macros ~ improve commentary/documentation
2020-11-08 19:56:56 -06:00
Roy Ivy III
c32ff9e8bb
change ~ use updated SIGPIPE in procs
2020-11-08 19:56:56 -06:00
Roy Ivy III
0432063479
change ~ add proc-macros module (uucore_procs) with uucore_procs::main()
...
- `uucore_procs::main!(UUTIL_NAME)` allows simple, consistent instantiation of `main()` for uutils
2020-11-08 19:56:55 -06:00
Roy Ivy III
503cc53014
change ~ improve naming and documentation of default SIGPIPE handling
2020-11-08 19:56:55 -06:00
Roy Ivy III
b0d02e7f43
change ~ reorganize code layout/structure
2020-11-08 19:56:55 -06:00
Roy Ivy III
6a8a677e8b
refactor/polish ~ cargo fmt
2020-11-08 19:56:55 -06:00
Roy Ivy III
099b0a2074
0.0.2
2020-11-08 19:56:55 -06:00
Roy Ivy III
5b2c2bdfca
maint/CICD ~ fix FreeBSD build on Cirrus CI
2020-11-08 19:56:55 -06:00
Roy Ivy III
16157f57eb
maint/build ~ refactor (reorganize) and improve comments within 'Cargo.toml'
2020-11-08 19:56:55 -06:00
Roy Ivy III
ceee0ec09e
fix build failure caused by imprecise libc version specification
...
- more precisely describe permissable libc versions
.# [why]
- libc >= v0.2.15 is needed for utmp support.
- libc <= v0.2.66 is required to avoid build errors for MinSRV == 1.31.0.
Intermittant build failures were being caused by `cargo` using early libc versions.
2020-11-08 19:56:55 -06:00
Roy Ivy III
c08674da28
fix build failure caused by data-encoding v2.2.0
...
- hold data-encoding to known working "<= 2.1.2"
.# [why]
data-encoding v2.2.0 causes a build error for '1.31.0-i686-pc-windows-msvc'.
```
cargo +1.31.0-i686-pc-windows-msvc build --target=i686-pc-windows-msvc --all-features
...
error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130 )
--> C:\Users\appveyor\.cargo\registry\src\github.com-1ecc6299db9ec823\data-encoding-2.2.0\src\lib.rs:194:5
|
187 | / mod prelude {
188 | | pub use std::borrow::Cow;
189 | | }
| |_- not an extern crate passed with `--extern`
...
194 | use prelude::*;
| ^^^^^^^
|
...
```
2020-11-08 19:56:55 -06:00
Roy Ivy III
96a92b3533
refactor ~ pin all crate versions < v1.0.0
...
. #[why]
Technically, by semver rules, projects with versions < v1.0.0 may make breaking
changes with *any* version change. So, for some protection, pin all crates with
version < v1.0.0 to a specific version.
* ref: <https://semver.org > @@ <https://archive.is/LTGHB >
2020-11-08 19:56:55 -06:00
Roy Ivy III
84d8473e1a
fix forced MinSRV increase (using pinned 'backtrace' version)
...
- hotfix transitive bug in 'failure' forcing MinSRV increase to rust v1.33.0 by pinning 'backtrace' to <= 0.3.31
- [rustlang/nursery#340 ](https://github.com/rust-lang-nursery/failure/issues/340 ) is now open on 'failure' to address this issue
.# [why]
'failure' was using 'backtrace' `version = "0.3.3"`, which by semantic version
auto-upgrade was pulling in 'backtrace' > v0.3.30 (specifically, v0.3.40 most
recently). 'backtrace' v0.3.31 introduces use of `#[cfg(target_vendor = ...)]`
which requires rust v1.33.0. So, 'backtrace' is forcing an upgrade of MinSRV
to rust v1.33.0 with the change from backtrace v0.3.30 to backtrace v0.3.31.
Technically, by being less than v1.0.0, 'backtrace' has no semantic version
requirement. And there is debate about whether increasing MinSRV is a semantic
change. But, in my strong opinion, breaking our MinSRV statement is definitely
a semantic change.
* ref: <https://github.com/rust-lang/rust/blob/master/RELEASES.md >
2020-11-08 19:56:55 -06:00
Roy Ivy III
667ed39ece
fix uucore::fs for windows
...
- standardize the return value of `std::env::current_dir()` by using `canonicalize()`
.# [why]
`std::env::current_dir()` will, in some situations on windows hosts, return
"short"-type paths (eg, "C:\Progra~1\..."). Using `canonicalize()` transforms
the path in a standard long form but may also require removing a leading
"\\?\" prefix.
2020-11-08 19:56:55 -06:00
Roy Ivy III
2792d85865
fix ~ 'musl' environment doesn't support utmpx
2020-11-08 19:56:55 -06:00
Alex Lyon
217d83526b
Set up for release on crates.io
2020-11-08 19:56:54 -06:00
Alex Lyon
12ce90d9cb
Fix doc-test for entries on macOS
2020-11-08 19:56:54 -06:00
Alex Lyon
cdafcce400
Redox is not tested currently, so don't mention it
2020-11-08 19:56:54 -06:00
Alex Lyon
12129d1b1c
Separate uucore into its own repository
2020-11-08 19:56:54 -06:00
Alex Lyon
76aef60d80
uucore: allow the Linux zero-copy setup on Android
2020-11-08 19:56:54 -06:00
Alex Lyon
f79f0716ee
uucore: remove an inaccurate comment
2020-11-08 19:56:54 -06:00
Alex Lyon
72c322a882
uucore, yes: add zero-copy on supported platforms (only Linux currently)
2020-11-08 19:56:54 -06:00
Alex Lyon
d81d3e3c71
Get rid of all warnings on Linux (or at least WSL)
2020-11-08 19:56:54 -06:00
Zachary Dremann
77cc8d39c6
Replace starts_with and slice with trim_left_matches
2020-11-08 19:56:54 -06:00
Zachary Dremann
c15b18bf5b
Don't allocate in signal_by_name_or_value
2020-11-08 19:56:54 -06:00
Zachary Dremann
30df2210f0
Fix is_signal
2020-11-08 19:56:54 -06:00
Zachary Dremann
44550ee5b6
Add tests for signals (including failing test for is_signal
2020-11-08 19:56:54 -06:00
Alex Lyon
4e0025cb17
base32, base64, uucore: merge base32/base64 code
2020-11-08 19:56:54 -06:00
Roy Ivy III
6600993c3e
fix: gate unix-only macros (silences "unused" warnings)
2020-11-08 19:56:53 -06:00
Vinzent Steinberg
5f582c05e1
Remove utf8 feature
...
All code it provides can be implemented with `std`.
2020-11-08 19:56:53 -06:00
Vinzent Steinberg
5160f47a9f
Fix more clippy warnings and remove redundant 'static
2020-11-08 19:56:53 -06:00
Vinzent Steinberg
de7a6b5afa
Fix a few clippy warnings
2020-11-08 19:56:53 -06:00
Roy Ivy III
bd450ebb94
uucore: fix: use updated 'wild' crate for globbing
2020-11-08 19:56:53 -06:00
Roy Ivy III
9e8b002735
uucore: fix: use forked 'wild' crate with case-sensitivity + API fixes
2020-11-08 19:56:53 -06:00
Roy Ivy III
03d6e733e4
uucore: Add globbing for Windows machines
2020-11-08 19:56:53 -06:00
dependabot[bot]
99da2451ab
Bump getopts from 0.2.17 to 0.2.18
...
Bumps [getopts](https://github.com/rust-lang/getopts ) from 0.2.17 to 0.2.18.
- [Release notes](https://github.com/rust-lang/getopts/releases )
- [Commits](https://github.com/rust-lang/getopts/compare/0.2.17...v0.2.18 )
Signed-off-by: dependabot[bot] <support@dependabot.com>
2020-11-08 19:56:53 -06:00
dependabot[bot]
b21bd0bea3
Bump time from 0.1.39 to 0.1.40
...
Bumps [time](https://github.com/rust-lang/time ) from 0.1.39 to 0.1.40.
- [Release notes](https://github.com/rust-lang/time/releases )
- [Commits](https://github.com/rust-lang/time/compare/0.1.39...0.1.40 )
Signed-off-by: dependabot[bot] <support@dependabot.com>
2020-11-08 19:56:53 -06:00
dependabot[bot]
a31b1047c1
Bump libc from 0.2.39 to 0.2.42
...
Bumps [libc](https://github.com/rust-lang/libc ) from 0.2.39 to 0.2.42.
- [Release notes](https://github.com/rust-lang/libc/releases )
- [Commits](https://github.com/rust-lang/libc/compare/0.2.39...0.2.42 )
Signed-off-by: dependabot[bot] <support@dependabot.com>
2020-11-08 19:56:53 -06:00
Alex Lyon
40738bfb0a
uucore: update data_encoding and add wrap_write()
2020-11-08 19:56:53 -06:00
Valentin Lorentz
2ad767586b
chmod: show human-friendly permissions when --changes or --verbose is used.
...
Like GNU chmod.
2020-11-08 19:56:53 -06:00
Ian Douglas Scott
eedf7cb28a
Make the 'cat' utility build on Redox
2020-11-08 19:56:53 -06:00
Alex Lyon
07de3eda6e
uucore: make features opt-in rather than opt-out
2020-11-08 19:56:53 -06:00
Alex Lyon
f74a1b6333
Format everything using rustfmt
2020-11-08 19:56:53 -06:00
Alex Lyon
1c0b1ab375
uucore: remove utsname.rs (and replace with platform-info)
2020-11-08 19:56:53 -06:00
Alex Lyon
ca3393bd86
uucore: read from sys:uname on Redox
2020-11-08 19:56:52 -06:00
Alex Lyon
7559c0d83d
cp, tail: update winapi
2020-11-08 19:56:52 -06:00
Alex Lyon
f575b8f4f2
arch: add support for building on Windows
2020-11-08 19:56:52 -06:00
Alex Lyon
3cec199da1
Add Sphinx documentation to generate man pages
2020-11-08 19:56:52 -06:00
Alex Lyon
64c2c2055b
chmod, install, uucore: fix build on Windows
2020-11-08 19:56:52 -06:00
Alex Lyon
5544def54e
Remove pipe_* macros
2020-11-08 19:56:52 -06:00
Alex Lyon
f0bd170996
chmod, install: move mode parsing into uucore
2020-11-08 19:56:52 -06:00
Alex Lyon
fd555c6d21
Handle SIGPIPE correctly and autogenerate main() for each util
2020-11-08 19:56:52 -06:00
Joshua Miller
6998949c06
pin dependencies
2020-11-08 19:56:52 -06:00
Matt8898
e7940828f9
uucore: add support for optflagmulti and optmulti.
2020-11-08 19:56:52 -06:00
Arcterus
e2b8741a35
uucore: compile on Windows again
2020-11-08 19:56:52 -06:00
Arcterus
f61f30f52b
uucore: read symlinked directories correctly in resolve_relative_path()
2020-11-08 19:56:52 -06:00
Joseph Crail
f3639b9453
Fix comment spelling
2020-11-08 19:56:52 -06:00
Lei Zhang
3f4dba0de9
Turn off utmpx and signals for Fuchsia.
...
Fuchsia uses musl as its libc; musl only has stub implementation
for utmpx. From their wiki, that is deliberately chosen.
Fuchsia doesn't have signals mechanism.
2020-11-08 19:56:52 -06:00
Will Wykeham
cf2be8a6b1
Fix a number of Windows build warnings
2020-11-08 19:56:52 -06:00
knight42
09b0b9ad78
chown,chgrp: fix bug in option --preserve-root
2020-11-08 19:56:51 -06:00
knight42
b6dcafc675
uucore::fs: add fn resolve_relative_path
2020-11-08 19:56:51 -06:00
Nathan Ross
22fab1444e
uucore: allow 'wrong number of arguments' macro to be more precise
2020-11-08 19:56:51 -06:00
Nathan Ross
8cb2edecb1
uucore: add support for optflagopt to coreopts
2020-11-08 19:56:51 -06:00
Nathan Ross
35951ebf66
uucore: fix utility name in coreopts parsing error messages
2020-11-08 19:56:51 -06:00
Knight
1dab4510b5
Remove uucore::c_types
2020-11-08 19:56:51 -06:00
Knight
d22814201e
Add uucore::utsname to get system info
2020-11-08 19:56:51 -06:00
Knight
05b5317605
uucore::process: add functions to obtain uid/gid, euid/egid
2020-11-08 19:56:51 -06:00
Knight
5bc2276775
Add uucore::entries
2020-11-08 19:56:51 -06:00
Knight
434aae76bc
uucore::utmpx: fix doctest errors
2020-11-08 19:56:51 -06:00
Knight
0277848de7
uucore: make libc optional
2020-11-08 19:56:51 -06:00
nathanross
50887566ea
uucore: coreopts alignment, spacing, and optional usage
2020-11-08 19:56:51 -06:00
Nathan Ross
73d36a1d88
uucore: require version; syntax; summary; longhelp
2020-11-08 19:56:51 -06:00
Knight
6a22120d7b
uucore::utmpx: change API and fix error
2020-11-08 19:56:51 -06:00
Knight
58b6ac9393
uucore::utmpx: refine implementation
2020-11-08 19:56:51 -06:00
Knight
3751142ccb
coreopts: fix error when using msg_wrong_number_of_arguments
macro
2020-11-08 19:56:50 -06:00
Knight
68ad14f3c4
uucore: conditional enable different features
2020-11-08 19:56:50 -06:00
Knight
25018b112b
uucore: export latest libc
2020-11-08 19:56:50 -06:00
Knight
789141d926
coreopts: display package name instead of module path
2020-11-08 19:56:50 -06:00
Nathan Ross
bcec54f572
uucore: CoreOptions error and version message templates
2020-11-08 19:56:50 -06:00
Nathan Ross
76952579ac
uucore: add message templates
2020-11-08 19:56:50 -06:00
Knight
2c78b92801
uucore: add module encoding
2020-11-08 19:56:50 -06:00
Corey Farwell
bcdb682bf8
Remove unused imports.
2020-11-08 19:56:50 -06:00
Corey Farwell
c6909951aa
Cleanup logic around wait_or_timeout
exit status handling.
2020-11-08 19:56:50 -06:00
Corey Farwell
72d2ab208c
Prefer handling Duration
over f32
when dealing with times.
...
Also refactored out usage of the `time` crate in `uucore`.
2020-11-08 19:56:50 -06:00
Knight
463c6af4e3
uucore: update utmpx
2020-11-08 19:56:50 -06:00
Knight
79b6835612
pinky: cleanup the code
2020-11-08 19:56:50 -06:00
Knight
6e2c3ede40
uucore::utmpx: revert the changes
2020-11-08 19:56:50 -06:00
Knight
967babd1e6
pinky: implement short format
2020-11-08 19:56:50 -06:00
Knight
b0588e482e
uucore: add disp_err macro
2020-11-08 19:56:50 -06:00
Shiroy
713770c9ae
Add missing lib.name for uucore
...
Fix build on Linux
2020-11-08 19:56:50 -06:00
Arcterus
a149efe45a
uucore: don't follow symlinks when examining them ( fixes #799 )
2020-11-08 19:56:49 -06:00
Michael Gehring
512a6a3201
expand, unexpand: fix build on stable
2020-11-08 19:56:49 -06:00
Michael Gehring
0a3a2ca935
Fix clippy warnings
2020-11-08 19:56:49 -06:00
Michael Gehring
ce733b38a9
Fix arm build
...
Fixes #719
2020-11-08 19:56:49 -06:00
Joseph Crail
bde309a29f
Remove trait shim needed before Path stabilized
...
Now that Path has stabilized in Rust 1.5, I removed the UUPathExt trait
needed to support stable, beta, and nightly.
2020-11-08 19:56:49 -06:00
Joseph Crail
0678332a1f
Add macro to properly find program name.
2020-11-08 19:56:49 -06:00
Joseph Crail
b8ee12f703
More import fixes for Windows.
2020-11-08 19:56:49 -06:00
Joseph Crail
3863842fae
Fix errors with bools represented as ints.
2020-11-08 19:56:49 -06:00
Joseph Crail
9c4c9f6782
Refactor check for standard stream interactivity.
...
Since several utilities check if the standard streams are interactive, I
moved this into the uucore::fs library as is_std*_interactive(). I also
added Windows support for these methods, which only return false (or at
least until someone finds a way to support this).
2020-11-08 19:56:49 -06:00
Joseph Crail
14eccb4335
uucore: specify a few modules to be Unix-only
2020-11-08 19:56:49 -06:00
Michael Gehring
23e0315262
Remove deprecated lint
2020-11-08 19:56:49 -06:00
Joseph Crail
6095dfee66
Split utility files into separate library.
...
Everything in src/common has been moved to src/uucore. This is defined
as a Cargo library, instead of directly included. This gives us
flexibility to make the library an external crate in the future.
Fixes #717 .
2020-11-08 19:56:42 -06:00
Sylvestre Ledru
5c8e47a4d1
Remove version mgmt, it is done by clap
2020-11-08 17:55:31 +01:00
Sylvestre Ledru
897bcb2e67
refactor(mkdir): Move to clap + add a test
2020-11-08 17:51:04 +01:00
Sylvestre Ledru
92d5d47434
refactor(pwd): move to clap + add a test
2020-11-03 23:12:16 +01:00
Sylvestre Ledru
8bd533ffe8
refactor(uptime): some minor improvements
2020-11-03 23:10:32 +01:00
Sylvestre Ledru
a3f3a050a8
Merge pull request #1618 from sylvestre/wc-clap
...
refactor(wc): use clap instead of getopts
2020-11-03 09:39:53 +01:00
Sylvestre Ledru
38e90b9a03
Merge pull request #1621 from sylvestre/clap-stat
...
refactor(stat): Move to clap
2020-11-03 08:37:39 +01:00
Sylvestre Ledru
57c83db6b6
Merge pull request #1616 from sylvestre/users
...
refactor(users): move to clap and simplify the code a bit
2020-11-03 08:37:16 +01:00
Sylvestre Ledru
bd41cb621b
Merge pull request #1620 from sylvestre/clap-printenv
...
refactor(printenv): use clap instead of getopts
2020-11-03 08:36:56 +01:00
Sylvestre Ledru
32ccd7d54d
Merge pull request #1619 from sylvestre/rmdir-clap
...
refactor(rmdir): use clap instead of getopts
2020-11-03 08:36:25 +01:00
Sylvestre Ledru
daf0f96b94
Update of the about description
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-02 22:47:55 +01:00
Sylvestre Ledru
2ad587ccbd
Update of the about description
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-11-02 22:32:44 +01:00
Sylvestre Ledru
1e37c29b1f
refactor(stat): Move to clap
2020-11-02 22:18:51 +01:00
Sylvestre Ledru
58099f4203
refactor(wc): use clap instead of getopts
2020-10-29 20:40:00 +01:00
Roy Ivy III
114fda0519
tests ~ (sub-crate factor) refactor divisor() test for improved readability
2020-10-26 15:06:29 -05:00
Roy Ivy III
ae06368cd8
polish/factor ~ correct spelling
2020-10-26 15:06:29 -05:00
Roy Ivy III
6a525c950d
perf/factor ~ tune number of stack inlined decomposition values (~1% time improvement)
2020-10-26 15:06:29 -05:00
Roy Ivy III
6eea8c5f30
perf/factor ~ improve factor() quotient and loop comparison (~6% time improvement)
2020-10-26 15:06:28 -05:00
Roy Ivy III
368f47381b
fix/factor ~ fix fault when factoring number composed of a squared factor
2020-10-26 15:06:28 -05:00
Roy Ivy III
8593b4c46c
tests ~ (sub-crate/factor) add tests for known prior factorization failures
2020-10-26 15:06:28 -05:00
Roy Ivy III
3bb3080170
factor/refactor ~ fix cargo clippy
complaints (allow many_single_char_names)
2020-10-26 15:06:28 -05:00
nicoo
0d39732300
factor::Decomposition: Inline a small number (4) of factors
...
This avoids allocating on the heap when factoring most numbers,
without using much space on the stack.
This is ~3.5% faster than the previous commit, and ~8.3% faster than “master”.
2020-10-26 15:06:28 -05:00
nicoo
78ae0cca31
factor: Slightly refactor main loop, fix bug
2020-10-26 15:06:28 -05:00
nicoo
b7b0c76b8e
factor::Decomposition: Optimise as a factor is never added twice
...
The invariant is checked by a debug_assert!, and follows from the previous
commit, as `dec` and `factors` only ever contains coprime numbers:
- true at the start: factor = ∅ and dec = { n¹ } ;
- on every loop iteration, we pull out an element `f` from `dec` and either:
- discover it is prime, and add it to `factors` ;
- split it into a number of coprime factors, that get reinserted into `dec`;
the invariant is maintained, as all divisors of `f` are coprime with all
numbers in `dec` and `factors` (as `f` itself is coprime with them.
As we only add elements to `Decomposition` objects that are coprime with the
existing ones, they are distinct.
2020-10-26 15:06:28 -05:00
nicoo
ce218e01b6
factor: Ensure we only need to find every single factor once [WiP]
...
~17% faster, many optimisation opportunities still missed >:)
2020-10-26 15:06:28 -05:00
nicoo
3743a3e1e7
factor: Derecursify and refactor
...
~7% slowdown, paves the way for upcoming improvements
2020-10-26 15:06:28 -05:00
nicoo
8643489096
factor::Factors: Use a RefCell rather than copy data when printing
...
~2.9% faster than the previous commit, ~11% faster than “master” overall.
2020-10-26 15:06:28 -05:00
nicoo
30f9cf32f2
factor::Decomposition: Use a flat vector representation
...
~18% faster than BTreeMap, and ~5% faster than 'master'
2020-10-26 15:06:27 -05:00
nicoo
b8ef58c002
factor::Factors: Split off a Decomposition type
...
The new type can be used to represent in-progress factorisations,
which contain non-prime factors.
2020-10-26 15:06:27 -05:00
nicoo
6158cd5714
factor: Introduce a type alias for exponents
...
This way, we can easily replace u8 with a larger type when moving to support
larger integers.
2020-10-26 15:06:27 -05:00
Sylvestre Ledru
af151703b3
refactor(rmdir): use clap instead of getopts
2020-10-26 09:53:55 +01:00
Sylvestre Ledru
17a99f8e53
refactor(printenv): use clap instead of getopts
2020-10-26 09:52:53 +01:00
Roy Ivy III
5837bc4fc9
Merge pull request #1610 from sylvestre/sort-clap
...
refactor(sort): move to use of 'clap'
2020-10-25 18:56:58 -05:00
Roy Ivy III
a9fb64abb4
Merge pull request #1612 from sylvestre/clap-seq
...
Move seq to use of 'clap'
2020-10-25 18:56:24 -05:00
Sylvestre Ledru
dc4eb79329
refactor/sort ~ changes based on PR feedback
...
- change `const`=>`static` and remove unneeded help/version (supplied by default by `clap`)
- update of the ABOUT description
- move to alphabetical order (where reasonable)
- rename OPT_FILES => ARG_FILES
- change the order of the declarations
2020-10-25 11:14:15 -05:00
Sylvestre Ledru
7fb5aaa108
only one file is allowed
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-10-25 17:07:32 +01:00
Sylvestre Ledru
bd339f142e
Improve the "about" description
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-10-25 17:07:17 +01:00
Sylvestre Ledru
58b0aeabee
refactor(sort): move to clap
2020-10-25 11:01:30 -05:00
Sylvestre Ledru
75e1c517a0
refactor/seq ~ changes based on PR feedback
...
- fix the ABOUT description
- rename OPT_NUMBERS => ARG_NUMBERS
- improve the get_usage of seq
- rename seq => incremetal
- `cargo fmt`
2020-10-25 10:58:14 -05:00
Sylvestre Ledru
e06aaace59
refactor/readline ~ changes based on PR feedback
...
- add a trailing "." to ABOUT for consistency
- rename OPT_FILES => ARG_FILES
- move to alphabetical order for OPTIONs (where reasonable)
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-10-25 10:54:24 -05:00
Sylvestre Ledru
733fe925ad
refactor(readlink): move to clap
2020-10-25 10:53:09 -05:00
Sylvestre Ledru
dfb922f66e
refactor(seq): use clap instead of doing arg mgmt by hand
2020-10-25 10:46:38 -05:00
Roy Ivy III
58d7d89e07
Merge pull request #1617 from sylvestre/clippy-fix
...
Fix some clippy warnings
2020-10-25 10:35:35 -05:00
Sylvestre Ledru
a12509f32e
Fix some clippy warnings
2020-10-25 15:50:51 +01:00
Sylvestre Ledru
4804e52c97
refactor(users): move to clap and simplify the code a bit
2020-10-25 15:29:02 +01:00
Sylvestre Ledru
7c3dccb981
remove the useless format
2020-10-25 12:28:27 +01:00
Sylvestre Ledru
0d4e36d5cd
reorder the args
2020-10-25 12:27:04 +01:00
Sylvestre Ledru
b72972e0b2
Rename OPT_FILES => ARG_FILES
...
Co-authored-by: Roy Ivy III <rivy.dev@gmail.com>
2020-10-25 12:22:07 +01:00
Sylvestre Ledru
8ad2fd3534
refactor(truncate): Move to clap
2020-10-23 00:40:46 +02:00
Kevin Burke
7fc1b16115
sort: fix panic on write to closed pipe
...
If the output of sort is piped to another program that closes the file
descriptor, sort currently panics. The GNU coreutils is able to handle
this case.
Replacing panic with crash_if_err reports the closed pipe and exits
with a return code, which seems like the correct behavior. Tested on
my Mac and the panic disappears.
Add a test which pipes data to sort - it won't protect against this
specific regression, but it increases the test coverage, at least.
Fixes #1608 .
2020-10-21 16:55:10 -07:00
Roy Ivy III
92075c7d14
refactor/polish ~ (factor) fix cargo clippy
complaint (unused_imports)
2020-10-16 20:25:49 -05:00
Sylvestre Ledru
fba62f39c6
Merge pull request #1603 from rivy/fix.warnings
...
Fix `cargo clippy` warnings
2020-10-12 09:23:15 +02:00
Roy Ivy III
77a04546f0
fix/printf ~ use calculated VERSION
2020-10-11 17:39:50 -05:00
Wisha Wa
b387565ba3
ptx: remove unneeded regex and reduce repetitive regex compilations
2020-10-12 01:59:06 +07:00
Wisha Wa
351d1fc068
ptx: improve performance by removing N^2 routine.
2020-10-12 01:27:35 +07:00
Roy Ivy III
46f30f3836
refactor/polish ~ fix cargo clippy
complaint (stable_sort_primitive)
2020-10-10 20:35:35 -05:00
Roy Ivy III
10b6926ccc
refactor/polish ~ fix cargo clippy
complaint (allow match_like_matches_macro)
2020-10-10 20:35:35 -05:00
Roy Ivy III
6fa16343f1
refactor/polish ~ fix cargo clippy
complaint (same_item_push)
2020-10-10 20:35:35 -05:00
Roy Ivy III
7b4d81efd4
refactor/polish ~ fix cargo clippy
complaint (needless_collect)
2020-10-10 20:35:35 -05:00
Roy Ivy III
4a041f95e3
Merge pull request #1598 from sylvestre/nproc
...
cleanup(nproc): remove some artifacts from the clap migration
2020-10-10 16:28:22 -05:00
Roy Ivy III
0fa249a944
Fix tr
argument handling for missing arguments ( #1601 )
...
* tests/tr ~ confirm failure for missing argument(s)
* fix/tr ~ mimic GNU error reponse for missing argument(s)
2020-10-02 22:43:57 +02:00
Sylvestre Ledru
c660684a8c
nproc: use the variable name
2020-09-26 23:09:08 +02:00
Sylvestre Ledru
805801ec39
nproc: remove the extern crate declaration
2020-09-26 23:09:02 +02:00
nicoo
9a1c560aba
factor: Refactor and optimise the Factors
datastructure ( #1572 )
...
* factor: Introduce a type alias for exponents
This way, we can easily replace u8 with a larger type when moving to support
larger integers.
* factor::Factors: Split off a Decomposition type
The new type can be used to represent in-progress factorisations,
which contain non-prime factors.
* factor::Decomposition: Use a flat vector representation
~18% faster than BTreeMap, and ~5% faster than “master”.
* factor::Factors: Use a RefCell rather than copy data when printing
~2.9% faster than the previous commit, ~11% faster than “master” overall.
2020-09-21 21:44:50 +02:00
Jens Humrich
bfca334ec1
style issues
2020-09-17 12:40:48 +02:00
Katzmann1983
f322f72c34
Update src/uu/split/src/split.rs
...
Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
2020-09-17 10:27:40 +02:00
Jens Humrich
5a75905476
Add additional-suffix option to split
2020-09-16 17:59:39 +02:00
Roy Ivy III
2ff6b67077
stat: fix cargo clippy
complaint (unnecessary_sort_by) ( #1594 )
2020-09-04 08:01:53 +02:00
Roy Ivy III
c33284f38b
factor::numeric::gcd: modify divisor()
test to return correct true/false results for all possible inputs
2020-09-03 14:56:14 -05:00
nicoo
07eaa7fe5a
factor::numeric::gcd: Add explicit test for the 0 case
2020-09-03 14:56:14 -05:00
nicoo
c11cebc4d3
factor::numeric::gcd: Exclude the 0 case from test divisor
2020-09-03 14:56:10 -05:00
16yuki0702
19e967ef31
ls: deleting user defined max function ( #1591 )
...
This is trivial refactor.
```usize``` can call max method, so deleting user defined max function.
2020-08-26 09:42:27 +02:00
Roy Ivy III
74510d2fa4
refactor/polish ~ cargo fmt
2020-08-19 09:13:09 -05:00
Roy Ivy III
74200f368b
tests ~ (sub-crate/mknod) fix WSL variation in expected test values
2020-08-19 09:13:09 -05:00
Roy Ivy III
2a50dc42c1
tests ~ (sub-crate/factor) fix divisor(0,0)
test of factor::numeric::gcd() with early value check and return ( fixes #1587 )
2020-08-19 09:13:09 -05:00
Roy Ivy III
5478ca9108
tests ~ (sub-crate/od) fix expected f16 formatted test value
2020-08-10 10:19:42 -05:00
Roy Ivy III
b2483cb3c3
tests ~ (sub-crate/od) fix/remove inadvertent doc test (by using ignore
)
2020-08-10 10:19:42 -05:00
Roy Ivy III
49d17f9587
tests ~ (sub-crate/od) fix compiler error (mismatched types)
2020-08-10 10:19:42 -05:00
Roy Ivy III
4fa27345be
tests ~ (sub-crate/od) fix cargo clippy
complaints (from deprecated half::consts to f16::...)
2020-08-10 10:19:42 -05:00
Roy Ivy III
c7cb5cbc37
tests ~ (sub-crate/cat) fix incorrect test attribute usage
2020-08-10 10:19:42 -05:00
Roy Ivy III
c3893edf94
tests ~ (sub-crates) fix 'edition=2018' module import errors
...
- ref: <https://users.rust-lang.org/t/imports-can-only-refer-to-extern-crate-names/24388 > @@ <https://archive.is/iCaXp >
2020-08-10 10:19:42 -05:00
Roy Ivy III
925137afce
tests ~ (sub-crate/od) fix cargo clippy
complaints (unused imports)
2020-08-10 10:19:41 -05:00
Roy Ivy III
dd72893771
tests ~ (sub-crate/od) fix cargo clippy
complaints (deprecated std::error::Error::description)
2020-08-10 10:19:41 -05:00
nicoo
dc6b9a8d62
CI: Improve annotations ( #1584 )
...
* CI: Only run rustfmt in one environment
- This displays clippy warnings even when rustfmt fails.
- This avoids displaying 3 copies of the same rustfmt warning as Github
annotations.
- Avoids duplicated work.
* CI: Suppress warnings when building for the oldest toolchain version
We had cases of warnings emitted due to `rustc` bugs that were fixed
in non-obsolete versions.
* factor: Remove a workaround for warnings on obsolete rustc
2020-08-10 16:53:32 +02:00
Felipe Lema
ba6b55f117
feature[env]: Add support for --chdir=DIR
in env
( fixes #1568 ) ( #1569 )
2020-08-08 22:26:49 -05:00
nicoo
d9be24e354
factor: Make the implementation of GCD more readable ( #1576 )
...
* factor::numeric::gcd: Switch variable names to be more consistent
* factor::numeric::gcd: Improve comments
* factor::numeric::gcd: Extend loop invariant to v
2020-08-08 22:26:49 -05:00
nicoo
37f717f5e3
factor: Add tests against (random) numbers with known factorisations ( #1573 ) ( #1578 )
...
* factor::Factors: Derive implementations of Eq and PartialEq
* factors::Factors: Implement quickcheck::Arbitrary
This generates uniformly-distributed integers with known factorisations,
and will enable further testing.
* factor: Test against random numbers with known factorisations
* factor::Factors::arbitrary: Simplify method signature
2020-08-08 22:26:25 -05:00
nicoo
34a5941ee9
factor::numeric: Add more property-based tests ( #1577 )
...
* factor::numeric::gcd: Rename test against the Euclidean algorithm
* factor::numeric::gcd: Add various property-based tests
* factor::numeric::modular_inverse: Rename test
* factor::numeric::modular_inverse: Add test on random values
2020-08-03 14:00:34 +02:00
nicoo
70828329ba
factor::miller_rabin: Deduplicate parametrized_check macro ( #1575 )
...
* factor::miller_rabin::tests::first_composite: Drop useless generic
* factor::miller_rabin::tests: Reuse parametrized_check macro
2020-08-03 13:58:09 +02:00
nicoo
1eabda91cf
factor: Split numeric.rs into multiple modules ( #1567 )
...
* factor::numeric: Start refactoring into multiple submodules
No change to the module's interface, but it should make it much easier to
keep the tests right next to the code they are related to.
Moreover, build.rs' dependency is now limited to numeric::{modular_inverse,
traits}, meaning that the rest of it can use build-time generated tables etc.
* factor::numeric: Move gcd (and its test) to a submodule
* factor::numeric: Move Montgomery arithmetic to its own module
Finally hollowed-out numeric.rs
* factor: Move numeric.rs to numeric/mod.rs
* factor::numeric: Fix an erroneous lint on obsolete Rust versions
2020-08-02 20:28:00 +02:00
Sylvestre Ledru
85e2e1d0ee
Merge pull request #1566 from nbraud/factor/miller-rabin/copyright
...
factor::miller_rabin: Add missing copyright header in source file
2020-08-02 14:09:44 +02:00
nicoo
645e9a24bd
factor::miller_rabin: Add missing copyright header in source file
2020-07-26 14:59:30 +02:00
Roy Ivy III
c36d71ba43
refactor/polish ~ fix cargo clippy
complaint (needless_lifetimes)
2020-07-25 11:09:10 -05:00
Roy Ivy III
305c3cbcdb
refactor/polish ~ fix cargo clippy
complaint (bind_instead_of_map)
2020-07-25 11:09:10 -05:00
Roy Ivy III
326ff36793
refactor/polosh ~ fix cargo clippy
complaint (reversed_empty_ranges)
2020-07-25 11:09:10 -05:00
Roy Ivy III
a6d7379b97
Merge pull request #1563 from nbraud/factor/faster/gcd
...
factor/perf ~ speed up factor::numeric::gcd
2020-07-25 11:07:57 -05:00
nicoo
6bef6306c0
factor::numeric::gcd: Avoid redundant u64::trailing_zeros and shifts
...
7 to 10% faster, according to criterion.
2020-07-25 15:04:57 +02:00
nicoo
3e55139c13
factor::miller_rabbin::Result: Mark as #[must_use]
...
Ignoring a value of that type is a bug: they are only produced by
`miller_rabbin::test`, which is a pure, but expensive, function.
As such, an ignored value is always either a mistake, or an easy
optimisation opportunity (just remove the useless call to `test`).
2020-07-24 23:06:08 +02:00
nicoo
ecc3e2db24
factor::miller_rabin::test: Minor readability improvement
2020-07-24 23:06:08 +02:00
nicoo
e415b17c01
factor::miller_rabin: Remove duplicated work
...
The duplicate work was introduced in 2015.
2020-07-24 23:06:06 +02:00
nicoo
29d45e472d
factor::numeric::gcd: Implement Stein's binary GCD algorithm
...
Also add a property-based test against the Euclidean implementation.
numeric::gcd got ~50-65% faster, according to criterion. The effect on the
overall system is small, but later PRs will use a lot more GCD computations.
2020-07-24 23:00:32 +02:00
nicoo
4f23767b85
factor::numeric::gcd: Add criterion-powered benchmark
...
The function had to be made `pub`, this is a [known limitation] of Criterion.
[known limitation]: https://bheisler.github.io/criterion.rs/book/user_guide/known_limitations.html
2020-07-24 22:58:26 +02:00
nicoo
1b593d94c9
factor: Update rand dependency to v0.7
2020-07-24 22:57:08 +02:00
nicoo
9a80ab7741
factor::numeric::DoubleInt: Document the DoubleWidth associated type
2020-07-24 11:28:26 -05:00
nicoo
17c69674eb
factor::numeric::Int: Remove from_u128
method
...
It was unused, the debug assertions only need `to_u128`.
2020-07-24 11:28:26 -05:00
nicoo
1172af09c0
factor::numeric::DoubleInt: Clarify methods and associated types
...
- `DoubleInt::Double` renamed to `DoubleWidth`
- `{as,from}_double()` renamed to `{as,from}_double_width()`.
This should hopefully clarify that this is not a “double precision”
floating-point type, but an integer type with a larger range (used
for storing intermediate results, typ. from a multiplication)
2020-07-24 11:28:26 -05:00
nicoo
86a4749e3a
factor::numeric: fix original "Generalise modular inverse computation"
2020-07-24 11:28:12 -05:00
nicoo
6e228d3184
Merge branches 'factor/faster/{centralise_logic, montgomery32}'
2020-07-05 00:20:16 +02:00
nicoo
4cfe754551
factor::miller_rabin::is_prime: Fix bug
...
Montgomery only works for odd n, so attempting to construct an instance
for an even number results in a panic!
The most obvious solution is to special-case even numbers.
2020-07-05 00:08:49 +02:00
nicoo
9b0f131135
Fix bug in factor::factor::factor (>_>")
...
Non-prime numbers, such as 0 or 1, shouldn't be inserted in the factorisation.
2020-07-05 00:07:38 +02:00
nicoo
e9e263ac66
factor::Factors: Derive Clone and Debug
...
Useful for printing out in-progress factorisations when debugging.
2020-07-05 00:07:33 +02:00
nicoo
7bdc81b882
factor: Add a first property-based test
2020-07-05 00:07:16 +02:00
nicoo
dcc22188ba
factor: Fix clippy warnings
2020-07-05 00:05:45 +02:00
nicoo
f1d1cb80e4
factor::Factors: Generalise invariant check (from prime() to add())
2020-07-05 00:05:45 +02:00
nicoo
2d2b6faab4
factor: Avoid moving data around in main factoring loop
...
Instead, the same `Factors` object is passed around through the execution.
~10% faster.
2020-07-05 00:05:45 +02:00
nicoo
6713d2ad62
factor: Move recursive factoring logic from rho to factor
...
No functional change, but prepares a coming optimisation.
2020-07-05 00:05:45 +02:00
nicoo
bd4d6fcac5
factor: Split the CLI and I/O code off the factoring logic
2020-07-05 00:05:45 +02:00
nicoo
6256750376
factor::miller_rabin: Use a macro to instantiate every test
2020-07-05 00:04:56 +02:00
nicoo
7a1b86c9c2
factor::numeric::tests: Use a macro to instantiate every test
2020-07-05 00:04:53 +02:00
nicoo
cbcc760f83
factor::miller_rabin: Squash another bug! >:3
...
Detected by the testsuite improvement just prior.
2020-07-05 00:04:49 +02:00
nicoo
3d6fdffe14
factor::miller_rabin: Generalise tests to 32 and 64b Montgomery
2020-07-05 00:04:29 +02:00
nicoo
9b149a759b
factor::miller_rabin: Hoist edge-cases (even, <2) out of test()
...
test() takes a modulus that is known to not be even or <2 (otherwise the
Montgomery value could not be constructed), so those checks can be hoisted
into is_prime() and out of the critical path.
2020-07-05 00:04:26 +02:00
nicoo
4f08e28167
factor::miller_rabin: Add property-based test
2020-07-05 00:04:08 +02:00
nicoo
d2fa0fe63c
factor::miller_rabin::tests: small_composites → small_semiprimes
...
This is more descriptive, as semiprime are the products of 2 primes;
all semiprimes are composite, but not all composite numbers are semiprime.
2020-07-05 00:01:48 +02:00
nicoo
1e4d824829
factor::miller_rabin: Add negative test over all small composites
2020-07-05 00:01:44 +02:00
nicoo
600268c6e4
factor::miller_rabin::tests: Refactor
2020-07-05 00:01:40 +02:00
nicoo
0a1200bdb8
factor::miller_rabin: Add test for the largest 64b composite numbers
2020-07-05 00:01:37 +02:00
nicoo
308290325a
factor::miller_rabin::is_prime: Fix bug
...
Montgomery<_> only works for odd n, so attempting to construct an instance
for an even number results in a panic!
The most obvious solution is to special-case even numbers.
2020-07-05 00:01:33 +02:00
nicoo
d2b43f49f9
factor::numeric::OverflowingAdd: Generate impls with a macro
2020-07-05 00:01:21 +02:00
nicoo
b25c77c5f9
factor::numeric: Generate implementations of DoubleInt with a macro
2020-07-05 00:01:21 +02:00
nicoo
f95f977f98
factor::numeric: Generate implementations of Int with a macro
2020-07-05 00:01:21 +02:00
nicoo
53954badd7
factor::numeric: Refactor away the use of {To,From}Primitives
2020-07-05 00:01:21 +02:00
nicoo
19a8231fb2
factor::numeric::Arithmetic: Rename associated type I to ModInt
2020-07-05 00:01:21 +02:00
nicoo
caa79a1261
factor::numeric: Split Int and DoubleInt traits
2020-07-05 00:01:21 +02:00
nicoo
28244413d1
factor::numeric: Document when to remove OverflowingAdd trait
2020-07-05 00:01:21 +02:00
nicoo
3f79be0219
factor::numeric: Use debug_assert! for runtime assertions.
2020-07-05 00:01:21 +02:00
nicoo
774feb0a40
factor::numeric: Generalise tests for Arithmetic trait
2020-07-05 00:01:21 +02:00
Alex Lyon
4d28f48ad9
factor: combine Montgomery and Montgomery32
2020-07-05 00:01:21 +02:00
nicoo
a440807e6c
factor::miller_rabin: Use a specialized basis for 32b integers
...
~3% faster
2020-07-05 00:01:21 +02:00
nicoo
e68bb192f2
factor::numeric: Add a 32b Montgomery variant [WiP]
...
~32% faster
2020-07-05 00:01:21 +02:00
nicoo
43ee92c40f
factor::numeric: Generalise modular inverse computation
2020-07-05 00:01:21 +02:00
Alex Lyon
9de82d92b0
Merge pull request #1557 from nbraud/factor/issue_1556
...
factor::miller_rabin: Fix bug #1556
2020-06-24 04:53:32 -07:00
Alex Lyon
700d51a92b
Merge pull request #1528 from sylvestre/cp-no-deref
...
feature(cp) implement -P/--no-deference
2020-06-23 23:05:26 -07:00
nicoo
abf579975c
factor::miller_rabin: Fix bug in primality test
...
Introduced in 6b9585b1
(#1525 : Performance improvements for `factor`).
Closes #1556
2020-06-23 16:19:16 +02:00
nicoo
c5c86b00e9
factor::miller_rabin: Add tests reproducing #1556
2020-06-23 16:14:52 +02:00
nicoo
8e040bbf1a
factor::table: Optimise the size of the precomputed table
...
A too-large precomputed table actually slows down the program: we spend
time fetching it from disk and from memory (into the CPU's cache), and
larger prime factors are more unlikely to occur in random integers (prime p
occurs with probability ~1/p when sampling 64b numbers uniformly-at-random)
The new value was chosen after measuring the execution time (for all
integers between 2 and 10⁷) for a broad set of values:
| n | time (s) |
|------|----------|
| 16 | 40.84 |
| 32 | 34.491 |
| 64 | 29.044 |
| 128 | 25.121 |
| 192 | 23.98 |
| 256 | 23.102 |
| 256 | 24.93 |
| 272 | 23.57 |
| 288 | 23.85 |
| 304 | 23.91 |
| 320 | 23.24 |
| 329 | 23.45 |
| 336 | 23.55 |
| 352 | 23.09 |
| 368 | 23.65 |
| 384 | 23.32 |
| 384 | 23.36 |
| 400 | 23.30 |
| 416 | 23.38 |
| 432 | 23.42 |
| 448 | 23.95 |
| 448 | 24.00 |
| 464 | 23.81 |
| 480 | 23.55 |
| 496 | 24.10 |
| 512 | 24.101 |
| 512 | 24.23 |
| 1027 | 29.864 |
2020-06-20 22:22:55 +02:00
nicoo
9d992b77b2
factor: Keep the primes table size in a single place
2020-06-20 22:22:55 +02:00
nicoo
b956e632e1
factor::table: Coalesce accesses to the factors
table
...
~5.6% faster
2020-06-20 22:22:55 +02:00
Sylvestre Ledru
2d62097843
feature(cp): Manage -P & -R
2020-06-20 10:49:15 +02:00
nicoo
0518e06053
factor::rho: Minor refactor for readability
2020-06-20 10:39:56 +02:00
nicoo
dacee413db
factor::rho: Refactor to avoid unnecessary allocations
2020-06-20 10:39:56 +02:00
nicoo
71e1c52920
factor::Factors: Rename new() to one()
2020-06-20 10:39:56 +02:00
Sylvestre Ledru
280fafed8a
feature(cp) implement -P/--no-deference
2020-06-20 09:38:39 +02:00
nicoo
45a1408fb0
fixup! factor: Add test exhibiting a bug in ρ
2020-06-19 15:28:01 +02:00
nicoo
9fe3de72f2
factor::rho: Fix very-unlikely bug (resulting in assertion failure)
...
This bug can only be triggered when:
- the Miller-Rabin test produces a divisor `d` (rare) ;
- n / d is prime.
2020-06-19 13:51:29 +02:00
nicoo
9eb944b6b9
factor: Add test exhibiting a bug in ρ
...
The test is repeated 20 times to make it overwhelmingly-likely to fail
(the bug itself is only triggered rarely)
2020-06-19 13:48:00 +02:00
nicoo
3a90e31307
factor::numeric::inv_mod_u64: Provide a more-helpful error message
2020-06-19 13:39:42 +02:00
nicoo
ef12991ee7
factors: Avoid repeatedly locking and flushing stdout
...
By default, stdout's LineWriter results one syscall per line, i.e. a billion
syscalls when factoring a billion numbers...
Buffering the output yields a ~28% speedup.
2020-06-18 16:45:40 -07:00
nicoo
2869248318
factor::Factors: Use a tree-based map internally
...
This eliminate the need for sorting the prime factors for display.
25% performance improvement after the changes from factor/montgomery.
2020-06-18 16:44:08 -07:00
nicoo
4b4d11b61a
factor: Add/update copyright notices as necessary ( #1546 )
2020-06-18 21:38:28 +02:00
Alex Lyon
6105cce69a
Merge pull request #1529 from nbraud/factor/montgomery
...
factor: Faster modular arithmetic with the Montgomery transform
2020-06-18 09:19:12 -07:00
nicoo
fb08d9ff9e
factor::numeric::Montgomery::add: Deal with rare overflow case
2020-06-18 14:32:58 +02:00
Alex Lyon
e02b8a60f7
hashsum: switch from getopts to clap ( #1542 )
...
* hashsum: switch from getopts to clap
Additionally, slightly refactor. This commit will be the first of
a series of commits refactoring (at the very least) `hashsum`.
2020-06-18 11:46:00 +02:00
Sylvestre Ledru
f17a112781
feature(ln): implement -r ( #1540 )
...
* bump the minimal version of rustc to 1.32
* feature(ln): implement -r
* fix two issues
* Use cow
* rustfmt the change
* with cargo.lock 1.31
* try to unbreak windows
2020-06-18 00:54:18 -07:00
nicoo
d1470dadf8
factor::numeric::gcd: Silence the (erroneous) dead code lint
2020-06-16 15:45:10 +02:00
nicoo
334e02786d
factor: Run cargo fmt
2020-06-16 15:43:25 +02:00
Alex Lyon
8377abadb6
Fix to build on Rust 1.32.0 and formatting
2020-06-16 04:08:17 -05:00
Alex Lyon
110d6844ad
Use an iterator over OsString for uumain()
...
Additionally, restructure `uname` so that we don't need to find the
iterator's length.
2020-06-16 03:28:02 -05:00
nicoo
f1788d9e70
fixup! factor::numeric::Montgomery: Fix overflow bug
2020-06-16 01:17:16 +02:00
nicoo
4851619d62
factor::miller_rabin: Avoid repeatedly transforming 1 and -1
...
Approx. 25% speedup
2020-06-15 23:05:31 +02:00