From 67b07eaaa9297389d7c32abdf61947babad02141 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Mon, 23 Nov 2015 00:00:01 -0500 Subject: [PATCH 001/606] create empty repository for 'uucore' --- .busybox-config | 2 - .gitignore | 14 - .travis.yml | 15 - Cargo.toml | 164 ----- LICENSE | 18 - Makefile | 442 -------------- README.md | 183 ------ appveyor.yml | 33 - build.rs | 61 -- deps/Cargo.toml | 25 - mkmain.rs | 49 -- mkuutils.rs | 63 -- src/base64/Cargo.toml | 13 - src/base64/base64.rs | 162 ----- src/base64/deps.mk | 1 - src/basename/Cargo.toml | 12 - src/basename/basename.rs | 108 ---- src/cat/Cargo.toml | 12 - src/cat/cat.rs | 347 ----------- src/chmod/Cargo.toml | 17 - src/chmod/chmod.rs | 326 ---------- src/chmod/deps.mk | 1 - src/chroot/Cargo.toml | 12 - src/chroot/chroot.rs | 220 ------- src/cksum/Cargo.toml | 12 - src/cksum/cksum.rs | 131 ---- src/cksum/crc_table.rs | 3 - src/cksum/gen_table.rs | 41 -- src/comm/Cargo.toml | 12 - src/comm/comm.rs | 160 ----- src/common/c_types.rs | 240 -------- src/common/filesystem.rs | 147 ----- src/common/parse_time.rs | 35 -- src/common/process.rs | 140 ----- src/common/signals.rs | 158 ----- src/common/util.rs | 219 ------- src/common/utmpx.rs | 126 ---- src/common/wide.rs | 35 -- src/cp/Cargo.toml | 12 - src/cp/cp.rs | 161 ----- src/cut/Cargo.toml | 12 - src/cut/buffer.rs | 151 ----- src/cut/cut.rs | 546 ----------------- src/cut/ranges.rs | 133 ---- src/cut/searcher.rs | 54 -- src/dirname/Cargo.toml | 12 - src/dirname/dirname.rs | 70 --- src/du/Cargo.toml | 13 - src/du/deps.mk | 1 - src/du/du.rs | 398 ------------ src/echo/Cargo.toml | 12 - src/echo/echo.rs | 254 -------- src/env/Cargo.toml | 12 - src/env/env.rs | 207 ------- src/expand/Cargo.toml | 13 - src/expand/deps.mk | 1 - src/expand/expand.rs | 244 -------- src/expr/Cargo.toml | 13 - src/expr/expr.rs | 135 ----- src/expr/syntax_tree.rs | 386 ------------ src/expr/tokens.rs | 160 ----- src/factor/Cargo.toml | 13 - src/factor/deps.mk | 1 - src/factor/factor.rs | 202 ------- src/factor/gen_table.rs | 134 ---- src/factor/numeric.rs | 132 ---- src/factor/prime_table.rs | 532 ---------------- src/factor/sieve.rs | 212 ------- src/false/Cargo.toml | 12 - src/false/false.rs | 14 - src/fmt/Cargo.toml | 13 - src/fmt/deps.mk | 1 - src/fmt/fmt.rs | 221 ------- src/fmt/linebreak.rs | 452 -------------- src/fmt/parasplit.rs | 570 ------------------ src/fold/Cargo.toml | 12 - src/fold/fold.rs | 222 ------- src/groups/Cargo.toml | 12 - src/groups/groups.rs | 52 -- src/hashsum/Cargo.toml | 15 - src/hashsum/deps.mk | 1 - src/hashsum/hashsum.rs | 309 ---------- src/head/Cargo.toml | 12 - src/head/head.rs | 210 ------- src/hostid/Cargo.toml | 12 - src/hostid/hostid.rs | 90 --- src/hostname/Cargo.toml | 12 - src/hostname/hostname.rs | 176 ------ src/id/Cargo.toml | 12 - src/id/id.rs | 397 ------------ src/kill/Cargo.toml | 12 - src/kill/kill.rs | 194 ------ src/link/Cargo.toml | 12 - src/link/link.rs | 66 -- src/ln/Cargo.toml | 12 - src/ln/ln.rs | 333 ---------- src/logname/Cargo.toml | 12 - src/logname/logname.rs | 81 --- src/mkdir/Cargo.toml | 12 - src/mkdir/mkdir.rs | 160 ----- src/mkfifo/Cargo.toml | 12 - src/mkfifo/mkfifo.rs | 79 --- src/mv/Cargo.toml | 12 - src/mv/deps.mk | 1 - src/mv/mv.rs | 358 ----------- src/nice/Cargo.toml | 12 - src/nice/nice.rs | 112 ---- src/nl/Cargo.toml | 16 - src/nl/deps.mk | 1 - src/nl/helper.rs | 121 ---- src/nl/nl.rs | 330 ---------- src/nohup/Cargo.toml | 12 - src/nohup/nohup.rs | 149 ----- src/nproc/Cargo.toml | 13 - src/nproc/deps.mk | 1 - src/nproc/nproc.rs | 87 --- src/od/Cargo.toml | 12 - src/od/od.rs | 126 ---- src/paste/Cargo.toml | 12 - src/paste/paste.rs | 130 ---- src/printenv/Cargo.toml | 12 - src/printenv/printenv.rs | 78 --- src/ptx/Cargo.toml | 16 - src/ptx/deps.mk | 1 - src/ptx/ptx.rs | 564 ----------------- src/pwd/Cargo.toml | 12 - src/pwd/pwd.rs | 53 -- src/readlink/Cargo.toml | 12 - src/readlink/readlink.rs | 140 ----- src/realpath/Cargo.toml | 12 - src/realpath/realpath.rs | 142 ----- src/relpath/Cargo.toml | 12 - src/relpath/relpath.rs | 107 ---- src/rm/Cargo.toml | 12 - src/rm/rm.rs | 292 --------- src/rmdir/Cargo.toml | 12 - src/rmdir/rmdir.rs | 126 ---- src/seq/Cargo.toml | 12 - src/seq/seq.rs | 260 -------- src/shuf/Cargo.toml | 13 - src/shuf/deps.mk | 1 - src/shuf/shuf.rs | 269 --------- src/sleep/Cargo.toml | 12 - src/sleep/sleep.rs | 81 --- src/sort/Cargo.toml | 12 - src/sort/sort.rs | 210 ------- src/split/Cargo.toml | 12 - src/split/README.md | 9 - src/split/deps.mk | 1 - src/split/split.rs | 317 ---------- src/stdbuf/libstdbuf.c | 7 - src/stdbuf/libstdbuf.h | 6 - src/stdbuf/libstdbuf.rs | 57 -- src/stdbuf/stdbuf.rs | 272 --------- src/sum/Cargo.toml | 12 - src/sum/sum.rs | 140 ----- src/sync/Cargo.toml | 12 - src/sync/deps.mk | 1 - src/sync/sync.rs | 146 ----- src/tac/Cargo.toml | 12 - src/tac/tac.rs | 149 ----- src/tail/Cargo.toml | 12 - src/tail/README.md | 16 - src/tail/tail.rs | 300 --------- src/tee/Cargo.toml | 12 - src/tee/tee.rs | 174 ------ src/test/Cargo.toml | 12 - src/test/test.rs | 408 ------------- src/timeout/Cargo.toml | 13 - src/timeout/deps.mk | 1 - src/timeout/timeout.rs | 159 ----- src/touch/Cargo.toml | 14 - src/touch/deps.mk | 1 - src/touch/touch.rs | 211 ------- src/tr/Cargo.toml | 14 - src/tr/deps.mk | 1 - src/tr/expand.rs | 117 ---- src/tr/tr.rs | 164 ----- src/true/Cargo.toml | 12 - src/true/true.rs | 14 - src/truncate/Cargo.toml | 12 - src/truncate/truncate.rs | 215 ------- src/tsort/Cargo.toml | 12 - src/tsort/tsort.rs | 196 ------ src/tty/Cargo.toml | 12 - src/tty/tty.rs | 83 --- src/uname/Cargo.toml | 12 - src/uname/uname.rs | 108 ---- src/unexpand/Cargo.toml | 13 - src/unexpand/deps.mk | 1 - src/unexpand/unexpand.rs | 283 --------- src/uniq/Cargo.toml | 12 - src/uniq/uniq.rs | 242 -------- src/unlink/Cargo.toml | 12 - src/unlink/unlink.rs | 96 --- src/uptime/Cargo.toml | 13 - src/uptime/deps.mk | 1 - src/uptime/uptime.rs | 207 ------- src/users/Cargo.toml | 12 - src/users/users.rs | 122 ---- src/uutils/uutils.rs | 105 ---- src/uutils/uutils_cargo.rs | 99 --- src/wc/Cargo.toml | 12 - src/wc/wc.rs | 284 --------- src/whoami/Cargo.toml | 12 - src/whoami/deps.mk | 1 - src/whoami/platform/mod.rs | 20 - src/whoami/platform/unix.rs | 34 -- src/whoami/platform/windows.rs | 31 - src/whoami/whoami.rs | 65 -- src/yes/Cargo.toml | 12 - src/yes/yes.rs | 63 -- test/base64.rs | 62 -- test/basename.rs | 54 -- test/cat.rs | 60 -- test/cksum.rs | 39 -- test/common/util.rs | 152 ----- test/cp.rs | 35 -- test/cut.rs | 58 -- test/dirname.rs | 28 - test/echo.rs | 50 -- test/env.rs | 74 --- test/factor.rs | 534 ---------------- test/false.rs | 9 - test/fixtures/cat/256.txt | Bin 256 -> 0 bytes test/fixtures/cat/alpha.txt | 5 - test/fixtures/cksum/alice_in_wonderland.txt | 5 - test/fixtures/cksum/lorem_ipsum.txt | 13 - test/fixtures/cksum/multiple_files.expected | 2 - test/fixtures/cksum/single_file.expected | 1 - test/fixtures/cksum/stdin.expected | 1 - test/fixtures/cp/hello_world.txt | 1 - test/fixtures/cut/lists.txt | 4 - .../cut/lists_change_delimiter.expected | 4 - test/fixtures/cut/lists_char_range.expected | 4 - .../cut/lists_column_to_end_of_line.expected | 4 - .../cut/lists_multiple_fields.expected | 4 - test/fixtures/cut/lists_prefix.expected | 4 - .../cut/lists_specific_field.expected | 4 - test/fixtures/cut/lists_tail.expected | 4 - test/fixtures/fold/lorem_ipsum.txt | 1 - .../fold/lorem_ipsum_40_column_hard.expected | 20 - .../fold/lorem_ipsum_40_column_word.expected | 21 - .../fold/lorem_ipsum_80_column.expected | 10 - test/fixtures/hashsum/input.txt | 1 - test/fixtures/hashsum/md5.expected | 1 - test/fixtures/hashsum/sha1.expected | 1 - test/fixtures/hashsum/sha224.expected | 1 - test/fixtures/hashsum/sha256.expected | 1 - test/fixtures/hashsum/sha384.expected | 1 - test/fixtures/hashsum/sha512.expected | 1 - test/fixtures/head/lorem_ipsum.txt | 24 - .../fixtures/head/lorem_ipsum_1_line.expected | 1 - .../head/lorem_ipsum_5_chars.expected | 1 - .../head/lorem_ipsum_default.expected | 10 - .../head/lorem_ipsum_verbose.expected | 11 - test/fixtures/mv/hello_world.txt | 1 - test/fixtures/nl/joinblanklines.txt | 27 - test/fixtures/nl/section.txt | 18 - test/fixtures/nl/simple.txt | 15 - test/fixtures/paste/html_colors.expected | 16 - test/fixtures/paste/html_colors.txt | 32 - ...ext_disabled_ignore_and_only_file.expected | 2 - .../gnu_ext_disabled_roff_auto_ref.expected | 24 - .../gnu_ext_disabled_roff_input_ref.expected | 17 - .../ptx/gnu_ext_disabled_roff_no_ref.expected | 24 - .../gnu_ext_disabled_tex_auto_ref.expected | 24 - .../gnu_ext_disabled_tex_input_ref.expected | 17 - .../ptx/gnu_ext_disabled_tex_no_ref.expected | 24 - test/fixtures/ptx/ignore | 2 - test/fixtures/ptx/input | 7 - test/fixtures/ptx/only | 5 - test/fixtures/sort/human1.ans | 11 - test/fixtures/sort/human1.txt | 11 - test/fixtures/sort/numeric1.ans | 2 - test/fixtures/sort/numeric1.txt | 2 - test/fixtures/sort/numeric2.ans | 2 - test/fixtures/sort/numeric2.txt | 2 - test/fixtures/sort/numeric3.ans | 2 - test/fixtures/sort/numeric3.txt | 2 - test/fixtures/sort/numeric4.ans | 2 - test/fixtures/sort/numeric4.txt | 2 - test/fixtures/sort/numeric5.ans | 2 - test/fixtures/sort/numeric5.txt | 2 - test/fixtures/sort/numeric6.ans | 100 --- test/fixtures/sort/numeric6.txt | 100 --- test/fixtures/sum/alice_in_wonderland.txt | 5 - test/fixtures/sum/bsd_multiple_files.expected | 2 - test/fixtures/sum/bsd_single_file.expected | 1 - test/fixtures/sum/bsd_stdin.expected | 1 - test/fixtures/sum/lorem_ipsum.txt | 13 - .../fixtures/sum/sysv_multiple_files.expected | 2 - test/fixtures/sum/sysv_single_file.expected | 1 - test/fixtures/sum/sysv_stdin.expected | 1 - test/fixtures/tac/delimited_primes.expected | 1 - test/fixtures/tac/delimited_primes.txt | 1 - .../tac/delimited_primes_before.expected | 1 - test/fixtures/tac/prime_per_line.expected | 25 - test/fixtures/tac/prime_per_line.txt | 25 - test/fixtures/tsort/call_graph.expected | 17 - test/fixtures/tsort/call_graph.txt | 22 - test/fixtures/wc/alice_in_wonderland.txt | 5 - test/fixtures/wc/lorem_ipsum.txt | 13 - test/fixtures/wc/moby_dick.txt | 18 - test/fold.rs | 53 -- test/hashsum.rs | 47 -- test/head.rs | 72 --- test/link.rs | 49 -- test/ln.rs | 354 ----------- test/mkdir.rs | 58 -- test/mv.rs | 446 -------------- test/nl.rs | 53 -- test/paste.rs | 27 - test/ptx.rs | 58 -- test/pwd.rs | 16 - test/readlink.rs | 80 --- test/realpath.rs | 46 -- test/rm.rs | 140 ----- test/rmdir.rs | 114 ---- test/seq.rs | 32 - test/sort.rs | 65 -- test/split.rs | 160 ----- test/stdbuf.rs | 16 - test/sum.rs | 70 --- test/tac.rs | 50 -- test/test.rs | 37 -- test/touch.rs | 258 -------- test/tr.rs | 43 -- test/true.rs | 9 - test/truncate.rs | 41 -- test/tsort.rs | 21 - test/unexpand.rs | 115 ---- test/unlink.rs | 59 -- test/wc.rs | 57 -- 334 files changed, 25603 deletions(-) delete mode 100644 .busybox-config delete mode 100644 .gitignore delete mode 100644 .travis.yml delete mode 100644 Cargo.toml delete mode 100644 LICENSE delete mode 100644 Makefile delete mode 100644 README.md delete mode 100644 appveyor.yml delete mode 100644 build.rs delete mode 100644 deps/Cargo.toml delete mode 100644 mkmain.rs delete mode 100644 mkuutils.rs delete mode 100644 src/base64/Cargo.toml delete mode 100644 src/base64/base64.rs delete mode 100644 src/base64/deps.mk delete mode 100644 src/basename/Cargo.toml delete mode 100644 src/basename/basename.rs delete mode 100644 src/cat/Cargo.toml delete mode 100644 src/cat/cat.rs delete mode 100644 src/chmod/Cargo.toml delete mode 100644 src/chmod/chmod.rs delete mode 100644 src/chmod/deps.mk delete mode 100644 src/chroot/Cargo.toml delete mode 100644 src/chroot/chroot.rs delete mode 100644 src/cksum/Cargo.toml delete mode 100644 src/cksum/cksum.rs delete mode 100644 src/cksum/crc_table.rs delete mode 100644 src/cksum/gen_table.rs delete mode 100644 src/comm/Cargo.toml delete mode 100644 src/comm/comm.rs delete mode 100644 src/common/c_types.rs delete mode 100644 src/common/filesystem.rs delete mode 100644 src/common/parse_time.rs delete mode 100644 src/common/process.rs delete mode 100644 src/common/signals.rs delete mode 100644 src/common/util.rs delete mode 100644 src/common/utmpx.rs delete mode 100644 src/common/wide.rs delete mode 100644 src/cp/Cargo.toml delete mode 100644 src/cp/cp.rs delete mode 100644 src/cut/Cargo.toml delete mode 100644 src/cut/buffer.rs delete mode 100644 src/cut/cut.rs delete mode 100644 src/cut/ranges.rs delete mode 100644 src/cut/searcher.rs delete mode 100644 src/dirname/Cargo.toml delete mode 100644 src/dirname/dirname.rs delete mode 100644 src/du/Cargo.toml delete mode 100644 src/du/deps.mk delete mode 100644 src/du/du.rs delete mode 100644 src/echo/Cargo.toml delete mode 100644 src/echo/echo.rs delete mode 100644 src/env/Cargo.toml delete mode 100644 src/env/env.rs delete mode 100644 src/expand/Cargo.toml delete mode 100644 src/expand/deps.mk delete mode 100644 src/expand/expand.rs delete mode 100644 src/expr/Cargo.toml delete mode 100644 src/expr/expr.rs delete mode 100644 src/expr/syntax_tree.rs delete mode 100644 src/expr/tokens.rs delete mode 100644 src/factor/Cargo.toml delete mode 100644 src/factor/deps.mk delete mode 100644 src/factor/factor.rs delete mode 100644 src/factor/gen_table.rs delete mode 100644 src/factor/numeric.rs delete mode 100644 src/factor/prime_table.rs delete mode 100644 src/factor/sieve.rs delete mode 100644 src/false/Cargo.toml delete mode 100644 src/false/false.rs delete mode 100644 src/fmt/Cargo.toml delete mode 100644 src/fmt/deps.mk delete mode 100644 src/fmt/fmt.rs delete mode 100644 src/fmt/linebreak.rs delete mode 100644 src/fmt/parasplit.rs delete mode 100644 src/fold/Cargo.toml delete mode 100644 src/fold/fold.rs delete mode 100644 src/groups/Cargo.toml delete mode 100644 src/groups/groups.rs delete mode 100644 src/hashsum/Cargo.toml delete mode 100644 src/hashsum/deps.mk delete mode 100644 src/hashsum/hashsum.rs delete mode 100644 src/head/Cargo.toml delete mode 100644 src/head/head.rs delete mode 100644 src/hostid/Cargo.toml delete mode 100644 src/hostid/hostid.rs delete mode 100644 src/hostname/Cargo.toml delete mode 100644 src/hostname/hostname.rs delete mode 100644 src/id/Cargo.toml delete mode 100644 src/id/id.rs delete mode 100644 src/kill/Cargo.toml delete mode 100644 src/kill/kill.rs delete mode 100644 src/link/Cargo.toml delete mode 100644 src/link/link.rs delete mode 100644 src/ln/Cargo.toml delete mode 100644 src/ln/ln.rs delete mode 100644 src/logname/Cargo.toml delete mode 100644 src/logname/logname.rs delete mode 100644 src/mkdir/Cargo.toml delete mode 100644 src/mkdir/mkdir.rs delete mode 100644 src/mkfifo/Cargo.toml delete mode 100644 src/mkfifo/mkfifo.rs delete mode 100644 src/mv/Cargo.toml delete mode 100644 src/mv/deps.mk delete mode 100644 src/mv/mv.rs delete mode 100644 src/nice/Cargo.toml delete mode 100644 src/nice/nice.rs delete mode 100644 src/nl/Cargo.toml delete mode 100644 src/nl/deps.mk delete mode 100644 src/nl/helper.rs delete mode 100644 src/nl/nl.rs delete mode 100644 src/nohup/Cargo.toml delete mode 100644 src/nohup/nohup.rs delete mode 100644 src/nproc/Cargo.toml delete mode 100644 src/nproc/deps.mk delete mode 100644 src/nproc/nproc.rs delete mode 100644 src/od/Cargo.toml delete mode 100644 src/od/od.rs delete mode 100644 src/paste/Cargo.toml delete mode 100644 src/paste/paste.rs delete mode 100644 src/printenv/Cargo.toml delete mode 100644 src/printenv/printenv.rs delete mode 100644 src/ptx/Cargo.toml delete mode 100644 src/ptx/deps.mk delete mode 100644 src/ptx/ptx.rs delete mode 100644 src/pwd/Cargo.toml delete mode 100644 src/pwd/pwd.rs delete mode 100644 src/readlink/Cargo.toml delete mode 100644 src/readlink/readlink.rs delete mode 100644 src/realpath/Cargo.toml delete mode 100644 src/realpath/realpath.rs delete mode 100644 src/relpath/Cargo.toml delete mode 100644 src/relpath/relpath.rs delete mode 100644 src/rm/Cargo.toml delete mode 100644 src/rm/rm.rs delete mode 100644 src/rmdir/Cargo.toml delete mode 100644 src/rmdir/rmdir.rs delete mode 100644 src/seq/Cargo.toml delete mode 100644 src/seq/seq.rs delete mode 100644 src/shuf/Cargo.toml delete mode 100644 src/shuf/deps.mk delete mode 100644 src/shuf/shuf.rs delete mode 100644 src/sleep/Cargo.toml delete mode 100644 src/sleep/sleep.rs delete mode 100644 src/sort/Cargo.toml delete mode 100644 src/sort/sort.rs delete mode 100644 src/split/Cargo.toml delete mode 100644 src/split/README.md delete mode 100644 src/split/deps.mk delete mode 100644 src/split/split.rs delete mode 100644 src/stdbuf/libstdbuf.c delete mode 100644 src/stdbuf/libstdbuf.h delete mode 100644 src/stdbuf/libstdbuf.rs delete mode 100644 src/stdbuf/stdbuf.rs delete mode 100644 src/sum/Cargo.toml delete mode 100644 src/sum/sum.rs delete mode 100644 src/sync/Cargo.toml delete mode 100644 src/sync/deps.mk delete mode 100644 src/sync/sync.rs delete mode 100644 src/tac/Cargo.toml delete mode 100644 src/tac/tac.rs delete mode 100644 src/tail/Cargo.toml delete mode 100644 src/tail/README.md delete mode 100644 src/tail/tail.rs delete mode 100644 src/tee/Cargo.toml delete mode 100644 src/tee/tee.rs delete mode 100644 src/test/Cargo.toml delete mode 100644 src/test/test.rs delete mode 100644 src/timeout/Cargo.toml delete mode 100644 src/timeout/deps.mk delete mode 100644 src/timeout/timeout.rs delete mode 100644 src/touch/Cargo.toml delete mode 100644 src/touch/deps.mk delete mode 100644 src/touch/touch.rs delete mode 100644 src/tr/Cargo.toml delete mode 100644 src/tr/deps.mk delete mode 100644 src/tr/expand.rs delete mode 100644 src/tr/tr.rs delete mode 100644 src/true/Cargo.toml delete mode 100644 src/true/true.rs delete mode 100644 src/truncate/Cargo.toml delete mode 100644 src/truncate/truncate.rs delete mode 100644 src/tsort/Cargo.toml delete mode 100644 src/tsort/tsort.rs delete mode 100644 src/tty/Cargo.toml delete mode 100644 src/tty/tty.rs delete mode 100644 src/uname/Cargo.toml delete mode 100644 src/uname/uname.rs delete mode 100644 src/unexpand/Cargo.toml delete mode 100644 src/unexpand/deps.mk delete mode 100644 src/unexpand/unexpand.rs delete mode 100644 src/uniq/Cargo.toml delete mode 100644 src/uniq/uniq.rs delete mode 100644 src/unlink/Cargo.toml delete mode 100644 src/unlink/unlink.rs delete mode 100644 src/uptime/Cargo.toml delete mode 100644 src/uptime/deps.mk delete mode 100644 src/uptime/uptime.rs delete mode 100644 src/users/Cargo.toml delete mode 100644 src/users/users.rs delete mode 100644 src/uutils/uutils.rs delete mode 100644 src/uutils/uutils_cargo.rs delete mode 100644 src/wc/Cargo.toml delete mode 100644 src/wc/wc.rs delete mode 100644 src/whoami/Cargo.toml delete mode 100644 src/whoami/deps.mk delete mode 100644 src/whoami/platform/mod.rs delete mode 100644 src/whoami/platform/unix.rs delete mode 100644 src/whoami/platform/windows.rs delete mode 100644 src/whoami/whoami.rs delete mode 100644 src/yes/Cargo.toml delete mode 100644 src/yes/yes.rs delete mode 100644 test/base64.rs delete mode 100644 test/basename.rs delete mode 100644 test/cat.rs delete mode 100644 test/cksum.rs delete mode 100644 test/common/util.rs delete mode 100644 test/cp.rs delete mode 100644 test/cut.rs delete mode 100644 test/dirname.rs delete mode 100644 test/echo.rs delete mode 100644 test/env.rs delete mode 100644 test/factor.rs delete mode 100644 test/false.rs delete mode 100644 test/fixtures/cat/256.txt delete mode 100644 test/fixtures/cat/alpha.txt delete mode 100644 test/fixtures/cksum/alice_in_wonderland.txt delete mode 100644 test/fixtures/cksum/lorem_ipsum.txt delete mode 100644 test/fixtures/cksum/multiple_files.expected delete mode 100644 test/fixtures/cksum/single_file.expected delete mode 100644 test/fixtures/cksum/stdin.expected delete mode 100644 test/fixtures/cp/hello_world.txt delete mode 100644 test/fixtures/cut/lists.txt delete mode 100644 test/fixtures/cut/lists_change_delimiter.expected delete mode 100644 test/fixtures/cut/lists_char_range.expected delete mode 100644 test/fixtures/cut/lists_column_to_end_of_line.expected delete mode 100644 test/fixtures/cut/lists_multiple_fields.expected delete mode 100644 test/fixtures/cut/lists_prefix.expected delete mode 100644 test/fixtures/cut/lists_specific_field.expected delete mode 100644 test/fixtures/cut/lists_tail.expected delete mode 100644 test/fixtures/fold/lorem_ipsum.txt delete mode 100644 test/fixtures/fold/lorem_ipsum_40_column_hard.expected delete mode 100644 test/fixtures/fold/lorem_ipsum_40_column_word.expected delete mode 100644 test/fixtures/fold/lorem_ipsum_80_column.expected delete mode 100644 test/fixtures/hashsum/input.txt delete mode 100644 test/fixtures/hashsum/md5.expected delete mode 100644 test/fixtures/hashsum/sha1.expected delete mode 100644 test/fixtures/hashsum/sha224.expected delete mode 100644 test/fixtures/hashsum/sha256.expected delete mode 100644 test/fixtures/hashsum/sha384.expected delete mode 100644 test/fixtures/hashsum/sha512.expected delete mode 100644 test/fixtures/head/lorem_ipsum.txt delete mode 100644 test/fixtures/head/lorem_ipsum_1_line.expected delete mode 100644 test/fixtures/head/lorem_ipsum_5_chars.expected delete mode 100644 test/fixtures/head/lorem_ipsum_default.expected delete mode 100644 test/fixtures/head/lorem_ipsum_verbose.expected delete mode 100644 test/fixtures/mv/hello_world.txt delete mode 100644 test/fixtures/nl/joinblanklines.txt delete mode 100644 test/fixtures/nl/section.txt delete mode 100644 test/fixtures/nl/simple.txt delete mode 100644 test/fixtures/paste/html_colors.expected delete mode 100644 test/fixtures/paste/html_colors.txt delete mode 100644 test/fixtures/ptx/gnu_ext_disabled_ignore_and_only_file.expected delete mode 100644 test/fixtures/ptx/gnu_ext_disabled_roff_auto_ref.expected delete mode 100644 test/fixtures/ptx/gnu_ext_disabled_roff_input_ref.expected delete mode 100644 test/fixtures/ptx/gnu_ext_disabled_roff_no_ref.expected delete mode 100644 test/fixtures/ptx/gnu_ext_disabled_tex_auto_ref.expected delete mode 100644 test/fixtures/ptx/gnu_ext_disabled_tex_input_ref.expected delete mode 100644 test/fixtures/ptx/gnu_ext_disabled_tex_no_ref.expected delete mode 100644 test/fixtures/ptx/ignore delete mode 100644 test/fixtures/ptx/input delete mode 100644 test/fixtures/ptx/only delete mode 100644 test/fixtures/sort/human1.ans delete mode 100644 test/fixtures/sort/human1.txt delete mode 100644 test/fixtures/sort/numeric1.ans delete mode 100644 test/fixtures/sort/numeric1.txt delete mode 100644 test/fixtures/sort/numeric2.ans delete mode 100644 test/fixtures/sort/numeric2.txt delete mode 100644 test/fixtures/sort/numeric3.ans delete mode 100644 test/fixtures/sort/numeric3.txt delete mode 100644 test/fixtures/sort/numeric4.ans delete mode 100644 test/fixtures/sort/numeric4.txt delete mode 100644 test/fixtures/sort/numeric5.ans delete mode 100644 test/fixtures/sort/numeric5.txt delete mode 100644 test/fixtures/sort/numeric6.ans delete mode 100644 test/fixtures/sort/numeric6.txt delete mode 100644 test/fixtures/sum/alice_in_wonderland.txt delete mode 100644 test/fixtures/sum/bsd_multiple_files.expected delete mode 100644 test/fixtures/sum/bsd_single_file.expected delete mode 100644 test/fixtures/sum/bsd_stdin.expected delete mode 100644 test/fixtures/sum/lorem_ipsum.txt delete mode 100644 test/fixtures/sum/sysv_multiple_files.expected delete mode 100644 test/fixtures/sum/sysv_single_file.expected delete mode 100644 test/fixtures/sum/sysv_stdin.expected delete mode 100644 test/fixtures/tac/delimited_primes.expected delete mode 100644 test/fixtures/tac/delimited_primes.txt delete mode 100644 test/fixtures/tac/delimited_primes_before.expected delete mode 100644 test/fixtures/tac/prime_per_line.expected delete mode 100644 test/fixtures/tac/prime_per_line.txt delete mode 100644 test/fixtures/tsort/call_graph.expected delete mode 100644 test/fixtures/tsort/call_graph.txt delete mode 100644 test/fixtures/wc/alice_in_wonderland.txt delete mode 100644 test/fixtures/wc/lorem_ipsum.txt delete mode 100644 test/fixtures/wc/moby_dick.txt delete mode 100644 test/fold.rs delete mode 100644 test/hashsum.rs delete mode 100644 test/head.rs delete mode 100644 test/link.rs delete mode 100644 test/ln.rs delete mode 100644 test/mkdir.rs delete mode 100644 test/mv.rs delete mode 100644 test/nl.rs delete mode 100644 test/paste.rs delete mode 100644 test/ptx.rs delete mode 100644 test/pwd.rs delete mode 100644 test/readlink.rs delete mode 100644 test/realpath.rs delete mode 100644 test/rm.rs delete mode 100644 test/rmdir.rs delete mode 100644 test/seq.rs delete mode 100644 test/sort.rs delete mode 100644 test/split.rs delete mode 100644 test/stdbuf.rs delete mode 100644 test/sum.rs delete mode 100644 test/tac.rs delete mode 100644 test/test.rs delete mode 100644 test/touch.rs delete mode 100644 test/tr.rs delete mode 100644 test/true.rs delete mode 100644 test/truncate.rs delete mode 100644 test/tsort.rs delete mode 100644 test/unexpand.rs delete mode 100644 test/unlink.rs delete mode 100644 test/wc.rs diff --git a/.busybox-config b/.busybox-config deleted file mode 100644 index d1fb62794..000000000 --- a/.busybox-config +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_FEATURE_FANCY_HEAD=y -CONFIG_UNICODE_SUPPORT=y diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 65b62036a..000000000 --- a/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -/src/*/gen_table -/build/ -/target/ -/tmp/ -/busybox/ -/deps/regex/ -/deps/rust-crypto/ -/deps/target/ -/deps/time/ -*~ -.*.swp -.*.swo -Cargo.lock -lib*.a diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3bde18d3a..000000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: rust -rust: - - stable - - beta - - nightly -sudo: false -script: - - make - - make test - - make build-check - - make test-check -matrix: - allow_failures: - - rust: stable - - rust: beta diff --git a/Cargo.toml b/Cargo.toml deleted file mode 100644 index d976558a0..000000000 --- a/Cargo.toml +++ /dev/null @@ -1,164 +0,0 @@ -[package] -name = "uutils" -version = "0.0.1" -authors = [] -build = "build.rs" - -[features] -default = ["all"] -all = [ - "base64", - "basename", - "cat", - "chmod", - "chroot", - "cksum", - "comm", - "cp", - "cut", - "dirname", - "du", - "echo", - "env", - "expand", - "expr", - "factor", - "false", - "fmt", - "fold", - "groups", - "hashsum", - "head", - "hostid", - "hostname", - "id", - "kill", - "link", - "ln", - "logname", - "mkdir", - "mkfifo", - "mv", - "nice", - "nl", - "nohup", - "nproc", - "od", - "paste", - "printenv", - "ptx", - "pwd", - "readlink", - "realpath", - "relpath", - "rm", - "rmdir", - "seq", - "shuf", - "sleep", - "sort", - "split", - "sum", - "sync", - "tac", - "tail", - "tee", - "test", - "timeout", - "touch", - "tr", - "true", - "truncate", - "tsort", - "tty", - "uname", - "unexpand", - "uniq", - "unlink", - "uptime", - "users", - "wc", - "whoami", - "yes", -] - -[dependencies] -base64 = { optional=true, path="src/base64" } -basename = { optional=true, path="src/basename" } -cat = { optional=true, path="src/cat" } -chmod = { optional=true, path="src/chmod" } -chroot = { optional=true, path="src/chroot" } -cksum = { optional=true, path="src/cksum" } -comm = { optional=true, path="src/comm" } -cp = { optional=true, path="src/cp" } -cut = { optional=true, path="src/cut" } -dirname = { optional=true, path="src/dirname" } -du = { optional=true, path="src/du" } -echo = { optional=true, path="src/echo" } -env = { optional=true, path="src/env" } -expand = { optional=true, path="src/expand" } -expr = { optional=true, path="src/expr" } -factor = { optional=true, path="src/factor" } -false = { optional=true, path="src/false" } -fmt = { optional=true, path="src/fmt" } -fold = { optional=true, path="src/fold" } -groups = { optional=true, path="src/groups" } -hashsum = { optional=true, path="src/hashsum" } -head = { optional=true, path="src/head" } -hostid = { optional=true, path="src/hostid" } -hostname = { optional=true, path="src/hostname" } -id = { optional=true, path="src/id" } -kill = { optional=true, path="src/kill" } -link = { optional=true, path="src/link" } -ln = { optional=true, path="src/ln" } -logname = { optional=true, path="src/logname" } -mkdir = { optional=true, path="src/mkdir" } -mkfifo = { optional=true, path="src/mkfifo" } -mv = { optional=true, path="src/mv" } -nice = { optional=true, path="src/nice" } -nl = { optional=true, path="src/nl" } -nohup = { optional=true, path="src/nohup" } -nproc = { optional=true, path="src/nproc" } -od = { optional=true, path="src/od" } -paste = { optional=true, path="src/paste" } -printenv = { optional=true, path="src/printenv" } -ptx = { optional=true, path="src/ptx" } -pwd = { optional=true, path="src/pwd" } -readlink = { optional=true, path="src/readlink" } -realpath = { optional=true, path="src/realpath" } -relpath = { optional=true, path="src/relpath" } -rm = { optional=true, path="src/rm" } -rmdir = { optional=true, path="src/rmdir" } -seq = { optional=true, path="src/seq" } -shuf = { optional=true, path="src/shuf" } -sleep = { optional=true, path="src/sleep" } -sort = { optional=true, path="src/sort" } -split = { optional=true, path="src/split" } -sum = { optional=true, path="src/sum" } -sync = { optional=true, path="src/sync" } -tac = { optional=true, path="src/tac" } -tail = { optional=true, path="src/tail" } -tee = { optional=true, path="src/tee" } -test = { optional=true, path="src/test" } -timeout = { optional=true, path="src/timeout" } -touch = { optional=true, path="src/touch" } -tr = { optional=true, path="src/tr" } -true = { optional=true, path="src/true" } -truncate = { optional=true, path="src/truncate" } -tsort = { optional=true, path="src/tsort" } -tty = { optional=true, path="src/tty" } -uname = { optional=true, path="src/uname" } -unexpand = { optional=true, path="src/unexpand" } -uniq = { optional=true, path="src/uniq" } -unlink = { optional=true, path="src/unlink" } -uptime = { optional=true, path="src/uptime" } -users = { optional=true, path="src/users" } -wc = { optional=true, path="src/wc" } -whoami = { optional=true, path="src/whoami" } -yes = { optional=true, path="src/yes" } - - -[[bin]] -name="uutils" -path="src/uutils/uutils_cargo.rs" - diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 0177c4ab7..000000000 --- a/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -Copyright (c) Jordi Boggiano - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Makefile b/Makefile deleted file mode 100644 index c97bcd906..000000000 --- a/Makefile +++ /dev/null @@ -1,442 +0,0 @@ -# Config options -ENABLE_LTO ?= n -ENABLE_STRIP ?= n - -# Binaries -RUSTC ?= rustc -CARGO ?= cargo -CC ?= gcc -RM := rm - -# Install directories -PREFIX ?= /usr/local -BINDIR ?= /bin -LIBDIR ?= /lib - -# This won't support any directory with spaces in its name, but you can just -# make a symlink without spaces that points to the directory. -BASEDIR ?= $(shell pwd) -SRCDIR := $(BASEDIR)/src -BUILDDIR := $(BASEDIR)/build -TESTDIR := $(BASEDIR)/test -TEMPDIR := $(BASEDIR)/tmp - -# Flags -RUSTCFLAGS := -O -RMFLAGS := - -RUSTCLIBFLAGS := $(RUSTCFLAGS) -L $(BUILDDIR)/ -RUSTCTESTFLAGS := $(RUSTCFLAGS) - -# Handle config setup -ifeq ($(ENABLE_LTO),y) -RUSTCBINFLAGS := $(RUSTCLIBFLAGS) -C lto -else -RUSTCBINFLAGS := $(RUSTCLIBFLAGS) -endif - -ifneq ($(ENABLE_STRIP),y) -ENABLE_STRIP := -endif - -# Possible programs -PROGS := \ - base64 \ - basename \ - cat \ - chmod \ - cksum \ - comm \ - cp \ - cut \ - dirname \ - echo \ - env \ - expand \ - expr \ - factor \ - false \ - fmt \ - fold \ - link \ - hashsum \ - ln \ - mkdir \ - nl \ - nproc \ - od \ - paste \ - printenv \ - ptx \ - pwd \ - readlink \ - realpath \ - relpath \ - rm \ - rmdir \ - sleep \ - split \ - seq \ - shuf \ - sort \ - sum \ - sync \ - tac \ - tee \ - test \ - tr \ - true \ - truncate \ - tsort \ - unexpand \ - uniq \ - wc \ - yes \ - head \ - tail \ - whoami - -UNIX_PROGS := \ - chroot \ - du \ - groups \ - hostid \ - hostname \ - id \ - kill \ - logname \ - mkfifo \ - mv \ - nice \ - nohup \ - stdbuf \ - timeout \ - touch \ - tty \ - uname \ - unlink \ - uptime \ - users - -ifneq ($(OS),Windows_NT) - PROGS := $(PROGS) $(UNIX_PROGS) -endif - -ALIASES := \ - hashsum:md5sum \ - hashsum:sha1sum \ - hashsum:sha224sum \ - hashsum:sha256sum \ - hashsum:sha384sum \ - hashsum:sha512sum - -BUILD ?= $(PROGS) - -# Output names -EXES := \ - $(sort $(filter $(BUILD),$(filter-out $(DONT_BUILD),$(PROGS)))) - -CRATE_RLIBS := - -INSTALL ?= $(EXES) - -INSTALLEES := \ - $(filter $(INSTALL),$(filter-out $(DONT_INSTALL),$(EXES) uutils)) - -# Shared library extension -SYSTEM := $(shell uname) -DYLIB_EXT := -ifeq ($(SYSTEM),Linux) - DYLIB_EXT := so - DYLIB_FLAGS := -shared -endif -ifeq ($(SYSTEM),Darwin) - DYLIB_EXT := dylib - DYLIB_FLAGS := -dynamiclib -undefined dynamic_lookup -endif - -# Libaries to install -LIBS := -ifneq (,$(findstring stdbuf, $(INSTALLEES))) -LIBS += libstdbuf.$(DYLIB_EXT) -endif - -# Programs with usable tests -TEST_PROGS := \ - base64 \ - basename \ - cat \ - cksum \ - cp \ - cut \ - env \ - dirname \ - echo \ - factor \ - false \ - fold \ - hashsum \ - head \ - link \ - ln \ - mkdir \ - mv \ - nl \ - paste \ - ptx \ - pwd \ - readlink \ - realpath \ - rm \ - rmdir \ - seq \ - sort \ - split \ - stdbuf \ - sum \ - tac \ - test \ - touch \ - tr \ - true \ - truncate \ - tsort \ - unlink \ - unexpand \ - wc - -TEST ?= $(TEST_PROGS) - -TESTS := \ - $(filter $(TEST),$(filter-out $(DONT_TEST),$(filter $(BUILD),$(filter-out $(DONT_BUILD),$(TEST_PROGS))))) - -# figure out what dependencies we need based on which programs we're building -define DEP_INCLUDE --include $(SRCDIR)/$(1)/deps.mk -endef -# we always depend on libc because common/util does -# we also depend on getopts since all utilities support command-line arguments -DEPLIBS := libc getopts -DEPPLUGS := -# now, add in deps in src/utilname/deps.mk -# if we're testing, only consider the TESTS variable, -# otherwise consider the EXES variable -ifeq ($(MAKECMDGOALS),test) -$(foreach build,$(TESTS),$(eval $(call DEP_INCLUDE,$(build)))) -else -$(foreach build,$(sort $(TESTS) $(EXES)),$(eval $(call DEP_INCLUDE,$(build)))) -endif -# uniqify deps -DEPLIBS := $(sort $(DEPLIBS)) -DEPPLUGS := $(sort $(DEPPLUGS)) -# build --extern commandline for rustc -DEP_EXTERN := $(foreach lib,$(subst -,_,$(DEPLIBS)),--extern $(lib)=$(BUILDDIR)/lib$(lib).rlib) -DEP_EXTERN += $(foreach plug,$(subst -,_,$(DEPPLUGS)),--extern $(plug)=$(BUILDDIR)/lib$(plug).$(DYLIB_EXT)) - -# Setup for building crates -define BUILD_SETUP -X := $(shell $(RUSTC) --print file-names --crate-type rlib $(SRCDIR)/$(1)/$(1).rs) -$(1)_RLIB := $$(X) -CRATE_RLIBS += $$(X) -endef -$(foreach crate,$(EXES),$(eval $(call BUILD_SETUP,$(crate)))) - -# Utils stuff -EXES_PATHS := $(addprefix $(BUILDDIR)/,$(EXES)) -RLIB_PATHS := $(addprefix $(BUILDDIR)/,$(CRATE_RLIBS)) -command = sh -c '$(1)' -RESERVED_EXTERNS := --extern uufalse=$(BUILDDIR)/libfalse.rlib --extern uutrue=$(BUILDDIR)/libtrue.rlib --extern uutest=$(BUILDDIR)/libtest.rlib - -# Main exe build rule -define EXE_BUILD -$(BUILDDIR)/gen/$(1).rs: $(BUILDDIR)/mkmain - $(BUILDDIR)/mkmain $(1) $$@ - -$(BUILDDIR)/$(1): $(BUILDDIR)/gen/$(1).rs $(BUILDDIR)/$($(1)_RLIB) | $(BUILDDIR) deps - $(RUSTC) $(RUSTCBINFLAGS) $(RESERVED_EXTERNS) -o $$@ $$< - $(if $(ENABLE_STRIP),strip $$@,) -endef - -# GRRR rust-crypto makes a crate called "crypto". -# This should NOT be allowed by crates.io. GRRRR. -define DEP_BUILD -DEP_$(1): -ifeq ($(1),crypto) - cd $(BASEDIR)/deps && $(CARGO) build --package rust-crypto --release -else ifeq ($(1),kernel32) - cd $(BASEDIR)/deps && $(CARGO) build --package kernel32-sys --release -else ifeq ($(1),advapi32) - cd $(BASEDIR)/deps && $(CARGO) build --package advapi32-sys --release -else - cd $(BASEDIR)/deps && $(CARGO) build --package $(1) --release -endif -endef - -define CRATE_BUILD --include $(BUILDDIR)/$(1).d - -$(BUILDDIR)/$($(1)_RLIB): $(SRCDIR)/$(1)/$(1).rs | $(BUILDDIR) deps - $(RUSTC) $(RUSTCLIBFLAGS) $(DEP_EXTERN) --crate-type rlib --emit link,dep-info $$< --out-dir $(BUILDDIR) -endef - -# Aliases build rule -ALIAS_SOURCE = $(firstword $(subst :, ,$(1))) -ALIAS_TARGET = $(word 2,$(subst :, ,$(1))) -define MAKE_ALIAS - -ifneq ($(ALIAS_TARGET,$(1)),) -all: $(BUILDDIR)/$(call ALIAS_TARGET,$(1)) -$(BUILDDIR)/$(call ALIAS_TARGET,$(1)): $(BUILDDIR)/$(call ALIAS_SOURCE,$(1)) - $(call command,install $$@ $$<) -endif - -endef - -# Test exe built rules -define TEST_BUILD -test_$(1): $(BUILDDIR)/$(1) $(TEMPDIR)/$(1)/$(1)_test - $(call command,cp $(BUILDDIR)/$(1) $(TEMPDIR)/$(1) && cd $(TEMPDIR)/$(1) && $(TEMPDIR)/$(1)/$(1)_test) - -$(TEMPDIR)/$(1)/$(1)_test: $(TESTDIR)/$(1).rs | $(TEMPDIR)/$(1) - $(call command,$(RUSTC) $(RUSTCTESTFLAGS) $(DEP_EXTERN) --test -o $$@ $$<) - -$(TEMPDIR)/$(1): | $(TEMPDIR) - $(call command,cp -r $(TESTDIR)/fixtures/$(1) $$@ || mkdir $$@) -endef - -# Main rules -all: $(EXES_PATHS) $(BUILDDIR)/uutils - -# Creating necessary rules for each targets -$(foreach crate,$(EXES),$(eval $(call CRATE_BUILD,$(crate)))) -$(foreach exe,$(EXES),$(eval $(call EXE_BUILD,$(exe)))) -$(foreach alias,$(ALIASES),$(eval $(call MAKE_ALIAS,$(alias)))) -$(foreach test,$(TESTS),$(eval $(call TEST_BUILD,$(test)))) -$(foreach dep,$(sort $(DEPLIBS) $(DEPPLUGS)),$(eval $(call DEP_BUILD,$(dep)))) - --include $(BUILDDIR)/uutils.d -$(BUILDDIR)/uutils: $(SRCDIR)/uutils/uutils.rs $(BUILDDIR)/mkuutils $(RLIB_PATHS) - $(BUILDDIR)/mkuutils $(BUILDDIR)/gen/uutils.rs $(EXES) - $(RUSTC) $(RUSTCBINFLAGS) $(RESERVED_EXTERNS) --emit link,dep-info $(BUILDDIR)/gen/uutils.rs --out-dir $(BUILDDIR) - $(if $(ENABLE_STRIP),strip $@) - -# Library for stdbuf -$(BUILDDIR)/libstdbuf.$(DYLIB_EXT): $(SRCDIR)/stdbuf/libstdbuf.rs $(SRCDIR)/stdbuf/libstdbuf.c $(SRCDIR)/stdbuf/libstdbuf.h | $(BUILDDIR) - cd $(SRCDIR)/stdbuf && \ - $(RUSTC) libstdbuf.rs --extern libc=$(BUILDDIR)/liblibc.rlib && \ - $(CC) -c -Wall -Werror -fPIC libstdbuf.c && \ - $(CC) $(DYLIB_FLAGS) -o libstdbuf.$(DYLIB_EXT) liblibstdbuf.a libstdbuf.o && \ - mv *.$(DYLIB_EXT) $(BUILDDIR) && $(RM) *.o && $(RM) *.a - -$(BUILDDIR)/stdbuf: $(BUILDDIR)/libstdbuf.$(DYLIB_EXT) - -deps: $(BUILDDIR) $(SRCDIR)/cksum/crc_table.rs $(addprefix DEP_,$(DEPLIBS) $(DEPPLUGS)) - $(foreach lib,$(subst -,_,$(DEPLIBS)),$(shell cp $(BASEDIR)/deps/target/release/deps/lib$(lib)-*.rlib $(BUILDDIR)/lib$(lib).rlib)) - $(foreach plug,$(subst -,_,$(DEPPLUGS)),$(shell cp $(BASEDIR)/deps/target/release/deps/lib$(plug)-*.$(DYLIB_EXT) $(BUILDDIR)/lib$(plug).$(DYLIB_EXT))) - -$(BUILDDIR)/mkmain: mkmain.rs | $(BUILDDIR) - $(RUSTC) $(RUSTCFLAGS) $< -o $@ - -$(BUILDDIR)/mkuutils: mkuutils.rs | $(BUILDDIR) - $(RUSTC) $(RUSTCFLAGS) $< -o $@ - -$(SRCDIR)/cksum/crc_table.rs: $(SRCDIR)/cksum/gen_table.rs - cd $(SRCDIR)/cksum && $(RUSTC) $(RUSTCBINFLAGS) gen_table.rs && ./gen_table && $(RM) gen_table - -$(SRCDIR)/factor/prime_table.rs: $(SRCDIR)/factor/gen_table.rs - cd $(SRCDIR)/factor && $(RUSTC) $(RUSTCBINFLAGS) gen_table.rs && ./gen_table > $@ && $(RM) gen_table - -crates: - echo $(EXES) - -test: $(TEMPDIR) $(addprefix test_,$(TESTS)) - $(RM) -rf $(TEMPDIR) - -clean: - $(RM) -rf $(BUILDDIR) $(TEMPDIR) - -distclean: clean - cd $(BASEDIR)/deps && $(CARGO) clean && $(CARGO) update - -$(BUILDDIR): - mkdir -p $(BUILDDIR)/gen - -$(TEMPDIR): - $(RM) -rf $(TEMPDIR) - mkdir $(TEMPDIR) - -install: $(addprefix $(BUILDDIR)/,$(INSTALLEES)) - mkdir -p $(DESTDIR)$(PREFIX)$(BINDIR) - for prog in $(INSTALLEES); do \ - install $(BUILDDIR)/$$prog $(DESTDIR)$(PREFIX)$(BINDIR)/$(PROG_PREFIX)$$prog; \ - done - mkdir -p $(DESTDIR)$(PREFIX)$(LIBDIR) - for lib in $(LIBS); do \ - install $(BUILDDIR)/$$lib $(DESTDIR)$(PREFIX)$(LIBDIR)/$$lib; \ - done - -# TODO: figure out if there is way for prefixes to work with the symlinks -install-multicall: $(BUILDDIR)/uutils - mkdir -p $(DESTDIR)$(PREFIX)$(BINDIR) - install $(BUILDDIR)/uutils $(DESTDIR)$(PREFIX)$(BINDIR)/$(PROG_PREFIX)uutils - cd $(DESTDIR)$(PREFIX)$(BINDIR) - for prog in $(INSTALLEES); do \ - ln -s $(PROG_PREFIX)uutils $$prog; \ - done - mkdir -p $(DESTDIR)$(PREFIX)$(LIBDIR) - for lib in $(LIBS); do \ - install $(BUILDDIR)/$$lib $(DESTDIR)$(PREFIX)$(LIBDIR)/$$lib; \ - done - -uninstall: - rm -f $(addprefix $(DESTDIR)$(PREFIX)$(BINDIR)/$(PROG_PREFIX),$(PROGS)) - rm -f $(addprefix $(DESTDIR)$(PREFIX)$(LIBDIR)/,$(LIBS)) - -uninstall-multicall: - rm -f $(addprefix $(DESTDIR)$(PREFIX)$(BINDIR)/,$(PROGS) $(PROG_PREFIX)uutils) - rm -f $(addprefix $(DESTDIR)$(PREFIX)$(LIBDIR)/,$(LIBS)) - -# Test under the busybox testsuite -$(BUILDDIR)/busybox: $(BUILDDIR)/uutils - rm -f $(BUILDDIR)/busybox - ln -s $(BUILDDIR)/uutils $(BUILDDIR)/busybox - -# This is a busybox-specific config file their test suite wants to parse. -$(BUILDDIR)/.config: $(BASEDIR)/.busybox-config $(BUILDDIR)/uutils - cp $< $@ - -ifeq ($(BUSYBOX_SRC),) -busytest: - @echo - @echo "To run \`busytest\` set BUSYBOX_SRC to the directory of the compiled busybox source code." - @echo "Optionally set RUNTEST_ARGS to arguments to pass to the busybox \`runtest\` program." - @echo - @false -else -busytest: $(BUILDDIR)/busybox $(BUILDDIR)/.config - (cd $(BUSYBOX_SRC)/testsuite && bindir=$(BUILDDIR) ./runtest $(RUNTEST_ARGS)) -endif - -# This rule will build each program, ignore all output, and return pass -# or fail depending on whether the build has errors. -build-check: - @for prog in $(sort $(PROGS)); do \ - make BUILD="$$prog" >/dev/null 2>&1; status=$$?; \ - if [ $$status -eq 0 ]; \ - then printf "%-10s\t\033[1;32mpass\033[00;m\n" $$prog; \ - else printf "%-10s\t\033[1;31mfail\033[00;m\n" $$prog; \ - fi; \ - done - -# This rule will test each program, ignore all output, and return pass -# or fail depending on whether the test has errors. -test-check: - @for prog in $(sort $(TEST_PROGS)); do \ - make TEST="$$prog" test >/dev/null 2>&1; status=$$?; \ - if [ $$status -eq 0 ]; \ - then printf "%-10s\t\033[1;32mpass\033[00;m\n" $$prog; \ - else printf "%-10s\t\033[1;31mfail\033[00;m\n" $$prog; \ - fi; \ - done - -.PHONY: $(TEMPDIR) all deps test distclean clean busytest install uninstall diff --git a/README.md b/README.md deleted file mode 100644 index f3e9a9665..000000000 --- a/README.md +++ /dev/null @@ -1,183 +0,0 @@ -uutils coreutils -================ - -[![Build Status](https://api.travis-ci.org/uutils/coreutils.svg?branch=master)](https://travis-ci.org/uutils/coreutils) -[![Build status](https://ci.appveyor.com/api/projects/status/xhlsa439de5ogodp?svg=true)](https://ci.appveyor.com/project/jbcrail/coreutils-o0l0r) - -uutils is an attempt at writing universal (as in cross-platform) CLI -utils in [Rust](http://www.rust-lang.org). This repo is to aggregate the GNU -coreutils rewrites. - -Why? ----- - -Many GNU, Linux and other utils are pretty awesome, and obviously -[some](http://gnuwin32.sourceforge.net) [effort](http://unxutils.sourceforge.net) -has been spent in the past to port them to Windows. However, those projects -are either old, abandoned, hosted on CVS, written in platform-specific C, etc. - -Rust provides a good, platform-agnostic way of writing systems utils that are easy -to compile anywhere, and this is as good a way as any to try and learn it. - -Build Instructions ------------------- - -NOTE: This currently requires the most current nightly build. - -To simply build all available utilities: -``` -make -``` - -(on Windows use [MinGW/MSYS](http://www.mingw.org/wiki/MSYS) or `Cygwin` make and make sure you have `rustc` in `PATH`) - -To build all but a few of the available utilities: -``` -make DONT_BUILD='UTILITY_1 UTILITY_2' -``` - -To build only a few of the available utilities: -``` -make BUILD='UTILITY_1 UTILITY_2' -``` - -To build with LTO and stripping: -``` -make ENABLE_LTO=y ENABLE_STRIP=y -``` - -To check all available utilities for build errors: -``` -make build-check -``` - -To check all available tests for errors: -``` -make test-check -``` - -Installation Instructions -------------------------- - -To install all available utilities: -``` -make install -``` - -To install all but a few of the available utilities: -``` -make DONT_INSTALL='UTILITY_1 UTILITY_2' install -``` - -To install only a few of the available utilities: -``` -make INSTALL='UTILITY_1 UTILITY_2' install -``` - -To install every program with a prefix: -``` -make PROG_PREFIX=PREFIX_GOES_HERE install -``` - -To install the multicall binary: -``` -make install-multicall -``` - -Uninstallation Instructions ---------------------------- - -To uninstall all utilities: -``` -make uninstall -``` - -To uninstall every program with a set prefix: -``` -make PROG_PREFIX=PREFIX_GOES_HERE uninstall -``` - -To uninstall the multicall binary: -``` -make uninstall-multicall -``` - -Test Instructions ------------------ - -To simply test all available utilities: -``` -make test -``` - -To test all but a few of the available utilities: -``` -make DONT_TEST='UTILITY_1 UTILITY_2' test -``` - -To test only a few of the available utilities: -``` -make TEST='UTILITY_1 UTILITY_2' test -``` - -Contribute ----------- - -Contributions are very welcome, and should target Rust's master branch until -Rust 1.0 is released. You may *claim* an item on the to-do list by following -these steps: - -1. Open an issue named "Implement [the utility of your choice]", e.g. "Implement ls" -2. State that you are working on this utility. -3. Develop the utility. -4. Add the reference to your utility into uutils/uutils.rs (required for multibinary). -5. Remove utility from the to-do list on this README. -6. Submit a pull request and close the issue. - -The steps above imply that, before starting to work on a utility, you should search the issues to make sure no one else is working on it. - -To do ------ - -- chcon -- chgrp -- chmod (mostly done, just needs verbosity options) -- chown -- copy -- cp (not much done) -- csplit -- date -- dd -- df -- dircolors -- expr -- getlimits -- install -- join -- ls -- mknod -- mktemp -- mv (almost done, one more option) -- numfmt -- od (in progress, needs lots of work) -- pathchk -- pinky -- pr -- printf -- remove -- runcon -- setuidgid -- shred -- sort (a couple of options implemented) -- split (a couple of missing options) -- stat -- stty -- tail (not all features implemented) -- test (not all features implemented) -- uniq (a couple of missing options) -- who - -License -------- - -uutils is licensed under the MIT License - see the `LICENSE` file for details diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index b571c1390..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,33 +0,0 @@ -platform: - - x64 - -environment: - global: - MSYS2_BASEVER: 20150512 - MSYS2_ARCH: x86_64 - MBASH: msys64\usr\bin\sh --login -c - - matrix: - - TARGET: i686-pc-windows-gnu - -install: - - appveyor DownloadFile "http://kent.dl.sourceforge.net/project/msys2/Base/%MSYS2_ARCH%/msys2-base-%MSYS2_ARCH%-%MSYS2_BASEVER%.tar.xz" -FileName "msys2.tar.xz" - - 7z x msys2.tar.xz - - 7z x msys2.tar > NUL - - call %MBASH% "" - - call %MBASH% "for i in {1..3}; do pacman --noconfirm -Suy mingw-w64-%MSYS2_ARCH%-{ragel,freetype,icu,gettext} libtool pkg-config gcc make autoconf automake perl && break || sleep 15; done" - - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe" - - rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust" - - call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 - - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin - - SET PATH=%PATH%;C:\MinGW\bin - - rustc -V - - cargo -V - -build_script: - - call %MBASH% "cd $APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; exec 0 continue, - "all" => continue, - _ => {}, - } - crates.push(krate.to_string()); - } - } - crates.sort(); - let mut cf = File::create(Path::new(&out_dir).join("uutils_crates.rs")).unwrap(); - let mut mf = File::create(Path::new(&out_dir).join("uutils_map.rs")).unwrap(); - mf.write_all(" - type UtilityMap = HashMap<&'static str, fn(Vec) -> i32>; - - fn util_map() -> UtilityMap { - let mut map: UtilityMap = HashMap::new();\n".as_bytes()).unwrap(); - for krate in crates { - match krate.as_ref() { - "false" => continue, - "true" => continue, - _ => cf.write_all(format!("extern crate {krate} as uu{krate};\n", krate=krate).as_bytes()).unwrap(), - } - - match krate.as_ref() { - "hashsum" => { - mf.write_all("map.insert(\"hashsum\", uuhashsum::uumain); - map.insert(\"md5sum\", uuhashsum::uumain); - map.insert(\"sha1sum\", uuhashsum::uumain); - map.insert(\"sha224sum\", uuhashsum::uumain); - map.insert(\"sha256sum\", uuhashsum::uumain); - map.insert(\"sha384sum\", uuhashsum::uumain); - map.insert(\"sha512sum\", uuhashsum::uumain);\n".as_bytes()).unwrap(); - }, - "false" => - mf.write_all("fn uufalse(_: Vec) -> i32 { 1 } - map.insert(\"false\", uufalse as fn(Vec) -> i32);\n".as_bytes()).unwrap(), - "true" => - mf.write_all("fn uutrue(_: Vec) -> i32 { 0 } - map.insert(\"true\", uutrue as fn(Vec) -> i32);\n".as_bytes()).unwrap(), - _ => - mf.write_all(format!("map.insert(\"{krate}\", uu{krate}::uumain as fn(Vec) -> i32);\n", krate= krate).as_bytes()).unwrap(), - } - } - mf.write_all("map - }\n".as_bytes()).unwrap(); - cf.flush().unwrap(); - mf.flush().unwrap(); -} diff --git a/deps/Cargo.toml b/deps/Cargo.toml deleted file mode 100644 index c03fa5fcb..000000000 --- a/deps/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -[project] -name = "deps" -version = "0.0.0" - -[lib] -name = "null" - -[dependencies] -libc = "0.1" -getopts = "0.2" -bit-vec = "0.4" -bit-set = "0.2" -vec_map = "0.3" -num_cpus = "0.2" -rand = "0.3" -regex = "0.1" -rust-crypto = "0.2" -rustc-serialize = "0.3" -time = "0.1" -unicode-width = "0.1" -winapi = "0.2" -advapi32-sys = "0.1" -kernel32-sys = "0.1" -walker = "^1.0" -filetime = "0.1" diff --git a/mkmain.rs b/mkmain.rs deleted file mode 100644 index e825a1b41..000000000 --- a/mkmain.rs +++ /dev/null @@ -1,49 +0,0 @@ -use std::env; -use std::io::Write; -use std::fs::File; - -static TEMPLATE: &'static str = "\ -extern crate @UTIL_CRATE@ as uu@UTIL_CRATE@; - -use std::io::Write; -use uu@UTIL_CRATE@::uumain; - -fn main() { - let code = uumain(std::env::args().collect()); - - // Since stdout is line-buffered by default, we need to ensure any pending - // writes are flushed before exiting. Ideally, this should be enforced by - // each utility. - // - // See: https://github.com/rust-lang/rust/issues/23818 - // - std::io::stdout().flush().unwrap(); - - std::process::exit(code); -} -"; - -fn main() { - let args : Vec = env::args().collect(); - if args.len() != 3 { - println!("usage: mkbuild "); - std::process::exit(1); - } - - let crat = match &args[1][..] { - "false" => "uufalse", - "test" => "uutest", - "true" => "uutrue", - _ => &args[1][..], - }; - let outfile = &args[2][..]; - - let main = TEMPLATE.replace("@UTIL_CRATE@", crat); - match File::create(outfile) { - Ok(mut out) => match out.write_all(main.as_bytes()) { - Err(e) => panic!("{}", e), - _ => (), - }, - Err(e) => panic!("{}", e), - } -} diff --git a/mkuutils.rs b/mkuutils.rs deleted file mode 100644 index 772b68435..000000000 --- a/mkuutils.rs +++ /dev/null @@ -1,63 +0,0 @@ -use std::env; -use std::fs::File; -use std::io::{Read, Write}; - -fn main() { - let args : Vec = env::args().collect(); - if args.len() < 3 { - println!("usage: mkuutils "); - std::process::exit(1); - } - - let mut crates = String::new(); - let mut util_map = String::new(); - let mut hashsum = false; - for prog in args[2..].iter() { - match &prog[..] { - "hashsum" | "md5sum" | "sha1sum" | "sha224sum" | "sha256sum" | "sha384sum" | "sha512sum" => { - if !hashsum { - crates.push_str("extern crate hashsum;\n"); - util_map.push_str("map.insert(\"hashsum\", hashsum::uumain);\n"); - util_map.push_str("map.insert(\"md5sum\", hashsum::uumain);\n"); - util_map.push_str("map.insert(\"sha1sum\", hashsum::uumain);\n"); - util_map.push_str("map.insert(\"sha224sum\", hashsum::uumain);\n"); - util_map.push_str("map.insert(\"sha256sum\", hashsum::uumain);\n"); - util_map.push_str("map.insert(\"sha384sum\", hashsum::uumain);\n"); - util_map.push_str("map.insert(\"sha512sum\", hashsum::uumain);\n"); - hashsum = true; - } - }, - "true" => { - util_map.push_str("fn uutrue(_: Vec) -> i32 { 0 }\n"); - util_map.push_str("map.insert(\"true\", uutrue as fn(Vec) -> i32);\n"); - }, - "false" => { - util_map.push_str("fn uufalse(_: Vec) -> i32 { 1 }\n"); - util_map.push_str("map.insert(\"false\", uufalse as fn(Vec) -> i32);\n"); - }, - _ => { - if prog == "test" { - crates.push_str(&(format!("extern crate uu{0} as uu{0};\n", prog))[..]); - } else { - crates.push_str(&(format!("extern crate {0} as uu{0};\n", prog))[..]); - } - util_map.push_str(&(format!("map.insert(\"{prog}\", uu{prog}::uumain as fn(Vec) -> i32);\n", prog = prog))[..]); - } - } - } - let outfile = &(args[1])[..]; - - // XXX: this all just assumes that the IO works correctly - let mut out = File::create(outfile).unwrap(); - let mut input = File::open("src/uutils/uutils.rs").unwrap(); - - let mut template = String::new(); - input.read_to_string(&mut template).unwrap(); - let template = template; - - let main = template.replace("@CRATES@", &crates[..]).replace("@UTIL_MAP@", &util_map[..]); - match out.write_all(main.as_bytes()) { - Err(e) => panic!("{}", e), - _ => (), - } -} diff --git a/src/base64/Cargo.toml b/src/base64/Cargo.toml deleted file mode 100644 index 6e0c8ec1f..000000000 --- a/src/base64/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "base64" -version = "0.0.1" -authors = [] - -[lib] -name = "base64" -path = "base64.rs" - -[dependencies] -getopts = "*" -libc = "*" -rustc-serialize = "*" diff --git a/src/base64/base64.rs b/src/base64/base64.rs deleted file mode 100644 index 3ea79a7c3..000000000 --- a/src/base64/base64.rs +++ /dev/null @@ -1,162 +0,0 @@ -#![crate_name = "base64"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordy Dickinson - * - * For the full copyright and license information, please view the LICENSE file - * that was distributed with this source code. - */ - -extern crate rustc_serialize as serialize; -extern crate getopts; -extern crate libc; - -use getopts::Options; -use serialize::base64::{self, FromBase64, ToBase64}; -use std::ascii::AsciiExt; -use std::error::Error; -use std::fs::File; -use std::io::{BufReader, Read, stdin, stdout, Write}; -use std::path::Path; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -enum Mode { - Decode, - Encode, - Help, - Version -} - -static NAME: &'static str = "base64"; -static VERSION: &'static str = "1.0.0"; - -pub type FileOrStdReader = BufReader>; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - opts.optflag("d", "decode", "decode data"); - opts.optflag("i", "ignore-garbage", "when decoding, ignore non-alphabetic characters"); - opts.optopt("w", "wrap", "wrap encoded lines after COLS character (default 76, 0 to disable wrapping)", "COLS"); - opts.optflag("h", "help", "display this help text and exit"); - opts.optflag("V", "version", "output version information and exit"); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(e) => { crash!(1, "{}", e) } - }; - - let mode = if matches.opt_present("help") { - Mode::Help - } else if matches.opt_present("version") { - Mode::Version - } else if matches.opt_present("decode") { - Mode::Decode - } else { - Mode::Encode - }; - let ignore_garbage = matches.opt_present("ignore-garbage"); - let line_wrap = match matches.opt_str("wrap") { - Some(s) => match s.parse() { - Ok(s) => s, - Err(e)=> { - crash!(1, "Argument to option 'wrap' improperly formatted: {}", e); - } - }, - None => 76 - }; - let stdin_buf; - let file_buf; - let mut input = if matches.free.is_empty() || &matches.free[0][..] == "-" { - stdin_buf = stdin(); - BufReader::new(Box::new(stdin_buf) as Box) - } else { - let path = Path::new(&matches.free[0][..]); - file_buf = safe_unwrap!(File::open(&path)); - BufReader::new(Box::new(file_buf) as Box) - }; - - match mode { - Mode::Decode => decode(&mut input, ignore_garbage), - Mode::Encode => encode(&mut input, line_wrap), - Mode::Help => help(opts), - Mode::Version => version() - } - - 0 -} - -fn decode(input: &mut FileOrStdReader, ignore_garbage: bool) { - let mut to_decode = String::new(); - input.read_to_string(&mut to_decode).unwrap(); - - if ignore_garbage { - let mut clean = String::new(); - clean.extend(to_decode.chars().filter(|&c| { - if !c.is_ascii() { - false - } else { - c >= 'a' && c <= 'z' || - c >= 'A' && c <= 'Z' || - c >= '0' && c <= '9' || - c == '+' || c == '/' - } - })); - to_decode = clean; - } - - match to_decode[..].from_base64() { - Ok(bytes) => { - let mut out = stdout(); - - match out.write_all(&bytes[..]) { - Ok(_) => {} - Err(f) => { crash!(1, "{}", f); } - } - match out.flush() { - Ok(_) => {} - Err(f) => { crash!(1, "{}", f); } - } - } - Err(s) => { - crash!(1, "{} ({:?})", s.description(), s); - } - } -} - -fn encode(input: &mut FileOrStdReader, line_wrap: usize) { - let b64_conf = base64::Config { - char_set: base64::Standard, - newline: base64::Newline::LF, - pad: true, - line_length: match line_wrap { - 0 => None, - _ => Some(line_wrap) - } - }; - let mut to_encode: Vec = vec!(); - input.read_to_end(&mut to_encode).unwrap(); - let encoded = to_encode.to_base64(b64_conf); - - println!("{}", &encoded[..]); -} - -fn help(opts: Options) { - let msg = format!("Usage: {} [OPTION]... [FILE]\n\n\ - Base64 encode or decode FILE, or standard input, to standard output.\n\ - With no FILE, or when FILE is -, read standard input.\n\n\ - The data are encoded as described for the base64 alphabet in RFC \ - 3548. When\ndecoding, the input may contain newlines in addition \ - to the bytes of the formal\nbase64 alphabet. Use --ignore-garbage \ - to attempt to recover from any other\nnon-alphabet bytes in the \ - encoded stream.", NAME); - - print!("{}", opts.usage(&msg)); -} - -fn version() { - println!("{} {}", NAME, VERSION); -} diff --git a/src/base64/deps.mk b/src/base64/deps.mk deleted file mode 100644 index 5f486e20e..000000000 --- a/src/base64/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += rustc-serialize diff --git a/src/basename/Cargo.toml b/src/basename/Cargo.toml deleted file mode 100644 index ade2a3236..000000000 --- a/src/basename/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "basename" -version = "0.0.1" -authors = [] - -[lib] -name = "basename" -path = "basename.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/basename/basename.rs b/src/basename/basename.rs deleted file mode 100644 index 95736067d..000000000 --- a/src/basename/basename.rs +++ /dev/null @@ -1,108 +0,0 @@ -#![crate_name = "basename"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Jimmy Lu - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use getopts::Options; -use std::io::Write; -use std::path::{is_separator, PathBuf}; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "basename"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - // - // Argument parsing - // - let mut opts = Options::new(); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f) - }; - - if matches.opt_present("help") { - let msg = format!("Usage: {0} NAME [SUFFIX]\n or: {0} OPTION\n\n\ - Print NAME with any leading directory components removed.\n\ - If specified, also remove a trailing SUFFIX.", NAME); - - print!("{}", opts.usage(&msg)); - - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - // too few arguments - if args.len() < 2 { - println!("{}: {}", NAME, "missing operand"); - println!("Try '{} --help' for more information.", NAME); - return 1; - } - // too many arguments - else if args.len() > 3 { - println!("{}: extra operand '{}'", NAME, args[3]); - println!("Try '{} --help' for more information.", NAME); - return 1; - } - - // - // Main Program Processing - // - - let mut name = strip_dir(&args[1]); - - if args.len() > 2 { - let suffix = args[2].clone(); - name = strip_suffix(name.as_ref(), suffix.as_ref()); - } - - println!("{}", name); - - 0 -} - -fn strip_dir(fullname: &str) -> String { - // Remove all platform-specific path separators from the end - let mut path: String = fullname.chars().rev().skip_while(|&ch| is_separator(ch)).collect(); - - // Undo reverse - path = path.chars().rev().collect(); - - // Convert to path buffer and get last path component - let pb = PathBuf::from(path); - match pb.components().last() { - Some(c) => c.as_os_str().to_str().unwrap().to_string(), - None => "".to_string() - } -} - -fn strip_suffix(name: &str, suffix: &str) -> String { - if name == suffix { - return name.to_string(); - } - - if name.ends_with(suffix) { - return name[..name.len() - suffix.len()].to_string(); - } - - name.to_string() -} diff --git a/src/cat/Cargo.toml b/src/cat/Cargo.toml deleted file mode 100644 index 36066a55f..000000000 --- a/src/cat/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "cat" -version = "0.0.1" -authors = [] - -[lib] -name = "cat" -path = "cat.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/cat/cat.rs b/src/cat/cat.rs deleted file mode 100644 index 61629734e..000000000 --- a/src/cat/cat.rs +++ /dev/null @@ -1,347 +0,0 @@ -#![crate_name = "cat"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/* last synced with: cat (GNU coreutils) 8.13 */ - -extern crate getopts; -extern crate libc; - -use getopts::Options; -use std::fs::File; -use std::intrinsics::{copy_nonoverlapping}; -use std::io::{stdout, stdin, stderr, Write, Read, Result}; -use libc::consts::os::posix88::STDIN_FILENO; -use libc::funcs::posix88::unistd::isatty; -use libc::types::os::arch::c95::c_int; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "cat"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - opts.optflag("A", "show-all", "equivalent to -vET"); - opts.optflag("b", "number-nonblank", - "number nonempty output lines, overrides -n"); - opts.optflag("e", "", "equivalent to -vE"); - opts.optflag("E", "show-ends", "display $ at end of each line"); - opts.optflag("n", "number", "number all output lines"); - opts.optflag("s", "squeeze-blank", "suppress repeated empty output lines"); - opts.optflag("t", "", "equivalent to -vT"); - opts.optflag("T", "show-tabs", "display TAB characters as ^I"); - opts.optflag("v", "show-nonprinting", - "use ^ and M- notation, except for LF (\\n) and TAB (\\t)"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => panic!("Invalid options\n{}", f) - }; - if matches.opt_present("help") { - let msg = format!("{} {}\n\n\ - Usage:\n {0} [OPTION]... [FILE]...\n\n\ - Concatenate FILE(s), or standard input, to standard output.\n\n\ - With no FILE, or when FILE is -, read standard input.", NAME, VERSION); - - print!("{}", opts.usage(&msg)); - return 0; - } - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let number_mode = if matches.opt_present("b") { - NumberingMode::NumberNonEmpty - } else if matches.opt_present("n") { - NumberingMode::NumberAll - } else { - NumberingMode::NumberNone - }; - let show_nonprint = matches.opts_present(&["A".to_string(), "e".to_string(), - "t".to_string(), "v".to_string()]); - let show_ends = matches.opts_present(&["E".to_string(), "A".to_string(), - "e".to_string()]); - let show_tabs = matches.opts_present(&["A".to_string(), "T".to_string(), - "t".to_string()]); - let squeeze_blank = matches.opt_present("s"); - let mut files = matches.free; - if files.is_empty() { - files.push("-".to_string()); - } - - exec(files, number_mode, show_nonprint, show_ends, show_tabs, squeeze_blank); - - 0 -} - -#[derive(Eq, PartialEq)] -enum NumberingMode { - NumberNone, - NumberNonEmpty, - NumberAll, -} - -fn write_lines(files: Vec, number: NumberingMode, squeeze_blank: bool, - show_ends: bool) { - - let mut line_counter: usize = 1; - - for (mut reader, interactive) in files.iter().filter_map(|p| open(&p[..])) { - - let mut in_buf = [0; 1024 * 31]; - let mut out_buf = [0; 1024 * 64]; - let mut writer = UnsafeWriter::new(&mut out_buf[..], stdout()); - let mut at_line_start = true; - while let Ok(n) = reader.read(&mut in_buf) { - if n == 0 { break } - - let in_buf = &in_buf[..n]; - let mut buf_pos = 0..n; - loop { - writer.possibly_flush(); - let pos = match buf_pos.next() { - Some(p) => p, - None => break, - }; - if in_buf[pos] == '\n' as u8 { - if !at_line_start || !squeeze_blank { - if at_line_start && number == NumberingMode::NumberAll { - (write!(&mut writer, "{0:6}\t", line_counter)).unwrap(); - line_counter += 1; - } - if show_ends { - writer.write_all(&['$' as u8]).unwrap(); - } - writer.write_all(&['\n' as u8]).unwrap(); - if interactive { - writer.flush().unwrap(); - } - } - at_line_start = true; - continue; - } - if at_line_start && number != NumberingMode::NumberNone { - (write!(&mut writer, "{0:6}\t", line_counter)).unwrap(); - line_counter += 1; - } - match in_buf[pos..].iter().position(|c| *c == '\n' as u8) { - Some(p) => { - writer.write_all(&in_buf[pos..pos + p]).unwrap(); - if show_ends { - writer.write_all(&['$' as u8]).unwrap(); - } - writer.write_all(&['\n' as u8]).unwrap(); - if interactive { - writer.flush().unwrap(); - } - buf_pos = pos + p + 1..n; - at_line_start = true; - }, - None => { - writer.write_all(&in_buf[pos..]).unwrap(); - at_line_start = false; - break; - } - }; - } - } - } -} - -fn write_bytes(files: Vec, number: NumberingMode, squeeze_blank: bool, - show_ends: bool, show_nonprint: bool, show_tabs: bool) { - - let mut line_counter: usize = 1; - - for (mut reader, interactive) in files.iter().filter_map(|p| open(&p[..])) { - - // Flush all 1024 iterations. - let mut flush_counter = 0usize..1024; - - let mut in_buf = [0; 1024 * 32]; - let mut out_buf = [0; 1024 * 64]; - let mut writer = UnsafeWriter::new(&mut out_buf[..], stdout()); - let mut at_line_start = true; - while let Ok(n) = reader.read(&mut in_buf) { - if n == 0 { break } - - for &byte in in_buf[..n].iter() { - if flush_counter.next().is_none() { - writer.possibly_flush(); - flush_counter = 0usize..1024; - } - if byte == '\n' as u8 { - if !at_line_start || !squeeze_blank { - if at_line_start && number == NumberingMode::NumberAll { - (write!(&mut writer, "{0:6}\t", line_counter)).unwrap(); - line_counter += 1; - } - if show_ends { - writer.write_all(&['$' as u8]).unwrap(); - } - writer.write_all(&['\n' as u8]).unwrap(); - if interactive { - writer.flush().unwrap(); - } - } - at_line_start = true; - continue; - } - if at_line_start && number != NumberingMode::NumberNone { - (write!(&mut writer, "{0:6}\t", line_counter)).unwrap(); - line_counter += 1; - at_line_start = false; - } - // This code is slow because of the many branches. cat in glibc avoids - // this by having the whole loop inside show_nonprint. - if byte == '\t' as u8 { - if show_tabs { - writer.write_all("^I".as_bytes()) - } else { - writer.write_all(&[byte]) - } - } else if show_nonprint { - let byte = match byte { - 128 ... 255 => { - writer.write_all("M-".as_bytes()).unwrap(); - byte - 128 - }, - _ => byte, - }; - match byte { - 0 ... 31 => writer.write_all(&['^' as u8, byte + 64]), - 127 => writer.write_all(&['^' as u8, byte - 64]), - _ => writer.write_all(&[byte]), - } - } else { - writer.write_all(&[byte]) - }.unwrap(); - } - } - } -} - -fn write_fast(files: Vec) { - let mut writer = stdout(); - let mut in_buf = [0; 1024 * 64]; - - for (mut reader, _) in files.iter().filter_map(|p| open(&p[..])) { - while let Ok(n) = reader.read(&mut in_buf) { - if n == 0 { break } - // This interface is completely broken. - writer.write_all(&in_buf[..n]).unwrap(); - } - } -} - -fn exec(files: Vec, number: NumberingMode, show_nonprint: bool, - show_ends: bool, show_tabs: bool, squeeze_blank: bool) { - - if show_nonprint || show_tabs { - write_bytes(files, number, squeeze_blank, show_ends, show_nonprint, show_tabs); - } else if number != NumberingMode::NumberNone || squeeze_blank || show_ends { - write_lines(files, number, squeeze_blank, show_ends); - } else { - write_fast(files); - } - pipe_flush!(); -} - -fn open(path: &str) -> Option<(Box, bool)> { - if path == "-" { - let stdin = stdin(); - let interactive = unsafe { isatty(STDIN_FILENO) } != 0 as c_int; - return Some((Box::new(stdin) as Box, interactive)); - } - - match File::open(path) { - Ok(f) => Some((Box::new(f) as Box, false)), - Err(e) => { - (writeln!(&mut stderr(), "cat: {0}: {1}", path, e.to_string())).unwrap(); - None - }, - } -} - -struct UnsafeWriter<'a, W: Write> { - inner: W, - buf: &'a mut [u8], - pos: usize, - threshold: usize, -} - -impl<'a, W: Write> UnsafeWriter<'a, W> { - fn new(buf: &'a mut [u8], inner: W) -> UnsafeWriter<'a, W> { - let threshold = buf.len()/2; - UnsafeWriter { - inner: inner, - buf: buf, - pos: 0, - threshold: threshold, - } - } - - fn flush_buf(&mut self) -> Result<()> { - if self.pos != 0 { - let ret = self.inner.write(&self.buf[..self.pos]); - self.pos = 0; - match ret { - Ok(_) => Ok(()), - Err(e) => Err(e), - } - } else { - Ok(()) - } - } - - fn possibly_flush(&mut self) { - if self.pos > self.threshold { - self.inner.write_all(&self.buf[..self.pos]).unwrap(); - self.pos = 0; - } - } -} - -#[inline(never)] -fn fail() -> ! { - panic!("assertion failed"); -} - -impl<'a, W: Write> Write for UnsafeWriter<'a, W> { - fn write(&mut self, buf: &[u8]) -> Result { - let dst = &mut self.buf[self.pos..]; - let len = buf.len(); - if len > dst.len() { - fail(); - } - unsafe { - copy_nonoverlapping(buf.as_ptr(), dst.as_mut_ptr(), len) - } - self.pos += len; - Ok(len) - } - - fn flush(&mut self) -> Result<()> { - self.flush_buf().and_then(|()| self.inner.flush()) - } -} - -impl<'a, W: Write> Drop for UnsafeWriter<'a, W> { - fn drop(&mut self) { - let _ = self.flush_buf(); - } -} - -/* vim: set ai ts=4 sw=4 sts=4 et : */ diff --git a/src/chmod/Cargo.toml b/src/chmod/Cargo.toml deleted file mode 100644 index 5d1508101..000000000 --- a/src/chmod/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -name = "chmod" -version = "0.0.1" -authors = [] - -[lib] -name = "chmod" -path = "chmod.rs" - -[dependencies] -getopts = "*" -libc = "*" -aho-corasick = "*" -memchr = "*" -regex = "*" -regex-syntax = "*" -walker = "*" diff --git a/src/chmod/chmod.rs b/src/chmod/chmod.rs deleted file mode 100644 index 958e56390..000000000 --- a/src/chmod/chmod.rs +++ /dev/null @@ -1,326 +0,0 @@ -#![crate_name = "chmod"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Arcterus - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#![allow(unused_variables)] // only necessary while the TODOs still exist - -extern crate aho_corasick; -extern crate getopts; -extern crate libc; -extern crate memchr; -extern crate regex; -extern crate regex_syntax; -extern crate walker; - -use getopts::Options; -use regex::Regex; -use std::ffi::CString; -use std::io::{Error, Write}; -use std::mem; -use std::path::Path; -use walker::Walker; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/filesystem.rs"] -mod filesystem; - -use filesystem::UUPathExt; - -const NAME: &'static str = "chmod"; -const VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - opts.optflag("c", "changes", "like verbose but report only when a change is made (unimplemented)"); - opts.optflag("f", "quiet", "suppress most error messages (unimplemented)"); // TODO: support --silent - opts.optflag("v", "verbose", "output a diagnostic for every file processed (unimplemented)"); - opts.optflag("", "no-preserve-root", "do not treat '/' specially (the default)"); - opts.optflag("", "preserve-root", "fail to operate recursively on '/'"); - opts.optflagopt("", "reference", "use RFILE's mode instead of MODE values", "RFILE"); - opts.optflag("R", "recursive", "change files and directories recursively"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - // TODO: sanitize input for - at beginning (e.g. chmod -x testfile). Solution is to add a to -x, making a-x - let mut matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { crash!(1, "{}", f) } - }; - if matches.opt_present("help") { - let msg = format!("{name} {version} - -Usage: - {program} [OPTION]... MODE[,MODE]... FILE... - {program} [OPTION]... OCTAL-MODE FILE... - {program} [OPTION]... --reference=RFILE FILE... - -Change the mode of each FILE to MODE. -With --reference, change the mode of each FILE to that of RFILE. -Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+'.", - name = NAME, version = VERSION, program = NAME); - - print!("{}", opts.usage(&msg)); - return 0; - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else if matches.free.is_empty() && matches.opt_present("reference") || matches.free.len() < 2 { - show_error!("missing an argument"); - show_error!("for help, try '{} --help'", NAME); - return 1; - } else { - let changes = matches.opt_present("changes"); - let quiet = matches.opt_present("quiet"); - let verbose = matches.opt_present("verbose"); - let preserve_root = matches.opt_present("preserve-root"); - let recursive = matches.opt_present("recursive"); - let fmode = matches.opt_str("reference").and_then(|fref| { - let mut stat : libc::stat = unsafe { mem::uninitialized() }; - let statres = unsafe { libc::stat(fref.as_ptr() as *const i8, &mut stat as *mut libc::stat) }; - if statres == 0 { - Some(stat.st_mode) - } else { - crash!(1, "{}", Error::last_os_error()) - } - }); - let cmode = - if fmode.is_none() { - let mode = matches.free.remove(0); - match verify_mode(&mode[..]) { - Ok(_) => Some(mode), - Err(f) => { - show_error!("{}", f); - return 1; - } - } - } else { - None - }; - match chmod(matches.free, changes, quiet, verbose, preserve_root, - recursive, fmode, cmode.as_ref()) { - Ok(()) => {} - Err(e) => return e - } - } - - 0 -} - -#[cfg(unix)] -#[inline] -fn verify_mode(modes: &str) -> Result<(), String> { - let re: regex::Regex = Regex::new(r"^[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+$").unwrap(); - for mode in modes.split(',') { - if !re.is_match(mode) { - return Err(format!("invalid mode '{}'", mode)); - } - } - Ok(()) -} - -#[cfg(windows)] -#[inline] -// XXX: THIS IS NOT TESTED!!! -fn verify_mode(modes: &str) -> Result<(), String> { - let re: regex::Regex = Regex::new(r"^[ugoa]*(?:[-+=](?:([rwxXst]*)|[ugo]))+|[-+=]?([0-7]+)$").unwrap(); - for mode in modes.split(',') { - match re.captures(mode) { - Some(cap) => { - let symbols = cap.at(1).unwrap(); - let numbers = cap.at(2).unwrap(); - if symbols.contains("s") || symbols.contains("t") { - return Err("The 's' and 't' modes are not supported on Windows".into()); - } else if numbers.len() >= 4 && numbers[..numbers.len() - 3].find(|ch| ch != '0').is_some() { - return Err("Setuid, setgid, and sticky modes are not supported on Windows".into()); - } - } - None => return Err(format!("invalid mode '{}'", mode)) - } - } - Ok(()) -} - -fn chmod(files: Vec, changes: bool, quiet: bool, verbose: bool, preserve_root: bool, recursive: bool, fmode: Option, cmode: Option<&String>) -> Result<(), i32> { - let mut r = Ok(()); - - for filename in files.iter() { - let filename = &filename[..]; - let file = Path::new(filename); - if file.uu_exists() { - if file.uu_is_dir() { - if !preserve_root || filename != "/" { - if recursive { - let walk_dir = match Walker::new(&file) { - Ok(m) => m, - Err(f) => { - crash!(1, "{}", f.to_string()); - } - }; - // XXX: here (and elsewhere) we see that this impl will have issues - // with non-UTF-8 filenames. Using OsString won't fix this because - // on Windows OsStrings cannot be built out of non-UTF-8 chars. One - // possible fix is to use CStrings rather than Strings in the args - // to chmod() and chmod_file(). - r = chmod(walk_dir.filter_map(|x| match x { - Ok(o) => match o.path().into_os_string().to_str() { - Some(s) => Some(s.to_string()), - None => None, - }, - Err(e) => None, - }).collect(), - changes, quiet, verbose, preserve_root, recursive, fmode, cmode).and(r); - r = chmod_file(&file, filename, changes, quiet, verbose, fmode, cmode).and(r); - } - } else { - show_error!("could not change permissions of directory '{}'", - filename); - r = Err(1); - } - } else { - r = chmod_file(&file, filename, changes, quiet, verbose, fmode, cmode).and(r); - } - } else { - show_error!("no such file or directory '{}'", filename); - r = Err(1); - } - } - - r -} - -#[cfg(windows)] -fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool, fmode: Option, cmode: Option<&String>) -> Result<(), i32> { - // chmod is useless on Windows - // it doesn't set any permissions at all - // instead it just sets the readonly attribute on the file - Err(0) -} -#[cfg(unix)] -fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool, fmode: Option, cmode: Option<&String>) -> Result<(), i32> { - let path = CString::new(name).unwrap_or_else(|e| panic!("{}", e)); - match fmode { - Some(mode) => { - if unsafe { libc::chmod(path.as_ptr(), mode) } == 0 { - // TODO: handle changes, quiet, and verbose - } else { - show_error!("{}", Error::last_os_error()); - return Err(1); - } - } - None => { - // TODO: make the regex processing occur earlier (i.e. once in the main function) - let re: regex::Regex = Regex::new(r"^(([ugoa]*)((?:[-+=](?:[rwxXst]*|[ugo]))+))|([-+=]?[0-7]+)$").unwrap(); - let mut stat: libc::stat = unsafe { mem::uninitialized() }; - let statres = unsafe { libc::stat(path.as_ptr(), &mut stat as *mut libc::stat) }; - let mut fperm = - if statres == 0 { - stat.st_mode - } else { - show_error!("{}", Error::last_os_error()); - return Err(1); - }; - for mode in cmode.unwrap().split(',') { // cmode is guaranteed to be Some in this case - let cap = re.captures(mode).unwrap(); // mode was verified earlier, so this is safe - if match cap.at(1) { - Some("") | None => false, - _ => true, - } { - // symbolic - let mut levels = cap.at(2).unwrap(); - if levels.len() == 0 { - levels = "a"; - } - let change = cap.at(3).unwrap().to_string() + "+"; - let mut action = change.chars().next().unwrap(); - let mut rwx = 0; - let mut special = 0; - let mut special_changed = false; - for ch in change[1..].chars() { - match ch { - '+' | '-' | '=' => { - for level in levels.chars() { - let (rwx, mask) = match level { - 'u' => (rwx << 6, 0o7077), - 'g' => (rwx << 3, 0o7707), - 'o' => (rwx, 0o7770), - 'a' => ((rwx << 6) | (rwx << 3) | rwx, 0o7000), - _ => unreachable!() - }; - match action { - '+' => fperm |= rwx, - '-' => fperm &= !rwx, - '=' => fperm = (fperm & mask) | rwx, - _ => unreachable!() - } - } - if special_changed { - match action { - '+' => fperm |= special, - '-' => fperm &= !special, - '=' => fperm &= special | 0o0777, - _ => unreachable!() - } - } - action = ch; - rwx = 0; - special = 0; - special_changed = false; - } - 'r' => rwx |= 0o004, - 'w' => rwx |= 0o002, - 'x' => rwx |= 0o001, - 'X' => { - if file.uu_is_dir() || (fperm & 0o0111) != 0 { - rwx |= 0o001; - } - } - 's' => { - special |= 0o4000 | 0o2000; - special_changed = true; - } - 't' => { - special |= 0o1000; - special_changed = true; - } - 'u' => rwx = (fperm >> 6) & 0o007, - 'g' => rwx = (fperm >> 3) & 0o007, - 'o' => rwx = (fperm >> 0) & 0o007, - _ => unreachable!() - } - } - } else { - // numeric - let change = cap.at(4).unwrap(); - let ch = change.chars().next().unwrap(); - let (action, slice) = match ch { - '+' | '-' | '=' => (ch, &change[1..]), - _ => ('=', change) - }; - let mode = u32::from_str_radix(slice, 8).unwrap() as libc::mode_t; // already verified - match action { - '+' => fperm |= mode, - '-' => fperm &= !mode, - '=' => fperm = mode, - _ => unreachable!() - } - } - if unsafe { libc::chmod(path.as_ptr(), fperm) } == 0 { - // TODO: see above - } else { - show_error!("{}", Error::last_os_error()); - return Err(1); - } - } - } - } - - Ok(()) -} diff --git a/src/chmod/deps.mk b/src/chmod/deps.mk deleted file mode 100644 index 07a0616b6..000000000 --- a/src/chmod/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += aho-corasick memchr regex regex-syntax walker diff --git a/src/chroot/Cargo.toml b/src/chroot/Cargo.toml deleted file mode 100644 index 25c36d15f..000000000 --- a/src/chroot/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "chroot" -version = "0.0.1" -authors = [] - -[lib] -name = "chroot" -path = "chroot.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/chroot/chroot.rs b/src/chroot/chroot.rs deleted file mode 100644 index 6ea2699df..000000000 --- a/src/chroot/chroot.rs +++ /dev/null @@ -1,220 +0,0 @@ -#![crate_name = "chroot"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Vsevolod Velichko - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use c_types::{get_pw_from_args, get_group}; -use getopts::Options; -use libc::funcs::posix88::unistd::{setgid, setuid}; -use std::ffi::CString; -use std::io::{Error, Write}; -use std::iter::FromIterator; -use std::path::Path; -use std::process::Command; - -#[path = "../common/util.rs"] #[macro_use] mod util; -#[path = "../common/c_types.rs"] mod c_types; -#[path = "../common/filesystem.rs"] mod filesystem; - -use filesystem::UUPathExt; - -extern { - fn chroot(path: *const libc::c_char) -> libc::c_int; -} - -#[cfg(any(target_os = "macos", target_os = "freebsd"))] -extern { - fn setgroups(size: libc::c_int, list: *const libc::gid_t) -> libc::c_int; -} - -#[cfg(target_os = "linux")] -extern { - fn setgroups(size: libc::size_t, list: *const libc::gid_t) -> libc::c_int; -} - -static NAME: &'static str = "chroot"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - - opts.optopt("u", "user", "User (ID or name) to switch before running the program", "USER"); - opts.optopt("g", "group", "Group (ID or name) to switch to", "GROUP"); - opts.optopt("G", "groups", "Comma-separated list of groups to switch to", "GROUP1,GROUP2..."); - opts.optopt("", "userspec", "Colon-separated user and group to switch to. \ - Same as -u USER -g GROUP. \ - Userspec has higher preference than -u and/or -g", "USER:GROUP"); - opts.optflag("h", "help", "Show help"); - opts.optflag("V", "version", "Show program's version"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - help_menu(opts); - return 1 - } - }; - - if matches.opt_present("V") { version(); return 0 } - if matches.opt_present("h") { help_menu(opts); return 0 } - - if matches.free.len() == 0 { - println!("Missing operand: NEWROOT"); - println!("Try `{} --help` for more information.", NAME); - return 1 - } - - let default_shell: &'static str = "/bin/sh"; - let default_option: &'static str = "-i"; - let user_shell = std::env::var("SHELL"); - - let newroot = Path::new(&matches.free[0][..]); - if !newroot.uu_is_dir() { - crash!(1, "cannot change root directory to `{}`: no such directory", newroot.display()); - } - - let command: Vec<&str> = match matches.free.len() { - 1 => { - let shell: &str = match user_shell { - Err(_) => default_shell, - Ok(ref s) => s.as_ref(), - }; - vec!(shell, default_option) - }, - _ => matches.free[1..].iter().map(|x| &x[..]).collect() - }; - - set_context(&newroot, &matches); - - let pstatus = Command::new(command[0]) - .args(&command[1..]) - .status() - .unwrap_or_else(|e| crash!(1, "Cannot exec: {}", e)); - - if pstatus.success() { - 0 - } else { - match pstatus.code() { - Some(i) => i, - None => -1, - } - } -} - -fn set_context(root: &Path, options: &getopts::Matches) { - let userspec_str = options.opt_str("userspec"); - let user_str = options.opt_str("user").unwrap_or_default(); - let group_str = options.opt_str("group").unwrap_or_default(); - let groups_str = options.opt_str("groups").unwrap_or_default(); - let userspec = match userspec_str { - Some(ref u) => { - let s: Vec<&str> = u.split(':').collect(); - if s.len() != 2 { - crash!(1, "invalid userspec: `{}`", u) - }; - s - } - None => Vec::new() - }; - let user = if userspec.is_empty() { &user_str[..] } else { &userspec[0][..] }; - let group = if userspec.is_empty() { &group_str[..] } else { &userspec[1][..] }; - - enter_chroot(root); - - set_groups_from_str(&groups_str[..]); - set_main_group(&group[..]); - set_user(&user[..]); -} - -fn enter_chroot(root: &Path) { - let root_str = root.display(); - std::env::set_current_dir(root).unwrap(); - let err = unsafe { - chroot(CString::new(".".as_bytes()).unwrap().as_bytes_with_nul().as_ptr() as *const libc::c_char) - }; - if err != 0 { - crash!(1, "cannot chroot to {}: {}", root_str, Error::last_os_error()) - }; -} - -fn set_main_group(group: &str) { - if !group.is_empty() { - let group_id = match get_group(group) { - None => crash!(1, "no such group: {}", group), - Some(g) => g.gr_gid - }; - let err = unsafe { setgid(group_id) }; - if err != 0 { - crash!(1, "cannot set gid to {}: {}", group_id, Error::last_os_error()) - } - } -} - -#[cfg(any(target_os = "macos", target_os = "freebsd"))] -fn set_groups(groups: Vec) -> libc::c_int { - unsafe { - setgroups(groups.len() as libc::c_int, - groups.as_ptr()) - } -} - -#[cfg(target_os = "linux")] -fn set_groups(groups: Vec) -> libc::c_int { - unsafe { - setgroups(groups.len() as libc::size_t, - groups.as_ptr()) - } -} - -fn set_groups_from_str(groups: &str) { - if !groups.is_empty() { - let groups_vec: Vec = FromIterator::from_iter( - groups.split(',').map( - |x| match get_group(x) { - None => crash!(1, "no such group: {}", x), - Some(g) => g.gr_gid - }) - ); - let err = set_groups(groups_vec); - if err != 0 { - crash!(1, "cannot set groups: {}", Error::last_os_error()) - } - } -} - -fn set_user(user: &str) { - if !user.is_empty() { - let user_id = get_pw_from_args(&vec!(user.to_string())).unwrap().pw_uid; - let err = unsafe { setuid(user_id as libc::uid_t) }; - if err != 0 { - crash!(1, "cannot set user to {}: {}", user, Error::last_os_error()) - } - } -} - -fn version() { - println!("{} {}", NAME, VERSION) -} - -fn help_menu(options: Options) { - let msg = format!("{0} {1} - -Usage: - {0} [OPTION]... NEWROOT [COMMAND [ARG]...] - -Run COMMAND with root directory set to NEWROOT. -If COMMAND is not specified, it defaults to '$(SHELL) -i'. -If $(SHELL) is not set, /bin/sh is used.", NAME, VERSION); - - print!("{}", options.usage(&msg)); -} diff --git a/src/cksum/Cargo.toml b/src/cksum/Cargo.toml deleted file mode 100644 index a76fd6dc4..000000000 --- a/src/cksum/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "cksum" -version = "0.0.1" -authors = [] - -[lib] -name = "cksum" -path = "cksum.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/cksum/cksum.rs b/src/cksum/cksum.rs deleted file mode 100644 index 02696ba62..000000000 --- a/src/cksum/cksum.rs +++ /dev/null @@ -1,131 +0,0 @@ -#![crate_name = "cksum"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Michael Gehring - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; - -use getopts::Options; -use std::fs::File; -use std::io::{self, stdin, Read, Write, BufReader}; -use std::mem; -use std::path::Path; - -use crc_table::CRC_TABLE; - -#[path="../common/util.rs"] -#[macro_use] -mod util; - -mod crc_table; - -static NAME: &'static str = "cksum"; -static VERSION: &'static str = "1.0.0"; - -#[inline] -fn crc_update(crc: u32, input: u8) -> u32 { - (crc << 8) ^ CRC_TABLE[((crc >> 24) as usize ^ input as usize) & 0xFF] -} - -#[inline] -fn crc_final(mut crc: u32, mut length: usize) -> u32 { - while length != 0 { - crc = crc_update(crc, length as u8); - length >>= 8; - } - - !crc -} - -#[inline] -fn cksum(fname: &str) -> io::Result<(u32, usize)> { - let mut crc = 0u32; - let mut size = 0usize; - - let file; - let mut rd : Box = match fname { - "-" => { - Box::new(stdin()) - } - _ => { - file = try!(File::open(&Path::new(fname))); - Box::new(BufReader::new(file)) - } - }; - - let mut bytes: [u8; 1024 * 1024] = unsafe { mem::uninitialized() }; - loop { - match rd.read(&mut bytes) { - Ok(num_bytes) => { - if num_bytes == 0 { - return Ok((crc_final(crc, size), size)); - } - for &b in bytes[..num_bytes].iter() { - crc = crc_update(crc, b); - } - size += num_bytes; - } - Err(err) => return Err(err) - } - } -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(err) => panic!("{}", err), - }; - - if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: - {0} [OPTIONS] [FILE]... - -Print CRC and size for each file.", NAME, VERSION); - - print!("{}", opts.usage(&msg)); - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let files = matches.free; - - if files.is_empty() { - match cksum("-") { - Ok((crc, size)) => println!("{} {}", crc, size), - Err(err) => { - show_error!("{}", err); - return 2; - } - } - return 0; - } - - let mut exit_code = 0; - for fname in files.iter() { - match cksum(fname.as_ref()) { - Ok((crc, size)) => println!("{} {} {}", crc, size, fname), - Err(err) => { - show_error!("'{}' {}", fname, err); - exit_code = 2; - } - } - } - - exit_code -} diff --git a/src/cksum/crc_table.rs b/src/cksum/crc_table.rs deleted file mode 100644 index 592dfe9cb..000000000 --- a/src/cksum/crc_table.rs +++ /dev/null @@ -1,3 +0,0 @@ -/* auto-generated (DO NOT EDIT) */ - -pub static CRC_TABLE: [u32; 256] = [0, 79764919, 159529838, 222504665, 319059676, 398814059, 445009330, 507990021, 638119352, 583659535, 797628118, 726387553, 890018660, 835552979, 1015980042, 944750013, 1276238704, 1221641927, 1167319070, 1095957929, 1595256236, 1540665371, 1452775106, 1381403509, 1780037320, 1859660671, 1671105958, 1733955601, 2031960084, 2111593891, 1889500026, 1952343757, 2552477408, 2632100695, 2443283854, 2506133561, 2334638140, 2414271883, 2191915858, 2254759653, 3190512472, 3135915759, 3081330742, 3009969537, 2905550212, 2850959411, 2762807018, 2691435357, 3560074640, 3505614887, 3719321342, 3648080713, 3342211916, 3287746299, 3467911202, 3396681109, 4063920168, 4143685023, 4223187782, 4286162673, 3779000052, 3858754371, 3904687514, 3967668269, 881225847, 809987520, 1023691545, 969234094, 662832811, 591600412, 771767749, 717299826, 311336399, 374308984, 453813921, 533576470, 25881363, 88864420, 134795389, 214552010, 2023205639, 2086057648, 1897238633, 1976864222, 1804852699, 1867694188, 1645340341, 1724971778, 1587496639, 1516133128, 1461550545, 1406951526, 1302016099, 1230646740, 1142491917, 1087903418, 2896545431, 2825181984, 2770861561, 2716262478, 3215044683, 3143675388, 3055782693, 3001194130, 2326604591, 2389456536, 2200899649, 2280525302, 2578013683, 2640855108, 2418763421, 2498394922, 3769900519, 3832873040, 3912640137, 3992402750, 4088425275, 4151408268, 4197601365, 4277358050, 3334271071, 3263032808, 3476998961, 3422541446, 3585640067, 3514407732, 3694837229, 3640369242, 1762451694, 1842216281, 1619975040, 1682949687, 2047383090, 2127137669, 1938468188, 2001449195, 1325665622, 1271206113, 1183200824, 1111960463, 1543535498, 1489069629, 1434599652, 1363369299, 622672798, 568075817, 748617968, 677256519, 907627842, 853037301, 1067152940, 995781531, 51762726, 131386257, 177728840, 240578815, 269590778, 349224269, 429104020, 491947555, 4046411278, 4126034873, 4172115296, 4234965207, 3794477266, 3874110821, 3953728444, 4016571915, 3609705398, 3555108353, 3735388376, 3664026991, 3290680682, 3236090077, 3449943556, 3378572211, 3174993278, 3120533705, 3032266256, 2961025959, 2923101090, 2868635157, 2813903052, 2742672763, 2604032198, 2683796849, 2461293480, 2524268063, 2284983834, 2364738477, 2175806836, 2238787779, 1569362073, 1498123566, 1409854455, 1355396672, 1317987909, 1246755826, 1192025387, 1137557660, 2072149281, 2135122070, 1912620623, 1992383480, 1753615357, 1816598090, 1627664531, 1707420964, 295390185, 358241886, 404320391, 483945776, 43990325, 106832002, 186451547, 266083308, 932423249, 861060070, 1041341759, 986742920, 613929101, 542559546, 756411363, 701822548, 3316196985, 3244833742, 3425377559, 3370778784, 3601682597, 3530312978, 3744426955, 3689838204, 3819031489, 3881883254, 3928223919, 4007849240, 4037393693, 4100235434, 4180117107, 4259748804, 2310601993, 2373574846, 2151335527, 2231098320, 2596047829, 2659030626, 2470359227, 2550115596, 2947551409, 2876312838, 2788305887, 2733848168, 3165939309, 3094707162, 3040238851, 2985771188]; \ No newline at end of file diff --git a/src/cksum/gen_table.rs b/src/cksum/gen_table.rs deleted file mode 100644 index b8b9b62e4..000000000 --- a/src/cksum/gen_table.rs +++ /dev/null @@ -1,41 +0,0 @@ -/* -* This file is part of the uutils coreutils package. -* -* (c) Arcterus -* (c) Michael Gehring -* -* For the full copyright and license information, please view the LICENSE -* file that was distributed with this source code. -*/ - -use std::fs::File; -use std::io::Write; - -static CRC_TABLE_LEN: usize = 256; - -fn main() { - let mut table = Vec::with_capacity(CRC_TABLE_LEN); - for num in (0 .. CRC_TABLE_LEN) { - table.push(crc_entry(num as u8) as u32); - } - let file = File::create("crc_table.rs").unwrap_or_else(|e| panic!("{}", e)); - write!(&file, "/* auto-generated (DO NOT EDIT) */ - -pub static CRC_TABLE: [u32; {}] = {:?};", CRC_TABLE_LEN, table).unwrap(); -} - -#[inline] -fn crc_entry(input: u8) -> u32 { - let mut crc = (input as u32) << 24; - - for _ in (0 .. 8) { - if crc & 0x80000000 != 0 { - crc <<= 1; - crc ^= 0x04c11db7; - } else { - crc <<= 1; - } - } - - crc -} diff --git a/src/comm/Cargo.toml b/src/comm/Cargo.toml deleted file mode 100644 index 214a0ea22..000000000 --- a/src/comm/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "comm" -version = "0.0.1" -authors = [] - -[lib] -name = "comm" -path = "comm.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/comm/comm.rs b/src/comm/comm.rs deleted file mode 100644 index ded6a83cb..000000000 --- a/src/comm/comm.rs +++ /dev/null @@ -1,160 +0,0 @@ -#![crate_name = "comm"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Michael Gehring - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; - -use getopts::Options; -use std::cmp::Ordering; -use std::fs::File; -use std::io::{self, BufRead, BufReader, Read, stdin, Stdin}; -use std::path::Path; - -static NAME: &'static str = "comm"; -static VERSION: &'static str = "1.0.0"; - -fn mkdelim(col: usize, opts: &getopts::Matches) -> String { - let mut s = String::new(); - let delim = match opts.opt_str("output-delimiter") { - Some(d) => d.clone(), - None => "\t".to_string(), - }; - - if col > 1 && !opts.opt_present("1") { - s.push_str(delim.as_ref()); - } - if col > 2 && !opts.opt_present("2") { - s.push_str(delim.as_ref()); - } - - s -} - -fn ensure_nl(line: &mut String) { - match line.chars().last() { - Some('\n') => (), - _ => line.push_str("\n") - } -} - -enum LineReader { - Stdin(Stdin), - FileIn(BufReader) -} - -impl LineReader { - fn read_line(&mut self, buf: &mut String) -> io::Result { - match self { - &mut LineReader::Stdin(ref mut r) => r.read_line(buf), - &mut LineReader::FileIn(ref mut r) => r.read_line(buf), - } - } -} - -fn comm(a: &mut LineReader, b: &mut LineReader, opts: &getopts::Matches) { - - let delim : Vec = (0 .. 4).map(|col| mkdelim(col, opts)).collect(); - - let mut ra = &mut String::new(); - let mut na = a.read_line(ra); - let mut rb = &mut String::new(); - let mut nb = b.read_line(rb); - - while na.is_ok() || nb.is_ok() { - let ord = match (na.is_ok(), nb.is_ok()) { - (false, true) => Ordering::Greater, - (true , false) => Ordering::Less, - (true , true) => match(&na, &nb) { - (&Ok(0), _) => Ordering::Greater, - (_, &Ok(0)) => Ordering::Less, - _ => ra.cmp(&rb), - }, - _ => unreachable!(), - }; - - match ord { - Ordering::Less => { - if !opts.opt_present("1") { - ensure_nl(ra); - print!("{}{}", delim[1], ra); - } - na = a.read_line(ra); - }, - Ordering::Greater => { - if !opts.opt_present("2") { - ensure_nl(rb); - print!("{}{}", delim[2], rb); - } - nb = b.read_line(rb); - }, - Ordering::Equal => { - if !opts.opt_present("3") { - ensure_nl(ra); - print!("{}{}", delim[3], ra); - } - na = a.read_line(ra); - nb = b.read_line(rb); - } - } - } -} - -fn open_file(name: &str) -> io::Result { - match name { - "-" => Ok(LineReader::Stdin(stdin())), - _ => { - let f = try!(File::open(&Path::new(name))); - Ok(LineReader::FileIn(BufReader::new(f))) - } - } -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - opts.optflag("1", "", "suppress column 1 (lines uniq to FILE1)"); - opts.optflag("2", "", "suppress column 2 (lines uniq to FILE2)"); - opts.optflag("3", "", "suppress column 3 (lines that appear in both files)"); - opts.optopt("", "output-delimiter", "separate columns with STR", "STR"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(err) => panic!("{}", err), - }; - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if matches.opt_present("help") || matches.free.len() != 2 { - let msg = format!("{0} {1} - -Usage: - {0} [OPTIONS] FILE1 FILE2 - -Compare sorted files line by line.", NAME, VERSION); - - print!("{}", opts.usage(&msg)); - - if matches.free.len() != 2 { - return 1; - } - return 0; - } - - let mut f1 = open_file(matches.free[0].as_ref()).unwrap(); - let mut f2 = open_file(matches.free[1].as_ref()).unwrap(); - - comm(&mut f1, &mut f2, &matches); - - 0 -} diff --git a/src/common/c_types.rs b/src/common/c_types.rs deleted file mode 100644 index d41871257..000000000 --- a/src/common/c_types.rs +++ /dev/null @@ -1,240 +0,0 @@ -#![allow(dead_code, non_camel_case_types, raw_pointer_derive)] - -extern crate libc; - -use self::libc::{ - c_char, - c_int, - uid_t, - gid_t, -}; -#[cfg(any(target_os = "macos", target_os = "freebsd"))] -use self::libc::time_t; -#[cfg(target_os = "macos")] -use self::libc::int32_t; - -use self::libc::funcs::posix88::unistd::getgroups; - -use std::ffi::{CStr, CString}; -use std::io::{Error, Write}; -use std::iter::repeat; -use std::vec::Vec; - -use std::ptr::{null_mut, read}; - -#[cfg(any(target_os = "macos", target_os = "freebsd"))] -#[repr(C)] -#[derive(Clone, Copy)] -pub struct c_passwd { - pub pw_name: *const c_char, /* user name */ - pub pw_passwd: *const c_char, /* user name */ - pub pw_uid: uid_t, /* user uid */ - pub pw_gid: gid_t, /* user gid */ - pub pw_change: time_t, - pub pw_class: *const c_char, - pub pw_gecos: *const c_char, - pub pw_dir: *const c_char, - pub pw_shell: *const c_char, - pub pw_expire: time_t -} - -#[cfg(target_os = "linux")] -#[repr(C)] -#[derive(Clone, Copy)] -pub struct c_passwd { - pub pw_name: *const c_char, /* user name */ - pub pw_passwd: *const c_char, /* user name */ - pub pw_uid: uid_t, /* user uid */ - pub pw_gid: gid_t, /* user gid */ - pub pw_gecos: *const c_char, - pub pw_dir: *const c_char, - pub pw_shell: *const c_char, -} - -#[cfg(any(target_os = "macos", target_os = "freebsd"))] -#[repr(C)] -pub struct utsname { - pub sysname: [c_char; 256], - pub nodename: [c_char; 256], - pub release: [c_char; 256], - pub version: [c_char; 256], - pub machine: [c_char; 256] -} - -#[cfg(target_os = "linux")] -#[repr(C)] -pub struct utsname { - pub sysname: [c_char; 65], - pub nodename: [c_char; 65], - pub release: [c_char; 65], - pub version: [c_char; 65], - pub machine: [c_char; 65], - pub domainame: [c_char; 65] -} - -#[repr(C)] -pub struct c_group { - pub gr_name: *const c_char, // group name - pub gr_passwd: *const c_char, // password - pub gr_gid: gid_t, // group id - pub gr_mem: *const *const c_char, // member list -} - -#[repr(C)] -pub struct c_tm { - pub tm_sec: c_int, /* seconds */ - pub tm_min: c_int, /* minutes */ - pub tm_hour: c_int, /* hours */ - pub tm_mday: c_int, /* day of the month */ - pub tm_mon: c_int, /* month */ - pub tm_year: c_int, /* year */ - pub tm_wday: c_int, /* day of the week */ - pub tm_yday: c_int, /* day in the year */ - pub tm_isdst: c_int /* daylight saving time */ -} - -extern { - pub fn getpwuid(uid: uid_t) -> *const c_passwd; - pub fn getpwnam(login: *const c_char) -> *const c_passwd; - pub fn getgrgid(gid: gid_t) -> *const c_group; - pub fn getgrnam(name: *const c_char) -> *const c_group; - pub fn getgrouplist(name: *const c_char, - gid: gid_t, - groups: *mut gid_t, - ngroups: *mut c_int) -> c_int; -} - -#[cfg(target_os = "macos")] -extern { - pub fn getgroupcount(name: *const c_char, gid: gid_t) -> int32_t; -} - -pub fn get_pw_from_args(free: &Vec) -> Option { - if free.len() == 1 { - let username = &free[0][..]; - - // Passed user as id - if username.chars().all(|c| c.is_digit(10)) { - let id = username.parse::().unwrap(); - let pw_pointer = unsafe { getpwuid(id as uid_t) }; - - if !pw_pointer.is_null() { - Some(unsafe { read(pw_pointer) }) - } else { - crash!(1, "{}: no such user", username); - } - - // Passed the username as a string - } else { - let pw_pointer = unsafe { - let cstr = CString::new(username).unwrap(); - getpwnam(cstr.as_bytes_with_nul().as_ptr() as *const i8) - }; - if !pw_pointer.is_null() { - Some(unsafe { read(pw_pointer) }) - } else { - crash!(1, "{}: no such user", username); - } - } - } else { - None - } -} - -pub fn get_group(groupname: &str) -> Option { - let group = if groupname.chars().all(|c| c.is_digit(10)) { - unsafe { getgrgid(groupname.parse().unwrap()) } - } else { - unsafe { - let cstr = CString::new(groupname).unwrap(); - getgrnam(cstr.as_bytes_with_nul().as_ptr() as *const c_char) - } - }; - - if !group.is_null() { - Some(unsafe { read(group) }) - } - else { - None - } -} - -pub fn get_group_list(name: *const c_char, gid: gid_t) -> Vec { - let mut ngroups: c_int = 32; - let mut groups: Vec = Vec::with_capacity(ngroups as usize); - - if unsafe { get_group_list_internal(name, gid, groups.as_mut_ptr(), &mut ngroups) } == -1 { - groups.reserve(ngroups as usize); - unsafe { get_group_list_internal(name, gid, groups.as_mut_ptr(), &mut ngroups); } - } else { - groups.truncate(ngroups as usize); - } - unsafe { groups.set_len(ngroups as usize); } - - groups -} - -#[cfg(any(target_os = "linux", target_os = "freebsd"))] -#[inline(always)] -unsafe fn get_group_list_internal(name: *const c_char, gid: gid_t, groups: *mut gid_t, grcnt: *mut c_int) -> c_int { - getgrouplist(name, gid, groups, grcnt) -} - -#[cfg(target_os = "macos")] -unsafe fn get_group_list_internal(name: *const c_char, gid: gid_t, groups: *mut gid_t, grcnt: *mut c_int) -> c_int { - let ngroups = getgroupcount(name, gid); - let oldsize = *grcnt; - *grcnt = ngroups; - if oldsize >= ngroups { - getgrouplist(name, gid, groups, grcnt); - 0 - } else { - -1 - } -} - -pub fn get_groups() -> Result, i32> { - let ngroups = unsafe { getgroups(0, null_mut()) }; - if ngroups == -1 { - return Err(Error::last_os_error().raw_os_error().unwrap()) - } - - let mut groups : Vec= repeat(0).take(ngroups as usize).collect(); - let ngroups = unsafe { getgroups(ngroups, groups.as_mut_ptr()) }; - if ngroups == -1 { - Err(Error::last_os_error().raw_os_error().unwrap()) - } else { - groups.truncate(ngroups as usize); - Ok(groups) - } -} - -pub fn group(possible_pw: Option, nflag: bool) { - let groups = match possible_pw { - Some(pw) => Ok(get_group_list(pw.pw_name, pw.pw_gid)), - None => get_groups(), - }; - - match groups { - Err(errno) => - crash!(1, "failed to get group list (errno={})", errno), - Ok(groups) => { - for &g in groups.iter() { - if nflag { - let group = unsafe { getgrgid(g) }; - if !group.is_null() { - let name = unsafe { - let gname = read(group).gr_name; - let bytes= CStr::from_ptr(gname).to_bytes(); - String::from_utf8_lossy(bytes).to_string() - }; - print!("{} ", name); - } - } else { - print!("{} ", g); - } - } - println!(""); - } - } -} diff --git a/src/common/filesystem.rs b/src/common/filesystem.rs deleted file mode 100644 index e00aa34b8..000000000 --- a/src/common/filesystem.rs +++ /dev/null @@ -1,147 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Joseph Crail - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -// Based on the pattern using by Cargo, I created a shim over the -// standard PathExt trait, so that the unstable path methods could -// be backported to stable (<= 1.1). This will likely be dropped -// when the path trait stabilizes. - -use std::env; -use std::fs; -use std::io::{Error, ErrorKind, Result}; -use std::path::{Component, Path, PathBuf}; - -pub trait UUPathExt { - fn uu_exists(&self) -> bool; - fn uu_is_file(&self) -> bool; - fn uu_is_dir(&self) -> bool; - fn uu_metadata(&self) -> Result; -} - -impl UUPathExt for Path { - fn uu_exists(&self) -> bool { - fs::metadata(self).is_ok() - } - - fn uu_is_file(&self) -> bool { - fs::metadata(self).map(|m| m.is_file()).unwrap_or(false) - } - - fn uu_is_dir(&self) -> bool { - fs::metadata(self).map(|m| m.is_dir()).unwrap_or(false) - } - - fn uu_metadata(&self) -> Result { - fs::metadata(self) - } -} - -#[derive(Clone, Copy, Debug, Eq, PartialEq)] -#[allow(dead_code)] -pub enum CanonicalizeMode { - None, - Normal, - Existing, - Missing, -} - -#[allow(dead_code)] -fn resolve>(original: P) -> Result { - const MAX_LINKS_FOLLOWED: u32 = 255; - let mut followed = 0; - let mut result = original.as_ref().to_path_buf(); - loop { - if followed == MAX_LINKS_FOLLOWED { - return Err(Error::new(ErrorKind::InvalidInput, "maximum links followed")); - } - - match fs::metadata(&result) { - Err(e) => return Err(e), - Ok(ref m) if !m.file_type().is_symlink() => break, - Ok(..) => { - followed += 1; - match fs::read_link(&result) { - Ok(path) => { - result.pop(); - result.push(path); - }, - Err(e) => { - return Err(e); - } - } - } - } - } - Ok(result) -} - -#[allow(dead_code)] -pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> Result { - // Create an absolute path - let original = original.as_ref(); - let original = if original.is_absolute() { - original.to_path_buf() - } else { - env::current_dir().unwrap().join(original) - }; - - let mut result = PathBuf::new(); - let mut parts = vec!(); - - // Split path by directory separator; add prefix (Windows-only) and root - // directory to final path buffer; add remaining parts to temporary - // vector for canonicalization. - for part in original.components() { - match part { - Component::Prefix(_) | Component::RootDir => { - result.push(part.as_os_str()); - }, - Component::CurDir => {}, - Component::ParentDir => { - parts.pop(); - }, - Component::Normal(_) => { - parts.push(part.as_os_str()); - } - } - } - - // Resolve the symlinks where possible - if parts.len() > 0 { - for part in parts[..parts.len()-1].iter() { - result.push(part); - - if can_mode == CanonicalizeMode::None { - continue; - } - - match resolve(&result) { - Err(e) => match can_mode { - CanonicalizeMode::Missing => continue, - _ => return Err(e) - }, - Ok(path) => { - result.pop(); - result.push(path); - } - } - } - - result.push(parts.last().unwrap()); - - match resolve(&result) { - Err(e) => { if can_mode == CanonicalizeMode::Existing { return Err(e); } }, - Ok(path) => { - result.pop(); - result.push(path); - } - } - } - Ok(result) -} diff --git a/src/common/parse_time.rs b/src/common/parse_time.rs deleted file mode 100644 index 608601fe1..000000000 --- a/src/common/parse_time.rs +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Arcterus - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -pub fn from_str(string: &str) -> Result { - let len = string.len(); - if len == 0 { - return Err("empty string".to_string()) - } - let slice = &string[..len - 1]; - let (numstr, times) = match string.chars().next_back().unwrap() { - 's' | 'S' => (slice, 1), - 'm' | 'M' => (slice, 60), - 'h' | 'H' => (slice, 60 * 60), - 'd' | 'D' => (slice, 60 * 60 * 24), - val => { - if !val.is_alphabetic() { - (string, 1) - } else if string == "inf" || string == "infinity" { - ("inf", 1) - } else { - return Err(format!("invalid time interval '{}'", string)) - } - } - }; - match numstr.parse::() { - Ok(m) => Ok(m * times as f64), - Err(e) => Err(format!("invalid time interval '{}': {}", string, e)) - } -} diff --git a/src/common/process.rs b/src/common/process.rs deleted file mode 100644 index 7f098a722..000000000 --- a/src/common/process.rs +++ /dev/null @@ -1,140 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Maciej Dziardziel - * - * For the full copyright and license information, please view the LICENSE file - * that was distributed with this source code. - */ - -extern crate libc; -extern crate time; - -use libc::{c_int, pid_t}; -use std::fmt; -use std::io; -use std::process::Child; -use std::sync::{Arc, Condvar, Mutex}; -use std::thread; -use time::{Duration, get_time}; - -// This is basically sys::unix::process::ExitStatus -#[derive(PartialEq, Eq, Clone, Copy, Debug)] -pub enum ExitStatus { - Code(i32), - Signal(i32), -} - -impl ExitStatus { - fn from_status(status: c_int) -> ExitStatus { - if status & 0x7F != 0 { // WIFSIGNALED(status) - ExitStatus::Signal(status & 0x7F) - } else { - ExitStatus::Code(status & 0xFF00 >> 8) - } - } - - pub fn success(&self) -> bool { - match *self { - ExitStatus::Code(code) => code == 0, - _ => false, - } - } - - pub fn code(&self) -> Option { - match *self { - ExitStatus::Code(code) => Some(code), - _ => None, - } - } - - pub fn signal(&self) -> Option { - match *self { - ExitStatus::Signal(code) => Some(code), - _ => None, - } - } -} - -impl fmt::Display for ExitStatus { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - ExitStatus::Code(code) => write!(f, "exit code: {}", code), - ExitStatus::Signal(code) => write!(f, "exit code: {}", code), - } - } -} - -/// Missing methods for Child objects -pub trait ChildExt { - /// Send a signal to a Child process. - fn send_signal(&mut self, signal: usize) -> io::Result<()>; - - /// Wait for a process to finish or return after the specified duration. - fn wait_or_timeout(&mut self, timeout: f64) -> io::Result>; -} - -impl ChildExt for Child { - fn send_signal(&mut self, signal: usize) -> io::Result<()> { - if unsafe { libc::funcs::posix88::signal::kill(self.id() as pid_t, - signal as i32) } != 0 { - Err(io::Error::last_os_error()) - } else { - Ok(()) - } - } - - fn wait_or_timeout(&mut self, timeout: f64) -> io::Result> { - // The result will be written to that Option, protected by a Mutex - // Then the Condvar will be signaled - let state = Arc::new(( - Mutex::new(Option::None::>), - Condvar::new(), - )); - - // Start the waiting thread - let state_th = state.clone(); - let pid_th = self.id(); - thread::spawn(move || { - let &(ref lock_th, ref cvar_th) = &*state_th; - // Child::wait() would need a &mut to self, can't use that... - // use waitpid() directly, with our own ExitStatus - let mut status: c_int = 0; - let r = unsafe { libc::waitpid(pid_th as i32, &mut status, 0) }; - // Fill the Option and notify on the Condvar - let mut exitstatus_th = lock_th.lock().unwrap(); - if r != pid_th as c_int { - *exitstatus_th = Some(Err(io::Error::last_os_error())); - } else { - let s = ExitStatus::from_status(status); - *exitstatus_th = Some(Ok(s)); - } - cvar_th.notify_one(); - }); - - // Main thread waits - let &(ref lock, ref cvar) = &*state; - let mut exitstatus = lock.lock().unwrap(); - // Condvar::wait_timeout_ms() can wake too soon, in this case wait again - let target = get_time() + - Duration::seconds(timeout as i64) + - Duration::nanoseconds((timeout * 1.0e-6) as i64); - while exitstatus.is_none() { - let now = get_time(); - if now >= target { - return Ok(None) - } - let ms = (target - get_time()).num_milliseconds() as u32; - exitstatus = cvar.wait_timeout_ms(exitstatus, ms).unwrap().0; - } - - // Turn Option> into Result> - match exitstatus.take() { - Some(r) => match r { - Ok(s) => Ok(Some(s)), - Err(e) => Err(e), - }, - None => panic!(), - } - } -} diff --git a/src/common/signals.rs b/src/common/signals.rs deleted file mode 100644 index f48fefd2f..000000000 --- a/src/common/signals.rs +++ /dev/null @@ -1,158 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Maciej Dziardziel - * - * For the full copyright and license information, please view the LICENSE file - * that was distributed with this source code. - */ - -#![allow(dead_code)] - -pub static DEFAULT_SIGNAL:usize= 15; - - -pub struct Signal<'a> { pub name:&'a str, pub value: usize} - -/* - -Linux Programmer's Manual - - 1 HUP 2 INT 3 QUIT 4 ILL 5 TRAP 6 ABRT 7 BUS - 8 FPE 9 KILL 10 USR1 11 SEGV 12 USR2 13 PIPE 14 ALRM -15 TERM 16 STKFLT 17 CHLD 18 CONT 19 STOP 20 TSTP 21 TTIN -22 TTOU 23 URG 24 XCPU 25 XFSZ 26 VTALRM 27 PROF 28 WINCH -29 POLL 30 PWR 31 SYS - - -*/ - -#[cfg(target_os = "linux")] -pub static ALL_SIGNALS:[Signal<'static>; 31] = [ - Signal{ name: "HUP", value:1 }, - Signal{ name: "INT", value:2 }, - Signal{ name: "QUIT", value:3 }, - Signal{ name: "ILL", value:4 }, - Signal{ name: "TRAP", value:5 }, - Signal{ name: "ABRT", value:6 }, - Signal{ name: "BUS", value:7 }, - Signal{ name: "FPE", value:8 }, - Signal{ name: "KILL", value:9 }, - Signal{ name: "USR1", value:10 }, - Signal{ name: "SEGV", value:11 }, - Signal{ name: "USR2", value:12 }, - Signal{ name: "PIPE", value:13 }, - Signal{ name: "ALRM", value:14 }, - Signal{ name: "TERM", value:15 }, - Signal{ name: "STKFLT", value:16 }, - Signal{ name: "CHLD", value:17 }, - Signal{ name: "CONT", value:18 }, - Signal{ name: "STOP", value:19 }, - Signal{ name: "TSTP", value:20 }, - Signal{ name: "TTIN", value:21 }, - Signal{ name: "TTOU", value:22 }, - Signal{ name: "URG", value:23 }, - Signal{ name: "XCPU", value:24 }, - Signal{ name: "XFSZ", value:25 }, - Signal{ name: "VTALRM", value:26 }, - Signal{ name: "PROF", value:27 }, - Signal{ name: "WINCH", value:28 }, - Signal{ name: "POLL", value:29 }, - Signal{ name: "PWR", value:30 }, - Signal{ name: "SYS", value:31 }, -]; - - -/* - - -https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/signal.3.html - - -No Name Default Action Description -1 SIGHUP terminate process terminal line hangup -2 SIGINT terminate process interrupt program -3 SIGQUIT create core image quit program -4 SIGILL create core image illegal instruction -5 SIGTRAP create core image trace trap -6 SIGABRT create core image abort program (formerly SIGIOT) -7 SIGEMT create core image emulate instruction executed -8 SIGFPE create core image floating-point exception -9 SIGKILL terminate process kill program -10 SIGBUS create core image bus error -11 SIGSEGV create core image segmentation violation -12 SIGSYS create core image non-existent system call invoked -13 SIGPIPE terminate process write on a pipe with no reader -14 SIGALRM terminate process real-time timer expired -15 SIGTERM terminate process software termination signal -16 SIGURG discard signal urgent condition present on socket -17 SIGSTOP stop process stop (cannot be caught or ignored) -18 SIGTSTP stop process stop signal generated from keyboard -19 SIGCONT discard signal continue after stop -20 SIGCHLD discard signal child status has changed -21 SIGTTIN stop process background read attempted from control terminal -22 SIGTTOU stop process background write attempted to control terminal -23 SIGIO discard signal I/O is possible on a descriptor (see fcntl(2)) -24 SIGXCPU terminate process cpu time limit exceeded (see setrlimit(2)) -25 SIGXFSZ terminate process file size limit exceeded (see setrlimit(2)) -26 SIGVTALRM terminate process virtual time alarm (see setitimer(2)) -27 SIGPROF terminate process profiling timer alarm (see setitimer(2)) -28 SIGWINCH discard signal Window size change -29 SIGINFO discard signal status request from keyboard -30 SIGUSR1 terminate process User defined signal 1 -31 SIGUSR2 terminate process User defined signal 2 - -*/ - -#[cfg(any(target_os = "macos", target_os = "freebsd"))] -pub static ALL_SIGNALS:[Signal<'static>; 31] = [ - Signal{ name: "HUP", value:1 }, - Signal{ name: "INT", value:2 }, - Signal{ name: "QUIT", value:3 }, - Signal{ name: "ILL", value:4 }, - Signal{ name: "TRAP", value:5 }, - Signal{ name: "ABRT", value:6 }, - Signal{ name: "EMT", value:7 }, - Signal{ name: "FPE", value:8 }, - Signal{ name: "KILL", value:9 }, - Signal{ name: "BUS", value:10 }, - Signal{ name: "SEGV", value:11 }, - Signal{ name: "SYS", value:12 }, - Signal{ name: "PIPE", value:13 }, - Signal{ name: "ALRM", value:14 }, - Signal{ name: "TERM", value:15 }, - Signal{ name: "URG", value:16 }, - Signal{ name: "STOP", value:17 }, - Signal{ name: "TSTP", value:18 }, - Signal{ name: "CONT", value:19 }, - Signal{ name: "CHLD", value:20 }, - Signal{ name: "TTIN", value:21 }, - Signal{ name: "TTOU", value:22 }, - Signal{ name: "IO", value:23 }, - Signal{ name: "XCPU", value:24 }, - Signal{ name: "XFSZ", value:25 }, - Signal{ name: "VTALRM", value:26 }, - Signal{ name: "PROF", value:27 }, - Signal{ name: "WINCH", value:28 }, - Signal{ name: "INFO", value:29 }, - Signal{ name: "USR1", value:30 }, - Signal{ name: "USR2", value:31 }, -]; - -pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { - if signal_name_or_value == "0" { - return Some(0); - } - for signal in ALL_SIGNALS.iter() { - let long_name = format!("SIG{}", signal.name); - if signal.name == signal_name_or_value || (signal_name_or_value == signal.value.to_string()) || (long_name == signal_name_or_value) { - return Some(signal.value); - } - } - None -} - -#[inline(always)] -pub fn is_signal(num: usize) -> bool { - num < ALL_SIGNALS.len() -} diff --git a/src/common/util.rs b/src/common/util.rs deleted file mode 100644 index d333def3e..000000000 --- a/src/common/util.rs +++ /dev/null @@ -1,219 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Arcterus - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -macro_rules! show_error( - ($($args:tt)+) => ({ - pipe_write!(&mut ::std::io::stderr(), "{}: error: ", ::NAME); - pipe_writeln!(&mut ::std::io::stderr(), $($args)+); - }) -); - -#[macro_export] -macro_rules! show_warning( - ($($args:tt)+) => ({ - pipe_write!(&mut ::std::io::stderr(), "{}: warning: ", ::NAME); - pipe_writeln!(&mut ::std::io::stderr(), $($args)+); - }) -); - -#[macro_export] -macro_rules! show_info( - ($($args:tt)+) => ({ - pipe_write!(&mut ::std::io::stderr(), "{}: ", ::NAME); - pipe_writeln!(&mut ::std::io::stderr(), $($args)+); - }) -); - -#[macro_export] -macro_rules! eprint( - ($($args:tt)+) => (pipe_write!(&mut ::std::io::stderr(), $($args)+)) -); - -#[macro_export] -macro_rules! eprintln( - ($($args:tt)+) => (pipe_writeln!(&mut ::std::io::stderr(), $($args)+)) -); - -#[macro_export] -macro_rules! crash( - ($exitcode:expr, $($args:tt)+) => ({ - show_error!($($args)+); - ::std::process::exit($exitcode) - }) -); - -#[macro_export] -macro_rules! exit( - ($exitcode:expr) => ({ - ::std::process::exit($exitcode) - }) -); - -#[macro_export] -macro_rules! crash_if_err( - ($exitcode:expr, $exp:expr) => ( - match $exp { - Ok(m) => m, - Err(f) => crash!($exitcode, "{}", f), - } - ) -); - -#[macro_export] -macro_rules! pipe_crash_if_err( - ($exitcode:expr, $exp:expr) => ( - match $exp { - Ok(_) => (), - Err(f) => { - if f.kind() == ::std::io::ErrorKind::BrokenPipe { - () - } else { - crash!($exitcode, "{}", f) - } - }, - } - ) -); - -#[macro_export] -macro_rules! return_if_err( - ($exitcode:expr, $exp:expr) => ( - match $exp { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - return $exitcode; - } - } - ) -); - -// XXX: should the pipe_* macros return an Err just to show the write failed? - -#[macro_export] -macro_rules! pipe_print( - ($($args:tt)+) => ( - match write!(&mut ::std::io::stdout(), $($args)+) { - Ok(_) => true, - Err(f) => { - if f.kind() == ::std::io::ErrorKind::BrokenPipe { - false - } else { - panic!("{}", f) - } - } - } - ) -); - -#[macro_export] -macro_rules! pipe_println( - ($($args:tt)+) => ( - match writeln!(&mut ::std::io::stdout(), $($args)+) { - Ok(_) => true, - Err(f) => { - if f.kind() == ::std::io::ErrorKind::BrokenPipe { - false - } else { - panic!("{}", f) - } - } - } - ) -); - -#[macro_export] -macro_rules! pipe_write( - ($fd:expr, $($args:tt)+) => ( - match write!($fd, $($args)+) { - Ok(_) => true, - Err(f) => { - if f.kind() == ::std::io::ErrorKind::BrokenPipe { - false - } else { - panic!("{}", f) - } - } - } - ) -); - -#[macro_export] -macro_rules! pipe_writeln( - ($fd:expr, $($args:tt)+) => ( - match writeln!($fd, $($args)+) { - Ok(_) => true, - Err(f) => { - if f.kind() == ::std::io::ErrorKind::BrokenPipe { - false - } else { - panic!("{}", f) - } - } - } - ) -); - -#[macro_export] -macro_rules! pipe_flush( - () => ( - match ::std::io::stdout().flush() { - Ok(_) => true, - Err(f) => { - if f.kind() == ::std::io::ErrorKind::BrokenPipe { - false - } else { - panic!("{}", f) - } - } - } - ); - ($fd:expr) => ( - match $fd.flush() { - Ok(_) => true, - Err(f) => { - if f.kind() == ::std::io::ErrorKind::BrokenPipe { - false - } else { - panic!("{}", f) - } - } - } - ) -); - -#[macro_export] -macro_rules! safe_write( - ($fd:expr, $($args:tt)+) => ( - match write!($fd, $($args)+) { - Ok(_) => {} - Err(f) => panic!(f.to_string()) - } - ) -); - -#[macro_export] -macro_rules! safe_writeln( - ($fd:expr, $($args:tt)+) => ( - match writeln!($fd, $($args)+) { - Ok(_) => {} - Err(f) => panic!(f.to_string()) - } - ) -); - -#[macro_export] -macro_rules! safe_unwrap( - ($exp:expr) => ( - match $exp { - Ok(m) => m, - Err(f) => crash!(1, "{}", f.to_string()) - } - ) -); diff --git a/src/common/utmpx.rs b/src/common/utmpx.rs deleted file mode 100644 index a210dfff4..000000000 --- a/src/common/utmpx.rs +++ /dev/null @@ -1,126 +0,0 @@ -#![allow(non_camel_case_types)] -#![allow(dead_code)] - -extern crate libc; - -pub use self::utmpx::{DEFAULT_FILE,USER_PROCESS,BOOT_TIME,c_utmp}; -#[cfg(target_os = "linux")] -mod utmpx { - use super::libc; - - pub static DEFAULT_FILE: &'static str = "/var/run/utmp"; - - pub const UT_LINESIZE: usize = 32; - pub const UT_NAMESIZE: usize = 32; - pub const UT_IDSIZE: usize = 4; - pub const UT_HOSTSIZE: usize = 256; - - pub const EMPTY: libc::c_short = 0; - pub const RUN_LVL: libc::c_short = 1; - pub const BOOT_TIME: libc::c_short = 2; - pub const NEW_TIME: libc::c_short = 3; - pub const OLD_TIME: libc::c_short = 4; - pub const INIT_PROCESS: libc::c_short = 5; - pub const LOGIN_PROCESS: libc::c_short = 6; - pub const USER_PROCESS: libc::c_short = 7; - pub const DEAD_PROCESS: libc::c_short = 8; - pub const ACCOUNTING: libc::c_short = 9; - - #[repr(C)] - pub struct c_exit_status { - pub e_termination: libc::c_short, - pub e_exit: libc::c_short, - } - - #[repr(C)] - pub struct c_utmp { - pub ut_type: libc::c_short, - pub ut_pid: libc::pid_t, - pub ut_line: [libc::c_char; UT_LINESIZE], - pub ut_id: [libc::c_char; UT_IDSIZE], - - pub ut_user: [libc::c_char; UT_NAMESIZE], - pub ut_host: [libc::c_char; UT_HOSTSIZE], - pub ut_exit: c_exit_status, - pub ut_session: libc::c_long, - pub ut_tv: libc::timeval, - - pub ut_addr_v6: [libc::int32_t; 4], - pub __unused: [libc::c_char; 20], - } -} - -#[cfg(target_os = "macos")] -mod utmpx { - use super::libc; - - pub static DEFAULT_FILE: &'static str = "/var/run/utmpx"; - - pub const UT_LINESIZE: usize = 32; - pub const UT_NAMESIZE: usize = 256; - pub const UT_IDSIZE: usize = 4; - pub const UT_HOSTSIZE: usize = 256; - - pub const EMPTY: libc::c_short = 0; - pub const RUN_LVL: libc::c_short = 1; - pub const BOOT_TIME: libc::c_short = 2; - pub const OLD_TIME: libc::c_short = 3; - pub const NEW_TIME: libc::c_short = 4; - pub const INIT_PROCESS: libc::c_short = 5; - pub const LOGIN_PROCESS: libc::c_short = 6; - pub const USER_PROCESS: libc::c_short = 7; - pub const DEAD_PROCESS: libc::c_short = 8; - pub const ACCOUNTING: libc::c_short = 9; - - #[repr(C)] - pub struct c_exit_status { - pub e_termination: libc::c_short, - pub e_exit: libc::c_short, - } - - #[repr(C)] - pub struct c_utmp { - pub ut_user: [libc::c_char; UT_NAMESIZE], - pub ut_id: [libc::c_char; UT_IDSIZE], - pub ut_line: [libc::c_char; UT_LINESIZE], - pub ut_pid: libc::pid_t, - pub ut_type: libc::c_short, - pub ut_tv: libc::timeval, - pub ut_host: [libc::c_char; UT_HOSTSIZE], - pub __unused: [libc::c_char; 16] - } -} - -#[cfg(target_os = "freebsd")] -mod utmpx { - use super::libc; - - pub static DEFAULT_FILE : &'static str = ""; - - pub const UT_LINESIZE : usize = 16; - pub const UT_NAMESIZE : usize = 32; - pub const UT_IDSIZE : usize = 8; - pub const UT_HOSTSIZE : usize = 128; - - pub const EMPTY : libc::c_short = 0; - pub const BOOT_TIME : libc::c_short = 1; - pub const OLD_TIME : libc::c_short = 2; - pub const NEW_TIME : libc::c_short = 3; - pub const USER_PROCESS : libc::c_short = 4; - pub const INIT_PROCESS : libc::c_short = 5; - pub const LOGIN_PROCESS : libc::c_short = 6; - pub const DEAD_PROCESS : libc::c_short = 7; - pub const SHUTDOWN_TIME : libc::c_short = 8; - - #[repr(C)] - pub struct c_utmp { - pub ut_type : libc::c_short, - pub ut_tv : libc::timeval, - pub ut_id : [libc::c_char; UT_IDSIZE], - pub ut_pid : libc::pid_t, - pub ut_user : [libc::c_char; UT_NAMESIZE], - pub ut_line : [libc::c_char; UT_LINESIZE], - pub ut_host : [libc::c_char; UT_HOSTSIZE], - pub ut_spare : [libc::c_char; 64], - } -} diff --git a/src/common/wide.rs b/src/common/wide.rs deleted file mode 100644 index 189e84438..000000000 --- a/src/common/wide.rs +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Peter Atashian - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -use std::ffi::{OsStr, OsString}; -use std::os::windows::ffi::{OsStrExt, OsStringExt}; -pub trait ToWide { - fn to_wide(&self) -> Vec; - fn to_wide_null(&self) -> Vec; -} -impl ToWide for T where T: AsRef { - fn to_wide(&self) -> Vec { - self.as_ref().encode_wide().collect() - } - fn to_wide_null(&self) -> Vec { - self.as_ref().encode_wide().chain(Some(0)).collect() - } -} -pub trait FromWide { - fn from_wide(wide: &[u16]) -> Self; - fn from_wide_null(wide: &[u16]) -> Self; -} -impl FromWide for String { - fn from_wide(wide: &[u16]) -> String { - OsString::from_wide(wide).to_string_lossy().into_owned() - } - fn from_wide_null(wide: &[u16]) -> String { - let len = wide.iter().take_while(|&&c| c != 0).count(); - OsString::from_wide(&wide[..len]).to_string_lossy().into_owned() - } -} \ No newline at end of file diff --git a/src/cp/Cargo.toml b/src/cp/Cargo.toml deleted file mode 100644 index b443112d6..000000000 --- a/src/cp/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "cp" -version = "0.0.1" -authors = [] - -[lib] -name = "cp" -path = "cp.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/cp/cp.rs b/src/cp/cp.rs deleted file mode 100644 index 3c0fa2944..000000000 --- a/src/cp/cp.rs +++ /dev/null @@ -1,161 +0,0 @@ -#![crate_name = "cp"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordy Dickinson - * - * For the full copyright and license information, please view the LICENSE file - * that was distributed with this source code. - */ - -extern crate getopts; - -use getopts::Options; -use std::fs; -use std::io::{ErrorKind, Result, Write}; -use std::path::Path; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/filesystem.rs"] -mod filesystem; - -use filesystem::{canonicalize, CanonicalizeMode, UUPathExt}; - -#[derive(Clone, Eq, PartialEq)] -pub enum Mode { - Copy, - Help, - Version, -} - -static NAME: &'static str = "cp"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(e) => { - show_error!("{}", e); - panic!() - }, - }; - - let usage = opts.usage("Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY."); - let mode = if matches.opt_present("version") { - Mode::Version - } else if matches.opt_present("help") { - Mode::Help - } else { - Mode::Copy - }; - - match mode { - Mode::Copy => copy(matches), - Mode::Help => help(&usage), - Mode::Version => version(), - } - - 0 -} - -fn version() { - println!("{} {}", NAME, VERSION); -} - -fn help(usage: &String) { - let msg = format!("{0} {1}\n\n\ - Usage: {0} SOURCE DEST\n \ - or: {0} SOURCE... DIRECTORY\n \ - or: {0} -t DIRECTORY SOURCE\n\ - \n\ - {2}", NAME, VERSION, usage); - println!("{}", msg); -} - -fn copy(matches: getopts::Matches) { - let sources: Vec = if matches.free.is_empty() { - show_error!("Missing SOURCE argument. Try --help."); - panic!() - } else { - // All but the last argument: - matches.free[..matches.free.len() - 1].iter().map(|arg| arg.clone()).collect() - }; - let dest = if matches.free.len() < 2 { - show_error!("Missing DEST argument. Try --help."); - panic!() - } else { - // Only the last argument: - Path::new(&matches.free[matches.free.len() - 1]) - }; - - assert!(sources.len() >= 1); - - if sources.len() == 1 { - let source = Path::new(&sources[0]); - let same_file = paths_refer_to_same_file(source, dest).unwrap_or_else(|err| { - match err.kind() { - ErrorKind::NotFound => false, - _ => { - show_error!("{}", err); - panic!() - } - } - }); - - if same_file { - show_error!("\"{}\" and \"{}\" are the same file", - source.display(), - dest.display()); - panic!(); - } - - if let Err(err) = fs::copy(source, dest) { - show_error!("{}", err); - panic!(); - } - } else { - if !dest.uu_is_dir() { - show_error!("TARGET must be a directory"); - panic!(); - } - - for src in sources.iter() { - let source = Path::new(&src); - - if !source.uu_is_file() { - show_error!("\"{}\" is not a file", source.display()); - continue; - } - - let mut full_dest = dest.to_path_buf(); - - full_dest.push(source.to_str().unwrap()); - - println!("{}", full_dest.display()); - - let io_result = fs::copy(source, full_dest); - - if let Err(err) = io_result { - show_error!("{}", err); - panic!() - } - } - } -} - -pub fn paths_refer_to_same_file(p1: &Path, p2: &Path) -> Result { - // We have to take symlinks and relative paths into account. - let pathbuf1 = try!(canonicalize(p1, CanonicalizeMode::Normal)); - let pathbuf2 = try!(canonicalize(p2, CanonicalizeMode::Normal)); - - Ok(pathbuf1 == pathbuf2) -} diff --git a/src/cut/Cargo.toml b/src/cut/Cargo.toml deleted file mode 100644 index dc3d30ca9..000000000 --- a/src/cut/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "cut" -version = "0.0.1" -authors = [] - -[lib] -name = "cut" -path = "cut.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/cut/buffer.rs b/src/cut/buffer.rs deleted file mode 100644 index da700513b..000000000 --- a/src/cut/buffer.rs +++ /dev/null @@ -1,151 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Rolf Morel - * (c) kwantam - * substantially rewritten to use the stdlib BufReader trait - * rather than re-implementing it here. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use std::io::{BufRead, BufReader, Read, Write}; -use std::io::Result as IoResult; - -#[allow(non_snake_case)] -pub mod Bytes { - use std::io::Write; - - pub trait Select { - fn select(&mut self, bytes: usize, out: Option<&mut W>) -> Selected; - } - - #[derive(PartialEq, Eq, Debug)] - pub enum Selected { - NewlineFound, - Complete(usize), - Partial(usize), - EndOfFile, - } -} - -#[derive(Debug)] -pub struct ByteReader where R: Read { - inner: BufReader, -} - -impl ByteReader { - pub fn new(read: R) -> ByteReader { - ByteReader { - inner: BufReader::with_capacity(4096, read), - } - } -} - -impl Read for ByteReader { - fn read(&mut self, buf: &mut [u8]) -> IoResult { - self.inner.read(buf) - } -} - -impl BufRead for ByteReader { - fn fill_buf(&mut self) -> IoResult<&[u8]> { - self.inner.fill_buf() - } - - fn consume(&mut self, amt: usize) { - self.inner.consume(amt) - } -} - -impl ByteReader { - pub fn consume_line(&mut self) -> usize { - let mut bytes_consumed = 0; - let mut consume_val; - - loop { - { // need filled_buf to go out of scope - let filled_buf = match self.fill_buf() { - Ok(b) => { - if b.len() == 0 { - return bytes_consumed - } else { - b - } - }, - Err(e) => crash!(1, "read error: {}", e), - }; - - match filled_buf.iter().position(|byte| *byte == b'\n') { - Some(idx) => { - consume_val = idx + 1; - bytes_consumed += consume_val; - break; - } - _ => () - } - - consume_val = filled_buf.len(); - } - - bytes_consumed += consume_val; - self.consume(consume_val); - } - - self.consume(consume_val); - return bytes_consumed; - } -} - -impl self::Bytes::Select for ByteReader { - fn select(&mut self, bytes: usize, out: Option<&mut W>) -> Bytes::Selected { - enum SRes { - Comp, - Part, - Newl, - }; - - use self::Bytes::Selected::*; - - let (res, consume_val) = { - let buffer = match self.fill_buf() { - Err(e) => crash!(1, "read error: {}", e), - Ok(b) => b, - }; - - let (res, consume_val) = match buffer.len() { - 0 => return EndOfFile, - buf_used if bytes < buf_used => { - // because the output delimiter should only be placed between - // segments check if the byte after bytes is a newline - let buf_slice = &buffer[0..bytes + 1]; - - match buf_slice.iter().position(|byte| *byte == b'\n') { - Some(idx) => (SRes::Newl, idx+1), - None => (SRes::Comp, bytes), - } - }, - _ => { - match buffer.iter().position(|byte| *byte == b'\n') { - Some(idx) => (SRes::Newl, idx+1), - None => (SRes::Part, buffer.len()), - } - }, - }; - - match out { - Some(out) => pipe_crash_if_err!(1, out.write_all(&buffer[0..consume_val])), - None => (), - } - (res, consume_val) - }; - - self.consume(consume_val); - match res { - SRes::Comp => Complete(consume_val), - SRes::Part => Partial(consume_val), - SRes::Newl => NewlineFound, - } - } -} diff --git a/src/cut/cut.rs b/src/cut/cut.rs deleted file mode 100644 index 1381e115b..000000000 --- a/src/cut/cut.rs +++ /dev/null @@ -1,546 +0,0 @@ -#![crate_name = "cut"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Rolf Morel - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::fs::File; -use std::io::{stdout, stdin, BufRead, BufReader, Read, Stdout, Write}; -use std::path::Path; - -use ranges::Range; -use searcher::Searcher; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/filesystem.rs"] -mod filesystem; - -use filesystem::UUPathExt; - -mod buffer; -mod ranges; -mod searcher; - -static NAME: &'static str = "cut"; -static VERSION: &'static str = "1.0.0"; - -struct Options { - out_delim: Option, -} - -struct FieldOptions { - delimiter: String, // one char long, String because of UTF8 representation - out_delimeter: Option, - only_delimited: bool, -} - -enum Mode { - Bytes(Vec, Options), - Characters(Vec, Options), - Fields(Vec, FieldOptions), -} - -fn list_to_ranges(list: &str, complement: bool) -> Result, String> { - if complement { - Range::from_list(list).map(|r| ranges::complement(&r)) - } else { - Range::from_list(list) - } -} - -fn cut_bytes(reader: R, ranges: &Vec, opts: &Options) -> i32 { - use buffer::Bytes::Select; - use buffer::Bytes::Selected::*; - - let mut buf_read = buffer::ByteReader::new(reader); - let mut out = stdout(); - - 'newline: loop { - let mut cur_pos = 1; - let mut print_delim = false; - - for &Range { low, high } in ranges.iter() { - // skip upto low - let orig_pos = cur_pos; - loop { - match buf_read.select(low - cur_pos, None::<&mut Stdout>) { - NewlineFound => { - pipe_crash_if_err!(1, out.write_all(&[b'\n'])); - continue 'newline - } - Complete(len) => { - cur_pos += len; - break - } - Partial(len) => cur_pos += len, - EndOfFile => { - if orig_pos != cur_pos { - pipe_crash_if_err!(1, out.write_all(&[b'\n'])); - } - - break 'newline - } - } - } - - match opts.out_delim { - Some(ref delim) => { - if print_delim { - pipe_crash_if_err!(1, out.write_all(delim.as_bytes())); - } - print_delim = true; - } - None => () - } - - // write out from low to high - loop { - match buf_read.select(high - cur_pos + 1, Some(&mut out)) { - NewlineFound => continue 'newline, - Partial(len) => cur_pos += len, - Complete(_) => { - cur_pos = high + 1; - break - } - EndOfFile => { - if cur_pos != low || low == high { - pipe_crash_if_err!(1, out.write_all(&[b'\n'])); - } - - break 'newline - } - } - } - } - - buf_read.consume_line(); - pipe_crash_if_err!(1, out.write_all(&[b'\n'])); - } - - 0 -} - -fn cut_characters(reader: R, ranges: &Vec, opts: &Options) -> i32 { - let mut buf_in = BufReader::new(reader); - let mut out = stdout(); - let mut buffer = String::new(); - - 'newline: loop { - buffer.clear(); - match buf_in.read_line(&mut buffer) { - Ok(n) if n == 0 => break, - Err(e) => { - if buffer.len() == 0 { - crash!(1, "read error: {}", e); - } - }, - _ => (), - }; - - let line = &buffer[..]; - let mut char_pos = 0; - let mut char_indices = line.char_indices(); - let mut print_delim = false; - let mut low_idx = 0; - - for &Range { low, high } in ranges.iter() { - low_idx = if low - char_pos > 0 { - match char_indices.nth(low - char_pos - 1) { - Some((low_idx, _)) => low_idx, - None => break, - } - } else { - low_idx - }; - - match opts.out_delim { - Some(ref delim) => { - if print_delim { - pipe_crash_if_err!(1, out.write_all(delim.as_bytes())); - } - print_delim = true; - } - None => () - } - - match char_indices.nth(high - low) { - Some((high_idx, _)) => { - let segment = &line.as_bytes()[low_idx..high_idx]; - low_idx = high_idx; - - pipe_crash_if_err!(1, out.write_all(segment)); - } - None => { - let bytes = line.as_bytes(); - let segment = &bytes[low_idx..]; - - pipe_crash_if_err!(1, out.write_all(segment)); - - if line.as_bytes()[bytes.len() - 1] == b'\n' { - continue 'newline - } - } - } - - char_pos = high + 1; - } - pipe_crash_if_err!(1, out.write_all(&[b'\n'])); - } - - 0 -} - -fn cut_fields_delimiter(reader: R, ranges: &Vec, delim: &String, only_delimited: bool, out_delim: &String) -> i32 { - let mut buf_in = BufReader::new(reader); - let mut out = stdout(); - let mut buffer = Vec::new(); - - 'newline: loop { - buffer.clear(); - match buf_in.read_until(b'\n', &mut buffer) { - Ok(n) if n == 0 => break, - Err(e) => { - if buffer.len() == 0 { - crash!(1, "read error: {}", e); - } - }, - _ => (), - } - - let line = &buffer[..]; - let mut fields_pos = 1; - let mut low_idx = 0; - let mut delim_search = Searcher::new(line, delim.as_bytes()).peekable(); - let mut print_delim = false; - - if delim_search.peek().is_none() { - if ! only_delimited { - pipe_crash_if_err!(1, out.write_all(line)); - if line[line.len() - 1] != b'\n' { - pipe_crash_if_err!(1, out.write_all(&[b'\n'])); - } - } - - continue - } - - for &Range { low, high } in ranges.iter() { - if low - fields_pos > 0 { - low_idx = match delim_search.nth(low - fields_pos - 1) { - Some((_, beyond_delim)) => beyond_delim, - None => break - }; - } - - for _ in 0..high - low + 1 { - if print_delim { - pipe_crash_if_err!(1, out.write_all(out_delim.as_bytes())); - } - - match delim_search.next() { - Some((high_idx, next_low_idx)) => { - let segment = &line[low_idx..high_idx]; - - pipe_crash_if_err!(1, out.write_all(segment)); - - print_delim = true; - - low_idx = next_low_idx; - fields_pos = high + 1; - } - None => { - let segment = &line[low_idx..]; - - pipe_crash_if_err!(1, out.write_all(segment)); - - if line[line.len() - 1] == b'\n' { - continue 'newline - } - break - } - } - } - } - - pipe_crash_if_err!(1, out.write_all(&[b'\n'])); - } - - 0 -} - -fn cut_fields(reader: R, ranges: &Vec, opts: &FieldOptions) -> i32 { - match opts.out_delimeter { - Some(ref o_delim) => { - return cut_fields_delimiter(reader, ranges, &opts.delimiter, - opts.only_delimited, o_delim); - } - None => () - } - - let mut buf_in = BufReader::new(reader); - let mut out = stdout(); - let mut buffer = Vec::new(); - - 'newline: loop { - buffer.clear(); - match buf_in.read_until(b'\n', &mut buffer) { - Ok(n) if n == 0 => break, - Err(e) => { - if buffer.len() == 0 { - crash!(1, "read error: {}", e); - } - }, - _ => (), - } - - let line = &buffer[..]; - let mut fields_pos = 1; - let mut low_idx = 0; - let mut delim_search = Searcher::new(line, opts.delimiter.as_bytes()).peekable(); - let mut print_delim = false; - - if delim_search.peek().is_none() { - if ! opts.only_delimited { - pipe_crash_if_err!(1, out.write_all(line)); - if line[line.len() - 1] != b'\n' { - pipe_crash_if_err!(1, out.write_all(&[b'\n'])); - } - } - - continue - } - - for &Range { low, high } in ranges.iter() { - if low - fields_pos > 0 { - low_idx = match delim_search.nth(low - fields_pos - 1) { - Some((_, beyond_delim)) => beyond_delim, - None => break - }; - } - - if print_delim { - if low_idx >= opts.delimiter.as_bytes().len() { - low_idx -= opts.delimiter.as_bytes().len(); - } - } - - match delim_search.nth(high - low) { - Some((high_idx, next_low_idx)) => { - let segment = &line[low_idx..high_idx]; - - pipe_crash_if_err!(1, out.write_all(segment)); - - print_delim = true; - low_idx = next_low_idx; - fields_pos = high + 1; - } - None => { - let segment = &line[low_idx..line.len()]; - - pipe_crash_if_err!(1, out.write_all(segment)); - - if line[line.len() - 1] == b'\n' { - continue 'newline - } - break - } - } - } - - pipe_crash_if_err!(1, out.write_all(&[b'\n'])); - } - - 0 -} - -fn cut_files(mut filenames: Vec, mode: Mode) -> i32 { - let mut stdin_read = false; - let mut exit_code = 0; - - if filenames.len() == 0 { filenames.push("-".to_string()); } - - for filename in filenames.iter() { - if filename == "-" { - if stdin_read { continue } - - exit_code |= match mode { - Mode::Bytes(ref ranges, ref opts) => cut_bytes(stdin(), ranges, opts), - Mode::Characters(ref ranges, ref opts) => cut_characters(stdin(), ranges, opts), - Mode::Fields(ref ranges, ref opts) => cut_fields(stdin(), ranges, opts), - }; - - stdin_read = true; - } else { - let path = Path::new(&filename[..]); - - if !path.uu_exists() { - show_error!("{}: No such file or directory", filename); - continue - } - - let file = match File::open(&path) { - Ok(f) => f, - Err(e) => { - show_error!("opening '{}': {}", &filename[..], e); - continue - } - }; - - exit_code |= match mode { - Mode::Bytes(ref ranges, ref opts) => cut_bytes(file, ranges, opts), - Mode::Characters(ref ranges, ref opts) => cut_characters(file, ranges, opts), - Mode::Fields(ref ranges, ref opts) => cut_fields(file, ranges, opts), - }; - } - } - - exit_code -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optopt("b", "bytes", "select only these bytes", "LIST"); - opts.optopt("c", "characters", "select only these characters", "LIST"); - opts.optopt("d", "delimiter", "use DELIM instead of TAB for field delimiter", "DELIM"); - opts.optopt("f", "fields", "select only these fields; also print any line that contains no delimiter character, unless the -s option is specified", "LIST"); - opts.optflag("n", "", "(ignored)"); - opts.optflag("", "complement", "complement the set of selected bytes, characters or fields"); - opts.optflag("s", "only-delimited", "do not print lines not containing delimiters"); - opts.optopt("", "output-delimiter", "use STRING as the output delimiter the default is to use the input delimiter", "STRING"); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("Invalid options\n{}", f); - return 1; - } - }; - - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {0} OPTION... [FILE]...", NAME); - println!(""); - println!("{}", opts.usage("Print selected parts of lines from each FILE to standard output.")); - println!(""); - println!("Use one, and only one of -b, -c or -f. Each LIST is made up of one"); - println!("range, or many ranges separated by commas. Selected input is written"); - println!("in the same order that it is read, and is written exactly once."); - println!("Each range is one of:"); - println!(""); - println!(" N N'th byte, character or field, counted from 1"); - println!(" N- from N'th byte, character or field, to end of line"); - println!(" N-M from N'th to M'th (included) byte, character or field"); - println!(" -M from first to M'th (included) byte, character or field"); - println!(""); - println!("With no FILE, or when FILE is -, read standard input."); - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let complement = matches.opt_present("complement"); - - let mode_parse = match (matches.opt_str("bytes"), - matches.opt_str("characters"), - matches.opt_str("fields")) { - (Some(byte_ranges), None, None) => { - list_to_ranges(&byte_ranges[..], complement) - .map(|ranges| Mode::Bytes(ranges, Options { out_delim: matches.opt_str("output-delimiter") })) - } - (None, Some(char_ranges), None) => { - list_to_ranges(&char_ranges[..], complement) - .map(|ranges| Mode::Characters(ranges, Options { out_delim: matches.opt_str("output-delimiter") })) - } - (None, None, Some(field_ranges)) => { - list_to_ranges(&field_ranges[..], complement).and_then(|ranges| - { - let out_delim = match matches.opt_str("output-delimiter") { - Some(s) => { - if s.len() == 0 { - Some("\0".to_string()) - } else { - Some(s) - } - }, - None => None, - }; - - let only_delimited = matches.opt_present("only-delimited"); - - match matches.opt_str("delimiter") { - Some(delim) => { - if delim.chars().count() > 1 { - Err("the delimiter must be a single character, or the empty string for null".to_string()) - } else { - let delim = if delim.len() == 0 { - "\0".to_string() - } else { - delim - }; - - Ok(Mode::Fields(ranges, - FieldOptions { - delimiter: delim, - out_delimeter: out_delim, - only_delimited: only_delimited - })) - } - } - None => Ok(Mode::Fields(ranges, - FieldOptions { - delimiter: "\t".to_string(), - out_delimeter: out_delim, - only_delimited: only_delimited - })) - } - } - ) - } - (ref b, ref c, ref f) if b.is_some() || c.is_some() || f.is_some() => { - Err("only one type of list may be specified".to_string()) - } - _ => Err("you must specify a list of bytes, characters, or fields".to_string()) - }; - - let mode_parse = match mode_parse { - Err(_) => mode_parse, - Ok(mode) => { - match mode { - Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.opt_present("delimiter") => - Err("an input delimiter may be specified only when operating on fields".to_string()), - Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.opt_present("only-delimited") => - Err("suppressing non-delimited lines makes sense only when operating on fields".to_string()), - _ => Ok(mode), - } - } - }; - - match mode_parse { - Ok(mode) => cut_files(matches.free, mode), - Err(err_msg) => { - show_error!("{}\n\ - Try '{} --help' for more information", - err_msg, args[0]); - 1 - } - } -} diff --git a/src/cut/ranges.rs b/src/cut/ranges.rs deleted file mode 100644 index 3e5bfd3d5..000000000 --- a/src/cut/ranges.rs +++ /dev/null @@ -1,133 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Rolf Morel - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use std::str::FromStr; - -#[derive(PartialEq,Eq,PartialOrd,Ord,Debug)] -pub struct Range { - pub low: usize, - pub high: usize, -} - -impl FromStr for Range { - type Err = &'static str; - - fn from_str(s: &str) -> Result { - use std::usize::MAX; - - let mut parts = s.splitn(2, '-'); - - let field = "fields and positions are numbered from 1"; - let order = "high end of range less than low end"; - let inval = "failed to parse range"; - - match (parts.next(), parts.next()) { - (Some(nm), None) => { - if let Ok(nm) = nm.parse::() { - if nm > 0 { Ok(Range{ low: nm, high: nm}) } else { Err(field) } - } else { - Err(inval) - } - } - (Some(n), Some(m)) if m.len() == 0 => { - if let Ok(low) = n.parse::() { - if low > 0 { Ok(Range{ low: low, high: MAX}) } else { Err(field) } - } else { - Err(inval) - } - } - (Some(n), Some(m)) if n.len() == 0 => { - if let Ok(high) = m.parse::() { - if high > 0 { Ok(Range{ low: 1, high: high}) } else { Err(field) } - } else { - Err(inval) - } - } - (Some(n), Some(m)) => { - match (n.parse::(), m.parse::()) { - (Ok(low), Ok(high)) => { - if low > 0 && low <= high { - Ok(Range { low: low, high: high }) - } else if low == 0 { - Err(field) - } else { - Err(order) - } - }, - _ => Err(inval), - } - } - _ => unreachable!() - } - } -} - -impl Range { - pub fn from_list(list: &str) -> Result, String> { - use std::cmp::max; - - let mut ranges : Vec = vec!(); - - for item in list.split(',') { - match FromStr::from_str(item) { - Ok(range_item) => ranges.push(range_item), - Err(e)=> return Err(format!("range '{}' was invalid: {}", item, e)) - } - } - - ranges.sort(); - - // merge overlapping ranges - for i in 0..ranges.len() { - let j = i + 1; - - while j < ranges.len() && ranges[j].low <= ranges[i].high { - let j_high = ranges.remove(j).high; - ranges[i].high = max(ranges[i].high, j_high); - } - } - - Ok(ranges) - } -} - -pub fn complement(ranges: &Vec) -> Vec { - use std::usize; - - let mut complements = Vec::with_capacity(ranges.len() + 1); - - if ranges.len() > 0 && ranges[0].low > 1 { - complements.push(Range { low: 1, high: ranges[0].low - 1 }); - } - - let mut ranges_iter = ranges.iter().peekable(); - loop { - match (ranges_iter.next(), ranges_iter.peek()) { - (Some(left), Some(right)) => { - if left.high + 1 != right.low { - complements.push(Range { - low: left.high + 1, - high: right.low - 1 - }); - } - } - (Some(last), None) => { - if last.high < usize::MAX { - complements.push(Range { - low: last.high + 1, - high: usize::MAX - }); - } - } - _ => break - } - } - - complements -} diff --git a/src/cut/searcher.rs b/src/cut/searcher.rs deleted file mode 100644 index 707a97f3a..000000000 --- a/src/cut/searcher.rs +++ /dev/null @@ -1,54 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Rolf Morel - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#[derive(Clone)] -pub struct Searcher<'a> { - haystack: &'a [u8], - needle: &'a [u8], - position: usize -} - -impl<'a> Searcher<'a> { - pub fn new(haystack: &'a [u8], needle: &'a [u8]) -> Searcher<'a> { - Searcher { - haystack: haystack, - needle: needle, - position: 0 - } - } -} - -impl<'a> Iterator for Searcher<'a> { - type Item = (usize, usize); - - fn next(&mut self) -> Option<(usize, usize)> { - if self.needle.len() == 1 { - for offset in self.position..self.haystack.len() { - if self.haystack[offset] == self.needle[0] { - self.position = offset + 1; - return Some((offset, offset + 1)); - } - } - - self.position = self.haystack.len(); - return None; - } - - while self.position + self.needle.len() <= self.haystack.len() { - if &self.haystack[self.position..self.position + self.needle.len()] == self.needle { - let match_pos = self.position; - self.position += self.needle.len(); - return Some((match_pos, match_pos + self.needle.len())); - } else { - self.position += 1; - } - } - None - } -} diff --git a/src/dirname/Cargo.toml b/src/dirname/Cargo.toml deleted file mode 100644 index 8c4e65c75..000000000 --- a/src/dirname/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "dirname" -version = "0.0.1" -authors = [] - -[lib] -name = "dirname" -path = "dirname.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/dirname/dirname.rs b/src/dirname/dirname.rs deleted file mode 100644 index 0ad6f68e5..000000000 --- a/src/dirname/dirname.rs +++ /dev/null @@ -1,70 +0,0 @@ -#![crate_name = "dirname"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Derek Chiang - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; - -use std::path::Path; - -static NAME: &'static str = "dirname"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - opts.optflag("z", "zero", "separate output with NUL rather than newline"); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => panic!("Invalid options\n{}", f) - }; - - if matches.opt_present("help") { - let msg = format!("{0} {1} - strip last component from file name - -Usage: - {0} [OPTION] NAME... - -Output each NAME with its last non-slash component and trailing slashes -removed; if NAME contains no /'s, output '.' (meaning the current -directory).", NAME, VERSION); - - print!("{}", opts.usage(&msg)); - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let separator = match matches.opt_present("zero") { - true => "\0", - false => "\n" - }; - - if !matches.free.is_empty() { - for path in matches.free.iter() { - let p = Path::new(path); - let d = p.parent().unwrap().to_str(); - if d.is_some() { - print!("{}", d.unwrap()); - } - print!("{}", separator); - } - } else { - println!("{0}: missing operand", NAME); - println!("Try '{0} --help' for more information.", NAME); - return 1; - } - - 0 -} diff --git a/src/du/Cargo.toml b/src/du/Cargo.toml deleted file mode 100644 index dd6851c34..000000000 --- a/src/du/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "du" -version = "0.0.1" -authors = [] - -[lib] -name = "du" -path = "du.rs" - -[dependencies] -getopts = "*" -libc = "*" -time = "*" diff --git a/src/du/deps.mk b/src/du/deps.mk deleted file mode 100644 index bc0c2cf05..000000000 --- a/src/du/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += time kernel32 winapi diff --git a/src/du/du.rs b/src/du/du.rs deleted file mode 100644 index b80d1f193..000000000 --- a/src/du/du.rs +++ /dev/null @@ -1,398 +0,0 @@ -#![crate_name = "du"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Derek Chiang - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#![allow(non_snake_case)] - -extern crate getopts; -extern crate libc; -extern crate time; - -use std::fs; -use std::io::{stderr, Write}; -use std::os::unix::fs::MetadataExt; -use std::path::PathBuf; -use std::sync::Arc; -use time::Timespec; -use std::sync::mpsc::channel; -use std::thread; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "du"; -static VERSION: &'static str = "1.0.0"; - -struct Options { - all: bool, - program_name: String, - max_depth: Option, - total: bool, - separate_dirs: bool, -} - -struct Stat { - path: PathBuf, - is_dir: bool, - size: u64, - blocks: u64, - nlink: u64, - created: u64, - accessed: u64, - modified: u64, -} - -impl Stat { - fn new(path: &PathBuf) -> Stat { - let metadata = safe_unwrap!(fs::metadata(path)); - Stat { - path: path.clone(), - is_dir: metadata.is_dir(), - size: metadata.len(), - blocks: metadata.blocks() as u64, - nlink: metadata.nlink() as u64, - created: metadata.mtime() as u64, - accessed: metadata.atime() as u64, - modified: metadata.mtime() as u64 - } - } -} - -// this takes `my_stat` to avoid having to stat files multiple times. -fn du(path: &PathBuf, mut my_stat: Stat, options: Arc, depth: usize) -> Vec> { - let mut stats = vec!(); - let mut futures = vec!(); - - if my_stat.is_dir { - let read = match fs::read_dir(path) { - Ok(read) => read, - Err(e) => { - safe_writeln!(stderr(), "{}: cannot read directory ‘{}‘: {}", - options.program_name, path.display(), e); - return vec!(Arc::new(my_stat)) - } - }; - - for f in read.into_iter() { - let entry = f.unwrap(); - let this_stat = Stat::new(&entry.path()); - if this_stat.is_dir { - let oa_clone = options.clone(); - let (tx, rx) = channel(); - thread::spawn(move || { - let result = du(&entry.path(), this_stat, oa_clone, depth + 1); - tx.send(result) - }); - futures.push(rx); - } else { - my_stat.size += this_stat.size; - my_stat.blocks += this_stat.blocks; - if options.all { - stats.push(Arc::new(this_stat)) - } - } - } - } - - for rx in futures.iter_mut() { - for stat in rx.recv().unwrap().into_iter().rev() { - if !options.separate_dirs && stat.path.parent().unwrap().to_path_buf() == my_stat.path { - my_stat.size += stat.size; - my_stat.blocks += stat.blocks; - } - if options.max_depth == None || depth < options.max_depth.unwrap() { - stats.push(stat.clone()); - } - } - } - - stats.push(Arc::new(my_stat)); - - stats -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - // In task - opts.optflag("a", "all", " write counts for all files, not just directories"); - // In main - opts.optflag("", "apparent-size", "print apparent sizes, rather than disk usage; - although the apparent size is usually smaller, it may be larger due to holes - in ('sparse') files, internal fragmentation, indirect blocks, and the like"); - // In main - opts.optopt("B", "block-size", "scale sizes by SIZE before printing them. - E.g., '-BM' prints sizes in units of 1,048,576 bytes. See SIZE format below.", - "SIZE"); - // In main - opts.optflag("b", "bytes", "equivalent to '--apparent-size --block-size=1'"); - // In main - opts.optflag("c", "total", "produce a grand total"); - // In task - // opts.optflag("D", "dereference-args", "dereference only symlinks that are listed - // on the command line"), - // In main - // opts.optopt("", "files0-from", "summarize disk usage of the NUL-terminated file - // names specified in file F; - // If F is - then read names from standard input", "F"), - // // In task - // opts.optflag("H", "", "equivalent to --dereference-args (-D)"), - // In main - opts.optflag("h", "human-readable", "print sizes in human readable format (e.g., 1K 234M 2G)"); - // In main - opts.optflag("", "si", "like -h, but use powers of 1000 not 1024"); - // In main - opts.optflag("k", "", "like --block-size=1K"); - // In task - opts.optflag("l", "count-links", "count sizes many times if hard linked"); - // // In main - opts.optflag("m", "", "like --block-size=1M"); - // // In task - // opts.optflag("L", "dereference", "dereference all symbolic links"), - // // In task - // opts.optflag("P", "no-dereference", "don't follow any symbolic links (this is the default)"), - // // In main - opts.optflag("0", "null", "end each output line with 0 byte rather than newline"); - // In main - opts.optflag("S", "separate-dirs", "do not include size of subdirectories"); - // In main - opts.optflag("s", "summarize", "display only a total for each argument"); - // // In task - // opts.optflag("x", "one-file-system", "skip directories on different file systems"), - // // In task - // opts.optopt("X", "exclude-from", "exclude files that match any pattern in FILE", "FILE"), - // // In task - // opts.optopt("", "exclude", "exclude files that match PATTERN", "PATTERN"), - // In main - opts.optopt("d", "max-depth", "print the total for a directory (or file, with --all) - only if it is N or fewer levels below the command - line argument; --max-depth=0 is the same as --summarize", "N"); - // In main - opts.optflagopt("", "time", "show time of the last modification of any file in the - directory, or any of its subdirectories. If WORD is given, show time as WORD instead of modification time: - atime, access, use, ctime or status", "WORD"); - // In main - opts.optopt("", "time-style", "show times using style STYLE: - full-iso, long-iso, iso, +FORMAT FORMAT is interpreted like 'date'", "STYLE"); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("Invalid options\n{}", f); - return 1; - } - }; - - if matches.opt_present("help") { - println!("{program} {version} - estimate file space usage - -Usage - {program} [OPTION]... [FILE]... - {program} [OPTION]... --files0-from=F - -{usage} - -Display values are in units of the first available SIZE from ---block-size, and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environ‐ -ment variables. Otherwise, units default to 1024 bytes (or 512 if -POSIXLY_CORRECT is set). - -SIZE is an integer and optional unit (example: 10M is 10*1024*1024). -Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (pow‐ -ers of 1000).", - program = NAME, - version = VERSION, - usage = opts.usage("Summarize disk usage of each FILE, recursively for directories.")); - return 0; - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let summarize = matches.opt_present("summarize"); - - let max_depth_str = matches.opt_str("max-depth"); - let max_depth = max_depth_str.as_ref().and_then(|s| s.parse::().ok()); - match (max_depth_str, max_depth) { - (Some(ref s), _) if summarize => { - show_error!("summarizing conflicts with --max-depth={}", *s); - return 1; - } - (Some(ref s), None) => { - show_error!("invalid maximum depth '{}'", *s); - return 1; - } - (Some(_), Some(_)) | (None, _) => { /* valid */ } - } - - let options = Options { - all: matches.opt_present("all"), - program_name: NAME.to_string(), - max_depth: max_depth, - total: matches.opt_present("total"), - separate_dirs: matches.opt_present("S"), - }; - - let strs = if matches.free.is_empty() {vec!("./".to_string())} else {matches.free.clone()}; - - let options_arc = Arc::new(options); - - let MB = match matches.opt_present("si") { - true => 1000 * 1000, - false => 1024 * 1024, - }; - let KB = match matches.opt_present("si") { - true => 1000, - false => 1024, - }; - - let block_size = match matches.opt_str("block-size") { - Some(s) => { - let mut found_number = false; - let mut found_letter = false; - let mut numbers = String::new(); - let mut letters = String::new(); - for c in s.chars() { - if found_letter && c.is_digit(10) || !found_number && !c.is_digit(10) { - show_error!("invalid --block-size argument '{}'", s); - return 1; - } else if c.is_digit(10) { - found_number = true; - numbers.push(c); - } else if c.is_alphabetic() { - found_letter = true; - letters.push(c); - } - } - let number = numbers.parse::().unwrap(); - let multiple = match &letters[..] { - "K" => 1024u64.pow(1), "M" => 1024u64.pow(2), - "G" => 1024u64.pow(3), "T" => 1024u64.pow(4), - "P" => 1024u64.pow(5), "E" => 1024u64.pow(6), - "Z" => 1024u64.pow(7), "Y" => 1024u64.pow(8), - "KB" => 1000u64.pow(1), "MB" => 1000u64.pow(2), - "GB" => 1000u64.pow(3), "TB" => 1000u64.pow(4), - "PB" => 1000u64.pow(5), "EB" => 1000u64.pow(6), - "ZB" => 1000u64.pow(7), "YB" => 1000u64.pow(8), - _ => { - show_error!("invalid --block-size argument '{}'", s); - return 1; - } - }; - number * multiple - }, - None => 1024 - }; - - let convert_size = |size: u64| -> String { - if matches.opt_present("human-readable") || matches.opt_present("si") { - if size >= MB { - format!("{:.1}M", (size as f64) / (MB as f64)) - } else if size >= KB { - format!("{:.1}K", (size as f64) / (KB as f64)) - } else { - format!("{}B", size) - } - } else if matches.opt_present("k") { - format!("{}", ((size as f64) / (KB as f64)).ceil()) - } else if matches.opt_present("m") { - format!("{}", ((size as f64) / (MB as f64)).ceil()) - } else { - format!("{}", ((size as f64) / (block_size as f64)).ceil()) - } - }; - - let time_format_str = match matches.opt_str("time-style") { - Some(s) => { - match &s[..] { - "full-iso" => "%Y-%m-%d %H:%M:%S.%f %z", - "long-iso" => "%Y-%m-%d %H:%M", - "iso" => "%Y-%m-%d", - _ => { - show_error!("invalid argument '{}' for 'time style' -Valid arguments are: -- 'full-iso' -- 'long-iso' -- 'iso' -Try '{} --help' for more information.", s, NAME); - return 1; - } - } - }, - None => "%Y-%m-%d %H:%M" - }; - - let line_separator = match matches.opt_present("0") { - true => "\0", - false => "\n", - }; - - let mut grand_total = 0; - for path_str in strs.into_iter() { - let path = PathBuf::from(path_str); - let iter = du(&path, Stat::new(&path), options_arc.clone(), 0).into_iter(); - let (_, len) = iter.size_hint(); - let len = len.unwrap(); - for (index, stat) in iter.enumerate() { - let size = match matches.opt_present("apparent-size") { - true => stat.nlink * stat.size, - // C's stat is such that each block is assume to be 512 bytes - // See: http://linux.die.net/man/2/stat - false => stat.blocks * 512, - }; - if matches.opt_present("time") { - let tm = { - let (secs, nsecs) = { - let time = match matches.opt_str("time") { - Some(s) => match &s[..] { - "accessed" => stat.accessed, - "created" => stat.created, - "modified" => stat.modified, - _ => { - show_error!("invalid argument 'modified' for '--time' - Valid arguments are: - - 'accessed', 'created', 'modified' - Try '{} --help' for more information.", NAME); - return 1; - } - }, - None => stat.modified - }; - ((time / 1000) as i64, (time % 1000 * 1000000) as i32) - }; - time::at(Timespec::new(secs, nsecs)) - }; - if !summarize || (summarize && index == len-1) { - let time_str = tm.strftime(time_format_str).unwrap(); - print!("{}\t{}\t{}{}", convert_size(size), time_str, stat.path.display(), line_separator); - } - } else { - if !summarize || (summarize && index == len-1) { - print!("{}\t{}{}", convert_size(size), stat.path.display(), line_separator); - } - } - if options_arc.total && index == (len - 1) { - // The last element will be the total size of the the path under - // path_str. We add it to the grand total. - grand_total += size; - } - } - } - - if options_arc.total { - print!("{}\ttotal", convert_size(grand_total)); - print!("{}", line_separator); - } - - 0 -} diff --git a/src/echo/Cargo.toml b/src/echo/Cargo.toml deleted file mode 100644 index 1e56ce491..000000000 --- a/src/echo/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "echo" -version = "0.0.1" -authors = [] - -[lib] -name = "echo" -path = "echo.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/echo/echo.rs b/src/echo/echo.rs deleted file mode 100644 index f7e9bae2b..000000000 --- a/src/echo/echo.rs +++ /dev/null @@ -1,254 +0,0 @@ -#![crate_name = "echo"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Derek Chiang - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::io::Write; -use std::str::from_utf8; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[allow(dead_code)] -static NAME: &'static str = "echo"; -static VERSION: &'static str = "1.0.0"; - -#[derive(Clone)] -struct EchoOptions { - newline: bool, - escape: bool -} - -#[inline(always)] -fn to_char(bytes: &Vec, base: u32) -> char { - usize::from_str_radix(from_utf8(bytes.as_ref()).unwrap(), base).unwrap() as u8 as char -} - -#[inline(always)] -fn isxdigit(c: u8) -> bool { - match c as char { - '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | - '8' | '9' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' => true, - _ => false - } -} - -#[inline(always)] -fn isodigit(c: u8) -> bool { - match c as char { - '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' => true, - _ => false - } -} - -fn convert_str(string: &[u8], index: usize, base: u32) -> (char, usize) { - let (max_digits, is_legal_digit) : (usize, fn(u8) -> bool) = match base { - 8 => (3, isodigit), - 16 => (2, isxdigit), - _ => panic!(), - }; - - let mut bytes = vec!(); - for offset in 0usize .. max_digits { - if string.len() <= index + offset as usize { - break; - } - let c = string[index + offset as usize]; - if is_legal_digit(c) { - bytes.push(c as u8); - } else { - break; - } - } - - if bytes.len() == 0 { - (' ', 0) - } else { - (to_char(&bytes, base), bytes.len()) - } -} - -fn parse_options(args: Vec, options: &mut EchoOptions) -> Option> { - let mut echo_args = vec!(); - 'argloop: for arg in args.into_iter().skip(1) { - match arg.as_ref() { - "--help" | "-h" => { - print_help(); - return None; - } - "--version" | "-V" => { - print_version(); - return None; - } - "-n" => options.newline = true, - "-e" => options.escape = true, - "-E" => options.escape = false, - _ => { - if arg.len() > 1 && arg.chars().next().unwrap_or('_') == '-' { - let mut newopts = options.clone(); - for ch in arg.chars().skip(1) { - match ch { - 'h' => { - print_help(); - return None; - } - 'V' => { - print_version(); - return None; - } - 'n' => newopts.newline = true, - 'e' => newopts.escape = true, - 'E' => newopts.escape = false, - _ => { - echo_args.push(arg.clone()); - continue 'argloop; - } - } - } - *options = newopts; - } else { - echo_args.push(arg); - } - } - } - } - Some(echo_args) -} - -fn print_help() { - let mut opts = getopts::Options::new(); - opts.optflag("n", "", "do not output the trailing newline"); - opts.optflag("e", "", "enable interpretation of backslash escapes"); - opts.optflag("E", "", "disable interpretation of backslash escapes (default)"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let msg = format!("{0} {1} - display a line of text - -Usage: - {0} [SHORT-OPTION]... [STRING]... - {0} LONG-OPTION - -Echo the STRING(s) to standard output. -If -e is in effect, the following sequences are recognized: - -\\\\ backslash -\\a alert (BEL) -\\b backspace -\\c produce no further output -\\e escape -\\f form feed -\\n new line -\\r carriage return -\\t horizontal tab -\\v vertical tab -\\0NNN byte with octal value NNN (1 to 3 digits) -\\xHH byte with hexadecimal value HH (1 to 2 digits)", NAME, VERSION); - - print!("{}", opts.usage(&msg)); -} - -fn print_version() { - println!("{} {}", NAME, VERSION); -} - -pub fn uumain(args: Vec) -> i32 { - let mut options = EchoOptions { - newline: false, - escape: false - }; - - let free = match parse_options(args, &mut options) { - Some(vec) => vec, - None => return 0 - }; - - if !free.is_empty() { - let string = free.join(" "); - if options.escape { - let mut prev_was_slash = false; - let mut iter = string.chars().enumerate(); - loop { - match iter.next() { - Some((index, c)) => { - if !prev_was_slash { - if c != '\\' { - print!("{}", c); - } else { - prev_was_slash = true; - } - } else { - prev_was_slash = false; - match c { - '\\' => print!("\\"), - 'a' => print!("\x07"), - 'b' => print!("\x08"), - 'c' => break, - 'e' => print!("\x1B"), - 'f' => print!("\x0C"), - 'n' => print!("\n"), - 'r' => print!("\r"), - 't' => print!("\t"), - 'v' => print!("\x0B"), - 'x' => { - let (c, num_char_used) = convert_str(string.as_bytes(), index + 1, 16); - if num_char_used == 0 { - print!("\\x"); - } else { - print!("{}", c); - for _ in 0 .. num_char_used { - iter.next(); // consume used characters - } - } - }, - '0' => { - let (c, num_char_used) = convert_str(string.as_bytes(), index + 1, 8); - if num_char_used == 0 { - print!("\0"); - } else { - print!("{}", c); - for _ in 0 .. num_char_used { - iter.next(); // consume used characters - } - } - } - _ => { - let (esc_c, num_char_used) = convert_str(string.as_bytes(), index, 8); - if num_char_used == 0 { - print!("\\{}", c); - } else { - print!("{}", esc_c); - for _ in 1 .. num_char_used { - iter.next(); // consume used characters - } - } - } - } - } - } - None => break - } - } - } else { - print!("{}", string); - } - } - - if options.newline { - pipe_flush!(); - } else { - println!("") - } - - 0 -} diff --git a/src/env/Cargo.toml b/src/env/Cargo.toml deleted file mode 100644 index 69d049a76..000000000 --- a/src/env/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "env" -version = "0.0.1" -authors = [] - -[lib] -name = "env" -path = "env.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/env/env.rs b/src/env/env.rs deleted file mode 100644 index 89fc38718..000000000 --- a/src/env/env.rs +++ /dev/null @@ -1,207 +0,0 @@ -#![crate_name = "env"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/* last synced with: env (GNU coreutils) 8.13 */ - -#![allow(non_camel_case_types)] - -use std::env; -use std::io::Write; -use std::process::Command; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "env"; -static VERSION: &'static str = "1.0.0"; - -struct options { - ignore_env: bool, - null: bool, - unsets: Vec, - sets: Vec<(String, String)>, - program: Vec -} - -fn usage() { - println!("Usage: {} [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]", NAME); - println!("Set each NAME to VALUE in the environment and run COMMAND\n"); - println!("Possible options are:"); - println!(" -i --ignore-environment\t start with an empty environment"); - println!(" -0 --null \t end each output line with a 0 byte rather than newline"); - println!(" -u --unset NAME \t remove variable from the environment"); - println!(" -h --help \t display this help and exit"); - println!(" -V --version \t output version information and exit\n"); - println!("A mere - implies -i. If no COMMAND, print the resulting environment"); -} - -fn version() { - println!("{} {}", NAME, VERSION); -} - -// print name=value env pairs on screen -// if null is true, separate pairs with a \0, \n otherwise -fn print_env(null: bool) { - for (n, v) in env::vars() { - print!("{}={}{}", n, v, if null { '\0' } else { '\n' }); - } -} - -pub fn uumain(args: Vec) -> i32 { - // to handle arguments the same way than GNU env, we can't use getopts - let mut opts = Box::new(options { - ignore_env: false, - null: false, - unsets: vec!(), - sets: vec!(), - program: vec!() - }); - - let mut wait_cmd = false; - let mut iter = args.iter(); - iter.next(); // skip program - let mut item = iter.next(); - - // the for loop doesn't work here, - // because we need sometines to read 2 items forward, - // and the iter can't be borrowed twice - while item != None { - let opt = item.unwrap(); - - if wait_cmd { - // we still accept NAME=VAL here but not other options - let mut sp = opt.splitn(2, '='); - let name = sp.next(); - let value = sp.next(); - - match (name, value) { - (Some(n), Some(v)) => { - opts.sets.push((n.to_string(), v.to_string())); - } - _ => { - // read the program now - opts.program.push(opt.to_string()); - break; - } - } - } else if opt.starts_with("--") { - match opt.as_ref() { - "--help" => { usage(); return 0; } - "--version" => { version(); return 0; } - - "--ignore-environment" => opts.ignore_env = true, - "--null" => opts.null = true, - "--unset" => { - let var = iter.next(); - - match var { - None => println!("{}: this option requires an argument: {}", NAME, opt), - Some(s) => opts.unsets.push(s.to_string()) - } - } - - _ => { - println!("{}: invalid option \"{}\"", NAME, *opt); - println!("Type \"{} --help\" for detailed informations", NAME); - return 1; - } - } - } else if opt.starts_with("-") { - if opt.len() == 1 { - // implies -i and stop parsing opts - wait_cmd = true; - opts.ignore_env = true; - continue; - } - - let mut chars = opt.chars(); - chars.next(); - - for c in chars { - // short versions of options - match c { - 'h' => { usage(); return 0; } - 'V' => { version(); return 0; } - 'i' => opts.ignore_env = true, - '0' => opts.null = true, - 'u' => { - let var = iter.next(); - - match var { - None => println!("{}: this option requires an argument: {}", NAME, opt), - Some(s) => opts.unsets.push(s.to_string()) - } - } - _ => { - println!("{}: illegal option -- {}", NAME, c); - println!("Type \"{} --help\" for detailed informations", NAME); - return 1; - } - } - } - } else { - // is it a NAME=VALUE like opt ? - let mut sp = opt.splitn(2, "="); - let name = sp.next(); - let value = sp.next(); - - match (name, value) { - (Some(n), Some(v)) => { - // yes - opts.sets.push((n.to_string(), v.to_string())); - wait_cmd = true; - } - // no, its a program-like opt - _ => { - opts.program.push(opt.to_string()); - break; - } - } - } - - item = iter.next(); - } - - // read program arguments - for opt in iter { - opts.program.push(opt.to_string()); - } - - if opts.ignore_env { - for (ref name, _) in env::vars() { - env::remove_var(name); - } - } - - for name in opts.unsets.iter() { - env::remove_var(name); - } - - for &(ref name, ref val) in opts.sets.iter() { - env::set_var(name, val); - } - - if opts.program.len() >= 1 { - let prog = opts.program[0].clone(); - let args = &opts.program[1..]; - match Command::new(prog).args(args).status() { - Ok(exit) => return if exit.success() { 0 } else { exit.code().unwrap() }, - Err(_) => return 1 - } - } else { - // no program provided - print_env(opts.null); - pipe_flush!(); - } - - 0 -} diff --git a/src/expand/Cargo.toml b/src/expand/Cargo.toml deleted file mode 100644 index 75176539a..000000000 --- a/src/expand/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "expand" -version = "0.0.1" -authors = [] - -[lib] -name = "expand" -path = "expand.rs" - -[dependencies] -getopts = "*" -libc = "*" -unicode-width = "*" diff --git a/src/expand/deps.mk b/src/expand/deps.mk deleted file mode 100644 index fb8005c0c..000000000 --- a/src/expand/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += unicode-width diff --git a/src/expand/expand.rs b/src/expand/expand.rs deleted file mode 100644 index 09bf427b1..000000000 --- a/src/expand/expand.rs +++ /dev/null @@ -1,244 +0,0 @@ -#![crate_name = "expand"] -#![feature(unicode)] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Virgile Andreani - * (c) kwantam - * 20150428 updated to work with both UTF-8 and non-UTF-8 encodings - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; -extern crate rustc_unicode; -extern crate unicode_width; - -use std::fs::File; -use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; -use std::iter::repeat; -use std::str::from_utf8; -use rustc_unicode::str::utf8_char_width; -use unicode_width::UnicodeWidthChar; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "expand"; -static VERSION: &'static str = "0.0.1"; - -static DEFAULT_TABSTOP: usize = 8; - -fn tabstops_parse(s: String) -> Vec { - let words = s.split(',').collect::>(); - - let nums = words.into_iter() - .map(|sn| sn.parse::() - .unwrap_or_else( - |_| crash!(1, "{}\n", "tab size contains invalid character(s)")) - ) - .collect::>(); - - if nums.iter().any(|&n| n == 0) { - crash!(1, "{}\n", "tab size cannot be 0"); - } - - match nums.iter().fold((true, 0), |(acc, last), &n| (acc && last <= n, n)) { - (false, _) => crash!(1, "{}\n", "tab sizes must be ascending"), - _ => {} - } - - nums -} - -struct Options { - files: Vec, - tabstops: Vec, - tspaces: String, - iflag: bool, - uflag: bool, -} - -impl Options { - fn new(matches: getopts::Matches) -> Options { - let tabstops = match matches.opt_str("t") { - None => vec!(DEFAULT_TABSTOP), - Some(s) => tabstops_parse(s) - }; - - let iflag = matches.opt_present("i"); - let uflag = !matches.opt_present("U"); - - // avoid allocations when dumping out long sequences of spaces - // by precomputing the longest string of spaces we will ever need - let nspaces = tabstops.iter().scan(0, |pr,&it| { - let ret = Some(it - *pr); - *pr = it; - ret - }).max().unwrap(); // length of tabstops is guaranteed >= 1 - let tspaces = repeat(' ').take(nspaces).collect(); - - let files = - if matches.free.is_empty() { - vec!("-".to_string()) - } else { - matches.free - }; - - Options { files: files, tabstops: tabstops, tspaces: tspaces, iflag: iflag, uflag: uflag } - } -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("i", "initial", "do not convert tabs after non blanks"); - opts.optopt("t", "tabs", "have tabs NUMBER characters apart, not 8", "NUMBER"); - opts.optopt("t", "tabs", "use comma separated list of explicit tab positions", "LIST"); - opts.optflag("U", "no-utf8", "interpret input file as 8-bit ASCII rather than UTF-8"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f) - }; - - if matches.opt_present("help") { - println!("Usage: {} [OPTION]... [FILE]...", NAME); - println!("{}", opts.usage( - "Convert tabs in each FILE to spaces, writing to standard output.\n\ - With no FILE, or when FILE is -, read standard input.")); - return 0; - } - - if matches.opt_present("V") { - println!("{} {}", NAME, VERSION); - return 0; - } - - expand(Options::new(matches)); - - 0 -} - -fn open(path: String) -> BufReader> { - let file_buf; - if path == "-" { - BufReader::new(Box::new(stdin()) as Box) - } else { - file_buf = match File::open(&path[..]) { - Ok(a) => a, - Err(e) => crash!(1, "{}: {}\n", &path[..], e), - }; - BufReader::new(Box::new(file_buf) as Box) - } -} - -fn next_tabstop(tabstops: &[usize], col: usize) -> usize { - if tabstops.len() == 1 { - tabstops[0] - col % tabstops[0] - } else { - match tabstops.iter().skip_while(|&&t| t <= col).next() { - Some(t) => t - col, - None => 1, - } - } -} - -#[derive(PartialEq, Eq, Debug)] -enum CharType { - Backspace, - Tab, - Other, -} - -fn expand(options: Options) { - use self::CharType::*; - - let mut output = BufWriter::new(stdout()); - let ts = options.tabstops.as_ref(); - let mut buf = Vec::new(); - - for file in options.files.into_iter() { - let mut fh = open(file); - - while match fh.read_until('\n' as u8, &mut buf) { - Ok(s) => s > 0, - Err(_) => buf.len() > 0, - } { - let mut col = 0; - let mut byte = 0; - let mut init = true; - - while byte < buf.len() { - let (ctype, cwidth, nbytes) = if options.uflag { - let nbytes = utf8_char_width(buf[byte]); - - if byte + nbytes > buf.len() { - // don't overrun buffer because of invalid UTF-8 - (Other, 1, 1) - } else if let Ok(t) = from_utf8(&buf[byte..byte+nbytes]) { - match t.chars().next() { - Some('\t') => (Tab, 0, nbytes), - Some('\x08') => (Backspace, 0, nbytes), - Some(c) => (Other, UnicodeWidthChar::width(c).unwrap_or(0), nbytes), - None => { // no valid char at start of t, so take 1 byte - (Other, 1, 1) - }, - } - } else { - (Other, 1, 1) // implicit assumption: non-UTF-8 char is 1 col wide - } - } else { - (match buf[byte] { // always take exactly 1 byte in strict ASCII mode - 0x09 => Tab, - 0x08 => Backspace, - _ => Other, - }, 1, 1) - }; - - // figure out how many columns this char takes up - match ctype { - Tab => { - // figure out how many spaces to the next tabstop - let nts = next_tabstop(ts, col); - col += nts; - - // now dump out either spaces if we're expanding, or a literal tab if we're not - if init || !options.iflag { - safe_unwrap!(output.write_all(&options.tspaces[..nts].as_bytes())); - } else { - safe_unwrap!(output.write_all(&buf[byte..byte+nbytes])); - } - }, - _ => { - col = if ctype == Other { - col + cwidth - } else if col > 0 { - col - 1 - } else { - 0 - }; - - // if we're writing anything other than a space, then we're - // done with the line's leading spaces - if buf[byte] != 0x20 { - init = false; - } - - safe_unwrap!(output.write_all(&buf[byte..byte+nbytes])); - }, - } - - byte += nbytes; // advance the pointer - } - - buf.truncate(0); // clear the buffer - } - } -} diff --git a/src/expr/Cargo.toml b/src/expr/Cargo.toml deleted file mode 100644 index 164c2070d..000000000 --- a/src/expr/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ - -[package] -name = "expr" -version = "0.0.1" -authors = [] - -[lib] -name = "expr" -path = "expr.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/expr/expr.rs b/src/expr/expr.rs deleted file mode 100644 index d6a7664d2..000000000 --- a/src/expr/expr.rs +++ /dev/null @@ -1,135 +0,0 @@ -#![crate_name = "expr"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Roman Gafiyatullin - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -#[path="../common/util.rs"] -#[macro_use] -mod util; -mod tokens; -mod syntax_tree; - -use std::io::{Write}; - -static NAME: &'static str = "expr"; -static VERSION: &'static str = "0.0.1"; - -pub fn uumain(args: Vec) -> i32 { - // For expr utility we do not want getopts. - // The following usage should work without escaping hyphens: `expr -15 = 1 + 2 \* \( 3 - -4 \)` - - if maybe_handle_help_or_version( &args ) { 0 } - else { - let token_strings = args[1..].to_vec(); - - match process_expr( &token_strings ) { - Ok( expr_result ) => print_expr_ok( &expr_result ), - Err( expr_error ) => print_expr_error( &expr_error ) - } - } -} - -fn process_expr( token_strings: &Vec ) -> Result< String, String > { - let maybe_tokens = tokens::strings_to_tokens( &token_strings ); - let maybe_ast = syntax_tree::tokens_to_ast( maybe_tokens ); - let maybe_result = evaluate_ast( maybe_ast ); - - maybe_result -} - -fn print_expr_ok( expr_result: &String ) -> i32 { - println!("{}", expr_result); - if expr_result == "0" || expr_result == "" { 1 } - else { 0 } -} - -fn print_expr_error( expr_error: &String ) -> ! { - crash!(2, "{}", expr_error) -} - -fn evaluate_ast( maybe_ast: Result, String> ) -> Result { - if maybe_ast.is_err() { Err( maybe_ast.err().unwrap() ) } - else { maybe_ast.ok().unwrap().evaluate() } -} - - - -fn maybe_handle_help_or_version( args: &Vec ) -> bool { - if args.len() == 2 { - if args[1] == "--help" { print_help(); true } - else if args[1] == "--version" { print_version(); true } - else { false } - } - else { false } -} - -fn print_help() { - //! The following is taken from GNU coreutils' "expr --help" output. - print!( -r#"Usage: expr EXPRESSION - or: expr OPTION - - --help display this help and exit - --version output version information and exit - -Print the value of EXPRESSION to standard output. A blank line below -separates increasing precedence groups. EXPRESSION may be: - - ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2 - - ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0 - - ARG1 < ARG2 ARG1 is less than ARG2 - ARG1 <= ARG2 ARG1 is less than or equal to ARG2 - ARG1 = ARG2 ARG1 is equal to ARG2 - ARG1 != ARG2 ARG1 is unequal to ARG2 - ARG1 >= ARG2 ARG1 is greater than or equal to ARG2 - ARG1 > ARG2 ARG1 is greater than ARG2 - - ARG1 + ARG2 arithmetic sum of ARG1 and ARG2 - ARG1 - ARG2 arithmetic difference of ARG1 and ARG2 - - ARG1 * ARG2 arithmetic product of ARG1 and ARG2 - ARG1 / ARG2 arithmetic quotient of ARG1 divided by ARG2 - ARG1 % ARG2 arithmetic remainder of ARG1 divided by ARG2 - - STRING : REGEXP [NOT IMPLEMENTED] anchored pattern match of REGEXP in STRING - - match STRING REGEXP [NOT IMPLEMENTED] same as STRING : REGEXP - substr STRING POS LENGTH substring of STRING, POS counted from 1 - index STRING CHARS index in STRING where any CHARS is found, or 0 - length STRING length of STRING - + TOKEN interpret TOKEN as a string, even if it is a - keyword like 'match' or an operator like '/' - - ( EXPRESSION ) value of EXPRESSION - -Beware that many operators need to be escaped or quoted for shells. -Comparisons are arithmetic if both ARGs are numbers, else lexicographical. -Pattern matches return the string matched between \( and \) or null; if -\( and \) are not used, they return the number of characters matched or 0. - -Exit status is 0 if EXPRESSION is neither null nor 0, 1 if EXPRESSION is null -or 0, 2 if EXPRESSION is syntactically invalid, and 3 if an error occurred. - -Environment variables: - * EXPR_DEBUG_TOKENS=1 dump expression's tokens - * EXPR_DEBUG_RPN=1 dump expression represented in reverse polish notation - * EXPR_DEBUG_SYA_STEP=1 dump each parser step - * EXPR_DEBUG_AST=1 dump expression represented abstract syntax tree -"# - ); -} - -fn print_version() { - println!("{} {}", NAME, VERSION); -} diff --git a/src/expr/syntax_tree.rs b/src/expr/syntax_tree.rs deleted file mode 100644 index 53819974d..000000000 --- a/src/expr/syntax_tree.rs +++ /dev/null @@ -1,386 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Roman Gafiyatullin - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -//! -//! Here we employ shunting-yard algorithm for building AST from tokens according to operators' precedence and associativeness. -//! * https://en.wikipedia.org/wiki/Shunting-yard_algorithm -//! - -use tokens::{Token}; - -type TokenStack = Vec<(usize, Token)>; -type OperandsList = Vec< Box >; - -#[derive(Debug)] -pub enum ASTNode { - Leaf { token_idx: usize, value: String }, - Node { token_idx: usize, op_type: String, operands: OperandsList } -} -impl ASTNode { - fn debug_dump( &self ) { - self.debug_dump_impl( 1 ); - } - fn debug_dump_impl( &self, depth: usize ) { - for _ in 0..depth { - print!("\t", ); - } - match self { - &ASTNode::Leaf{ ref token_idx, ref value } => println!("Leaf( {} ) at #{} ( evaluate -> {:?} )", value, token_idx, self.evaluate()), - &ASTNode::Node{ ref token_idx, ref op_type, ref operands } => { - println!("Node( {} ) at #{} (evaluate -> {:?})", op_type, token_idx, self.evaluate()); - for operand in operands { - operand.debug_dump_impl( depth + 1 ); - } - } - } - } - - fn new_node( token_idx: usize, op_type: &String, operands: OperandsList ) -> Box { - Box::new( ASTNode::Node{ - token_idx: token_idx, - op_type: op_type.clone(), - operands: operands - } ) - } - fn new_leaf( token_idx: usize, value: &String ) -> Box { - Box::new( ASTNode::Leaf{ token_idx: token_idx, value: value.clone() } ) - } - pub fn evaluate( &self ) -> Result { - match self { - &ASTNode::Leaf{ ref value, .. } => Ok( value.clone() ), - &ASTNode::Node{ ref op_type, .. } => - match self.operand_values() { - Err( reason ) => Err( reason ), - Ok( operand_values ) => - match op_type.as_ref() { - "+" => infix_operator_two_ints( |a: i64, b: i64| Ok( a + b ), &operand_values ), - "-" => infix_operator_two_ints( |a: i64, b: i64| Ok( a - b ), &operand_values ), - "*" => infix_operator_two_ints( |a: i64, b: i64| Ok( a * b ), &operand_values ), - "/" => infix_operator_two_ints( - |a: i64, b: i64| - if b == 0 { Err("division by zero".to_string()) } - else { Ok( a / b ) }, - &operand_values ), - "%" => infix_operator_two_ints( - |a: i64, b: i64| - if b == 0 { Err("division by zero".to_string()) } - else { Ok( a % b ) }, - &operand_values ), - - "=" => infix_operator_two_ints_or_two_strings( - |a: i64, b: i64| Ok( bool_as_int(a == b) ), - |a: &String, b: &String| Ok( bool_as_string(a == b) ), - &operand_values - ), - "!=" => infix_operator_two_ints_or_two_strings( - |a: i64, b: i64| Ok( bool_as_int(a != b) ), - |a: &String, b: &String| Ok( bool_as_string(a != b) ), - &operand_values - ), - "<" => infix_operator_two_ints_or_two_strings( - |a: i64, b: i64| Ok( bool_as_int(a < b) ), - |a: &String, b: &String| Ok( bool_as_string(a < b) ), - &operand_values - ), - ">" => infix_operator_two_ints_or_two_strings( - |a: i64, b: i64| Ok( bool_as_int(a > b) ), - |a: &String, b: &String| Ok( bool_as_string(a > b) ), - &operand_values - ), - "<=" => infix_operator_two_ints_or_two_strings( - |a: i64, b: i64| Ok( bool_as_int(a <= b) ), - |a: &String, b: &String| Ok( bool_as_string(a <= b) ), - &operand_values - ), - ">=" => infix_operator_two_ints_or_two_strings( - |a: i64, b: i64| Ok( bool_as_int(a >= b) ), - |a: &String, b: &String| Ok( bool_as_string(a >= b) ), - &operand_values - ), - "length" => prefix_operator_length( &operand_values ), - "index" => prefix_operator_index( &operand_values ), - "substr" => prefix_operator_substr( &operand_values ), - - _ => Err(format!("operation not implemented: {}", op_type)) - } - } - } - } - pub fn operand_values( &self ) -> Result, String> { - if let &ASTNode::Node{ ref operands, .. } = self { - let mut out = Vec::with_capacity( operands.len() ); - for operand in operands { - match operand.evaluate() { - Ok( value ) => out.push( value ), - Err( reason ) => return Err( reason ), - } - } - Ok( out ) - } - else { panic!("Invoked .operand_values(&self) not with ASTNode::Node") } - } -} - -pub fn tokens_to_ast( maybe_tokens: Result< Vec<(usize, Token)>, String > ) -> Result, String> { - if maybe_tokens.is_err() { Err( maybe_tokens.err().unwrap() ) } - else { - let tokens = maybe_tokens.ok().unwrap(); - let mut out_stack: TokenStack = Vec::new(); - let mut op_stack: TokenStack = Vec::new(); - - for (token_idx, token) in tokens { - if let Err( reason ) = push_token_to_either_stack( token_idx, &token, &mut out_stack, &mut op_stack ) { - return Err( reason ) - } - } - if let Err( reason ) = move_rest_of_ops_to_out( &mut out_stack, &mut op_stack ) { - return Err( reason ) - } - assert!( op_stack.is_empty() ); - - maybe_dump_rpn( &out_stack ); - let result = ast_from_rpn( &mut out_stack ); - if !out_stack.is_empty() { - Err( "syntax error (fist RPN token does not represent expression AST's root)".to_string() ) - } - else { - maybe_dump_ast( &result ); - result - } - } -} - -fn maybe_dump_ast( result: &Result< Box, String > ) { - use std::env; - if let Ok( debug_var ) = env::var( "EXPR_DEBUG_AST" ) { - if debug_var == "1" { - println!("EXPR_DEBUG_AST"); - match result { - &Ok( ref ast ) => ast.debug_dump(), - &Err( ref reason ) => println!("\terr: {:?}", reason), - } - } - } -} - -fn maybe_dump_rpn( rpn: &TokenStack ) { - use std::env; - if let Ok( debug_var ) = env::var( "EXPR_DEBUG_RPN" ) { - if debug_var == "1" { - println!("EXPR_DEBUG_RPN"); - for token in rpn { - println!("\t{:?}", token); - } - } - } -} - -fn ast_from_rpn( rpn: &mut TokenStack ) -> Result, String> { - match rpn.pop() { - None => Err( "syntax error (premature end of expression)".to_string() ), - - Some( (token_idx, Token::Value{ value }) ) => - Ok( ASTNode::new_leaf( token_idx, &value ) ), - - Some( (token_idx, Token::InfixOp{ value, .. }) ) => - maybe_ast_node( token_idx, &value, 2, rpn ), - - Some( (token_idx, Token::PrefixOp{ value, arity }) ) => - maybe_ast_node( token_idx, &value, arity, rpn ), - - Some( (token_idx, unexpected_token) ) => - panic!("unexpected token at #{} {:?}", token_idx, unexpected_token), - } -} -fn maybe_ast_node( token_idx: usize, op_type: &String, arity: usize, rpn: &mut TokenStack ) -> Result< Box, String > { - let mut operands = Vec::with_capacity( arity ); - for _ in 0..arity { - match ast_from_rpn( rpn ) { - Err( reason ) => return Err( reason ), - Ok( operand ) => operands.push( operand ), - } - } - operands.reverse(); - Ok( ASTNode::new_node( token_idx, op_type, operands ) ) -} - -fn move_rest_of_ops_to_out( out_stack: &mut TokenStack, op_stack: &mut TokenStack ) -> Result<(), String> { - loop { - match op_stack.pop() { - None => return Ok( () ), - Some( (token_idx, Token::ParOpen) ) => return Err( format!( "syntax error (Mismatched open-parenthesis at #{})", token_idx ) ), - Some( (token_idx, Token::ParClose) ) => return Err( format!( "syntax error (Mismatched close-parenthesis at #{})", token_idx ) ), - Some( other ) => out_stack.push( other ) - } - } -} - -fn push_token_to_either_stack( token_idx: usize, token: &Token, out_stack: &mut TokenStack, op_stack: &mut TokenStack ) -> Result<(), String> { - let result = - match token { - &Token::Value{ .. } => Ok( out_stack.push( (token_idx, token.clone()) ) ), - - &Token::InfixOp{ .. } => - if op_stack.is_empty() { Ok( op_stack.push( (token_idx, token.clone()) ) ) } - else { push_op_to_stack( token_idx, token, out_stack, op_stack ) }, - - &Token::PrefixOp{ .. } => Ok( op_stack.push( (token_idx, token.clone()) ) ), - - &Token::ParOpen => Ok( op_stack.push( (token_idx, token.clone()) ) ), - - &Token::ParClose => move_till_match_paren( out_stack, op_stack ) - }; - maybe_dump_shunting_yard_step( token_idx, token, out_stack, op_stack, &result ); - result -} - -fn maybe_dump_shunting_yard_step( token_idx: usize, token: &Token, out_stack: &TokenStack, op_stack: &TokenStack, result: &Result<(), String> ) { - use std::env; - if let Ok( debug_var ) = env::var( "EXPR_DEBUG_SYA_STEP" ) { - if debug_var == "1" { - println!("EXPR_DEBUG_SYA_STEP"); - println!("\t{} => {:?}", token_idx, token); - println!("\t\tout: {:?}", out_stack); - println!("\t\top : {:?}", op_stack); - println!("\t\tresult: {:?}", result); - } - } -} - -fn push_op_to_stack( token_idx: usize, token: &Token, out_stack: &mut TokenStack, op_stack: &mut TokenStack ) -> Result<(), String> { - if let &Token::InfixOp{ precedence: prec, left_assoc: la, .. } = token { - loop { - match op_stack.last() { - None => - return Ok( op_stack.push( (token_idx, token.clone()) ) ), - - Some( &(_, Token::ParOpen) ) => - return Ok( op_stack.push( (token_idx, token.clone()) ) ), - - Some( &(_, Token::InfixOp{ precedence: prev_prec, .. }) ) => - if la && prev_prec >= prec - || !la && prev_prec > prec { - out_stack.push( op_stack.pop().unwrap() ) - } - else { - return Ok( op_stack.push( (token_idx, token.clone()) ) ) - }, - - Some( &(_, Token::PrefixOp{ .. }) ) => - return Ok( op_stack.push( (token_idx, token.clone()) ) ), - - Some( _ ) => panic!("Non-operator on op_stack") - } - } - } - else { - panic!("Expected infix-op") - } -} - -fn move_till_match_paren( out_stack: &mut TokenStack, op_stack: &mut TokenStack ) -> Result<(), String> { - loop { - match op_stack.pop() { - None => return Err( "syntax error (Mismatched close-parenthesis)".to_string() ), - Some( (_, Token::ParOpen) ) => return Ok( () ), - Some( other ) => out_stack.push( other ) - } - } -} - - -fn infix_operator_two_ints( f: F, values: &Vec ) -> Result - where F : Fn( i64, i64 ) -> Result -{ - assert!( values.len() == 2 ); - if let Some( left ) = values[0].parse::().ok() { - if let Some( right ) = values[1].parse::().ok() { - return match f( left, right ) { - Ok(result) => Ok(result.to_string()), - Err(reason) => Err(reason), - } - } - } - Err( "Expected an integer operand".to_string() ) -} - - -fn infix_operator_two_ints_or_two_strings( fi: FI, fs: FS, values: &Vec ) -> Result - where FI : Fn( i64, i64 ) -> Result, - FS : Fn( &String, &String ) -> Result -{ - assert!( values.len() == 2 ); - if let ( Some( a_int ), Some( b_int ) ) = - ( - values[0].parse::().ok(), - values[1].parse::().ok() - ) { - match fi( a_int, b_int ) { - Ok( result ) => Ok(result.to_string()), - Err( reason ) => Err(reason) - } - } - else { - fs( &values[0], &values[1] ) - } -} - -fn prefix_operator_length( values: &Vec ) -> Result { - assert!( values.len() == 1 ); - Ok( values[0].len().to_string() ) -} - -fn prefix_operator_index( values: &Vec ) -> Result { - assert!( values.len() == 2 ); - let haystack = &values[0]; - let needles = &values[1]; - - let mut current_idx = 0; - for ch_h in haystack.chars() { - current_idx += 1; - - for ch_n in needles.chars() { - if ch_n == ch_h { - return Ok( current_idx.to_string() ) - } - } - } - Ok( "0".to_string() ) -} - -fn prefix_operator_substr( values: &Vec ) -> Result { - assert!( values.len() == 3 ); - let subj = &values[0]; - let mut idx = match values[1].parse::() { - Ok( i ) => i, - Err( _ ) => return Err( "expected integer as POS arg to 'substr'".to_string() ), - }; - let mut len = match values[2].parse::() { - Ok( i ) => i, - Err( _ ) => return Err( "expected integer as LENGTH arg to 'substr'".to_string() ), - }; - - if idx <= 0 || len <= 0 { return Ok( "".to_string() ) } - - let mut out_str = String::new(); - for ch in subj.chars() { - idx -= 1; - if idx <= 0 { - if len <= 0 { break; } - len -= 1; - - out_str.push( ch ); - } - } - Ok( out_str ) -} - -fn bool_as_int( b: bool ) -> i64 { if b { 1 } else { 0 } } -fn bool_as_string( b: bool ) -> String { if b { "1".to_string() } else { "0".to_string() } } - diff --git a/src/expr/tokens.rs b/src/expr/tokens.rs deleted file mode 100644 index f1c0a65bf..000000000 --- a/src/expr/tokens.rs +++ /dev/null @@ -1,160 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Roman Gafiyatullin - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -//! -//! The following tokens are present in the expr grammar: -//! * integer literal; -//! * string literal; -//! * infix binary operators; -//! * prefix operators. -//! -//! According to the man-page of expr we have expression split into tokens (each token -- separate CLI-argument). -//! Hence all we need is to map the strings into the Token structures, except for some ugly fiddling with +-escaping. -//! - -#[derive(Debug)] -#[derive(Clone)] -pub enum Token { - Value{ value: String }, - - ParOpen, - ParClose, - - InfixOp { - precedence: u8, - left_assoc: bool, - value: String - }, - - PrefixOp { - arity: usize, - value: String - }, -} -impl Token { - fn new_infix_op( v: &String, left_assoc: bool, precedence: u8 ) -> Self { - Token::InfixOp{ - left_assoc: left_assoc, - precedence: precedence, - value: v.clone() - } - } - fn new_value( v: &String ) -> Self { - Token::Value{ - value: v.clone() - } - } - - fn is_infix_plus( &self ) -> bool { - match self { - &Token::InfixOp{ ref value, .. } => value == "+", - _ => false - } - } - fn is_a_number( &self ) -> bool { - match self { - &Token::Value{ ref value, .. } => - match value.parse::() { - Ok( _ ) => true, - Err( _ ) => false - }, - _ => false, - } - } - fn is_a_close_paren( &self ) -> bool { - match self { - &Token::ParClose => true, - _ => false, - } - } -} - -pub fn strings_to_tokens( strings: &Vec ) -> Result< Vec<(usize, Token)>, String > { - let mut tokens_acc = Vec::with_capacity( strings.len() ); - let mut tok_idx = 1; - - for s in strings { - let token_if_not_escaped = - match s.as_ref() { - "(" => Token::ParOpen, - ")" => Token::ParClose, - - "^" => Token::new_infix_op( &s, false, 7 ), - - ":" => Token::new_infix_op( &s, true, 6 ), - - "*" => Token::new_infix_op( &s, true, 5 ), - "/" => Token::new_infix_op( &s, true, 5 ), - "%" => Token::new_infix_op( &s, true, 5 ), - - "+" => Token::new_infix_op( &s, true, 4 ), - "-" => Token::new_infix_op( &s, true, 4 ), - - "=" => Token::new_infix_op( &s, true, 3 ), - "!=" => Token::new_infix_op( &s, true, 3 ), - "<" => Token::new_infix_op( &s, true, 3 ), - ">" => Token::new_infix_op( &s, true, 3 ), - "<=" => Token::new_infix_op( &s, true, 3 ), - ">=" => Token::new_infix_op( &s, true, 3 ), - - "&" => Token::new_infix_op( &s, true, 2 ), - - "|" => Token::new_infix_op( &s, true, 1 ), - - "match" => Token::PrefixOp{ arity: 2, value: s.clone() }, - "substr" => Token::PrefixOp{ arity: 3, value: s.clone() }, - "index" => Token::PrefixOp{ arity: 2, value: s.clone() }, - "length" => Token::PrefixOp{ arity: 1, value: s.clone() }, - - _ => Token::new_value( &s ), - }; - push_token_if_not_escaped( &mut tokens_acc, tok_idx, token_if_not_escaped, &s ); - tok_idx += 1; - } - maybe_dump_tokens_acc( &tokens_acc ); - - Ok( tokens_acc ) -} - -fn maybe_dump_tokens_acc( tokens_acc: &Vec<(usize, Token)> ) { - use std::env; - - if let Ok(debug_var) = env::var( "EXPR_DEBUG_TOKENS" ) { - if debug_var == "1" { - println!("EXPR_DEBUG_TOKENS"); - for token in tokens_acc { - println!("\t{:?}", token); - } - } - } -} - -fn push_token_if_not_escaped( acc: &mut Vec<(usize, Token)>, tok_idx: usize, token: Token, s: &String ) { - // Smells heuristics... :( - let prev_is_plus = - match acc.last() { - None => false, - Some( ref t ) => t.1.is_infix_plus(), - }; - let should_use_as_escaped = - if prev_is_plus && acc.len() >= 2 { - let pre_prev = &acc[acc.len() - 2]; - ! ( pre_prev.1.is_a_number() || pre_prev.1.is_a_close_paren() ) - } - else if prev_is_plus { true } - else { false }; - - if should_use_as_escaped { - acc.pop(); - acc.push( (tok_idx, Token::new_value( s )) ) - } - else { - acc.push( (tok_idx, token) ) - } -} diff --git a/src/factor/Cargo.toml b/src/factor/Cargo.toml deleted file mode 100644 index ab32fae68..000000000 --- a/src/factor/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "factor" -version = "0.0.1" -authors = [] - -[lib] -name = "factor" -path = "factor.rs" - -[dependencies] -getopts = "*" -libc = "*" -rand = "*" diff --git a/src/factor/deps.mk b/src/factor/deps.mk deleted file mode 100644 index ea0f8a6b8..000000000 --- a/src/factor/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += rand diff --git a/src/factor/factor.rs b/src/factor/factor.rs deleted file mode 100644 index b037be020..000000000 --- a/src/factor/factor.rs +++ /dev/null @@ -1,202 +0,0 @@ -#![crate_name = "factor"] - -/* -* This file is part of the uutils coreutils package. -* -* (c) T. Jameson Little -* (c) Wiktor Kuropatwa -* 20150223 added Pollard rho method implementation -* (c) kwantam -* 20150429 sped up trial division by adding table of prime inverses -* -* For the full copyright and license information, please view the LICENSE file -* that was distributed with this source code. -*/ - -extern crate getopts; -extern crate libc; -extern crate rand; - -use numeric::*; -use prime_table::P_INVS_U64; -use rand::weak_rng; -use rand::distributions::{Range, IndependentSample}; -use std::cmp::{max, min}; -use std::io::{stdin, BufRead, BufReader, Write}; -use std::num::Wrapping; -use std::mem::swap; - -#[path="../common/util.rs"] -#[macro_use] -mod util; -mod numeric; -mod prime_table; - -static NAME: &'static str = "factor"; -static VERSION: &'static str = "1.0.0"; - -fn rho_pollard_pseudorandom_function(x: u64, a: u64, b: u64, num: u64) -> u64 { - if num < 1 << 63 { - (sm_mul(a, sm_mul(x, x, num), num) + b) % num - } else { - big_add(big_mul(a, big_mul(x, x, num), num), b, num) - } -} - -fn gcd(mut a: u64, mut b: u64) -> u64 { - while b > 0 { - a %= b; - swap(&mut a, &mut b); - } - a -} - -fn rho_pollard_find_divisor(num: u64) -> u64 { - let range = Range::new(1, num); - let mut rng = rand::weak_rng(); - let mut x = range.ind_sample(&mut rng); - let mut y = x; - let mut a = range.ind_sample(&mut rng); - let mut b = range.ind_sample(&mut rng); - - loop { - x = rho_pollard_pseudorandom_function(x, a, b, num); - y = rho_pollard_pseudorandom_function(y, a, b, num); - y = rho_pollard_pseudorandom_function(y, a, b, num); - let d = gcd(num, max(x, y) - min(x, y)); - if d == num { - // Failure, retry with diffrent function - x = range.ind_sample(&mut rng); - y = x; - a = range.ind_sample(&mut rng); - b = range.ind_sample(&mut rng); - } else if d > 1 { - return d; - } - } -} - -fn rho_pollard_factor(num: u64, factors: &mut Vec) { - if is_prime(num) { - factors.push(num); - return; - } - let divisor = rho_pollard_find_divisor(num); - rho_pollard_factor(divisor, factors); - rho_pollard_factor(num / divisor, factors); -} - -fn table_division(mut num: u64, factors: &mut Vec) { - if num < 2 { - return; - } - while num % 2 == 0 { - num /= 2; - factors.push(2); - } - if num == 1 { - return; - } - if is_prime(num) { - factors.push(num); - return; - } - for &(prime, inv, ceil) in P_INVS_U64 { - if num == 1 { - break; - } - - // inv = prime^-1 mod 2^64 - // ceil = floor((2^64-1) / prime) - // if (num * inv) mod 2^64 <= ceil, then prime divides num - // See http://math.stackexchange.com/questions/1251327/ - // for a nice explanation. - loop { - let Wrapping(x) = Wrapping(num) * Wrapping(inv); // x = num * inv mod 2^64 - if x <= ceil { - num = x; - factors.push(prime); - if is_prime(num) { - factors.push(num); - return; - } - } else { - break; - } - } - } - - // do we still have more factoring to do? - // Decide whether to use Pollard Rho or slow divisibility based on - // number's size: - //if num >= 1 << 63 { - // number is too big to use rho pollard without overflowing - //trial_division_slow(num, factors); - //} else if num > 1 { - // number is still greater than 1, but not so big that we have to worry - rho_pollard_factor(num, factors); - //} -} - -fn print_factors(num: u64) { - print!("{}:", num); - - let mut factors = Vec::new(); - // we always start with table division, and go from there - table_division(num, &mut factors); - factors.sort(); - - for fac in factors.iter() { - print!(" {}", fac); - } - println!(""); -} - -fn print_factors_str(num_str: &str) { - if let Err(e) = num_str.parse::().and_then(|x| Ok(print_factors(x))) { - show_warning!("{}: {}", num_str, e); - } -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - opts.optflag("h", "help", "show this help message"); - opts.optflag("v", "version", "print the version and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f) - }; - - if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: -\t{0} [NUMBER]... -\t{0} [OPTION] - -Print the prime factors of the given number(s). If none are specified, -read from standard input.", NAME, VERSION); - - print!("{}", opts.usage(&msg)); - return 1; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if matches.free.is_empty() { - for line in BufReader::new(stdin()).lines() { - for number in line.unwrap().split_whitespace() { - print_factors_str(number); - } - } - } else { - for num_str in matches.free.iter() { - print_factors_str(num_str); - } - } - 0 -} diff --git a/src/factor/gen_table.rs b/src/factor/gen_table.rs deleted file mode 100644 index f4ad03cce..000000000 --- a/src/factor/gen_table.rs +++ /dev/null @@ -1,134 +0,0 @@ -/* -* This file is part of the uutils coreutils package. -* -* (c) kwantam -* -* For the full copyright and license information, please view the LICENSE file -* that was distributed with this source code. -*/ - -//! Generate a table of the multiplicative inverses of p_i mod 2^64 -//! for the first 1027 odd primes (all 13 bit and smaller primes). -//! You can supply a commandline argument to override the default -//! value of 1027 for the number of entries in the table. -//! -//! 2 has no multiplicative inverse mode 2^64 because 2 | 2^64, -//! and in any case divisibility by two is trivial by checking the LSB. - -#![cfg_attr(test, allow(dead_code))] - -use sieve::Sieve; -use std::env::args; -use std::num::Wrapping; -use std::u64::MAX as MAX_U64; - -#[cfg(test)] -use numeric::is_prime; - -#[cfg(test)] -mod numeric; - -mod sieve; - -// extended Euclid algorithm -// precondition: a does not divide 2^64 -fn inv_mod_u64(a: u64) -> Option { - let mut t = 0u64; - let mut newt = 1u64; - let mut r = 0u64; - let mut newr = a; - - while newr != 0 { - let quot = if r == 0 { - // special case when we're just starting out - // This works because we know that - // a does not divide 2^64, so floor(2^64 / a) == floor((2^64-1) / a); - MAX_U64 - } else { - r - } / newr; - - let (tp, Wrapping(newtp)) = - (newt, Wrapping(t) - (Wrapping(quot) * Wrapping(newt))); - t = tp; - newt = newtp; - - let (rp, Wrapping(newrp)) = - (newr, Wrapping(r) - (Wrapping(quot) * Wrapping(newr))); - r = rp; - newr = newrp; - } - - if r > 1 { // not invertible - return None; - } - - Some(t) -} - -#[cfg_attr(test, allow(dead_code))] -fn main() { - // By default, we print the multiplicative inverses mod 2^64 of the first 1k primes - let n = args().skip(1).next().unwrap_or("1027".to_string()).parse::().ok().unwrap_or(1027); - - print!("{}", PREAMBLE); - let mut cols = 3; - - // we want a total of n + 1 values - let mut primes = Sieve::odd_primes().take(n + 1); - - // in each iteration of the for loop, we use the value yielded - // by the previous iteration. This leaves one value left at the - // end, which we call NEXT_PRIME. - let mut x = primes.next().unwrap(); - for next in primes { - // format the table - let outstr = format!("({}, {}, {}),", x, inv_mod_u64(x).unwrap(), MAX_U64 / x); - if cols + outstr.len() > MAX_WIDTH { - print!("\n {}", outstr); - cols = 4 + outstr.len(); - } else { - print!(" {}", outstr); - cols += 1 + outstr.len(); - } - - x = next; - } - - print!("\n];\n\n#[allow(dead_code)]\npub const NEXT_PRIME: u64 = {};\n", x); -} - -#[test] -fn test_inverter() { - let num = 10000; - - let invs = Sieve::odd_primes().map(|x| inv_mod_u64(x).unwrap()); - assert!(Sieve::odd_primes().zip(invs).take(num).all(|(x, y)| { - let Wrapping(z) = Wrapping(x) * Wrapping(y); - is_prime(x) && z == 1 - })); -} - -#[test] -fn test_generator() { - let prime_10001 = Sieve::primes().skip(10000).next(); - assert_eq!(prime_10001, Some(104743)); -} - -const MAX_WIDTH: usize = 102; -const PREAMBLE: &'static str = -r##"/* -* This file is part of the uutils coreutils package. -* -* (c) kwantam -* -* For the full copyright and license information, please view the LICENSE file -* that was distributed with this source code. -*/ - -// *** NOTE: this file was automatically generated. -// Please do not edit by hand. Instead, modify and -// re-run src/factor/gen_tables.rs. - -pub const P_INVS_U64: &'static [(u64, u64, u64)] = &[ - "##; diff --git a/src/factor/numeric.rs b/src/factor/numeric.rs deleted file mode 100644 index 16a0652a1..000000000 --- a/src/factor/numeric.rs +++ /dev/null @@ -1,132 +0,0 @@ -/* -* This file is part of the uutils coreutils package. -* -* (c) Wiktor Kuropatwa -* (c) kwantam -* 20150507 added big_ routines to prevent overflow when num > 2^63 -* -* For the full copyright and license information, please view the LICENSE file -* that was distributed with this source code. -*/ - -use std::u64::MAX as MAX_U64; -use std::num::Wrapping; - -pub fn big_add(a: u64, b: u64, m: u64) -> u64 { - let Wrapping(msb_mod_m) = Wrapping(MAX_U64) - Wrapping(m) + Wrapping(1); - let msb_mod_m = msb_mod_m % m; - - let Wrapping(res) = Wrapping(a) + Wrapping(b); - let res = if b <= MAX_U64 - a { - res - } else { - (res + msb_mod_m) % m - }; - - res -} - -// computes (a + b) % m using the russian peasant algorithm -// CAUTION: Will overflow if m >= 2^63 -pub fn sm_mul(mut a: u64, mut b: u64, m: u64) -> u64 { - let mut result = 0; - while b > 0 { - if b & 1 != 0 { - result = (result + a) % m; - } - a = (a << 1) % m; - b >>= 1; - } - result -} - -// computes (a + b) % m using the russian peasant algorithm -// Only necessary when m >= 2^63; otherwise, just wastes time. -pub fn big_mul(mut a: u64, mut b: u64, m: u64) -> u64 { - // precompute 2^64 mod m, since we expect to wrap - let Wrapping(msb_mod_m) = Wrapping(MAX_U64) - Wrapping(m) + Wrapping(1); - let msb_mod_m = msb_mod_m % m; - - let mut result = 0; - while b > 0 { - if b & 1 != 0 { - let Wrapping(next_res) = Wrapping(result) + Wrapping(a); - let next_res = next_res % m; - result = if result <= MAX_U64 - a { - next_res - } else { - (next_res + msb_mod_m) % m - }; - } - let Wrapping(next_a) = Wrapping(a) << 1; - let next_a = next_a % m; - a = if a < 1 << 63 { - next_a - } else { - (next_a + msb_mod_m) % m - }; - b >>= 1; - } - result -} - -// computes a.pow(b) % m -fn pow(mut a: u64, mut b: u64, m: u64, mul: fn(u64, u64, u64) -> u64) -> u64 { - let mut result = 1; - while b > 0 { - if b & 1 != 0 { - result = mul(result, a, m); - } - a = mul(a, a, m); - b >>= 1; - } - result -} - -fn witness(mut a: u64, exponent: u64, m: u64) -> bool { - if a == 0 { - return false; - } - - let mul = if m < 1 << 63 { - sm_mul as fn(u64, u64, u64) -> u64 - } else { - big_mul as fn(u64, u64, u64) -> u64 - }; - - if pow(a, m-1, m, mul) != 1 { - return true; - } - a = pow(a, exponent, m, mul); - if a == 1 { - return false; - } - loop { - if a == 1 { - return true; - } - if a == m-1 { - return false; - } - a = mul(a, a, m); - } -} - -// uses deterministic (i.e., fixed witness set) Miller-Rabin test -pub fn is_prime(num: u64) -> bool { - if num < 2 { - return false; - } - if num % 2 == 0 { - return num == 2; - } - let mut exponent = num - 1; - while exponent & 1 == 0 { - exponent >>= 1; - } - - // These witnesses detect all composites up to at least 2^64. - // Discovered by Jim Sinclair, according to http://miller-rabin.appspot.com - let witnesses = [2, 325, 9375, 28178, 450775, 9780504, 1795265022]; - ! witnesses.iter().any(|&wit| witness(wit % num, exponent, num)) -} diff --git a/src/factor/prime_table.rs b/src/factor/prime_table.rs deleted file mode 100644 index 43f01eb4b..000000000 --- a/src/factor/prime_table.rs +++ /dev/null @@ -1,532 +0,0 @@ -/* -* This file is part of the uutils coreutils package. -* -* (c) kwantam -* -* For the full copyright and license information, please view the LICENSE file -* that was distributed with this source code. -*/ - -// *** NOTE: this file was automatically generated. -// Please do not edit by hand. Instead, modify and -// re-run src/factor/gen_tables.rs. - -pub const P_INVS_U64: &'static [(u64, u64, u64)] = &[ - (3, 12297829382473034411, 6148914691236517205), (5, 14757395258967641293, 3689348814741910323), - (7, 7905747460161236407, 2635249153387078802), (11, 3353953467947191203, 1676976733973595601), - (13, 5675921253449092805, 1418980313362273201), (17, 17361641481138401521, 1085102592571150095), - (19, 9708812670373448219, 970881267037344821), (23, 15238614669586151335, 802032351030850070), - (29, 3816567739388183093, 636094623231363848), (31, 17256631552825064415, 595056260442243600), - (37, 1495681951922396077, 498560650640798692), (41, 10348173504763894809, 449920587163647600), - (43, 9437869060967677571, 428994048225803525), (47, 5887258746928580303, 392483916461905353), - (53, 2436362424829563421, 348051774975651917), (59, 14694863923124558067, 312656679215416129), - (61, 5745707170499696405, 302405640552615600), (67, 17345445920055250027, 275324538413575397), - (71, 1818693077689674103, 259813296812810586), (73, 9097024474706080249, 252695124297391118), - (79, 11208148297950107311, 233503089540627235), (83, 11779246215742243803, 222249928598910260), - (89, 17617676924329347049, 207266787345051141), (97, 11790702397628785569, 190172619316593315), - (101, 4200743699953660269, 182641030432767837), (103, 15760325033848937303, 179094602657374287), - (107, 8619973866219416643, 172399477324388332), (109, 12015769075535579493, 169236184162472950), - (113, 10447713457676206225, 163245522776190722), (127, 9150747060186627967, 145249953336295682), - (131, 281629680514649643, 140814840257324821), (137, 16292379802327414201, 134647766961383588), - (139, 4246732448623781667, 132710389019493177), (149, 16094474695182830269, 123803651501406386), - (151, 8062815290495565607, 122163868037811600), (157, 6579730370240349621, 117495185182863386), - (163, 2263404180823257867, 113170209041162893), (167, 10162278172342986519, 110459545351554201), - (173, 9809829218388894501, 106628578460748853), (179, 17107036403551874683, 103054436165975148), - (181, 3770881385233444253, 101915713114417412), (191, 2124755861893246783, 96579811904238490), - (193, 8124213711219232577, 95578984837873324), (197, 14513935692512591373, 93638294790403815), - (199, 2780916192016515319, 92697206400550510), (211, 13900627050804827995, 87425327363552377), - (223, 7527595115280579359, 82720825442643729), (227, 1950316554048586955, 81263189752024456), - (229, 2094390156840385773, 80553467570784068), (233, 7204522363551799129, 79170575423646144), - (239, 7255204782128442895, 77183029597111094), (241, 17298606475760824337, 76542506529915151), - (251, 2939720171109091891, 73493004277727297), (257, 18374966859414961921, 71777214294589695), - (263, 15430736487513693367, 70139711306880424), (269, 10354863773718001093, 68575256779589411), - (271, 15383631589145234927, 68069166323651481), (277, 17181443938689762877, 66594743948409933), - (281, 14245350405676059433, 65646776063023315), (283, 5149444458738708755, 65182841249857072), - (293, 2707201348701401773, 62958170900032599), (307, 17305088903023944187, 60087114246610917), - (311, 9134400602415662215, 59314289626075728), (313, 6365010734698503433, 58935284580541698), - (317, 17050145153302519317, 58191621683626345), (331, 3455281367280943203, 55730344633563600), - (337, 9196002980365592497, 54738112978366622), (347, 9941040754419844819, 53160645745560667), - (349, 15751088062938241781, 52856000211202153), (353, 8779186981255537313, 52257065364616293), - (359, 5600822016808749655, 51383688227603207), (367, 9751139919072624015, 50263607830271257), - (373, 3511310534137743069, 49455077945602015), (379, 17181268226964305331, 48672147951740241), - (383, 14834457375202459263, 48163822646761231), (389, 12661389891209383757, 47420935922132523), - (397, 185861401246443845, 46465350311610961), (401, 3220129888178724721, 46001855545410353), - (409, 2074694932495450793, 45102063749901104), (419, 1849076971589024267, 44025642180691053), - (421, 14897608040525528621, 43816494236839790), (431, 8046375605237577039, 42799870240625409), - (433, 7540585914657253201, 42602180308798040), (439, 15379290047785184263, 42019918163347497), - (443, 15615189678648040307, 41640505809728107), (449, 205420312624827969, 41084062524965593), - (457, 686202733595322489, 40364866682077793), (461, 3041111821262312197, 40014629227135686), - (463, 8127723090792113455, 39841779856824085), (467, 15247201739725667931, 39500522641776341), - (479, 8010277176057592351, 38510947961815347), (487, 2386334448960373207, 37878324586672590), - (491, 1051952818867347139, 37569743530976683), (499, 12494988971771199291, 36967422993405915), - (503, 17969989256695189447, 36673447462643243), (509, 5436172123882971989, 36241147492553146), - (521, 1805727346946616377, 35406418567580713), (523, 7195288319381928355, 35271021173440825), - (541, 13911777416032342069, 34097493666745936), (547, 13219604528142859659, 33723480939139948), - (557, 5133295029488295333, 33118032448311582), (563, 18151858289227516155, 32765087164670606), - (569, 6386658317259721737, 32419585366800617), (571, 1873749835858413299, 32306031652731263), - (577, 8184343991108570561, 31970093715267853), (587, 8107768264083584867, 31425458387920871), - (593, 13407330009728190129, 31107494222107169), (599, 16999336775772408167, 30795899956109435), - (601, 10926856722530117097, 30693417759916059), (607, 7810235958720518559, 30390023185682951), - (613, 10111102787547160429, 30092567820080834), (617, 5112468778937331161, 29897478239399597), - (619, 10400506755613301315, 29800878955912038), (631, 14909412801254946631, 29234142747558718), - (641, 18417966001831689601, 28778071877862015), (643, 12450835035754191915, 28688559990217032), - (647, 16650538700226241335, 28511196404496988), (653, 18023005695293558853, 28249225227732850), - (659, 13744083976011213723, 27992024391061535), (661, 3544230707051608253, 27907328401981167), - (673, 7016889276180750689, 27409723735081057), (677, 7711120491668837677, 27247775588935822), - (683, 18338710433453565955, 27008410063996415), (691, 16604739238563445883, 26695722248494285), - (701, 4578792394900801685, 26314898821268975), (709, 17796294705807240205, 26017974716092456), - (719, 7799457855921701935, 25656111368163493), (727, 3501582781529460967, 25373788271952615), - (733, 8027982755134170485, 25166090141486427), (739, 12755461734324196043, 24961764646426998), - (743, 8416482154761154775, 24827380987496031), (751, 73688724661955599, 24562908220651866), - (757, 11233750354002778461, 24368222026036395), (761, 8193166224591101769, 24240136759145271), - (769, 8635666926574042369, 23987963684927895), (773, 11955781087876436429, 23863834506739394), - (787, 1757948926973591323, 23439319026314550), (797, 3332912354597459765, 23145224684704581), - (809, 12062209660064712985, 22801908620160137), (811, 2229076349227541379, 22745677032934095), - (821, 4044353146489304861, 22468628591607249), (823, 5536264624794968711, 22414026821032261), - (827, 9502192231439261171, 22305615566758829), (829, 9813044796750195733, 22251802260204525), - (839, 17941052639030982263, 21986584116459537), (853, 13018686907823153661, 21625725760503577), - (857, 12247604875076703465, 21524788884141833), (859, 858986918449804499, 21474672961245112), - (863, 13637338028999645343, 21375137976488472), (877, 4964004106494246501, 21033915705484095), - (881, 14447506709261737361, 20938415520669184), (883, 17047047751015848379, 20890989890950794), - (887, 15763959422628906567, 20796780240935232), (907, 11979197639928253475, 20338196332645591), - (911, 16462352285319281519, 20248895799900715), (919, 16098246732442938407, 20072626848432591), - (929, 13264181960428396641, 19856559821000593), (937, 11792529028977610905, 19687026759561954), - (941, 1725094026021722149, 19603341204792297), (947, 18271431828024877947, 19479138409408185), - (953, 18137040080866579081, 19356499552685783), (967, 9614435380713147895, 19076260676018150), - (971, 10828675717831559651, 18997676697950104), (977, 12064963626510136625, 18881007240234955), - (983, 9326583728009813991, 18765762028188760), (991, 13160290676198438943, 18614272526447579), - (997, 11785933776281829869, 18502250826188115), (1009, 6965519813759503633, 18282204235589248), - (1013, 7775675932353384541, 18210013893099261), (1019, 10372899268140896051, 18102791043875909), - (1021, 7497942008412795221, 18067330140753723), (1031, 13544311604071901623, 17892089305246897), - (1033, 15464550210873641529, 17857448280454551), (1039, 1881958490676816623, 17754325383743553), - (1049, 8370495880920635433, 17585075380085368), (1051, 15691141010367591955, 17551611868420125), - (1061, 10466484384894580653, 17386186685871396), (1063, 5917535022704569239, 17353475139896097), - (1069, 13511506650808773541, 17256074905247475), (1087, 4836542834413267903, 16970325734783396), - (1091, 12613447368457676907, 16908106392034419), (1093, 12235946434985750157, 16877167496532069), - (1097, 14007418243755748857, 16815628143764404), (1103, 13546566364192871087, 16724156005176384), - (1109, 14687533829653321981, 16633673646266502), (1117, 17043007953507839989, 16514542590608372), - (1123, 10923494932339137867, 16426308168931034), (1129, 8610659102608444377, 16339011579902171), - (1151, 2852754513571068799, 16026710750399262), (1153, 16894849732729650049, 15998910731751562), - (1163, 14877941479913636643, 15861344861315177), (1171, 10554499171123313051, 15752983837497482), - (1181, 9918444103984390581, 15619597014148646), (1187, 6884505159775342347, 15540643701524474), - (1193, 17503532515875282841, 15462484554660143), (1201, 10275496907003905105, 15359487155461741), - (1213, 12439766407497455253, 15207538395473661), (1217, 6745111842892974913, 15157554703130280), - (1223, 5399782811437464823, 15083192210719175), (1229, 11572367518982965253, 15009555796346258), - (1231, 1168843247562424879, 14985169840543908), (1237, 12988774525627339901, 14912485104049758), - (1249, 2171073962238033697, 14769210627469616), (1259, 2754557494723904451, 14651901567680342), - (1277, 8710561218830743637, 14445375155606540), (1279, 10802667170608642815, 14422786609624356), - (1283, 17756608675784330667, 14377820790108769), (1289, 715544766241642809, 14310895324832856), - (1291, 10173572254439349923, 14288725076459761), (1297, 9401154844041645041, 14222624574949538), - (1301, 4069343235322552893, 14178896290322483), (1303, 17455744775812645543, 14157132827098658), - (1307, 11545093077501463827, 14113805718216948), (1319, 7286393982109686423, 13985401117293064), - (1321, 10375420777264342809, 13964227156479600), (1327, 17848997280062595535, 13901088224347815), - (1361, 8864195903163884465, 13553816365694012), (1367, 11915490136858474087, 13494326315808011), - (1373, 7241656996161287925, 13435356208091443), (1381, 10365440551193781357, 13357526483497140), - (1399, 11511084757933122631, 13185664098434275), (1409, 11062809611273648769, 13092082380205501), - (1423, 11991031811792927087, 12963277634370731), (1427, 10910337770294927515, 12926940486131430), - (1429, 4001742941112638909, 12908848197137544), (1433, 6539390083352723113, 12872815124710084), - (1439, 3589359513994909279, 12819141121410390), (1447, 15973580044476895767, 12748268191920906), - (1451, 6496406768894266627, 12713124792356686), (1453, 16301183338364118565, 12695625652931556), - (1459, 12921571242858918267, 12643416088903051), (1471, 15612641993044453951, 12540274693208396), - (1481, 7535638193514030201, 12455600319857901), (1483, 10846635760131307491, 12438802477214802), - (1487, 7517637463798243631, 12405342349502052), (1489, 9155234298503263025, 12388679700275051), - (1493, 17211195240909179773, 12355488328003718), (1499, 11419998999601376851, 12306033404742862), - (1511, 5310611298519956951, 12208301835678061), (1523, 3355054568888736571, 12112110356999048), - (1531, 13325995392242171187, 12048820426982071), (1543, 7651274275550300087, 11955116055547343), - (1549, 15826806245293734085, 11908808310980988), (1553, 14028077753413380849, 11878135269613362), - (1559, 9773579605442007463, 11832420829832938), (1567, 5579934072072959455, 11772012810280505), - (1571, 4004035473669609867, 11742039512227594), (1579, 17874299197451307139, 11682548495066213), - (1583, 11163601277709254863, 11653028473600474), (1597, 8663154699613126933, 11550872932817502), - (1601, 13918592655241185729, 11522013787451312), (1607, 1503748272343466871, 11478994445369976), - (1609, 4574425659049167865, 11464725962529242), (1613, 2904818967589724805, 11436295147991042), - (1619, 3999263230310100443, 11393912337065813), (1621, 9707015851248764669, 11379854456329149), - (1627, 10045368930120874451, 11337888182980670), (1637, 13127951646836669293, 11268628023035767), - (1657, 2237655738573095881, 11132615614791521), (1663, 5291098570751326591, 11092449833860223), - (1667, 12747839935760889899, 11065833277570216), (1669, 12312566146262696525, 11052572842246585), - (1693, 14633182097455361973, 10895891360726256), (1697, 3782832609104846177, 10870208646853006), - (1699, 15080946155610692875, 10857412639028576), (1709, 5137887758388383013, 10793881845353745), - (1721, 4062356771607158665, 10718619450150814), (1723, 2141235527998787187, 10706177639993935), - (1733, 18372233278258907149, 10644399350092066), (1741, 3401151549489239557, 10595487693112895), - (1747, 8806287668845887835, 10559097924275644), (1753, 5387754116223211881, 10522957258248460), - (1759, 4184338195230307615, 10487063145940620), (1777, 7816768873102584337, 10380835156842741), - (1783, 6114428349726497479, 10345902453005917), (1787, 17001559870956704819, 10322744305377477), - (1789, 18085851931406681685, 10311204065796283), (1801, 15916846357881534265, 10242500873797641), - (1811, 13751024019606788891, 10185943718227251), (1823, 16463440816196072671, 10118894170987137), - (1831, 11374316799136037015, 10074682727312698), (1847, 10307005892836089479, 9987408810887683), - (1861, 10526836220461872013, 9912275160510237), (1867, 12903828473628641891, 9880419964493600), - (1871, 5176130752911552431, 9859296672212480), (1873, 10567728986166763953, 9848768859428484), - (1877, 8451891264459357693, 9827780540069020), (1879, 13538084128603231335, 9817319890212640), - (1889, 13896091485912489121, 9765348900852065), (1901, 9383483176894863973, 9703705456975040), - (1907, 2843913349591299515, 9673174658473807), (1913, 12053544219622027977, 9642835375697622), - (1931, 10661090826649331747, 9552948769399042), (1933, 6680145293117788997, 9543064704453984), - (1949, 13790100623599187637, 9464722459573910), (1951, 7043989920509285471, 9455020027529242), - (1973, 17128451669050125981, 9349591522407274), (1979, 736378363730699635, 9321245110515185), - (1987, 11864589293508206827, 9283716192103448), (1993, 11727057070441546361, 9255767222132238), - (1997, 13994400236189269253, 9237227878672784), (1999, 2768395808960913199, 9227986029869710), - (2003, 16319336244939253851, 9209557700304319), (2011, 15043590393278798931, 9172920971511462), - (2017, 493864243916864545, 9145634146608602), (2027, 11384744369122175171, 9100515083231155), - (2029, 5309462069515218405, 9091544639580853), (2039, 9698337247188150727, 9046956387302379), - (2053, 11797649765601871053, 8985262578523892), (2063, 3818109413220542191, 8941708227682768), - (2069, 3798121302755084093, 8915777705997849), (2081, 15698790847928695777, 8864365244454373), - (2083, 13345772116697212811, 8855854092035310), (2087, 12993154666196952983, 8838880725304049), - (2089, 7205621428505023513, 8830418417285568), (2099, 9913257415504704251, 8788348772610553), - (2111, 6859637185154901951, 8738391318668664), (2113, 34920480972474305, 8730120243118576), - (2129, 5588609641870672049, 8664511072667708), (2131, 16317274790681607131, 8656379199300587), - (2137, 13327923654566002665, 8632074905806996), (2141, 15749952436590873589, 8615947722423891), - (2143, 11310789413371138975, 8607906707283971), (2153, 15473673849103321049, 8567925719326312), - (2161, 6700922766248032401, 8536207345538894), (2179, 4893170295825663531, 8465692553331597), - (2203, 10433337773872946579, 8373465308084226), (2207, 10364278500860826463, 8358289113597440), - (2213, 8552354007964753709, 8335627688074808), (2221, 17059708386942556965, 8305602914772423), - (2237, 16393440866577822357, 8246197619002928), (2239, 15110017253766555455, 8238831654180237), - (2243, 14104398611864414187, 8224139132282457), (2251, 6883725020842302691, 8194910739097979), - (2267, 13865572078341894995, 8137072815928342), (2269, 4089339915855400821, 8129900429135985), - (2273, 15021963607759076129, 8115593521209657), (2281, 16036779262676914009, 8087130238364555), - (2287, 14583171528319575567, 8065913455928968), (2293, 13072812524979512157, 8044807707679699), - (2297, 4946971854333950281, 8030798464827841), (2309, 9770622781354171341, 7989061963494825), - (2311, 191571552474698935, 7982148019779122), (2333, 13362622153694445877, 7906877014020382), - (2339, 9984428387052711563, 7886594302569282), (2341, 12907204952044530349, 7879856503079688), - (2347, 10532014085543587203, 7859712004137005), (2351, 17214868778272546255, 7846339461382199), - (2357, 1017427547552923933, 7826365750407107), (2371, 18298921156206185323, 7780153552808752), - (2377, 18058718325419489529, 7760514965801241), (2381, 17276874961937127301, 7747477561406783), - (2383, 10241310285152218543, 7740975272223899), (2389, 13551291690816351229, 7721533726960883), - (2393, 2227793162265800425, 7708626859051212), (2399, 3252593890445660831, 7689347258736786), - (2411, 9357265865676806979, 7651075932687495), (2417, 5975920814941902737, 7632082777703579), - (2423, 2047946411815051335, 7613183687044800), (2437, 499583548980234061, 7569447711821728), - (2441, 15590181492856536249, 7557043864690516), (2447, 5435268687022716271, 7538514129019023), - (2459, 7749282890663670931, 7501725934814783), (2467, 14722999222186504715, 7477399300247082), - (2473, 12524093530027633305, 7459257611690073), (2477, 11342103845078581797, 7447211979697033), - (2503, 16596910768675153911, 7369853804917919), (2521, 18227227087509120617, 7317232873347699), - (2531, 6646950057377760203, 7288322431335263), (2539, 3465575786986788547, 7265358043997460), - (2543, 3358569605240866063, 7253930032917637), (2549, 10949362017858984541, 7236855266265026), - (2551, 16769109959597197255, 7231181526346355), (2557, 13101011825520745301, 7214213560308780), - (2579, 13311124746480603163, 7152673157700485), (2591, 17656474451099840991, 7119546149637032), - (2593, 8330558160552983009, 7114054791249345), (2609, 14154994877564784337, 7070427011770621), - (2617, 2283815468048106505, 7048813172987983), (2621, 15624483725156506901, 7038055732052480), - (2633, 11910165182417864697, 7005979519069332), (2647, 13603341304072929639, 6968924848398017), - (2657, 5963776123190253985, 6942696301734870), (2659, 7978095406079723339, 6937474266156281), - (2663, 4419460277516595543, 6927053726515040), (2671, 3549841427887199375, 6906306279936185), - (2677, 15855793094361478621, 6890827072734236), (2683, 3417082297664423091, 6875417097916344), - (2687, 14849388697965671807, 6865182014778396), (2689, 8472193726675826049, 6860075892045203), - (2693, 575390457553509965, 6849886399446547), (2699, 12705630690265304355, 6834658789814580), - (2707, 16695427772659180443, 6814460315371094), (2711, 10390327628386014503, 6804405781523257), - (2713, 8540033378761222569, 6799389632771674), (2719, 7639218031260373343, 6784385462931059), - (2729, 2142769465506019737, 6759525127779242), (2731, 13509149815971843, 6754574907985921), - (2741, 5155128041029374877, 6729932168445659), (2749, 7414933503619154069, 6710347062098781), - (2753, 8831387101034939713, 6700597193501471), (2767, 16100067559815167023, 6666694641745410), - (2777, 11511777990543267177, 6642687819124793), (2789, 14842055826964587245, 6614106874761402), - (2791, 10931893478292941015, 6609367278290774), (2797, 5111271597112943333, 6595189157565088), - (2801, 3839504389493990929, 6585770822459675), (2803, 14017682795933408827, 6581071735180004), - (2819, 9318255963448883115, 6543719075455676), (2833, 8647114765226362353, 6511381600321055), - (2837, 12601265426453687357, 6502200942442563), (2843, 10822781960938280723, 6488478393847890), - (2851, 1067594799074737291, 6470271509543862), (2857, 17813989114233340185, 6456683259961341), - (2861, 1972982763563482277, 6447656090076739), (2879, 12129102650757964991, 6407344242344408), - (2887, 9181839706934750839, 6389589218465379), (2897, 7144372402727689649, 6367533335764429), - (2903, 2923011461903683687, 6354372743268877), (2909, 16893133795930644725, 6341266439913905), - (2917, 9106380344923467373, 6323875239530185), (2927, 5123745449923425167, 6302269926105074), - (2939, 12345949504248617907, 6276537622902195), (2953, 12487315070553807545, 6246780925739773), - (2957, 386776507463642949, 6238330765542628), (2963, 273930725360519835, 6225698303648178), - (2969, 15172431467833858217, 6213116899194864), (2971, 13150523038746829459, 6208934390343167), - (2999, 8051613201895899655, 6150965012907486), (3001, 12760893267917703817, 6146865735991186), - (3011, 3394053874737659115, 6126451037432597), (3019, 6091886002480431587, 6110216652437744), - (3023, 14938018356745280303, 6102131681676993), (3037, 15847071217750484085, 6074001999904363), - (3041, 16426761904506894369, 6066012520128099), (3049, 3817610859465636953, 6050096449232388), - (3061, 17295705812331399261, 6026378331822787), (3067, 4559058365788014387, 6014588873071259), - (3079, 17218558774875365815, 5991147799191150), (3083, 1352242672934920099, 5983374659004071), - (3089, 13579765627586766065, 5971752694629184), (3109, 5684136642847780781, 5933336787941316), - (3119, 3761503440487103183, 5914313585671545), (3121, 4604297863960186065, 5910523573761471), - (3137, 12819222850075493313, 5880377454163070), (3163, 17274503934975558611, 5832040491213895), - (3167, 14584984894401236895, 5824674478594743), (3169, 10111074299789678497, 5820998445474771), - (3181, 3635997653007195493, 5799039318990742), (3187, 11414176125935122619, 5788121767715579), - (3191, 11781405334446902599, 5780866209247744), (3203, 8730959730172863019, 5759208265285529), - (3209, 1965966492118624697, 5748440035434575), (3217, 17322851677549442161, 5734144878367905), - (3221, 10663718554873388733, 5727023928503431), (3229, 5541449907555981749, 5712834956243280), - (3251, 15479150363912536699, 5674175353340372), (3253, 9611814080829292957, 5670686773350615), - (3257, 10279656276875295113, 5663722466597958), (3259, 3792365305119791219, 5660246724059389), - (3271, 2227595203031266551, 5639481526661434), (3299, 7162861218072729803, 5591616875934995), - (3301, 14054396045252808941, 5588229043838095), (3307, 9131333549640924099, 5578090134172830), - (3313, 11926630185899746321, 5567987948599321), (3319, 17407412605862704327, 5557922287951055), - (3323, 9281659973289909811, 5551232041441333), (3329, 4327698144057422593, 5541226816974932), - (3331, 1030049353860695467, 5537899751939222), (3343, 7432774234904805871, 5518020961325022), - (3347, 16142967849386099995, 5511426373979549), (3359, 15481206175584169695, 5491736848380336), - (3361, 18139389813629892321, 5488468929993915), (3371, 2670427501622741379, 5472187503325289), - (3373, 306260796954561189, 5468942802760021), (3389, 6221489665461793301, 5443123066895707), - (3391, 9770083266405884607, 5439912731851828), (3407, 3021216082515388847, 5414365739274890), - (3413, 12685176777320925181, 5404847369970568), (3433, 445988860506231513, 5373359765135319), - (3449, 8824913807370472649, 5348432610527559), (3457, 1371366279127380609, 5336055560806928), - (3461, 4130663581948830541, 5329888492837200), (3463, 3861937468506908727, 5326810301388839), - (3467, 10822231740964876835, 5320664572745760), (3469, 13655589155746938181, 5317597023265941), - (3491, 1976248147684724235, 5284085956376268), (3499, 13986628187353941251, 5272004593800957), - (3511, 2553437089097932807, 5253985780036898), (3517, 14135335592450168213, 5245022483283921), - (3527, 8849416210013201399, 5230151424357684), (3529, 17944934090406599801, 5227187326072414), - (3533, 13136713300156589829, 5221269197200552), (3539, 10956500718546899547, 5212417087795860), - (3541, 16279603284479624061, 5209473051033479), (3547, 10453328330464110163, 5200660860927417), - (3557, 9894964209344341997, 5186039942004372), (3559, 14139566685327242711, 5183125617788578), - (3571, 16742060359253054267, 5165708225625749), (3581, 13120317552565827413, 5151282902460081), - (3583, 10631461488197104127, 5148407500337580), (3593, 16916788678784573497, 5134078506459658), - (3607, 1493332206687881639, 5114151392766717), (3613, 8536660971835696181, 5105658475978287), - (3617, 17268641258938496481, 5100012185156082), (3623, 12876570732103631255, 5091566125782376), - (3631, 2667182770227902671, 5080348133767433), (3637, 15180397308939424797, 5071967026040569), - (3643, 4501552424245893875, 5063613525585932), (3659, 720930418841340771, 5041471460428956), - (3671, 13738326967453531495, 5024991575513361), (3673, 8708590858647525865, 5022255397143901), - (3677, 10826237071271474677, 5016791970005317), (3691, 11394900159322074691, 4997763227772839), - (3697, 419130782307709585, 4989652170329876), (3701, 3982423268007006685, 4984259409270346), - (3709, 10165851951108741845, 4973508782342828), (3719, 3625859079828363063, 4960135540120879), - (3727, 11992610917788635247, 4949488616503770), (3733, 1319389410040302781, 4941533370937463), - (3739, 17015999013165082515, 4933603657049893), (3761, 13002477675991497297, 4904744502448697), - (3767, 783509172230827783, 4896932326442673), (3769, 9925708936450774921, 4894333795094070), - (3779, 10304598237523382763, 4881382395795065), (3793, 9454381882228148785, 4863365165755220), - (3797, 10522951715474029181, 4858241789230853), (3803, 6330002896710745427, 4850576932345398), - (3821, 16868077412599103205, 4827726792386692), (3823, 14620359545733701647, 4825201170209142), - (3833, 3157073861819323209, 4812612594236773), (3847, 15996448721054084791, 4795098537486236), - (3851, 15850500166165906595, 4790117910597131), (3853, 15722581764355610565, 4787631475138736), - (3863, 16379066055610603687, 4775237917087639), (3877, 7550937024755496109, 4757994344521421), - (3881, 4515435936620477721, 4753090459600502), (3889, 6147333586918894033, 4743312952869517), - (3907, 8753586770580370795, 4721459962556834), (3911, 10055857418856753783, 4716631059501291), - (3917, 18117085639918469509, 4709406197015458), (3919, 5671938404904314799, 4707002825646734), - (3923, 15126988448922668251, 4702203434542327), (3929, 10653006440123943145, 4695022670834703), - (3931, 4368842211300837587, 4692633954136238), (3943, 9408166962269822039, 4678352542153069), - (3947, 15553778636256748867, 4673611369067532), (3967, 9128046033953075327, 4650048922034169), - (3989, 3838254595432170429, 4624403127026711), (4001, 9935699444849808481, 4610533385081117), - (4003, 16838471857440594955, 4608229846042855), (4007, 10680420826305505303, 4603629666510993), - (4013, 14433784298890603557, 4596746592003376), (4019, 8147044222651021179, 4589884069099166), - (4021, 13845380157785482909, 4587601112586309), (4027, 1575783452037766515, 4580765848946995), - (4049, 715272615355001137, 4555876530923574), (4051, 9325828650446102619, 4553627270725636), - (4057, 2259805719653351529, 4546892796083202), (4073, 17463944303516825689, 4529031199044819), - (4079, 10862730881355808527, 4522369226209745), (4091, 1848732600885093171, 4509103904597788), - (4093, 7918624318961075541, 4506900579943696), (4099, 5944900932268923563, 4500303506638095), - (4111, 12196120260847132399, 4487167130554500), (4127, 250307164557241311, 4469770795665023), - (4129, 15189859493972505569, 4467605733521325), (4133, 14023631715363031981, 4463281895405166), - (4139, 13931993712108252803, 4456811808096050), (4153, 1159306574341004809, 4441787641153275), - (4157, 4406451013998937877, 4437513609263784), (4159, 7069995204013711295, 4435379676294674), - (4177, 13182554718703138993, 4416266237421487), (4201, 10204768680623898585, 4391036437445739), - (4211, 6965168149417759931, 4380608899004880), (4217, 12773178253552736713, 4374376114230389), - (4219, 7913867450441879219, 4372302458807668), (4229, 14778332684258207821, 4361963602201360), - (4231, 248514396644160823, 4359901695511593), (4241, 13549070452630335601, 4349621333107651), - (4243, 12334059141436247451, 4347571075585564), (4253, 17570599633810814389, 4337348712369986), - (4259, 15835007357004489483, 4331238336160965), (4261, 15078622297284761389, 4329205368155257), - (4271, 15401800366857471567, 4319069087733446), (4273, 14306695497372678225, 4317047524855968), - (4283, 11396237408133428339, 4306968030284742), (4289, 6829897316169449281, 4300942894313255), - (4297, 10826783466114845049, 4292935553574482), (4327, 3465958616114135767, 4263171729537682), - (4337, 4249088616471257105, 4253341958429686), (4339, 3804986389944698939, 4251381441278993), - (4349, 8788607431760448597, 4241605903359289), (4357, 1752800561513829325, 4233817781434370), - (4363, 4879106729557832355, 4227995432892402), (4373, 14042810661188908605, 4218327023487205), - (4391, 17963625064719208087, 4201034860785595), (4397, 15606524438071305893, 4195302268298738), - (4409, 3782231037113502985, 4183883890612282), (4421, 1969432979595319693, 4172527499142626), - (4423, 1259533508989438071, 4170640758243172), (4441, 1013511721230608105, 4153736562420525), - (4447, 10581885345633700511, 4148132240546334), (4451, 14928144721074321483, 4144404420065053), - (4457, 15160516836885368537, 4138825235294940), (4463, 8303721452852899215, 4133261051693827), - (4481, 14552385695283031681, 4116657905313446), (4483, 8295479824358343979, 4114821341447591), - (4493, 15778063092647631173, 4105663047787569), (4507, 8402743639522012307, 4092909712382860), - (4513, 662169851526910561, 4087468219301917), (4517, 3695882972483317293, 4083848588379356), - (4519, 2249204687898641943, 4082041175859604), (4523, 3597176270840553731, 4078431146077725), - (4547, 4819602366300186347, 4056904348737530), (4549, 1184095245003998477, 4055120702068487), - (4561, 12804733991967647537, 4044451671499572), (4567, 8667990536934683111, 4039138181237037), - (4583, 4512066355362951639, 4025036891492374), (4591, 9422264180537769231, 4018023104706937), - (4597, 13996572401370223197, 4012778784796508), (4603, 5570491910157783347, 4007548136804160), - (4621, 14482749945773264069, 3991937691778738), (4637, 16867413170698403893, 3978163483655283), - (4639, 13106373888110946783, 3976448388383175), (4643, 1326989558608440715, 3973022630564193), - (4649, 5773287293449644569, 3967895047044429), (4651, 16011504155142003843, 3966188792455289), - (4657, 2150865800305837777, 3961078821926036), (4663, 636913102266188679, 3955982001653345), - (4673, 5542313006524333505, 3947516386413342), (4679, 13912921529412482935, 3942454386345277), - (4691, 2355489170784911835, 3932369233363792), (4703, 18325151671777806751, 3922335546185318), - (4721, 2961794536723541649, 3907380655308102), (4723, 13908290418479719099, 3905726037202953), - (4729, 3237639581556127689, 3900770580188105), (4733, 18244075429755844309, 3897473922186678), - (4751, 1615206384900689007, 3882707656011271), (4759, 17136594988415618343, 3876180725721696), - (4783, 3089241480878392399, 3856730937426207), (4787, 11117371350042209403, 3853508266912377), - (4789, 7965727029532543901, 3851898950450939), (4793, 16872632175911261065, 3848684346695086), - (4799, 7976035414241991999, 3843872488791321), (4801, 15891633719821434177, 3842271208854311), - (4813, 13560062441883314693, 3832691475942146), (4817, 4702636853335131697, 3829508838220791), - (4831, 8923626764698659103, 3818411110269002), (4861, 4770120818895886933, 3794845520203569), - (4871, 11845907506171931319, 3787054829338852), (4877, 9005884281218462661, 3782395750196750), - (4889, 14832102874565810473, 3773111898897433), (4903, 17190123123144797335, 3762338175343575), - (4909, 5264593287281947813, 3757739676860776), (4919, 7211443149775049351, 3750100441900701), - (4931, 13205639136117363051, 3740974259523332), (4933, 8869993298771347341, 3739457545856385), - (4937, 15565958235988250361, 3736427805085993), (4943, 8564693030379004847, 3731892387964707), - (4951, 3968043312159295591, 3725862264938305), (4957, 9638302834558753013, 3721352445775580), - (4967, 16541533743568017495, 3713860292673555), (4969, 10357499691215465689, 3712365480722389), - (4973, 5515847262740016741, 3709379463846682), (4987, 7294361201795716019, 3698966126671255), - (4993, 964270018673781889, 3694521144343991), (4999, 13125638861809336887, 3690086832108331), - (5003, 9487002298951564323, 3687136532822216), (5009, 2938810495272553841, 3682719918887912), - (5011, 17154625301035025051, 3681250064599790), (5021, 14901412858587122357, 3673918357639823), - (5023, 8751461502617929823, 3672455519352887), (5039, 7526593731999769423, 3660794616731405), - (5051, 3031240859469199731, 3652097421047228), (5059, 14629044717082965227, 3646322212632842), - (5077, 14050336681708653949, 3633394538843717), (5081, 10953321564727753833, 3630534161328390), - (5087, 4587208817228736543, 3626252029429831), (5099, 15849222550876945603, 3617717998374103), - (5101, 7395332607476187621, 3616299563558037), (5107, 10818092520219327803, 3612050924948022), - (5113, 14341053724427042377, 3607812257717494), (5119, 4551325994353421311, 3603583526803975), - (5147, 12293050742728533523, 3583979808375665), (5153, 2233799398795800545, 3579806728839423), - (5167, 11445763789493482191, 3570107233154548), (5171, 5586463202364950267, 3567345595379917), - (5179, 3344563175364601075, 3561835117534186), (5189, 16850562133240176269, 3554970914185691), - (5197, 4678239116634440837, 3549498571042823), (5209, 4228337958151123945, 3541321572990891), - (5227, 12210777596142155843, 3529126472873455), (5231, 818131260772436623, 3526427848157054), - (5233, 5062014999015271569, 3525080082879715), (5237, 16544654747797167069, 3522387640578489), - (5261, 7296649765707959877, 3506318964780374), (5273, 10047230984201371561, 3498339479178750), - (5279, 6384201822820108127, 3494363340350360), (5281, 2997028292982919009, 3493039968511560), - (5297, 8566922866023314513, 3482488969928176), (5303, 12933244289280051463, 3478548759892429), - (5309, 6038885138464343701, 3474617455963373), (5323, 4168971091616116963, 3465478879148891), - (5333, 15983949815228171389, 3458980700114298), (5347, 6623854240045322443, 3449924083356938), - (5351, 13155069217954709207, 3447345182902177), (5381, 15004905930240978893, 3428125640904952), - (5387, 14803280978401037987, 3424307420402738), (5393, 17827633990761020401, 3420497695848238), - (5399, 7250229843380564647, 3416696438916382), (5407, 17075264303479989983, 3411641219476521), - (5413, 8267467416002100909, 3407859610882976), (5417, 6194319267136362265, 3405343192488379), - (5419, 9225074080042975619, 3404086376399621), (5431, 9948538647007047815, 3396564918746004), - (5437, 11023261264572803605, 3392816640373285), (5441, 6736570570568071873, 3390322380758969), - (5443, 1633534933589565291, 3389076625704492), (5449, 8693565568230157561, 3385344847441650), - (5471, 7279568717810075295, 3371731689583175), (5477, 14122183293968258157, 3368037990452720), - (5479, 17918155130549778007, 3366808555157793), (5483, 9891195983349641027, 3364352375288993), - (5501, 10026497869549456341, 3353343769080085), (5503, 305043378285947519, 3352125036109313), - (5507, 2599359615253061931, 3349690225841574), (5519, 8001722288903907695, 3342406971137806), - (5521, 12486050100244990833, 3341196173466682), (5527, 15569759562846943783, 3337569038123674), - (5531, 2498031334516082835, 3335155319781151), (5557, 15827618453022699677, 3319550850046707), - (5563, 1369495830027331443, 3315970532753829), (5569, 14359245027748411969, 3312397930276450), - (5573, 15080453256741560589, 3310020468995074), (5581, 13835884374224723717, 3305275770240019), - (5591, 16546310414890610151, 3299363991005106), (5623, 13912972010777557959, 3280587599806073), - (5639, 843990064021469111, 3271279317912670), (5641, 4133431042221037625, 3270119495428036), - (5647, 7993480210442229999, 3266644957271038), (5651, 5957407172981761051, 3264332697524252), - (5653, 3899497464723671357, 3263177794747842), (5657, 3759783616225404457, 3260870439050654), - (5659, 6816070305376687123, 3259717984398224), (5669, 14714442882574456237, 3253967908574625), - (5683, 2054687488766170363, 3245951798998689), (5689, 17999275154361350153, 3242528401073923), - (5693, 14694534406160691477, 3240250144688134), (5701, 11150233306087197837, 3235703222892396), - (5711, 16615312820024852655, 3230037484452731), (5717, 10486604554758797053, 3226647555310399), - (5737, 2205763715280591321, 3215399001866751), (5741, 2609084861148259173, 3213158695995393), - (5743, 346900289040681103, 3212039713339639), (5749, 2717758258902763997, 3208687436721090), - (5779, 4197520065223751579, 3192030467850761), (5783, 10344594679412082983, 3189822596180105), - (5791, 8043175407721743711, 3185416003058116), (5801, 10566890287353359769, 3179924853251086), - (5807, 10819633255563067471, 3176639241210530), (5813, 13007604327909074845, 3173360411785575), - (5821, 1191543681792611477, 3168999153703753), (5827, 819925641855289835, 3165736068939342), - (5839, 14295515830370906159, 3159230017761526), (5843, 14490938781161533787, 3157067272584212), - (5849, 649688712460962153, 3153828701266806), (5851, 1588986329370981715, 3152750653513852), - (5857, 16739703730880359713, 3149520927729136), (5861, 13656444725443737325, 3147371450897381), - (5867, 5499123126797001155, 3144152731158948), (5869, 2618186712114509541, 3143081287052232), - (5879, 15525512787330304711, 3137735001481468), (5881, 9798950601303968585, 3136667926153639), - (5897, 6043600059421206329, 3128157380652798), (5903, 9878054890224613359, 3124977820381086), - (5923, 2229928880090501259, 3114425810182264), (5927, 13031300394233489559, 3112323953721874), - (5939, 8684474899830258683, 3106035371899234), (5953, 167331459764877505, 3098730736386620), - (5981, 1761091935477036277, 3084224055126158), (5987, 4159529731001819723, 3081133134075422), - (6007, 5008596568040665671, 3070874658516655), (6011, 1224463630911680435, 3068831155167118), - (6029, 6296798690279359301, 3059668945713974), (6037, 9414347936243022781, 3055614390211951), - (6043, 12027167243159959187, 3052580518568517), (6047, 9465891658792911967, 3050561282240706), - (6053, 5250906994713622573, 3047537431638782), (6067, 12578569347772608379, 3040505039345566), - (6073, 2019938219828231817, 3037501082448468), (6079, 12930017519012403263, 3034503055388970), - (6089, 13023904216271532665, 3029519473429060), (6091, 3534288349042693603, 3028524720687826), - (6101, 4934451127404358013, 3023560739831101), (6113, 14047046239672495137, 3017625400574112), - (6121, 12365134934558126169, 3013681436645899), (6131, 13226535140764506427, 3008765955587922), - (6133, 12392073305671507037, 3007784782929977), (6143, 9690321199065720831, 3002888502964276), - (6151, 17867940365983012279, 2998982941588286), (6163, 5827650610337903131, 2993143610856652), - (6173, 16486422655865154101, 2988294844274996), (6197, 10207178542641609245, 2976721651397378), - (6199, 14244969169357577607, 2975761263705364), (6203, 16347211377266065651, 2973842346237232), - (6211, 13388813763368645739, 2970011926213097), (6217, 2222392039763302905, 2967145580458348), - (6221, 5610229832415764613, 2965237754976619), (6229, 9361078506501186813, 2961429454761526), - (6247, 17153375432076002135, 2952896442085729), (6257, 17739181571281823889, 2948177093448865), - (6263, 3572712847103574343, 2945352718139797), (6269, 15030462390893027541, 2942533749195972), - (6271, 15458083257430026111, 2941595291613706), (6277, 13198076730130571341, 2938783507043102), - (6287, 11343265880222860911, 2934109125768975), (6299, 12282210612023790995, 2928519459233140), - (6301, 3940536029711642037, 2927589918062141), (6311, 14059394548335120151, 2922951049549921), - (6317, 17115144374863334181, 2920174778171529), (6323, 9411544580387001979, 2917403775693429), - (6329, 17248827844558876041, 2914638027130597), (6337, 14927395235913299777, 2910958509343467), - (6343, 6293355537680509175, 2908204961959569), (6353, 3205604510841389105, 2903627274312852), - (6359, 12865436384164469479, 2900887572528628), (6361, 17086655570240005993, 2899975487141888), - (6367, 14680328603971461919, 2897242669029299), (6373, 10177114728254006509, 2894514996659273), - (6379, 9323138876569931715, 2891792455511765), (6389, 11153509525237125981, 2887266250384966), - (6397, 15969684020666483797, 2883655475021033), (6421, 14505156646653095485, 2872877133423072), - (6427, 10054293525782567187, 2870195125830022), (6449, 12242528242437103569, 2860403794961940), - (6451, 8564253371688126971, 2859516985538606), (6469, 15991550589791801741, 2851560376211091), - (6473, 5639750737196230905, 2849798250225483), (6481, 5610018912094048177, 2846280523639801), - (6491, 9128168535627034323, 2841895559037059), (6521, 8557184607111086281, 2828821357722673), - (6529, 14697497728815605377, 2825355195850750), (6547, 518436063779220635, 2817587303147938), - (6551, 13597821268805285415, 2815866901802709), (6553, 17436156385252092585, 2815007488739440), - (6563, 17465803393879499275, 2810718280315336), (6569, 10626043473118730905, 2808151023551461), - (6571, 18101446627192084739, 2807296313150137), (6577, 7505471665082371921, 2804735300852904), - (6581, 1345454665762131101, 2803030553671106), (6599, 7161775771608406007, 2795384766435755), - (6607, 3696608014770916655, 2792000011156281), (6619, 15353242650259241555, 2786938219324603), - (6637, 8357595213145189349, 2779379851395141), (6653, 1186713732684155733, 2772695637112513), - (6659, 12391092692852203691, 2770197337995127), (6661, 4536220806596043469, 2769365571792456), - (6673, 10526779774117484273, 2764385444883793), (6679, 13467034601498394023, 2761902092185888), - (6689, 17961376013166438881, 2757773071267685), (6691, 8973868175149393291, 2756948748125773), - (6701, 16605097784303240613, 2752834513312871), (6703, 14324228390818770127, 2752013139446449), - (6709, 9246743228481923101, 2749551956134975), (6719, 4530008590805292479, 2745459752003207), - (6733, 3843870776090078853, 2739751087733484), (6737, 5292794462591741617, 2738124398650668), - (6761, 3486901187132200409, 2728404684766979), (6763, 8150062293692760643, 2727597822521004), - (6779, 5891311538513228979, 2721160063978396), (6781, 6999479796734209749, 2720357480269805), - (6791, 11036536765054028599, 2716351652732962), (6793, 12073343758532705209, 2715551902503982), - (6803, 4238168600206971803, 2711560204866904), (6823, 627237963520535831, 2703611911726447), - (6827, 1680661317393780739, 2702027841469100), (6829, 6950281520230586661, 2701236502227200), - (6833, 3018214528670756433, 2699655213480104), (6841, 9284043245984795529, 2696498183556432), - (6857, 14225810509227958137, 2690206223378963), (6863, 14941782064075680815, 2687854301866465), - (6869, 9963229074605100669, 2685506489111886), (6871, 15958004187764455655, 2684724796057277), - (6883, 2355758832019569355, 2680044177496665), (6899, 17246194995713379899, 2673828681505950), - (6907, 17672231871396569139, 2670731732113732), (6911, 16193951135175206143, 2669185946130741), - (6917, 370695016082930125, 2666870619301655), (6947, 6718045560167722123, 2655353976350878), - (6949, 5802933162344089773, 2654589735747525), (6959, 7962928466363485135, 2650775121958550), - (6961, 12534563923092397521, 2650013514395855), (6967, 977012855346465415, 2647731315302074), - (6971, 3191331710356293107, 2646212031804554), (6977, 14766384642635494593, 2643936372898029), - (6983, 2826581148341575287, 2641664624618294), (6991, 16045580133346843567, 2638641692706272), - (6997, 9506782782592059901, 2636379030114270), (7001, 5401489123140205801, 2634872742995222), - (7013, 5523764801766727277, 2630364191317489), (7019, 1952689962496964931, 2628115696496588), - (7027, 4502087104939786683, 2625123676349729), (7039, 9670192588718318719, 2620648398026644), - (7043, 12207904888195402539, 2619160027503840), (7057, 13242341714242962801, 2613964017813454), - (7069, 10281535104033899189, 2609526676150735), (7079, 16080641005630970903, 2605840383346454), - (7103, 17083300368416363583, 2597035629129881), (7109, 12639483806870055693, 2594843729597629), - (7121, 11885081001289063729, 2590471011614878), (7127, 16831651004817344487, 2588290174506742), - (7129, 16953719619995087977, 2587564044565794), (7151, 7261583634106053391, 2579603422417780), - (7159, 5158595004269663687, 2576720781353478), (7177, 17238722656035942969, 2570258335475763), - (7187, 10628630472969424411, 2566682075095248), (7193, 9324671409983029289, 2564541091854518), - (7207, 6974799167595189143, 2559559327557867), (7211, 12552790621230449283, 2558139519305165), - (7213, 5431981756905460645, 2557430205699369), (7219, 9740821223019921147, 2555304623037754), - (7229, 13549897777202617109, 2551769826215182), (7237, 779978400795235981, 2548949022206653), - (7243, 1319261829377543523, 2546837508450856), (7247, 6600304592676813487, 2545431775039264), - (7253, 4702609925863637245, 2543326082132848), (7283, 11559925848195852475, 2532849659990327), - (7297, 1266523061659378561, 2527990143032691), (7307, 7389300657417251619, 2524530460340707), - (7309, 9509827838245668421, 2523839659831652), (7321, 7339894206626953129, 2519702782913475), - (7331, 7936302115465819915, 2516265730965700), (7333, 4512949525192272685, 2515579445480642), - (7349, 8313459841083961757, 2510102609022935), (7351, 7613579311608594695, 2509419680820235), - (7369, 10356110765766917497, 2503290008645616), (7393, 13329163646930396961, 2495163543042006), - (7411, 12017390418009676859, 2489103234881871), (7417, 16529197939041887561, 2487089668829655), - (7433, 16411720511158518073, 2481736051891504), (7451, 4867306247337669907, 2475740715838082), - (7457, 13959363927577175777, 2473748702388299), (7459, 7204097799532903051, 2473085410069654), - (7477, 16714817587184995613, 2467131747185977), (7481, 8879391178910318857, 2465812601752379), - (7487, 8327767459481539263, 2463836526473828), (7489, 2943498353329271489, 2463178538350854), - (7499, 7741285984793166947, 2459893862342919), (7507, 6275873766385266395, 2457272422233855), - (7517, 15651634122937278197, 2454003468632373), (7523, 10828236319221238859, 2452046267939592), - (7529, 4687026353168597721, 2450092186706010), (7537, 14956621073960338321, 2447491584676867), - (7541, 1223096676416228061, 2446193352832456), (7547, 11989039311189260723, 2444248585359686), - (7549, 8528167547654833109, 2443601016520009), (7559, 8011729169729919031, 2440368312436770), - (7561, 7380161463162464441, 2439722797739657), (7573, 10532645104281011645, 2435856869630206), - (7577, 8104686686205503145, 2434570948094173), (7583, 11637771811766648415, 2432644609482995), - (7589, 3417594171516092973, 2430721316867775), (7591, 14242704125413210647, 2430080894968983), - (7603, 2938183226787092859, 2426245439130547), (7607, 6697766153751252999, 2424969642922249), - (7621, 10459044894698723597, 2420514902730553), (7639, 12602900552518673895, 2414811372392924), - (7643, 8312257829367486035, 2413547569502754), (7649, 8303325904795657761, 2411654343536351), - (7669, 1820861294014621277, 2405364985488271), (7673, 17468270877045953609, 2404111048313508), - (7681, 13079152223072805377, 2401607092007492), (7687, 12399418060212989879, 2399732545038318), - (7691, 16966879154521046435, 2398484471942471), (7699, 12504683377151597595, 2395992216354013), - (7703, 16902131594475141543, 2394748029820790), (7717, 12155201971596873133, 2390403534237339), - (7723, 5099546626617880707, 2388546429329218), (7727, 11158286760776296655, 2387309961655176), - (7741, 15213023403508820245, 2382992387767672), (7753, 6999912429363278841, 2379304020857674), - (7757, 9407673012194790021, 2378077101161473), (7759, 4426838183431780527, 2377464115699130), - (7789, 8521168978971237221, 2368307109219354), (7793, 10912291823405752977, 2367091501823373), - (7817, 15223224513176451001, 2359823982820717), (7823, 5647443698905071727, 2358014070524038), - (7829, 13225389511525317821, 2356206932393607), (7841, 3761808924099167585, 2352600953157703), - (7853, 14765851680547337509, 2349005994360060), (7867, 16228538926419703411, 2344825737092862), - (7873, 17809437533883691329, 2343038749359780), (7877, 3187256402731839501, 2341848936614136), - (7879, 15749618908978823927, 2341254483273201), (7883, 13069271299209418467, 2340066481505715), - (7901, 7641588830939294069, 2334735359284843), (7907, 12420698804657854155, 2332963712369995), - (7919, 12818844884155027471, 2329428472497733), (7927, 7937661667140567751, 2327077592242910), - (7933, 17988656517612138069, 2325317543641693), (7937, 12066964247284867329, 2324145656256715), - (7949, 10178314191381317573, 2320637070538376), (7951, 5681810619609444335, 2320053335896057), - (7963, 6180574304741565203, 2316557085735219), (7993, 7117447607071219465, 2307862388803897), - (8009, 15818733711853814521, 2303251850881452), (8011, 6594866437037093475, 2302676828574404), - (8017, 12876135691215997361, 2300953483062186), (8039, 16092426444697734231, 2294656558491050), - (8053, 7540876877021214941, 2290667338098789), (8059, 6493784953110063027, 2288961915089905), - (8069, 14763796409470353741, 2286125179540160), (8081, 12739918163021037937, 2282730364275405), - (8087, 10456272391972868135, 2281036734723575), (8089, 11422888004105716905, 2280472749871374), - (8093, 18241602968231501493, 2279345616422779), (8101, 4561020661602299949, 2277094688767997), - (8111, 16802434375116035919, 2274287273296702), (8117, 16051417197561976477, 2272606144352538), - (8123, 11545395404498259315, 2270927498917832), (8147, 11443457045357563995, 2264237642532165), - (8161, 12755174219819017249, 2260353397097114), (8167, 10672323466178233303, 2258692797074758), - (8171, 17536936478347301059, 2257587085266130), (8179, 16031233265182478651, 2255378906187743), - (8191, 18442239924259250175, 2252074725150720), -]; - -#[allow(dead_code)] -pub const NEXT_PRIME: u64 = 8209; diff --git a/src/factor/sieve.rs b/src/factor/sieve.rs deleted file mode 100644 index 6b389ec39..000000000 --- a/src/factor/sieve.rs +++ /dev/null @@ -1,212 +0,0 @@ -/* -* This file is part of the uutils coreutils package. -* -* (c) kwantam -* -* For the full copyright and license information, please view the LICENSE file -* that was distributed with this source code. -*/ - -use std::iter::{Chain, Cycle, Map}; -use std::slice::Iter; - -/// A lazy Sieve of Eratosthenes. -/// -/// This is a reasonably efficient implementation based on -/// O'Neill, M. E. "[The Genuine Sieve of Eratosthenes.](http://dx.doi.org/10.1017%2FS0956796808007004)" -/// Journal of Functional Programming, Volume 19, Issue 1, 2009, pp. 95--106. -pub struct Sieve { - inner: Wheel, - filts: PrimeHeap, -} - -impl Iterator for Sieve { - type Item = u64; - - #[inline] - fn size_hint(&self) -> (usize, Option) { - self.inner.size_hint() - } - - #[inline] - fn next(&mut self) -> Option { - while let Some(n) = self.inner.next() { - let mut prime = true; - while let Some((next, inc)) = self.filts.peek() { - // need to keep checking the min element of the heap - // until we've found an element that's greater than n - if next > n { - break; // next heap element is bigger than n - } - - if next == n { - // n == next, and is composite. - prime = false; - } - // Increment the element in the prime heap. - self.filts.replace((next + inc, inc)); - } - - if prime { - // this is a prime; add it to the heap - self.filts.insert(n); - return Some(n); - } - } - None - } -} - -impl Sieve { - fn new() -> Sieve { - Sieve { inner: Wheel::new(), filts: PrimeHeap::new() } - } - - #[allow(dead_code)] - #[inline] - pub fn primes() -> PrimeSieve { - fn deref(x: &u64) -> u64 { *x } - let deref = deref as fn(&u64) -> u64; - INIT_PRIMES.iter().map(deref).chain(Sieve::new()) - } - - #[allow(dead_code)] - #[inline] - pub fn odd_primes() -> PrimeSieve { - fn deref(x: &u64) -> u64 { *x } - let deref = deref as fn(&u64) -> u64; - (&INIT_PRIMES[1..]).iter().map(deref).chain(Sieve::new()) - } -} - -pub type PrimeSieve = Chain, fn(&u64) -> u64>, Sieve>; - -/// An iterator that generates an infinite list of numbers that are -/// not divisible by any of 2, 3, 5, or 7. -struct Wheel { - next: u64, - increment: Cycle>, -} - -impl Iterator for Wheel { - type Item = u64; - - #[inline] - fn size_hint(&self) -> (usize, Option) { - (1, None) - } - - #[inline] - fn next (&mut self) -> Option { - let increment = self.increment.next().unwrap(); // infinite iterator, no check necessary - let ret = self.next; - self.next = ret + increment; - Some(ret) - } -} - -impl Wheel { - #[inline] - fn new() -> Wheel { - Wheel { next: 11u64, increment: WHEEL_INCS.iter().cycle() } - } -} - -/// The increments of a wheel of circumference 210 -/// (i.e., a wheel that skips all multiples of 2, 3, 5, 7) -const WHEEL_INCS: &'static [u64] = &[2,4,2,4,6,2,6,4,2,4,6,6,2,6,4,2,6,4,6,8,4,2,4,2,4,8,6,4,6,2,4,6,2,6,6,4,2,4,6,2,6,4,2,4,2,10,2,10]; -const INIT_PRIMES: &'static [u64] = &[2, 3, 5, 7]; - -/// A min-heap of "infinite lists" of prime multiples, where a list is -/// represented as (head, increment). -#[derive(Debug)] -struct PrimeHeap { - data: Vec<(u64, u64)>, -} - -impl PrimeHeap { - fn new() -> PrimeHeap { - PrimeHeap { data: Vec::new() } - } - - fn peek(&self) -> Option<(u64, u64)> { - if let Some(&(x, y)) = self.data.get(0) { - Some((x, y)) - } else { - None - } - } - - fn insert(&mut self, next: u64) { - let mut idx = self.data.len(); - let key = next * next; - - let item = (key, next); - self.data.push(item); - loop { - // break if we've bubbled to the top - if idx == 0 { - break; - } - - let paridx = (idx - 1) / 2; - let (k, _) = self.data[paridx]; - if key < k { - // bubble up, found a smaller key - self.data.swap(idx, paridx); - idx = paridx; - } else { - // otherwise, parent is smaller, so we're done - break; - } - } - } - - fn remove(&mut self) -> (u64, u64) { - let ret = self.data.swap_remove(0); - - let mut idx = 0; - let len = self.data.len(); - let (key, _) = self.data[0]; - loop { - let child1 = 2*idx + 1; - let child2 = 2*idx + 2; - - // no more children - if child1 >= len { - break; - } - - // find lesser child - let (c1key, _) = self.data[child1]; - let (minidx, minkey) = if child2 >= len { - (child1, c1key) - } else { - let (c2key, _) = self.data[child2]; - if c1key < c2key { - (child1, c1key) - } else { - (child2, c2key) - } - }; - - if minkey < key { - self.data.swap(minidx, idx); - idx = minidx; - continue; - } - - // smaller than both children, so done - break; - } - - ret - } - - /// More efficient than inserting and removing in two steps - /// because we save one traversal of the heap. - fn replace(&mut self, next: (u64, u64)) -> (u64, u64) { - self.data.push(next); - self.remove() - } -} diff --git a/src/false/Cargo.toml b/src/false/Cargo.toml deleted file mode 100644 index e101245ec..000000000 --- a/src/false/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "false" -version = "0.0.1" -authors = [] - -[lib] -name = "false" -path = "false.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/false/false.rs b/src/false/false.rs deleted file mode 100644 index bd19e7dea..000000000 --- a/src/false/false.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![crate_name = "false"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -pub fn uumain(_: Vec) -> i32 { - 1 -} diff --git a/src/fmt/Cargo.toml b/src/fmt/Cargo.toml deleted file mode 100644 index 3c3f3fa93..000000000 --- a/src/fmt/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "fmt" -version = "0.0.1" -authors = [] - -[lib] -name = "fmt" -path = "fmt.rs" - -[dependencies] -getopts = "*" -libc = "*" -unicode-width = "*" diff --git a/src/fmt/deps.mk b/src/fmt/deps.mk deleted file mode 100644 index fb8005c0c..000000000 --- a/src/fmt/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += unicode-width diff --git a/src/fmt/fmt.rs b/src/fmt/fmt.rs deleted file mode 100644 index 9d2b2df2e..000000000 --- a/src/fmt/fmt.rs +++ /dev/null @@ -1,221 +0,0 @@ -#![crate_name = "fmt"] -#![feature(iter_cmp, str_char, unicode)] - -/* - * This file is part of `fmt` from the uutils coreutils package. - * - * (c) kwantam - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate rustc_unicode; -extern crate unicode_width; - -use std::cmp; -use std::io::{Read, BufReader, BufWriter}; -use std::fs::File; -use std::io::{stdin, stdout, Write}; -use linebreak::break_lines; -use parasplit::ParagraphStream; - -macro_rules! silent_unwrap( - ($exp:expr) => ( - match $exp { - Ok(_) => (), - Err(_) => ::std::process::exit(1), - } - ) -); - -#[path = "../common/util.rs"] -#[macro_use] -mod util; -mod linebreak; -mod parasplit; - -// program's NAME and VERSION are used for -V and -h -static NAME: &'static str = "fmt"; -static VERSION: &'static str = "0.0.3"; - -pub type FileOrStdReader = BufReader>; -pub struct FmtOptions { - crown : bool, - tagged : bool, - mail : bool, - split_only : bool, - use_prefix : bool, - prefix : String, - xprefix : bool, - use_anti_prefix : bool, - anti_prefix : String, - xanti_prefix : bool, - uniform : bool, - quick : bool, - width : usize, - goal : usize, - tabwidth : usize, -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("c", "crown-margin", "First and second line of paragraph may have different indentations, in which case the first line's indentation is preserved, and each subsequent line's indentation matches the second line."); - opts.optflag("t", "tagged-paragraph", "Like -c, except that the first and second line of a paragraph *must* have different indentation or they are treated as separate paragraphs."); - opts.optflag("m", "preserve-headers", "Attempt to detect and preserve mail headers in the input. Be careful when combining this flag with -p."); - opts.optflag("s", "split-only", "Split lines only, do not reflow."); - opts.optflag("u", "uniform-spacing", "Insert exactly one space between words, and two between sentences. Sentence breaks in the input are detected as [?!.] followed by two spaces or a newline; other punctuation is not interpreted as a sentence break."); - - opts.optopt("p", "prefix", "Reformat only lines beginning with PREFIX, reattaching PREFIX to reformatted lines. Unless -x is specified, leading whitespace will be ignored when matching PREFIX.", "PREFIX"); - opts.optopt("P", "skip-prefix", "Do not reformat lines beginning with PSKIP. Unless -X is specified, leading whitespace will be ignored when matching PSKIP", "PSKIP"); - - opts.optflag("x", "exact-prefix", "PREFIX must match at the beginning of the line with no preceding whitespace."); - opts.optflag("X", "exact-skip-prefix", "PSKIP must match at the beginning of the line with no preceding whitespace."); - - opts.optopt("w", "width", "Fill output lines up to a maximum of WIDTH columns, default 79.", "WIDTH"); - opts.optopt("g", "goal", "Goal width, default ~0.94*WIDTH. Must be less than WIDTH.", "GOAL"); - - opts.optflag("q", "quick", "Break lines more quickly at the expense of a potentially more ragged appearance."); - - opts.optopt("T", "tab-width", "Treat tabs as TABWIDTH spaces for determining line length, default 8. Note that this is used only for calculating line lengths; tabs are preserved in the output.", "TABWIDTH"); - - opts.optflag("V", "version", "Output version information and exit."); - opts.optflag("h", "help", "Display this help message and exit."); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}\nTry `{} --help' for more information.", f, NAME) - }; - - if matches.opt_present("h") { - println!("Usage: {} [OPTION]... [FILE]...\n\n{}", NAME, opts.usage("Reformat paragraphs from input files (or stdin) to stdout.")); - } - - if matches.opt_present("V") || matches.opt_present("h") { - println!("{} {}", NAME, VERSION); - return 0 - } - - let mut fmt_opts = FmtOptions { - crown : false, - tagged : false, - mail : false, - uniform : false, - quick : false, - split_only : false, - use_prefix : false, - prefix : String::new(), - xprefix : false, - use_anti_prefix : false, - anti_prefix : String::new(), - xanti_prefix : false, - width : 79, - goal : 74, - tabwidth : 8, - }; - - if matches.opt_present("t") { fmt_opts.tagged = true; } - if matches.opt_present("c") { fmt_opts.crown = true; fmt_opts.tagged = false; } - if matches.opt_present("m") { fmt_opts.mail = true; } - if matches.opt_present("u") { fmt_opts.uniform = true; } - if matches.opt_present("q") { fmt_opts.quick = true; } - if matches.opt_present("s") { fmt_opts.split_only = true; fmt_opts.crown = false; fmt_opts.tagged = false; } - if matches.opt_present("x") { fmt_opts.xprefix = true; } - if matches.opt_present("X") { fmt_opts.xanti_prefix = true; } - - match matches.opt_str("p") { - Some(s) => { - fmt_opts.prefix = s; - fmt_opts.use_prefix = true; - } - None => () - }; - - match matches.opt_str("P") { - Some(s) => { - fmt_opts.anti_prefix = s; - fmt_opts.use_anti_prefix = true; - } - None => () - }; - - match matches.opt_str("w") { - Some(s) => { - fmt_opts.width = - match s.parse::() { - Ok(t) => t, - Err(e) => { crash!(1, "Invalid WIDTH specification: `{}': {}", s, e); } - }; - fmt_opts.goal = cmp::min(fmt_opts.width * 94 / 100, fmt_opts.width - 3); - } - None => () - }; - - match matches.opt_str("g") { - Some(s) => { - fmt_opts.goal = - match s.parse::() { - Ok(t) => t, - Err(e) => { crash!(1, "Invalid GOAL specification: `{}': {}", s, e); } - }; - if !matches.opt_present("w") { - fmt_opts.width = cmp::max(fmt_opts.goal * 100 / 94, fmt_opts.goal + 3); - } else if fmt_opts.goal > fmt_opts.width { - crash!(1, "GOAL cannot be greater than WIDTH."); - } - } - None => () - }; - - match matches.opt_str("T") { - Some(s) => { - fmt_opts.tabwidth = - match s.parse::() { - Ok(t) => t, - Err(e) => { crash!(1, "Invalid TABWIDTH specification: `{}': {}", s, e); } - }; - } - None => () - }; - - if fmt_opts.tabwidth < 1 { - fmt_opts.tabwidth = 1; - } - - // immutable now - let fmt_opts = fmt_opts; - - let mut files = matches.free; - if files.is_empty() { - files.push("-".to_string()); - } - - let mut ostream = BufWriter::new(stdout()); - - for i in files.iter().map(|x| &x[..]) { - let mut fp = match i { - "-" => BufReader::new(Box::new(stdin()) as Box), - _ => match File::open(i) { - Ok(f) => BufReader::new(Box::new(f) as Box), - Err(e) => { - show_warning!("{}: {}", i, e); - continue; - }, - }, - }; - let p_stream = ParagraphStream::new(&fmt_opts, &mut fp); - for para_result in p_stream { - match para_result { - Err(s) => silent_unwrap!(ostream.write_all(s.as_bytes())), - Ok(para) => break_lines(¶, &fmt_opts, &mut ostream) - } - } - - // flush the output after each file - silent_unwrap!(ostream.flush()); - } - - 0 -} diff --git a/src/fmt/linebreak.rs b/src/fmt/linebreak.rs deleted file mode 100644 index c4394baf9..000000000 --- a/src/fmt/linebreak.rs +++ /dev/null @@ -1,452 +0,0 @@ -/* - * This file is part of `fmt` from the uutils coreutils package. - * - * (c) kwantam - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use FmtOptions; -use parasplit::{Paragraph, ParaWords, WordInfo}; -use std::io::{Write, BufWriter, Stdout}; -use std::i64; -use std::cmp; -use std::mem; - -struct BreakArgs<'a> { - opts : &'a FmtOptions, - init_len : usize, - indent_str : &'a str, - indent_len : usize, - uniform : bool, - ostream : &'a mut BufWriter -} - -impl<'a> BreakArgs<'a> { - #[inline(always)] - fn compute_width<'b>(&self, winfo: &WordInfo<'b>, posn: usize, fresh: bool) -> usize { - if fresh { - 0 - } else { - let post = winfo.after_tab; - match winfo.before_tab { - None => post, - Some(pre) => post + ((pre + posn) / self.opts.tabwidth + 1) * self.opts.tabwidth - posn - } - } - } -} - -pub fn break_lines(para: &Paragraph, opts: &FmtOptions, ostream: &mut BufWriter) { - // indent - let p_indent = ¶.indent_str[..]; - let p_indent_len = para.indent_len; - - // words - let p_words = ParaWords::new(opts, para); - let mut p_words_words = p_words.words(); - - // the first word will *always* appear on the first line - // make sure of this here - let (w, w_len) = match p_words_words.next() { - Some(winfo) => (winfo.word, winfo.word_nchars), - None => { - silent_unwrap!(ostream.write_all("\n".as_bytes())); - return; - } - }; - // print the init, if it exists, and get its length - let p_init_len = w_len + - if opts.crown || opts.tagged { - // handle "init" portion - silent_unwrap!(ostream.write_all(para.init_str.as_bytes())); - para.init_len - } else if !para.mail_header { - // for non-(crown, tagged) that's the same as a normal indent - silent_unwrap!(ostream.write_all(p_indent.as_bytes())); - p_indent_len - } else { - // except that mail headers get no indent at all - 0 - }; - // write first word after writing init - silent_unwrap!(ostream.write_all(w.as_bytes())); - - // does this paragraph require uniform spacing? - let uniform = para.mail_header || opts.uniform; - - let mut break_args = BreakArgs { - opts : opts, - init_len : p_init_len, - indent_str : &p_indent[..], - indent_len : p_indent_len, - uniform : uniform, - ostream : ostream - }; - - if opts.quick || para.mail_header { - break_simple(p_words_words, &mut break_args); - } else { - break_knuth_plass(p_words_words, &mut break_args); - } -} - -// break_simple implements a "greedy" breaking algorithm: print words until -// maxlength would be exceeded, then print a linebreak and indent and continue. -fn break_simple<'a, T: Iterator>>(iter: T, args: &mut BreakArgs<'a>) { - iter.fold((args.init_len, false), |l, winfo| accum_words_simple(args, l, winfo)); - silent_unwrap!(args.ostream.write_all("\n".as_bytes())); -} - -#[inline(always)] -fn accum_words_simple<'a>(args: &mut BreakArgs<'a>, (l, prev_punct): (usize, bool), winfo: &'a WordInfo<'a>) -> (usize, bool) { - // compute the length of this word, considering how tabs will expand at this position on the line - let wlen = winfo.word_nchars + args.compute_width(winfo, l, false); - - let slen = compute_slen(args.uniform, winfo.new_line, winfo.sentence_start, prev_punct); - - if l + wlen + slen > args.opts.width { - write_newline(args.indent_str, args.ostream); - write_with_spaces(&winfo.word[winfo.word_start..], 0, args.ostream); - (args.indent_len + winfo.word_nchars, winfo.ends_punct) - } else { - write_with_spaces(winfo.word, slen, args.ostream); - (l + wlen + slen, winfo.ends_punct) - } -} - -// break_knuth_plass implements an "optimal" breaking algorithm in the style of -// Knuth, D.E., and Plass, M.F. "Breaking Paragraphs into Lines." in Software, -// Practice and Experience. Vol. 11, No. 11, November 1981. -// http://onlinelibrary.wiley.com/doi/10.1002/spe.4380111102/pdf -fn break_knuth_plass<'a, T: Clone + Iterator>>(mut iter: T, args: &mut BreakArgs<'a>) { - // run the algorithm to get the breakpoints - let breakpoints = find_kp_breakpoints(iter.clone(), args); - - // iterate through the breakpoints (note that breakpoints is in reverse break order, so we .rev() it - let (mut prev_punct, mut fresh) = - breakpoints.iter().rev().fold((false, false), |(mut prev_punct, mut fresh), &(next_break, break_before)| { - if fresh { - write_newline(args.indent_str, args.ostream); - } - // at each breakpoint, keep emitting words until we find the word matching this breakpoint - for winfo in &mut iter { - let (slen, word) = slice_if_fresh(fresh, winfo.word, winfo.word_start, args.uniform, - winfo.new_line, winfo.sentence_start, prev_punct); - fresh = false; - prev_punct = winfo.ends_punct; - - // We find identical breakpoints here by comparing addresses of the references. - // This is OK because the backing vector is not mutating once we are linebreaking. - let winfo_ptr = winfo as *const _; - let next_break_ptr = next_break as *const _; - if winfo_ptr == next_break_ptr { - // OK, we found the matching word - if break_before { - write_newline(args.indent_str, args.ostream); - write_with_spaces(&winfo.word[winfo.word_start..], 0, args.ostream); - } else { - // breaking after this word, so that means "fresh" is true for the next iteration - write_with_spaces(word, slen, args.ostream); - fresh = true; - } - break; - } else { - write_with_spaces(word, slen, args.ostream); - } - } - (prev_punct, fresh) - }); - - // after the last linebreak, write out the rest of the final line. - for winfo in iter { - if fresh { - write_newline(args.indent_str, args.ostream); - } - let (slen, word) = slice_if_fresh(fresh, winfo.word, winfo.word_start, args.uniform, - winfo.new_line, winfo.sentence_start, prev_punct); - prev_punct = winfo.ends_punct; - fresh = false; - write_with_spaces(word, slen, args.ostream); - } - silent_unwrap!(args.ostream.write_all("\n".as_bytes())); -} - -struct LineBreak<'a> { - prev : usize, - linebreak : Option<&'a WordInfo<'a>>, - break_before : bool, - demerits : i64, - prev_rat : f32, - length : usize, - fresh : bool -} - -fn find_kp_breakpoints<'a, T: Iterator>>(iter: T, args: &BreakArgs<'a>) -> Vec<(&'a WordInfo<'a>, bool)> { - let mut iter = iter.peekable(); - // set up the initial null linebreak - let mut linebreaks = vec!(LineBreak { - prev : 0, - linebreak : None, - break_before : false, - demerits : 0, - prev_rat : 0.0f32, - length : args.init_len, - fresh : false - }); - // this vec holds the current active linebreaks; next_ holds the breaks that will be active for the next word - let active_breaks = &mut vec!(0); - let next_active_breaks = &mut vec!(); - - let stretch = (args.opts.width - args.opts.goal) as isize; - let minlength = args.opts.goal - stretch as usize; - let mut new_linebreaks = vec!(); - let mut is_sentence_start = false; - let mut least_demerits = 0; - loop { - let w = - match iter.next() { - None => break, - Some(w) => w - }; - - // if this is the last word, we don't add additional demerits for this break - let (is_last_word, is_sentence_end) = - match iter.peek() { - None => (true, true), - Some(&&WordInfo { sentence_start: st, new_line: nl, .. }) => (false, st || (nl && w.ends_punct)) - }; - - // should we be adding extra space at the beginning of the next sentence? - let slen = compute_slen(args.uniform, w.new_line, is_sentence_start, false); - - let mut ld_new = i64::MAX; - let mut ld_next = i64::MAX; - let mut ld_idx = 0; - new_linebreaks.clear(); - next_active_breaks.clear(); - // go through each active break, extending it and possibly adding a new active - // break if we are above the minimum required length - for &i in active_breaks.iter() { - let active = &mut linebreaks[i]; - // normalize demerits to avoid overflow, and record if this is the least - active.demerits -= least_demerits; - if active.demerits < ld_next { - ld_next = active.demerits; - ld_idx = i; - } - - // get the new length - let tlen = w.word_nchars + args.compute_width(w, active.length, active.fresh) + slen + active.length; - - // if tlen is longer than args.opts.width, we drop this break from the active list - // otherwise, we extend the break, and possibly add a new break at this point - if tlen <= args.opts.width { - // this break will still be active next time - next_active_breaks.push(i); - // we can put this word on this line - active.fresh = false; - active.length = tlen; - - // if we're above the minlength, we can also consider breaking here - if tlen >= minlength { - let (new_demerits, new_ratio) = - if is_last_word { - // there is no penalty for the final line's length - (0, 0.0) - } else { - compute_demerits((args.opts.goal - tlen) as isize, stretch, w.word_nchars as isize, active.prev_rat) - }; - - // do not even consider adding a line that has too many demerits - // also, try to detect overflow by checking signum - let total_demerits = new_demerits + active.demerits; - if new_demerits < BAD_INFTY_SQ && total_demerits < ld_new && active.demerits.signum() <= new_demerits.signum() { - ld_new = total_demerits; - new_linebreaks.push(LineBreak { - prev : i, - linebreak : Some(w), - break_before : false, - demerits : total_demerits, - prev_rat : new_ratio, - length : args.indent_len, - fresh : true - }); - } - } - } - } - - // if we generated any new linebreaks, add the last one to the list - // the last one is always the best because we don't add to new_linebreaks unless - // it's better than the best one so far - match new_linebreaks.pop() { - None => (), - Some(lb) => { - next_active_breaks.push(linebreaks.len()); - linebreaks.push(lb); - } - } - - if next_active_breaks.is_empty() { - // every potential linebreak is too long! choose the linebreak with the least demerits, ld_idx - let new_break = restart_active_breaks(args, &linebreaks[ld_idx], ld_idx, w, slen, minlength); - next_active_breaks.push(linebreaks.len()); - linebreaks.push(new_break); - least_demerits = 0; - } else { - // next time around, normalize out the demerits fields - // on active linebreaks to make overflow less likely - least_demerits = cmp::max(ld_next, 0); - } - // swap in new list of active breaks - mem::swap(active_breaks, next_active_breaks); - // If this was the last word in a sentence, the next one must be the first in the next. - is_sentence_start = is_sentence_end; - } - - // return the best path - build_best_path(&linebreaks, active_breaks) -} - -#[inline(always)] -fn build_best_path<'a>(paths: &Vec>, active: &Vec) -> Vec<(&'a WordInfo<'a>, bool)> { - let mut breakwords = vec!(); - // of the active paths, we select the one with the fewest demerits - let mut best_idx = match active.iter().min_by(|&&a| paths[a].demerits) { - None => crash!(1, "Failed to find a k-p linebreak solution. This should never happen."), - Some(&s) => s - }; - - // now, chase the pointers back through the break list, recording - // the words at which we should break - loop { - let ref next_best = paths[best_idx]; - match next_best.linebreak { - None => return breakwords, - Some(prev) => { - breakwords.push((prev, next_best.break_before)); - best_idx = next_best.prev - } - } - } -} - -// "infinite" badness is more like (1+BAD_INFTY)^2 because of how demerits are computed -const BAD_INFTY: i64 = 10000000; -const BAD_INFTY_SQ: i64 = BAD_INFTY * BAD_INFTY; -// badness = BAD_MULT * abs(r) ^ 3 -const BAD_MULT: f32 = 100.0; -// DR_MULT is multiplier for delta-R between lines -const DR_MULT: f32 = 600.0; -// DL_MULT is penalty multiplier for short words at end of line -const DL_MULT: f32 = 300.0; - -#[inline(always)] -fn compute_demerits(delta_len: isize, stretch: isize, wlen: isize, prev_rat: f32) -> (i64, f32) { - // how much stretch are we using? - let ratio = - if delta_len == 0 { - 0.0f32 - } else { - delta_len as f32 / stretch as f32 - }; - - // compute badness given the stretch ratio - let bad_linelen = - if ratio.abs() > 1.0f32 { - BAD_INFTY - } else { - (BAD_MULT * ratio.powf(3f32).abs()) as i64 - }; - - // we penalize lines ending in really short words - let bad_wordlen = - if wlen >= stretch { - 0 - } else { - (DL_MULT * ((stretch - wlen) as f32 / (stretch - 1) as f32).powf(3f32).abs()) as i64 - }; - - // we penalize lines that have very different ratios from previous lines - let bad_delta_r = (DR_MULT * (((ratio - prev_rat) / 2.0).powf(3f32)).abs()) as i64; - - let demerits = i64::pow(1 + bad_linelen + bad_wordlen + bad_delta_r, 2); - - (demerits, ratio) -} - -#[inline(always)] -fn restart_active_breaks<'a>(args: &BreakArgs<'a>, active: &LineBreak<'a>, act_idx: usize, w: &'a WordInfo<'a>, slen: usize, min: usize) -> LineBreak<'a> { - let (break_before, line_length) = - if active.fresh { - // never break before a word if that word would be the first on a line - (false, args.indent_len) - } else { - // choose the lesser evil: breaking too early, or breaking too late - let wlen = w.word_nchars + args.compute_width(w, active.length, active.fresh); - let underlen = (min - active.length) as isize; - let overlen = ((wlen + slen + active.length) - args.opts.width) as isize; - if overlen > underlen { - // break early, put this word on the next line - (true, args.indent_len + w.word_nchars) - } else { - (false, args.indent_len) - } - }; - - // restart the linebreak. This will be our only active path. - LineBreak { - prev : act_idx, - linebreak : Some(w), - break_before : break_before, - demerits : 0, // this is the only active break, so we can reset the demerit count - prev_rat : if break_before { 1.0 } else { -1.0 }, - length : line_length, - fresh : !break_before - } -} - -// Number of spaces to add before a word, based on mode, newline, sentence start. -#[inline(always)] -fn compute_slen(uniform: bool, newline: bool, start: bool, punct: bool) -> usize { - if uniform || newline { - if start || (newline && punct) { - 2 - } else { - 1 - } - } else { - 0 - } -} - -// If we're on a fresh line, slen=0 and we slice off leading whitespace. -// Otherwise, compute slen and leave whitespace alone. -#[inline(always)] -fn slice_if_fresh<'a>(fresh: bool, word: &'a str, start: usize, uniform: bool, newline: bool, sstart: bool, punct: bool) -> (usize, &'a str) { - if fresh { - (0, &word[start..]) - } else { - (compute_slen(uniform, newline, sstart, punct), word) - } -} - -// Write a newline and add the indent. -#[inline(always)] -fn write_newline(indent: &str, ostream: &mut BufWriter) { - silent_unwrap!(ostream.write_all("\n".as_bytes())); - silent_unwrap!(ostream.write_all(indent.as_bytes())); -} - -// Write the word, along with slen spaces. -#[inline(always)] -fn write_with_spaces(word: &str, slen: usize, ostream: &mut BufWriter) { - if slen == 2 { - silent_unwrap!(ostream.write_all(" ".as_bytes())); - } else if slen == 1 { - silent_unwrap!(ostream.write_all(" ".as_bytes())); - } - silent_unwrap!(ostream.write_all(word.as_bytes())); -} diff --git a/src/fmt/parasplit.rs b/src/fmt/parasplit.rs deleted file mode 100644 index 01627f24a..000000000 --- a/src/fmt/parasplit.rs +++ /dev/null @@ -1,570 +0,0 @@ -/* - * This file is part of `fmt` from the uutils coreutils package. - * - * (c) kwantam - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use std::iter::Peekable; -use std::io::{BufRead, Lines}; -use std::slice::Iter; -use std::str::CharRange; -use unicode_width::UnicodeWidthChar; -use FileOrStdReader; -use FmtOptions; - -#[inline(always)] -fn char_width(c: char) -> usize { - if (c as usize) < 0xA0 { - // if it is ASCII, call it exactly 1 wide (including control chars) - // calling control chars' widths 1 is consistent with OpenBSD fmt - 1 - } else { - // otherwise, get the unicode width - // note that we shouldn't actually get None here because only c < 0xA0 - // can return None, but for safety and future-proofing we do it this way - UnicodeWidthChar::width(c).unwrap_or(1) - } -} - -// lines with PSKIP, lacking PREFIX, or which are entirely blank are -// NoFormatLines; otherwise, they are FormatLines -#[derive(Debug)] -pub enum Line { - FormatLine(FileLine), - NoFormatLine(String, bool) -} - -impl Line { - // when we know that it's a FormatLine, as in the ParagraphStream iterator - fn get_formatline(self) -> FileLine { - match self { - Line::FormatLine(fl) => fl, - Line::NoFormatLine(..) => panic!("Found NoFormatLine when expecting FormatLine") - } - } - - // when we know that it's a NoFormatLine, as in the ParagraphStream iterator - fn get_noformatline(self) -> (String, bool) { - match self { - Line::NoFormatLine(s, b) => (s, b), - Line::FormatLine(..) => panic!("Found FormatLine when expecting NoFormatLine") - } - } -} - -// each line's prefix has to be considered to know whether to merge it with -// the next line or not -#[derive(Debug)] -struct FileLine { - line : String, - indent_end : usize, // the end of the indent, always the start of the text - pfxind_end : usize, // the end of the PREFIX's indent, that is, the spaces before the prefix - indent_len : usize, // display length of indent taking into account tabs - prefix_len : usize, // PREFIX indent length taking into account tabs -} - -// iterator that produces a stream of Lines from a file -pub struct FileLines<'a> { - opts : &'a FmtOptions, - lines : Lines<&'a mut FileOrStdReader>, -} - -impl<'a> FileLines<'a> { - fn new<'b>(opts: &'b FmtOptions, lines: Lines<&'b mut FileOrStdReader>) -> FileLines<'b> { - FileLines { opts: opts, lines: lines } - } - - // returns true if this line should be formatted - fn match_prefix(&self, line: &str) -> (bool, usize) { - if !self.opts.use_prefix { return (true, 0); } - - FileLines::match_prefix_generic(&self.opts.prefix[..], line, self.opts.xprefix) - } - - // returns true if this line should be formatted - fn match_anti_prefix(&self, line: &str) -> bool { - if !self.opts.use_anti_prefix { return true; } - - match FileLines::match_prefix_generic(&self.opts.anti_prefix[..], line, self.opts.xanti_prefix) { - (true, _) => false, - (_ , _) => true - } - } - - fn match_prefix_generic(pfx: &str, line: &str, exact: bool) -> (bool, usize) { - if line.starts_with(pfx) { - return (true, 0); - } - - if !exact { - // we do it this way rather than byte indexing to support unicode whitespace chars - let mut i = 0; - while (i < line.len()) && line.char_at(i).is_whitespace() { - i = match line.char_range_at(i) { CharRange { ch: _ , next: nxi } => nxi }; - if line[i..].starts_with(pfx) { - return (true, i); - } - } - } - - (false, 0) - } - - fn compute_indent(&self, string: &str, prefix_end: usize) -> (usize, usize, usize) { - let mut prefix_len = 0; - let mut indent_len = 0; - let mut indent_end = 0; - for (os, c) in string.char_indices() { - if os == prefix_end { - // we found the end of the prefix, so this is the printed length of the prefix here - prefix_len = indent_len; - } - - if (os >= prefix_end) && !c.is_whitespace() { - // found first non-whitespace after prefix, this is indent_end - indent_end = os; - break; - } else if c == '\t' { - // compute tab length - indent_len = (indent_len / self.opts.tabwidth + 1) * self.opts.tabwidth; - } else { - // non-tab character - indent_len += char_width(c); - } - } - (indent_end, prefix_len, indent_len) - } -} - -impl<'a> Iterator for FileLines<'a> { - type Item = Line; - - fn next(&mut self) -> Option { - let n = - match self.lines.next() { - Some(t) => match t { - Ok(tt) => tt, - Err(_) => return None - }, - None => return None - }; - - // if this line is entirely whitespace, - // emit a blank line - // Err(true) indicates that this was a linebreak, - // which is important to know when detecting mail headers - if n.chars().all(|c| c.is_whitespace()) { - return Some(Line::NoFormatLine("\n".to_string(), true)); - } - - // if this line does not match the prefix, - // emit the line unprocessed and iterate again - let (pmatch, poffset) = self.match_prefix(&n[..]); - if !pmatch { - return Some(Line::NoFormatLine(n, false)); - } else if n[poffset + self.opts.prefix.len()..].chars().all(|c| c.is_whitespace()) { - // if the line matches the prefix, but is blank after, - // don't allow lines to be combined through it (that is, - // treat it like a blank line, except that since it's - // not truly blank we will not allow mail headers on the - // following line) - return Some(Line::NoFormatLine(n, false)); - } - - // skip if this line matches the anti_prefix - // (NOTE definition of match_anti_prefix is TRUE if we should process) - if !self.match_anti_prefix(&n[..]) { - return Some(Line::NoFormatLine(n, false)); - } - - // figure out the indent, prefix, and prefixindent ending points - let prefix_end = poffset + self.opts.prefix.len(); - let (indent_end, prefix_len, indent_len) = self.compute_indent(&n[..], prefix_end); - - Some(Line::FormatLine(FileLine { - line : n, - indent_end : indent_end, - pfxind_end : poffset, - indent_len : indent_len, - prefix_len : prefix_len - })) - } -} - -// a paragraph : a collection of FileLines that are to be formatted -// plus info about the paragraph's indentation -// (but we only retain the String from the FileLine; the other info -// is only there to help us in deciding how to merge lines into Paragraphs -#[derive(Debug)] -pub struct Paragraph { - lines : Vec, // the lines of the file - pub init_str : String, // string representing the init, that is, the first line's indent - pub init_len : usize, // printable length of the init string considering TABWIDTH - init_end : usize, // byte location of end of init in first line String - pub indent_str : String, // string representing indent - pub indent_len : usize, // length of above - indent_end : usize, // byte location of end of indent (in crown and tagged mode, only applies to 2nd line and onward) - pub mail_header : bool // we need to know if this is a mail header because we do word splitting differently in that case -} - -// an iterator producing a stream of paragraphs from a stream of lines -// given a set of options. -pub struct ParagraphStream<'a> { - lines : Peekable>, - next_mail : bool, - opts : &'a FmtOptions, -} - -impl<'a> ParagraphStream<'a> { - pub fn new<'b>(opts: &'b FmtOptions, reader: &'b mut FileOrStdReader) -> ParagraphStream<'b> { - let lines = FileLines::new(opts, reader.lines()).peekable(); - // at the beginning of the file, we might find mail headers - ParagraphStream { lines: lines, next_mail: true, opts: opts } - } - - // detect RFC822 mail header - fn is_mail_header(line: &FileLine) -> bool { - // a mail header begins with either "From " (envelope sender line) - // or with a sequence of printable ASCII chars (33 to 126, inclusive, - // except colon) followed by a colon. - if line.indent_end > 0 { - false - } else { - let l_slice = &line.line[..]; - if l_slice.starts_with("From ") { - true - } else { - let colon_posn = - match l_slice.find(':') { - Some(n) => n, - None => return false - }; - - // header field must be nonzero length - if colon_posn == 0 { return false; } - - return l_slice[..colon_posn].chars().all(|x| match x as usize { - y if y < 33 || y > 126 => false, - _ => true - }); - } - } - } -} - -impl<'a> Iterator for ParagraphStream<'a> { - type Item = Result; - - fn next(&mut self) -> Option> { - // return a NoFormatLine in an Err; it should immediately be output - let noformat = - match self.lines.peek() { - None => return None, - Some(l) => match l { - &Line::FormatLine(_) => false, - &Line::NoFormatLine(_, _) => true - } - }; - - // found a NoFormatLine, immediately dump it out - if noformat { - let (s, nm) = self.lines.next().unwrap().get_noformatline(); - self.next_mail = nm; - return Some(Err(s)); - } - - // found a FormatLine, now build a paragraph - let mut init_str = String::new(); - let mut init_end = 0; - let mut init_len = 0; - let mut indent_str = String::new(); - let mut indent_end = 0; - let mut indent_len = 0; - let mut prefix_len = 0; - let mut pfxind_end = 0; - let mut p_lines = Vec::new(); - - let mut in_mail = false; - let mut second_done = false; // for when we use crown or tagged mode - loop { - { // peek ahead - // need to explicitly force fl out of scope before we can call self.lines.next() - let fl = - match self.lines.peek() { - None => break, - Some(l) => { - match l { - &Line::FormatLine(ref x) => x, - &Line::NoFormatLine(..) => break - } - } - }; - - if p_lines.len() == 0 { - // first time through the loop, get things set up - // detect mail header - if self.opts.mail && self.next_mail && ParagraphStream::is_mail_header(fl) { - in_mail = true; - // there can't be any indent or pfxind because otherwise is_mail_header would fail - // since there cannot be any whitespace before the colon in a valid header field - indent_str.push_str(" "); - indent_len = 2; - } else { - if self.opts.crown || self.opts.tagged { - init_str.push_str(&fl.line[..fl.indent_end]); - init_len = fl.indent_len; - init_end = fl.indent_end; - } else { - second_done = true; - } - - // these will be overwritten in the 2nd line of crown or tagged mode, but - // we are not guaranteed to get to the 2nd line, e.g., if the next line - // is a NoFormatLine or None. Thus, we set sane defaults the 1st time around - indent_str.push_str(&fl.line[..fl.indent_end]); - indent_len = fl.indent_len; - indent_end = fl.indent_end; - - // save these to check for matching lines - prefix_len = fl.prefix_len; - pfxind_end = fl.pfxind_end; - - // in tagged mode, add 4 spaces of additional indenting by default - // (gnu fmt's behavior is different: it seems to find the closest column to - // indent_end that is divisible by 3. But honesly that behavior seems - // pretty arbitrary. - // Perhaps a better default would be 1 TABWIDTH? But ugh that's so big. - if self.opts.tagged { - indent_str.push_str(" "); - indent_len += 4; - } - } - } else if in_mail { - // lines following mail headers must begin with spaces - if fl.indent_end == 0 || (self.opts.use_prefix && fl.pfxind_end == 0) { - break; // this line does not begin with spaces - } - } else if !second_done { - // now we have enough info to handle crown margin and tagged mode - if prefix_len != fl.prefix_len || pfxind_end != fl.pfxind_end { - // in both crown and tagged modes we require that prefix_len is the same - break; - } else if self.opts.tagged && indent_len - 4 == fl.indent_len && indent_end == fl.indent_end { - // in tagged mode, indent has to be *different* on following lines - break; - } else { - // this is part of the same paragraph, get the indent info from this line - indent_str.clear(); - indent_str.push_str(&fl.line[..fl.indent_end]); - indent_len = fl.indent_len; - indent_end = fl.indent_end; - } - second_done = true; - } else { - // detect mismatch - if indent_end != fl.indent_end || pfxind_end != fl.pfxind_end || indent_len != fl.indent_len || prefix_len != fl.prefix_len { - break; - } - } - } - - p_lines.push(self.lines.next().unwrap().get_formatline().line); - - // when we're in split-only mode, we never join lines, so stop here - if self.opts.split_only { - break; - } - } - - // if this was a mail header, then the next line can be detected as one. Otherwise, it cannot. - // NOTE next_mail is true at ParagraphStream instantiation, and is set to true after a blank - // NoFormatLine. - self.next_mail = in_mail; - - Some(Ok(Paragraph { - lines : p_lines, - init_str : init_str, - init_len : init_len, - init_end : init_end, - indent_str : indent_str, - indent_len : indent_len, - indent_end : indent_end, - mail_header : in_mail - })) - } -} - -pub struct ParaWords<'a> { - opts : &'a FmtOptions, - para : &'a Paragraph, - words : Vec> -} - -impl<'a> ParaWords<'a> { - pub fn new<'b>(opts: &'b FmtOptions, para: &'b Paragraph) -> ParaWords<'b> { - let mut pw = ParaWords { opts: opts, para: para, words: Vec::new() }; - pw.create_words(); - pw - } - - fn create_words<'r>(&'r mut self) { - if self.para.mail_header { - // no extra spacing for mail headers; always exactly 1 space - // safe to trim_left on every line of a mail header, since the - // first line is guaranteed not to have any spaces - self.words.extend(self.para.lines.iter().flat_map(|x| x.split_whitespace()).map(|x| WordInfo { - word : x, - word_start : 0, - word_nchars : x.len(), // OK for mail headers; only ASCII allowed (unicode is escaped) - before_tab : None, - after_tab : 0, - sentence_start : false, - ends_punct : false, - new_line : false - })); - } else { - // first line - self.words.extend( - if self.opts.crown || self.opts.tagged { - // crown and tagged mode has the "init" in the first line, so slice from there - WordSplit::new(self.opts, &self.para.lines[0][self.para.init_end..]) - } else { - // otherwise we slice from the indent - WordSplit::new(self.opts, &self.para.lines[0][self.para.indent_end..]) - }); - - if self.para.lines.len() > 1 { - let indent_end = self.para.indent_end; - let opts = self.opts; - self.words.extend( - self.para.lines.iter().skip(1).flat_map(|x| WordSplit::new(opts, &x[indent_end..]))); - } - } - } - - pub fn words(&'a self) -> Iter<'a, WordInfo<'a>> { return self.words.iter() } -} - -struct WordSplit<'a> { - opts : &'a FmtOptions, - string : &'a str, - length : usize, - position : usize, - prev_punct : bool -} - -impl<'a> WordSplit<'a> { - fn analyze_tabs(&self, string: &str) -> (Option, usize, Option) { - // given a string, determine (length before tab) and (printed length after first tab) - // if there are no tabs, beforetab = -1 and aftertab is the printed length - let mut beforetab = None; - let mut aftertab = 0; - let mut word_start = None; - for (os, c) in string.char_indices() { - if !c.is_whitespace() { - word_start = Some(os); - break; - } else if c == '\t' { - if beforetab == None { - beforetab = Some(aftertab); - aftertab = 0; - } else { - aftertab = (aftertab / self.opts.tabwidth + 1) * self.opts.tabwidth; - } - } else { - aftertab += 1; - } - } - (beforetab, aftertab, word_start) - } -} - -impl<'a> WordSplit<'a> { - fn new<'b>(opts: &'b FmtOptions, string: &'b str) -> WordSplit<'b> { - // wordsplits *must* start at a non-whitespace character - let trim_string = string.trim_left(); - WordSplit { opts: opts, string: trim_string, length: string.len(), position: 0, prev_punct: false } - } - - fn is_punctuation(c: char) -> bool { - match c { - '!' | '.' | '?' => true, - _ => false - } - } -} - -pub struct WordInfo<'a> { - pub word : &'a str, - pub word_start : usize, - pub word_nchars : usize, - pub before_tab : Option, - pub after_tab : usize, - pub sentence_start : bool, - pub ends_punct : bool, - pub new_line : bool -} - -// returns (&str, is_start_of_sentence) -impl<'a> Iterator for WordSplit<'a> { - type Item = WordInfo<'a>; - - fn next(&mut self) -> Option> { - if self.position >= self.length { - return None - } - - let old_position = self.position; - let new_line = old_position == 0; - - // find the start of the next word, and record if we find a tab character - let (before_tab, after_tab, word_start) = match self.analyze_tabs(&self.string[old_position..]) { - (b, a, Some(s)) => (b, a, s + old_position), - (_, _, None) => { - self.position = self.length; - return None; - } - }; - - // find the beginning of the next whitespace - // note that this preserves the invariant that self.position - // points to whitespace character OR end of string - let mut word_nchars = 0; - self.position = - match self.string[word_start..] - .find(|x: char| if !x.is_whitespace() { word_nchars += char_width(x); false } else { true }) { - None => self.length, - Some(s) => s + word_start - }; - - let word_start_relative = word_start - old_position; - // if the previous sentence was punctuation and this sentence has >2 whitespace or one tab, is a new sentence. - let is_start_of_sentence = self.prev_punct && (before_tab.is_some() || word_start_relative > 1); - - // now record whether this word ends in punctuation - self.prev_punct = match self.string.char_range_at_reverse(self.position) { - CharRange { ch, next: _ } => WordSplit::is_punctuation(ch) - }; - - let (word, word_start_relative, before_tab, after_tab) = - if self.opts.uniform { - (&self.string[word_start..self.position], 0, None, 0) - } else { - (&self.string[old_position..self.position], word_start_relative, before_tab, after_tab) - }; - - Some(WordInfo { - word : word, - word_start : word_start_relative, - word_nchars : word_nchars, - before_tab : before_tab, - after_tab : after_tab, - sentence_start : is_start_of_sentence, - ends_punct : self.prev_punct, - new_line : new_line - }) - } -} diff --git a/src/fold/Cargo.toml b/src/fold/Cargo.toml deleted file mode 100644 index 54bb67150..000000000 --- a/src/fold/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "fold" -version = "0.0.1" -authors = [] - -[lib] -name = "fold" -path = "fold.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/fold/fold.rs b/src/fold/fold.rs deleted file mode 100644 index 5b8da31cd..000000000 --- a/src/fold/fold.rs +++ /dev/null @@ -1,222 +0,0 @@ -#![crate_name = "fold"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Arcterus - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::fs::File; -use std::io::{BufRead, BufReader, Read, stdin, Write}; -use std::path::Path; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "fold"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let (args, obs_width) = handle_obsolete(&args[..]); - let mut opts = getopts::Options::new(); - - opts.optflag("b", "bytes", "count using bytes rather than columns (meaning control characters such as newline are not treated specially)"); - opts.optflag("s", "spaces", "break lines at word boundaries rather than a hard cut-off"); - opts.optopt("w", "width", "set WIDTH as the maximum line width rather than 80", "WIDTH"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f) - }; - - if matches.opt_present("h") { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {} [OPTION]... [FILE]...", NAME); - println!(""); - print!("{}", opts.usage("Writes each file (or standard input if no files are given) to standard output whilst breaking long lines")); - } else if matches.opt_present("V") { - println!("{} {}", NAME, VERSION); - } else { - let bytes = matches.opt_present("b"); - let spaces = matches.opt_present("s"); - let poss_width = - if matches.opt_present("w") { - matches.opt_str("w") - } else { - match obs_width { - Some(v) => Some(v.to_string()), - None => None, - } - }; - let width = match poss_width { - Some(inp_width) => match inp_width.parse::() { - Ok(width) => width, - Err(e) => crash!(1, "illegal width value (\"{}\"): {}", inp_width, e) - }, - None => 80 - }; - let files = if matches.free.is_empty() { - vec!("-".to_string()) - } else { - matches.free - }; - fold(files, bytes, spaces, width); - } - - 0 -} - -fn handle_obsolete(args: &[String]) -> (Vec, Option) { - for (i, arg) in args.iter().enumerate() { - let slice = &arg; - if slice.chars().next().unwrap() == '-' && slice.len() > 1 && slice.chars().nth(1).unwrap().is_digit(10) { - let mut v = args.to_vec(); - v.remove(i); - return (v, Some(slice[1..].to_string())); - } - } - (args.to_vec(), None) -} - -#[inline] -fn fold(filenames: Vec, bytes: bool, spaces: bool, width: usize) { - for filename in filenames.iter() { - let filename: &str = &filename; - let mut stdin_buf; - let mut file_buf; - let buffer = BufReader::new( - if filename == "-" { - stdin_buf = stdin(); - &mut stdin_buf as &mut Read - } else { - file_buf = safe_unwrap!(File::open(Path::new(filename))); - &mut file_buf as &mut Read - } - ); - fold_file(buffer, bytes, spaces, width); - } -} - -#[inline] -fn fold_file(mut file: BufReader, bytes: bool, spaces: bool, width: usize) { - let mut line = String::new(); - while safe_unwrap!(file.read_line(&mut line)) > 0 { - if bytes { - let len = line.len(); - let mut i = 0; - while i < len { - let width = if len - i >= width { width } else { len - i }; - let slice = { - let slice = &line[i..i + width]; - if spaces && i + width < len { - match slice.rfind(|ch: char| ch.is_whitespace()) { - Some(m) => &slice[..m + 1], - None => slice - } - } else { - slice - } - }; - print!("{}", slice); - i += slice.len(); - } - } else { - let mut len = line.chars().count(); - let newline = line.ends_with("\n"); - if newline { - if len == 1 { - println!(""); - continue; - } - len -= 1; - line.truncate(len); - } - let mut output = String::new(); - let mut count = 0; - for (i, ch) in line.chars().enumerate() { - if count >= width { - let (val, ncount) = { - let slice = &output[..]; - let (out, val, ncount) = - if spaces && i + 1 < len { - match rfind_whitespace(slice) { - Some(m) => { - let routput = &slice[m + 1 .. slice.chars().count()]; - let ncount = routput.chars().fold(0, |out, ch: char| { - out + match ch { - '\t' => 8, - '\x08' => if out > 0 { !0 } else { 0 }, - '\r' => return 0, - _ => 1 - } - }); - (&slice[0 .. m + 1], routput, ncount) - }, - None => (slice, "", 0) - } - } else { - (slice, "", 0) - }; - println!("{}", out); - (val.to_string(), ncount) - }; - output = val; - count = ncount; - } - match ch { - '\t' => { - count += 8; - if count > width { - println!("{}", output); - output.truncate(0); - count = 8; - } - } - '\x08' => { - if count > 0 { - count -= 1; - let len = output.len() - 1; - output.truncate(len); - } - continue; - } - '\r' => { - output.truncate(0); - count = 0; - continue; - } - _ => count += 1 - }; - output.push(ch); - } - if count > 0 { - if newline { - println!("{}", output); - } else { - print!("{}", output); - } - } - } - } -} - -#[inline] -fn rfind_whitespace(slice: &str) -> Option { - for (i, ch) in slice.chars().rev().enumerate() { - if ch.is_whitespace() { - return Some(slice.chars().count() - (i + 1)); - } - } - None -} diff --git a/src/groups/Cargo.toml b/src/groups/Cargo.toml deleted file mode 100644 index ad8f0c86d..000000000 --- a/src/groups/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "groups" -version = "0.0.1" -authors = [] - -[lib] -name = "groups" -path = "groups.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/groups/groups.rs b/src/groups/groups.rs deleted file mode 100644 index 167905111..000000000 --- a/src/groups/groups.rs +++ /dev/null @@ -1,52 +0,0 @@ -#![crate_name = "groups"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Alan Andrade - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - */ -extern crate getopts; - -use c_types::{get_pw_from_args, group}; -use std::io::Write; - -#[path = "../common/util.rs"] #[macro_use] mod util; -#[path = "../common/c_types.rs"] mod c_types; - -static NAME: &'static str = "groups"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - opts.optflag("h", "help", "display this help menu and exit"); - opts.optflag("V", "version", "display version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => { m }, - Err(f) => { - show_error!("{}", f); - return 1; - } - }; - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: - {0} [OPTION]... [USER]... - -Prints the groups a user is in to standard output.", NAME, VERSION); - - print!("{}", opts.usage(&msg)); - } else { - group(get_pw_from_args(&matches.free), true); - } - - 0 -} diff --git a/src/hashsum/Cargo.toml b/src/hashsum/Cargo.toml deleted file mode 100644 index 78111a679..000000000 --- a/src/hashsum/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "hashsum" -version = "0.0.1" -authors = [] - -[lib] -name = "hashsum" -path = "hashsum.rs" - -[dependencies] -getopts = "*" -libc = "*" -regex = "*" -regex-syntax = "*" -rust-crypto = "*" diff --git a/src/hashsum/deps.mk b/src/hashsum/deps.mk deleted file mode 100644 index 83178fa58..000000000 --- a/src/hashsum/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += regex regex-syntax crypto rand rustc-serialize time winapi kernel32 diff --git a/src/hashsum/hashsum.rs b/src/hashsum/hashsum.rs deleted file mode 100644 index a47aa1ca1..000000000 --- a/src/hashsum/hashsum.rs +++ /dev/null @@ -1,309 +0,0 @@ -#![crate_name = "hashsum"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Arcterus - * (c) Vsevolod Velichko - * (c) Gil Cottle - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate crypto; -extern crate getopts; -extern crate regex_syntax; -extern crate regex; - -use crypto::digest::Digest; -use crypto::md5::Md5; -use crypto::sha1::Sha1; -use crypto::sha2::{Sha224, Sha256, Sha384, Sha512}; -use regex::Regex; -use std::ascii::AsciiExt; -use std::fs::File; -use std::io::{self, BufRead, BufReader, Read, stdin, Write}; -use std::path::Path; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "hashsum"; -static VERSION: &'static str = "1.0.0"; - -fn is_custom_binary(program: &str) -> bool { - match program { - "md5sum" | "sha1sum" - | "sha224sum" | "sha256sum" - | "sha384sum" | "sha512sum" => true, - _ => false - } -} - -fn detect_algo(program: &str, matches: &getopts::Matches) -> (&'static str, Box) { - let mut alg: Option> = None; - let mut name: &'static str = ""; - match program { - "md5sum" => ("MD5", Box::new(Md5::new()) as Box), - "sha1sum" => ("SHA1", Box::new(Sha1::new()) as Box), - "sha224sum" => ("SHA224", Box::new(Sha224::new()) as Box), - "sha256sum" => ("SHA256", Box::new(Sha256::new()) as Box), - "sha384sum" => ("SHA384", Box::new(Sha384::new()) as Box), - "sha512sum" => ("SHA512", Box::new(Sha512::new()) as Box), - _ => { - { - let mut set_or_crash = |n, val| -> () { - if alg.is_some() { crash!(1, "You cannot combine multiple hash algorithms!") }; - name = n; - alg = Some(val); - }; - if matches.opt_present("md5") { set_or_crash("MD5", Box::new(Md5::new())) }; - if matches.opt_present("sha1") { set_or_crash("SHA1", Box::new(Sha1::new())) }; - if matches.opt_present("sha224") { set_or_crash("SHA224", Box::new(Sha224::new())) }; - if matches.opt_present("sha256") { set_or_crash("SHA256", Box::new(Sha256::new())) }; - if matches.opt_present("sha384") { set_or_crash("SHA384", Box::new(Sha384::new())) }; - if matches.opt_present("sha512") { set_or_crash("SHA512", Box::new(Sha512::new())) }; - } - if alg.is_none() { crash!(1, "You must specify hash algorithm!") }; - (name, alg.unwrap()) - } - } -} - -pub fn uumain(args: Vec) -> i32 { - let program = &args[0]; - let binary_name = Path::new(program).file_name().unwrap().to_str().unwrap(); - - // Default binary in Windows, text mode otherwise - let binary_flag_default = cfg!(windows); - - let mut opts = getopts::Options::new(); - opts.optflag("b", "binary", &format!("read in binary mode{}", if binary_flag_default { " (default)" } else { "" })); - opts.optflag("c", "check", "read hashsums from the FILEs and check them"); - opts.optflag("", "tag", "create a BSD-style checksum"); - opts.optflag("t", "text", &format!("read in text mode{}", if binary_flag_default { "" } else { " (default)" })); - opts.optflag("q", "quiet", "don't print OK for each successfully verified file"); - opts.optflag("s", "status", "don't output anything, status code shows success"); - opts.optflag("", "strict", "exit non-zero for improperly formatted checksum lines"); - opts.optflag("w", "warn", "warn about improperly formatted checksum lines"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - if !is_custom_binary(program) { - opts.optflag("", "md5", "work with MD5"); - opts.optflag("", "sha1", "work with SHA1"); - opts.optflag("", "sha224", "work with SHA224"); - opts.optflag("", "sha256", "work with SHA256"); - opts.optflag("", "sha384", "work with SHA384"); - opts.optflag("", "sha512", "work with SHA512"); - } - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f) - }; - - if matches.opt_present("help") { - usage(program, binary_name, &opts); - } else if matches.opt_present("version") { - version(); - } else { - let (name, algo) = detect_algo(binary_name, &matches); - - let binary_flag = matches.opt_present("binary"); - let text_flag = matches.opt_present("text"); - if binary_flag && text_flag { - crash!(1, "cannot set binary and text mode at the same time"); - } - let binary = if binary_flag { true } else if text_flag { false } else { binary_flag_default }; - let check = matches.opt_present("check"); - let tag = matches.opt_present("tag"); - let status = matches.opt_present("status"); - let quiet = matches.opt_present("quiet") || status; - let strict = matches.opt_present("strict"); - let warn = matches.opt_present("warn") && !status; - let files = if matches.free.is_empty() { - vec!("-".to_string()) - } else { - matches.free - }; - match hashsum(name, algo, files, binary, check, tag, status, quiet, strict, warn) { - Ok(()) => return 0, - Err(e) => return e - } - } - - 0 -} - -fn version() { - pipe_println!("{} {}", NAME, VERSION); -} - -fn usage(program: &str, binary_name: &str, opts: &getopts::Options) { - let spec = if is_custom_binary(binary_name) { - format!(" {} [OPTION]... [FILE]...", program) - } else { - format!(" {} {{--md5|--sha1|--sha224|--sha256|--sha384|--sha512}} [OPTION]... [FILE]...", program) - }; - - let msg = format!("{} {} - -Usage: -{} - -Compute and check message digests.", NAME, VERSION, spec); - - pipe_print!("{}", opts.usage(&msg)); -} - -fn hashsum<'a>(algoname: &str, mut digest: Box, files: Vec, binary: bool, check: bool, tag: bool, status: bool, quiet: bool, strict: bool, warn: bool) -> Result<(), i32> { - let mut bad_format = 0; - let mut failed = 0; - let binary_marker = if binary { - "*" - } else { - " " - }; - for filename in files.iter() { - let filename: &str = filename; - let stdin_buf; - let file_buf; - let mut file = BufReader::new( - if filename == "-" { - stdin_buf = stdin(); - Box::new(stdin_buf) as Box - } else { - file_buf = safe_unwrap!(File::open(filename)); - Box::new(file_buf) as Box - } - ); - if check { - // Set up Regexes for line validation and parsing - let bytes = digest.output_bits() / 4; - let gnu_re = safe_unwrap!( - Regex::new( - &format!( - r"^(?P[a-fA-F0-9]{{{}}}) (?P[ \*])(?P.*)", - bytes - ) - ) - ); - let bsd_re = safe_unwrap!( - Regex::new( - &format!( - r"^{algorithm} \((?P.*)\) = (?P[a-fA-F0-9]{{{digest_size}}})", - algorithm = algoname, - digest_size = bytes - ) - ) - ); - - let buffer = file; - for (i, line) in buffer.lines().enumerate() { - let line = safe_unwrap!(line); - let (ck_filename, sum, binary_check) = match gnu_re.captures(&line) { - Some(caps) => (caps.name("fileName").unwrap(), - caps.name("digest").unwrap().to_ascii_lowercase(), - caps.name("binary").unwrap() == "*"), - None => match bsd_re.captures(&line) { - Some(caps) => (caps.name("fileName").unwrap(), - caps.name("digest").unwrap().to_ascii_lowercase(), - true), - None => { - bad_format += 1; - if strict { - return Err(1); - } - if warn { - show_warning!("{}: {}: improperly formatted {} checksum line", filename, i + 1, algoname); - } - continue; - } - } - }; - let f = safe_unwrap!(File::open(ck_filename)); - let mut ckf = BufReader::new(Box::new(f) as Box); - let real_sum = safe_unwrap!(digest_reader(&mut digest, &mut ckf, binary_check)) - .to_ascii_lowercase(); - if sum == real_sum { - if !quiet { - pipe_println!("{}: OK", ck_filename); - } - } else { - if !status { - pipe_println!("{}: FAILED", ck_filename); - } - failed += 1; - } - } - } else { - let sum = safe_unwrap!(digest_reader(&mut digest, &mut file, binary)); - if tag { - pipe_println!("{} ({}) = {}", algoname, filename, sum); - } else { - pipe_println!("{} {}{}", sum, binary_marker, filename); - } - } - } - if !status { - if bad_format == 1 { - show_warning!("{} line is improperly formatted", bad_format); - } else if bad_format > 1 { - show_warning!("{} lines are improperly formatted", bad_format); - } - if failed > 0 { - show_warning!("{} computed checksum did NOT match", failed); - } - } - - Ok(()) -} - -fn digest_reader<'a, T: Read>(digest: &mut Box, reader: &mut BufReader, binary: bool) -> io::Result { - digest.reset(); - - // Digest file, do not hold too much in memory at any given moment - let windows = cfg!(windows); - let mut buffer = Vec::with_capacity(524288); - let mut vec = Vec::with_capacity(524288); - let mut looking_for_newline = false; - loop { - match reader.read_to_end(&mut buffer) { - Ok(0) => { break; }, - Ok(nread) => { - if windows && !binary { - // Windows text mode returns '\n' when reading '\r\n' - for i in 0 .. nread { - if looking_for_newline { - if buffer[i] != ('\n' as u8) { - vec.push('\r' as u8); - } - if buffer[i] != ('\r' as u8) { - vec.push(buffer[i]); - looking_for_newline = false; - } - } else if buffer[i] != ('\r' as u8) { - vec.push(buffer[i]); - } else { - looking_for_newline = true; - } - } - digest.input(&vec); - vec.clear(); - } else { - digest.input(&buffer[..nread]); - } - }, - Err(e) => return Err(e) - } - } - if windows && looking_for_newline { - vec.push('\r' as u8); - digest.input(&vec); - } - - Ok(digest.result_str()) -} diff --git a/src/head/Cargo.toml b/src/head/Cargo.toml deleted file mode 100644 index 42341acc1..000000000 --- a/src/head/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "head" -version = "0.0.1" -authors = [] - -[lib] -name = "head" -path = "head.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/head/head.rs b/src/head/head.rs deleted file mode 100644 index 17790c969..000000000 --- a/src/head/head.rs +++ /dev/null @@ -1,210 +0,0 @@ -#![crate_name = "head"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Alan Andrade - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * Synced with: https://raw.github.com/avsm/src/master/usr.bin/head/head.c - */ - -extern crate getopts; - -use std::io::{BufRead, BufReader, Read, stdin, Write}; -use std::fs::File; -use std::path::Path; -use std::str::from_utf8; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "head"; -static VERSION: &'static str = "1.0.0"; - -enum FilterMode { - Bytes(usize), - Lines(usize), -} - -struct Settings { - mode: FilterMode, - verbose: bool, -} - -impl Default for Settings { - fn default() -> Settings { - Settings { - mode: FilterMode::Lines(10), - verbose: false, - } - } -} - -pub fn uumain(args: Vec) -> i32 { - let mut settings: Settings = Default::default(); - - // handle obsolete -number syntax - let options = match obsolete(&args[1..]) { - (args, Some(n)) => { settings.mode = FilterMode::Lines(n); args }, - (args, None) => args - }; - - let args = options; - - let mut opts = getopts::Options::new(); - - opts.optopt("c", "bytes", "Print the first K bytes. With the leading '-', print all but the last K bytes", "[-]K"); - opts.optopt("n", "lines", "Print the first K lines. With the leading '-', print all but the last K lines", "[-]K"); - opts.optflag("q", "quiet", "never print headers giving file names"); - opts.optflag("v", "verbose", "always print headers giving file names"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args) { - Ok (m) => { m } - Err(_) => { - println!("{}", opts.usage("")); - return 1; - } - }; - - if matches.opt_present("h") { - println!("{}", opts.usage("")); - return 0; - } - if matches.opt_present("V") { version(); return 0 } - - let use_bytes = matches.opt_present("c"); - - // TODO: suffixes (e.g. b, kB, etc.) - match matches.opt_str("n") { - Some(n) => { - if use_bytes { - show_error!("cannot specify both --bytes and --lines."); - return 1; - } - match n.parse::() { - Ok(m) => { settings.mode = FilterMode::Lines(m) } - Err(e) => { - show_error!("invalid line count '{}': {}", n, e); - return 1; - } - } - } - None => match matches.opt_str("c") { - Some(count) => match count.parse::() { - Ok(m) => settings.mode = FilterMode::Bytes(m), - Err(e)=> { - show_error!("invalid byte count '{}': {}", count, e); - return 1; - } - }, - None => {} - } - }; - - let quiet = matches.opt_present("q"); - let verbose = matches.opt_present("v"); - let files = matches.free; - - // GNU implementation allows multiple declarations of "-q" and "-v" with the - // last flag winning. This can't be simulated with the getopts cargo unless - // we manually parse the arguments. Given the declaration of both flags, - // verbose mode always wins. This is a potential future improvement. - if files.len() > 1 && !quiet && !verbose { - settings.verbose = true; - } - if quiet { - settings.verbose = false; - } - if verbose { - settings.verbose = true; - } - - if files.is_empty() { - let mut buffer = BufReader::new(stdin()); - head(&mut buffer, &settings); - } else { - let mut firstime = true; - - for file in files.iter() { - if settings.verbose { - if !firstime { pipe_println!(""); } - pipe_println!("==> {} <==", file); - } - firstime = false; - - let path = Path::new(file); - let reader = File::open(&path).unwrap(); - let mut buffer = BufReader::new(reader); - if !head(&mut buffer, &settings) { - break; - } - } - } - - 0 -} - -// It searches for an option in the form of -123123 -// -// In case is found, the options vector will get rid of that object so that -// getopts works correctly. -fn obsolete(options: &[String]) -> (Vec, Option) { - let mut options: Vec = options.to_vec(); - let mut a = 0; - let b = options.len(); - - while a < b { - let current = options[a].clone(); - let current = current.as_bytes(); - - if current.len() > 1 && current[0] == '-' as u8 { - let len = current.len(); - for pos in 1 .. len { - // Ensure that the argument is only made out of digits - if !(current[pos] as char).is_numeric() { break; } - - // If this is the last number - if pos == len - 1 { - options.remove(a); - let number: Option = from_utf8(¤t[1..len]).unwrap().parse::().ok(); - return (options, Some(number.unwrap())); - } - } - } - - a += 1; - }; - - (options, None) -} - -// TODO: handle errors on read -fn head(reader: &mut BufReader, settings: &Settings) -> bool { - match settings.mode { - FilterMode::Bytes(count) => { - for byte in reader.bytes().take(count) { - if !pipe_print!("{}", byte.unwrap() as char) { - return false; - } - } - }, - FilterMode::Lines(count) => { - for line in reader.lines().take(count) { - if !pipe_println!("{}", line.unwrap()) { - return false; - } - } - } - } - true -} - -fn version() { - println!("{} {}", NAME, VERSION); -} diff --git a/src/hostid/Cargo.toml b/src/hostid/Cargo.toml deleted file mode 100644 index 146c0879e..000000000 --- a/src/hostid/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "hostid" -version = "0.0.1" -authors = [] - -[lib] -name = "hostid" -path = "hostid.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/hostid/hostid.rs b/src/hostid/hostid.rs deleted file mode 100644 index 9cca3d7c5..000000000 --- a/src/hostid/hostid.rs +++ /dev/null @@ -1,90 +0,0 @@ -#![crate_name = "hostid"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Maciej Dziardziel - * - * For the full copyright and license information, please view the LICENSE file - * that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use libc::c_long; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "hostid"; -static VERSION: &'static str = "0.0.1"; - -static EXIT_ERR: i32 = 1; - -pub enum Mode { - HostId, - Help, - Version, -} - -// currently rust libc interface doesn't include gethostid -extern { - pub fn gethostid() -> c_long; -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(_) => { - help(&opts); - return EXIT_ERR; - }, - }; - - let mode = if matches.opt_present("version") { - Mode::Version - } else if matches.opt_present("help") { - Mode::Help - } else { - Mode::HostId - }; - - match mode { - Mode::HostId => hostid(), - Mode::Help => help(&opts), - Mode::Version => version(), - } - - 0 -} - -fn version() { - println!("{} {}", NAME, VERSION); -} - -fn help(opts: &getopts::Options) { - let msg = format!("Usage:\n {} [options]", NAME); - print!("{}", opts.usage(&msg)); -} - -fn hostid() { - /* - * POSIX says gethostid returns a "32-bit identifier" but is silent - * whether it's sign-extended. Turn off any sign-extension. This - * is a no-op unless unsigned int is wider than 32 bits. - */ - - let mut result:c_long; - unsafe { - result = gethostid(); - } - - result &= 0xffffffff; - println!("{:0>8x}", result); -} diff --git a/src/hostname/Cargo.toml b/src/hostname/Cargo.toml deleted file mode 100644 index 2d2db8ee1..000000000 --- a/src/hostname/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "hostname" -version = "0.0.1" -authors = [] - -[lib] -name = "hostname" -path = "hostname.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/hostname/hostname.rs b/src/hostname/hostname.rs deleted file mode 100644 index d22a8d9e3..000000000 --- a/src/hostname/hostname.rs +++ /dev/null @@ -1,176 +0,0 @@ -#![crate_name = "hostname"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Alan Andrade - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * Synced with: - * - * https://www.opensource.apple.com/source/shell_cmds/shell_cmds-170/hostname/hostname.c?txt - */ - -extern crate getopts; -extern crate libc; - -use std::collections::hash_set::HashSet; -use std::iter::repeat; -use std::str; -use std::io::Write; -use std::net::ToSocketAddrs; -use getopts::Options; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "hostname"; - -extern { - fn gethostname(name: *mut libc::c_char, namelen: libc::size_t) -> libc::c_int; -} - -#[cfg(any(target_os = "macos", target_os = "freebsd"))] -extern { - fn sethostname(name: *const libc::c_char, namelen: libc::c_int) -> libc::c_int; -} - -#[cfg(target_os = "linux")] -extern { - fn sethostname(name: *const libc::c_char, namelen: libc::size_t) -> libc::c_int; -} - -pub fn uumain(args: Vec) -> i32 { - let program = &args[0]; - - let mut opts = Options::new(); - opts.optflag("d", "domain", "Display the name of the DNS domain if possible"); - opts.optflag("i", "ip-address", "Display the network address(es) of the host"); - opts.optflag("f", "fqdn", "Display the FQDN (Fully Qualified Domain Name) (default)"); // TODO: support --long - opts.optflag("s", "short", "Display the short hostname (the portion before the first dot) if possible"); - opts.optflag("h", "help", "Show help"); - opts.optflag("V", "version", "Show program's version"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => { m } - _ => { help_menu(program, opts); return 0; } - }; - - if matches.opt_present("h") { - help_menu(program, opts); - return 0 - } - if matches.opt_present("V") { version(); return 0 } - - match matches.free.len() { - 0 => { - let hostname = xgethostname(); - - if matches.opt_present("i") { - match hostname.to_socket_addrs() { - Ok(addresses) => { - let mut hashset = HashSet::new(); - let mut output = String::new(); - for addr in addresses { - // XXX: not sure why this is necessary... - if !hashset.contains(&addr) { - output.push_str(&format!("{}", addr)); - output.push_str(" "); - hashset.insert(addr.clone()); - } - } - let len = output.len(); - if len > 0 { - println!("{}", &output[0 .. len - 1]); - } - } - Err(f) => { - show_error!("{}", f); - return 1; - } - } - } else { - if matches.opt_present("s") { - let mut it = hostname.char_indices().filter(|&ci| ci.1 == '.'); - let ci = it.next(); - if ci.is_some() { - println!("{}", &hostname[0 .. ci.unwrap().0]); - return 0; - } - } else if matches.opt_present("d") { - let mut it = hostname.char_indices().filter(|&ci| ci.1 == '.'); - let ci = it.next(); - if ci.is_some() { - println!("{}", &hostname[ci.unwrap().0 + 1 .. ]); - return 0; - } - } - - println!("{}", hostname); - } - } - 1 => xsethostname(matches.free.last().unwrap()), - _ => help_menu(program, opts) - }; - - 0 -} - -fn version() { - println!("hostname 1.0.0"); -} - -fn help_menu(program: &str, options: Options) { - version(); - println!(""); - println!("Usage:"); - println!(" {} [OPTION]... [HOSTNAME]", program); - println!(""); - print!("{}", options.usage("Print or set the system's host name.")); -} - -fn xgethostname() -> String { - let namelen = 256usize; - let mut name : Vec = repeat(0).take(namelen).collect(); - let err = unsafe { - gethostname (name.as_mut_ptr() as *mut libc::c_char, - namelen as libc::size_t) - }; - - if err != 0 { - panic!("Cannot determine hostname"); - } - - let last_char = name.iter().position(|byte| *byte == 0).unwrap_or(namelen); - - str::from_utf8(&name[..last_char]).unwrap().to_string() -} - -#[cfg(any(target_os = "macos", target_os = "freebsd"))] -fn xsethostname(name: &str) { - let vec_name: Vec = name.bytes().map(|c| c as libc::c_char).collect(); - - let err = unsafe { - sethostname (vec_name.as_ptr(), vec_name.len() as libc::c_int) - }; - - if err != 0 { - println!("Cannot set hostname to {}", name); - } -} - -#[cfg(target_os = "linux")] -fn xsethostname(name: &str) { - let vec_name: Vec = name.bytes().map(|c| c as libc::c_char).collect(); - - let err = unsafe { - sethostname (vec_name.as_ptr(), vec_name.len() as libc::size_t) - }; - - if err != 0 { - println!("Cannot set hostname to {}", name); - } -} diff --git a/src/id/Cargo.toml b/src/id/Cargo.toml deleted file mode 100644 index 39035c77a..000000000 --- a/src/id/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "id" -version = "0.0.1" -authors = [] - -[lib] -name = "id" -path = "id.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/id/id.rs b/src/id/id.rs deleted file mode 100644 index ca3f07e83..000000000 --- a/src/id/id.rs +++ /dev/null @@ -1,397 +0,0 @@ -#![crate_name = "id"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Alan Andrade - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * Synced with: - * http://ftp-archive.freebsd.org/mirror/FreeBSD-Archive/old-releases/i386/1.0-RELEASE/ports/shellutils/src/id.c - * http://www.opensource.apple.com/source/shell_cmds/shell_cmds-118/id/id.c - */ - -#![allow(non_camel_case_types)] -extern crate getopts; -extern crate libc; - -use libc::{getgid, getuid, uid_t}; -use libc::funcs::posix88::unistd::{getegid, geteuid, getlogin}; -use std::ffi::CStr; -use std::io::Write; -use std::ptr::read; -use c_types::{ - c_passwd, - c_group, - get_groups, - get_group_list, - get_pw_from_args, - getpwuid, - group -}; - -#[path = "../common/util.rs"] #[macro_use] mod util; -#[path = "../common/c_types.rs"] mod c_types; - -#[cfg(not(target_os = "linux"))] -mod audit { - pub use std::mem::uninitialized; - use libc::{uid_t, pid_t, c_int, c_uint, uint64_t, dev_t}; - - pub type au_id_t = uid_t; - pub type au_asid_t = pid_t; - pub type au_event_t = c_uint; - pub type au_emod_t = c_uint; - pub type au_class_t = c_int; - - #[repr(C)] - pub struct au_mask { - pub am_success: c_uint, - pub am_failure: c_uint - } - pub type au_mask_t = au_mask; - - #[repr(C)] - pub struct au_tid_addr { - pub port: dev_t, - } - pub type au_tid_addr_t = au_tid_addr; - - #[repr(C)] - pub struct c_auditinfo_addr { - pub ai_auid: au_id_t, /* Audit user ID */ - pub ai_mask: au_mask_t, /* Audit masks. */ - pub ai_termid: au_tid_addr_t, /* Terminal ID. */ - pub ai_asid: au_asid_t, /* Audit session ID. */ - pub ai_flags: uint64_t /* Audit session flags */ - } - pub type c_auditinfo_addr_t = c_auditinfo_addr; - - extern { - pub fn getaudit(auditinfo_addr: *mut c_auditinfo_addr_t) -> c_int; - } -} - -extern { - fn getgrgid(gid: uid_t) -> *const c_group; -} - -static NAME: &'static str = "id"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - opts.optflag("h", "", "Show help"); - opts.optflag("A", "", "Display the process audit (not available on Linux)"); - opts.optflag("G", "", "Display the different group IDs"); - opts.optflag("g", "", "Display the effective group ID as a number"); - opts.optflag("n", "", "Display the name of the user or group ID for the -G, -g and -u options"); - opts.optflag("P", "", "Display the id as a password file entry"); - opts.optflag("p", "", "Make the output human-readable"); - opts.optflag("r", "", "Display the real ID for the -g and -u options"); - opts.optflag("u", "", "Display the effective user ID as a number"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => { m }, - Err(_) => { - println!("{}", opts.usage(NAME)); - return 1; - } - }; - - if matches.opt_present("h") { - println!("{}", opts.usage(NAME)); - return 0; - } - - if matches.opt_present("A") { - auditid(); - return 0; - } - - let possible_pw = get_pw_from_args(&matches.free); - - let nflag = matches.opt_present("n"); - let uflag = matches.opt_present("u"); - let gflag = matches.opt_present("g"); - let rflag = matches.opt_present("r"); - - if gflag { - let id = if possible_pw.is_some() { - possible_pw.unwrap().pw_gid - } else { - if rflag { - unsafe { getgid() } - } else { - unsafe { getegid() } - } - }; - let gr = unsafe { getgrgid(id) }; - - if nflag && !gr.is_null() { - let gr_name = unsafe { String::from_utf8_lossy(CStr::from_ptr(read(gr).gr_name).to_bytes()).to_string() }; - println!("{}", gr_name); - } else { - println!("{}", id); - } - return 0; - } - - if uflag { - let id = if possible_pw.is_some() { - possible_pw.unwrap().pw_uid - } else if rflag { - unsafe { getgid() } - } else { - unsafe { getegid() } - }; - - let pw = unsafe { getpwuid(id) }; - if nflag && !pw.is_null() { - let pw_name = unsafe { - String::from_utf8_lossy(CStr::from_ptr(read(pw).pw_name).to_bytes()).to_string() - }; - println!("{}", pw_name); - } else { - println!("{}", id); - } - - return 0; - } - - if matches.opt_present("G") { - group(possible_pw, nflag); - return 0; - } - - if matches.opt_present("P") { - pline(possible_pw); - return 0; - }; - - if matches.opt_present("p") { - pretty(possible_pw); - return 0; - } - - if possible_pw.is_some() { - id_print(possible_pw, false, false) - } else { - id_print(possible_pw, true, true) - } - - 0 -} - -fn pretty(possible_pw: Option) { - if possible_pw.is_some() { - let pw = possible_pw.unwrap(); - - let pw_name = unsafe { String::from_utf8_lossy(CStr::from_ptr(pw.pw_name).to_bytes()).to_string() }; - print!("uid\t{}\ngroups\t", pw_name); - group(possible_pw, true); - } else { - let login = unsafe { String::from_utf8_lossy(CStr::from_ptr((getlogin() as *const i8)).to_bytes()).to_string() }; - let rid = unsafe { getuid() }; - let pw = unsafe { getpwuid(rid) }; - - let is_same_user = unsafe { - String::from_utf8_lossy(CStr::from_ptr(read(pw).pw_name).to_bytes()).to_string() == login - }; - - if pw.is_null() || is_same_user { - println!("login\t{}", login); - } - - if !pw.is_null() { - println!( - "uid\t{}", - unsafe { String::from_utf8_lossy(CStr::from_ptr(read(pw).pw_name).to_bytes()).to_string() }) - } else { - println!("uid\t{}\n", rid); - } - - let eid = unsafe { getegid() }; - if eid == rid { - let pw = unsafe { getpwuid(eid) }; - if !pw.is_null() { - println!( - "euid\t{}", - unsafe { String::from_utf8_lossy(CStr::from_ptr(read(pw).pw_name).to_bytes()).to_string() }); - } else { - println!("euid\t{}", eid); - } - } - - let rid = unsafe { getgid() }; - - if rid != eid { - let gr = unsafe { getgrgid(rid) }; - if !gr.is_null() { - println!( - "rgid\t{}", - unsafe { String::from_utf8_lossy(CStr::from_ptr(read(gr).gr_name).to_bytes()).to_string() }); - } else { - println!("rgid\t{}", rid); - } - } - - print!("groups\t"); - group(None, true); - } -} - -#[cfg(any(target_os = "macos", target_os = "freebsd"))] -fn pline(possible_pw: Option) { - let pw = if possible_pw.is_none() { - unsafe { read(getpwuid(getuid())) } - } else { - possible_pw.unwrap() - }; - - let pw_name = unsafe { String::from_utf8_lossy(CStr::from_ptr(pw.pw_name ).to_bytes()).to_string()}; - let pw_passwd = unsafe { String::from_utf8_lossy(CStr::from_ptr(pw.pw_passwd).to_bytes()).to_string()}; - let pw_class = unsafe { String::from_utf8_lossy(CStr::from_ptr(pw.pw_class ).to_bytes()).to_string()}; - let pw_gecos = unsafe { String::from_utf8_lossy(CStr::from_ptr(pw.pw_gecos ).to_bytes()).to_string()}; - let pw_dir = unsafe { String::from_utf8_lossy(CStr::from_ptr(pw.pw_dir ).to_bytes()).to_string()}; - let pw_shell = unsafe { String::from_utf8_lossy(CStr::from_ptr(pw.pw_shell ).to_bytes()).to_string()}; - - println!( - "{}:{}:{}:{}:{}:{}:{}:{}:{}:{}", - pw_name, - pw_passwd, - pw.pw_uid, - pw.pw_gid, - pw_class, - pw.pw_change, - pw.pw_expire, - pw_gecos, - pw_dir, - pw_shell); -} - -#[cfg(target_os = "linux")] -fn pline(possible_pw: Option) { - let pw = if possible_pw.is_none() { - unsafe { read(getpwuid(getuid())) } - } else { - possible_pw.unwrap() - }; - - let pw_name = unsafe { String::from_utf8_lossy(CStr::from_ptr(pw.pw_name ).to_bytes()).to_string()}; - let pw_passwd = unsafe { String::from_utf8_lossy(CStr::from_ptr(pw.pw_passwd).to_bytes()).to_string()}; - let pw_gecos = unsafe { String::from_utf8_lossy(CStr::from_ptr(pw.pw_gecos ).to_bytes()).to_string()}; - let pw_dir = unsafe { String::from_utf8_lossy(CStr::from_ptr(pw.pw_dir ).to_bytes()).to_string()}; - let pw_shell = unsafe { String::from_utf8_lossy(CStr::from_ptr(pw.pw_shell ).to_bytes()).to_string()}; - - println!( - "{}:{}:{}:{}:{}:{}:{}", - pw_name, - pw_passwd, - pw.pw_uid, - pw.pw_gid, - pw_gecos, - pw_dir, - pw_shell); -} - -#[cfg(target_os = "linux")] -fn auditid() { } - -#[cfg(not(target_os = "linux"))] -fn auditid() { - let mut auditinfo: audit::c_auditinfo_addr_t = unsafe { audit::uninitialized() }; - let address = &mut auditinfo as *mut audit::c_auditinfo_addr_t; - if unsafe { audit::getaudit(address) } < 0 { - println!("couldn't retrieve information"); - return; - } - - println!("auid={}", auditinfo.ai_auid); - println!("mask.success=0x{:x}", auditinfo.ai_mask.am_success); - println!("mask.failure=0x{:x}", auditinfo.ai_mask.am_failure); - println!("termid.port=0x{:x}", auditinfo.ai_termid.port); - println!("asid={}", auditinfo.ai_asid); -} - -fn id_print(possible_pw: Option, p_euid: bool, p_egid: bool) { - let uid; - let gid; - - if possible_pw.is_some() { - uid = possible_pw.unwrap().pw_uid; - gid = possible_pw.unwrap().pw_gid; - } else { - uid = unsafe { getuid() }; - gid = unsafe { getgid() }; - } - - let groups = match possible_pw { - Some(pw) => Ok(get_group_list(pw.pw_name, pw.pw_gid)), - None => get_groups(), - }; - - let groups = groups.unwrap_or_else(|errno| { - crash!(1, "failed to get group list (errno={})", errno); - }); - - if possible_pw.is_some() { - print!( - "uid={}({})", - uid, - unsafe { String::from_utf8_lossy(CStr::from_ptr(possible_pw.unwrap().pw_name).to_bytes()).to_string() }); - } else { - print!("uid={}", unsafe { getuid() }); - } - - print!(" gid={}", gid); - let gr = unsafe { getgrgid(gid) }; - if !gr.is_null() { - print!( - "({})", - unsafe { String::from_utf8_lossy(CStr::from_ptr(read(gr).gr_name).to_bytes()).to_string() }); - } - - let euid = unsafe { geteuid() }; - if p_euid && (euid != uid) { - print!(" euid={}", euid); - let pw = unsafe { getpwuid(euid) }; - if !pw.is_null() { - print!( - "({})", - unsafe { String::from_utf8_lossy(CStr::from_ptr(read(pw).pw_name).to_bytes()).to_string() }); - } - } - - let egid = unsafe { getegid() }; - if p_egid && (egid != gid) { - print!(" egid={}", egid); - unsafe { - let grp = getgrgid(egid); - if !grp.is_null() { - print!("({})", String::from_utf8_lossy(CStr::from_ptr(read(grp).gr_name).to_bytes()).to_string()); - } - } - } - - if groups.len() > 0 { - print!(" groups="); - - let mut first = true; - for &gr in groups.iter() { - if !first { print!(",") } - print!("{}", gr); - let group = unsafe { getgrgid(gr) }; - if !group.is_null() { - let name = unsafe { - String::from_utf8_lossy(CStr::from_ptr(read(group).gr_name).to_bytes()).to_string() - }; - print!("({})", name); - } - first = false - } - } - - println!(""); -} diff --git a/src/kill/Cargo.toml b/src/kill/Cargo.toml deleted file mode 100644 index 7f36a1bd6..000000000 --- a/src/kill/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "kill" -version = "0.0.1" -authors = [] - -[lib] -name = "kill" -path = "kill.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/kill/kill.rs b/src/kill/kill.rs deleted file mode 100644 index 1556a2807..000000000 --- a/src/kill/kill.rs +++ /dev/null @@ -1,194 +0,0 @@ -#![crate_name = "kill"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Maciej Dziardziel - * - * For the full copyright and license information, please view the LICENSE file - * that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use libc::{c_int, pid_t}; -use signals::ALL_SIGNALS; -use std::io::{Error, Write}; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/c_types.rs"] -mod c_types; - -#[path = "../common/signals.rs"] -mod signals; - -static NAME: &'static str = "kill"; -static VERSION: &'static str = "0.0.1"; - -static EXIT_OK: i32 = 0; -static EXIT_ERR: i32 = 1; - -#[derive(Clone, Copy)] -pub enum Mode { - Kill, - Table, - List, - Help, - Version, -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - opts.optopt("s", "signal", "specify the to be sent", "SIGNAL"); - opts.optflagopt("l", "list", "list all signal names, or convert one to a name", "LIST"); - opts.optflag("L", "table", "list all signal names in a nice table"); - - let (args, obs_signal) = handle_obsolete(args); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(_) => { - help(&opts); - return EXIT_ERR; - }, - }; - - let mode = if matches.opt_present("version") { - Mode::Version - } else if matches.opt_present("help") { - Mode::Help - } else if matches.opt_present("table") { - Mode::Table - } else if matches.opt_present("list") { - Mode::List - } else { - Mode::Kill - }; - - match mode { - Mode::Kill => return kill(&matches.opt_str("signal").unwrap_or(obs_signal.unwrap_or("9".to_string())), matches.free), - Mode::Table => table(), - Mode::List => list(matches.opt_str("list")), - Mode::Help => help(&opts), - Mode::Version => version(), - } - - 0 -} - -fn version() { - println!("{} {}", NAME, VERSION); -} - -fn handle_obsolete(mut args: Vec) -> (Vec, Option) { - let mut i = 0; - while i < args.len() { - // this is safe because slice is valid when it is referenced - let slice = &args[i].clone(); - if slice.chars().next().unwrap() == '-' && slice.len() > 1 && slice.chars().nth(1).unwrap().is_digit(10) { - let val = &slice[1..]; - match val.parse() { - Ok(num) => { - if signals::is_signal(num) { - args.remove(i); - return (args, Some(val.to_string())); - } - } - Err(_)=> break /* getopts will error out for us */ - } - } - i += 1; - } - (args, None) -} - -fn table() { - let mut name_width = 0; - /* Compute the maximum width of a signal name. */ - for s in ALL_SIGNALS.iter() { - if s.name.len() > name_width { - name_width = s.name.len() - } - } - - for (idx, signal) in ALL_SIGNALS.iter().enumerate() { - print!("{0: >#2} {1: <#8}", idx+1, signal.name); - //TODO: obtain max signal width here - - if (idx+1) % 7 == 0 { - println!(""); - } - } -} - -fn print_signal(signal_name_or_value: &str) { - for signal in ALL_SIGNALS.iter() { - if signal.name == signal_name_or_value || (format!("SIG{}", signal.name)) == signal_name_or_value { - println!("{}", signal.value); - exit!(EXIT_OK as i32) - } else if signal_name_or_value == signal.value.to_string() { - println!("{}", signal.name); - exit!(EXIT_OK as i32) - } - } - crash!(EXIT_ERR, "unknown signal name {}", signal_name_or_value) -} - -fn print_signals() { - let mut pos = 0; - for (idx, signal) in ALL_SIGNALS.iter().enumerate() { - pos += signal.name.len(); - print!("{}", signal.name); - if idx > 0 && pos > 73 { - println!(""); - pos = 0; - } else { - pos += 1; - print!(" "); - } - } -} - -fn list(arg: Option) { - match arg { - Some(ref x) => print_signal(x), - None => print_signals(), - }; -} - -fn help(opts: &getopts::Options) { - let msg = format!("{0} {1} - -Usage: - {0} [options] [...]", NAME, VERSION); - - println!("{}", opts.usage(&msg)); -} - -fn kill(signalname: &str, pids: std::vec::Vec) -> i32 { - let mut status = 0; - let optional_signal_value = signals::signal_by_name_or_value(signalname); - let signal_value = match optional_signal_value { - Some(x) => x, - None => crash!(EXIT_ERR, "unknown signal name {}", signalname) - }; - for pid in pids.iter() { - match pid.parse::() { - Ok(x) => { - if unsafe { libc::funcs::posix88::signal::kill(x as pid_t, signal_value as c_int) } != 0 { - show_error!("{}", Error::last_os_error()); - status = 1; - } - }, - Err(e) => crash!(EXIT_ERR, "failed to parse argument {}: {}", pid, e) - }; - } - status -} diff --git a/src/link/Cargo.toml b/src/link/Cargo.toml deleted file mode 100644 index 84044b784..000000000 --- a/src/link/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "link" -version = "0.0.1" -authors = [] - -[lib] -name = "link" -path = "link.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/link/link.rs b/src/link/link.rs deleted file mode 100644 index a762550b7..000000000 --- a/src/link/link.rs +++ /dev/null @@ -1,66 +0,0 @@ -#![crate_name = "link"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Michael Gehring - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; - -use std::fs::hard_link; -use std::io::Write; -use std::path::Path; - -#[path="../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "link"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(err) => panic!("{}", err), - }; - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if matches.opt_present("help") || matches.free.len() != 2 { - let msg = format!("{0} {1} - -Usage: - {0} [OPTIONS] FILE1 FILE2 - -Create a link named FILE2 to FILE1.", NAME, VERSION); - - println!("{}", opts.usage(&msg)); - if matches.free.len() != 2 { - return 1; - } - return 0; - } - - let old = Path::new(&matches.free[0]); - let new = Path::new(&matches.free[1]); - - match hard_link(old, new) { - Ok(_) => 0, - Err(err) => { - show_error!("{}", err); - 1 - } - } -} diff --git a/src/ln/Cargo.toml b/src/ln/Cargo.toml deleted file mode 100644 index 8ec3cb1d7..000000000 --- a/src/ln/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "ln" -version = "0.0.1" -authors = [] - -[lib] -name = "ln" -path = "ln.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/ln/ln.rs b/src/ln/ln.rs deleted file mode 100644 index 6a7646e93..000000000 --- a/src/ln/ln.rs +++ /dev/null @@ -1,333 +0,0 @@ -#![crate_name = "ln"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Joseph Crail - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; - -use std::fs; -use std::io::{BufRead, BufReader, Result, stdin, Write}; -#[cfg(unix)] use std::os::unix::fs::symlink as symlink_file; -#[cfg(windows)] use std::os::windows::fs::symlink_file; -use std::path::{Path, PathBuf}; - -#[path="../common/util.rs"] -#[macro_use] -mod util; - -#[path="../common/filesystem.rs"] -mod filesystem; - -use filesystem::UUPathExt; - -static NAME: &'static str = "ln"; -static VERSION: &'static str = "1.0.0"; - -pub struct Settings { - overwrite: OverwriteMode, - backup: BackupMode, - suffix: String, - symbolic: bool, - target_dir: Option, - no_target_dir: bool, - verbose: bool, -} - -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum OverwriteMode { - NoClobber, - Interactive, - Force, -} - -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum BackupMode { - NoBackup, - SimpleBackup, - NumberedBackup, - ExistingBackup, -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("b", "", "make a backup of each file that would otherwise be overwritten or removed"); - opts.optflagopt("", "backup", "make a backup of each file that would otherwise be overwritten or removed", "METHOD"); - // TODO: opts.optflag("d", "directory", "allow users with appropriate privileges to attempt to make hard links to directories"); - opts.optflag("f", "force", "remove existing destination files"); - opts.optflag("i", "interactive", "prompt whether to remove existing destination files"); - // TODO: opts.optflag("L", "logical", "dereference TARGETs that are symbolic links"); - // TODO: opts.optflag("n", "no-dereference", "treat LINK_NAME as a normal file if it is a symbolic link to a directory"); - // TODO: opts.optflag("P", "physical", "make hard links directly to symbolic links"); - // TODO: opts.optflag("r", "relative", "create symbolic links relative to link location"); - opts.optflag("s", "symbolic", "make symbolic links instead of hard links"); - opts.optopt("S", "suffix", "override the usual backup suffix", "SUFFIX"); - opts.optopt("t", "target-directory", "specify the DIRECTORY in which to create the links", "DIRECTORY"); - opts.optflag("T", "no-target-directory", "treat LINK_NAME as a normal file always"); - opts.optflag("v", "verbose", "print name of each linked file"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(e) => crash!(1, "{}", e), - }; - - let overwrite_mode = if matches.opt_present("force") { - OverwriteMode::Force - } else if matches.opt_present("interactive") { - OverwriteMode::Interactive - } else { - OverwriteMode::NoClobber - }; - - let backup_mode = if matches.opt_present("b") { - BackupMode::ExistingBackup - } else if matches.opt_present("backup") { - match matches.opt_str("backup") { - None => BackupMode::ExistingBackup, - Some(mode) => match &mode[..] { - "simple" | "never" => BackupMode::SimpleBackup, - "numbered" | "t" => BackupMode::NumberedBackup, - "existing" | "nil" => BackupMode::ExistingBackup, - "none" | "off" => BackupMode::NoBackup, - x => { - show_error!("invalid argument '{}' for 'backup method'\n\ - Try '{} --help' for more information.", x, NAME); - return 1; - } - } - } - } else { - BackupMode::NoBackup - }; - - let backup_suffix = if matches.opt_present("suffix") { - match matches.opt_str("suffix") { - Some(x) => x, - None => { - show_error!("option '--suffix' requires an argument\n\ - Try '{} --help' for more information.", NAME); - return 1; - } - } - } else { - "~".to_string() - }; - - if matches.opt_present("T") && matches.opt_present("t") { - show_error!("cannot combine --target-directory (-t) and --no-target-directory (-T)"); - return 1; - } - - let settings = Settings { - overwrite: overwrite_mode, - backup: backup_mode, - suffix: backup_suffix, - symbolic: matches.opt_present("s"), - target_dir: matches.opt_str("t"), - no_target_dir: matches.opt_present("T"), - verbose: matches.opt_present("v"), - }; - - let string_to_path = |s: &String| { PathBuf::from(s) }; - let paths: Vec = matches.free.iter().map(string_to_path).collect(); - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - 0 - } else if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: {0} [OPTION]... [-T] TARGET LINK_NAME (1st form) - or: {0} [OPTION]... TARGET (2nd form) - or: {0} [OPTION]... TARGET... DIRECTORY (3rd form) - or: {0} [OPTION]... -t DIRECTORY TARGET... (4th form) - -In the 1st form, create a link to TARGET with the name LINK_NAME. -In the 2nd form, create a link to TARGET in the current directory. -In the 3rd and 4th forms, create links to each TARGET in DIRECTORY. -Create hard links by default, symbolic links with --symbolic. -By default, each destination (name of new link) should not already exist. -When creating hard links, each TARGET must exist. Symbolic links -can hold arbitrary text; if later resolved, a relative link is -interpreted in relation to its parent directory.", NAME, VERSION); - - print!("{}", opts.usage(&msg)); - 0 - } else { - exec(&paths[..], &settings) - } -} - -fn exec(files: &[PathBuf], settings: &Settings) -> i32 { - match settings.target_dir { - Some(ref name) => return link_files_in_dir(files, &PathBuf::from(name), &settings), - None => {} - } - match files.len() { - 0 => { - show_error!("missing file operand\nTry '{} --help' for more information.", NAME); - 1 - }, - 1 => match link(&files[0], &files[0], settings) { - Ok(_) => 0, - Err(e) => { - show_error!("{}", e); - 1 - } - }, - 2 => match link(&files[0], &files[1], settings) { - Ok(_) => 0, - Err(e) => { - show_error!("{}", e); - 1 - } - }, - _ => { - if settings.no_target_dir { - show_error!("extra operand '{}'\nTry '{} --help' for more information.", files[2].display(), NAME); - return 1; - } - let (targets, dir) = match settings.target_dir { - Some(ref dir) => (files, PathBuf::from(dir.clone())), - None => (&files[0..files.len()-1], files[files.len()-1].clone()) - }; - link_files_in_dir(targets, &dir, settings) - } - } -} - -fn link_files_in_dir(files: &[PathBuf], target_dir: &PathBuf, settings: &Settings) -> i32 { - if !target_dir.uu_is_dir() { - show_error!("target '{}' is not a directory", target_dir.display()); - return 1; - } - - let mut all_successful = true; - for srcpath in files.iter() { - let targetpath = match srcpath.as_os_str().to_str() { - Some(name) => target_dir.join(name), - None => { - show_error!("cannot stat '{}': No such file or directory", - srcpath.display()); - all_successful = false; - continue; - } - }; - - match link(srcpath, &targetpath, settings) { - Err(e) => { - show_error!("cannot link '{}' to '{}': {}", - targetpath.display(), srcpath.display(), e); - all_successful = false; - }, - _ => {} - } - } - if all_successful { 0 } else { 1 } -} - -fn link(src: &PathBuf, dst: &PathBuf, settings: &Settings) -> Result<()> { - let mut backup_path = None; - - if dst.uu_is_dir() { - if settings.no_target_dir { - try!(fs::remove_dir(dst)); - } - } - - if is_symlink(dst) || dst.uu_exists() { - match settings.overwrite { - OverwriteMode::NoClobber => {}, - OverwriteMode::Interactive => { - print!("{}: overwrite '{}'? ", NAME, dst.display()); - if !read_yes() { - return Ok(()); - } - try!(fs::remove_file(dst)) - }, - OverwriteMode::Force => { - try!(fs::remove_file(dst)) - } - }; - - backup_path = match settings.backup { - BackupMode::NoBackup => None, - BackupMode::SimpleBackup => Some(simple_backup_path(dst, &settings.suffix)), - BackupMode::NumberedBackup => Some(numbered_backup_path(dst)), - BackupMode::ExistingBackup => Some(existing_backup_path(dst, &settings.suffix)) - }; - if let Some(ref p) = backup_path { - try!(fs::rename(dst, p)); - } - } - - if settings.symbolic { - try!(symlink(src, dst)); - } else { - try!(fs::hard_link(src, dst)); - } - - if settings.verbose { - print!("'{}' -> '{}'", dst.display(), src.display()); - match backup_path { - Some(path) => println!(" (backup: '{}')", path.display()), - None => println!("") - } - } - Ok(()) -} - -fn read_yes() -> bool { - let mut s = String::new(); - match BufReader::new(stdin()).read_line(&mut s) { - Ok(_) => match s.char_indices().nth(0) { - Some((_, x)) => x == 'y' || x == 'Y', - _ => false - }, - _ => false - } -} - -fn simple_backup_path(path: &PathBuf, suffix: &String) -> PathBuf { - let mut p = path.as_os_str().to_str().unwrap().to_string(); - p.push_str(suffix); - PathBuf::from(p) -} - -fn numbered_backup_path(path: &PathBuf) -> PathBuf { - let mut i: u64 = 1; - loop { - let new_path = simple_backup_path(path, &format!(".~{}~", i)); - if !new_path.uu_exists() { - return new_path; - } - i += 1; - } -} - -fn existing_backup_path(path: &PathBuf, suffix: &String) -> PathBuf { - let test_path = simple_backup_path(path, &".~1~".to_string()); - if test_path.uu_exists() { - return numbered_backup_path(path); - } - simple_backup_path(path, suffix) -} - -pub fn symlink>(src: P, dst: P) -> Result<()> { - symlink_file(src, dst) -} - -pub fn is_symlink>(path: P) -> bool { - match fs::symlink_metadata(path) { - Ok(m) => m.file_type().is_symlink(), - Err(_) => false - } -} diff --git a/src/logname/Cargo.toml b/src/logname/Cargo.toml deleted file mode 100644 index b207e91bf..000000000 --- a/src/logname/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "logname" -version = "0.0.1" -authors = [] - -[lib] -name = "logname" -path = "logname.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/logname/logname.rs b/src/logname/logname.rs deleted file mode 100644 index c587bf038..000000000 --- a/src/logname/logname.rs +++ /dev/null @@ -1,81 +0,0 @@ -#![crate_name = "logname"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Benoit Benedetti - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/* last synced with: logname (GNU coreutils) 8.22 */ - -extern crate getopts; -extern crate libc; - -use std::ffi::CStr; -use std::io::Write; - -#[path = "../common/util.rs"] #[macro_use] mod util; - -extern { - // POSIX requires using getlogin (or equivalent code) - pub fn getlogin() -> *const libc::c_char; -} - -fn get_userlogin() -> Option { - unsafe { - let login: *const libc::c_char = getlogin(); - if login.is_null() { - None - } else { - Some(String::from_utf8_lossy(CStr::from_ptr(login).to_bytes()).to_string()) - } - } -} - -static NAME: &'static str = "logname"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - // - // Argument parsing - // - let mut opts = getopts::Options::new(); - - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f) - }; - - if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: - {0} - -Print user's login name.", NAME, VERSION); - - print!("{}", opts.usage(&msg)); - return 0; - } - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - exec(); - - 0 -} - -fn exec() { - match get_userlogin() { - Some(userlogin) => println!("{}", userlogin), - None => println!("{}: no login name", NAME) - } -} diff --git a/src/mkdir/Cargo.toml b/src/mkdir/Cargo.toml deleted file mode 100644 index 11f916bb0..000000000 --- a/src/mkdir/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "mkdir" -version = "0.0.1" -authors = [] - -[lib] -name = "mkdir" -path = "mkdir.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/mkdir/mkdir.rs b/src/mkdir/mkdir.rs deleted file mode 100644 index b68fe0d09..000000000 --- a/src/mkdir/mkdir.rs +++ /dev/null @@ -1,160 +0,0 @@ -#![crate_name = "mkdir"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Nicholas Juszczak - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::ffi::CString; -use std::fs; -use std::io::{Error, Write}; -use std::path::{Path, PathBuf}; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/filesystem.rs"] -mod filesystem; - -use filesystem::UUPathExt; - -static NAME: &'static str = "mkdir"; -static VERSION: &'static str = "1.0.0"; - -/** - * Handles option parsing - */ -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - // Linux-specific options, not implemented - // opts.optflag("Z", "context", "set SELinux secutiry context" + - // " of each created directory to CTX"), - opts.optopt("m", "mode", "set file mode", "755"); - opts.optflag("p", "parents", "make parent directories as needed"); - opts.optflag("v", "verbose", "print a message for each printed directory"); - opts.optflag("h", "help", "display this help"); - opts.optflag("V", "version", "display this version"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f) - }; - - if args.len() == 1 || matches.opt_present("help") { - print_help(&opts); - return 0; - } - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - let verbose = matches.opt_present("verbose"); - let recursive = matches.opt_present("parents"); - - // Translate a ~str in octal form to u16, default to 755 - // Not tested on Windows - let mode_match = matches.opts_str(&["mode".to_string()]); - let mode: u16 = if mode_match.is_some() { - let m = mode_match.unwrap(); - let res: Option = u16::from_str_radix(&m, 8).ok(); - if res.is_some() { - unsafe { std::mem::transmute(res.unwrap()) } - } else { - crash!(1, "no mode given"); - } - } else { - unsafe { std::mem::transmute(0o755 as u16) } - }; - - let dirs = matches.free; - if dirs.is_empty() { - crash!(1, "missing operand"); - } - exec(dirs, recursive, mode, verbose) -} - -fn print_help(opts: &getopts::Options) { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - print!("{}", opts.usage("Create the given DIRECTORY(ies) if they do not exist")); -} - -/** - * Create the list of new directories - */ -fn exec(dirs: Vec, recursive: bool, mode: u16, verbose: bool) -> i32 { - let mut status = 0; - let empty = Path::new(""); - for dir in dirs.iter() { - let path = Path::new(dir); - if recursive { - let mut pathbuf = PathBuf::new(); - for component in path.components() { - pathbuf.push(component.as_os_str()); - status |= mkdir(pathbuf.as_path(), mode, verbose); - } - } else { - match path.parent() { - Some(parent) => { - if parent != empty && !parent.uu_exists() { - show_info!("cannot create directory '{}': No such file or directory", path.display()); - status = 1; - } else { - status |= mkdir(path, mode, verbose); - } - }, - None => { - status |= mkdir(path, mode, verbose); - } - } - } - } - status -} - -/** - * Wrapper to catch errors, return 1 if failed - */ -fn mkdir(path: &Path, mode: u16, verbose: bool) -> i32 { - if path.uu_exists() { - show_info!("cannot create directory '{}': File exists", path.display()); - return 1; - } - - if let Err(e) = fs::create_dir(path) { - show_info!("{}: {}", path.display(), e.to_string()); - return 1; - } - - if verbose { - show_info!("created directory '{}'", path.display()); - } - - #[cfg(unix)] - fn chmod(path: &Path, mode: u16) -> i32 { - let directory = CString::new(path.as_os_str().to_str().unwrap()).unwrap_or_else(|e| crash!(1, "{}", e)); - let mode = mode as libc::mode_t; - - if unsafe { libc::chmod(directory.as_ptr(), mode) } != 0 { - show_info!("{}: errno {}", path.display(), Error::last_os_error().raw_os_error().unwrap()); - return 1; - } - 0 - } - #[cfg(windows)] - fn chmod(path: &Path, mode: u16) -> i32 { - // chmod on Windows only sets the readonly flag, which isn't even honored on directories - 0 - } - chmod(path, mode) -} diff --git a/src/mkfifo/Cargo.toml b/src/mkfifo/Cargo.toml deleted file mode 100644 index a8b347e2c..000000000 --- a/src/mkfifo/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "mkfifo" -version = "0.0.1" -authors = [] - -[lib] -name = "mkfifo" -path = "mkfifo.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/mkfifo/mkfifo.rs b/src/mkfifo/mkfifo.rs deleted file mode 100644 index 9b496c416..000000000 --- a/src/mkfifo/mkfifo.rs +++ /dev/null @@ -1,79 +0,0 @@ -#![crate_name = "mkfifo"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Michael Gehring - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use libc::funcs::posix88::stat_::mkfifo; -use std::ffi::CString; -use std::io::{Error, Write}; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "mkfifo"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optopt("m", "mode", "file permissions for the fifo", "(default 0666)"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(err) => panic!("{}", err), - }; - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if matches.opt_present("help") || matches.free.is_empty() { - let msg = format!("{0} {1} - -Usage: - {0} [OPTIONS] NAME... - -Create a FIFO with the given name.", NAME, VERSION); - - print!("{}", opts.usage(&msg)); - if matches.free.is_empty() { - return 1; - } - return 0; - } - - let mode = match matches.opt_str("m") { - Some(m) => match usize::from_str_radix(&m, 8) { - Ok(m) => m, - Err(e)=> { - show_error!("invalid mode: {}", e); - return 1; - } - }, - None => 0o666, - }; - - let mut exit_status = 0; - for f in matches.free.iter() { - let err = unsafe { mkfifo(CString::new(f.as_bytes()).unwrap().as_ptr(), mode as libc::mode_t) }; - if err == -1 { - show_error!("creating '{}': {}", f, Error::last_os_error().raw_os_error().unwrap()); - exit_status = 1; - } - } - - exit_status -} diff --git a/src/mv/Cargo.toml b/src/mv/Cargo.toml deleted file mode 100644 index a9e89f11d..000000000 --- a/src/mv/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "mv" -version = "0.0.1" -authors = [] - -[lib] -name = "mv" -path = "mv.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/mv/deps.mk b/src/mv/deps.mk deleted file mode 100644 index 0e162f8f0..000000000 --- a/src/mv/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += kernel32 winapi filetime time diff --git a/src/mv/mv.rs b/src/mv/mv.rs deleted file mode 100644 index f8317ccd9..000000000 --- a/src/mv/mv.rs +++ /dev/null @@ -1,358 +0,0 @@ -#![crate_name = "mv"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Orvar Segerström - * (c) Sokovikov Evgeniy - * - * For the full copyright and license information, please view the LICENSE file - * that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::fs; -use std::io::{BufRead, BufReader, Result, stdin, Write}; -use std::os::unix::fs::MetadataExt; -use std::path::{Path, PathBuf}; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/filesystem.rs"] -mod filesystem; - -use filesystem::UUPathExt; - -static NAME: &'static str = "mv"; -static VERSION: &'static str = "0.0.1"; - -pub struct Behaviour { - overwrite: OverwriteMode, - backup: BackupMode, - suffix: String, - update: bool, - target_dir: Option, - no_target_dir: bool, - verbose: bool, -} - -#[derive(Clone, Eq, PartialEq)] -pub enum OverwriteMode { - NoClobber, - Interactive, - Force, -} - -#[derive(Clone, Eq, PartialEq)] -pub enum BackupMode { - NoBackup, - SimpleBackup, - NumberedBackup, - ExistingBackup, -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflagopt("", "backup", "make a backup of each existing destination file", "CONTROL"); - opts.optflag("b", "", "like --backup but does not accept an argument"); - opts.optflag("f", "force", "do not prompt before overwriting"); - opts.optflag("i", "interactive", "prompt before override"); - opts.optflag("n", "no-clobber", "do not overwrite an existing file"); - opts.optflag("", "strip-trailing-slashes", "remove any trailing slashes from each SOURCE\n \ - argument"); - opts.optopt("S", "suffix", "override the usual backup suffix", "SUFFIX"); - opts.optopt("t", "target-directory", "move all SOURCE arguments into DIRECTORY", "DIRECTORY"); - opts.optflag("T", "no-target-directory", "treat DEST as a normal file"); - opts.optflag("u", "update", "move only when the SOURCE file is newer\n \ - than the destination file or when the\n \ - destination file is missing"); - opts.optflag("v", "verbose", "explain what is being done"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("Invalid options\n{}", f); - return 1; - } - }; - let usage = opts.usage("Move SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY."); - - /* This does not exactly match the GNU implementation: - * The GNU mv defaults to Force, but if more than one of the - * overwrite options are supplied, only the last takes effect. - * To default to no-clobber in that situation seems safer: - */ - let overwrite_mode = if matches.opt_present("no-clobber") { - OverwriteMode::NoClobber - } else if matches.opt_present("interactive") { - OverwriteMode::Interactive - } else { - OverwriteMode::Force - }; - - let backup_mode = if matches.opt_present("b") { - BackupMode::SimpleBackup - } else if matches.opt_present("backup") { - match matches.opt_str("backup") { - None => BackupMode::SimpleBackup, - Some(mode) => match &mode[..] { - "simple" | "never" => BackupMode::SimpleBackup, - "numbered" | "t" => BackupMode::NumberedBackup, - "existing" | "nil" => BackupMode::ExistingBackup, - "none" | "off" => BackupMode::NoBackup, - x => { - show_error!("invalid argument ‘{}’ for ‘backup type’\n\ - Try '{} --help' for more information.", x, NAME); - return 1; - } - } - } - } else { - BackupMode::NoBackup - }; - - if overwrite_mode == OverwriteMode::NoClobber && backup_mode != BackupMode::NoBackup { - show_error!("options --backup and --no-clobber are mutually exclusive\n\ - Try '{} --help' for more information.", NAME); - return 1; - } - - let backup_suffix = if matches.opt_present("suffix") { - match matches.opt_str("suffix") { - Some(x) => x, - None => { - show_error!("option '--suffix' requires an argument\n\ - Try '{} --help' for more information.", NAME); - return 1; - } - } - } else { - "~".to_string() - }; - - if matches.opt_present("T") && matches.opt_present("t") { - show_error!("cannot combine --target-directory (-t) and --no-target-directory (-T)"); - return 1; - } - - let behaviour = Behaviour { - overwrite: overwrite_mode, - backup: backup_mode, - suffix: backup_suffix, - update: matches.opt_present("u"), - target_dir: matches.opt_str("t"), - no_target_dir: matches.opt_present("T"), - verbose: matches.opt_present("v"), - }; - - let paths: Vec = { - fn string_to_path<'a>(s: &'a String) -> &'a Path { - Path::new(s) - }; - fn strip_slashes<'a>(p: &'a Path) -> &'a Path { - p.components().as_path() - } - let to_owned = |p: &Path| p.to_owned(); - let arguments = matches.free.iter().map(string_to_path); - if matches.opt_present("strip-trailing-slashes") { - arguments.map(strip_slashes).map(to_owned).collect() - } else { - arguments.map(to_owned).collect() - } - }; - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - 0 - } else if matches.opt_present("help") { - help(&usage); - 0 - } else { - exec(&paths[..], behaviour) - } -} - -fn help(usage: &str) { - println!("{0} {1}\n\n\ - Usage: {0} SOURCE DEST\n \ - or: {0} SOURCE... DIRECTORY\n\n\ - {2}", NAME, VERSION, usage); -} - -fn exec(files: &[PathBuf], b: Behaviour) -> i32 { - match b.target_dir { - Some(ref name) => return move_files_into_dir(files, &PathBuf::from(name), &b), - None => {} - } - match files.len() { - 0 | 1 => { - show_error!("missing file operand\n\ - Try '{} --help' for more information.", NAME); - return 1; - }, - 2 => { - let ref source = files[0]; - let ref target = files[1]; - if !source.uu_exists() { - show_error!("cannot stat ‘{}’: No such file or directory", source.display()); - return 1; - } - - if target.uu_is_dir() { - if b.no_target_dir { - if !source.uu_is_dir() { - show_error!("cannot overwrite directory ‘{}’ with non-directory", - target.display()); - return 1; - } - - return match rename(source, target, &b) { - Err(e) => { - show_error!("{}", e); - 1 - }, - _ => 0 - } - } - - return move_files_into_dir(&[source.clone()], target, &b); - } - - match rename(source, target, &b) { - Err(e) => { - show_error!("{}", e); - return 1; - }, - _ => {} - } - } - _ => { - if b.no_target_dir { - show_error!("mv: extra operand ‘{}’\n\ - Try '{} --help' for more information.", files[2].display(), NAME); - return 1; - } - let target_dir = files.last().unwrap(); - move_files_into_dir(&files[0..files.len()-1], target_dir, &b); - } - } - 0 -} - -fn move_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behaviour) -> i32 { - if !target_dir.uu_is_dir() { - show_error!("target ‘{}’ is not a directory", target_dir.display()); - return 1; - } - - let mut all_successful = true; - for sourcepath in files.iter() { - let targetpath = match sourcepath.as_os_str().to_str() { - Some(name) => target_dir.join(name), - None => { - show_error!("cannot stat ‘{}’: No such file or directory", - sourcepath.display()); - - all_successful = false; - continue; - } - }; - - match rename(sourcepath, &targetpath, b) { - Err(e) => { - show_error!("mv: cannot move ‘{}’ to ‘{}’: {}", - sourcepath.display(), targetpath.display(), e); - all_successful = false; - }, - _ => {} - } - }; - if all_successful { 0 } else { 1 } -} - -fn rename(from: &PathBuf, to: &PathBuf, b: &Behaviour) -> Result<()> { - let mut backup_path = None; - - if to.uu_exists() { - match b.overwrite { - OverwriteMode::NoClobber => return Ok(()), - OverwriteMode::Interactive => { - print!("{}: overwrite ‘{}’? ", NAME, to.display()); - if !read_yes() { - return Ok(()); - } - }, - OverwriteMode::Force => {} - }; - - backup_path = match b.backup { - BackupMode::NoBackup => None, - BackupMode::SimpleBackup => Some(simple_backup_path(to, &b.suffix)), - BackupMode::NumberedBackup => Some(numbered_backup_path(to)), - BackupMode::ExistingBackup => Some(existing_backup_path(to, &b.suffix)) - }; - if let Some(ref p) = backup_path { - try!(fs::rename(to, p)); - } - - if b.update { - if try!(fs::metadata(from)).mtime() <= try!(fs::metadata(to)).mtime() { - return Ok(()); - } - } - } - - try!(fs::rename(from, to)); - - if b.verbose { - print!("‘{}’ -> ‘{}’", from.display(), to.display()); - match backup_path { - Some(path) => println!(" (backup: ‘{}’)", path.display()), - None => println!("") - } - } - Ok(()) -} - -fn read_yes() -> bool { - let mut s = String::new(); - match BufReader::new(stdin()).read_line(&mut s) { - Ok(_) => match s.char_indices().nth(0) { - Some((_, x)) => x == 'y' || x == 'Y', - _ => false - }, - _ => false - } -} - -fn simple_backup_path(path: &PathBuf, suffix: &String) -> PathBuf { - let mut p = path.as_os_str().to_str().unwrap().to_string(); - p.push_str(suffix); - return PathBuf::from(p); -} - -fn numbered_backup_path(path: &PathBuf) -> PathBuf { - let mut i: u64 = 1; - loop { - let new_path = simple_backup_path(path, &format!(".~{}~", i)); - if !new_path.uu_exists() { - return new_path; - } - i = i + 1; - } -} - -fn existing_backup_path(path: &PathBuf, suffix: &String) -> PathBuf { - let test_path = simple_backup_path(path, &".~1~".to_string()); - if test_path.uu_exists() { - return numbered_backup_path(path); - } - simple_backup_path(path, suffix) -} diff --git a/src/nice/Cargo.toml b/src/nice/Cargo.toml deleted file mode 100644 index 812e0f61b..000000000 --- a/src/nice/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "nice" -version = "0.0.1" -authors = [] - -[lib] -name = "nice" -path = "nice.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/nice/nice.rs b/src/nice/nice.rs deleted file mode 100644 index d5e13576d..000000000 --- a/src/nice/nice.rs +++ /dev/null @@ -1,112 +0,0 @@ -#![crate_name = "nice"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Arcterus - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use libc::{c_char, c_int, execvp}; -use std::ffi::CString; -use std::io::{Error, Write}; - -const NAME: &'static str = "nice"; -const VERSION: &'static str = "1.0.0"; - -// XXX: PRIO_PROCESS is 0 on at least FreeBSD and Linux. Don't know about Mac OS X. -const PRIO_PROCESS: c_int = 0; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -extern { - fn getpriority(which: c_int, who: c_int) -> c_int; - fn setpriority(which: c_int, who: c_int, prio: c_int) -> c_int; -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optopt("n", "adjustment", "add N to the niceness (default is 10)", "N"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(err) => { - show_error!("{}", err); - return 125; - } - }; - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: - {0} [OPTIONS] [COMMAND [ARGS]] - -Run COMMAND with an adjusted niceness, which affects process scheduling. -With no COMMAND, print the current niceness. Niceness values range from at -least -20 (most favorable to the process) to 19 (least favorable to the -process).", NAME, VERSION); - - print!("{}", opts.usage(&msg)); - return 0; - } - - let mut niceness = unsafe { getpriority(PRIO_PROCESS, 0) }; - if Error::last_os_error().raw_os_error().unwrap() != 0 { - show_error!("{}", Error::last_os_error()); - return 125; - } - - let adjustment = match matches.opt_str("adjustment") { - Some(nstr) => { - if matches.free.len() == 0 { - show_error!("A command must be given with an adjustment. - Try \"{} --help\" for more information.", args[0]); - return 125; - } - match nstr.parse() { - Ok(num) => num, - Err(e)=> { - show_error!("\"{}\" is not a valid number: {}", nstr, e); - return 125; - } - } - }, - None => { - if matches.free.len() == 0 { - println!("{}", niceness); - return 0; - } - 10 as c_int - } - }; - - niceness += adjustment; - unsafe { setpriority(PRIO_PROCESS, 0, niceness); } - if Error::last_os_error().raw_os_error().unwrap() != 0 { - show_warning!("{}", Error::last_os_error()); - } - - let cstrs: Vec = matches.free.iter().map(|x| CString::new(x.as_bytes()).unwrap()).collect(); - let mut args: Vec<*const c_char> = cstrs.iter().map(|s| s.as_ptr()).collect(); - args.push(0 as *const c_char); - unsafe { execvp(args[0], args.as_mut_ptr()); } - - show_error!("{}", Error::last_os_error()); - if Error::last_os_error().raw_os_error().unwrap() as c_int == libc::ENOENT { 127 } else { 126 } -} diff --git a/src/nl/Cargo.toml b/src/nl/Cargo.toml deleted file mode 100644 index 3ca33339e..000000000 --- a/src/nl/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "nl" -version = "0.0.1" -authors = [] - -[lib] -name = "nl" -path = "nl.rs" - -[dependencies] -getopts = "*" -libc = "*" -aho-corasick = "*" -memchr = "*" -regex = "*" -regex-syntax = "*" diff --git a/src/nl/deps.mk b/src/nl/deps.mk deleted file mode 100644 index 78a05f8b6..000000000 --- a/src/nl/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += aho-corasick memchr regex regex-syntax diff --git a/src/nl/helper.rs b/src/nl/helper.rs deleted file mode 100644 index 2cdd5d9f5..000000000 --- a/src/nl/helper.rs +++ /dev/null @@ -1,121 +0,0 @@ -extern crate getopts; -extern crate regex; - -// parse_style parses a style string into a NumberingStyle. -fn parse_style(chars: &[char]) -> Result<::NumberingStyle, String> { - if chars.len() == 1 && chars[0] == 'a' { - Ok(::NumberingStyle::NumberForAll) - } else if chars.len() == 1 && chars[0] == 't' { - Ok(::NumberingStyle::NumberForNonEmpty) - } else if chars.len() == 1 && chars[0] == 'n' { - Ok(::NumberingStyle::NumberForNone) - } else if chars.len() > 1 && chars[0] == 'p' { - let s: String = chars[1..].iter().map(|c| *c).collect(); - match regex::Regex::new(&s) { - Ok(re) => Ok(::NumberingStyle::NumberForRegularExpression(re)), - Err(_) => Err(String::from("Illegal regular expression")), - } - } else { - Err(String::from("Illegal style encountered")) - } -} - -// parse_options loads the options into the settings, returning an array of -// error messages. -pub fn parse_options(settings: &mut ::Settings, opts: &getopts::Matches) -> Vec { - // This vector holds error messages encountered. - let mut errs: Vec = vec![]; - settings.renumber = !opts.opt_present("p"); - match opts.opt_str("s") { - None => {}, - Some(val) => { settings.number_separator = val; } - } - match opts.opt_str("n") { - None => {}, - Some(val) => match val.as_ref() { - "ln" => { settings.number_format = ::NumberFormat::Left; }, - "rn" => { settings.number_format = ::NumberFormat::Right; }, - "rz" => { settings.number_format = ::NumberFormat::RightZero; }, - _ => { errs.push(String::from("Illegal value for -n")); }, - } - } - match opts.opt_str("b") { - None => {}, - Some(val) => { - let chars: Vec = val.chars().collect(); - match parse_style(&chars) { - Ok(s) => { settings.body_numbering = s; } - Err(message) => { errs.push(message); } - } - } - } - match opts.opt_str("f") { - None => {}, - Some(val) => { - let chars: Vec = val.chars().collect(); - match parse_style(&chars) { - Ok(s) => { settings.footer_numbering = s; } - Err(message) => { errs.push(message); } - } - } - } - match opts.opt_str("h") { - None => {}, - Some(val) => { - let chars: Vec = val.chars().collect(); - match parse_style(&chars) { - Ok(s) => { settings.header_numbering = s; } - Err(message) => { errs.push(message); } - } - } - } - match opts.opt_str("i") { - None => {} - Some(val) => { - let conv: Option = val.parse().ok(); - match conv { - None => { - errs.push(String::from("Illegal value for -i")); - } - Some(num) => { settings.line_increment = num } - } - } - } - match opts.opt_str("w") { - None => {} - Some(val) => { - let conv: Option = val.parse().ok(); - match conv { - None => { - errs.push(String::from("Illegal value for -w")); - } - Some(num) => { settings.number_width = num } - } - } - } - match opts.opt_str("v") { - None => {} - Some(val) => { - let conv: Option = val.parse().ok(); - match conv { - None => { - errs.push(String::from("Illegal value for -v")); - } - Some(num) => { settings.starting_line_number = num } - } - } - } - match opts.opt_str("l") { - None => {} - Some(val) => { - let conv: Option = val.parse().ok(); - match conv { - None => { - errs.push(String::from("Illegal value for -l")); - } - Some(num) => { settings.join_blank_lines = num } - } - } - } - errs -} diff --git a/src/nl/nl.rs b/src/nl/nl.rs deleted file mode 100644 index b6048d32d..000000000 --- a/src/nl/nl.rs +++ /dev/null @@ -1,330 +0,0 @@ -#![crate_name = "nl"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Tobias Bohumir Schottdorf - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - */ - -extern crate aho_corasick; -extern crate getopts; -extern crate memchr; -extern crate regex_syntax; -extern crate regex; - -use std::fs::File; -use std::io::{BufRead, BufReader, Read, stdin, Write}; -use std::iter::repeat; -use std::path::Path; - -#[path="../common/util.rs"] -#[macro_use] -mod util; -mod helper; - -static NAME: &'static str = "nl"; -static VERSION: &'static str = "1.0.0"; -static USAGE: &'static str = "nl [OPTION]... [FILE]..."; -// A regular expression matching everything. - -// Settings store options used by nl to produce its output. -pub struct Settings { - // The variables corresponding to the options -h, -b, and -f. - header_numbering: NumberingStyle, - body_numbering: NumberingStyle, - footer_numbering: NumberingStyle, - // The variable corresponding to -d - section_delimiter: [char; 2], - // The variables corresponding to the options -v, -i, -l, -w. - starting_line_number: u64, - line_increment: u64, - join_blank_lines: u64, - number_width: usize, // Used with String::from_char, hence usize. - // The format of the number and the (default value for) - // renumbering each page. - number_format: NumberFormat, - renumber: bool, - // The string appended to each line number output. - number_separator: String -} - -// NumberingStyle stores which lines are to be numberd. -// The possible options are: -// 1. Number all lines -// 2. Number only nonempty lines -// 3. Don't number any lines at all -// 4. Number all lines that match a basic regular expression. -enum NumberingStyle { - NumberForAll, - NumberForNonEmpty, - NumberForNone, - NumberForRegularExpression(regex::Regex) -} - -// NumberFormat specifies how line numbers are output within their allocated -// space. They are justified to the left or right, in the latter case with -// the option of having all unused space to its left turned into leading zeroes. -enum NumberFormat { - Left, - Right, - RightZero, -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optopt("b", "body-numbering", "use STYLE for numbering body lines", "STYLE"); - opts.optopt("d", "section-delimiter", "use CC for separating logical pages", "CC"); - opts.optopt("f", "footer-numbering", "use STYLE for numbering footer lines", "STYLE"); - opts.optopt("h", "header-numbering", "use STYLE for numbering header lines", "STYLE"); - opts.optopt("i", "line-increment", "line number increment at each line", ""); - opts.optopt("l", "join-blank-lines", "group of NUMBER empty lines counted as one", "NUMBER"); - opts.optopt("n", "number-format", "insert line numbers according to FORMAT", "FORMAT"); - opts.optflag("p", "no-renumber", "do not reset line numbers at logical pages"); - opts.optopt("s", "number-separator", "add STRING after (possible) line number", "STRING"); - opts.optopt("v", "starting-line-number", "first line number on each logical page", "NUMBER"); - opts.optopt("w", "number-width", "use NUMBER columns for line numbers", "NUMBER"); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("V", "version", "version"); - - // A mutable settings object, initialized with the defaults. - let mut settings = Settings { - header_numbering: NumberingStyle::NumberForNone, - body_numbering: NumberingStyle::NumberForAll, - footer_numbering: NumberingStyle::NumberForNone, - section_delimiter: ['\\', ':'], - starting_line_number: 1, - line_increment: 1, - join_blank_lines: 1, - number_width: 6, - number_format: NumberFormat::Right, - renumber: true, - number_separator: String::from("\t"), - }; - - let given_options = match opts.parse(&args[1..]) { - Ok (m) => { m } - Err(f) => { - show_error!("{}", f); - print_usage(&opts); - return 1 - } - }; - - if given_options.opt_present("help") { - print_usage(&opts); - return 0; - } - if given_options.opt_present("version") { version(); return 0; } - - // Update the settings from the command line options, and terminate the - // program if some options could not successfully be parsed. - let parse_errors = helper::parse_options(&mut settings, &given_options); - if parse_errors.len() > 0 { - show_error!("Invalid arguments supplied."); - for message in parse_errors.iter() { - println!("{}", message); - } - return 1; - } - - let files = given_options.free; - let mut read_stdin = files.is_empty(); - - for file in files.iter() { - if file == "-" { - // If both file names and '-' are specified, we choose to treat first all - // regular files, and then read from stdin last. - read_stdin = true; - continue - } - let path = Path::new(file); - let reader = File::open(path).unwrap(); - let mut buffer = BufReader::new(reader); - nl(&mut buffer, &settings); - } - - if read_stdin { - let mut buffer = BufReader::new(stdin()); - nl(&mut buffer, &settings); - } - 0 -} - -// nl implements the main functionality for an individual buffer. -fn nl (reader: &mut BufReader, settings: &Settings) { - let regexp: regex::Regex = regex::Regex::new(r".?").unwrap(); - let mut line_no = settings.starting_line_number; - // The current line number's width as a string. Using to_string is inefficient - // but since we only do it once, it should not hurt. - let mut line_no_width = line_no.to_string().len(); - let line_no_width_initial = line_no_width; - // Stores the smallest integer with one more digit than line_no, so that - // when line_no >= line_no_threshold, we need to use one more digit. - let mut line_no_threshold = 10u64.pow(line_no_width as u32); - let mut empty_line_count: u64 = 0; - let fill_char = match settings.number_format { - NumberFormat::RightZero => '0', - _ => ' ' - }; - // Initially, we use the body's line counting settings - let mut regex_filter = match settings.body_numbering { - NumberingStyle::NumberForRegularExpression(ref re) => re, - _ => ®exp, - }; - let mut line_filter : fn(&str, ®ex::Regex) -> bool = pass_regex; - for mut l in reader.lines().map(|r| r.unwrap()) { - // Sanitize the string. We want to print the newline ourselves. - if l.len() > 0 && l.chars().rev().next().unwrap() == '\n' { - l.pop(); - } - // Next we iterate through the individual chars to see if this - // is one of the special lines starting a new "section" in the - // document. - let line = l; - let mut odd = false; - // matched_group counts how many copies of section_delimiter - // this string consists of (0 if there's anything else) - let mut matched_groups = 0u8; - for c in line.chars() { - // If this is a newline character, the loop should end. - if c == '\n' { - break; - } - // If we have already seen three groups (corresponding to - // a header) or the current char does not form part of - // a new group, then this line is not a segment indicator. - if matched_groups >= 3 - || settings.section_delimiter[if odd { 1 } else { 0 }] != c { - matched_groups = 0; - break; - } - if odd { - // We have seen a new group and count it. - matched_groups += 1; - } - odd = !odd; - } - - // See how many groups we matched. That will tell us if this is - // a line starting a new segment, and the number of groups - // indicates what type of segment. - if matched_groups > 0 { - // The current line is a section delimiter, so we output - // a blank line. - println!(""); - // However the line does not count as a blank line, so we - // reset the counter used for --join-blank-lines. - empty_line_count = 0; - match *match matched_groups { - 3 => { - // This is a header, so we may need to reset the - // line number and the line width - if settings.renumber { - line_no = settings.starting_line_number; - line_no_width = line_no_width_initial; - line_no_threshold = 10u64.pow(line_no_width as u32); - } - &settings.header_numbering - }, - 1 => { - &settings.footer_numbering - }, - // The only option left is 2, but rust wants - // a catch-all here. - _ => { - &settings.body_numbering - } - } { - NumberingStyle::NumberForAll => { - line_filter = pass_all; - }, - NumberingStyle::NumberForNonEmpty => { - line_filter = pass_nonempty; - }, - NumberingStyle::NumberForNone => { - line_filter = pass_none; - } - NumberingStyle::NumberForRegularExpression(ref re) => { - line_filter = pass_regex; - regex_filter = re; - } - } - continue; - } - // From this point on we format and print a "regular" line. - if line == "" { - // The line is empty, which means that we have to care - // about the --join-blank-lines parameter. - empty_line_count += 1; - } else { - // This saves us from having to check for an empty string - // in the next selector. - empty_line_count = 0; - } - if !line_filter(&line, regex_filter) - || ( empty_line_count > 0 && empty_line_count < settings.join_blank_lines) { - // No number is printed for this line. Either we did not - // want to print one in the first place, or it is a blank - // line but we are still collecting more blank lines via - // the option --join-blank-lines. - println!("{}", line); - continue; - } - // If we make it here, then either we are printing a non-empty - // line or assigning a line number to an empty line. Either - // way, start counting empties from zero once more. - empty_line_count = 0; - // A line number is to be printed. - let mut w: usize = 0; - if settings.number_width > line_no_width { - w = settings.number_width - line_no_width; - } - let fill: String = repeat(fill_char).take(w).collect(); - match settings.number_format { - NumberFormat::Left => { - println!("{1}{0}{2}{3}", fill, line_no, settings.number_separator, line) - }, - _ => { - println!("{0}{1}{2}{3}", fill, line_no, settings.number_separator, line) - } - } - // Now update the variables for the (potential) next - // line. - line_no += settings.line_increment; - while line_no >= line_no_threshold { - // The line number just got longer. - line_no_threshold *= 10; - line_no_width += 1; - } - - } -} - -fn pass_regex(line: &str, re: ®ex::Regex) -> bool { - re.is_match(line) -} - -fn pass_nonempty(line: &str, _: ®ex::Regex) -> bool { - line.len() > 0 -} - -fn pass_none(_: &str, _: ®ex::Regex) -> bool { - false -} - -fn pass_all(_: &str, _: ®ex::Regex) -> bool { - true -} - -fn print_usage(opts: &getopts::Options) { - println!("{}", opts.usage(USAGE)); -} - -fn version() { - println!("{} {}", NAME, VERSION); -} diff --git a/src/nohup/Cargo.toml b/src/nohup/Cargo.toml deleted file mode 100644 index e4d916481..000000000 --- a/src/nohup/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "nohup" -version = "0.0.1" -authors = [] - -[lib] -name = "nohup" -path = "nohup.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/nohup/nohup.rs b/src/nohup/nohup.rs deleted file mode 100644 index 304776d5a..000000000 --- a/src/nohup/nohup.rs +++ /dev/null @@ -1,149 +0,0 @@ -#![crate_name = "nohup"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) 2014 Vsevolod Velichko - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use libc::c_char; -use libc::funcs::posix01::signal::signal; -use libc::funcs::posix88::unistd::{dup2, execvp, isatty}; -use libc::consts::os::posix01::SIG_IGN; -use libc::consts::os::posix88::SIGHUP; -use std::env; -use std::ffi::CString; -use std::fs::{File, OpenOptions}; -use std::io::{Error, Write}; -use std::os::unix::prelude::*; -use std::path::{Path, PathBuf}; - -#[path = "../common/util.rs"] #[macro_use] mod util; -#[path = "../common/c_types.rs"] mod c_types; - -static NAME: &'static str = "nohup"; -static VERSION: &'static str = "1.0.0"; - -#[cfg(target_os = "macos")] -extern { - fn _vprocmgr_detach_from_console(flags: u32) -> *const libc::c_int; -} - -#[cfg(any(target_os = "linux", target_os = "freebsd"))] -unsafe fn _vprocmgr_detach_from_console(_: u32) -> *const libc::c_int { std::ptr::null() } - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("h", "help", "Show help and exit"); - opts.optflag("V", "version", "Show version and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - show_usage(&opts); - return 1 - } - }; - - if matches.opt_present("V") { println!("{} {}", NAME, VERSION); return 0 } - if matches.opt_present("h") { show_usage(&opts); return 0 } - - if matches.free.len() == 0 { - show_error!("Missing operand: COMMAND"); - println!("Try `{} --help` for more information.", NAME); - return 1 - } - replace_fds(); - - unsafe { signal(SIGHUP, SIG_IGN) }; - - if unsafe { _vprocmgr_detach_from_console(0) } != std::ptr::null() { crash!(2, "Cannot detach from console")}; - - let cstrs: Vec = matches.free.iter().map(|x| CString::new(x.as_bytes()).unwrap()).collect(); - let mut args: Vec<*const c_char> = cstrs.iter().map(|s| s.as_ptr()).collect(); - args.push(std::ptr::null()); - unsafe { execvp(args[0], args.as_mut_ptr())} -} - -fn replace_fds() { - let replace_stdin = unsafe { isatty(libc::STDIN_FILENO) == 1 }; - let replace_stdout = unsafe { isatty(libc::STDOUT_FILENO) == 1 }; - let replace_stderr = unsafe { isatty(libc::STDERR_FILENO) == 1 }; - - if replace_stdin { - let new_stdin = match File::open(Path::new("/dev/null")) { - Ok(t) => t, - Err(e) => { - crash!(2, "Cannot replace STDIN: {}", e) - } - }; - if unsafe { dup2(new_stdin.as_raw_fd(), 0) } != 0 { - crash!(2, "Cannot replace STDIN: {}", Error::last_os_error()) - } - } - - if replace_stdout { - let new_stdout = find_stdout(); - let fd = new_stdout.as_raw_fd(); - - if unsafe { dup2(fd, 1) } != 1 { - crash!(2, "Cannot replace STDOUT: {}", Error::last_os_error()) - } - } - - if replace_stderr { - if unsafe { dup2(1, 2) } != 2 { - crash!(2, "Cannot replace STDERR: {}", Error::last_os_error()) - } - } -} - -fn find_stdout() -> File { - match OpenOptions::new().write(true).create(true).append(true).open(Path::new("nohup.out")) { - Ok(t) => { - show_warning!("Output is redirected to: nohup.out"); - t - }, - Err(e) => { - let home = match env::var("HOME") { - Err(_) => crash!(2, "Cannot replace STDOUT: {}", e), - Ok(h) => h - }; - let mut homeout = PathBuf::from(home); - homeout.push("nohup.out"); - match OpenOptions::new().write(true).create(true).append(true).open(&homeout) { - Ok(t) => { - show_warning!("Output is redirected to: {:?}", homeout); - t - }, - Err(e) => { - crash!(2, "Cannot replace STDOUT: {}", e) - } - } - } - } -} - -fn show_usage(opts: &getopts::Options) { - let msg = format!("{0} {1} - -Usage: - {0} COMMAND [ARG]... - {0} OPTION - -Run COMMAND ignoring hangup signals. -If standard input is terminal, it'll be replaced with /dev/null. -If standard output is terminal, it'll be appended to nohup.out instead, -or $HOME/nohup.out, if nohup.out open failed. -If standard error is terminal, it'll be redirected to stdout.", NAME, VERSION); - - print!("{}", opts.usage(&msg)); -} diff --git a/src/nproc/Cargo.toml b/src/nproc/Cargo.toml deleted file mode 100644 index 289086eb5..000000000 --- a/src/nproc/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "nproc" -version = "0.0.1" -authors = [] - -[lib] -name = "nproc" -path = "nproc.rs" - -[dependencies] -getopts = "*" -libc = "*" -num_cpus = "*" diff --git a/src/nproc/deps.mk b/src/nproc/deps.mk deleted file mode 100644 index 8bd1a6c62..000000000 --- a/src/nproc/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += num_cpus diff --git a/src/nproc/nproc.rs b/src/nproc/nproc.rs deleted file mode 100644 index 037d2a3e7..000000000 --- a/src/nproc/nproc.rs +++ /dev/null @@ -1,87 +0,0 @@ -#![crate_name = "nproc"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Michael Gehring - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate num_cpus; - -use std::env; -use std::io::Write; - -static NAME : &'static str = "nproc"; -static VERSION : &'static str = "0.0.0"; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("", "all", "print the number of cores available to the system"); - opts.optopt("", "ignore", "ignore up to N cores", "N"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(err) => { - show_error!("{}", err); - return 1; - } - }; - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: - {0} [OPTIONS]... - -Print the number of cores available to the current process.", NAME, VERSION); - - print!("{}", opts.usage(&msg)); - return 0; - } - - let mut ignore = match matches.opt_str("ignore") { - Some(numstr) => match numstr.parse() { - Ok(num) => num, - Err(e) => { - show_error!("\"{}\" is not a valid number: {}", numstr, e); - return 1; - } - }, - None => 0 - }; - - if !matches.opt_present("all") { - ignore += match env::var("OMP_NUM_THREADS") { - Ok(threadstr) => match threadstr.parse() { - Ok(num) => num, - Err(_)=> 0 - }, - Err(_) => 0 - }; - } - - let mut cores = num_cpus::get(); - if cores <= ignore { - cores = 1; - } else { - cores -= ignore; - } - println!("{}", cores); - 0 -} diff --git a/src/od/Cargo.toml b/src/od/Cargo.toml deleted file mode 100644 index e6e1d7183..000000000 --- a/src/od/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "od" -version = "0.0.1" -authors = [] - -[lib] -name = "od" -path = "od.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/od/od.rs b/src/od/od.rs deleted file mode 100644 index da9295855..000000000 --- a/src/od/od.rs +++ /dev/null @@ -1,126 +0,0 @@ -#![crate_name = "od"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Ben Hirsch - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; - -use std::fs::File; -use std::io::Read; -use std::mem; -use std::path::Path; - -#[derive(Debug)] -enum Radix { Decimal, Hexadecimal, Octal, Binary } - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optopt("A", "address-radix", - "Select the base in which file offsets are printed.", "RADIX"); - opts.optopt("j", "skip-bytes", - "Skip bytes input bytes before formatting and writing.", "BYTES"); - opts.optopt("N", "read-bytes", - "limit dump to BYTES input bytes", "BYTES"); - opts.optopt("S", "strings", - ("output strings of at least BYTES graphic chars. 3 is assumed when \ - BYTES is not specified."), - "BYTES"); - opts.optopt("t", "format", "select output format or formats", "TYPE"); - opts.optflag("v", "output-duplicates", "do not use * to mark line suppression"); - opts.optopt("w", "width", - ("output BYTES bytes per output line. 32 is implied when BYTES is not \ - specified."), - "BYTES"); - opts.optflag("h", "help", "display this help and exit."); - opts.optflag("", "version", "output version information and exit."); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => panic!("Invalid options\n{}", f) - }; - - let input_offset_base = match parse_radix(matches.opt_str("A")) { - Ok(r) => r, - Err(f) => { panic!("Invalid -A/--address-radix\n{}", f) } - }; - - let fname = match args.last() { - Some(n) => n, - None => { panic!("Need fname for now") ; } - }; - - main(&input_offset_base, &fname); - - 0 -} - -fn main(input_offset_base: &Radix, fname: &str) { - let mut f = match File::open(Path::new(fname)) { - Ok(f) => f, - Err(e) => panic!("file error: {}", e) - }; - - let mut addr = 0; - let bytes = &mut [b'\x00'; 16]; - loop { - match f.read(bytes) { - Ok(n) => { - print_with_radix(input_offset_base, addr); - for b in 0 .. n / mem::size_of::() { - let bs = &bytes[(2 * b) .. (2 * b + 2)]; - let p: u16 = (bs[1] as u16) << 8 | bs[0] as u16; - print!(" {:06o}", p); - } - if n % mem::size_of::() == 1 { - print!(" {:06o}", bytes[n - 1]); - } - print!("\n"); - addr += n; - }, - Err(_) => { - print_with_radix(input_offset_base, addr); - break; - } - }; - }; -} - -fn parse_radix(radix_str: Option) -> Result { - match radix_str { - None => Ok(Radix::Octal), - Some(s) => { - let st = s.into_bytes(); - if st.len() != 1 { - Err("Radix must be one of [d, o, b, x]\n") - } else { - let radix: char = *(st.get(0) - .expect("byte string of length 1 lacks a 0th elem")) as char; - match radix { - 'd' => Ok(Radix::Decimal), - 'x' => Ok(Radix::Hexadecimal), - 'o' => Ok(Radix::Octal), - 'b' => Ok(Radix::Binary), - _ => Err("Radix must be one of [d, o, b, x]\n") - } - } - } - } -} - -fn print_with_radix(r: &Radix, x: usize) { - // TODO(keunwoo): field widths should be based on sizeof(x), or chosen dynamically based on the - // expected range of address values. Binary in particular is not great here. - match *r { - Radix::Decimal => print!("{:07}", x), - Radix::Hexadecimal => print!("{:07X}", x), - Radix::Octal => print!("{:07o}", x), - Radix::Binary => print!("{:07b}", x) - } -} diff --git a/src/paste/Cargo.toml b/src/paste/Cargo.toml deleted file mode 100644 index 9800ef127..000000000 --- a/src/paste/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "paste" -version = "0.0.1" -authors = [] - -[lib] -name = "paste" -path = "paste.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/paste/paste.rs b/src/paste/paste.rs deleted file mode 100644 index 6a8592138..000000000 --- a/src/paste/paste.rs +++ /dev/null @@ -1,130 +0,0 @@ -#![crate_name = "paste"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Arcterus - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::io::{BufRead, BufReader, Read, stdin, Write}; -use std::iter::repeat; -use std::fs::File; -use std::path::Path; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "paste"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("s", "serial", "paste one file at a time instead of in parallel"); - opts.optopt("d", "delimiters", "reuse characters from LIST instead of TABs", "LIST"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(e) => crash!(1, "{}", e) - }; - - if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: - {0} [OPTION]... [FILE]... - -Write lines consisting of the sequentially corresponding lines from each -FILE, separated by TABs, to standard output.", NAME, VERSION); - print!("{}", opts.usage(&msg)); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else { - let serial = matches.opt_present("serial"); - let delimiters = matches.opt_str("delimiters").unwrap_or("\t".to_string()); - paste(matches.free, serial, delimiters); - } - - 0 -} - -fn paste(filenames: Vec, serial: bool, delimiters: String) { - let mut files: Vec>> = filenames.into_iter().map(|name| - BufReader::new( - if name == "-" { - Box::new(stdin()) as Box - } else { - let r = crash_if_err!(1, File::open(Path::new(&name))); - Box::new(r) as Box - } - ) - ).collect(); - - let delimiters: Vec = unescape(delimiters).chars().map(|x| x.to_string()).collect(); - let mut delim_count = 0; - - if serial { - for file in files.iter_mut() { - let mut output = String::new(); - loop { - let mut line = String::new(); - match file.read_line(&mut line) { - Ok(0) => break, - Ok(_) => { - output.push_str(line.trim_right()); - output.push_str(&delimiters[delim_count % delimiters.len()]); - } - Err(e) => crash!(1, "{}", e.to_string()) - } - delim_count += 1; - } - println!("{}", &output[..output.len()-1]); - } - } else { - let mut eof: Vec = repeat(false).take(files.len()).collect(); - loop { - let mut output = String::new(); - let mut eof_count = 0; - for (i, file) in files.iter_mut().enumerate() { - if eof[i] { - eof_count += 1; - } else { - let mut line = String::new(); - match file.read_line(&mut line) { - Ok(0) => { - eof[i] = true; - eof_count += 1; - } - Ok(_) => output.push_str(line.trim_right()), - Err(e) => crash!(1, "{}", e.to_string()) - } - } - output.push_str(&delimiters[delim_count % delimiters.len()]); - delim_count += 1; - } - if files.len() == eof_count { - break; - } - println!("{}", &output[..output.len()-1]); - delim_count = 0; - } - } -} - -// Unescape all special characters -// TODO: this will need work to conform to GNU implementation -fn unescape(s: String) -> String { - s.replace("\\n", "\n") - .replace("\\t", "\t") - .replace("\\\\", "\\") - .replace("\\", "") -} diff --git a/src/printenv/Cargo.toml b/src/printenv/Cargo.toml deleted file mode 100644 index 166816d5c..000000000 --- a/src/printenv/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "printenv" -version = "0.0.1" -authors = [] - -[lib] -name = "printenv" -path = "printenv.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/printenv/printenv.rs b/src/printenv/printenv.rs deleted file mode 100644 index d895449f9..000000000 --- a/src/printenv/printenv.rs +++ /dev/null @@ -1,78 +0,0 @@ -#![crate_name = "printenv"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/* last synced with: printenv (GNU coreutils) 8.13 */ - -extern crate getopts; -extern crate libc; - -use std::env; -use std::io::Write; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "printenv"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - opts.optflag("0", "null", "end each output line with 0 byte rather than newline"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - crash!(1, "Invalid options\n{}", f) - } - }; - if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: - {0} [VARIABLE]... [OPTION]... - -Prints the given environment VARIABLE(s), otherwise prints them all.", NAME, VERSION); - print!("{}", opts.usage(&msg)); - return 0; - } - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - let mut separator = "\n"; - if matches.opt_present("null") { - separator = "\x00"; - }; - - exec(matches.free, separator); - - 0 -} - -pub fn exec(args: Vec, separator: &str) { - if args.is_empty() { - for (env_var, value) in env::vars() { - print!("{}={}{}", env_var, value, separator); - } - return; - } - - for env_var in args.iter() { - match env::var(env_var) { - Ok(var) => { - print!("{}{}", var, separator); - } - _ => () - } - } -} diff --git a/src/ptx/Cargo.toml b/src/ptx/Cargo.toml deleted file mode 100644 index 65f0cc7b7..000000000 --- a/src/ptx/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "ptx" -version = "0.0.1" -authors = [] - -[lib] -name = "ptx" -path = "ptx.rs" - -[dependencies] -getopts = "*" -libc = "*" -aho-corasick = "*" -memchr = "*" -regex-syntax = "*" -regex = "*" diff --git a/src/ptx/deps.mk b/src/ptx/deps.mk deleted file mode 100644 index 78a05f8b6..000000000 --- a/src/ptx/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += aho-corasick memchr regex regex-syntax diff --git a/src/ptx/ptx.rs b/src/ptx/ptx.rs deleted file mode 100644 index 0569d130b..000000000 --- a/src/ptx/ptx.rs +++ /dev/null @@ -1,564 +0,0 @@ -#![crate_name = "ptx"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Dorota Kapturkiewicz - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate aho_corasick; -extern crate getopts; -extern crate memchr; -extern crate regex_syntax; -extern crate regex; - -use std::collections::{HashMap, HashSet, BTreeSet}; -use std::default::Default; -use std::fs::File; -use getopts::{Options, Matches}; -use std::io::{stdin, stdout, BufReader, BufWriter, BufRead, Read, Write}; -use regex::Regex; -use std::cmp; - - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "ptx"; -static VERSION: &'static str = "1.0.0"; - -#[derive(Debug)] -enum OutFormat { - Dumb, - Roff, - Tex, -} - -#[derive(Debug)] -struct Config { - format : OutFormat, - gnu_ext : bool, - auto_ref : bool, - input_ref : bool, - right_ref : bool, - ignore_case : bool, - macro_name : String, - trunc_str : String, - context_regex : String, - line_width : usize, - gap_size : usize, -} - -impl Default for Config { - fn default() -> Config { - Config { - format : OutFormat::Dumb, - gnu_ext : true, - auto_ref : false, - input_ref : false, - right_ref : false, - ignore_case : false, - macro_name : "xx".to_string(), - trunc_str : "/".to_string(), - context_regex : "\\w+".to_string(), - line_width : 72, - gap_size : 3 - } - } -} - -fn read_word_filter_file(matches: &Matches, option: &str) -> HashSet { - let filename = matches.opt_str(option).expect("parsing options failed!"); - let reader = BufReader::new(crash_if_err!(1, File::open(filename))); - let mut words: HashSet = HashSet::new(); - for word in reader.lines() { - words.insert(crash_if_err!(1, word)); - } - words -} - -#[derive(Debug)] -struct WordFilter { - only_specified: bool, - ignore_specified: bool, - only_set: HashSet, - ignore_set: HashSet, - word_regex: String, -} - -impl WordFilter { - fn new(matches: &Matches, config: &Config) -> WordFilter { - let (o, oset): (bool, HashSet) = - if matches.opt_present("o") { - (true, read_word_filter_file(matches, "o")) - } else { - (false, HashSet::new()) - }; - let (i, iset): (bool, HashSet) = - if matches.opt_present("i") { - (true, read_word_filter_file(matches, "i")) - } else { - (false, HashSet::new()) - }; - if matches.opt_present("b") { - crash!(1, "-b not implemented yet"); - } - let reg = - if matches.opt_present("W") { - matches.opt_str("W").expect("parsing options failed!") - } else if config.gnu_ext { - "\\w+".to_string() - } else { - "[^ \t\n]+".to_string() - }; - WordFilter { - only_specified: o, - ignore_specified: i, - only_set: oset, - ignore_set: iset, - word_regex: reg - } - } -} - -#[derive(Debug, PartialOrd, PartialEq, Eq, Ord)] -struct WordRef { - word: String, - global_line_nr: usize, - local_line_nr: usize, - position: usize, - position_end: usize, - filename: String, -} - -fn print_version() { - println!("{} {}", NAME, VERSION); -} - -fn print_usage(opts: &Options) { - let brief = "Usage: ptx [OPTION]... [INPUT]... (without -G) or: \ - ptx -G [OPTION]... [INPUT [OUTPUT]] \n Output a permuted index, \ - including context, of the words in the input files. \n\n Mandatory \ - arguments to long options are mandatory for short options too."; - let explaination = "With no FILE, or when FILE is -, read standard input. \ - Default is '-F /'."; - println!("{}\n{}", opts.usage(&brief), explaination); -} - -fn get_config(matches: &Matches) -> Config { - let mut config: Config = Default::default(); - let err_msg = "parsing options failed"; - if matches.opt_present("G") { - config.gnu_ext = false; - config.format = OutFormat::Roff; - config.context_regex = "[^ \t\n]+".to_string(); - } else { - crash!(1, "GNU extensions not implemented yet"); - } - if matches.opt_present("S") { - crash!(1, "-S not implemented yet"); - } - config.auto_ref = matches.opt_present("A"); - config.input_ref = matches.opt_present("r"); - config.right_ref &= matches.opt_present("R"); - config.ignore_case = matches.opt_present("f"); - if matches.opt_present("M") { - config.macro_name = - matches.opt_str("M").expect(err_msg).to_string(); - } - if matches.opt_present("F") { - config.trunc_str = - matches.opt_str("F").expect(err_msg).to_string(); - } - if matches.opt_present("w") { - let width_str = matches.opt_str("w").expect(err_msg); - config.line_width = crash_if_err!( - 1, usize::from_str_radix(&width_str, 10)); - } - if matches.opt_present("g") { - let gap_str = matches.opt_str("g").expect(err_msg); - config.gap_size = crash_if_err!( - 1, usize::from_str_radix(&gap_str, 10)); - } - if matches.opt_present("O") { - config.format = OutFormat::Roff; - } - if matches.opt_present("T") { - config.format = OutFormat::Tex; - } - config -} - -fn read_input(input_files: &Vec, config: &Config) -> - HashMap, usize)> { - let mut file_map : HashMap, usize)> = - HashMap::new(); - let mut files = Vec::new(); - if input_files.is_empty() { - files.push("-"); - } else { - if config.gnu_ext { - for file in input_files { - files.push(&file); - } - } else { - files.push(&input_files[0]); - } - } - let mut lines_so_far: usize = 0; - for filename in files { - let reader: BufReader> = BufReader::new( - if filename == "-" { - Box::new(stdin()) - } else { - let file = crash_if_err!(1, File::open(filename)); - Box::new(file) - }); - let lines: Vec = reader.lines().map(|x| crash_if_err!(1, x)) - .collect(); - let size = lines.len(); - file_map.insert(filename.to_string(), (lines, lines_so_far)); - lines_so_far += size - } - file_map -} - -fn create_word_set(config: &Config, filter: &WordFilter, - file_map: &HashMap, usize)>)-> - BTreeSet { - let reg = Regex::new(&filter.word_regex).unwrap(); - let ref_reg = Regex::new(&config.context_regex).unwrap(); - let mut word_set: BTreeSet = BTreeSet::new(); - for (file, lines) in file_map.iter() { - let mut count: usize = 0; - let offs = lines.1; - for line in (lines.0).iter() { - // if -r, exclude reference from word set - let (ref_beg, ref_end) = match ref_reg.find(line) { - Some(x) => x, - None => (0,0) - }; - // match words with given regex - for (beg, end) in reg.find_iter(line) { - if config.input_ref && ((beg, end) == (ref_beg, ref_end)) { - continue; - } - let mut word = line[beg .. end].to_string(); - if filter.only_specified && - !(filter.only_set.contains(&word)) { - continue; - } - if filter.ignore_specified && - filter.ignore_set.contains(&word) { - continue; - } - if config.ignore_case { - word = word.to_lowercase(); - } - word_set.insert(WordRef{ - word: word, - filename: String::from(file.clone()), - global_line_nr: offs + count, - local_line_nr: count, - position: beg, - position_end: end - }); - } - count += 1; - } - } - word_set -} - -fn get_reference(config: &Config, word_ref: &WordRef, line: &String) -> - String { - if config.auto_ref { - format!("{}:{}", word_ref.filename, word_ref.local_line_nr + 1) - } else if config.input_ref { - let reg = Regex::new(&config.context_regex).unwrap(); - let (beg, end) = match reg.find(line) { - Some(x) => x, - None => (0,0) - }; - format!("{}", &line[beg .. end]) - } else { - String::new() - } -} - -fn assert_str_integrity(s: &Vec, beg: usize, end: usize) { - assert!(beg <= end); - assert!(end <= s.len()); -} - -fn trim_broken_word_left(s: &Vec, beg: usize, end: usize) -> usize { - assert_str_integrity(s, beg, end); - if beg == end || beg == 0 || s[beg].is_whitespace() || - s[beg-1].is_whitespace() { - return beg; - } - let mut b = beg; - while b < end && !s[b].is_whitespace() { - b += 1; - } - b -} - -fn trim_broken_word_right(s: &Vec, beg: usize, end: usize) -> usize { - assert_str_integrity(s, beg, end); - if beg == end || end == s.len() || s[end-1].is_whitespace() || - s[end].is_whitespace() { - return end; - } - let mut e = end; - while beg < e && !s[e-1].is_whitespace() { - e -= 1; - } - e -} - -fn trim_idx(s: &Vec, beg: usize, end: usize) -> (usize, usize) { - assert_str_integrity(s, beg, end); - let mut b = beg; - let mut e = end; - while b < e && s[b].is_whitespace() { - b += 1; - } - while b < e && s[e-1].is_whitespace() { - e -= 1; - } - (b,e) -} - -fn get_output_chunks(all_before: &String, keyword: &String, all_after: &String, - config: &Config) -> (String, String, String, String) { - assert_eq!(all_before.trim().to_string(), *all_before); - assert_eq!(keyword.trim().to_string(), *keyword); - assert_eq!(all_after.trim().to_string(), *all_after); - let mut head = String::new(); - let mut before = String::new(); - let mut after = String::new(); - let mut tail = String::new(); - - let half_line_size = cmp::max((config.line_width/2) as isize - - (2*config.trunc_str.len()) as isize, 0) as usize; - let max_after_size = cmp::max(half_line_size as isize - - keyword.len() as isize - 1, 0) as usize; - let max_before_size = half_line_size; - let all_before_vec: Vec = all_before.chars().collect(); - let all_after_vec: Vec = all_after.chars().collect(); - - // get before - let mut bb_tmp = - cmp::max(all_before.len() as isize - max_before_size as isize, 0) as usize; - bb_tmp = trim_broken_word_left(&all_before_vec, bb_tmp, all_before.len()); - let (before_beg, before_end) = - trim_idx(&all_before_vec, bb_tmp, all_before.len()); - before.push_str(&all_before[before_beg .. before_end]); - assert!(max_before_size >= before.len()); - - // get after - let mut ae_tmp = cmp::min(max_after_size, all_after.len()); - ae_tmp = trim_broken_word_right(&all_after_vec, 0, ae_tmp); - let (after_beg, after_end) = trim_idx(&all_after_vec, 0, ae_tmp); - after.push_str(&all_after[after_beg .. after_end]); - assert!(max_after_size >= after.len()); - - // get tail - let max_tail_size = max_before_size - before.len(); - let (tb, _) = trim_idx(&all_after_vec, after_end, all_after.len()); - let mut te_tmp = cmp::min(tb + max_tail_size, all_after.len()); - te_tmp = trim_broken_word_right(&all_after_vec, tb, te_tmp); - let (tail_beg, tail_end) = trim_idx(&all_after_vec, tb, te_tmp); - tail.push_str(&all_after[tail_beg .. tail_end]); - - // get head - let max_head_size = max_after_size - after.len(); - let (_, he) = trim_idx(&all_before_vec, 0, before_beg); - let mut hb_tmp = - cmp::max(he as isize - max_head_size as isize, 0) as usize; - hb_tmp = trim_broken_word_left(&all_before_vec, hb_tmp, he); - let (head_beg, head_end) = trim_idx(&all_before_vec, hb_tmp, he); - head.push_str(&all_before[head_beg .. head_end]); - - // put right context truncation string if needed - if after_end != all_after.len() && tail_beg == tail_end { - after.push_str(&config.trunc_str); - } else if after_end != all_after.len() && tail_end != all_after.len() { - tail.push_str(&config.trunc_str); - } - - // put left context truncation string if needed - if before_beg != 0 && head_beg == head_end { - before = format!("{}{}", config.trunc_str, before); - } else if before_beg != 0 && head_beg != 0 { - head = format!("{}{}", config.trunc_str, head); - } - - // add space before "after" if needed - if after.len() > 0 { - after = format!(" {}", after); - } - - (tail, before, after, head) -} - -fn tex_mapper(x: char) -> String { - match x { - '\\' => "\\backslash{}".to_string(), - '$' | '%' | '#' | '&' | '_' => format!("\\{}", x), - '}' | '{' => format!("$\\{}$", x), - _ => x.to_string() - } -} - -fn adjust_tex_str(context: &str) -> String { - let ws_reg = Regex::new(r"[\t\n\v\f\r ]").unwrap(); - let mut fix: String = ws_reg.replace_all(context, " ").trim().to_string(); - let mapped_chunks: Vec = fix.chars().map(tex_mapper).collect(); - fix = mapped_chunks.join(""); - fix -} - -fn format_tex_line(config: &Config, word_ref: &WordRef, line: &String, - reference: &String) -> String { - let mut output = String::new(); - output.push_str(&format!("\\{} ", config.macro_name)); - let all_before = if config.input_ref { - let before = &line[0 .. word_ref.position]; - adjust_tex_str(before.trim().trim_left_matches(reference)) - } else { - adjust_tex_str(&line[0 .. word_ref.position]) - }; - let keyword = adjust_tex_str( - &line[word_ref.position .. word_ref.position_end]); - let all_after = adjust_tex_str( - &line[word_ref.position_end .. line.len()]); - let (tail, before, after, head) = - get_output_chunks(&all_before, &keyword, &all_after, &config); - output.push_str(&format!("{5}{0}{6}{5}{1}{6}{5}{2}{6}{5}{3}{6}{5}{4}{6}", - tail, before, keyword, after, head, "{", "}")); - if config.auto_ref || config.input_ref { - output.push_str( - &format!("{}{}{}", "{", adjust_tex_str(&reference), "}")); - } - output -} - -fn adjust_roff_str(context: &str) -> String { - let ws_reg = Regex::new(r"[\t\n\v\f\r]").unwrap(); - ws_reg.replace_all(context, " ").replace("\"", "\"\"").trim().to_string() -} - -fn format_roff_line(config: &Config, word_ref: &WordRef, line: &str, - reference: &str) -> String { - let mut output = String::new(); - output.push_str(&format!(".{}", config.macro_name)); - let all_before = if config.input_ref { - let before = &line[0 .. word_ref.position]; - adjust_roff_str(before.trim().trim_left_matches(reference)) - } else { - adjust_roff_str(&line[0 .. word_ref.position]) - }; - let keyword = adjust_roff_str( - &line[word_ref.position .. word_ref.position_end]); - let all_after = adjust_roff_str( - &line[word_ref.position_end .. line.len()]); - let (tail, before, after, head) = - get_output_chunks(&all_before, &keyword, &all_after, &config); - output.push_str(&format!(" \"{}\" \"{}\" \"{}{}\" \"{}\"", - tail, before, keyword, after, head)); - if config.auto_ref || config.input_ref { - output.push_str(&format!(" \"{}\"", adjust_roff_str(&reference))); - } - output -} - -fn write_traditional_output(config: &Config, - file_map: &HashMap,usize)>, - words: &BTreeSet, output_filename: &String) { - let mut writer: BufWriter> = BufWriter::new( - if output_filename == "-" { - Box::new(stdout()) - } else { - let file = crash_if_err!(1, File::create(output_filename)); - Box::new(file) - }); - for word_ref in words.iter() { - let file_map_value : &(Vec, usize) = - file_map.get(&(word_ref.filename)) - .expect("Missing file in file map"); - let (ref lines, _) = *(file_map_value); - let reference = - get_reference(config, word_ref, &lines[word_ref.local_line_nr]); - let output_line: String = match config.format { - OutFormat::Tex => format_tex_line( - config, word_ref, &lines[word_ref.local_line_nr], &reference), - OutFormat::Roff => format_roff_line( - config, word_ref, &lines[word_ref.local_line_nr], &reference), - OutFormat::Dumb => crash!( - 1, "There is no dumb format with GNU extensions disabled") - }; - crash_if_err!(1, writeln!(writer, "{}", output_line)); - } -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - opts.optflag("A", "auto-reference", - "output automatically generated references"); - opts.optflag("G", "traditional", "behave more like System V 'ptx'"); - opts.optopt("F", "flag-truncation", - "use STRING for flagging line truncations", "STRING"); - opts.optopt("M", "macro-name", "macro name to use instead of 'xx'", - "STRING"); - opts.optflag("O", "format=roff", "generate output as roff directives"); - opts.optflag("R", "right-side-refs", - "put references at right, not counted in -w"); - opts.optopt("S", "sentence-regexp", "for end of lines or end of sentences", - "REGEXP"); - opts.optflag("T", "format=tex", "generate output as TeX directives"); - opts.optopt("W", "word-regexp", "use REGEXP to match each keyword", - "REGEXP"); - opts.optopt("b", "break-file", "word break characters in this FILE", - "FILE"); - opts.optflag("f", "ignore-case", - "fold lower case to upper case for sorting"); - opts.optopt("g", "gap-size", "gap size in columns between output fields", - "NUMBER"); - opts.optopt("i", "ignore-file", "read ignore word list from FILE", "FILE"); - opts.optopt("o", "only-file", "read only word list from this FILE", - "FILE"); - opts.optflag("r", "references", "first field of each line is a reference"); - opts.optopt("w", "width", "output width in columns, reference excluded", - "NUMBER"); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); - - let matches = return_if_err!(1, opts.parse(&args[1..])); - - if matches.opt_present("help") { - print_usage(&opts); - return 0; - } - if matches.opt_present("version") { - print_version(); - return 0; - } - let config = get_config(&matches); - let word_filter = WordFilter::new(&matches, &config); - let file_map = - read_input(&matches.free, &config); - let word_set = create_word_set(&config, &word_filter, &file_map); - let output_file = if !config.gnu_ext && matches.free.len() == 2 { - matches.free[1].clone() - } else { - "-".to_string() - }; - write_traditional_output(&config, &file_map, &word_set, &output_file); - 0 -} diff --git a/src/pwd/Cargo.toml b/src/pwd/Cargo.toml deleted file mode 100644 index 9b4c9afbd..000000000 --- a/src/pwd/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "pwd" -version = "0.0.1" -authors = [] - -[lib] -name = "pwd" -path = "pwd.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/pwd/pwd.rs b/src/pwd/pwd.rs deleted file mode 100644 index 3205e0c32..000000000 --- a/src/pwd/pwd.rs +++ /dev/null @@ -1,53 +0,0 @@ -#![crate_name = "pwd"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Derek Chiang - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::env; -use std::io::Write; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "pwd"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - crash!(1, "Invalid options\n{}", f) - } - }; - - if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: - {0} [OPTION]... - -Print the full filename of the current working directory.", NAME, VERSION); - print!("{}", opts.usage(&msg)); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else { - println!("{}", env::current_dir().unwrap().display()); - } - - 0 -} diff --git a/src/readlink/Cargo.toml b/src/readlink/Cargo.toml deleted file mode 100644 index 42e5db253..000000000 --- a/src/readlink/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "readlink" -version = "0.0.1" -authors = [] - -[lib] -name = "readlink" -path = "readlink.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/readlink/readlink.rs b/src/readlink/readlink.rs deleted file mode 100644 index 58640b97d..000000000 --- a/src/readlink/readlink.rs +++ /dev/null @@ -1,140 +0,0 @@ -#![crate_name = "readlink"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Haitao Li - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; - -use std::fs; -use std::io::Write; -use std::path::PathBuf; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/filesystem.rs"] -mod filesystem; - -use filesystem::{canonicalize, CanonicalizeMode}; - -const NAME: &'static str = "readlink"; -const VERSION: &'static str = "0.0.1"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("f", "canonicalize", - "canonicalize by following every symlink in every component of the \ - given name recursively; all but the last component must exist"); - opts.optflag("e", "canonicalize-existing", - "canonicalize by following every symlink in every component of the \ - given name recursively, all components must exist"); - opts.optflag("m", "canonicalize-missing", - "canonicalize by following every symlink in every component of the \ - given name recursively, without requirements on components existence"); - opts.optflag("n", "no-newline", "do not output the trailing delimiter"); - opts.optflag("q", "quiet", "suppress most error messages"); - opts.optflag("s", "silent", "suppress most error messages"); - opts.optflag("v", "verbose", "report error message"); - opts.optflag("z", "zero", "separate output with NUL rather than newline"); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f) - }; - if matches.opt_present("help") { - show_usage(&opts); - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let mut no_newline = matches.opt_present("no-newline"); - let use_zero = matches.opt_present("zero"); - let silent = matches.opt_present("silent") || matches.opt_present("quiet"); - let verbose = matches.opt_present("verbose"); - - let mut can_mode = CanonicalizeMode::None; - if matches.opt_present("canonicalize") { - can_mode = CanonicalizeMode::Normal; - } - - if matches.opt_present("canonicalize-existing") { - can_mode = CanonicalizeMode::Existing; - } - - if matches.opt_present("canonicalize-missing") { - can_mode = CanonicalizeMode::Missing; - } - - let files = matches.free; - if files.len() == 0 { - crash!(1, "missing operand\nTry {} --help for more information", NAME); - } - - if no_newline && files.len() > 1 { - if !silent { - eprintln!("{}: ignoring --no-newline with multiple arguments", NAME); - no_newline = false; - } - } - - for f in files.iter() { - let p = PathBuf::from(f); - if can_mode == CanonicalizeMode::None { - match fs::read_link(&p) { - Ok(path) => show(&path, no_newline, use_zero), - Err(err) => { - if verbose { - eprintln!("{}: {}: errno {}", NAME, f, err.raw_os_error().unwrap()); - } - return 1 - } - } - } else { - match canonicalize(&p, can_mode) { - Ok(path) => show(&path, no_newline, use_zero), - Err(err) => { - if verbose { - eprintln!("{}: {}: errno {:?}", NAME, f, err.raw_os_error().unwrap()); - } - return 1 - } - } - } - } - - 0 -} - -fn show(path: &PathBuf, no_newline: bool, use_zero: bool) { - let path = path.as_path().to_str().unwrap(); - if use_zero { - print!("{}\0", path); - } else if no_newline { - print!("{}", path); - } else { - println!("{}", path); - } - pipe_flush!(); -} - -fn show_usage(opts: &getopts::Options) { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage: {0} [OPTION]... [FILE]...", NAME); - print!("Print value of a symbolic link or canonical file name"); - print!("{}", opts.usage("")); -} diff --git a/src/realpath/Cargo.toml b/src/realpath/Cargo.toml deleted file mode 100644 index b481bf0a0..000000000 --- a/src/realpath/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "realpath" -version = "0.0.1" -authors = [] - -[lib] -name = "realpath" -path = "realpath.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/realpath/realpath.rs b/src/realpath/realpath.rs deleted file mode 100644 index 62b1f951b..000000000 --- a/src/realpath/realpath.rs +++ /dev/null @@ -1,142 +0,0 @@ -#![crate_name= "realpath"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) 2014 Vsevolod Velichko - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::fs; -use std::io::Write; -use std::path::{Path, PathBuf}; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/filesystem.rs"] -mod filesystem; - -use filesystem::{canonicalize, CanonicalizeMode}; - -static NAME: &'static str = "realpath"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("h", "help", "Show help and exit"); - opts.optflag("V", "version", "Show version and exit"); - opts.optflag("s", "strip", "Only strip '.' and '..' components, but don't resolve symbolic links"); - opts.optflag("z", "zero", "Separate output filenames with \\0 rather than newline"); - opts.optflag("q", "quiet", "Do not print warnings for invalid paths"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - show_usage(&opts); - return 1 - } - }; - - if matches.opt_present("V") { version(); return 0 } - if matches.opt_present("h") { show_usage(&opts); return 0 } - - if matches.free.len() == 0 { - show_error!("Missing operand: FILENAME, at least one is required"); - println!("Try `{} --help` for more information.", NAME); - return 1 - } - - let strip = matches.opt_present("s"); - let zero = matches.opt_present("z"); - let quiet = matches.opt_present("q"); - let mut retcode = 0; - for path in matches.free.iter() { - if !resolve_path(path, strip, zero, quiet) { - retcode = 1 - }; - } - retcode -} - -fn resolve_path(path: &str, strip: bool, zero: bool, quiet: bool) -> bool { - let p = Path::new(path).to_path_buf(); - let abs = canonicalize(p, CanonicalizeMode::Normal).unwrap(); - - if strip { - if zero { - print!("{}\0", abs.display()); - } else { - println!("{}", abs.display()) - } - return true - } - - let mut result = PathBuf::new(); - let mut links_left = 256; - - for part in abs.components() { - result.push(part.as_ref()); - loop { - if links_left == 0 { - if !quiet { show_error!("Too many symbolic links: {}", path) }; - return false - } - match fs::metadata(result.as_path()) { - Err(_) => break, - Ok(ref m) if !m.file_type().is_symlink() => break, - Ok(_) => { - links_left -= 1; - match fs::read_link(result.as_path()) { - Ok(x) => { - result.pop(); - result.push(x.as_path()); - }, - _ => { - if !quiet { - show_error!("Invalid path: {}", path) - }; - return false - }, - } - } - } - } - } - - if zero { - print!("{}\0", result.display()); - } else { - println!("{}", result.display()); - } - - true -} - -fn version() { - println!("{} {}", NAME, VERSION) -} - -fn show_usage(opts: &getopts::Options) { - version(); - println!(""); - println!("Usage:"); - println!(" {} [-s|--strip] [-z|--zero] FILENAME...", NAME); - println!(" {} -V|--version", NAME); - println!(" {} -h|--help", NAME); - println!(""); - print!("{}", opts.usage( - "Convert each FILENAME to the absolute path.\n\ - All the symbolic links will be resolved, resulting path will contain no special components like '.' or '..'.\n\ - Each path component must exist or resolution will fail and non-zero exit status returned.\n\ - Each resolved FILENAME will be written to the standard output, one per line.") - ); -} diff --git a/src/relpath/Cargo.toml b/src/relpath/Cargo.toml deleted file mode 100644 index c45a18deb..000000000 --- a/src/relpath/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "relpath" -version = "0.0.1" -authors = [] - -[lib] -name = "relpath" -path = "relpath.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/relpath/relpath.rs b/src/relpath/relpath.rs deleted file mode 100644 index 1f4cebcbc..000000000 --- a/src/relpath/relpath.rs +++ /dev/null @@ -1,107 +0,0 @@ -#![crate_name = "relpath"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) 2014 Vsevolod Velichko - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::env; -use std::io::Write; -use std::path::{Path, PathBuf}; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/filesystem.rs"] -mod filesystem; - -use filesystem::{canonicalize, CanonicalizeMode}; - -static NAME: &'static str = "relpath"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("h", "help", "Show help and exit"); - opts.optflag("V", "version", "Show version and exit"); - opts.optopt("d", "", "If any of FROM and TO is not subpath of DIR, output absolute path instead of relative", "DIR"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - show_usage(&opts); - return 1 - } - }; - - if matches.opt_present("V") { version(); return 0 } - if matches.opt_present("h") { show_usage(&opts); return 0 } - - if matches.free.len() == 0 { - show_error!("Missing operand: TO"); - println!("Try `{} --help` for more information.", NAME); - return 1 - } - - let to = Path::new(&matches.free[0]); - let from = if matches.free.len() > 1 { - Path::new(&matches.free[1]).to_path_buf() - } else { - env::current_dir().unwrap() - }; - let absto = canonicalize(to, CanonicalizeMode::Normal).unwrap(); - let absfrom = canonicalize(from, CanonicalizeMode::Normal).unwrap(); - - if matches.opt_present("d") { - let base = Path::new(&matches.opt_str("d").unwrap()).to_path_buf(); - let absbase = canonicalize(base, CanonicalizeMode::Normal).unwrap(); - if !absto.as_path().starts_with(absbase.as_path()) || !absfrom.as_path().starts_with(absbase.as_path()) { - println!("{}", absto.display()); - return 0 - } - } - - let mut suffix_pos = 0; - for (f, t) in absfrom.components().zip(absto.components()) { - if f == t { - suffix_pos += 1; - } else { - break; - } - } - - let mut result = PathBuf::new(); - absfrom.components().skip(suffix_pos).map(|_| result.push("..")).last(); - absto.components().skip(suffix_pos).map(|x| result.push(x.as_ref())).last(); - - println!("{}", result.display()); - 0 -} - -fn version() { - println!("{} {}", NAME, VERSION) -} - -fn show_usage(opts: &getopts::Options) { - version(); - println!(""); - println!("Usage:"); - println!(" {} [-d DIR] TO [FROM]", NAME); - println!(" {} -V|--version", NAME); - println!(" {} -h|--help", NAME); - println!(""); - print!("{}", opts.usage( - "Convert TO destination to the relative path from the FROM dir.\n\ - If FROM path is omitted, current working dir will be used.") - ); -} diff --git a/src/rm/Cargo.toml b/src/rm/Cargo.toml deleted file mode 100644 index 953e7caf0..000000000 --- a/src/rm/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "rm" -version = "0.0.1" -authors = [] - -[lib] -name = "rm" -path = "rm.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/rm/rm.rs b/src/rm/rm.rs deleted file mode 100644 index f8a9c8d44..000000000 --- a/src/rm/rm.rs +++ /dev/null @@ -1,292 +0,0 @@ -#![crate_name = "rm"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Arcterus - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::collections::VecDeque; -use std::fs; -use std::io::{stdin, stderr, BufRead, Write}; -use std::ops::BitOr; -use std::path::{Path, PathBuf}; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/filesystem.rs"] -mod filesystem; - -use filesystem::UUPathExt; - -#[derive(Eq, PartialEq, Clone, Copy)] -enum InteractiveMode { - InteractiveNone, - InteractiveOnce, - InteractiveAlways -} - -static NAME: &'static str = "rm"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - // TODO: make getopts support -R in addition to -r - let mut opts = getopts::Options::new(); - - opts.optflag("f", "force", "ignore nonexistent files and arguments, never prompt"); - opts.optflag("i", "", "prompt before every removal"); - opts.optflag("I", "", "prompt once before removing more than three files, or when removing recursively. Less intrusive than -i, while still giving some protection against most mistakes"); - opts.optflagopt("", "interactive", "prompt according to WHEN: never, once (-I), or always (-i). Without WHEN, prompts always", "WHEN"); - opts.optflag("", "one-file-system", "when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument (NOT IMPLEMENTED)"); - opts.optflag("", "no-preserve-root", "do not treat '/' specially"); - opts.optflag("", "preserve-root", "do not remove '/' (default)"); - opts.optflag("r", "recursive", "remove directories and their contents recursively"); - opts.optflag("d", "dir", "remove empty directories"); - opts.optflag("v", "verbose", "explain what is being done"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f) - }; - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {0} [OPTION]... [FILE]...", NAME); - println!(""); - println!("{}", opts.usage("Remove (unlink) the FILE(s).")); - println!("By default, rm does not remove directories. Use the --recursive (-r)"); - println!("option to remove each listed directory, too, along with all of its contents"); - println!(""); - println!("To remove a file whose name starts with a '-', for example '-foo',"); - println!("use one of these commands:"); - println!("rm -- -foo"); - println!(""); - println!("rm ./-foo"); - println!(""); - println!("Note that if you use rm to remove a file, it might be possible to recover"); - println!("some of its contents, given sufficient expertise and/or time. For greater"); - println!("assurance that the contents are truly unrecoverable, consider using shred."); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else if matches.free.is_empty() { - show_error!("missing an argument"); - show_error!("for help, try '{0} --help'", NAME); - return 1; - } else { - let force = matches.opt_present("force"); - let interactive = - if matches.opt_present("i") { - InteractiveMode::InteractiveAlways - } else if matches.opt_present("I") { - InteractiveMode::InteractiveOnce - } else if matches.opt_present("interactive") { - match &matches.opt_str("interactive").unwrap()[..] { - "none" => InteractiveMode::InteractiveNone, - "once" => InteractiveMode::InteractiveOnce, - "always" => InteractiveMode::InteractiveAlways, - val => { - crash!(1, "Invalid argument to interactive ({})", val) - } - } - } else { - InteractiveMode::InteractiveNone - }; - let one_fs = matches.opt_present("one-file-system"); - let preserve_root = !matches.opt_present("no-preserve-root"); - let recursive = matches.opt_present("recursive"); - let dir = matches.opt_present("dir"); - let verbose = matches.opt_present("verbose"); - if interactive == InteractiveMode::InteractiveOnce && (recursive || matches.free.len() > 3) { - let msg = - if recursive { - "Remove all arguments recursively? " - } else { - "Remove all arguments? " - }; - if !prompt(msg) { - return 0; - } - } - - if remove(matches.free, force, interactive, one_fs, preserve_root, recursive, dir, verbose) { - return 1; - } - } - - 0 -} - -// TODO: implement one-file-system -#[allow(unused_variables)] -fn remove(files: Vec, force: bool, interactive: InteractiveMode, one_fs: bool, preserve_root: bool, recursive: bool, dir: bool, verbose: bool) -> bool { - let mut had_err = false; - - for filename in files.iter() { - let filename = &filename[..]; - let file = Path::new(filename); - if file.uu_exists() { - if file.uu_is_dir() { - if recursive && (filename != "/" || !preserve_root) { - if interactive != InteractiveMode::InteractiveAlways { - match fs::remove_dir_all(file) { - Err(e) => { - had_err = true; - show_error!("could not remove '{}': {}", filename, e); - }, - _ => (), - }; - } else { - let mut dirs: VecDeque = VecDeque::new(); - let mut files: Vec = Vec::new(); - let mut rmdirstack: Vec = Vec::new(); - dirs.push_back(file.to_path_buf()); - - while !dirs.is_empty() { - let dir = dirs.pop_front().unwrap(); - if !prompt(&(format!("rm: descend into directory '{}'? ", dir.display()))[..]) { - continue; - } - - // iterate over items in this directory, adding to either file or - // directory queue - match fs::read_dir(dir.as_path()) { - Ok(rdir) => { - for ent in rdir { - match ent { - Ok(ref f) => match f.file_type() { - Ok(t) => { - if t.is_dir() { - dirs.push_back(f.path()); - } else { - files.push(f.path()); - } - }, - Err(e) => { - had_err = true; - show_error!("reading '{}': {}", f.path().display(), e); - }, - }, - Err(ref e) => { - had_err = true; - show_error!("recursing into '{}': {}", filename, e); - }, - }; - } - }, - Err(e) => { - had_err = true; - show_error!("could not recurse into '{}': {}", dir.display(), e); - continue; - }, - }; - - for f in files.iter() { - had_err = remove_file(f.as_path(), interactive, verbose).bitor(had_err); - } - - files.clear(); - rmdirstack.push(dir); - } - - for d in rmdirstack.iter().rev() { - had_err = remove_dir(d.as_path(), interactive, verbose).bitor(had_err); - } - } - } else if dir && (filename != "/" || !preserve_root) { - had_err = remove_dir(&file, interactive, verbose).bitor(had_err); - } else { - if recursive { - show_error!("could not remove directory '{}'", filename); - had_err = true; - } else { - show_error!("could not remove directory '{}' (did you mean to pass '-r'?)", filename); - had_err = true; - } - } - } else { - had_err = remove_file(&file, interactive, verbose).bitor(had_err); - } - } else if !force { - show_error!("no such file or directory '{}'", filename); - had_err = true; - } - } - - had_err -} - -fn remove_dir(path: &Path, interactive: InteractiveMode, verbose: bool) -> bool { - let response = - if interactive == InteractiveMode::InteractiveAlways { - prompt_file(path, true) - } else { - true - }; - if response { - match fs::remove_dir(path) { - Ok(_) => if verbose { println!("removed '{}'", path.display()); }, - Err(e) => { - show_error!("removing '{}': {}", path.display(), e); - return true; - } - } - } - - false -} - -fn remove_file(path: &Path, interactive: InteractiveMode, verbose: bool) -> bool { - let response = - if interactive == InteractiveMode::InteractiveAlways { - prompt_file(path, false) - } else { - true - }; - if response { - match fs::remove_file(path) { - Ok(_) => if verbose { println!("removed '{}'", path.display()); }, - Err(e) => { - show_error!("removing '{}': {}", path.display(), e); - return true; - } - } - } - - false -} - -fn prompt_file(path: &Path, is_dir: bool) -> bool { - if is_dir { - prompt(&(format!("rm: remove directory '{}'? ", path.display()))[..]) - } else { - prompt(&(format!("rm: remove file '{}'? ", path.display()))[..]) - } -} - -fn prompt(msg: &str) -> bool { - stderr().write_all(msg.as_bytes()).unwrap_or(()); - stderr().flush().unwrap_or(()); - let mut buf = Vec::new(); - let stdin = stdin(); - let mut stdin = stdin.lock(); - match stdin.read_until('\n' as u8, &mut buf) { - Ok(x) if x > 0 => { - match buf[0] { - 0x59 | 0x79 => true, - _ => false, - } - } - _ => false, - } -} diff --git a/src/rmdir/Cargo.toml b/src/rmdir/Cargo.toml deleted file mode 100644 index ec6dc3639..000000000 --- a/src/rmdir/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "rmdir" -version = "0.0.1" -authors = [] - -[lib] -name = "rmdir" -path = "rmdir.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/rmdir/rmdir.rs b/src/rmdir/rmdir.rs deleted file mode 100644 index 56df54c3c..000000000 --- a/src/rmdir/rmdir.rs +++ /dev/null @@ -1,126 +0,0 @@ -#![crate_name = "rmdir"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Arcterus - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::fs; -use std::io::Write; -use std::path::Path; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "rmdir"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("", "ignore-fail-on-non-empty", "ignore each failure that is solely because a directory is non-empty"); - opts.optflag("p", "parents", "remove DIRECTORY and its ancestors; e.g., 'rmdir -p a/b/c' is similar to rmdir a/b/c a/b a"); - opts.optflag("v", "verbose", "output a diagnostic for every directory processed"); - opts.optflag("h", "help", "print this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - return 1; - } - }; - - if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: - {0} [OPTION]... DIRECTORY... - -Remove the DIRECTORY(ies), if they are empty.", NAME, VERSION); - print!("{}", opts.usage(&msg)); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else if matches.free.is_empty() { - show_error!("missing an argument"); - show_error!("for help, try '{0} --help'", NAME); - return 1; - } else { - let ignore = matches.opt_present("ignore-fail-on-non-empty"); - let parents = matches.opt_present("parents"); - let verbose = matches.opt_present("verbose"); - match remove(matches.free, ignore, parents, verbose) { - Ok(()) => ( /* pass */ ), - Err(e) => return e - } - } - - 0 -} - -fn remove(dirs: Vec, ignore: bool, parents: bool, verbose: bool) -> Result<(), i32> { - let mut r = Ok(()); - - for dir in dirs.iter() { - let path = Path::new(&dir[..]); - r = remove_dir(&path, ignore, verbose).and(r); - if parents { - let mut p = path; - loop { - let new_p = match p.parent() { - Some(p) => p, - None => break, - }; - p = new_p; - - match p.as_os_str().to_str() { - None => break, - Some(s) => match s { - "" | "." | "/" => break, - _ => (), - }, - }; - r = remove_dir(p, ignore, verbose).and(r); - } - } - } - - r -} - -fn remove_dir(path: &Path, ignore: bool, verbose: bool) -> Result<(), i32> { - let mut read_dir = match fs::read_dir(path) { - Ok(m) => m, - Err(e) => { - show_error!("reading directory '{}': {}", path.display(), e); - return Err(1); - } - }; - - let mut r = Ok(()); - - if read_dir.next().is_none() { - match fs::remove_dir(path) { - Err(e) => { - show_error!("removing directory '{}': {}", path.display(), e); - r = Err(1); - }, - Ok(_) if verbose => println!("Removed directory '{}'", path.display()), - _ => (), - } - } else if !ignore { - show_error!("failed to remove '{}': Directory not empty", path.display()); - r = Err(1); - } - - r -} diff --git a/src/seq/Cargo.toml b/src/seq/Cargo.toml deleted file mode 100644 index 4b56530a8..000000000 --- a/src/seq/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "seq" -version = "0.0.1" -authors = [] - -[lib] -name = "seq" -path = "seq.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/seq/seq.rs b/src/seq/seq.rs deleted file mode 100644 index 88fcb2e71..000000000 --- a/src/seq/seq.rs +++ /dev/null @@ -1,260 +0,0 @@ -#![crate_name = "seq"] - -// TODO: Make -w flag work with decimals -// TODO: Support -f flag - -extern crate getopts; -extern crate libc; - -use std::cmp; -use std::io::Write; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "seq"; -static VERSION: &'static str = "1.0.0"; - -#[derive(Clone)] -struct SeqOptions { - separator: String, - terminator: Option, - widths: bool -} - -fn parse_float(mut s: &str) -> Result { - if s.starts_with("+") { - s = &s[1..]; - } - match s.parse() { - Ok(n) => Ok(n), - Err(e) => Err(format!("seq: invalid floating point argument `{}`: {}", s, e)) - } -} - -fn escape_sequences(s: &str) -> String { - s.replace("\\n", "\n") - .replace("\\t", "\t") -} - -fn parse_options(args: Vec, options: &mut SeqOptions) -> Result, i32> { - let mut seq_args = vec!(); - let mut iter = args.into_iter().skip(1); - loop { - match iter.next() { - Some(arg) => match &arg[..] { - "--help" | "-h" => { - print_help(); - return Err(0); - } - "--version" | "-V" => { - print_version(); - return Err(0); - } - "-s" | "--separator" => match iter.next() { - Some(sep) => options.separator = sep, - None => { - show_error!("expected a separator after {}", arg); - return Err(1); - } - }, - "-t" | "--terminator" => match iter.next() { - Some(term) => options.terminator = Some(term), - None => { - show_error!("expected a terminator after '{}'", arg); - return Err(1); - } - }, - "-w" | "--widths" => options.widths = true, - "--" => { - seq_args.extend(iter); - break; - }, - _ => { - if arg.len() > 1 && arg.chars().next().unwrap() == '-' { - let argptr: *const String = &arg; // escape from the borrow checker - let mut chiter = unsafe { &(*argptr)[..] }.chars().skip(1); - let mut ch = ' '; - while match chiter.next() { Some(m) => { ch = m; true } None => false } { - match ch { - 'h' => { - print_help(); - return Err(0); - } - 'V' => { - print_version(); - return Err(0); - } - 's' => match iter.next() { - Some(sep) => { - options.separator = sep; - let next = chiter.next(); - if next.is_some() { - show_error!("unexpected character ('{}')", next.unwrap()); - return Err(1); - } - } - None => { - show_error!("expected a separator after {}", arg); - return Err(1); - } - }, - 't' => match iter.next() { - Some(term) => { - options.terminator = Some(term); - let next = chiter.next(); - if next.is_some() { - show_error!("unexpected character ('{}')", next.unwrap()); - return Err(1); - } - } - None => { - show_error!("expected a terminator after {}", arg); - return Err(1); - } - }, - 'w' => options.widths = true, - _ => { seq_args.push(arg); break } - } - } - } else { - seq_args.push(arg); - } - } - }, - None => break - } - } - Ok(seq_args) -} - -fn print_help() { - let mut opts = getopts::Options::new(); - - opts.optopt("s", "separator", "Separator character (defaults to \\n)", ""); - opts.optopt("t", "terminator", "Terminator character (defaults to separator)", ""); - opts.optflag("w", "widths", "Equalize widths of all numbers by padding with zeros"); - opts.optflag("h", "help", "print this help text and exit"); - opts.optflag("V", "version", "print version and exit"); - - println!("{} {}\n", NAME, VERSION); - println!("Usage:\n {} [-w] [-s string] [-t string] [first [step]] last\n", NAME); - println!("{}", opts.usage("Print sequences of numbers")); -} - -fn print_version() { - println!("{} {}", NAME, VERSION); -} - -pub fn uumain(args: Vec) -> i32 { - let mut options = SeqOptions { - separator: "\n".to_string(), - terminator: None, - widths: false - }; - let free = match parse_options(args, &mut options) { - Ok(m) => m, - Err(f) => return f - }; - if free.len() < 1 || free.len() > 3 { - crash!(1, "too {} operands.\nTry '{} --help' for more information.", - if free.len() < 1 { "few" } else { "many" }, NAME); - } - let mut largest_dec = 0; - let mut padding = 0; - let first = if free.len() > 1 { - let slice = &free[0][..]; - let len = slice.len(); - let dec = slice.find('.').unwrap_or(len); - largest_dec = len - dec; - padding = dec; - match parse_float(slice) { - Ok(n) => n, - Err(s) => { show_error!("{}", s); return 1; } - } - } else { - 1.0 - }; - let step = if free.len() > 2 { - let slice = &free[1][..]; - let len = slice.len(); - let dec = slice.find('.').unwrap_or(len); - largest_dec = cmp::max(largest_dec, len - dec); - padding = cmp::max(padding, dec); - match parse_float(slice) { - Ok(n) => n, - Err(s) => { show_error!("{}", s); return 1; } - } - } else { - 1.0 - }; - let last = { - let slice = &free[free.len() - 1][..]; - padding = cmp::max(padding, slice.find('.').unwrap_or(slice.len())); - match parse_float(slice) { - Ok(n) => n, - Err(s) => { show_error!("{}", s); return 1; } - } - }; - let separator = escape_sequences(&options.separator[..]); - let terminator = match options.terminator { - Some(term) => escape_sequences(&term[..]), - None => separator.clone() - }; - print_seq(first, step, last, largest_dec, separator, terminator, options.widths, padding); - - 0 -} - -#[inline(always)] -fn done_printing(next: f64, step: f64, last: f64) -> bool { - if step >= 0f64 { - next > last - } else { - next < last - } -} - -fn print_seq(first: f64, step: f64, last: f64, largest_dec: usize, separator: String, terminator: String, pad: bool, padding: usize) { - let mut i = 0isize; - let mut value = first + i as f64 * step; - while !done_printing(value, step, last) { - let istr = value.to_string(); - let ilen = istr.len(); - let before_dec = istr.find('.').unwrap_or(ilen); - if pad && before_dec < padding { - for _ in 0..(padding - before_dec) { - if !pipe_print!("0") { - return; - } - } - } - pipe_print!("{}", istr); - let mut idec = ilen - before_dec; - if idec < largest_dec { - if idec == 0 { - if !pipe_print!(".") { - return; - } - idec += 1; - } - for _ in idec..largest_dec { - if !pipe_print!("0") { - return; - } - } - } - i += 1; - value = first + i as f64 * step; - if !done_printing(value, step, last) { - if !pipe_print!("{}", separator) { - return; - } - } - } - if (first >= last && step < 0f64) || (first <= last && step > 0f64) { - pipe_print!("{}", terminator); - } - pipe_flush!(); -} diff --git a/src/shuf/Cargo.toml b/src/shuf/Cargo.toml deleted file mode 100644 index 81101d39f..000000000 --- a/src/shuf/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "shuf" -version = "0.0.1" -authors = [] - -[lib] -name = "shuf" -path = "shuf.rs" - -[dependencies] -getopts = "*" -libc = "*" -rand = "*" diff --git a/src/shuf/deps.mk b/src/shuf/deps.mk deleted file mode 100644 index ea0f8a6b8..000000000 --- a/src/shuf/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += rand diff --git a/src/shuf/shuf.rs b/src/shuf/shuf.rs deleted file mode 100644 index b4ea0ebbe..000000000 --- a/src/shuf/shuf.rs +++ /dev/null @@ -1,269 +0,0 @@ -#![crate_name = "shuf"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Arcterus - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; -extern crate rand; - -use rand::{Rng, ThreadRng}; -use rand::read::ReadRng; -use std::fs::File; -use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write}; -use std::usize::MAX as MAX_USIZE; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -enum Mode { - Default, - Echo, - InputRange((usize, usize)) -} - -static NAME: &'static str = "shuf"; -static VERSION: &'static str = "0.0.1"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - opts.optflag("e", "echo", "treat each ARG as an input line"); - opts.optopt("i", "input-range", "treat each number LO through HI as an input line", "LO-HI"); - opts.optopt("n", "head-count", "output at most COUNT lines", "COUNT"); - opts.optopt("o", "output", "write result to FILE instead of standard output", "FILE"); - opts.optopt("", "random-source", "get random bytes from FILE", "FILE"); - opts.optflag("r", "repeat", "output lines can be repeated"); - opts.optflag("z", "zero-terminated", "end lines with 0 byte, not newline"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - let mut matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - crash!(1, "{}", f) - } - }; - if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: - {0} [OPTION]... [FILE] - {0} -e [OPTION]... [ARG]... - {0} -i LO-HI [OPTION]... - -Write a random permutation of the input lines to standard output. -With no FILE, or when FILE is -, read standard input.", NAME, VERSION); - print!("{}", opts.usage(&msg)); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else { - let echo = matches.opt_present("echo"); - let mode = match matches.opt_str("input-range") { - Some(range) => { - if echo { - show_error!("cannot specify more than one mode"); - return 1; - } - match parse_range(range) { - Ok(m) => Mode::InputRange(m), - Err(msg) => { - crash!(1, "{}", msg); - }, - } - } - None => { - if echo { - Mode::Echo - } else { - if matches.free.len() == 0 { - matches.free.push("-".to_string()); - } else if matches.free.len() > 1 { - show_error!("extra operand '{}'", &matches.free[1][..]); - } - Mode::Default - } - } - }; - let repeat = matches.opt_present("repeat"); - let sep = if matches.opt_present("zero-terminated") { - 0x00 as u8 - } else { - 0x0a as u8 - }; - let count = match matches.opt_str("head-count") { - Some(cnt) => match cnt.parse::() { - Ok(val) => val, - Err(e) => { - show_error!("'{}' is not a valid count: {}", cnt, e); - return 1; - } - }, - None => MAX_USIZE, - }; - let output = matches.opt_str("output"); - let random = matches.opt_str("random-source"); - - match mode { - Mode::Echo => { - // XXX: this doesn't correctly handle non-UTF-8 cmdline args - let mut evec = matches.free.iter().map(|a| a.as_bytes()).collect::>(); - find_seps(&mut evec, sep); - shuf_bytes(&mut evec, repeat, count, sep, output, random); - }, - Mode::InputRange((b, e)) => { - let rvec = (b..e).map(|x| format!("{}", x)).collect::>(); - let mut rvec = rvec.iter().map(|a| a.as_bytes()).collect::>(); - shuf_bytes(&mut rvec, repeat, count, sep, output, random); - }, - Mode::Default => { - let fdata = read_input_file(&matches.free[0][..]); - let mut fdata = vec!(&fdata[..]); - find_seps(&mut fdata, sep); - shuf_bytes(&mut fdata, repeat, count, sep, output, random); - } - } - } - - 0 -} - -fn read_input_file(filename: &str) -> Vec { - let mut file = BufReader::new( - if filename == "-" { - Box::new(stdin()) as Box - } else { - match File::open(filename) { - Ok(f) => Box::new(f) as Box, - Err(e) => crash!(1, "failed to open '{}': {}", filename, e), - } - }); - - let mut data = Vec::new(); - match file.read_to_end(&mut data) { - Err(e) => crash!(1, "failed reading '{}': {}", filename, e), - Ok(_) => (), - }; - - data -} - -fn find_seps(data: &mut Vec<&[u8]>, sep: u8) { - // need to use for loop so we don't borrow the vector as we modify it in place - // basic idea: - // * We don't care about the order of the result. This lets us slice the slices - // without making a new vector. - // * Starting from the end of the vector, we examine each element. - // * If that element contains the separator, we remove it from the vector, - // and then sub-slice it into slices that do not contain the separator. - // * We maintain the invariant throughout that each element in the vector past - // the ith element does not have any separators remaining. - for i in (0..data.len()).rev() { - if data[i].contains(&sep) { - let this = data.swap_remove(i); - let mut p = 0; - let mut i = 1; - loop { - if i == this.len() { - break; - } - - if this[i] == sep { - data.push(&this[p..i]); - p = i + 1; - } - i += 1; - } - if p < this.len() { - data.push(&this[p..i]); - } - } - } -} - -fn shuf_bytes(input: &mut Vec<&[u8]>, repeat: bool, count: usize, sep: u8, output: Option, random: Option) { - let mut output = BufWriter::new( - match output { - None => Box::new(stdout()) as Box, - Some(s) => match File::create(&s[..]) { - Ok(f) => Box::new(f) as Box, - Err(e) => crash!(1, "failed to open '{}' for writing: {}", &s[..], e), - }, - }); - - let mut rng = match random { - Some(r) => WrappedRng::RngFile(rand::read::ReadRng::new(match File::open(&r[..]) { - Ok(f) => f, - Err(e) => crash!(1, "failed to open random source '{}': {}", &r[..], e), - })), - None => WrappedRng::RngDefault(rand::thread_rng()), - }; - - // we're generating a random usize. To keep things fair, we take this number mod ceil(log2(length+1)) - let mut len_mod = 1; - let mut len = input.len(); - while len > 0 { - len >>= 1; - len_mod <<= 1; - } - drop(len); - - let mut count = count; - while count > 0 && input.len() > 0 { - let mut r = input.len(); - while r >= input.len() { - r = rng.next_usize() % len_mod; - } - - // write the randomly chosen value and the separator - output.write_all(input[r]).unwrap_or_else(|e| crash!(1, "write failed: {}", e)); - output.write_all(&[sep]).unwrap_or_else(|e| crash!(1, "write failed: {}", e)); - - // if we do not allow repeats, remove the chosen value from the input vector - if !repeat { - // shrink the mask if we will drop below a power of 2 - if input.len() % 2 == 0 && len_mod > 2 { - len_mod >>= 1; - } - input.swap_remove(r); - } - - count -= 1; - } -} - -fn parse_range(input_range: String) -> Result<(usize, usize), String> { - let split: Vec<&str> = input_range.split('-').collect(); - if split.len() != 2 { - Err("invalid range format".to_string()) - } else { - let begin = match split[0].parse::() { - Ok(m) => m, - Err(e)=> return Err(format!("{} is not a valid number: {}", split[0], e)), - }; - let end = match split[1].parse::() { - Ok(m) => m, - Err(e)=> return Err(format!("{} is not a valid number: {}", split[1], e)), - }; - Ok((begin, end + 1)) - } -} - -enum WrappedRng { - RngFile(rand::read::ReadRng), - RngDefault(rand::ThreadRng), -} - -impl WrappedRng { - fn next_usize(&mut self) -> usize { - match self { - &mut WrappedRng::RngFile(ref mut r) => r.next_u32() as usize, - &mut WrappedRng::RngDefault(ref mut r) => r.next_u32() as usize, - } - } -} diff --git a/src/sleep/Cargo.toml b/src/sleep/Cargo.toml deleted file mode 100644 index 6c29d728d..000000000 --- a/src/sleep/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "sleep" -version = "0.0.1" -authors = [] - -[lib] -name = "sleep" -path = "sleep.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/sleep/sleep.rs b/src/sleep/sleep.rs deleted file mode 100644 index 70abc233e..000000000 --- a/src/sleep/sleep.rs +++ /dev/null @@ -1,81 +0,0 @@ -#![crate_name = "sleep"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Arcterus - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::io::Write; -use std::thread::sleep_ms; -use std::u32::MAX as U32_MAX; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/parse_time.rs"] -mod parse_time; - -static NAME: &'static str = "sleep"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - return 1; - } - }; - - if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: - {0} NUMBER[SUFFIX] -or - {0} OPTION - -Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default), -'m' for minutes, 'h' for hours or 'd' for days. Unlike most implementations -that require NUMBER be an integer, here NUMBER may be an arbitrary floating -point number. Given two or more arguments, pause for the amount of time -specified by the sum of their values.", NAME, VERSION); - print!("{}", opts.usage(&msg)); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else if matches.free.is_empty() { - show_error!("missing an argument"); - show_error!("for help, try '{0} --help'", NAME); - return 1; - } else { - sleep(matches.free); - } - - 0 -} - -fn sleep(args: Vec) { - let sleep_time = args.iter().fold(0.0, |result, arg| - match parse_time::from_str(&arg[..]) { - Ok(m) => m + result, - Err(f) => crash!(1, "{}", f), - }); - - let sleep_dur = if sleep_time > (U32_MAX as f64) { - U32_MAX - } else { - (1000.0 * sleep_time) as u32 - }; - sleep_ms(sleep_dur); -} diff --git a/src/sort/Cargo.toml b/src/sort/Cargo.toml deleted file mode 100644 index c88e0b7fb..000000000 --- a/src/sort/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "sort" -version = "0.0.1" -authors = [] - -[lib] -name = "sort" -path = "sort.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/sort/sort.rs b/src/sort/sort.rs deleted file mode 100644 index 03b830593..000000000 --- a/src/sort/sort.rs +++ /dev/null @@ -1,210 +0,0 @@ -#![crate_name = "sort"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Michael Yin - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#![allow(dead_code)] - -extern crate getopts; -extern crate libc; - -use libc::consts::os::posix88::STDIN_FILENO; -use libc::funcs::posix88::unistd::isatty; -use libc::types::os::arch::c95::c_int; -use std::cmp::Ordering; -use std::fs::File; -use std::io::{BufRead, BufReader, Read, stdin, Write}; -use std::path::Path; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "sort"; -static VERSION: &'static str = "0.0.1"; - -static DECIMAL_PT: char = '.'; -static THOUSANDS_SEP: char = ','; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("n", "numeric-sort", "compare according to string numerical value"); - opts.optflag("H", "human-readable-sort", "compare according to human readable sizes, eg 1M > 100k"); - opts.optflag("r", "reverse", "reverse the output"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f) - }; - if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: - {0} [OPTION]... [FILE]... - -Write the sorted concatenation of all FILE(s) to standard output. - -Mandatory arguments for long options are mandatory for short options too. - -With no FILE, or when FILE is -, read standard input.", NAME, VERSION); - print!("{}", opts.usage(&msg)); - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let numeric = matches.opt_present("numeric-sort"); - let human_readable = matches.opt_present("human-readable-sort"); - let reverse = matches.opt_present("reverse"); - - let mut files = matches.free; - if files.is_empty() { - /* if no file, default to stdin */ - files.push("-".to_string()); - } - - exec(files, numeric, human_readable, reverse); - - 0 -} - -fn exec(files: Vec, numeric: bool, human_readable: bool, reverse: bool) { - for path in files.iter() { - let (reader, _) = match open(path) { - Some(x) => x, - None => continue, - }; - - let buf_reader = BufReader::new(reader); - let mut lines = Vec::new(); - - for line in buf_reader.lines() { - match line { - Ok(n) => { - lines.push(n); - }, - _ => break - } - } - - if numeric { - lines.sort_by(numeric_compare); - } else if human_readable { - lines.sort_by(human_readable_size_compare); - } else { - lines.sort(); - } - - let iter = lines.iter(); - if reverse { - print_sorted(iter.rev()); - } else { - print_sorted(iter) - }; - } -} - -/// Parse the beginning string into an f64, returning -inf instead of NaN on errors. -fn permissive_f64_parse(a: &String) -> f64{ - //Maybe should be split on non-digit, but then 10e100 won't parse properly. - //On the flip side, this will give NEG_INFINITY for "1,234", which might be OK - //because there's no way to handle both CSV and thousands separators without a new flag. - //GNU sort treats "1,234" as "1" in numeric, so maybe it's fine. - let sa: &str = a.split_whitespace().next().unwrap(); - match sa.parse::() { - Ok(a) => a, - Err(_) => std::f64::NEG_INFINITY - } -} - -/// Compares two floating point numbers, with errors being assumned to be -inf. -/// Stops coercing at the first whitespace char, so 1e2 will parse as 100 but -/// 1,000 will parse as -inf. -fn numeric_compare(a: &String, b: &String) -> Ordering { - let fa = permissive_f64_parse(a); - let fb = permissive_f64_parse(b); - //f64::cmp isn't implemented because NaN messes with it - //but we sidestep that with permissive_f64_parse so just fake it - if fa > fb { - return Ordering::Greater; - } - else if fa < fb { - return Ordering::Less; - } - else { - return Ordering::Equal; - } -} - -fn human_readable_convert(a: &String) -> f64 { - let int_iter = a.chars(); - let suffix_iter = a.chars(); - let int_str: String = int_iter.take_while(|c| c.is_numeric()).collect(); - let suffix = suffix_iter.skip_while(|c| c.is_numeric()).next(); - let int_part = match int_str.parse::() { - Ok(i) => i, - Err(_) => -1f64 - } as f64; - let suffix: f64 = match suffix.unwrap_or('\0') { - 'K' => 1000f64, - 'M' => 1E6, - 'G' => 1E9, - 'T' => 1E12, - 'P' => 1E15, - _ => 1f64 - }; - return int_part * suffix; -} - -/// Compare two strings as if they are human readable sizes. -/// AKA 1M > 100k -fn human_readable_size_compare(a: &String, b: &String) -> Ordering { - let fa = human_readable_convert(a); - let fb = human_readable_convert(b); - if fa > fb { - return Ordering::Greater; - } - else if fa < fb { - return Ordering::Less; - } - else { - return Ordering::Equal; - } - -} - -#[inline(always)] -fn print_sorted>(iter: T) where S: std::fmt::Display { - for line in iter { - println!("{}", line); - } -} - -// from cat.rs -fn open<'a>(path: &str) -> Option<(Box, bool)> { - if path == "-" { - let stdin = stdin(); - let interactive = unsafe { isatty(STDIN_FILENO) } != 0 as c_int; - return Some((Box::new(stdin) as Box, interactive)); - } - - match File::open(Path::new(path)) { - Ok(f) => Some((Box::new(f) as Box, false)), - Err(e) => { - show_error!("sort: {0}: {1}", path, e.to_string()); - None - }, - } -} diff --git a/src/split/Cargo.toml b/src/split/Cargo.toml deleted file mode 100644 index 3c0d0de3b..000000000 --- a/src/split/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "split" -version = "0.0.1" -authors = [] - -[lib] -name = "split" -path = "split.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/split/README.md b/src/split/README.md deleted file mode 100644 index 582c9970a..000000000 --- a/src/split/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Rudimentary "split" Implementation - -## Missing Features - -### Flags -* `--verbose` - created file printing is implemented, don't know if there is anything else - -## Possible Optimizations -* Use slice (`[u8]`) directly as the `control.current_line`. diff --git a/src/split/deps.mk b/src/split/deps.mk deleted file mode 100644 index 62b0140cc..000000000 --- a/src/split/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += aho-corasick memchr rand regex regex-syntax diff --git a/src/split/split.rs b/src/split/split.rs deleted file mode 100644 index 08d57cd18..000000000 --- a/src/split/split.rs +++ /dev/null @@ -1,317 +0,0 @@ -#![crate_name = "split"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Akira Hayakawa - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::char; -use std::fs::{File, OpenOptions}; -use std::io::{BufRead, BufReader, BufWriter, Read, stdin, stdout, Write}; -use std::path::Path; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "split"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optopt("a", "suffix-length", "use suffixes of length N (default 2)", "N"); - opts.optopt("b", "bytes", "put SIZE bytes per output file", "SIZE"); - opts.optopt("C", "line-bytes", "put at most SIZE bytes of lines per output file", "SIZE"); - opts.optflag("d", "numeric-suffixes", "use numeric suffixes instead of alphabetic"); - opts.optopt("l", "lines", "put NUMBER lines per output file", "NUMBER"); - opts.optflag("", "verbose", "print a diagnostic just before each output file is opened"); - opts.optflag("h", "help", "display help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f) - }; - - if matches.opt_present("h") { - let msg = format!("{0} {1} - -Usage: - {0} [OPTION]... [INPUT [PREFIX]] - -Output fixed-size pieces of INPUT to PREFIXaa, PREFIX ab, ...; default -size is 1000, and default PREFIX is 'x'. With no INPUT, or when INPUT is --, read standard input.", NAME, VERSION); - - println!("{}\nSIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.", opts.usage(&msg)); - return 0; - } - - if matches.opt_present("V") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let mut settings = Settings { - prefix: "".to_string(), - numeric_suffix: false, - suffix_length: 0, - input: "".to_string(), - strategy: "".to_string(), - strategy_param: "".to_string(), - verbose: false, - }; - - settings.numeric_suffix = if matches.opt_present("d") { true } else { false }; - - settings.suffix_length = match matches.opt_str("a") { - Some(n) => match n.parse() { - Ok(m) => m, - Err(e) => crash!(1, "cannot parse num: {}", e) - }, - None => 2 - }; - - settings.verbose = if matches.opt_present("verbose") { true } else { false }; - - settings.strategy = "l".to_string(); - settings.strategy_param = "1000".to_string(); - let strategies = vec!["b", "C", "l"]; - for e in strategies.iter() { - match matches.opt_str(*e) { - Some(a) => { - if settings.strategy == "l" { - settings.strategy = e.to_string(); - settings.strategy_param = a; - } else { - crash!(1, "{}: cannot split in more than one way", NAME) - } - }, - None => {} - } - } - - let mut v = matches.free.iter(); - let (input, prefix) = match (v.next(), v.next()) { - (Some(a), None) => (a.to_string(), "x".to_string()), - (Some(a), Some(b)) => (a.to_string(), b.to_string()), - (None, _) => ("-".to_string(), "x".to_string()), - }; - settings.input = input; - settings.prefix = prefix; - - split(&settings) -} - -struct Settings { - prefix: String, - numeric_suffix: bool, - suffix_length: usize, - input: String, - strategy: String, - strategy_param: String, - verbose: bool, -} - -struct SplitControl { - current_line: String, // Don't touch - request_new_file: bool, // Splitter implementation requests new file -} - -trait Splitter { - // Consume the current_line and return the consumed string - fn consume(&mut self, &mut SplitControl) -> String; -} - -struct LineSplitter { - saved_lines_to_write: usize, - lines_to_write: usize, -} - -impl LineSplitter { - fn new(settings: &Settings) -> Box { - let n = match settings.strategy_param.parse() { - Ok(a) => a, - Err(e) => crash!(1, "invalid number of lines: {}", e) - }; - Box::new(LineSplitter { - saved_lines_to_write: n, - lines_to_write: n, - }) as Box - } - -} - -impl Splitter for LineSplitter { - fn consume(&mut self, control: &mut SplitControl) -> String { - self.lines_to_write -= 1; - if self.lines_to_write == 0 { - self.lines_to_write = self.saved_lines_to_write; - control.request_new_file = true; - } - control.current_line.clone() - } -} - -struct ByteSplitter { - saved_bytes_to_write: usize, - bytes_to_write: usize, - break_on_line_end: bool, - require_whole_line: bool, -} - -impl ByteSplitter { - fn new(settings: &Settings) -> Box { - let mut strategy_param : Vec = settings.strategy_param.chars().collect(); - let suffix = strategy_param.pop().unwrap(); - let multiplier = match suffix { - '0'...'9' => 1usize, - 'b' => 512usize, - 'k' => 1024usize, - 'm' => 1024usize * 1024usize, - _ => crash!(1, "invalid number of bytes") - }; - let n = if suffix.is_alphabetic() { - match strategy_param.iter().map(|c| *c).collect::().parse::() { - Ok(a) => a, - Err(e) => crash!(1, "invalid number of bytes: {}", e) - } - } else { - match settings.strategy_param.parse::() { - Ok(a) => a, - Err(e) => crash!(1, "invalid number of bytes: {}", e) - } - }; - Box::new(ByteSplitter { - saved_bytes_to_write: n * multiplier, - bytes_to_write: n * multiplier, - break_on_line_end: if settings.strategy == "b" { false } else { true }, - require_whole_line: false, - }) as Box - } -} - -impl Splitter for ByteSplitter { - fn consume(&mut self, control: &mut SplitControl) -> String { - let line = control.current_line.clone(); - let n = std::cmp::min(line.chars().count(), self.bytes_to_write); - if self.require_whole_line && n < line.chars().count() { - self.bytes_to_write = self.saved_bytes_to_write; - control.request_new_file = true; - self.require_whole_line = false; - return line[0..0].to_string(); - } - self.bytes_to_write -= n; - if n == 0 { - self.bytes_to_write = self.saved_bytes_to_write; - control.request_new_file = true; - } - if self.break_on_line_end && n == line.chars().count() { - self.require_whole_line = self.break_on_line_end; - } - line[..n].to_string() - } -} - -// (1, 3) -> "aab" -fn str_prefix(i: usize, width: usize) -> String { - let mut c = "".to_string(); - let mut n = i; - let mut w = width; - while w > 0 { - w -= 1; - let div = 26usize.pow(w as u32); - let r = n / div; - n -= r * div; - c.push(char::from_u32((r as u32) + 97).unwrap()); - } - c -} - -// (1, 3) -> "001" -fn num_prefix(i: usize, width: usize) -> String { - let mut c = "".to_string(); - let mut n = i; - let mut w = width; - while w > 0 { - w -= 1; - let div = 10usize.pow(w as u32); - let r = n / div; - n -= r * div; - c.push(char::from_digit(r as u32, 10).unwrap()); - } - c -} - -fn split(settings: &Settings) -> i32 { - let mut reader = BufReader::new( - if settings.input == "-" { - Box::new(stdin()) as Box - } else { - let r = match File::open(Path::new(&settings.input)) { - Ok(a) => a, - Err(_) => crash!(1, "cannot open '{}' for reading: No such file or directory", settings.input) - }; - Box::new(r) as Box - } - ); - - let mut splitter: Box = - match settings.strategy.as_ref() { - "l" => LineSplitter::new(settings), - "b" | "C" => ByteSplitter::new(settings), - a @ _ => crash!(1, "strategy {} not supported", a) - }; - - let mut control = SplitControl { - current_line: "".to_string(), // Request new line - request_new_file: true, // Request new file - }; - - let mut writer = BufWriter::new(Box::new(stdout()) as Box); - let mut fileno = 0; - loop { - if control.current_line.chars().count() == 0 { - match reader.read_line(&mut control.current_line) { - Ok(0) | Err(_) => break, - _ => {} - } - } - - if control.request_new_file { - let mut filename = settings.prefix.clone(); - filename.push_str(if settings.numeric_suffix { - num_prefix(fileno, settings.suffix_length) - } else { - str_prefix(fileno, settings.suffix_length) - }.as_ref()); - - if fileno != 0 { - crash_if_err!(1, writer.flush()); - } - fileno += 1; - writer = BufWriter::new(Box::new(OpenOptions::new().write(true).create(true).open(Path::new(&filename)).unwrap()) as Box); - control.request_new_file = false; - if settings.verbose { - println!("creating file '{}'", filename); - } - } - - let consumed = splitter.consume(&mut control); - crash_if_err!(1, writer.write_all(consumed.as_bytes())); - - let advance = consumed.chars().count(); - let clone = control.current_line.clone(); - let sl = clone; - control.current_line = sl[advance..sl.chars().count()].to_string(); - } - 0 -} diff --git a/src/stdbuf/libstdbuf.c b/src/stdbuf/libstdbuf.c deleted file mode 100644 index b7ee1370f..000000000 --- a/src/stdbuf/libstdbuf.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "libstdbuf.h" - -void __attribute ((constructor)) -stdbuf_init (void) -{ - stdbuf(); -} diff --git a/src/stdbuf/libstdbuf.h b/src/stdbuf/libstdbuf.h deleted file mode 100644 index d8ae3c70a..000000000 --- a/src/stdbuf/libstdbuf.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef UUTILS_LIBSTDBUF_H -#define UUTILS_LIBSTDBUF_H - -void stdbuf(void); - -#endif diff --git a/src/stdbuf/libstdbuf.rs b/src/stdbuf/libstdbuf.rs deleted file mode 100644 index 6ff620a99..000000000 --- a/src/stdbuf/libstdbuf.rs +++ /dev/null @@ -1,57 +0,0 @@ -#![crate_name = "libstdbuf"] -#![crate_type = "staticlib"] - -extern crate libc; - -use libc::{c_int, size_t, c_char, FILE, _IOFBF, _IONBF, _IOLBF, setvbuf}; -use std::env; -use std::io::Write; -use std::ptr; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -extern { - static stdin: *mut FILE; - static stdout: *mut FILE; - static stderr: *mut FILE; -} - -static NAME: &'static str = "libstdbuf"; - -fn set_buffer(stream: *mut FILE, value: &str) { - let (mode, size): (c_int, size_t) = match value { - "0" => (_IONBF, 0 as size_t), - "L" => (_IOLBF, 0 as size_t), - input => { - let buff_size: usize = match input.parse() { - Ok(num) => num, - Err(e) => crash!(1, "incorrect size of buffer!: {}", e) - }; - (_IOFBF, buff_size as size_t) - } - }; - let res: c_int; - unsafe { - let buffer: *mut c_char = ptr::null_mut(); - assert!(buffer.is_null()); - res = libc::setvbuf(stream, buffer, mode, size); - } - if res != 0 { - crash!(res, "error while calling setvbuf!"); - } -} - -#[no_mangle] -pub extern fn stdbuf() { - if let Ok(val) = env::var("_STDBUF_E") { - set_buffer(stderr, &val); - } - if let Ok(val) = env::var("_STDBUF_I") { - set_buffer(stdin, &val); - } - if let Ok(val) = env::var("_STDBUF_O") { - set_buffer(stdout, &val); - } -} diff --git a/src/stdbuf/stdbuf.rs b/src/stdbuf/stdbuf.rs deleted file mode 100644 index ecb30fa76..000000000 --- a/src/stdbuf/stdbuf.rs +++ /dev/null @@ -1,272 +0,0 @@ -#![crate_name = "stdbuf"] - -/* -* This file is part of the uutils coreutils package. -* -* (c) Dorota Kapturkiewicz -* -* For the full copyright and license information, please view the LICENSE -* file that was distributed with this source code. -*/ - -extern crate getopts; -extern crate libc; - -use getopts::{Matches, Options}; -use std::env; -use std::io::{self, Write}; -use std::os::unix::process::ExitStatusExt; -use std::path::PathBuf; -use std::process::Command; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/filesystem.rs"] -mod filesystem; - -use filesystem::{canonicalize, CanonicalizeMode, UUPathExt}; - -static NAME: &'static str = "stdbuf"; -static VERSION: &'static str = "1.0.0"; -static LIBSTDBUF: &'static str = "libstdbuf"; - -enum BufferType { - Default, - Line, - Size(u64) -} - -struct ProgramOptions { - stdin: BufferType, - stdout: BufferType, - stderr: BufferType, -} - -enum ErrMsg { - Retry, - Fatal -} - -enum OkMsg { - Buffering, - Help, - Version -} - -#[cfg(target_os = "linux")] -fn preload_strings() -> (&'static str, &'static str) { - ("LD_PRELOAD", ".so") -} - -#[cfg(target_os = "macos")] -fn preload_strings() -> (&'static str, &'static str) { - ("DYLD_LIBRARY_PATH", ".dylib") -} - -#[cfg(not(any(target_os = "linux", target_os = "macos")))] -fn preload_strings() -> (&'static str, &'static str) { - crash!(1, "Command not supported for this operating system!") -} - -fn print_version() { - println!("{} {}", NAME, VERSION); -} - -fn print_usage(opts: &Options) { - let brief = - "Run COMMAND, with modified buffering operations for its standard streams\n \ - Mandatory arguments to long options are mandatory for short options too."; - let explanation = - "If MODE is 'L' the corresponding stream will be line buffered.\n \ - This option is invalid with standard input.\n\n \ - If MODE is '0' the corresponding stream will be unbuffered.\n\n \ - Otherwise MODE is a number which may be followed by one of the following:\n\n \ - KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.\n \ - In this case the corresponding stream will be fully buffered with the buffer size set to MODE bytes.\n\n \ - NOTE: If COMMAND adjusts the buffering of its standard streams ('tee' does for e.g.) then that will override \ - corresponding settings changed by 'stdbuf'.\n \ - Also some filters (like 'dd' and 'cat' etc.) don't use streams for I/O, \ - and are thus unaffected by 'stdbuf' settings.\n"; - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage: stdbuf OPTION... COMMAND"); - println!(""); - println!("{}\n{}", opts.usage(brief), explanation); -} - -fn parse_size(size: &str) -> Option { - let ext = size.trim_left_matches(|c: char| c.is_digit(10)); - let num = size.trim_right_matches(|c: char| c.is_alphabetic()); - let mut recovered = num.to_string(); - recovered.push_str(ext); - if recovered != size { - return None; - } - let buf_size: u64 = match num.parse().ok() { - Some(m) => m, - None => return None, - }; - let (power, base): (u32, u64) = match ext { - "" => (0, 0), - "KB" => (1, 1024), - "K" => (1, 1000), - "MB" => (2, 1024), - "M" => (2, 1000), - "GB" => (3, 1024), - "G" => (3, 1000), - "TB" => (4, 1024), - "T" => (4, 1000), - "PB" => (5, 1024), - "P" => (5, 1000), - "EB" => (6, 1024), - "E" => (6, 1000), - "ZB" => (7, 1024), - "Z" => (7, 1000), - "YB" => (8, 1024), - "Y" => (8, 1000), - _ => return None, - }; - Some(buf_size * base.pow(power)) -} - -fn check_option(matches: &Matches, name: &str, modified: &mut bool) -> Option { - match matches.opt_str(name) { - Some(value) => { - *modified = true; - match &value[..] { - "L" => { - if name == "input" { - show_info!("line buffering stdin is meaningless"); - None - } else { - Some(BufferType::Line) - } - }, - x => { - let size = match parse_size(x) { - Some(m) => m, - None => { show_error!("Invalid mode {}", x); return None } - }; - Some(BufferType::Size(size)) - }, - } - }, - None => Some(BufferType::Default), - } -} - -fn parse_options(args: &[String], options: &mut ProgramOptions, optgrps: &Options) -> Result { - let matches = match optgrps.parse(args) { - Ok(m) => m, - Err(_) => return Err(ErrMsg::Retry) - }; - if matches.opt_present("help") { - return Ok(OkMsg::Help); - } - if matches.opt_present("version") { - return Ok(OkMsg::Version); - } - let mut modified = false; - options.stdin = try!(check_option(&matches, "input", &mut modified).ok_or(ErrMsg::Fatal)); - options.stdout = try!(check_option(&matches, "output", &mut modified).ok_or(ErrMsg::Fatal)); - options.stderr = try!(check_option(&matches, "error", &mut modified).ok_or(ErrMsg::Fatal)); - - if matches.free.len() != 1 { - return Err(ErrMsg::Retry); - } - if !modified { - show_error!("you must specify a buffering mode option"); - return Err(ErrMsg::Fatal); - } - Ok(OkMsg::Buffering) -} - -fn set_command_env(command: &mut Command, buffer_name: &str, buffer_type: BufferType) { - match buffer_type { - BufferType::Size(m) => { command.env(buffer_name, m.to_string()); }, - BufferType::Line => { command.env(buffer_name, "L"); }, - BufferType::Default => {}, - } -} - -fn exe_path() -> io::Result { - let exe_path = try!(env::current_exe()); - let absolute_path = try!(canonicalize(exe_path, CanonicalizeMode::Normal)); - Ok(match absolute_path.parent() { - Some(p) => p.to_path_buf(), - None => absolute_path.clone() - }) -} - -fn get_preload_env() -> (String, String) { - let (preload, extension) = preload_strings(); - let mut libstdbuf = LIBSTDBUF.to_string(); - libstdbuf.push_str(extension); - // First search for library in directory of executable. - let mut path = exe_path().unwrap_or_else(|_| crash!(1, "Impossible to fetch the path of this executable.")); - path.push(libstdbuf.clone()); - if path.uu_exists() { - match path.as_os_str().to_str() { - Some(s) => { return (preload.to_string(), s.to_string()); }, - None => crash!(1, "Error while converting path.") - }; - } - // We assume library is in LD_LIBRARY_PATH/ DYLD_LIBRARY_PATH. - (preload.to_string(), libstdbuf) -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - - opts.optopt("i", "input", "adjust standard input stream buffering", "MODE"); - opts.optopt("o", "output", "adjust standard output stream buffering", "MODE"); - opts.optopt("e", "error", "adjust standard error stream buffering", "MODE"); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); - - let mut options = ProgramOptions {stdin: BufferType::Default, stdout: BufferType::Default, stderr: BufferType::Default}; - let mut command_idx: i32 = -1; - for i in 1 .. args.len()+1 { - match parse_options(&args[1 .. i], &mut options, &opts) { - Ok(OkMsg::Buffering) => { - command_idx = (i as i32) - 1; - break; - }, - Ok(OkMsg::Help) => { - print_usage(&opts); - return 0; - }, - Ok(OkMsg::Version) => { - print_version(); - return 0; - }, - Err(ErrMsg::Fatal) => break, - Err(ErrMsg::Retry) => continue, - } - }; - if command_idx == -1 { - crash!(125, "Invalid options\nTry 'stdbuf --help' for more information."); - } - let ref command_name = args[command_idx as usize]; - let mut command = Command::new(command_name); - let (preload_env, libstdbuf) = get_preload_env(); - command.args(&args[(command_idx as usize) + 1 ..]).env(preload_env, libstdbuf); - set_command_env(&mut command, "_STDBUF_I", options.stdin); - set_command_env(&mut command, "_STDBUF_O", options.stdout); - set_command_env(&mut command, "_STDBUF_E", options.stderr); - let mut process = match command.spawn() { - Ok(p) => p, - Err(e) => crash!(1, "failed to execute process: {}", e) - }; - match process.wait() { - Ok(status) => { - match status.code() { - Some(i) => return i, - None => crash!(1, "process killed by signal {}", status.signal().unwrap()), - } - }, - Err(e) => crash!(1, "{}", e) - }; -} diff --git a/src/sum/Cargo.toml b/src/sum/Cargo.toml deleted file mode 100644 index 7655fd221..000000000 --- a/src/sum/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "sum" -version = "0.0.1" -authors = [] - -[lib] -name = "sum" -path = "sum.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/sum/sum.rs b/src/sum/sum.rs deleted file mode 100644 index 75f25adee..000000000 --- a/src/sum/sum.rs +++ /dev/null @@ -1,140 +0,0 @@ -#![crate_name = "sum"] - -/* -* This file is part of the uutils coreutils package. -* -* (c) T. Jameson Little -* -* For the full copyright and license information, please view the LICENSE file -* that was distributed with this source code. -*/ - -extern crate getopts; -extern crate libc; - -use std::fs::File; -use std::io::{Read, Result, stdin, Write}; -use std::path::Path; - -#[path="../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "sum"; -static VERSION: &'static str = "1.0.0"; - -fn bsd_sum(mut reader: Box) -> (usize, u16) { - let mut buf = [0; 1024]; - let mut blocks_read = 0; - let mut checksum: u16 = 0; - loop { - match reader.read(&mut buf) { - Ok(n) if n != 0 => { - blocks_read += 1; - for &byte in buf[..n].iter() { - checksum = (checksum >> 1) + ((checksum & 1) << 15); - checksum += byte as u16; - } - }, - _ => break, - } - } - - (blocks_read, checksum) -} - -fn sysv_sum(mut reader: Box) -> (usize, u16) { - let mut buf = [0; 512]; - let mut blocks_read = 0; - let mut ret = 0; - - loop { - match reader.read(&mut buf) { - Ok(n) if n != 0 => { - blocks_read += 1; - for &byte in buf[..n].iter() { - ret += byte as u32; - } - }, - _ => break, - } - } - - ret = (ret & 0xffff) + (ret >> 16); - ret = (ret & 0xffff) + (ret >> 16); - - (blocks_read, ret as u16) -} - -fn open(name: &str) -> Result> { - match name { - "-" => Ok(Box::new(stdin()) as Box), - _ => { - let f = try!(File::open(&Path::new(name))); - Ok(Box::new(f) as Box) - } - } -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("r", "", "use the BSD compatible algorithm (default)"); - opts.optflag("s", "sysv", "use System V compatible algorithm"); - opts.optflag("h", "help", "show this help message"); - opts.optflag("v", "version", "print the version and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f) - }; - - if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: - {0} [OPTION]... [FILE]... - -Checksum and count the blocks in a file.", NAME, VERSION); - println!("{}\nWith no FILE, or when FILE is -, read standard input.", opts.usage(&msg)); - return 0; - } - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let sysv = matches.opt_present("sysv"); - - let files = if matches.free.is_empty() { - vec!["-".to_string()] - } else { - matches.free - }; - - let print_names = if sysv { - files.len() > 1 || files[0] != "-" - } else { - files.len() > 1 - }; - - for file in files.iter() { - let reader = match open(file) { - Ok(f) => f, - _ => crash!(1, "unable to open file") - }; - let (blocks, sum) = if sysv { - sysv_sum(reader) - } else { - bsd_sum(reader) - }; - - if print_names { - println!("{} {} {}", sum, blocks, file); - } else { - println!("{} {}", sum, blocks); - } - } - - 0 -} diff --git a/src/sync/Cargo.toml b/src/sync/Cargo.toml deleted file mode 100644 index 2c17e5550..000000000 --- a/src/sync/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "sync" -version = "0.0.1" -authors = [] - -[lib] -name = "sync" -path = "sync.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/sync/deps.mk b/src/sync/deps.mk deleted file mode 100644 index bd85e154d..000000000 --- a/src/sync/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += winapi kernel32 diff --git a/src/sync/sync.rs b/src/sync/sync.rs deleted file mode 100644 index 3f3834774..000000000 --- a/src/sync/sync.rs +++ /dev/null @@ -1,146 +0,0 @@ -#![crate_name = "sync"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Alexander Fomin - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - - /* Last synced with: sync (GNU coreutils) 8.13 */ - -extern crate getopts; -extern crate libc; - -#[path = "../common/util.rs"] #[macro_use] mod util; -#[cfg(windows)] #[path = "../common/wide.rs"] mod wide; - -static NAME: &'static str = "sync"; -static VERSION: &'static str = "1.0.0"; - -#[cfg(unix)] -mod platform { - use super::libc; - - extern { - fn sync() -> libc::c_void; - } - - pub unsafe fn do_sync() -> isize { - sync(); - 0 - } -} - -#[cfg(windows)] -mod platform { - extern crate winapi; - extern crate kernel32; - use std::{mem}; - use std::fs::OpenOptions; - use std::io::{Write}; - use std::os::windows::prelude::*; - use wide::{FromWide, ToWide}; - - unsafe fn flush_volume(name: &str) { - let name_wide = name.to_wide_null(); - if kernel32::GetDriveTypeW(name_wide.as_ptr()) == winapi::DRIVE_FIXED { - let sliced_name = &name[..name.len() - 1]; // eliminate trailing backslash - match OpenOptions::new().write(true).open(sliced_name) { - Ok(file) => if kernel32::FlushFileBuffers(file.as_raw_handle()) == 0 { - crash!(kernel32::GetLastError() as i32, "failed to flush file buffer"); - }, - Err(e) => crash!(e.raw_os_error().unwrap_or(1), "failed to create volume handle") - } - } - } - - unsafe fn find_first_volume() -> (String, winapi::HANDLE) { - let mut name: [winapi::WCHAR; winapi::MAX_PATH] = mem::uninitialized(); - let handle = kernel32::FindFirstVolumeW(name.as_mut_ptr(), name.len() as winapi::DWORD); - if handle == winapi::INVALID_HANDLE_VALUE { - crash!(kernel32::GetLastError() as i32, "failed to find first volume"); - } - (String::from_wide_null(&name), handle) - } - - unsafe fn find_all_volumes() -> Vec { - let (first_volume, next_volume_handle) = find_first_volume(); - let mut volumes = vec![first_volume]; - loop { - let mut name: [winapi::WCHAR; winapi::MAX_PATH] = mem::uninitialized(); - if kernel32::FindNextVolumeW( - next_volume_handle, name.as_mut_ptr(), name.len() as winapi::DWORD - ) == 0 { - match kernel32::GetLastError() { - winapi::ERROR_NO_MORE_FILES => { - kernel32::FindVolumeClose(next_volume_handle); - return volumes - }, - err => crash!(err as i32, "failed to find next volume"), - } - } else { - volumes.push(String::from_wide_null(&name)); - } - } - } - - pub unsafe fn do_sync() -> isize { - let volumes = find_all_volumes(); - for vol in &volumes { - flush_volume(vol); - } - 0 - } -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => { m } - _ => { help(&opts); return 1 } - }; - - if matches.opt_present("h") { - help(&opts); - return 0 - } - - if matches.opt_present("V") { - version(); - return 0 - } - - sync(); - 0 -} - -fn version() { - println!("{} (uutils) {}", NAME, VERSION); - println!("The MIT License"); - println!(""); - println!("Author -- Alexander Fomin."); -} - -fn help(opts: &getopts::Options) { - let msg = format!("{0} {1} - -Usage: - {0} [OPTION] - -Force changed blocks to disk, update the super block.", NAME, VERSION); - - print!("{}", opts.usage(&msg)); -} - -fn sync() -> isize { - unsafe { - platform::do_sync() - } -} diff --git a/src/tac/Cargo.toml b/src/tac/Cargo.toml deleted file mode 100644 index 2a4dd498f..000000000 --- a/src/tac/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "tac" -version = "0.0.1" -authors = [] - -[lib] -name = "tac" -path = "tac.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/tac/tac.rs b/src/tac/tac.rs deleted file mode 100644 index 995d5c2d7..000000000 --- a/src/tac/tac.rs +++ /dev/null @@ -1,149 +0,0 @@ -#![crate_name = "tac"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Arcterus - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::fs::File; -use std::io::{BufReader, Read, stdin, stdout, Stdout, Write}; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "tac"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("b", "before", "attach the separator before instead of after"); - opts.optflag("r", "regex", "interpret the sequence as a regular expression (NOT IMPLEMENTED)"); - opts.optopt("s", "separator", "use STRING as the separator instead of newline", "STRING"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f) - }; - if matches.opt_present("help") { - let msg = format!("{0} {1} - -Usage: - {0} [OPTION]... [FILE]... - -Write each file to standard output, last line first.", NAME, VERSION); - - print!("{}", opts.usage(&msg)); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else { - let before = matches.opt_present("b"); - let regex = matches.opt_present("r"); - let separator = match matches.opt_str("s") { - Some(m) => { - if m.len() == 0 { - crash!(1, "separator cannot be empty") - } else { - m - } - } - None => "\n".to_string() - }; - let files = if matches.free.is_empty() { - vec!("-".to_string()) - } else { - matches.free - }; - tac(files, before, regex, &separator[..]); - } - - 0 -} - -fn tac(filenames: Vec, before: bool, _: bool, separator: &str) { - let mut out = stdout(); - let sbytes = separator.as_bytes(); - let slen = sbytes.len(); - - for filename in filenames.iter() { - let mut file = BufReader::new( - if filename == "-" { - Box::new(stdin()) as Box - } else { - match File::open(filename) { - Ok(f) => Box::new(f) as Box, - Err(e) => { - show_warning!("failed to open '{}' for reading: {}", filename, e); - continue; - }, - } - }); - - let mut data = Vec::new(); - match file.read_to_end(&mut data) { - Err(e) => { - show_warning!("failed to read '{}': {}", filename, e); - continue; - }, - Ok(_) => (), - }; - - // find offsets in string of all separators - let mut offsets = Vec::new(); - let mut i = 0; - loop { - if i + slen > data.len() { - break; - } - - if &data[i..i+slen] == sbytes { - offsets.push(i); - i += slen; - } else { - i += 1; - } - } - drop(i); - - // if there isn't a separator at the end of the file, fake it - if offsets.len() == 0 || *offsets.last().unwrap() < data.len() - slen { - offsets.push(data.len()); - } - - let mut prev = *offsets.last().unwrap(); - let mut start = true; - for off in offsets.iter().rev().skip(1) { - // correctly handle case of no final separator in file - if start && prev == data.len() { - show_line(&mut out, &[], &data[*off+slen..prev], before); - start = false; - } else { - show_line(&mut out, sbytes, &data[*off+slen..prev], before); - } - prev = *off; - } - show_line(&mut out, sbytes, &data[0..prev], before); - } -} - -fn show_line(out: &mut Stdout, sep: &[u8], dat: &[u8], before: bool) { - if before { - out.write_all(sep).unwrap_or_else(|e| crash!(1, "failed to write to stdout: {}", e)); - } - - out.write_all(dat).unwrap_or_else(|e| crash!(1, "failed to write to stdout: {}", e)); - - if !before { - out.write_all(sep).unwrap_or_else(|e| crash!(1, "failed to write to stdout: {}", e)); - } -} diff --git a/src/tail/Cargo.toml b/src/tail/Cargo.toml deleted file mode 100644 index beac774b1..000000000 --- a/src/tail/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "tail" -version = "0.0.1" -authors = [] - -[lib] -name = "tail" -path = "tail.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/tail/README.md b/src/tail/README.md deleted file mode 100644 index a31dd0702..000000000 --- a/src/tail/README.md +++ /dev/null @@ -1,16 +0,0 @@ -Rudimentary tail implementation. - -##Missing features: - -### Flags with features -* `--max-unchanged-stats` : with `--follow=name`, reopen a FILE which has not changed size after N (default 5) iterations to see if it has been unlinked or renamed (this is the usual case of rotated log files). With inotify, this option is rarely useful. -* `--pid` : with `-f`, terminate after process ID, PID dies -* `--quiet` : never output headers giving file names -* `--retry` : keep trying to open a file even when it is or becomes inaccessible; useful when follow‐ing by name, i.e., with `--follow=name` -* `--verbose` : always output headers giving file names - -### Others -The current implementation does not handle `-` as an alias for stdin. - -##Possible optimizations: -* Don't read the whole file if not using `-f` and input is regular file. Read in chunks from the end going backwards, reading each individual chunk forward. diff --git a/src/tail/tail.rs b/src/tail/tail.rs deleted file mode 100644 index 8b64760a5..000000000 --- a/src/tail/tail.rs +++ /dev/null @@ -1,300 +0,0 @@ -#![crate_name = "tail"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Morten Olsen Lysgaard - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - */ - -extern crate getopts; - -use std::collections::VecDeque; -use std::fs::File; -use std::io::{BufRead, BufReader, Read, stdin, stdout, Write}; -use std::path::Path; -use std::str::from_utf8; -use std::thread::sleep_ms; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "tail"; -static VERSION: &'static str = "0.0.1"; - -pub fn uumain(args: Vec) -> i32 { - let mut beginning = false; - let mut lines = true; - let mut byte_count = 0usize; - let mut line_count = 10usize; - let mut sleep_msec = 1000u32; - - // handle obsolete -number syntax - let options = match obsolete(&args[1..]) { - (args, Some(n)) => { line_count = n; args }, - (args, None) => args - }; - - let args = options; - - let mut opts = getopts::Options::new(); - - opts.optopt("c", "bytes", "Number of bytes to print", "k"); - opts.optopt("n", "lines", "Number of lines to print", "k"); - opts.optflag("f", "follow", "Print the file as it grows"); - opts.optopt("s", "sleep-interval", "Number or seconds to sleep between polling the file when running with -f", "n"); - opts.optflag("h", "help", "help"); - opts.optflag("V", "version", "version"); - - let given_options = match opts.parse(&args) { - Ok (m) => { m } - Err(_) => { - println!("{}", opts.usage("")); - return 1; - } - }; - - if given_options.opt_present("h") { - println!("{}", opts.usage("")); - return 0; - } - if given_options.opt_present("V") { version(); return 0 } - - let follow = given_options.opt_present("f"); - if follow { - match given_options.opt_str("s") { - Some(n) => { - let parsed: Option = n.parse().ok(); - match parsed { - Some(m) => { sleep_msec = m * 1000 } - None => {} - } - } - None => {} - }; - } - - match given_options.opt_str("n") { - Some(n) => { - let mut slice: &str = n.as_ref(); - if slice.chars().next().unwrap_or('_') == '+' { - beginning = true; - slice = &slice[1..]; - } - line_count = match parse_size(slice) { - Some(m) => m, - None => { - show_error!("invalid number of lines ({})", slice); - return 1; - } - }; - } - None => match given_options.opt_str("c") { - Some(n) => { - let mut slice: &str = n.as_ref(); - if slice.chars().next().unwrap_or('_') == '+' { - beginning = true; - slice = &slice[1..]; - } - byte_count = match parse_size(slice) { - Some(m) => m, - None => { - show_error!("invalid number of bytes ({})", slice); - return 1; - } - }; - lines = false; - } - None => { } - } - }; - - let files = given_options.free; - - if files.is_empty() { - let mut buffer = BufReader::new(stdin()); - tail(&mut buffer, line_count, byte_count, beginning, lines, follow, sleep_msec); - } else { - let mut multiple = false; - let mut firstime = true; - - if files.len() > 1 { - multiple = true; - } - - - for file in files.iter() { - if multiple { - if !firstime { println!(""); } - println!("==> {} <==", file); - } - firstime = false; - - let path = Path::new(file); - let reader = File::open(&path).unwrap(); - let mut buffer = BufReader::new(reader); - tail(&mut buffer, line_count, byte_count, beginning, lines, follow, sleep_msec); - } - } - - 0 -} - -fn parse_size(mut size_slice: &str) -> Option { - let mut base = - if size_slice.chars().last().unwrap_or('_') == 'B' { - size_slice = &size_slice[..size_slice.len() - 1]; - 1000usize - } else { - 1024usize - }; - let exponent = - if size_slice.len() > 0 { - let mut has_suffix = true; - let exp = match size_slice.chars().last().unwrap_or('_') { - 'K' => 1usize, - 'M' => 2usize, - 'G' => 3usize, - 'T' => 4usize, - 'P' => 5usize, - 'E' => 6usize, - 'Z' => 7usize, - 'Y' => 8usize, - 'b' => { - base = 512usize; - 1usize - } - _ => { - has_suffix = false; - 0usize - } - }; - if has_suffix { - size_slice = &size_slice[..size_slice.len() - 1]; - } - exp - } else { - 0usize - }; - - let mut multiplier = 1usize; - for _ in 0usize .. exponent { - multiplier *= base; - } - if base == 1000usize && exponent == 0usize { - // sole B is not a valid suffix - None - } else { - let value: Option = size_slice.parse().ok(); - match value { - Some(v) => Some(multiplier * v), - _ => None - } - } -} - -// It searches for an option in the form of -123123 -// -// In case is found, the options vector will get rid of that object so that -// getopts works correctly. -fn obsolete(options: &[String]) -> (Vec, Option) { - let mut options: Vec = options.to_vec(); - let mut a = 0; - let b = options.len(); - - while a < b { - let current = options[a].clone(); - let current = current.as_bytes(); - - if current.len() > 1 && current[0] == '-' as u8 { - let len = current.len(); - for pos in 1 .. len { - // Ensure that the argument is only made out of digits - if !(current[pos] as char).is_numeric() { break; } - - // If this is the last number - if pos == len - 1 { - options.remove(a); - let number: Option = from_utf8(¤t[1..len]).unwrap().parse().ok(); - return (options, Some(number.unwrap())); - } - } - } - - a += 1; - }; - - (options, None) -} - -macro_rules! tail_impl ( - ($kind:ty, $kindfn:ident, $kindprint:ident, $reader:ident, $count:ident, $beginning:ident) => ({ - // read through each line and store them in a ringbuffer that always contains - // count lines/chars. When reaching the end of file, output the data in the - // ringbuf. - let mut ringbuf: VecDeque<$kind> = VecDeque::new(); - let data = $reader.$kindfn().skip( - if $beginning { - let temp = $count; - $count = ::std::usize::MAX; - temp - 1 - } else { - 0 - } - ); - for io_datum in data { - match io_datum { - Ok(datum) => { - if $count <= ringbuf.len() { - ringbuf.pop_front(); - } - ringbuf.push_back(datum); - } - Err(err) => panic!(err) - } - } - let mut stdout = stdout(); - for datum in ringbuf.iter() { - $kindprint(&mut stdout, datum); - } - }) -); - -fn tail(reader: &mut BufReader, mut line_count: usize, mut byte_count: usize, beginning: bool, lines: bool, follow: bool, sleep_msec: u32) { - if lines { - tail_impl!(String, lines, print_string, reader, line_count, beginning); - } else { - tail_impl!(u8, bytes, print_byte, reader, byte_count, beginning); - } - - // if we follow the file, sleep a bit and print the rest if the file has grown. - while follow { - sleep_ms(sleep_msec); - for io_line in reader.lines() { - match io_line { - Ok(line) => print!("{}", line), - Err(err) => panic!(err) - } - } - } -} - -#[inline] -fn print_byte(stdout: &mut T, ch: &u8) { - if let Err(err) = stdout.write(&[*ch]) { - crash!(1, "{}", err); - } -} - -#[inline] -fn print_string(_: &mut T, s: &String) { - print!("{}", s); -} - -fn version () { - println!("{} {}", NAME, VERSION); -} diff --git a/src/tee/Cargo.toml b/src/tee/Cargo.toml deleted file mode 100644 index d91409f52..000000000 --- a/src/tee/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "tee" -version = "0.0.1" -authors = [] - -[lib] -name = "tee" -path = "tee.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/tee/tee.rs b/src/tee/tee.rs deleted file mode 100644 index 52279708f..000000000 --- a/src/tee/tee.rs +++ /dev/null @@ -1,174 +0,0 @@ -#![crate_name = "tee"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Aleksander Bielawski - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; - -use std::fs::OpenOptions; -use std::io::{copy, Error, ErrorKind, Read, Result, sink, stdin, stdout, Write}; -use std::path::{Path, PathBuf}; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "tee"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - match options(&args).and_then(exec) { - Ok(_) => 0, - Err(_) => 1 - } -} - -#[allow(dead_code)] -struct Options { - program: String, - append: bool, - ignore_interrupts: bool, - print_and_exit: Option, - files: Vec -} - -fn options(args: &Vec) -> Result { - let mut opts = getopts::Options::new(); - - opts.optflag("a", "append", "append to the given FILEs, do not overwrite"); - opts.optflag("i", "ignore-interrupts", "ignore interrupt signals"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - opts.parse(&args[1..]).map_err(|e| Error::new(ErrorKind::Other, format!("{}", e))).and_then(|m| { - let version = format!("{} {}", NAME, VERSION); - let arguments = "[OPTION]... [FILE]..."; - let brief = "Copy standard input to each FILE, and also to standard output."; - let comment = "If a FILE is -, copy again to standard output."; - let help = format!("{}\n\nUsage:\n {} {}\n\n{}\n{}", - version, NAME, arguments, opts.usage(brief), - comment); - let mut names: Vec = m.free.clone().into_iter().collect(); - names.push("-".to_string()); - let to_print = if m.opt_present("help") { Some(help) } - else if m.opt_present("version") { Some(version) } - else { None }; - Ok(Options { - program: NAME.to_string(), - append: m.opt_present("append"), - ignore_interrupts: m.opt_present("ignore-interrupts"), - print_and_exit: to_print, - files: names - }) - }).map_err(|message| warn(format!("{}", message).as_ref())) -} - -fn exec(options: Options) -> Result<()> { - match options.print_and_exit { - Some(text) => Ok(println!("{}", text)), - None => tee(options) - } -} - -fn tee(options: Options) -> Result<()> { - let writers: Vec> = options.files.clone().into_iter().map(|file| open(file, options.append)).collect(); - let output = &mut MultiWriter { writers: writers }; - let input = &mut NamedReader { inner: Box::new(stdin()) as Box }; - if copy(input, output).is_err() || output.flush().is_err() { - Err(Error::new(ErrorKind::Other, "")) - } else { - Ok(()) - } -} - -fn open(name: String, append: bool) -> Box { - let is_stdout = name == "-"; - let path = PathBuf::from(name); - let inner: Box = if is_stdout { - Box::new(stdout()) - } else { - let mut options = OpenOptions::new(); - let mode = if append { options.append(true) } else { options.truncate(true) }; - match mode.write(true).create(true).open(path.as_path()) { - Ok(file) => Box::new(file), - Err(_) => Box::new(sink()) - } - }; - Box::new(NamedWriter { inner: inner, path: path }) as Box -} - -struct MultiWriter { - writers: Vec> -} - -impl Write for MultiWriter { - fn write(&mut self, buf: &[u8]) -> Result { - for writer in self.writers.iter_mut() { - try!(writer.write_all(buf)); - } - Ok(buf.len()) - } - - fn flush(&mut self) -> Result<()> { - for writer in self.writers.iter_mut() { - try!(writer.flush()); - } - Ok(()) - } -} - -struct NamedWriter { - inner: Box, - path: PathBuf -} - -impl Write for NamedWriter { - fn write(&mut self, buf: &[u8]) -> Result { - match self.inner.write(buf) { - Err(f) => { - self.inner = Box::new(sink()) as Box; - warn(format!("{}: {}", self.path.display(), f.to_string()).as_ref()); - Err(f) - } - okay => okay - } - } - - fn flush(&mut self) -> Result<()> { - match self.inner.flush() { - Err(f) => { - self.inner = Box::new(sink()) as Box; - warn(format!("{}: {}", self.path.display(), f.to_string()).as_ref()); - Err(f) - } - okay => okay - } - } -} - -struct NamedReader { - inner: Box -} - -impl Read for NamedReader { - fn read(&mut self, buf: &mut [u8]) -> Result { - match self.inner.read(buf) { - Err(f) => { - warn(format!("{}: {}", Path::new("stdin").display(), f.to_string()).as_ref()); - Err(f) - } - okay => okay - } - } -} - -fn warn(message: &str) -> Error { - eprintln!("{}: {}", NAME, message); - Error::new(ErrorKind::Other, format!("{}: {}", NAME, message)) -} diff --git a/src/test/Cargo.toml b/src/test/Cargo.toml deleted file mode 100644 index 38acc688a..000000000 --- a/src/test/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "test" -version = "0.0.1" -authors = [] - -[lib] -name = "test" -path = "test.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/test/test.rs b/src/test/test.rs deleted file mode 100644 index 7cd446e69..000000000 --- a/src/test/test.rs +++ /dev/null @@ -1,408 +0,0 @@ -#![crate_name = "test"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) mahkoh (ju.orth [at] gmail [dot] com) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate libc; - -use std::collections::HashMap; -use std::ffi::{CString, OsString}; -use std::env::{args_os}; -use std::str::{from_utf8}; - -static NAME: &'static str = "test"; - -// TODO: decide how to handle non-UTF8 input for all the utils -// Definitely don't use [u8], try keeping it as OsStr or OsString instead -pub fn uumain(_: Vec) -> i32 { - let args = args_os().collect::>(); - // This is completely disregarding valid windows paths that aren't valid unicode - let args = args.iter().map(|a| a.to_str().unwrap().as_bytes()).collect::>(); - if args.len() == 0 { - return 2; - } - let args = - if !args[0].ends_with(NAME.as_bytes()) { - &args[1..] - } else { - &args[..] - }; - let args = match args[0] { - b"[" => match args[args.len() - 1] { - b"]" => &args[1..args.len() - 1], - _ => return 2, - }, - _ => &args[1..args.len()], - }; - let mut error = false; - let retval = 1 - parse_expr(args, &mut error) as i32; - if error { - 2 - } else { - retval - } -} - -fn one(args: &[&[u8]]) -> bool { - args[0].len() > 0 -} - -fn two(args: &[&[u8]], error: &mut bool) -> bool { - match args[0] { - b"!" => !one(&args[1..]), - b"-b" => path(args[1], PathCondition::BlockSpecial), - b"-c" => path(args[1], PathCondition::CharacterSpecial), - b"-d" => path(args[1], PathCondition::Directory), - b"-e" => path(args[1], PathCondition::Exists), - b"-f" => path(args[1], PathCondition::Regular), - b"-g" => path(args[1], PathCondition::GroupIDFlag), - b"-h" => path(args[1], PathCondition::SymLink), - b"-L" => path(args[1], PathCondition::SymLink), - b"-n" => one(&args[1..]), - b"-p" => path(args[1], PathCondition::FIFO), - b"-r" => path(args[1], PathCondition::Readable), - b"-S" => path(args[1], PathCondition::Socket), - b"-s" => path(args[1], PathCondition::NonEmpty), - b"-t" => isatty(args[1]), - b"-u" => path(args[1], PathCondition::UserIDFlag), - b"-w" => path(args[1], PathCondition::Writable), - b"-x" => path(args[1], PathCondition::Executable), - b"-z" => !one(&args[1..]), - _ => { - *error = true; - false - } - } -} - -fn three(args: &[&[u8]], error: &mut bool) -> bool { - match args[1] { - b"=" => args[0] == args[2], - b"==" => args[0] == args[2], - b"!=" => args[0] != args[2], - b"-eq" => integers(args[0], args[2], IntegerCondition::Equal), - b"-ne" => integers(args[0], args[2], IntegerCondition::Unequal), - b"-gt" => integers(args[0], args[2], IntegerCondition::Greater), - b"-ge" => integers(args[0], args[2], IntegerCondition::GreaterEqual), - b"-lt" => integers(args[0], args[2], IntegerCondition::Less), - b"-le" => integers(args[0], args[2], IntegerCondition::LessEqual), - _ => match args[0] { - b"!" => !two(&args[1..], error), - _ => { - *error = true; - false - } - } - } -} - -fn four(args: &[&[u8]], error: &mut bool) -> bool { - match args[0] { - b"!" => { - !three(&args[1..], error) - } - _ => { - *error = true; - false - } - } -} - -enum IntegerCondition { - Equal, - Unequal, - Greater, - GreaterEqual, - Less, - LessEqual, -} - -fn integers(a: &[u8], b: &[u8], cond: IntegerCondition) -> bool { - let (a, b): (&str, &str) = match (from_utf8(a), from_utf8(b)) { - (Ok(a), Ok(b)) => (a, b), - _ => return false, - }; - let (a, b): (i64, i64) = match (a.parse(), b.parse()) { - (Ok(a), Ok(b)) => (a, b), - _ => return false, - }; - match cond { - IntegerCondition::Equal => a == b, - IntegerCondition::Unequal => a != b, - IntegerCondition::Greater => a > b, - IntegerCondition::GreaterEqual => a >= b, - IntegerCondition::Less => a < b, - IntegerCondition::LessEqual => a <= b, - } -} - -fn isatty(fd: &[u8]) -> bool { - use libc::{isatty}; - from_utf8(fd).ok().and_then(|s| s.parse().ok()) - .map(|i| unsafe { isatty(i) == 1 }).unwrap_or(false) -} - -fn dispatch(args: &mut &[&[u8]], error: &mut bool) -> bool { - let (val, idx) = match args.len() { - 0 => { - *error = true; - (false, 0) - } - 1 => (one(*args), 1), - 2 => dispatch_two(args, error), - 3 => dispatch_three(args, error), - _ => dispatch_four(args, error) - }; - *args = &(*args)[idx..]; - val -} - -fn dispatch_two(args: &mut &[&[u8]], error: &mut bool) -> (bool, usize) { - let val = two(*args, error); - if *error { - *error = false; - (one(*args), 1) - } else { - (val, 2) - } -} - -fn dispatch_three(args: &mut &[&[u8]], error: &mut bool) -> (bool, usize) { - let val = three(*args, error); - if *error { - *error = false; - dispatch_two(args, error) - } else { - (val, 3) - } -} - -fn dispatch_four(args: &mut &[&[u8]], error: &mut bool) -> (bool, usize) { - let val = four(*args, error); - if *error { - *error = false; - dispatch_three(args, error) - } else { - (val, 4) - } -} - -#[derive(Clone, Copy)] -enum Precedence { - Unknown = 0, - Paren, // FIXME: this is useless (parentheses have not been implemented) - Or, - And, - BUnOp, - BinOp, - UnOp -} - -fn parse_expr(mut args: &[&[u8]], error: &mut bool) -> bool { - if args.len() == 0 { - false - } else { - let hashmap = setup_hashmap(); - let lhs = dispatch(&mut args, error); - - if args.len() > 0 { - parse_expr_helper(&hashmap, &mut args, lhs, Precedence::Unknown, error) - } else { - lhs - } - } -} - -fn parse_expr_helper<'a>(hashmap: &HashMap<&'a [u8], Precedence>, - args: &mut &[&'a [u8]], - mut lhs: bool, - min_prec: Precedence, - error: &mut bool) -> bool { - let mut prec = *hashmap.get(&args[0]).unwrap_or_else(|| { - *error = true; - &min_prec - }); - while !*error && args.len() > 0 && prec as usize >= min_prec as usize { - let op = args[0]; - *args = &(*args)[1..]; - let mut rhs = dispatch(args, error); - while args.len() > 0 { - let subprec = *hashmap.get(&args[0]).unwrap_or_else(|| { - *error = true; - &min_prec - }); - if subprec as usize <= prec as usize || *error { - break; - } - rhs = parse_expr_helper(hashmap, args, rhs, subprec, error); - } - lhs = match prec { - Precedence::UnOp | Precedence::BUnOp => { - *error = true; - false - } - Precedence::And => lhs && rhs, - Precedence::Or => lhs || rhs, - Precedence::BinOp => three(&[if lhs { b" " } else { b"" }, op, if rhs { b" " } else { b"" }], error), - Precedence::Paren => unimplemented!(), // TODO: implement parentheses - _ => unreachable!() - }; - if args.len() > 0 { - prec = *hashmap.get(&args[0]).unwrap_or_else(|| { - *error = true; - &min_prec - }); - } - } - lhs -} - -#[inline] -fn setup_hashmap<'a>() -> HashMap<&'a [u8], Precedence> { - let mut hashmap = HashMap::<&'a [u8], Precedence>::new(); - - hashmap.insert(b"-b", Precedence::UnOp); - hashmap.insert(b"-c", Precedence::UnOp); - hashmap.insert(b"-d", Precedence::UnOp); - hashmap.insert(b"-e", Precedence::UnOp); - hashmap.insert(b"-f", Precedence::UnOp); - hashmap.insert(b"-g", Precedence::UnOp); - hashmap.insert(b"-h", Precedence::UnOp); - hashmap.insert(b"-L", Precedence::UnOp); - hashmap.insert(b"-n", Precedence::UnOp); - hashmap.insert(b"-p", Precedence::UnOp); - hashmap.insert(b"-r", Precedence::UnOp); - hashmap.insert(b"-S", Precedence::UnOp); - hashmap.insert(b"-s", Precedence::UnOp); - hashmap.insert(b"-t", Precedence::UnOp); - hashmap.insert(b"-u", Precedence::UnOp); - hashmap.insert(b"-w", Precedence::UnOp); - hashmap.insert(b"-x", Precedence::UnOp); - hashmap.insert(b"-z", Precedence::UnOp); - - hashmap.insert(b"=", Precedence::BinOp); - hashmap.insert(b"!=", Precedence::BinOp); - hashmap.insert(b"-eq", Precedence::BinOp); - hashmap.insert(b"-ne", Precedence::BinOp); - hashmap.insert(b"-gt", Precedence::BinOp); - hashmap.insert(b"-ge", Precedence::BinOp); - hashmap.insert(b"-lt", Precedence::BinOp); - hashmap.insert(b"-le", Precedence::BinOp); - - hashmap.insert(b"!", Precedence::BUnOp); - - hashmap.insert(b"-a", Precedence::And); - hashmap.insert(b"-o", Precedence::Or); - - hashmap.insert(b"(", Precedence::Paren); - hashmap.insert(b")", Precedence::Paren); - - hashmap -} - -#[derive(Eq, PartialEq)] -enum PathCondition { - BlockSpecial, - CharacterSpecial, - Directory, - Exists, - Regular, - GroupIDFlag, - SymLink, - FIFO, - Readable, - Socket, - NonEmpty, - UserIDFlag, - Writable, - Executable, -} - -#[cfg(not(windows))] -fn path(path: &[u8], cond: PathCondition) -> bool { - use libc::{stat, lstat, S_IFMT, S_IFLNK, S_IFBLK, S_IFCHR, S_IFDIR, S_IFREG}; - use libc::{S_IFIFO, mode_t}; - static S_ISUID: mode_t = 0o4000; - static S_ISGID: mode_t = 0o2000; - static S_IFSOCK: mode_t = 0o140000; - - enum Permission { - Read = 0o4, - Write = 0o2, - Execute = 0o1, - } - let perm = |stat: stat, p: Permission| { - use libc::{getgid, getuid}; - let (uid, gid) = unsafe { (getuid(), getgid()) }; - if uid == stat.st_uid { - stat.st_mode & ((p as mode_t) << 6) != 0 - } else if gid == stat.st_gid { - stat.st_mode & ((p as mode_t) << 3) != 0 - } else { - stat.st_mode & ((p as mode_t) << 0) != 0 - } - }; - - let path = CString::new(path).unwrap(); - let mut stat = unsafe { std::mem::zeroed() }; - if cond == PathCondition::SymLink { - if unsafe { lstat(path.as_ptr(), &mut stat) } == 0 { - if stat.st_mode & S_IFMT == S_IFLNK { - return true; - } - } - return false; - } - if unsafe { libc::stat(path.as_ptr(), &mut stat) } != 0 { - return false; - } - let file_type = stat.st_mode & S_IFMT; - match cond { - PathCondition::BlockSpecial => file_type == S_IFBLK, - PathCondition::CharacterSpecial => file_type == S_IFCHR, - PathCondition::Directory => file_type == S_IFDIR, - PathCondition::Exists => true, - PathCondition::Regular => file_type == S_IFREG, - PathCondition::GroupIDFlag => stat.st_mode & S_ISGID != 0, - PathCondition::SymLink => true, - PathCondition::FIFO => file_type == S_IFIFO, - PathCondition::Readable => perm(stat, Permission::Read), - PathCondition::Socket => file_type == S_IFSOCK, - PathCondition::NonEmpty => stat.st_size > 0, - PathCondition::UserIDFlag => stat.st_mode & S_ISUID != 0, - PathCondition::Writable => perm(stat, Permission::Write), - PathCondition::Executable => perm(stat, Permission::Execute), - } -} - -#[cfg(windows)] -fn path(path: &[u8], cond: PathCondition) -> bool { - use std::fs::metadata; - let path = from_utf8(path).unwrap(); - let stat = match metadata(path) { - Ok(s) => s, - _ => return false, - }; - match cond { - PathCondition::BlockSpecial => false, - PathCondition::CharacterSpecial => false, - PathCondition::Directory => stat.is_dir(), - PathCondition::Exists => true, - PathCondition::Regular => stat.is_file(), - PathCondition::GroupIDFlag => false, - PathCondition::SymLink => false, - PathCondition::FIFO => false, - PathCondition::Readable => false, // TODO - PathCondition::Socket => false, - PathCondition::NonEmpty => stat.len() > 0, - PathCondition::UserIDFlag => false, - PathCondition::Writable => false, // TODO - PathCondition::Executable => false, // TODO - } -} diff --git a/src/timeout/Cargo.toml b/src/timeout/Cargo.toml deleted file mode 100644 index 18d3c3ba2..000000000 --- a/src/timeout/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "timeout" -version = "0.0.1" -authors = [] - -[lib] -name = "timeout" -path = "timeout.rs" - -[dependencies] -getopts = "*" -libc = "*" -time = "*" diff --git a/src/timeout/deps.mk b/src/timeout/deps.mk deleted file mode 100644 index b6534caec..000000000 --- a/src/timeout/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += time diff --git a/src/timeout/timeout.rs b/src/timeout/timeout.rs deleted file mode 100644 index 8a16c2b38..000000000 --- a/src/timeout/timeout.rs +++ /dev/null @@ -1,159 +0,0 @@ -#![crate_name = "timeout"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Arcterus - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; -extern crate time; - -use libc::pid_t; -use std::io::{ErrorKind, Write}; -use std::process::{Command, Stdio}; -use std::os::unix::process::ExitStatusExt; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/parse_time.rs"] -mod parse_time; - -#[path = "../common/signals.rs"] -mod signals; - -#[path = "../common/process.rs"] -mod process; -use process::ChildExt; - -extern { - pub fn setpgid(_: libc::pid_t, _: libc::pid_t) -> libc::c_int; -} - -static NAME: &'static str = "timeout"; -static VERSION: &'static str = "1.0.0"; - -static ERR_EXIT_STATUS: i32 = 125; - -pub fn uumain(args: Vec) -> i32 { - let program = args[0].clone(); - - let mut opts = getopts::Options::new(); - opts.optflag("", "preserve-status", "exit with the same status as COMMAND, even when the command times out"); - opts.optflag("", "foreground", "when not running timeout directly from a shell prompt, allow COMMAND to read from the TTY and get TTY signals; in this mode, children of COMMAND will not be timed out"); - opts.optopt("k", "kill-after", "also send a KILL signal if COMMAND is still running this long after the initial signal was sent", "DURATION"); - opts.optflag("s", "signal", "specify the signal to be sent on timeout; SIGNAL may be a name like 'HUP' or a number; see 'kill -l' for a list of signals"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - crash!(ERR_EXIT_STATUS, "{}", f) - } - }; - if matches.opt_present("help") { - print!("{} {} - -Usage: - {} [OPTION] DURATION COMMAND [ARG]... - -{}", NAME, VERSION, program, &opts.usage("Start COMMAND, and kill it if still running after DURATION.")); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else if matches.free.len() < 2 { - show_error!("missing an argument"); - show_error!("for help, try '{0} --help'", program); - return ERR_EXIT_STATUS; - } else { - let status = matches.opt_present("preserve-status"); - let foreground = matches.opt_present("foreground"); - let kill_after = match matches.opt_str("kill-after") { - Some(tstr) => match parse_time::from_str(&tstr) { - Ok(time) => time, - Err(f) => { - show_error!("{}", f); - return ERR_EXIT_STATUS; - } - }, - None => 0f64 - }; - let signal = match matches.opt_str("signal") { - Some(sigstr) => match signals::signal_by_name_or_value(&sigstr) { - Some(sig) => sig, - None => { - show_error!("invalid signal '{}'", sigstr); - return ERR_EXIT_STATUS; - } - }, - None => signals::signal_by_name_or_value("TERM").unwrap() - }; - let duration = match parse_time::from_str(&matches.free[0]) { - Ok(time) => time, - Err(f) => { - show_error!("{}", f); - return ERR_EXIT_STATUS; - } - }; - return timeout(&matches.free[1], &matches.free[2..], duration, signal, kill_after, foreground, status); - } - - 0 -} - -fn timeout(cmdname: &str, args: &[String], duration: f64, signal: usize, kill_after: f64, foreground: bool, preserve_status: bool) -> i32 { - if !foreground { - unsafe { setpgid(0, 0) }; - } - let mut process = match Command::new(cmdname).args(args) - .stdin(Stdio::inherit()) - .stdout(Stdio::inherit()) - .stderr(Stdio::inherit()) - .spawn() { - Ok(p) => p, - Err(err) => { - show_error!("failed to execute process: {}", err); - if err.kind() == ErrorKind::NotFound { - // XXX: not sure which to use - return 127; - } else { - // XXX: this may not be 100% correct... - return 126; - } - } - }; - match process.wait_or_timeout(duration) { - Ok(Some(status)) => status.code().unwrap_or_else(|| status.signal().unwrap()), - Ok(None) => { - return_if_err!(ERR_EXIT_STATUS, process.send_signal(signal)); - match process.wait_or_timeout(kill_after) { - Ok(Some(status)) => { - if preserve_status { - status.code().unwrap_or_else(|| status.signal().unwrap()) - } else { - 124 - } - }, - Ok(None) => { - if kill_after == 0f64 { - // XXX: this may not be right - return 124; - } - return_if_err!(ERR_EXIT_STATUS, process.send_signal(signals::signal_by_name_or_value("KILL").unwrap())); - return_if_err!(ERR_EXIT_STATUS, process.wait()); - 137 - }, - Err(_) => return 124, - } - }, - Err(_) => { - return_if_err!(ERR_EXIT_STATUS, process.send_signal(signal)); - ERR_EXIT_STATUS - }, - } -} diff --git a/src/touch/Cargo.toml b/src/touch/Cargo.toml deleted file mode 100644 index 4c2c7c509..000000000 --- a/src/touch/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "touch" -version = "0.0.1" -authors = [] - -[lib] -name = "touch" -path = "touch.rs" - -[dependencies] -filetime = "*" -getopts = "*" -libc = "*" -time = "*" diff --git a/src/touch/deps.mk b/src/touch/deps.mk deleted file mode 100644 index 0e162f8f0..000000000 --- a/src/touch/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += kernel32 winapi filetime time diff --git a/src/touch/touch.rs b/src/touch/touch.rs deleted file mode 100644 index 9f51f9837..000000000 --- a/src/touch/touch.rs +++ /dev/null @@ -1,211 +0,0 @@ -#![crate_name = "touch"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Nick Platt - * - * For the full copyright and license information, please view the LICENSE file - * that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; -extern crate time; -extern crate filetime; - -use filetime::*; -use std::fs::{self, File}; -use std::io::{Error, Write}; -use std::path::Path; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/filesystem.rs"] -mod filesystem; - -use filesystem::UUPathExt; - -static NAME: &'static str = "touch"; -static VERSION: &'static str = "1.0.0"; - -// Since touch's date/timestamp parsing doesn't account for timezone, the -// returned value from time::strptime() is UTC. We get system's timezone to -// localize the time. -macro_rules! to_local( - ($exp:expr) => ({ - let mut tm = $exp; - tm.tm_utcoff = time::now().tm_utcoff; - tm - }) -); - -macro_rules! local_tm_to_filetime( - ($exp:expr) => ({ - let ts = $exp.to_timespec(); - FileTime::from_seconds_since_1970(ts.sec as u64, ts.nsec as u32) - }) -); - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("a", "", "change only the access time"); - opts.optflag("c", "no-create", "do not create any files"); - opts.optopt( "d", "date", "parse argument and use it instead of current time", "STRING"); - opts.optflag("h", "no-dereference", "affect each symbolic link instead of any referenced file \ - (only for systems that can change the timestamps of a symlink)"); - opts.optflag("m", "", "change only the modification time"); - opts.optopt( "r", "reference", "use this file's times instead of the current time", "FILE"); - opts.optopt( "t", "", "use [[CC]YY]MMDDhhmm[.ss] instead of the current time", "STAMP"); - opts.optopt( "", "time", "change only the specified time: \"access\", \"atime\", or \ - \"use\" are equivalent to -a; \"modify\" or \"mtime\" are \ - equivalent to -m", "WORD"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(e) => panic!("Invalid options\n{}", e) - }; - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if matches.opt_present("help") || matches.free.is_empty() { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage: {} [OPTION]... FILE...", NAME); - println!(""); - println!("{}", opts.usage("Update the access and modification times of \ - each FILE to the current time.")); - if matches.free.is_empty() { - return 1; - } - return 0; - } - - if matches.opt_present("date") && matches.opts_present(&["reference".to_string(), "t".to_string()]) || - matches.opt_present("reference") && matches.opts_present(&["date".to_string(), "t".to_string()]) || - matches.opt_present("t") && matches.opts_present(&["date".to_string(), "reference".to_string()]) { - panic!("Invalid options: cannot specify reference time from more than one source"); - } - - let (mut atime, mut mtime) = - if matches.opt_present("reference") { - stat(&matches.opt_str("reference").unwrap()[..], !matches.opt_present("no-dereference")) - } else if matches.opts_present(&["date".to_string(), "t".to_string()]) { - let timestamp = if matches.opt_present("date") { - parse_date(matches.opt_str("date").unwrap().as_ref()) - } else { - parse_timestamp(matches.opt_str("t").unwrap().as_ref()) - }; - (timestamp, timestamp) - } else { - let now = local_tm_to_filetime!(time::now()); - (now, now) - }; - - for filename in matches.free.iter() { - let path = &filename[..]; - - if !Path::new(path).uu_exists() { - // no-dereference included here for compatibility - if matches.opts_present(&["no-create".to_string(), "no-dereference".to_string()]) { - continue; - } - - match File::create(path) { - Err(e) => { - show_warning!("cannot touch '{}': {}", path, e); - continue; - }, - _ => (), - }; - - // Minor optimization: if no reference time was specified, we're done. - if !matches.opts_present(&["date".to_string(), "reference".to_string(), "t".to_string()]) { - continue; - } - } - - // If changing "only" atime or mtime, grab the existing value of the other. - // Note that "-a" and "-m" may be passed together; this is not an xor. - if matches.opts_present(&["a".to_string(), "m".to_string(), "time".to_string()]) { - let st = stat(path, !matches.opt_present("no-dereference")); - let time = matches.opt_strs("time"); - - if !(matches.opt_present("a") || - time.contains(&"access".to_string()) || - time.contains(&"atime".to_string()) || - time.contains(&"use".to_string())) { - atime = st.0; - } - - if !(matches.opt_present("m") || - time.contains(&"modify".to_string()) || - time.contains(&"mtime".to_string())) { - mtime = st.1; - } - } - - // this follows symlinks and thus does not work correctly for the -h flag - // need to use lutimes() c function on supported platforms - match filetime::set_file_times(path, atime, mtime) { - Err(e) => show_warning!("cannot touch '{}': {}", path, e), - _ => (), - }; - } - - 0 -} - -fn stat(path: &str, follow: bool) -> (FileTime, FileTime) { - let metadata = if follow { - fs::symlink_metadata(path) - } else { - fs::metadata(path) - }; - - match metadata { - Ok(m) => ( - FileTime::from_last_access_time(&m), - FileTime::from_last_modification_time(&m) - ), - Err(_) => crash!(1, "failed to get attributes of '{}': {}", path, Error::last_os_error()) - } -} - -fn parse_date(str: &str) -> FileTime { - // This isn't actually compatible with GNU touch, but there doesn't seem to - // be any simple specification for what format this parameter allows and I'm - // not about to implement GNU parse_datetime. - // http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=lib/parse-datetime.y - match time::strptime(str, "%c") { - Ok(tm) => local_tm_to_filetime!(to_local!(tm)), - Err(e) => panic!("Unable to parse date\n{}", e) - } -} - -fn parse_timestamp(s: &str) -> FileTime { - let now = time::now(); - let (format, ts) = match s.chars().count() { - 15 => ("%Y%m%d%H%M.%S", s.to_string()), - 12 => ("%Y%m%d%H%M", s.to_string()), - 13 => ("%y%m%d%H%M.%S", s.to_string()), - 10 => ("%y%m%d%H%M", s.to_string()), - 11 => ("%Y%m%d%H%M.%S", format!("{}{}", now.tm_year + 1900, s)), - 8 => ("%Y%m%d%H%M", format!("{}{}", now.tm_year + 1900, s)), - _ => panic!("Unknown timestamp format") - }; - - match time::strptime(&ts, format) { - Ok(tm) => local_tm_to_filetime!(to_local!(tm)), - Err(e) => panic!("Unable to parse timestamp\n{}", e) - } -} - diff --git a/src/tr/Cargo.toml b/src/tr/Cargo.toml deleted file mode 100644 index 0c47ab424..000000000 --- a/src/tr/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "tr" -version = "0.0.1" -authors = [] - -[lib] -name = "tr" -path = "tr.rs" - -[dependencies] -getopts = "*" -libc = "*" -bit-set = "*" -vec_map = "*" diff --git a/src/tr/deps.mk b/src/tr/deps.mk deleted file mode 100644 index 5e9f37b70..000000000 --- a/src/tr/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += bit-vec bit-set vec_map diff --git a/src/tr/expand.rs b/src/tr/expand.rs deleted file mode 100644 index fd8f885ff..000000000 --- a/src/tr/expand.rs +++ /dev/null @@ -1,117 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Michael Gehring - * (c) kwantam - * 20150428 created `expand` module to eliminate most allocs during setup - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use std::char::from_u32; -use std::cmp::min; -use std::iter::Peekable; -use std::ops::Range; - -#[inline] -fn unescape_char(c: char) -> char { - match c { - 'a' => 0x07u8 as char, - 'b' => 0x08u8 as char, - 'f' => 0x0cu8 as char, - 'v' => 0x0bu8 as char, - 'n' => '\n', - 'r' => '\r', - 't' => '\t', - _ => c, - } -} - -struct Unescape<'a> { - string: &'a str, -} - -impl<'a> Iterator for Unescape<'a> { - type Item = char; - - #[inline] - fn size_hint(&self) -> (usize, Option) { - let slen = self.string.len(); - (min(slen, 1), None) - } - - #[inline] - fn next(&mut self) -> Option { - if self.string.len() == 0 { - return None; - } - - // is the next character an escape? - let (ret, idx) = match self.string.chars().next().unwrap() { - '\\' if self.string.len() > 1 => { - // yes---it's \ and it's not the last char in a string - // we know that \ is 1 byte long so we can index into the string safely - let c = self.string[1..].chars().next().unwrap(); - (Some(unescape_char(c)), 1 + c.len_utf8()) - }, - c => (Some(c), c.len_utf8()), // not an escape char - }; - - self.string = &self.string[idx..]; // advance the pointer to the next char - ret - } -} - -pub struct ExpandSet<'a> { - range: Range, - unesc: Peekable>, -} - -impl<'a> Iterator for ExpandSet<'a> { - type Item = char; - - #[inline] - fn size_hint(&self) -> (usize, Option) { - self.unesc.size_hint() - } - - #[inline] - fn next(&mut self) -> Option { - // while the Range has elements, try to return chars from it - // but make sure that they actually turn out to be Chars! - while let Some(n) = self.range.next() { - match from_u32(n) { - Some(c) => return Some(c), - _ => (), - } - } - - if let Some(first) = self.unesc.next() { - // peek ahead - if self.unesc.peek() == Some(&'-') && match self.unesc.size_hint() { - (x, _) if x > 1 => true, // there's a range here; record it in our internal Range struct - _ => false, - } { - self.unesc.next(); // this is the '-' - let last = self.unesc.next().unwrap(); // this is the end of the range - - self.range = first as u32 + 1 .. last as u32 + 1; - } - - return Some(first); // in any case, return the next char - } - - None - } -} - -impl<'a> ExpandSet<'a> { - #[inline] - pub fn new(s: &'a str) -> ExpandSet<'a> { - ExpandSet { - range: 0 .. 0, - unesc: Unescape { string: s }.peekable(), - } - } -} diff --git a/src/tr/tr.rs b/src/tr/tr.rs deleted file mode 100644 index 7ec6627ff..000000000 --- a/src/tr/tr.rs +++ /dev/null @@ -1,164 +0,0 @@ -#![crate_name = "tr"] -#![feature(io)] -/* - * This file is part of the uutils coreutils package. - * - * (c) Michael Gehring - * (c) kwantam - * 20150428 created `expand` module to eliminate most allocs during setup - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate bit_set; -extern crate getopts; -extern crate vec_map; - -use bit_set::BitSet; -use getopts::Options; -use std::io::{stdin, stdout, BufReader, Read, Write}; -use vec_map::VecMap; - -use expand::ExpandSet; - -#[path="../common/util.rs"] -#[macro_use] -mod util; - -mod expand; - -static NAME: &'static str = "tr"; -static VERSION: &'static str = "1.0.0"; -const BUFFER_LEN: usize = 1024; - -fn delete<'a>(set: ExpandSet<'a>, complement: bool) { - let mut bset = BitSet::new(); - let mut stdout = stdout(); - let mut buf = String::with_capacity(BUFFER_LEN + 4); - - for c in set { - bset.insert(c as usize); - } - - let is_allowed = |c : char| { - if complement { - bset.contains(&(c as usize)) - } else { - !bset.contains(&(c as usize)) - } - }; - - for c in BufReader::new(stdin()).chars() { - match c { - Ok(c) if is_allowed(c) => buf.push(c), - Ok(_) => (), - Err(err) => panic!("{}", err), - }; - if buf.len() >= BUFFER_LEN { - safe_unwrap!(stdout.write_all(&buf[..].as_bytes())); - } - } - if buf.len() > 0 { - safe_unwrap!(stdout.write_all(&buf[..].as_bytes())); - pipe_flush!(); - } -} - -fn tr<'a>(set1: ExpandSet<'a>, mut set2: ExpandSet<'a>) { - let mut map = VecMap::new(); - let mut stdout = stdout(); - let mut buf = String::with_capacity(BUFFER_LEN + 4); - - let mut s2_prev = '_'; - for i in set1 { - s2_prev = set2.next().unwrap_or(s2_prev); - - map.insert(i as usize, s2_prev); - } - - for c in BufReader::new(stdin()).chars() { - match c { - Ok(inc) => { - let trc = match map.get(&(inc as usize)) { - Some(t) => *t, - None => inc, - }; - buf.push(trc); - if buf.len() >= BUFFER_LEN { - safe_unwrap!(stdout.write_all(&buf[..].as_bytes())); - buf.truncate(0); - } - } - Err(err) => { - panic!("{}", err); - } - } - } - if buf.len() > 0 { - safe_unwrap!(stdout.write_all(&buf[..].as_bytes())); - pipe_flush!(); - } -} - -fn usage(opts: &Options) { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {} [OPTIONS] SET1 [SET2]", NAME); - println!(""); - println!("{}", opts.usage("Translate or delete characters.")); -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - - opts.optflag("c", "complement", "use the complement of SET1"); - opts.optflag("C", "", "same as -c"); - opts.optflag("d", "delete", "delete characters in SET1"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(err) => { - show_error!("{}", err); - return 1; - } - }; - - if matches.opt_present("help") { - usage(&opts); - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if matches.free.len() == 0 { - usage(&opts); - return 1; - } - - let dflag = matches.opt_present("d"); - let cflag = matches.opts_present(&["c".to_string(), "C".to_string()]); - let sets = matches.free; - - if cflag && !dflag { - show_error!("-c is only supported with -d"); - return 1; - } - - if dflag { - let set1 = ExpandSet::new(sets[0].as_ref()); - delete(set1, cflag); - } else { - let set1 = ExpandSet::new(sets[0].as_ref()); - let set2 = ExpandSet::new(sets[1].as_ref()); - tr(set1, set2); - } - - 0 -} diff --git a/src/true/Cargo.toml b/src/true/Cargo.toml deleted file mode 100644 index d5b7fe5cc..000000000 --- a/src/true/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "true" -version = "0.0.1" -authors = [] - -[lib] -name = "true" -path = "true.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/true/true.rs b/src/true/true.rs deleted file mode 100644 index 772870f54..000000000 --- a/src/true/true.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![crate_name= "true"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -pub fn uumain(_: Vec) -> i32 { - 0 -} diff --git a/src/truncate/Cargo.toml b/src/truncate/Cargo.toml deleted file mode 100644 index 2795af9fb..000000000 --- a/src/truncate/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "truncate" -version = "0.0.1" -authors = [] - -[lib] -name = "truncate" -path = "truncate.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/truncate/truncate.rs b/src/truncate/truncate.rs deleted file mode 100644 index 7cffc301b..000000000 --- a/src/truncate/truncate.rs +++ /dev/null @@ -1,215 +0,0 @@ -#![crate_name = "truncate"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Arcterus - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::ascii::AsciiExt; -use std::fs::{File, metadata, OpenOptions}; -use std::io::{Result, Write}; -use std::path::Path; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[derive(Eq, PartialEq)] -enum TruncateMode { - Reference, - Extend, - Reduce, - AtMost, - AtLeast, - RoundDown, - RoundUp -} - -static NAME: &'static str = "truncate"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("c", "no-create", "do not create files that do not exist"); - opts.optflag("o", "io-blocks", "treat SIZE as the number of I/O blocks of the file rather than bytes (NOT IMPLEMENTED)"); - opts.optopt("r", "reference", "base the size of each file on the size of RFILE", "RFILE"); - opts.optopt("s", "size", "set or adjust the size of each file according to SIZE, which is in bytes unless --io-blocks is specified", "SIZE"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { crash!(1, "{}", f) } - }; - - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {} [OPTION]... FILE...", NAME); - println!(""); - print!("{}", opts.usage("Shrink or extend the size of each file to the specified size.")); - print!(" -SIZE is an integer with an optional prefix and optional unit. -The available units (K, M, G, T, P, E, Z, and Y) use the following format: - 'KB' => 1000 (kilobytes) - 'K' => 1024 (kibibytes) - 'MB' => 1000*1000 (megabytes) - 'M' => 1024*1024 (mebibytes) - 'GB' => 1000*1000*1000 (gigabytes) - 'G' => 1024*1024*1024 (gibibytes) -SIZE may also be prefixed by one of the following to adjust the size of each -file based on its current size: - '+' => extend by - '-' => reduce by - '<' => at most - '>' => at least - '/' => round down to multiple of - '%' => round up to multiple of -"); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else if matches.free.is_empty() { - show_error!("missing an argument"); - return 1; - } else { - let no_create = matches.opt_present("no-create"); - let io_blocks = matches.opt_present("io-blocks"); - let reference = matches.opt_str("reference"); - let size = matches.opt_str("size"); - if reference.is_none() && size.is_none() { - crash!(1, "you must specify either --reference or --size"); - } else { - match truncate(no_create, io_blocks, reference, size, matches.free) { - Ok(()) => ( /* pass */ ), - Err(_) => return 1 - } - } - } - - 0 -} - -fn truncate(no_create: bool, _: bool, reference: Option, size: Option, filenames: Vec) -> Result<()> { - let (refsize, mode) = match reference { - Some(rfilename) => { - let _ = match File::open(Path::new(&rfilename)) { - Ok(m) => m, - Err(f) => { - crash!(1, "{}", f.to_string()) - } - }; - match metadata(rfilename) { - Ok(meta) => (meta.len(), TruncateMode::Reference), - Err(f) => { - crash!(1, "{}", f.to_string()) - } - } - } - None => parse_size(size.unwrap().as_ref()) - }; - for filename in filenames.iter() { - let path = Path::new(filename); - match OpenOptions::new().read(true).write(true).create(!no_create).open(path) { - Ok(file) => { - let fsize = match metadata(filename) { - Ok(meta) => meta.len(), - Err(f) => { - show_warning!("{}", f.to_string()); - continue; - } - }; - let tsize: u64 = match mode { - TruncateMode::Reference => refsize, - TruncateMode::Extend => fsize + refsize, - TruncateMode::Reduce => fsize - refsize, - TruncateMode::AtMost => if fsize > refsize { refsize } else { fsize }, - TruncateMode::AtLeast => if fsize < refsize { refsize } else { fsize }, - TruncateMode::RoundDown => fsize - fsize % refsize, - TruncateMode::RoundUp => fsize + fsize % refsize - }; - let _ = match file.set_len(tsize) { - Ok(_) => {}, - Err(f) => { - crash!(1, "{}", f.to_string()) - } - }; - } - Err(f) => { - crash!(1, "{}", f.to_string()) - } - } - } - Ok(()) -} - -fn parse_size(size: &str) -> (u64, TruncateMode) { - let mode = match size.chars().next().unwrap() { - '+' => TruncateMode::Extend, - '-' => TruncateMode::Reduce, - '<' => TruncateMode::AtMost, - '>' => TruncateMode::AtLeast, - '/' => TruncateMode::RoundDown, - '*' => TruncateMode::RoundUp, - _ => TruncateMode::Reference /* assume that the size is just a number */ - }; - let bytes = { - let mut slice = - if mode == TruncateMode::Reference { - let size: &str = size; - size - } else { - &size[1..] - }; - if slice.chars().last().unwrap().is_alphabetic() { - slice = &slice[..slice.len() - 1]; - if slice.len() > 0 && slice.chars().last().unwrap().is_alphabetic() { - slice = &slice[..slice.len() - 1]; - } - } - slice - }.to_string(); - let mut number: u64 = match bytes.parse() { - Ok(num) => num, - Err(e) => { - crash!(1, "'{}' is not a valid number: {}", size, e) - } - }; - if size.chars().last().unwrap().is_alphabetic() { - number *= match size.chars().last().unwrap().to_ascii_uppercase() { - 'B' => match size.chars().nth(size.len() - 2).unwrap().to_ascii_uppercase() { - 'K' => 1000u64, - 'M' => 1000u64.pow(2), - 'G' => 1000u64.pow(3), - 'T' => 1000u64.pow(4), - 'P' => 1000u64.pow(5), - 'E' => 1000u64.pow(6), - 'Z' => 1000u64.pow(7), - 'Y' => 1000u64.pow(8), - letter => { - crash!(1, "'{}B' is not a valid suffix.", letter) - } - }, - 'K' => 1024u64, - 'M' => 1024u64.pow(2), - 'G' => 1024u64.pow(3), - 'T' => 1024u64.pow(4), - 'P' => 1024u64.pow(5), - 'E' => 1024u64.pow(6), - 'Z' => 1024u64.pow(7), - 'Y' => 1024u64.pow(8), - letter => { - crash!(1, "'{}' is not a valid suffix.", letter) - } - }; - } - (number, mode) -} diff --git a/src/tsort/Cargo.toml b/src/tsort/Cargo.toml deleted file mode 100644 index 877cf9707..000000000 --- a/src/tsort/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "tsort" -version = "0.0.1" -authors = [] - -[lib] -name = "tsort" -path = "tsort.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/tsort/tsort.rs b/src/tsort/tsort.rs deleted file mode 100644 index 6f43aaebb..000000000 --- a/src/tsort/tsort.rs +++ /dev/null @@ -1,196 +0,0 @@ -#![crate_name = "tsort"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Ben Eggers - * (c) Akira Hayakawa - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use std::collections::{HashMap, HashSet}; -use std::fs::File; -use std::io::{BufRead, BufReader, Read, stdin, Write}; -use std::path::Path; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "tsort"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f) - }; - - if matches.opt_present("h") { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {} [OPTIONS] FILE", NAME); - println!(""); - println!("{}", opts.usage("Topological sort the strings in FILE. Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline). If FILE is not passed in, stdin is used instead.")); - return 0; - } - - if matches.opt_present("V") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let files = matches.free.clone(); - let input = if files.len() > 1 { - crash!(1, "{}, extra operand '{}'", NAME, matches.free[1]); - } else if files.is_empty() { - "-".to_string() - } else { - files[0].to_string() - }; - - let mut stdin_buf; - let mut file_buf; - let mut reader = BufReader::new( - if input == "-" { - stdin_buf = stdin(); - &mut stdin_buf as &mut Read - } else { - file_buf = match File::open(Path::new(&input)) { - Ok(a) => a, - _ => { - show_error!("{}: No such file or directory", input); - return 1; - } - }; - &mut file_buf as &mut Read - } - ); - - let mut g = Graph::new(); - loop { - let mut line = String::new(); - match reader.read_line(&mut line) { - Ok(_) => { - let tokens: Vec = line.trim_right().split_whitespace().map(|s| s.to_string()).collect(); - if tokens.len() == 0 { - break - } - for ab in tokens.chunks(2) { - match ab.len() { - 2 => g.add_edge(&ab[0], &ab[1]), - _ => crash!(1, "{}: input contains an odd number of tokens", input) - } - } - }, - _ => break - } - } - - g.run_tsort(); - - if !g.is_acyclic() { - crash!(1, "{}, input contains a loop:", input); - } - - for x in g.result.iter() { - println!("{}", x); - } - - 0 -} - -// We use String as a representation of node here -// but using integer may improve performance. -struct Graph { - in_edges: HashMap>, - out_edges: HashMap>, - result: Vec -} - -impl Graph { - fn new() -> Graph { - Graph { - in_edges: HashMap::new(), - out_edges: HashMap::new(), - result: vec!(), - } - } - - fn has_node(&self, n: &String) -> bool { - self.in_edges.contains_key(n) - } - - fn has_edge(&self, from: &String, to: &String) -> bool { - self.in_edges.get(to).unwrap().contains(from) - } - - fn init_node(&mut self, n: &String) { - self.in_edges.insert(n.clone(), HashSet::new()); - self.out_edges.insert(n.clone(), vec!()); - } - - fn add_edge(&mut self, from: &String, to: &String) { - if !self.has_node(to) { - self.init_node(to); - } - - if !self.has_node(from) { - self.init_node(from); - } - - if !self.has_edge(from, to) { - self.in_edges.get_mut(to).unwrap().insert(from.clone()); - self.out_edges.get_mut(from).unwrap().push(to.clone()); - } - } - - // Kahn's algorithm - // O(|V|+|E|) - fn run_tsort(&mut self) { - let mut start_nodes = vec!(); - for (n, edges) in self.in_edges.iter() { - if edges.is_empty() { - start_nodes.push(n.clone()); - } - } - - while !start_nodes.is_empty() { - let n = start_nodes.remove(0); - - self.result.push(n.clone()); - - let n_out_edges = self.out_edges.get_mut(&n).unwrap(); - for m in n_out_edges.iter() { - let m_in_edges = self.in_edges.get_mut(m).unwrap(); - m_in_edges.remove(&n); - - // If m doesn't have other in-coming edges add it to start_nodes - if m_in_edges.is_empty() { - start_nodes.push(m.clone()); - } - } - n_out_edges.clear(); - } - } - - fn is_acyclic(&self) -> bool { - for (_, edges) in self.out_edges.iter() { - if !edges.is_empty() { - return false - } - } - true - } -} diff --git a/src/tty/Cargo.toml b/src/tty/Cargo.toml deleted file mode 100644 index 40e4f8a82..000000000 --- a/src/tty/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "tty" -version = "0.0.1" -authors = [] - -[lib] -name = "tty" -path = "tty.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/tty/tty.rs b/src/tty/tty.rs deleted file mode 100644 index 7bac51a0f..000000000 --- a/src/tty/tty.rs +++ /dev/null @@ -1,83 +0,0 @@ -#![crate_name = "tty"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * Synced with http://lingrok.org/xref/coreutils/src/tty.c - */ - -extern crate getopts; -extern crate libc; - -use std::ffi::CStr; -use std::io::Write; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -extern { - fn ttyname(filedesc: libc::c_int) -> *const libc::c_char; - fn isatty(filedesc: libc::c_int) -> libc::c_int; -} - -static NAME: &'static str = "tty"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("s", "silent", "print nothing, only return an exit status"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { crash!(2, "{}", f) } - }; - - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {} [OPTION]...", NAME); - println!(""); - print!("{}", opts.usage("Print the file name of the terminal connected to standard input.")); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else { - let silent = matches.opt_present("s"); - - let tty = unsafe { - let ptr = ttyname(libc::STDIN_FILENO); - if !ptr.is_null() { - String::from_utf8_lossy(CStr::from_ptr(ptr).to_bytes()).to_string() - } else { - "".to_string() - } - }; - - if !silent { - if !tty.chars().all(|c| c.is_whitespace()) { - println!("{}", tty); - } else { - println!("not a tty"); - } - } - - return unsafe { - if isatty(libc::STDIN_FILENO) == 1 { - libc::EXIT_SUCCESS - } else { - libc::EXIT_FAILURE - } - }; - } - - 0 -} diff --git a/src/uname/Cargo.toml b/src/uname/Cargo.toml deleted file mode 100644 index 4f10bc75a..000000000 --- a/src/uname/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "uname" -version = "0.0.1" -authors = [] - -[lib] -name = "uname" -path = "uname.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/uname/uname.rs b/src/uname/uname.rs deleted file mode 100644 index 7b5700f85..000000000 --- a/src/uname/uname.rs +++ /dev/null @@ -1,108 +0,0 @@ -#![crate_name = "uname"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Joao Oliveira - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/* last synced with: uname (GNU coreutils) 8.21 */ - -extern crate getopts; -extern crate libc; - -use c_types::utsname; -use std::ffi::CStr; -use std::io::Write; -use std::mem::uninitialized; - -#[path = "../common/util.rs"] #[macro_use] mod util; -#[path = "../common/c_types.rs"] mod c_types; - -struct Uts { - sysname: String, - nodename: String, - release: String, - version: String, - machine: String -} - -extern { - fn uname(uts: *mut utsname); -} - -unsafe fn string_from_c_str(ptr: *const i8) -> String { - String::from_utf8_lossy(CStr::from_ptr(ptr).to_bytes()).to_string() -} - -unsafe fn getuname() -> Uts { - let mut uts: utsname = uninitialized(); - uname(&mut uts); - Uts { - sysname: string_from_c_str(uts.sysname.as_ptr() as *const i8), - nodename: string_from_c_str(uts.nodename.as_ptr() as *const i8), - release: string_from_c_str(uts.release.as_ptr() as *const i8), - version: string_from_c_str(uts.version.as_ptr() as *const i8), - machine: string_from_c_str(uts.machine.as_ptr() as *const i8) - } -} - -static NAME: &'static str = "uname"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("a", "all", "Behave as though all of the options -mnrsv were specified."); - opts.optflag("m", "machine", "print the machine hardware name."); - opts.optflag("n", "nodename", "print the nodename (the nodename may be a name that the system is known by to a communications network)."); - opts.optflag("p", "processor", "print the machine processor architecture name."); - opts.optflag("r", "release", "print the operating system release."); - opts.optflag("s", "sysname", "print the operating system name."); - opts.optflag("v", "version", "print the operating system version."); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f), - }; - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {} [OPTIONS]", NAME); - println!(""); - print!("{}", opts.usage("The uname utility writes symbols representing one or more system characteristics to the standard output.")); - return 0; - } - let uname = unsafe { getuname() }; - let mut output = String::new(); - if matches.opt_present("sysname") || matches.opt_present("all") - || !matches.opts_present(&["nodename".to_string(), "release".to_string(), "version".to_string(), "machine".to_string()]) { - output.push_str(uname.sysname.as_ref()); - output.push_str(" "); - } - - if matches.opt_present("nodename") || matches.opt_present("all") { - output.push_str(uname.nodename.as_ref()); - output.push_str(" "); - } - if matches.opt_present("release") || matches.opt_present("all") { - output.push_str(uname.release.as_ref()); - output.push_str(" "); - } - if matches.opt_present("version") || matches.opt_present("all") { - output.push_str(uname.version.as_ref()); - output.push_str(" "); - } - if matches.opt_present("machine") || matches.opt_present("all") { - output.push_str(uname.machine.as_ref()); - output.push_str(" "); - } - println!("{}", output.trim()); - - 0 -} diff --git a/src/unexpand/Cargo.toml b/src/unexpand/Cargo.toml deleted file mode 100644 index 4e631f138..000000000 --- a/src/unexpand/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "unexpand" -version = "0.0.1" -authors = [] - -[lib] -name = "unexpand" -path = "unexpand.rs" - -[dependencies] -getopts = "*" -libc = "*" -unicode-width = "*" diff --git a/src/unexpand/deps.mk b/src/unexpand/deps.mk deleted file mode 100644 index fb8005c0c..000000000 --- a/src/unexpand/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += unicode-width diff --git a/src/unexpand/unexpand.rs b/src/unexpand/unexpand.rs deleted file mode 100644 index af138dcef..000000000 --- a/src/unexpand/unexpand.rs +++ /dev/null @@ -1,283 +0,0 @@ -#![crate_name = "unexpand"] -#![feature(unicode)] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Virgile Andreani - * (c) kwantam - * 20150428 updated to work with both UTF-8 and non-UTF-8 encodings - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; -extern crate rustc_unicode; -extern crate unicode_width; - -use std::fs::File; -use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Stdout, Write}; -use std::str::from_utf8; -use rustc_unicode::str::utf8_char_width; -use unicode_width::UnicodeWidthChar; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "unexpand"; -static VERSION: &'static str = "0.0.1"; - -static DEFAULT_TABSTOP: usize = 8; - -fn tabstops_parse(s: String) -> Vec { - let words = s.split(',').collect::>(); - - let nums = words.into_iter() - .map(|sn| sn.parse() - .unwrap_or_else( - |_| crash!(1, "{}\n", "tab size contains invalid character(s)")) - ) - .collect::>(); - - if nums.iter().any(|&n| n == 0) { - crash!(1, "{}\n", "tab size cannot be 0"); - } - - match nums.iter().fold((true, 0), |(acc, last), &n| (acc && last <= n, n)) { - (false, _) => crash!(1, "{}\n", "tab sizes must be ascending"), - _ => {} - } - - nums -} - -struct Options { - files: Vec, - tabstops: Vec, - aflag: bool, - uflag: bool, -} - -impl Options { - fn new(matches: getopts::Matches) -> Options { - let tabstops = match matches.opt_str("t") { - None => vec!(DEFAULT_TABSTOP), - Some(s) => tabstops_parse(s) - }; - - let aflag = (matches.opt_present("all") || matches.opt_present("tabs")) - && !matches.opt_present("first-only"); - let uflag = !matches.opt_present("U"); - - let files = - if matches.free.is_empty() { - vec!("-".to_string()) - } else { - matches.free - }; - - Options { files: files, tabstops: tabstops, aflag: aflag, uflag: uflag } - } -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = getopts::Options::new(); - - opts.optflag("a", "all", "convert all blanks, instead of just initial blanks"); - opts.optflag("", "first-only", "convert only leading sequences of blanks (overrides -a)"); - opts.optopt("t", "tabs", "have tabs N characters apart instead of 8 (enables -a)", "N"); - opts.optopt("t", "tabs", "use comma separated LIST of tab positions (enables -a)", "LIST"); - opts.optflag("U", "no-utf8", "interpret input file as 8-bit ASCII rather than UTF-8"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f) - }; - - if matches.opt_present("help") { - println!("{} {}\n", NAME, VERSION); - println!("Usage: {} [OPTION]... [FILE]...\n", NAME); - println!("{}", opts.usage( - "Convert blanks in each FILE to tabs, writing to standard output.\n\ - With no FILE, or when FILE is -, read standard input.")); - return 0; - } - - if matches.opt_present("V") { - println!("{} {}", NAME, VERSION); - return 0; - } - - unexpand(Options::new(matches)); - - 0 -} - -fn open(path: String) -> BufReader> { - let file_buf; - if path == "-" { - BufReader::new(Box::new(stdin()) as Box) - } else { - file_buf = match File::open(&path[..]) { - Ok(a) => a, - Err(e) => crash!(1, "{}: {}", &path[..], e), - }; - BufReader::new(Box::new(file_buf) as Box) - } -} - -fn next_tabstop(tabstops: &[usize], col: usize) -> Option { - if tabstops.len() == 1 { - Some(tabstops[0] - col % tabstops[0]) - } else { - // find next larger tab - match tabstops.iter().skip_while(|&&t| t <= col).next() { - Some(t) => Some(t - col), - None => None, // if there isn't one in the list, tab becomes a single space - } - } -} - -fn write_tabs(mut output: &mut BufWriter, tabstops: &[usize], - mut scol: usize, col: usize, prevtab: bool, init: bool, amode: bool) { - // This conditional establishes the following: - // We never turn a single space before a non-blank into - // a tab, unless it's at the start of the line. - let ai = init || amode; - if (ai && !prevtab && col > scol + 1) || - (col > scol && (init || ai && prevtab)) { - while let Some(nts) = next_tabstop(tabstops, scol) { - if col < scol + nts { - break; - } - - safe_unwrap!(output.write_all("\t".as_bytes())); - scol += nts; - } - } - - while col > scol { - safe_unwrap!(output.write_all(" ".as_bytes())); - scol += 1; - } -} - -#[derive(PartialEq, Eq, Debug)] -enum CharType { - Backspace, - Space, - Tab, - Other, -} - -fn unexpand(options: Options) { - use self::CharType::*; - - let mut output = BufWriter::new(stdout()); - let ts = &options.tabstops[..]; - let mut buf = Vec::new(); - let lastcol = if ts.len() > 1 { - *ts.last().unwrap() - } else { - 0 - }; - - for file in options.files.into_iter() { - let mut fh = open(file); - - while match fh.read_until('\n' as u8, &mut buf) { - Ok(s) => s > 0, - Err(_) => buf.len() > 0, - } { - let mut byte = 0; // offset into the buffer - let mut col = 0; // the current column - let mut scol = 0; // the start col for the current span, i.e., the already-printed width - let mut init = true; // are we at the start of the line? - let mut pctype = Other; - - while byte < buf.len() { - // when we have a finite number of columns, never convert past the last column - if lastcol > 0 && col >= lastcol { - write_tabs(&mut output, ts, scol, col, pctype == Tab, init, true); - safe_unwrap!(output.write_all(&buf[byte..])); - scol = col; - break; - } - - let (ctype, cwidth, nbytes) = if options.uflag { - let nbytes = utf8_char_width(buf[byte]); - - // figure out how big the next char is, if it's UTF-8 - if byte + nbytes > buf.len() { - // make sure we don't overrun the buffer because of invalid UTF-8 - (Other, 1, 1) - } else if let Ok(t) = from_utf8(&buf[byte..byte+nbytes]) { - // Now that we think it's UTF-8, figure out what kind of char it is - match t.chars().next() { - Some(' ') => (Space, 0, 1), - Some('\t') => (Tab, 0, 1), - Some('\x08') => (Backspace, 0, 1), - Some(c) => (Other, UnicodeWidthChar::width(c).unwrap_or(0), nbytes), - None => { // invalid char snuck past the utf8_validation_iterator somehow??? - (Other, 1, 1) - }, - } - } else { - // otherwise, it's not valid - (Other, 1, 1) // implicit assumption: non-UTF8 char has display width 1 - } - } else { - (match buf[byte] { // always take exactly 1 byte in strict ASCII mode - 0x20 => Space, - 0x09 => Tab, - 0x08 => Backspace, - _ => Other, - }, 1, 1) - }; - - // now figure out how many columns this char takes up, and maybe print it - let tabs_buffered = init || options.aflag; - match ctype { - Space | Tab => { // compute next col, but only write space or tab chars if not buffering - col += if ctype == Space { - 1 - } else { - next_tabstop(ts, col).unwrap_or(1) - }; - - if !tabs_buffered { - safe_unwrap!(output.write_all(&buf[byte..byte+nbytes])); - scol = col; // now printed up to this column - } - }, - Other | Backspace => { // always - write_tabs(&mut output, ts, scol, col, pctype == Tab, init, options.aflag); - init = false; // no longer at the start of a line - col = if ctype == Other { // use computed width - col + cwidth - } else if col > 0 { // Backspace case, but only if col > 0 - col - 1 - } else { - 0 - }; - safe_unwrap!(output.write_all(&buf[byte..byte+nbytes])); - scol = col; // we've now printed up to this column - }, - } - - byte += nbytes; // move on to next char - pctype = ctype; // save the previous type - } - - // write out anything remaining - write_tabs(&mut output, ts, scol, col, pctype == Tab, init, true); - buf.truncate(0); // clear out the buffer - } - } - pipe_flush!(output); -} diff --git a/src/uniq/Cargo.toml b/src/uniq/Cargo.toml deleted file mode 100644 index 81245beb1..000000000 --- a/src/uniq/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "uniq" -version = "0.0.1" -authors = [] - -[lib] -name = "uniq" -path = "uniq.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/uniq/uniq.rs b/src/uniq/uniq.rs deleted file mode 100644 index b70b0881a..000000000 --- a/src/uniq/uniq.rs +++ /dev/null @@ -1,242 +0,0 @@ -#![crate_name = "uniq"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Chirag B Jadwani - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - */ - -extern crate getopts; - -use getopts::{Matches, Options}; -use std::cmp::min; -use std::fs::File; -use std::io::{BufRead, BufReader, BufWriter, Read, stdin, stdout, Write}; -use std::path::Path; -use std::str::FromStr; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "uniq"; -static VERSION: &'static str = "1.0.0"; - -struct Uniq { - repeats_only: bool, - uniques_only: bool, - all_repeated: bool, - delimiters: String, - show_counts: bool, - skip_fields: Option, - slice_start: Option, - slice_stop: Option, - ignore_case: bool, -} - -impl Uniq { - pub fn print_uniq(&self, reader: &mut BufReader, writer: &mut BufWriter) { - let mut lines: Vec = vec!(); - let mut first_line_printed = false; - let delimiters = &self.delimiters[..]; - - for io_line in reader.lines() { - let line = crash_if_err!(1, io_line); - if !lines.is_empty() && self.cmp_key(&self.skip_fields(&lines[0])) != self.cmp_key(&self.skip_fields(&line)) { - let print_delimiter = delimiters == "prepend" || (delimiters == "separate" && first_line_printed); - first_line_printed |= self.print_lines(writer, &lines, print_delimiter); - lines.truncate(0); - } - lines.push(line); - } - if !lines.is_empty() { - let print_delimiter = delimiters == "prepend" || (delimiters == "separate" && first_line_printed); - self.print_lines(writer, &lines, print_delimiter); - } - } - - fn skip_fields(&self, line: &String) -> String { - match self.skip_fields { - Some(skip_fields) => - if line.split_whitespace().count() > skip_fields { - let mut field = 0; - let mut i = 0; - while field < skip_fields && i < line.len() { - while i < line.len() && line.chars().nth(i).unwrap().is_whitespace() { - i = i + 1; - } - while i < line.len() && !line.chars().nth(i).unwrap().is_whitespace() { - i = i + 1; - } - field = field + 1; - } - line[i..].to_string() - } else { - "".to_string() - }, - None => line[..].to_string() - } - } - - fn cmp_key(&self, line: &String) -> String { - let len = line.len(); - if len > 0 { - let slice_start = match self.slice_start { - Some(i) => min(i, len - 1), - None => 0 - }; - let slice_stop = match self.slice_stop { - Some(i) => min(slice_start + i, len), - None => len - }; - - line[slice_start..slice_stop].chars() - .map(|c| match c { - 'a' ... 'z' if self.ignore_case => ((c as u8) - 32) as char, - _ => c, - }).collect() - } else { - line.clone() - } - } - - fn print_lines(&self, writer: &mut BufWriter, lines: &Vec, print_delimiter: bool) -> bool { - let mut first_line_printed = false; - let mut count = if self.all_repeated { 1 } else { lines.len() }; - if lines.len() == 1 && !self.repeats_only - || lines.len() > 1 && !self.uniques_only { - self.print_line(writer, &lines[0], count, print_delimiter); - first_line_printed = true; - count += 1; - } - if self.all_repeated { - for line in lines[1..].iter() { - self.print_line(writer, line, count, print_delimiter && !first_line_printed); - first_line_printed = true; - count += 1; - } - } - first_line_printed - } - - fn print_line(&self, writer: &mut BufWriter, line: &String, count: usize, print_delimiter: bool) { - if print_delimiter { - crash_if_err!(1, writer.write_all(&['\n' as u8])); - } - - crash_if_err!(1, if self.show_counts { - writer.write_all(format!("{:7} {}", count, line).as_bytes()) - } else { - writer.write_all(line.as_bytes()) - }); - crash_if_err!(1, writer.write_all("\n".as_bytes())); - } -} - -fn opt_parsed(opt_name: &str, matches: &Matches) -> Option { - matches.opt_str(opt_name).map(|arg_str| { - let opt_val: Option = arg_str.parse().ok(); - opt_val.unwrap_or_else(|| - crash!(1, "Invalid argument for {}: {}", opt_name, arg_str)) - }) -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - - opts.optflag("c", "count", "prefix lines by the number of occurrences"); - opts.optflag("d", "repeated", "only print duplicate lines"); - opts.optflagopt( - "D", - "all-repeated", - "print all duplicate lines delimit-method={none(default),prepend,separate} Delimiting is done with blank lines", - "delimit-method" - ); - opts.optopt("f", "skip-fields", "avoid comparing the first N fields", "N"); - opts.optopt("s", "skip-chars", "avoid comparing the first N characters", "N"); - opts.optopt("w", "check-chars", "compare no more than N characters in lines", "N"); - opts.optflag("i", "ignore-case", "ignore differences in case when comparing"); - opts.optflag("u", "unique", "only print unique lines"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f) - }; - - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {0} [OPTION]... [FILE]...", NAME); - println!(""); - print!("{}", opts.usage("Filter adjacent matching lines from INPUT (or standard input),\n\ - writing to OUTPUT (or standard output).")); - println!(""); - println!("Note: '{0}' does not detect repeated lines unless they are adjacent.\n\ - You may want to sort the input first, or use 'sort -u' without '{0}'.\n", NAME); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else { - let (in_file_name, out_file_name) = match matches.free.len() { - 0 => ("-".to_string(), "-".to_string()), - 1 => (matches.free[0].clone(), "-".to_string()), - 2 => (matches.free[0].clone(), matches.free[1].clone()), - _ => { - crash!(1, "Extra operand: {}", matches.free[2]); - } - }; - let uniq = Uniq { - repeats_only: matches.opt_present("repeated") || matches.opt_present("all-repeated"), - uniques_only: matches.opt_present("unique"), - all_repeated: matches.opt_present("all-repeated"), - delimiters: match matches.opt_default("all-repeated", "none") { - Some(ref opt_arg) if opt_arg != "none" => { - let rep_args = ["prepend".to_string(), "separate".to_string()]; - if !rep_args.contains(opt_arg) { - crash!(1, "Incorrect argument for all-repeated: {}", opt_arg.clone()); - } - opt_arg.clone() - }, - _ => "".to_string() - }, - show_counts: matches.opt_present("count"), - skip_fields: opt_parsed("skip-fields", &matches), - slice_start: opt_parsed("skip-chars", &matches), - slice_stop: opt_parsed("check-chars", &matches), - ignore_case: matches.opt_present("ignore-case"), - }; - uniq.print_uniq(&mut open_input_file(in_file_name), - &mut open_output_file(out_file_name)); - } - 0 -} - -fn open_input_file(in_file_name: String) -> BufReader> { - let in_file = if in_file_name == "-" { - Box::new(stdin()) as Box - } else { - let path = Path::new(&in_file_name[..]); - let in_file = File::open(&path); - let r = crash_if_err!(1, in_file); - Box::new(r) as Box - }; - BufReader::new(in_file) -} - -fn open_output_file(out_file_name: String) -> BufWriter> { - let out_file = if out_file_name == "-" { - Box::new(stdout()) as Box - } else { - let path = Path::new(&out_file_name[..]); - let in_file = File::create(&path); - let w = crash_if_err!(1, in_file); - Box::new(w) as Box - }; - BufWriter::new(out_file) -} diff --git a/src/unlink/Cargo.toml b/src/unlink/Cargo.toml deleted file mode 100644 index 11c4a5a33..000000000 --- a/src/unlink/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "unlink" -version = "0.0.1" -authors = [] - -[lib] -name = "unlink" -path = "unlink.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/unlink/unlink.rs b/src/unlink/unlink.rs deleted file mode 100644 index 1c9a5e02d..000000000 --- a/src/unlink/unlink.rs +++ /dev/null @@ -1,96 +0,0 @@ -#![crate_name = "unlink"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Colin Warren - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/* last synced with: unlink (GNU coreutils) 8.21 */ - -extern crate getopts; -extern crate libc; - -use getopts::Options; -use libc::consts::os::posix88::{S_IFMT, S_IFLNK, S_IFREG}; -use libc::funcs::posix01::stat_::lstat; -use libc::funcs::posix88::unistd::unlink; -use libc::types::os::arch::c95::c_char; -use libc::types::os::arch::posix01::stat; -use std::io::{Error, ErrorKind, Write}; -use std::mem::uninitialized; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "unlink"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "invalid options\n{}", f) - }; - - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {} [FILE]... [OPTION]...", NAME); - println!(""); - println!("{}", opts.usage("Unlink the file at [FILE].")); - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if matches.free.len() == 0 { - crash!(1, "missing operand\nTry '{0} --help' for more information.", NAME); - } else if matches.free.len() > 1 { - crash!(1, "extra operand: '{1}'\nTry '{0} --help' for more information.", NAME, matches.free[1]); - } - - let st_mode = { - let mut buf: stat = unsafe { uninitialized() }; - let result = unsafe { lstat(matches.free[0].as_ptr() as *const c_char, &mut buf as *mut stat) }; - - if result < 0 { - crash!(1, "Cannot stat '{}': {}", matches.free[0], Error::last_os_error()); - } - - buf.st_mode & S_IFMT - }; - - let result = if st_mode != S_IFREG && st_mode != S_IFLNK { - Err(Error::new(ErrorKind::Other, "Not a regular file or symlink")) - } else { - let result = unsafe { unlink(matches.free[0].as_ptr() as *const c_char) }; - - if result < 0 { - Err(Error::last_os_error()) - } else { - Ok(()) - } - }; - - match result { - Ok(_) => (), - Err(e) => { - crash!(1, "cannot unlink '{0}': {1}", matches.free[0], e); - } - } - - 0 -} diff --git a/src/uptime/Cargo.toml b/src/uptime/Cargo.toml deleted file mode 100644 index 9572f295f..000000000 --- a/src/uptime/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "uptime" -version = "0.0.1" -authors = [] - -[lib] -name = "uptime" -path = "uptime.rs" - -[dependencies] -getopts = "*" -libc = "*" -time = "*" diff --git a/src/uptime/deps.mk b/src/uptime/deps.mk deleted file mode 100644 index b6534caec..000000000 --- a/src/uptime/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += time diff --git a/src/uptime/uptime.rs b/src/uptime/uptime.rs deleted file mode 100644 index 7b3730ef5..000000000 --- a/src/uptime/uptime.rs +++ /dev/null @@ -1,207 +0,0 @@ -#![crate_name = "uptime"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/* last synced with: cat (GNU coreutils) 8.13 */ - -extern crate getopts; -extern crate libc; -extern crate time as rtime; - -use getopts::Options; -use libc::{time_t, c_double, c_int, c_char}; -use std::ffi::CString; -use std::fs::File; -use std::io::{Read, Write}; -use std::mem::transmute; -use std::ptr::null; -use utmpx::*; - -#[path = "../common/util.rs"] #[macro_use] mod util; - -#[path = "../common/c_types.rs"] mod c_types; - -#[path = "../common/utmpx.rs"] mod utmpx; - -static NAME: &'static str = "uptime"; -static VERSION: &'static str = "1.0.0"; - -#[cfg(unix)] -extern { - fn getloadavg(loadavg: *mut c_double, nelem: c_int) -> c_int; - - fn getutxent() -> *const c_utmp; - fn setutxent(); - fn endutxent(); - - #[cfg(any(target_os = "macos", target_os = "linux"))] - fn utmpxname(file: *const c_char) -> c_int; -} - -#[cfg(windows)] -extern { - fn GetTickCount() -> libc::uint32_t; -} - -#[cfg(target_os = "freebsd")] -unsafe extern fn utmpxname(_file: *const c_char) -> c_int { - 0 -} - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - - opts.optflag("v", "version", "output version information and exit"); - opts.optflag("h", "help", "display this help and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f) - }; - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - if matches.opt_present("help") || matches.free.len() > 0 { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {0} [OPTION]", NAME); - println!(""); - println!("{}", opts.usage("Print the current time, the length of time the system has been up,\n\ - the number of users on the system, and the average number of jobs\n\ - in the run queue over the last 1, 5 and 15 minutes.")); - return 0; - } - - print_time(); - let (boot_time, user_count) = process_utmpx(); - let upsecs = get_uptime(boot_time) / 100; - print_uptime(upsecs); - print_nusers(user_count); - print_loadavg(); - - 0 -} - -fn print_loadavg() { - let mut avg: [c_double; 3] = [0.0; 3]; - let loads: i32 = unsafe { transmute(getloadavg(avg.as_mut_ptr(), 3)) }; - - if loads == -1 { - print!("\n"); - } - else { - print!("load average: "); - for n in 0..loads { - print!("{:.2}{}", avg[n as usize], if n == loads - 1 { "\n" } - else { ", " } ); - } - } -} - -#[cfg(unix)] -fn process_utmpx() -> (Option, usize) { - unsafe { - utmpxname(CString::new(DEFAULT_FILE).unwrap().as_ptr()); - } - - let mut nusers = 0; - let mut boot_time = None; - - unsafe { - setutxent(); - - loop { - let line = getutxent(); - - if line == null() { - break; - } - - match (*line).ut_type { - USER_PROCESS => nusers += 1, - BOOT_TIME => { - let t = (*line).ut_tv; - if t.tv_sec > 0 { - boot_time = Some(t.tv_sec); - } - }, - _ => continue - } - } - - endutxent(); - } - - (boot_time, nusers) -} - -#[cfg(windows)] -fn process_utmpx() -> (Option, usize) { - (None, 0) // TODO: change 0 to number of users -} - -fn print_nusers(nusers: usize) { - if nusers == 1 { - print!("1 user, "); - } else if nusers > 1 { - print!("{} users, ", nusers); - } -} - -fn print_time() { - let local_time = rtime::now(); - - print!(" {:02}:{:02}:{:02} ", local_time.tm_hour, - local_time.tm_min, local_time.tm_sec); -} - -#[cfg(unix)] -fn get_uptime(boot_time: Option) -> i64 { - let mut proc_uptime = String::new(); - - if let Some(n) = - File::open("/proc/uptime").ok() - .and_then(|mut f| f.read_to_string(&mut proc_uptime).ok()) - .and_then(|_| proc_uptime.split_whitespace().next()) - .and_then(|s| s.replace(".", "").parse().ok()) { - n - } else { - match boot_time { - Some(t) => { - let now = rtime::get_time().sec; - let time = t as i64; - ((now - time) * 100) - }, - _ => -1, - } - } -} - -#[cfg(windows)] -fn get_uptime(boot_time: Option) -> i64 { - unsafe { GetTickCount() as i64 } -} - -fn print_uptime(upsecs: i64) { - let updays = upsecs / 86400; - let uphours = (upsecs - (updays * 86400)) / 3600; - let upmins = (upsecs - (updays * 86400) - (uphours * 3600)) / 60; - if updays == 1 { - print!("up {:1} day, {:2}:{:02}, ", updays, uphours, upmins); - } - else if updays > 1 { - print!("up {:1} days, {:2}:{:02}, ", updays, uphours, upmins); - } - else { - print!("up {:2}:{:02}, ", uphours, upmins); - } -} diff --git a/src/users/Cargo.toml b/src/users/Cargo.toml deleted file mode 100644 index ce7cea1f5..000000000 --- a/src/users/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "users" -version = "0.0.1" -authors = [] - -[lib] -name = "users" -path = "users.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/users/users.rs b/src/users/users.rs deleted file mode 100644 index d46092f8b..000000000 --- a/src/users/users.rs +++ /dev/null @@ -1,122 +0,0 @@ -#![crate_name = "users"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) KokaKiwi - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/* last synced with: whoami (GNU coreutils) 8.22 */ - -// Allow dead code here in order to keep all fields, constants here, for consistency. -#![allow(dead_code)] - -extern crate getopts; -extern crate libc; - -use getopts::Options; -use std::ffi::{CStr, CString}; -use std::mem; -use std::ptr; -use utmpx::*; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/utmpx.rs"] -mod utmpx; - -extern { - fn getutxent() -> *const c_utmp; - fn getutxid(ut: *const c_utmp) -> *const c_utmp; - fn getutxline(ut: *const c_utmp) -> *const c_utmp; - - fn pututxline(ut: *const c_utmp) -> *const c_utmp; - - fn setutxent(); - fn endutxent(); - - #[cfg(any(target_os = "macos", target_os = "linux"))] - fn utmpxname(file: *const libc::c_char) -> libc::c_int; -} - -#[cfg(target_os = "freebsd")] -unsafe extern fn utmpxname(_file: *const libc::c_char) -> libc::c_int { - 0 -} - -static NAME: &'static str = "users"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => panic!("{}", f), - }; - - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {} [OPTION]... [FILE]", NAME); - println!(""); - println!("{}", opts.usage("Output who is currently logged in according to FILE.")); - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let filename = if matches.free.len() > 0 { - matches.free[0].as_ref() - } else { - DEFAULT_FILE - }; - - exec(filename); - - 0 -} - -fn exec(filename: &str) { - unsafe { - utmpxname(CString::new(filename).unwrap().as_ptr()); - } - - let mut users = vec!(); - - unsafe { - setutxent(); - - loop { - let line = getutxent(); - - if line == ptr::null() { - break; - } - - if (*line).ut_type == USER_PROCESS { - let user = String::from_utf8_lossy(CStr::from_ptr(mem::transmute(&(*line).ut_user)).to_bytes()).to_string(); - users.push(user); - } - } - - endutxent(); - } - - if users.len() > 0 { - users.sort(); - println!("{}", users.join(" ")); - } -} diff --git a/src/uutils/uutils.rs b/src/uutils/uutils.rs deleted file mode 100644 index 934acede4..000000000 --- a/src/uutils/uutils.rs +++ /dev/null @@ -1,105 +0,0 @@ -#![crate_name = "uutils"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Michael Gehring - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -@CRATES@ - -use std::env; -use std::collections::hash_map::HashMap; -use std::path::Path; - -static NAME: &'static str = "uutils"; -static VERSION: &'static str = "1.0.0"; - -type UtilityMap = HashMap<&'static str, fn(Vec) -> i32>; - -fn util_map() -> UtilityMap { - let mut map: UtilityMap = HashMap::new(); - @UTIL_MAP@ - map -} - -fn usage(cmap: &UtilityMap) { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {} [util [arguments...]]\n", NAME); - println!("Currently defined functions:"); - let mut utils: Vec<&str> = cmap.keys().map(|&s| s).collect(); - utils.sort(); - for util in utils.iter() { - println!("\t{}", util); - } -} - -fn main() { - let umap = util_map(); - let mut args : Vec = env::args().collect(); - - // try binary name as util name. - let args0 = args[0].clone(); - let binary = Path::new(&args0[..]); - let binary_as_util = binary.file_name().unwrap().to_str().unwrap(); - - match umap.get(binary_as_util) { - Some(&uumain) => { - std::process::exit(uumain(args)); - } - None => (), - } - - if binary_as_util.ends_with("uutils") || binary_as_util.starts_with("uutils") || - binary_as_util.ends_with("busybox") || binary_as_util.starts_with("busybox") { - // uutils can be called as either "uutils", "busybox" - // "uutils-suffix" or "busybox-suffix". Not sure - // what busybox uses the -suffix pattern for. - } else { - println!("{}: applet not found", binary_as_util); - std::process::exit(1); - } - - // try first arg as util name. - if args.len() >= 2 { - args.remove(0); - let util = &args[0][..]; - - match umap.get(util) { - Some(&uumain) => { - std::process::exit(uumain(args.clone())); - } - None => { - if &args[0][..] == "--help" { - // see if they want help on a specific util - if args.len() >= 2 { - let util = &args[1][..]; - match umap.get(util) { - Some(&uumain) => { - std::process::exit(uumain(vec![util.to_string(), "--help".to_string()])); - } - None => { - println!("{}: applet not found", util); - std::process::exit(1); - } - } - } - usage(&umap); - std::process::exit(0); - } else { - println!("{}: applet not found", util); - std::process::exit(1); - } - } - } - } else { - // no arguments provided - usage(&umap); - std::process::exit(0); - } -} diff --git a/src/uutils/uutils_cargo.rs b/src/uutils/uutils_cargo.rs deleted file mode 100644 index 275459147..000000000 --- a/src/uutils/uutils_cargo.rs +++ /dev/null @@ -1,99 +0,0 @@ -#![crate_name = "uutils"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Michael Gehring - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -include!(concat!(env!("OUT_DIR"), "/uutils_crates.rs")); - -use std::env; -use std::collections::hash_map::HashMap; -use std::path::Path; - -static NAME: &'static str = "uutils"; -static VERSION: &'static str = "0.0.1"; - -include!(concat!(env!("OUT_DIR"), "/uutils_map.rs")); - -fn usage(cmap: &UtilityMap) { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {} [util [arguments...]]\n", NAME); - println!("Currently defined functions:"); - let mut utils: Vec<&str> = cmap.keys().map(|&s| s).collect(); - utils.sort(); - for util in utils.iter() { - println!("\t{}", util); - } -} - -fn main() { - let umap = util_map(); - let mut args : Vec = env::args().collect(); - - // try binary name as util name. - let args0 = args[0].clone(); - let binary = Path::new(&args0[..]); - let binary_as_util = binary.file_name().unwrap().to_str().unwrap(); - - match umap.get(binary_as_util) { - Some(&uumain) => { - std::process::exit(uumain(args)); - } - None => (), - } - - if binary_as_util.ends_with("uutils") || binary_as_util.starts_with("uutils") || - binary_as_util.ends_with("busybox") || binary_as_util.starts_with("busybox") { - // uutils can be called as either "uutils", "busybox" - // "uutils-suffix" or "busybox-suffix". Not sure - // what busybox uses the -suffix pattern for. - } else { - println!("{}: applet not found", binary_as_util); - std::process::exit(1); - } - - // try first arg as util name. - if args.len() >= 2 { - args.remove(0); - let util = &args[0][..]; - - match umap.get(util) { - Some(&uumain) => { - std::process::exit(uumain(args.clone())); - } - None => { - if &args[0][..] == "--help" { - // see if they want help on a specific util - if args.len() >= 2 { - let util = &args[1][..]; - match umap.get(util) { - Some(&uumain) => { - std::process::exit(uumain(vec![util.to_string(), "--help".to_string()])); - } - None => { - println!("{}: applet not found", util); - std::process::exit(1); - } - } - } - usage(&umap); - std::process::exit(0); - } else { - println!("{}: applet not found", util); - std::process::exit(1); - } - } - } - } else { - // no arguments provided - usage(&umap); - std::process::exit(0); - } -} diff --git a/src/wc/Cargo.toml b/src/wc/Cargo.toml deleted file mode 100644 index cb46772b6..000000000 --- a/src/wc/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "wc" -version = "0.0.1" -authors = [] - -[lib] -name = "wc" -path = "wc.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/wc/wc.rs b/src/wc/wc.rs deleted file mode 100644 index a4215b88c..000000000 --- a/src/wc/wc.rs +++ /dev/null @@ -1,284 +0,0 @@ -#![crate_name = "wc"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Boden Garman - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate getopts; -extern crate libc; - -use getopts::{Matches, Options}; -use std::ascii::AsciiExt; -use std::fs::File; -use std::io::{stdin, BufRead, BufReader, Read, Write}; -use std::path::Path; -use std::result::Result as StdResult; -use std::str::from_utf8; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -#[path = "../common/filesystem.rs"] -mod filesystem; - -use filesystem::UUPathExt; - -struct Settings { - show_bytes: bool, - show_chars: bool, - show_lines: bool, - show_words: bool, - show_max_line_length: bool, -} - -impl Settings { - fn new(matches: &Matches) -> Settings { - let settings = Settings { - show_bytes: matches.opt_present("bytes"), - show_chars: matches.opt_present("chars"), - show_lines: matches.opt_present("lines"), - show_words: matches.opt_present("words"), - show_max_line_length: matches.opt_present("L"), - }; - - if settings.show_bytes - || settings.show_chars - || settings.show_lines - || settings.show_words - || settings.show_max_line_length { - return settings; - } - - Settings { - show_bytes: true, - show_chars: false, - show_lines: true, - show_words: true, - show_max_line_length: false, - } - } -} - -struct Result { - title: String, - bytes: usize, - chars: usize, - lines: usize, - words: usize, - max_line_length: usize, -} - -static NAME: &'static str = "wc"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - - opts.optflag("c", "bytes", "print the byte counts"); - opts.optflag("m", "chars", "print the character counts"); - opts.optflag("l", "lines", "print the newline counts"); - opts.optflag("L", "max-line-length", "print the length of the longest line"); - opts.optflag("w", "words", "print the word counts"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let mut matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f) - }; - - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {0} [OPTION]... [FILE]...", NAME); - println!(""); - println!("{}", opts.usage("Print newline, word and byte counts for each FILE")); - println!("With no FILE, or when FILE is -, read standard input."); - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if matches.free.is_empty() { - matches.free.push("-".to_string()); - } - - let settings = Settings::new(&matches); - - match wc(matches.free, &settings) { - Ok(()) => ( /* pass */ ), - Err(e) => return e - } - - 0 -} - -const CR: u8 = '\r' as u8; -const LF: u8 = '\n' as u8; -const SPACE: u8 = ' ' as u8; -const TAB: u8 = '\t' as u8; -const SYN: u8 = 0x16 as u8; -const FF: u8 = 0x0C as u8; - -#[inline(always)] -fn is_word_seperator(byte: u8) -> bool { - byte == SPACE || byte == TAB || byte == CR || byte == SYN || byte == FF -} - -fn wc(files: Vec, settings: &Settings) -> StdResult<(), i32> { - let mut total_line_count: usize = 0; - let mut total_word_count: usize = 0; - let mut total_char_count: usize = 0; - let mut total_byte_count: usize = 0; - let mut total_longest_line_length: usize = 0; - - let mut results = vec!(); - let mut max_width: usize = 0; - - for path in files.iter() { - let mut reader = try!(open(&path[..])); - - let mut line_count: usize = 0; - let mut word_count: usize = 0; - let mut byte_count: usize = 0; - let mut char_count: usize = 0; - let mut longest_line_length: usize = 0; - let mut raw_line = Vec::new(); - - // reading from a TTY seems to raise a condition on, rather than return Some(0) like a file. - // hence the option wrapped in a result here - while match reader.read_until(LF, &mut raw_line) { - Ok(n) if n > 0 => true, - Err(ref e) if raw_line.len() > 0 => { - show_warning!("Error while reading {}: {}", path, e); - raw_line.len() > 0 - }, - _ => false, - } { - // GNU 'wc' only counts lines that end in LF as lines - if *raw_line.last().unwrap() == LF { - line_count += 1; - } - - byte_count += raw_line.len(); - - // try and convert the bytes to UTF-8 first - let current_char_count; - match from_utf8(&raw_line[..]) { - Ok(line) => { - word_count += line.split_whitespace().count(); - current_char_count = line.chars().count(); - }, - Err(..) => { - word_count += raw_line.split(|&x| is_word_seperator(x)).count(); - current_char_count = raw_line.iter().filter(|c|c.is_ascii()).count() - } - } - char_count += current_char_count; - - if current_char_count > longest_line_length { - // we subtract one here because `line.len()` includes the LF - // matches GNU 'wc' behaviour - longest_line_length = current_char_count - 1; - } - - raw_line.truncate(0); - } - - results.push(Result { - title: path.to_string(), - bytes: byte_count, - chars: char_count, - lines: line_count, - words: word_count, - max_line_length: longest_line_length, - }); - - total_line_count += line_count; - total_word_count += word_count; - total_char_count += char_count; - total_byte_count += byte_count; - - if longest_line_length > total_longest_line_length { - total_longest_line_length = longest_line_length; - } - - // used for formatting - max_width = total_byte_count.to_string().len() + 1; - } - - for result in results.iter() { - print_stats(settings, &result, max_width); - } - - if files.len() > 1 { - let result = Result { - title: "total".to_string(), - bytes: total_byte_count, - chars: total_char_count, - lines: total_line_count, - words: total_word_count, - max_line_length: total_longest_line_length, - }; - print_stats(settings, &result, max_width); - } - - Ok(()) -} - -fn print_stats(settings: &Settings, result: &Result, max_width: usize) { - if settings.show_lines { - print!("{:1$}", result.lines, max_width); - } - if settings.show_words { - print!("{:1$}", result.words, max_width); - } - if settings.show_bytes { - print!("{:1$}", result.bytes, max_width); - } - if settings.show_chars { - print!("{:1$}", result.chars, max_width); - } - if settings.show_max_line_length { - print!("{:1$}", result.max_line_length, max_width); - } - - if result.title != "-" { - println!(" {}", result.title); - } - else { - println!(""); - } -} - -fn open(path: &str) -> StdResult>, i32> { - if "-" == path { - let reader = Box::new(stdin()) as Box; - return Ok(BufReader::new(reader)); - } - - let fpath = Path::new(path); - if fpath.uu_is_dir() { - show_info!("{}: is a directory", path); - } - match File::open(&fpath) { - Ok(fd) => { - let reader = Box::new(fd) as Box; - Ok(BufReader::new(reader)) - } - Err(e) => { - show_error!("wc: {}: {}", path, e); - Err(1) - } - } -} diff --git a/src/whoami/Cargo.toml b/src/whoami/Cargo.toml deleted file mode 100644 index 91ee10c24..000000000 --- a/src/whoami/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "whoami" -version = "0.0.1" -authors = [] - -[lib] -name = "whoami" -path = "whoami.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/whoami/deps.mk b/src/whoami/deps.mk deleted file mode 100644 index dab27f417..000000000 --- a/src/whoami/deps.mk +++ /dev/null @@ -1 +0,0 @@ -DEPLIBS += winapi advapi32 kernel32 diff --git a/src/whoami/platform/mod.rs b/src/whoami/platform/mod.rs deleted file mode 100644 index 12d85ec08..000000000 --- a/src/whoami/platform/mod.rs +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -#[cfg(unix)] -pub use self::unix::getusername; - -#[cfg(windows)] -pub use self::windows::getusername; - -#[cfg(unix)] -mod unix; - -#[cfg(windows)] -mod windows; diff --git a/src/whoami/platform/unix.rs b/src/whoami/platform/unix.rs deleted file mode 100644 index 009a7ef6b..000000000 --- a/src/whoami/platform/unix.rs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use std::io::{Result, Error}; -use ::libc; -use self::c_types::{c_passwd, getpwuid}; - -#[path = "../../common/c_types.rs"] mod c_types; - -extern { - pub fn geteuid() -> libc::uid_t; -} - -pub unsafe fn getusername() -> Result { - // Get effective user id - let uid = geteuid(); - - // Try to find username for uid - let passwd: *const c_passwd = getpwuid(uid); - if passwd.is_null() { - return Err(Error::last_os_error()) - } - - // Extract username from passwd struct - let pw_name: *const libc::c_char = (*passwd).pw_name; - let username = String::from_utf8_lossy(::std::ffi::CStr::from_ptr(pw_name).to_bytes()).to_string(); - Ok(username) -} diff --git a/src/whoami/platform/windows.rs b/src/whoami/platform/windows.rs deleted file mode 100644 index 28d36cbfc..000000000 --- a/src/whoami/platform/windows.rs +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -extern crate winapi; -extern crate advapi32; - -use std::io::{Result, Error}; - -#[path = "../../common/wide.rs"] #[macro_use] mod wide; - -use std::mem; -use std::io::Write; -use std::ffi::OsString; -use std::os::windows::ffi::OsStringExt; -use self::wide::FromWide; - -pub unsafe fn getusername() -> Result { - let mut buffer: [winapi::WCHAR; winapi::UNLEN as usize + 1] = mem::uninitialized(); - let mut len = buffer.len() as winapi::DWORD; - if advapi32::GetUserNameW(buffer.as_mut_ptr(), &mut len) == 0 { - return Err(Error::last_os_error()) - } - let username = String::from_wide(&buffer[..len as usize - 1]); - Ok(username) -} diff --git a/src/whoami/whoami.rs b/src/whoami/whoami.rs deleted file mode 100644 index fbcf90f27..000000000 --- a/src/whoami/whoami.rs +++ /dev/null @@ -1,65 +0,0 @@ -#![crate_name = "whoami"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/* last synced with: whoami (GNU coreutils) 8.21 */ - -extern crate getopts; -extern crate libc; - -use getopts::Options; -use std::io::Write; - -#[path = "../common/util.rs"] #[macro_use] mod util; -mod platform; - -static NAME: &'static str = "whoami"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f), - }; - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {} [OPTIONS]", NAME); - println!(""); - println!("{}", opts.usage("print effective userid")); - return 0; - } - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - exec(); - - 0 -} - -pub fn exec() { - unsafe { - match platform::getusername() { - Ok(username) => println!("{}", username), - Err(err) => match err.raw_os_error() { - Some(0) | None => crash!(1, "failed to get username"), - Some(_) => crash!(1, "failed to get username: {}", err), - } - } - } -} diff --git a/src/yes/Cargo.toml b/src/yes/Cargo.toml deleted file mode 100644 index e5280f83e..000000000 --- a/src/yes/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "yes" -version = "0.0.1" -authors = [] - -[lib] -name = "yes" -path = "yes.rs" - -[dependencies] -getopts = "*" -libc = "*" diff --git a/src/yes/yes.rs b/src/yes/yes.rs deleted file mode 100644 index 52af0f53a..000000000 --- a/src/yes/yes.rs +++ /dev/null @@ -1,63 +0,0 @@ -#![crate_name = "yes"] - -/* - * This file is part of the uutils coreutils package. - * - * (c) Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/* last synced with: yes (GNU coreutils) 8.13 */ - -extern crate getopts; -extern crate libc; - -use getopts::Options; -use std::io::Write; - -#[path = "../common/util.rs"] -#[macro_use] -mod util; - -static NAME: &'static str = "yes"; -static VERSION: &'static str = "1.0.0"; - -pub fn uumain(args: Vec) -> i32 { - let mut opts = Options::new(); - - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "invalid options\n{}", f) - }; - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(""); - println!("Usage:"); - println!(" {0} [STRING]... [OPTION]...", NAME); - println!(""); - print!("{}", opts.usage("Repeatedly output a line with all specified STRING(s), or 'y'.")); - return 0; - } - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - let string = if matches.free.is_empty() { - "y".to_string() - } else { - matches.free.join(" ") - }; - - exec(&string[..]); - - 0 -} - -pub fn exec(string: &str) { - while pipe_println!("{}", string) { } -} diff --git a/test/base64.rs b/test/base64.rs deleted file mode 100644 index 106a42de5..000000000 --- a/test/base64.rs +++ /dev/null @@ -1,62 +0,0 @@ -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./base64"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_encode() { - let input = "hello, world!"; - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd, input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, "aGVsbG8sIHdvcmxkIQ==\n"); -} - -#[test] -fn test_decode() { - let input = "aGVsbG8sIHdvcmxkIQ=="; - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.arg("-d"), input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, "hello, world!"); -} - -#[test] -fn test_garbage() { - let input = "aGVsbG8sIHdvcmxkIQ==\0"; - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.arg("-d"), input.as_bytes()); - - assert!(!result.success); - assert_eq!(result.stderr, "base64: error: invalid character (Invalid character '0' at position 20)\n"); -} - -#[test] -fn test_ignore_garbage() { - let input = "aGVsbG8sIHdvcmxkIQ==\0"; - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.arg("-d").arg("-i"), input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, "hello, world!"); -} - -#[test] -fn test_wrap() { - let input = "The quick brown fox jumps over the lazy dog."; - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.arg("-w").arg("20"), input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, "VGhlIHF1aWNrIGJyb3du\nIGZveCBqdW1wcyBvdmVy\nIHRoZSBsYXp5IGRvZy4=\n"); -} diff --git a/test/basename.rs b/test/basename.rs deleted file mode 100644 index 6ecf224c0..000000000 --- a/test/basename.rs +++ /dev/null @@ -1,54 +0,0 @@ -use std::process::Command; -use std::str; - -static PROGNAME: &'static str = "./basename"; - -#[test] -fn test_directory() { - let dir = "/root/alpha/beta/gamma/delta/epsilon/omega/"; - let po = Command::new(PROGNAME) - .arg(dir) - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap().trim_right(); - assert_eq!(out, "omega"); -} - -#[test] -fn test_file() { - let file = "/etc/passwd"; - let po = Command::new(PROGNAME) - .arg(file) - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap().trim_right(); - assert_eq!(out, "passwd"); -} - -#[test] -fn test_remove_suffix() { - let path = "/usr/local/bin/reallylongexecutable.exe"; - let po = Command::new(PROGNAME) - .arg(path) - .arg(".exe") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap().trim_right(); - assert_eq!(out, "reallylongexecutable"); -} - -#[test] -fn test_dont_remove_suffix() { - let path = "/foo/bar/baz"; - let po = Command::new(PROGNAME) - .arg(path) - .arg("baz") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap().trim_right(); - assert_eq!(out, "baz"); -} diff --git a/test/cat.rs b/test/cat.rs deleted file mode 100644 index 41fdb9eb6..000000000 --- a/test/cat.rs +++ /dev/null @@ -1,60 +0,0 @@ -use std::io::Write; -use std::process::Command; -use std::process::Stdio; -use std::str; - -static PROGNAME: &'static str = "./cat"; - -#[test] -fn test_output_multi_files_print_all_chars() { - let po = match Command::new(PROGNAME) - .arg("alpha.txt") - .arg("256.txt") - .arg("-A") - .arg("-n").output() { - - Ok(p) => p, - Err(err) => panic!("{}", err), - }; - - let out = str::from_utf8(&po.stdout[..]).unwrap(); - assert_eq!(out, - " 1\tabcde$\n 2\tfghij$\n 3\tklmno$\n 4\tpqrst$\n 5\tuvwxyz$\n 6\t^@^A^B^C^D^E^F^G^H^I$\n 7\t^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\\^]^^^_ !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~^?M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^KM-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^VM-^WM-^XM-^YM-^ZM-^[M-^\\M-^]M-^^M-^_M- M-!M-\"M-#M-$M-%M-&M-\'M-(M-)M-*M-+M-,M--M-.M-/M-0M-1M-2M-3M-4M-5M-6M-7M-8M-9M-:M-;M-M-?M-@M-AM-BM-CM-DM-EM-FM-GM-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-ZM-[M-\\M-]M-^M-_M-`M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}M-~M-^?"); -} - -#[test] -fn test_stdin_squeeze() { - let mut process = Command::new(PROGNAME) - .arg("-A") - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .spawn() - .unwrap_or_else(|e| panic!("{}", e)); - - process.stdin.take().unwrap_or_else(|| panic!("Could not grab child process stdin")) - .write_all("\x00\x01\x02".as_bytes()).unwrap_or_else(|e| panic!("{}", e)); - - let po = process.wait_with_output().unwrap_or_else(|e| panic!("{}", e)); - let out = str::from_utf8(&po.stdout[..]).unwrap_or_else(|e| panic!("{}", e)); - - assert_eq!(out, "^@^A^B"); -} - -#[test] -fn test_stdin_number_non_blank() { - let mut process = Command::new(PROGNAME) - .arg("-b") - .arg("-") - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .spawn() - .unwrap_or_else(|e| panic!("{}", e)); - - process.stdin.take().unwrap_or_else(|| panic!("Could not grab child process stdin")) - .write_all("\na\nb\n\n\nc".as_bytes()).unwrap_or_else(|e| panic!("{}", e)); - - let po = process.wait_with_output().unwrap_or_else(|e| panic!("{}", e)); - let out = str::from_utf8(&po.stdout[..]).unwrap_or_else(|e| panic!("{}", e)); - - assert_eq!(out, "\n 1\ta\n 2\tb\n\n\n 3\tc"); -} diff --git a/test/cksum.rs b/test/cksum.rs deleted file mode 100644 index c5ecdf3be..000000000 --- a/test/cksum.rs +++ /dev/null @@ -1,39 +0,0 @@ -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./cksum"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_single_file() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.arg("lorem_ipsum.txt")); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, get_file_contents("single_file.expected")); -} - -#[test] -fn test_multiple_files() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.arg("lorem_ipsum.txt").arg("alice_in_wonderland.txt")); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, get_file_contents("multiple_files.expected")); -} - -#[test] -fn test_stdin() { - let input = get_file_contents("lorem_ipsum.txt"); - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd, input); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, get_file_contents("stdin.expected")); -} diff --git a/test/common/util.rs b/test/common/util.rs deleted file mode 100644 index cb4a99c83..000000000 --- a/test/common/util.rs +++ /dev/null @@ -1,152 +0,0 @@ -#![allow(dead_code)] - -use std::env; -use std::fs::{self, File}; -use std::io::{Read, Write}; -#[cfg(unix)] -use std::os::unix::fs::symlink as symlink_file; -#[cfg(windows)] -use std::os::windows::fs::symlink_file; -use std::path::Path; -use std::process::{Command, Stdio}; -use std::str::from_utf8; - -#[macro_export] -macro_rules! assert_empty_stderr( - ($cond:expr) => ( - if $cond.stderr.len() > 0 { - panic!(format!("stderr: {}", $cond.stderr)) - } - ); -); - -pub struct CmdResult { - pub success: bool, - pub stdout: String, - pub stderr: String, -} - -pub fn run(cmd: &mut Command) -> CmdResult { - let prog = cmd.output().unwrap(); - CmdResult { - success: prog.status.success(), - stdout: from_utf8(&prog.stdout).unwrap().to_string(), - stderr: from_utf8(&prog.stderr).unwrap().to_string(), - } -} - -pub fn run_piped_stdin>(cmd: &mut Command, input: T)-> CmdResult { - let mut command = cmd - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .spawn() - .unwrap(); - - command.stdin - .take() - .unwrap_or_else(|| panic!("Could not take child process stdin")) - .write_all(input.as_ref()) - .unwrap_or_else(|e| panic!("{}", e)); - - let prog = command.wait_with_output().unwrap(); - CmdResult { - success: prog.status.success(), - stdout: from_utf8(&prog.stdout).unwrap().to_string(), - stderr: from_utf8(&prog.stderr).unwrap().to_string(), - } -} - -pub fn get_file_contents(name: &str) -> String { - let mut f = File::open(Path::new(name)).unwrap(); - let mut contents = String::new(); - let _ = f.read_to_string(&mut contents); - contents -} - -pub fn set_file_contents(name: &str, contents: &str) { - let mut f = File::open(Path::new(name)).unwrap(); - let _ = f.write(contents.as_bytes()); -} - -pub fn mkdir(dir: &str) { - fs::create_dir(Path::new(dir)).unwrap(); -} - -pub fn mkdir_all(dir: &str) { - fs::create_dir_all(Path::new(dir)).unwrap(); -} - -pub fn make_file(name: &str) -> File { - match File::create(Path::new(name)) { - Ok(f) => f, - Err(e) => panic!("{}", e) - } -} - -pub fn touch(file: &str) { - File::create(Path::new(file)).unwrap(); -} - -pub fn symlink(src: &str, dst: &str) { - symlink_file(src, dst).unwrap(); -} - -pub fn is_symlink(path: &str) -> bool { - match fs::symlink_metadata(path) { - Ok(m) => m.file_type().is_symlink(), - Err(_) => false - } -} - -pub fn resolve_link(path: &str) -> String { - match fs::read_link(path) { - Ok(p) => p.to_str().unwrap().to_owned(), - Err(_) => "".to_string() - } -} - -pub fn metadata(path: &str) -> fs::Metadata { - match fs::metadata(path) { - Ok(m) => m, - Err(e) => panic!("{}", e) - } -} - -pub fn file_exists(path: &str) -> bool { - match fs::metadata(path) { - Ok(m) => m.is_file(), - Err(_) => false - } -} - -pub fn dir_exists(path: &str) -> bool { - match fs::metadata(path) { - Ok(m) => m.is_dir(), - Err(_) => false - } -} - -pub fn cleanup(path: &'static str) { - let p = Path::new(path); - match fs::metadata(p) { - Ok(m) => if m.is_file() { - fs::remove_file(&p).unwrap(); - } else { - fs::remove_dir(&p).unwrap(); - }, - Err(_) => {} - } -} - -pub fn current_directory() -> String { - env::current_dir().unwrap().into_os_string().into_string().unwrap() -} - -pub fn repeat_str(s: &str, n: u32) -> String { - let mut repeated = String::new(); - for _ in 0 .. n { - repeated.push_str(s); - } - repeated -} diff --git a/test/cp.rs b/test/cp.rs deleted file mode 100644 index d82c9af49..000000000 --- a/test/cp.rs +++ /dev/null @@ -1,35 +0,0 @@ -use std::fs::File; -use std::io::Read; -use std::path::Path; -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./cp"; -static TEST_HELLO_WORLD_SOURCE: &'static str = "hello_world.txt"; -static TEST_HELLO_WORLD_DEST: &'static str = "copy_of_hello_world.txt"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_cp_cp() { - // Invoke our binary to make the copy. - let prog = Command::new(PROGNAME) - .arg(TEST_HELLO_WORLD_SOURCE) - .arg(TEST_HELLO_WORLD_DEST) - .status(); - - // Check that the exit code represents a successful copy. - let exit_success = prog.unwrap().success(); - assert_eq!(exit_success, true); - - // Check the content of the destination file that was copied. - let mut contents = String::new(); - let mut f = File::open(Path::new(TEST_HELLO_WORLD_DEST)).unwrap(); - let _ = f.read_to_string(&mut contents); - assert_eq!(contents, "Hello, World!\n"); - - cleanup(TEST_HELLO_WORLD_SOURCE); - cleanup(TEST_HELLO_WORLD_DEST); -} diff --git a/test/cut.rs b/test/cut.rs deleted file mode 100644 index baf32b9f0..000000000 --- a/test/cut.rs +++ /dev/null @@ -1,58 +0,0 @@ -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./cut"; -static INPUT: &'static str = "lists.txt"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_prefix() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-c", "-10", INPUT])); - assert_eq!(result.stdout, get_file_contents("lists_prefix.expected")); -} - -#[test] -fn test_char_range() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-c", "4-10", INPUT])); - assert_eq!(result.stdout, get_file_contents("lists_char_range.expected")); -} - -#[test] -fn test_column_to_end_of_line() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-d", ":", "-f", "5-", INPUT])); - assert_eq!(result.stdout, get_file_contents("lists_column_to_end_of_line.expected")); -} - -#[test] -fn test_specific_field() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-d", " ", "-f", "3", INPUT])); - assert_eq!(result.stdout, get_file_contents("lists_specific_field.expected")); -} - -#[test] -fn test_multiple_fields() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-d", ":", "-f", "1,3", INPUT])); - assert_eq!(result.stdout, get_file_contents("lists_multiple_fields.expected")); -} - -#[test] -fn test_tail() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-d", ":", "--complement", "-f", "1", INPUT])); - assert_eq!(result.stdout, get_file_contents("lists_tail.expected")); -} - -#[test] -fn test_change_delimiter() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-d", ":", "--complement", "--output-delimiter=#", "-f", "1", INPUT])); - assert_eq!(result.stdout, get_file_contents("lists_change_delimiter.expected")); -} diff --git a/test/dirname.rs b/test/dirname.rs deleted file mode 100644 index f0309ce9e..000000000 --- a/test/dirname.rs +++ /dev/null @@ -1,28 +0,0 @@ -use std::process::Command; -use std::str; - -static PROGNAME: &'static str = "./dirname"; - -#[test] -fn test_path_with_trailing_slashes() { - let dir = "/root/alpha/beta/gamma/delta/epsilon/omega//"; - let po = Command::new(PROGNAME) - .arg(dir) - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap().trim_right(); - assert_eq!(out, "/root/alpha/beta/gamma/delta/epsilon"); -} - -#[test] -fn test_path_without_trailing_slashes() { - let dir = "/root/alpha/beta/gamma/delta/epsilon/omega"; - let po = Command::new(PROGNAME) - .arg(dir) - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap().trim_right(); - assert_eq!(out, "/root/alpha/beta/gamma/delta/epsilon"); -} diff --git a/test/echo.rs b/test/echo.rs deleted file mode 100644 index b107fd4c4..000000000 --- a/test/echo.rs +++ /dev/null @@ -1,50 +0,0 @@ -use std::process::Command; -use std::str; - -static PROGNAME: &'static str = "./echo"; - -#[test] -fn test_default() { - let po = Command::new(PROGNAME) - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap(); - assert_eq!(out, "\n"); -} - -#[test] -fn test_no_trailing_newline() { - let po = Command::new(PROGNAME) - .arg("-n") - .arg("hello_world") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap(); - assert_eq!(out, "hello_world"); -} - -#[test] -fn test_enable_escapes() { - let po = Command::new(PROGNAME) - .arg("-e") - .arg("\\\\\\t\\r") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap(); - assert_eq!(out, "\\\t\r\n"); -} - -#[test] -fn test_disable_escapes() { - let po = Command::new(PROGNAME) - .arg("-E") - .arg("\\b\\c\\e") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap(); - assert_eq!(out, "\\b\\c\\e\n"); -} diff --git a/test/env.rs b/test/env.rs deleted file mode 100644 index aa2825f29..000000000 --- a/test/env.rs +++ /dev/null @@ -1,74 +0,0 @@ -use std::process::Command; -use std::str; - -static PROGNAME: &'static str = "./env"; - -#[test] -fn test_single_name_value_pair() { - let po = Command::new(PROGNAME) - .arg("FOO=bar") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap(); - assert!(out.lines().any(|line| line == "FOO=bar")); -} - -#[test] -fn test_multiple_name_value_pairs() { - let po = Command::new(PROGNAME) - .arg("FOO=bar") - .arg("ABC=xyz") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap(); - assert_eq!(out.lines().filter(|&line| line == "FOO=bar" || line == "ABC=xyz").count(), 2); -} - -#[test] -fn test_ignore_environment() { - let po = Command::new(PROGNAME) - .arg("-i") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap(); - assert_eq!(out, ""); - - let po = Command::new(PROGNAME) - .arg("-") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap(); - assert_eq!(out, ""); -} - -#[test] -fn test_null_delimiter() { - let po = Command::new(PROGNAME) - .arg("-i") - .arg("--null") - .arg("FOO=bar") - .arg("ABC=xyz") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap(); - assert_eq!(out, "FOO=bar\0ABC=xyz\0"); -} - -#[test] -fn test_unset_variable() { - // This test depends on the HOME variable being pre-defined by the - // default shell - let po = Command::new(PROGNAME) - .arg("-u") - .arg("HOME") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap(); - assert_eq!(out.lines().any(|line| line.starts_with("HOME=")), false); -} diff --git a/test/factor.rs b/test/factor.rs deleted file mode 100644 index 6eadf3469..000000000 --- a/test/factor.rs +++ /dev/null @@ -1,534 +0,0 @@ -/* -* This file is part of the uutils coreutils package. -* -* (c) kwantam -* -* For the full copyright and license information, please view the LICENSE file -* that was distributed with this source code. -*/ - -extern crate libc; -extern crate rand; - -use rand::{weak_rng, Rng}; -use rand::distributions::{IndependentSample, Range}; -use sieve::Sieve; -use std::io::Write; -use std::process::{Command, Stdio}; - -#[path="../src/factor/sieve.rs"] -mod sieve; - -const NUM_PRIMES: usize = 10000; -const LOG_PRIMES: f64 = 14.0; // ceil(log2(NUM_PRIMES)) - -const NUM_TESTS: usize = 100; -const PROGNAME: &'static str = "./factor"; - -#[test] -fn test_random() { - let primes = Sieve::primes().take(NUM_PRIMES).collect::>(); - - let mut rng = weak_rng(); - let mut rand_gt = move |min: u64| { - let mut product = 1u64; - let mut factors = Vec::new(); - while product < min { - // log distribution---higher probability for lower numbers - let factor; - loop { - let next = rng.gen_range(0f64, LOG_PRIMES).exp2().floor() as usize; - if next < NUM_PRIMES { - factor = primes[next]; - break; - } - } - let factor = factor; - - match product.checked_mul(factor) { - Some(p) => { - product = p; - factors.push(factor); - }, - None => break, - }; - } - - factors.sort(); - (product, factors) - }; - - // build an input and expected output string from factor - let mut instring = String::new(); - let mut outstring = String::new(); - for _ in 0..NUM_TESTS { - let (product, factors) = rand_gt(1 << 63); - instring.push_str(&(format!("{} ", product))[..]); - - outstring.push_str(&(format!("{}:", product))[..]); - for factor in factors { - outstring.push_str(&(format!(" {}", factor))[..]); - } - outstring.push_str("\n"); - } - - run(instring.as_bytes(), outstring.as_bytes()); -} - -#[test] -fn test_random_big() { - let mut rng = weak_rng(); - let bitrange_1 = Range::new(14usize, 51); - let mut rand_64 = move || { - // first, choose a random number of bits for the first factor - let f_bit_1 = bitrange_1.ind_sample(&mut rng); - // how many more bits do we need? - let rem = 64 - f_bit_1; - - // we will have a number of additional factors equal to nfacts + 1 - // where nfacts is in [0, floor(rem/14) ) NOTE half-open interval - // Each prime factor is at least 14 bits, hence floor(rem/14) - let nfacts = Range::new(0usize, rem / 14).ind_sample(&mut rng); - // we have to distribute extrabits among the (nfacts + 1) values - let extrabits = rem - (nfacts + 1) * 14; - // (remember, a Range is a half-open interval) - let extrarange = Range::new(0usize, extrabits + 1); - - // to generate an even split of this range, generate n-1 random elements - // in the range, add the desired total value to the end, sort this list, - // and then compute the sequential differences. - let mut f_bits = Vec::new(); - for _ in 0..nfacts { - f_bits.push(extrarange.ind_sample(&mut rng)); - } - f_bits.push(extrabits); - f_bits.sort(); - - // compute sequential differences here. We leave off the +14 bits - // so we can just index PRIMES_BY_BITS - let mut f_bits = f_bits.iter().scan(0, |st,&x| { - let ret = x - *st; // + 14 would give actual number of bits - *st = x; - Some(ret) - }).collect::>(); - // finally, add f_bit_1 in there - f_bits.push(f_bit_1 - 14); // index of f_bit_1 in PRIMES_BY_BITS - let f_bits = f_bits; - - let mut nbits = 0; - let mut product = 1u64; - let mut factors = Vec::new(); - for bit in f_bits { - assert!(bit < 37); - nbits += 14 + bit; - let elm = Range::new(0, PRIMES_BY_BITS[bit].len()).ind_sample(&mut rng); - let factor = PRIMES_BY_BITS[bit][elm]; - factors.push(factor); - product *= factor; - } - assert_eq!(nbits, 64); - - factors.sort(); - (product, factors) - }; - - let mut instring = String::new(); - let mut outstring = String::new(); - for _ in 0..NUM_TESTS { - let (product, factors) = rand_64(); - instring.push_str(&(format!("{} ", product))[..]); - - outstring.push_str(&(format!("{}:", product))[..]); - for factor in factors { - outstring.push_str(&(format!(" {}", factor))[..]); - } - outstring.push_str("\n"); - } - - run(instring.as_bytes(), outstring.as_bytes()); -} - -#[test] -fn test_big_primes() { - let mut instring = String::new(); - let mut outstring = String::new(); - for prime in PRIMES64 { - instring.push_str(&(format!("{} ", prime))[..]); - outstring.push_str(&(format!("{0}: {0}\n", prime))[..]); - } - - run(instring.as_bytes(), outstring.as_bytes()); -} - -fn run(instring: &[u8], outstring: &[u8]) { - // now run factor - let mut process = Command::new(PROGNAME) - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .spawn() - .unwrap_or_else(|e| panic!("{}", e)); - - process.stdin.take().unwrap_or_else(|| panic!("Could not take child process stdin")) - .write_all(instring).unwrap_or_else(|e| panic!("{}", e)); - - let output = process.wait_with_output().unwrap_or_else(|e| panic!("{}", e)); - assert_eq!(&output.stdout[..], outstring); -} - -const PRIMES_BY_BITS: &'static [&'static [u64]] = &[PRIMES14, PRIMES15, PRIMES16, PRIMES17, - PRIMES18, PRIMES19, PRIMES20, PRIMES21, PRIMES22, PRIMES23, PRIMES24, PRIMES25, PRIMES26, - PRIMES27, PRIMES28, PRIMES29, PRIMES30, PRIMES31, PRIMES32, PRIMES33, PRIMES34, PRIMES35, - PRIMES36, PRIMES37, PRIMES38, PRIMES39, PRIMES40, PRIMES41, PRIMES42, PRIMES43, PRIMES44, - PRIMES45, PRIMES46, PRIMES47, PRIMES48, PRIMES49, PRIMES50, -]; - -const PRIMES64: &'static [u64] = &[18446744073709551557, 18446744073709551533, - 18446744073709551521, 18446744073709551437, 18446744073709551427, 18446744073709551359, - 18446744073709551337, 18446744073709551293, 18446744073709551263, 18446744073709551253, - 18446744073709551191, 18446744073709551163, 18446744073709551113, 18446744073709550873, - 18446744073709550791, 18446744073709550773, 18446744073709550771, 18446744073709550719, - 18446744073709550717, 18446744073709550681, 18446744073709550671, 18446744073709550593, - 18446744073709550591, 18446744073709550539, 18446744073709550537, 18446744073709550381, - 18446744073709550341, 18446744073709550293, 18446744073709550237, 18446744073709550147, - 18446744073709550141, 18446744073709550129, 18446744073709550111, 18446744073709550099, - 18446744073709550047, 18446744073709550033, 18446744073709550009, 18446744073709549951, - 18446744073709549861, 18446744073709549817, 18446744073709549811, 18446744073709549777, - 18446744073709549757, 18446744073709549733, 18446744073709549667, 18446744073709549621, - 18446744073709549613, 18446744073709549583, 18446744073709549571, -]; - -const PRIMES14: &'static [u64] = &[16381, 16369, 16363, 16361, 16349, 16339, 16333, 16319, - 16301, 16273, 16267, 16253, 16249, 16231, 16229, 16223, 16217, 16193, 16189, 16187, 16183, - 16141, 16139, 16127, 16111, 16103, 16097, 16091, 16087, 16073, 16069, 16067, 16063, 16061, - 16057, 16033, 16007, 16001, 15991, 15973, 15971, 15959, 15937, 15923, 15919, 15913, 15907, - 15901, 15889, 15887, 15881, 15877, 15859, 15823, 15817, 15809, 15803, 15797, 15791, 15787, - 15773, 15767, 15761, 15749, 15739, 15737, 15733, 15731, 15727, 15683, 15679, 15671, 15667, - 15661, 15649, 15647, 15643, 15641, 15629, 15619, 15607, 15601, 15583, 15581, 15569, 15559, - 15551, 15541, 15527, 15511, 15497, 15493, 15473, 15467, 15461, 15451, 15443, 15439, 15427, - 15413, 15401, 15391, 15383, 15377, 15373, -]; - -const PRIMES15: &'static [u64] = &[32749, 32719, 32717, 32713, 32707, 32693, 32687, 32653, - 32647, 32633, 32621, 32611, 32609, 32603, 32587, 32579, 32573, 32569, 32563, 32561, 32537, - 32533, 32531, 32507, 32503, 32497, 32491, 32479, 32467, 32443, 32441, 32429, 32423, 32413, - 32411, 32401, 32381, 32377, 32371, 32369, 32363, 32359, 32353, 32341, 32327, 32323, 32321, - 32309, 32303, 32299, 32297, 32261, 32257, 32251, 32237, 32233, 32213, 32203, 32191, 32189, - 32183, 32173, 32159, 32143, 32141, 32119, 32117, 32099, 32089, 32083, 32077, 32069, 32063, - 32059, 32057, 32051, 32029, 32027, 32009, 32003, 31991, 31981, 31973, 31963, 31957, 31907, - 31891, 31883, 31873, 31859, 31849, 31847, 31817, 31799, 31793, 31771, 31769, 31751, -]; - -const PRIMES16: &'static [u64] = &[65521, 65519, 65497, 65479, 65449, 65447, 65437, 65423, - 65419, 65413, 65407, 65393, 65381, 65371, 65357, 65353, 65327, 65323, 65309, 65293, 65287, - 65269, 65267, 65257, 65239, 65213, 65203, 65183, 65179, 65173, 65171, 65167, 65147, 65141, - 65129, 65123, 65119, 65111, 65101, 65099, 65089, 65071, 65063, 65053, 65033, 65029, 65027, - 65011, 65003, 64997, 64969, 64951, 64937, 64927, 64921, 64919, 64901, 64891, 64879, 64877, - 64871, 64853, 64849, 64817, 64811, 64793, 64783, 64781, 64763, 64747, 64717, 64709, 64693, - 64679, 64667, 64663, 64661, 64633, 64627, 64621, 64613, 64609, 64601, 64591, 64579, 64577, - 64567, 64553, -]; - -const PRIMES17: &'static [u64] = &[131071, 131063, 131059, 131041, 131023, 131011, 131009, - 130987, 130981, 130973, 130969, 130957, 130927, 130873, 130859, 130843, 130841, 130829, - 130817, 130811, 130807, 130787, 130783, 130769, 130729, 130699, 130693, 130687, 130681, - 130657, 130651, 130649, 130643, 130639, 130633, 130631, 130621, 130619, 130589, 130579, - 130553, 130547, 130531, 130523, 130517, 130513, 130489, 130483, 130477, 130469, 130457, - 130447, 130439, 130423, 130411, 130409, 130399, 130379, 130369, 130367, 130363, 130349, - 130343, 130337, 130307, 130303, 130279, 130267, 130261, 130259, 130253, 130241, 130223, - 130211, 130201, 130199, 130183, 130171, 130147, 130127, 130121, 130099, 130087, 130079, - 130073, 130069, 130057, 130051, -]; - -const PRIMES18: &'static [u64] = &[262139, 262133, 262127, 262121, 262111, 262109, 262103, - 262079, 262069, 262051, 262049, 262027, 262007, 261983, 261977, 261973, 261971, 261959, - 261917, 261887, 261881, 261847, 261823, 261799, 261791, 261787, 261773, 261761, 261757, - 261739, 261721, 261713, 261707, 261697, 261673, 261643, 261641, 261637, 261631, 261619, - 261601, 261593, 261587, 261581, 261577, 261563, 261557, 261529, 261523, 261509, 261467, - 261463, 261451, 261439, 261433, 261431, 261427, 261407, 261389, 261379, 261353, 261347, - 261337, 261329, 261323, 261301, 261281, 261271, 261251, 261241, 261229, 261223, 261169, - 261167, 261127, -]; - -const PRIMES19: &'static [u64] = &[524287, 524269, 524261, 524257, 524243, 524231, 524221, - 524219, 524203, 524201, 524197, 524189, 524171, 524149, 524123, 524119, 524113, 524099, - 524087, 524081, 524071, 524063, 524057, 524053, 524047, 523997, 523987, 523969, 523949, - 523937, 523927, 523907, 523903, 523877, 523867, 523847, 523829, 523801, 523793, 523777, - 523771, 523763, 523759, 523741, 523729, 523717, 523681, 523673, 523669, 523667, 523657, - 523639, 523637, 523631, 523603, 523597, 523577, 523573, 523571, 523553, 523543, 523541, - 523519, 523511, 523493, 523489, 523487, 523463, 523459, 523433, 523427, 523417, 523403, - 523387, 523357, 523351, 523349, 523333, 523307, 523297, -]; - -const PRIMES20: &'static [u64] = &[1048573, 1048571, 1048559, 1048549, 1048517, 1048507, - 1048447, 1048433, 1048423, 1048391, 1048387, 1048367, 1048361, 1048357, 1048343, 1048309, - 1048291, 1048273, 1048261, 1048219, 1048217, 1048213, 1048193, 1048189, 1048139, 1048129, - 1048127, 1048123, 1048063, 1048051, 1048049, 1048043, 1048027, 1048013, 1048009, 1048007, - 1047997, 1047989, 1047979, 1047971, 1047961, 1047941, 1047929, 1047923, 1047887, 1047883, - 1047881, 1047859, 1047841, 1047833, 1047821, 1047779, 1047773, 1047763, 1047751, 1047737, - 1047721, 1047713, 1047703, 1047701, 1047691, 1047689, 1047671, 1047667, 1047653, 1047649, - 1047647, 1047589, 1047587, 1047559, -]; - -const PRIMES21: &'static [u64] = &[2097143, 2097133, 2097131, 2097097, 2097091, 2097083, - 2097047, 2097041, 2097031, 2097023, 2097013, 2096993, 2096987, 2096971, 2096959, 2096957, - 2096947, 2096923, 2096911, 2096909, 2096893, 2096881, 2096873, 2096867, 2096851, 2096837, - 2096807, 2096791, 2096789, 2096777, 2096761, 2096741, 2096737, 2096713, 2096693, 2096687, - 2096681, 2096639, 2096629, 2096621, 2096599, 2096597, 2096569, 2096539, 2096533, 2096483, - 2096449, 2096431, 2096429, 2096411, 2096407, 2096401, 2096399, 2096377, 2096357, 2096291, - 2096273, 2096261, 2096233, 2096231, 2096221, 2096209, 2096191, 2096183, 2096147, -]; - -const PRIMES22: &'static [u64] = &[4194301, 4194287, 4194277, 4194271, 4194247, 4194217, - 4194199, 4194191, 4194187, 4194181, 4194173, 4194167, 4194143, 4194137, 4194131, 4194107, - 4194103, 4194023, 4194011, 4194007, 4193977, 4193971, 4193963, 4193957, 4193939, 4193929, - 4193909, 4193869, 4193807, 4193803, 4193801, 4193789, 4193759, 4193753, 4193743, 4193701, - 4193663, 4193633, 4193573, 4193569, 4193551, 4193549, 4193531, 4193513, 4193507, 4193459, - 4193447, 4193443, 4193417, 4193411, 4193393, 4193389, 4193381, 4193377, 4193369, 4193359, - 4193353, 4193327, 4193309, 4193303, 4193297, -]; - -const PRIMES23: &'static [u64] = &[8388593, 8388587, 8388581, 8388571, 8388547, 8388539, - 8388473, 8388461, 8388451, 8388449, 8388439, 8388427, 8388421, 8388409, 8388377, 8388371, - 8388319, 8388301, 8388287, 8388283, 8388277, 8388239, 8388209, 8388187, 8388113, 8388109, - 8388091, 8388071, 8388059, 8388019, 8388013, 8387999, 8387993, 8387959, 8387957, 8387947, - 8387933, 8387921, 8387917, 8387891, 8387879, 8387867, 8387861, 8387857, 8387839, 8387831, - 8387809, 8387807, 8387741, 8387737, 8387723, 8387707, 8387671, 8387611, 8387609, 8387591, -]; - -const PRIMES24: &'static [u64] = &[16777213, 16777199, 16777183, 16777153, 16777141, 16777139, - 16777127, 16777121, 16777099, 16777049, 16777027, 16776989, 16776973, 16776971, 16776967, - 16776961, 16776941, 16776937, 16776931, 16776919, 16776901, 16776899, 16776869, 16776857, - 16776839, 16776833, 16776817, 16776763, 16776731, 16776719, 16776713, 16776691, 16776689, - 16776679, 16776659, 16776631, 16776623, 16776619, 16776607, 16776593, 16776581, 16776547, - 16776521, 16776491, 16776481, 16776469, 16776451, 16776401, 16776391, 16776379, 16776371, - 16776367, 16776343, 16776337, 16776317, 16776313, 16776289, 16776217, 16776211, -]; - -const PRIMES25: &'static [u64] = &[33554393, 33554383, 33554371, 33554347, 33554341, 33554317, - 33554291, 33554273, 33554267, 33554249, 33554239, 33554221, 33554201, 33554167, 33554159, - 33554137, 33554123, 33554093, 33554083, 33554077, 33554051, 33554021, 33554011, 33554009, - 33553999, 33553991, 33553969, 33553967, 33553909, 33553901, 33553879, 33553837, 33553799, - 33553787, 33553771, 33553769, 33553759, 33553747, 33553739, 33553727, 33553697, 33553693, - 33553679, 33553661, 33553657, 33553651, 33553649, 33553633, 33553613, 33553607, 33553577, - 33553549, 33553547, 33553537, 33553519, 33553517, 33553511, 33553489, 33553463, 33553451, - 33553417, -]; - -const PRIMES26: &'static [u64] = &[67108859, 67108837, 67108819, 67108777, 67108763, - 67108757, 67108753, 67108747, 67108739, 67108729, 67108721, 67108709, 67108693, 67108669, - 67108667, 67108661, 67108649, 67108633, 67108597, 67108579, 67108529, 67108511, 67108507, - 67108493, 67108471, 67108463, 67108453, 67108439, 67108387, 67108373, 67108369, 67108351, - 67108331, 67108313, 67108303, 67108289, 67108271, 67108219, 67108207, 67108201, 67108199, - 67108187, 67108183, 67108177, 67108127, 67108109, 67108081, 67108049, 67108039, 67108037, - 67108033, 67108009, 67108007, 67108003, 67107983, 67107977, 67107967, 67107941, 67107919, - 67107913, 67107883, 67107881, 67107871, 67107863, -]; - -const PRIMES27: &'static [u64] = &[134217689, 134217649, 134217617, 134217613, 134217593, - 134217541, 134217529, 134217509, 134217497, 134217493, 134217487, 134217467, 134217439, - 134217437, 134217409, 134217403, 134217401, 134217367, 134217361, 134217353, 134217323, - 134217301, 134217277, 134217257, 134217247, 134217221, 134217199, 134217173, 134217163, - 134217157, 134217131, 134217103, 134217089, 134217079, 134217049, 134217047, 134217043, - 134217001, 134216987, 134216947, 134216939, 134216933, 134216911, 134216899, 134216881, - 134216869, 134216867, 134216861, 134216837, 134216827, 134216807, 134216801, 134216791, - 134216783, 134216777, 134216759, 134216737, 134216729, -]; - -const PRIMES28: &'static [u64] = &[268435399, 268435367, 268435361, 268435337, 268435331, - 268435313, 268435291, 268435273, 268435243, 268435183, 268435171, 268435157, 268435147, - 268435133, 268435129, 268435121, 268435109, 268435091, 268435067, 268435043, 268435039, - 268435033, 268435019, 268435009, 268435007, 268434997, 268434979, 268434977, 268434961, - 268434949, 268434941, 268434937, 268434857, 268434841, 268434827, 268434821, 268434787, - 268434781, 268434779, 268434773, 268434731, 268434721, 268434713, 268434707, 268434703, - 268434697, 268434659, 268434623, 268434619, 268434581, 268434577, 268434563, 268434557, - 268434547, 268434511, 268434499, 268434479, 268434461, -]; - -const PRIMES29: &'static [u64] = &[536870909, 536870879, 536870869, 536870849, 536870839, - 536870837, 536870819, 536870813, 536870791, 536870779, 536870767, 536870743, 536870729, - 536870723, 536870717, 536870701, 536870683, 536870657, 536870641, 536870627, 536870611, - 536870603, 536870599, 536870573, 536870569, 536870563, 536870561, 536870513, 536870501, - 536870497, 536870473, 536870401, 536870363, 536870317, 536870303, 536870297, 536870273, - 536870267, 536870239, 536870233, 536870219, 536870171, 536870167, 536870153, 536870123, - 536870063, 536870057, 536870041, 536870027, 536869999, 536869951, 536869943, 536869937, - 536869919, 536869901, 536869891, -]; - -const PRIMES30: &'static [u64] = &[1073741789, 1073741783, 1073741741, 1073741723, 1073741719, - 1073741717, 1073741689, 1073741671, 1073741663, 1073741651, 1073741621, 1073741567, 1073741561, - 1073741527, 1073741503, 1073741477, 1073741467, 1073741441, 1073741419, 1073741399, 1073741387, - 1073741381, 1073741371, 1073741329, 1073741311, 1073741309, 1073741287, 1073741237, 1073741213, - 1073741197, 1073741189, 1073741173, 1073741101, 1073741077, 1073741047, 1073740963, 1073740951, - 1073740933, 1073740909, 1073740879, 1073740853, 1073740847, 1073740819, 1073740807, -]; - -const PRIMES31: &'static [u64] = &[2147483647, 2147483629, 2147483587, 2147483579, 2147483563, - 2147483549, 2147483543, 2147483497, 2147483489, 2147483477, 2147483423, 2147483399, 2147483353, - 2147483323, 2147483269, 2147483249, 2147483237, 2147483179, 2147483171, 2147483137, 2147483123, - 2147483077, 2147483069, 2147483059, 2147483053, 2147483033, 2147483029, 2147482951, 2147482949, - 2147482943, 2147482937, 2147482921, 2147482877, 2147482873, 2147482867, 2147482859, 2147482819, - 2147482817, 2147482811, 2147482801, 2147482763, 2147482739, 2147482697, 2147482693, 2147482681, - 2147482663, 2147482661, -]; - -const PRIMES32: &'static [u64] = &[4294967291, 4294967279, 4294967231, 4294967197, 4294967189, - 4294967161, 4294967143, 4294967111, 4294967087, 4294967029, 4294966997, 4294966981, 4294966943, - 4294966927, 4294966909, 4294966877, 4294966829, 4294966813, 4294966769, 4294966667, 4294966661, - 4294966657, 4294966651, 4294966639, 4294966619, 4294966591, 4294966583, 4294966553, 4294966477, - 4294966447, 4294966441, 4294966427, 4294966373, 4294966367, 4294966337, 4294966297, -]; - -const PRIMES33: &'static [u64] = &[8589934583, 8589934567, 8589934543, 8589934513, 8589934487, - 8589934307, 8589934291, 8589934289, 8589934271, 8589934237, 8589934211, 8589934207, 8589934201, - 8589934187, 8589934151, 8589934141, 8589934139, 8589934117, 8589934103, 8589934099, 8589934091, - 8589934069, 8589934049, 8589934027, 8589934007, 8589933973, 8589933971, 8589933967, 8589933931, - 8589933917, 8589933907, 8589933853, 8589933827, 8589933823, 8589933787, 8589933773, 8589933733, - 8589933731, 8589933721, 8589933683, 8589933647, 8589933641, 8589933637, 8589933631, 8589933629, - 8589933619, 8589933601, 8589933581, -]; - -const PRIMES34: &'static [u64] = &[17179869143, 17179869107, 17179869071, 17179869053, - 17179869041, 17179869019, 17179868999, 17179868977, 17179868957, 17179868903, 17179868899, - 17179868887, 17179868879, 17179868873, 17179868869, 17179868861, 17179868843, 17179868833, - 17179868809, 17179868807, 17179868777, 17179868759, 17179868729, 17179868711, 17179868683, - 17179868681, 17179868597, 17179868549, 17179868543, 17179868521, 17179868513, 17179868479, - 17179868443, 17179868437, 17179868429, 17179868383, 17179868369, 17179868357, 17179868353, - 17179868351, 17179868333, 17179868317, 17179868309, 17179868297, 17179868287, 17179868249, - 17179868243, 17179868183, -]; - -const PRIMES35: &'static [u64] = &[34359738337, 34359738319, 34359738307, 34359738299, - 34359738289, 34359738247, 34359738227, 34359738121, 34359738059, 34359738043, 34359738011, - 34359737917, 34359737869, 34359737849, 34359737837, 34359737821, 34359737813, 34359737791, - 34359737777, 34359737771, 34359737717, 34359737591, 34359737567, 34359737549, 34359737519, - 34359737497, 34359737479, 34359737407, 34359737393, 34359737371, -]; - -const PRIMES36: &'static [u64] = &[68719476731, 68719476719, 68719476713, 68719476671, - 68719476619, 68719476599, 68719476577, 68719476563, 68719476547, 68719476503, 68719476493, - 68719476479, 68719476433, 68719476407, 68719476391, 68719476389, 68719476377, 68719476361, - 68719476323, 68719476307, 68719476281, 68719476271, 68719476257, 68719476247, 68719476209, - 68719476197, 68719476181, 68719476169, 68719476157, 68719476149, 68719476109, 68719476053, - 68719476047, 68719476019, 68719475977, 68719475947, 68719475933, 68719475911, 68719475893, - 68719475879, 68719475837, 68719475827, 68719475809, 68719475791, 68719475779, 68719475771, - 68719475767, 68719475731, 68719475729, -]; - -const PRIMES37: &'static [u64] = &[137438953447, 137438953441, 137438953427, 137438953403, - 137438953349, 137438953331, 137438953273, 137438953271, 137438953121, 137438953097, - 137438953037, 137438953009, 137438952953, 137438952901, 137438952887, 137438952869, - 137438952853, 137438952731, 137438952683, 137438952611, 137438952529, 137438952503, - 137438952491, -]; - -const PRIMES38: &'static [u64] = &[274877906899, 274877906857, 274877906837, 274877906813, - 274877906791, 274877906759, 274877906753, 274877906717, 274877906713, 274877906687, - 274877906647, 274877906629, 274877906627, 274877906573, 274877906543, 274877906491, - 274877906477, 274877906473, 274877906431, 274877906419, 274877906341, 274877906333, - 274877906327, 274877906321, 274877906309, 274877906267, 274877906243, 274877906213, - 274877906209, 274877906203, 274877906179, 274877906167, 274877906119, 274877906063, - 274877906053, 274877906021, 274877905931, -]; - -const PRIMES39: &'static [u64] = &[549755813881, 549755813869, 549755813821, 549755813797, - 549755813753, 549755813723, 549755813669, 549755813657, 549755813647, 549755813587, - 549755813561, 549755813513, 549755813507, 549755813461, 549755813417, 549755813401, - 549755813371, 549755813359, 549755813357, 549755813351, 549755813339, 549755813317, - 549755813311, 549755813281, 549755813239, 549755813231, 549755813213, 549755813207, - 549755813197, 549755813183, 549755813161, 549755813149, 549755813147, 549755813143, - 549755813141, 549755813059, 549755813027, 549755813003, 549755812951, 549755812937, - 549755812933, 549755812889, 549755812867, -]; - -const PRIMES40: &'static [u64] = &[1099511627689, 1099511627609, 1099511627581, 1099511627573, - 1099511627563, 1099511627491, 1099511627483, 1099511627477, 1099511627387, 1099511627339, - 1099511627321, 1099511627309, 1099511627297, 1099511627293, 1099511627261, 1099511627213, - 1099511627191, 1099511627177, 1099511627173, 1099511627143, 1099511627089, 1099511626987, - 1099511626949, 1099511626937, 1099511626793, 1099511626781, 1099511626771, -]; - -const PRIMES41: &'static [u64] = &[2199023255531, 2199023255521, 2199023255497, 2199023255489, - 2199023255479, 2199023255477, 2199023255461, 2199023255441, 2199023255419, 2199023255413, - 2199023255357, 2199023255327, 2199023255291, 2199023255279, 2199023255267, 2199023255243, - 2199023255203, 2199023255171, 2199023255137, 2199023255101, 2199023255087, 2199023255081, - 2199023255069, 2199023255027, 2199023255021, 2199023254979, 2199023254933, 2199023254913, - 2199023254907, 2199023254903, 2199023254843, 2199023254787, 2199023254699, 2199023254693, - 2199023254657, 2199023254567, -]; - -const PRIMES42: &'static [u64] = &[4398046511093, 4398046511087, 4398046511071, 4398046511051, - 4398046511039, 4398046510961, 4398046510943, 4398046510939, 4398046510889, 4398046510877, - 4398046510829, 4398046510787, 4398046510771, 4398046510751, 4398046510733, 4398046510721, - 4398046510643, 4398046510639, 4398046510597, 4398046510577, 4398046510547, 4398046510531, - 4398046510463, 4398046510397, 4398046510391, 4398046510379, 4398046510357, 4398046510331, - 4398046510327, 4398046510313, 4398046510283, 4398046510279, 4398046510217, 4398046510141, - 4398046510133, 4398046510103, 4398046510093, -]; - -const PRIMES43: &'static [u64] = &[8796093022151, 8796093022141, 8796093022091, 8796093022033, - 8796093021953, 8796093021941, 8796093021917, 8796093021899, 8796093021889, 8796093021839, - 8796093021803, 8796093021791, 8796093021769, 8796093021763, 8796093021743, 8796093021671, - 8796093021607, 8796093021587, 8796093021533, 8796093021523, 8796093021517, 8796093021493, - 8796093021467, 8796093021461, 8796093021449, 8796093021409, 8796093021407, 8796093021371, - 8796093021347, 8796093021337, 8796093021281, 8796093021269, -]; - -const PRIMES44: &'static [u64] = &[17592186044399, 17592186044299, 17592186044297, 17592186044287, - 17592186044273, 17592186044267, 17592186044129, 17592186044089, 17592186044057, 17592186044039, - 17592186043987, 17592186043921, 17592186043889, 17592186043877, 17592186043841, 17592186043829, - 17592186043819, 17592186043813, 17592186043807, 17592186043741, 17592186043693, 17592186043667, - 17592186043631, 17592186043591, 17592186043577, 17592186043547, 17592186043483, 17592186043451, - 17592186043433, 17592186043409, -]; - -const PRIMES45: &'static [u64] = &[35184372088777, 35184372088763, 35184372088751, 35184372088739, - 35184372088711, 35184372088699, 35184372088693, 35184372088673, 35184372088639, 35184372088603, - 35184372088571, 35184372088517, 35184372088493, 35184372088471, 35184372088403, 35184372088391, - 35184372088379, 35184372088363, 35184372088321, 35184372088319, 35184372088279, 35184372088259, - 35184372088249, 35184372088241, 35184372088223, 35184372088183, 35184372088097, 35184372088081, - 35184372088079, 35184372088051, 35184372088043, 35184372088039, 35184372087937, 35184372087929, - 35184372087923, 35184372087881, 35184372087877, 35184372087869, -]; - -const PRIMES46: &'static [u64] = &[70368744177643, 70368744177607, 70368744177601, 70368744177587, - 70368744177497, 70368744177467, 70368744177427, 70368744177377, 70368744177359, 70368744177353, - 70368744177331, 70368744177289, 70368744177283, 70368744177271, 70368744177257, 70368744177227, - 70368744177167, 70368744177113, 70368744177029, 70368744176959, 70368744176921, 70368744176909, - 70368744176879, 70368744176867, 70368744176833, 70368744176827, 70368744176807, 70368744176779, - 70368744176777, 70368744176729, 70368744176719, 70368744176711, -]; - -const PRIMES47: &'static [u64] = &[140737488355213, 140737488355201, 140737488355181, - 140737488355049, 140737488355031, 140737488354989, 140737488354893, 140737488354787, - 140737488354709, 140737488354679, 140737488354613, 140737488354557, 140737488354511, - 140737488354431, 140737488354413, 140737488354409, 140737488354373, 140737488354347, - 140737488354329, -]; - -const PRIMES48: &'static [u64] = &[281474976710597, 281474976710591, 281474976710567, - 281474976710563, 281474976710509, 281474976710491, 281474976710467, 281474976710423, - 281474976710413, 281474976710399, 281474976710339, 281474976710327, 281474976710287, - 281474976710197, 281474976710143, 281474976710131, 281474976710129, 281474976710107, - 281474976710089, 281474976710087, 281474976710029, 281474976709987, 281474976709891, - 281474976709859, 281474976709831, 281474976709757, 281474976709741, 281474976709711, - 281474976709649, 281474976709637, -]; - -const PRIMES49: &'static [u64] = &[562949953421231, 562949953421201, 562949953421189, - 562949953421173, 562949953421131, 562949953421111, 562949953421099, 562949953421047, - 562949953421029, 562949953420973, 562949953420871, 562949953420867, 562949953420837, - 562949953420793, 562949953420747, 562949953420741, 562949953420733, 562949953420727, - 562949953420609, 562949953420571, 562949953420559, 562949953420553, 562949953420523, - 562949953420507, 562949953420457, 562949953420403, 562949953420373, 562949953420369, - 562949953420343, 562949953420303, 562949953420297, -]; - -const PRIMES50: &'static [u64] = &[1125899906842597, 1125899906842589, 1125899906842573, - 1125899906842553, 1125899906842511, 1125899906842507, 1125899906842493, 1125899906842463, - 1125899906842429, 1125899906842391, 1125899906842357, 1125899906842283, 1125899906842273, - 1125899906842247, 1125899906842201, 1125899906842177, 1125899906842079, 1125899906842033, - 1125899906842021, 1125899906842013, 1125899906841973, 1125899906841971, 1125899906841959, - 1125899906841949, 1125899906841943, 1125899906841917, 1125899906841901, 1125899906841883, - 1125899906841859, 1125899906841811, 1125899906841803, 1125899906841751, 1125899906841713, - 1125899906841673, 1125899906841653, 1125899906841623, 1125899906841613, -]; diff --git a/test/false.rs b/test/false.rs deleted file mode 100644 index 2cd6a327d..000000000 --- a/test/false.rs +++ /dev/null @@ -1,9 +0,0 @@ -use std::process::Command; - -static PROGNAME: &'static str = "./false"; - -#[test] -fn test_exit_code() { - let exit_status = Command::new(PROGNAME).status().unwrap().success(); - assert_eq!(exit_status, false); -} diff --git a/test/fixtures/cat/256.txt b/test/fixtures/cat/256.txt deleted file mode 100644 index c86626638e0bc8cf47ca49bb1525b40e9737ee64..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 256 zcmZQzWMXDvWn<^yMC+6cQE@6%&_`l#-T_m6KOcR8m$^Ra4i{)Y8_`)zddH zG%_|ZH8Z!cw6eCbwX=6{baHlab#wRd^z!!c_45x13RUz zF>}`JIdkXDU$Ah|;w4L$Enl&6)#^2C*R9{Mant54TeofBv2)k%J$v` lorem_ipsum.txt <== -Lorem ipsum dolor sit amet, -consectetur adipiscing elit. -Nunc interdum suscipit sem vel ornare. -Proin euismod, -justo sed mollis dictum, -eros urna ultricies augue, -eu pharetra mi ex id ante. -Duis convallis porttitor aliquam. -Nunc vitae tincidunt ex. -Suspendisse iaculis ligula ac diam consectetur lacinia. diff --git a/test/fixtures/mv/hello_world.txt b/test/fixtures/mv/hello_world.txt deleted file mode 100644 index 8ab686eaf..000000000 --- a/test/fixtures/mv/hello_world.txt +++ /dev/null @@ -1 +0,0 @@ -Hello, World! diff --git a/test/fixtures/nl/joinblanklines.txt b/test/fixtures/nl/joinblanklines.txt deleted file mode 100644 index 197859644..000000000 --- a/test/fixtures/nl/joinblanklines.txt +++ /dev/null @@ -1,27 +0,0 @@ -Nonempty -Nonempty -Followed by 10x empty - - - - - - - - - - -Followed by 5x empty - - - - - -Followed by 4x empty - - - - -Nonempty -Nonempty -Nonempty. diff --git a/test/fixtures/nl/section.txt b/test/fixtures/nl/section.txt deleted file mode 100644 index 62359e7bf..000000000 --- a/test/fixtures/nl/section.txt +++ /dev/null @@ -1,18 +0,0 @@ -\:\:\: -HEADER1 -HEADER2 -\:\: -BODY1 -BODY2 -\: -FOOTER1 -FOOTER2 -\:\:\: -NEXTHEADER1 -NEXTHEADER2 -\:\: -NEXTBODY1 -NEXTBODY2 -\: -NEXTFOOTER1 -NEXTFOOTER2 diff --git a/test/fixtures/nl/simple.txt b/test/fixtures/nl/simple.txt deleted file mode 100644 index b168ae840..000000000 --- a/test/fixtures/nl/simple.txt +++ /dev/null @@ -1,15 +0,0 @@ -L1 -L2 -L3 -L4 -L5 -L6 -L7 -L8 -L9 -L10 -L11 -L12 -L13 -L14 -L15 diff --git a/test/fixtures/paste/html_colors.expected b/test/fixtures/paste/html_colors.expected deleted file mode 100644 index 4fb65d6aa..000000000 --- a/test/fixtures/paste/html_colors.expected +++ /dev/null @@ -1,16 +0,0 @@ -white #FFFFFF -silver #C0C0C0 -gray #808080 -black #000000 -red #FF0000 -maroon #800000 -yellow #FFFF00 -olive #808000 -lime #00FF00 -green #008000 -aqua #00FFFF -teal #008080 -blue #0000FF -navy #000080 -fuchsia #FF00FF -purple #800080 diff --git a/test/fixtures/paste/html_colors.txt b/test/fixtures/paste/html_colors.txt deleted file mode 100644 index 290303ff0..000000000 --- a/test/fixtures/paste/html_colors.txt +++ /dev/null @@ -1,32 +0,0 @@ -white -#FFFFFF -silver -#C0C0C0 -gray -#808080 -black -#000000 -red -#FF0000 -maroon -#800000 -yellow -#FFFF00 -olive -#808000 -lime -#00FF00 -green -#008000 -aqua -#00FFFF -teal -#008080 -blue -#0000FF -navy -#000080 -fuchsia -#FF00FF -purple -#800080 diff --git a/test/fixtures/ptx/gnu_ext_disabled_ignore_and_only_file.expected b/test/fixtures/ptx/gnu_ext_disabled_ignore_and_only_file.expected deleted file mode 100644 index d57017253..000000000 --- a/test/fixtures/ptx/gnu_ext_disabled_ignore_and_only_file.expected +++ /dev/null @@ -1,2 +0,0 @@ -.xx "" """quotes"", for" "roff" "" -.xx "" "{brackets} for" "tex" "" diff --git a/test/fixtures/ptx/gnu_ext_disabled_roff_auto_ref.expected b/test/fixtures/ptx/gnu_ext_disabled_roff_auto_ref.expected deleted file mode 100644 index eefba851b..000000000 --- a/test/fixtures/ptx/gnu_ext_disabled_roff_auto_ref.expected +++ /dev/null @@ -1,24 +0,0 @@ -.xx "" "" """quotes"", for roff" "" "input:3" -.xx "" "and some other like" "%a, b#, c$c" "" "input:5" -.xx "" "maybe" "also~or^" "" "input:6" -.xx "" "" "and some other like %a, b#, c$c" "" "input:5" -.xx "" "oh," "and back\slash" "" "input:7" -.xx "" "and some other like %a," "b#, c$c" "" "input:5" -.xx "" "oh, and" "back\slash" "" "input:7" -.xx "" "and some other like %a, b#," "c$c" "" "input:5" -.xx "" "let's check special" "characters:" "" "input:2" -.xx "" "let's" "check special characters:" "" "input:2" -.xx "" """quotes""," "for roff" "" "input:3" -.xx "" "{brackets}" "for tex" "" "input:4" -.xx "" "" "hello world!" "" "input:1" -.xx "" "" "let's check special characters:" "" "input:2" -.xx "" "and some other" "like %a, b#, c$c" "" "input:5" -.xx "" "" "maybe also~or^" "" "input:6" -.xx "" "" "oh, and back\slash" "" "input:7" -.xx "" "and some" "other like %a, b#, c$c" "" "input:5" -.xx "" """quotes"", for" "roff" "" "input:3" -.xx "" "and" "some other like %a, b#, c$c" "" "input:5" -.xx "" "let's check" "special characters:" "" "input:2" -.xx "" "{brackets} for" "tex" "" "input:4" -.xx "" "hello" "world!" "" "input:1" -.xx "" "" "{brackets} for tex" "" "input:4" diff --git a/test/fixtures/ptx/gnu_ext_disabled_roff_input_ref.expected b/test/fixtures/ptx/gnu_ext_disabled_roff_input_ref.expected deleted file mode 100644 index f2f3f9160..000000000 --- a/test/fixtures/ptx/gnu_ext_disabled_roff_input_ref.expected +++ /dev/null @@ -1,17 +0,0 @@ -.xx "" "some other like" "%a, b#, c$c" "" "and" -.xx "" "" "also~or^" "" "maybe" -.xx "" "" "and back\slash" "" "oh," -.xx "" "some other like %a," "b#, c$c" "" "and" -.xx "" "and" "back\slash" "" "oh," -.xx "" "some other like %a, b#," "c$c" "" "and" -.xx "" "check special" "characters:" "" "let's" -.xx "" "" "check special characters:" "" "let's" -.xx "" "" "for roff" "" """quotes""," -.xx "" "" "for tex" "" "{brackets}" -.xx "" "some other" "like %a, b#, c$c" "" "and" -.xx "" "some" "other like %a, b#, c$c" "" "and" -.xx "" "for" "roff" "" """quotes""," -.xx "" "" "some other like %a, b#, c$c" "" "and" -.xx "" "check" "special characters:" "" "let's" -.xx "" "for" "tex" "" "{brackets}" -.xx "" "" "world!" "" "hello" diff --git a/test/fixtures/ptx/gnu_ext_disabled_roff_no_ref.expected b/test/fixtures/ptx/gnu_ext_disabled_roff_no_ref.expected deleted file mode 100644 index 3886e087d..000000000 --- a/test/fixtures/ptx/gnu_ext_disabled_roff_no_ref.expected +++ /dev/null @@ -1,24 +0,0 @@ -.xx "" "" """quotes"", for roff" "" -.xx "" "and some other like" "%a, b#, c$c" "" -.xx "" "maybe" "also~or^" "" -.xx "" "" "and some other like %a, b#, c$c" "" -.xx "" "oh," "and back\slash" "" -.xx "" "and some other like %a," "b#, c$c" "" -.xx "" "oh, and" "back\slash" "" -.xx "" "and some other like %a, b#," "c$c" "" -.xx "" "let's check special" "characters:" "" -.xx "" "let's" "check special characters:" "" -.xx "" """quotes""," "for roff" "" -.xx "" "{brackets}" "for tex" "" -.xx "" "" "hello world!" "" -.xx "" "" "let's check special characters:" "" -.xx "" "and some other" "like %a, b#, c$c" "" -.xx "" "" "maybe also~or^" "" -.xx "" "" "oh, and back\slash" "" -.xx "" "and some" "other like %a, b#, c$c" "" -.xx "" """quotes"", for" "roff" "" -.xx "" "and" "some other like %a, b#, c$c" "" -.xx "" "let's check" "special characters:" "" -.xx "" "{brackets} for" "tex" "" -.xx "" "hello" "world!" "" -.xx "" "" "{brackets} for tex" "" diff --git a/test/fixtures/ptx/gnu_ext_disabled_tex_auto_ref.expected b/test/fixtures/ptx/gnu_ext_disabled_tex_auto_ref.expected deleted file mode 100644 index f0b0f41c7..000000000 --- a/test/fixtures/ptx/gnu_ext_disabled_tex_auto_ref.expected +++ /dev/null @@ -1,24 +0,0 @@ -\xx {}{}{"quotes",}{ for roff}{}{input:3} -\xx {}{and some other like}{\%a,}{ b\#, c\$c}{}{input:5} -\xx {}{maybe}{also~or^}{}{}{input:6} -\xx {}{}{and}{ some other like \%a, b\#, c\$c}{}{input:5} -\xx {}{oh,}{and}{ back\backslash{}slash}{}{input:7} -\xx {}{and some other like \%a,}{b\#,}{ c\$c}{}{input:5} -\xx {}{oh, and}{back\backslash{}slash}{}{}{input:7} -\xx {}{and some other like \%a, b\#,}{c\$c}{}{}{input:5} -\xx {}{let's check special}{characters:}{}{}{input:2} -\xx {}{let's}{check}{ special characters:}{}{input:2} -\xx {}{"quotes",}{for}{ roff}{}{input:3} -\xx {}{$\{$brackets$\}$}{for}{ tex}{}{input:4} -\xx {}{}{hello}{ world!}{}{input:1} -\xx {}{}{let's}{ check special characters:}{}{input:2} -\xx {}{and some other}{like}{ \%a, b\#, c\$c}{}{input:5} -\xx {}{}{maybe}{ also~or^}{}{input:6} -\xx {}{}{oh,}{ and back\backslash{}slash}{}{input:7} -\xx {}{and some}{other}{ like \%a, b\#, c\$c}{}{input:5} -\xx {}{"quotes", for}{roff}{}{}{input:3} -\xx {}{and}{some}{ other like \%a, b\#, c\$c}{}{input:5} -\xx {}{let's check}{special}{ characters:}{}{input:2} -\xx {}{$\{$brackets$\}$ for}{tex}{}{}{input:4} -\xx {}{hello}{world!}{}{}{input:1} -\xx {}{}{$\{$brackets$\}$}{ for tex}{}{input:4} diff --git a/test/fixtures/ptx/gnu_ext_disabled_tex_input_ref.expected b/test/fixtures/ptx/gnu_ext_disabled_tex_input_ref.expected deleted file mode 100644 index 8e345339a..000000000 --- a/test/fixtures/ptx/gnu_ext_disabled_tex_input_ref.expected +++ /dev/null @@ -1,17 +0,0 @@ -\xx {}{some other like}{\%a,}{ b\#, c\$c}{}{and} -\xx {}{}{also~or^}{}{}{maybe} -\xx {}{}{and}{ back\backslash{}slash}{}{oh,} -\xx {}{some other like \%a,}{b\#,}{ c\$c}{}{and} -\xx {}{and}{back\backslash{}slash}{}{}{oh,} -\xx {}{some other like \%a, b\#,}{c\$c}{}{}{and} -\xx {}{check special}{characters:}{}{}{let's} -\xx {}{}{check}{ special characters:}{}{let's} -\xx {}{}{for}{ roff}{}{"quotes",} -\xx {}{}{for}{ tex}{}{$\{$brackets$\}$} -\xx {}{some other}{like}{ \%a, b\#, c\$c}{}{and} -\xx {}{some}{other}{ like \%a, b\#, c\$c}{}{and} -\xx {}{for}{roff}{}{}{"quotes",} -\xx {}{}{some}{ other like \%a, b\#, c\$c}{}{and} -\xx {}{check}{special}{ characters:}{}{let's} -\xx {}{for}{tex}{}{}{$\{$brackets$\}$} -\xx {}{}{world!}{}{}{hello} diff --git a/test/fixtures/ptx/gnu_ext_disabled_tex_no_ref.expected b/test/fixtures/ptx/gnu_ext_disabled_tex_no_ref.expected deleted file mode 100644 index dad32b5f1..000000000 --- a/test/fixtures/ptx/gnu_ext_disabled_tex_no_ref.expected +++ /dev/null @@ -1,24 +0,0 @@ -\xx {}{}{"quotes",}{ for roff}{} -\xx {}{and some other like}{\%a,}{ b\#, c\$c}{} -\xx {}{maybe}{also~or^}{}{} -\xx {}{}{and}{ some other like \%a, b\#, c\$c}{} -\xx {}{oh,}{and}{ back\backslash{}slash}{} -\xx {}{and some other like \%a,}{b\#,}{ c\$c}{} -\xx {}{oh, and}{back\backslash{}slash}{}{} -\xx {}{and some other like \%a, b\#,}{c\$c}{}{} -\xx {}{let's check special}{characters:}{}{} -\xx {}{let's}{check}{ special characters:}{} -\xx {}{"quotes",}{for}{ roff}{} -\xx {}{$\{$brackets$\}$}{for}{ tex}{} -\xx {}{}{hello}{ world!}{} -\xx {}{}{let's}{ check special characters:}{} -\xx {}{and some other}{like}{ \%a, b\#, c\$c}{} -\xx {}{}{maybe}{ also~or^}{} -\xx {}{}{oh,}{ and back\backslash{}slash}{} -\xx {}{and some}{other}{ like \%a, b\#, c\$c}{} -\xx {}{"quotes", for}{roff}{}{} -\xx {}{and}{some}{ other like \%a, b\#, c\$c}{} -\xx {}{let's check}{special}{ characters:}{} -\xx {}{$\{$brackets$\}$ for}{tex}{}{} -\xx {}{hello}{world!}{}{} -\xx {}{}{$\{$brackets$\}$}{ for tex}{} diff --git a/test/fixtures/ptx/ignore b/test/fixtures/ptx/ignore deleted file mode 100644 index d671622f8..000000000 --- a/test/fixtures/ptx/ignore +++ /dev/null @@ -1,2 +0,0 @@ -maybe -about diff --git a/test/fixtures/ptx/input b/test/fixtures/ptx/input deleted file mode 100644 index 6ba595bc0..000000000 --- a/test/fixtures/ptx/input +++ /dev/null @@ -1,7 +0,0 @@ -hello world! -let's check special characters: -"quotes", for roff -{brackets} for tex -and some other like %a, b#, c$c -maybe also~or^ -oh, and back\slash diff --git a/test/fixtures/ptx/only b/test/fixtures/ptx/only deleted file mode 100644 index 917aa2431..000000000 --- a/test/fixtures/ptx/only +++ /dev/null @@ -1,5 +0,0 @@ -roff -tex -world -maybe -about diff --git a/test/fixtures/sort/human1.ans b/test/fixtures/sort/human1.ans deleted file mode 100644 index 74fad9fdf..000000000 --- a/test/fixtures/sort/human1.ans +++ /dev/null @@ -1,11 +0,0 @@ -844K -981K -11M -13M -14M -16M -18M -19M -20M -981T -20P diff --git a/test/fixtures/sort/human1.txt b/test/fixtures/sort/human1.txt deleted file mode 100644 index 803666dbe..000000000 --- a/test/fixtures/sort/human1.txt +++ /dev/null @@ -1,11 +0,0 @@ -14M -20M -20P -11M -981T -16M -18M -19M -844K -981K -13M diff --git a/test/fixtures/sort/numeric1.ans b/test/fixtures/sort/numeric1.ans deleted file mode 100644 index c61659bcd..000000000 --- a/test/fixtures/sort/numeric1.ans +++ /dev/null @@ -1,2 +0,0 @@ -0 -.02 diff --git a/test/fixtures/sort/numeric1.txt b/test/fixtures/sort/numeric1.txt deleted file mode 100644 index b2cc3ea1a..000000000 --- a/test/fixtures/sort/numeric1.txt +++ /dev/null @@ -1,2 +0,0 @@ -.02 -0 diff --git a/test/fixtures/sort/numeric2.ans b/test/fixtures/sort/numeric2.ans deleted file mode 100644 index 99ff9b359..000000000 --- a/test/fixtures/sort/numeric2.ans +++ /dev/null @@ -1,2 +0,0 @@ -.02 -.03 diff --git a/test/fixtures/sort/numeric2.txt b/test/fixtures/sort/numeric2.txt deleted file mode 100644 index 25eb8cfbd..000000000 --- a/test/fixtures/sort/numeric2.txt +++ /dev/null @@ -1,2 +0,0 @@ -.03 -.02 diff --git a/test/fixtures/sort/numeric3.ans b/test/fixtures/sort/numeric3.ans deleted file mode 100644 index ce65c1f73..000000000 --- a/test/fixtures/sort/numeric3.ans +++ /dev/null @@ -1,2 +0,0 @@ -.000 -.01 diff --git a/test/fixtures/sort/numeric3.txt b/test/fixtures/sort/numeric3.txt deleted file mode 100644 index 7d772028a..000000000 --- a/test/fixtures/sort/numeric3.txt +++ /dev/null @@ -1,2 +0,0 @@ -.01 -.000 diff --git a/test/fixtures/sort/numeric4.ans b/test/fixtures/sort/numeric4.ans deleted file mode 100644 index 7d5f4d647..000000000 --- a/test/fixtures/sort/numeric4.ans +++ /dev/null @@ -1,2 +0,0 @@ -.00 -.01 diff --git a/test/fixtures/sort/numeric4.txt b/test/fixtures/sort/numeric4.txt deleted file mode 100644 index 490de8590..000000000 --- a/test/fixtures/sort/numeric4.txt +++ /dev/null @@ -1,2 +0,0 @@ -.01 -.00 diff --git a/test/fixtures/sort/numeric5.ans b/test/fixtures/sort/numeric5.ans deleted file mode 100644 index 4c59f5cda..000000000 --- a/test/fixtures/sort/numeric5.ans +++ /dev/null @@ -1,2 +0,0 @@ -.022 -.024 diff --git a/test/fixtures/sort/numeric5.txt b/test/fixtures/sort/numeric5.txt deleted file mode 100644 index 4c59f5cda..000000000 --- a/test/fixtures/sort/numeric5.txt +++ /dev/null @@ -1,2 +0,0 @@ -.022 -.024 diff --git a/test/fixtures/sort/numeric6.ans b/test/fixtures/sort/numeric6.ans deleted file mode 100644 index 190423f88..000000000 --- a/test/fixtures/sort/numeric6.ans +++ /dev/null @@ -1,100 +0,0 @@ -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 diff --git a/test/fixtures/sort/numeric6.txt b/test/fixtures/sort/numeric6.txt deleted file mode 100644 index d3c2bb861..000000000 --- a/test/fixtures/sort/numeric6.txt +++ /dev/null @@ -1,100 +0,0 @@ -33 -16 -35 -56 -72 -37 -21 -49 -70 -48 -90 -83 -44 -79 -10 -20 -4 -26 -27 -63 -29 -47 -51 -85 -88 -46 -30 -61 -93 -81 -78 -53 -87 -18 -98 -38 -13 -39 -23 -71 -5 -100 -96 -8 -24 -14 -28 -15 -25 -43 -36 -67 -75 -66 -31 -57 -34 -80 -40 -86 -17 -55 -9 -1 -62 -12 -74 -58 -69 -76 -11 -73 -68 -59 -41 -45 -52 -97 -82 -6 -7 -77 -42 -84 -95 -94 -89 -19 -64 -2 -22 -50 -60 -32 -92 -3 -99 -65 -54 -91 diff --git a/test/fixtures/sum/alice_in_wonderland.txt b/test/fixtures/sum/alice_in_wonderland.txt deleted file mode 100644 index a95562a1c..000000000 --- a/test/fixtures/sum/alice_in_wonderland.txt +++ /dev/null @@ -1,5 +0,0 @@ -Alice was beginning to get very tired of sitting by -her sister on the bank, and of having nothing to do: once or twice -she had peeped into the book her sister was reading, but it had no -pictures or conversations in it, "and what is the use of a book," -thought Alice "without pictures or conversation?" diff --git a/test/fixtures/sum/bsd_multiple_files.expected b/test/fixtures/sum/bsd_multiple_files.expected deleted file mode 100644 index 1b05ee27f..000000000 --- a/test/fixtures/sum/bsd_multiple_files.expected +++ /dev/null @@ -1,2 +0,0 @@ -8109 1 lorem_ipsum.txt -1814 1 alice_in_wonderland.txt diff --git a/test/fixtures/sum/bsd_single_file.expected b/test/fixtures/sum/bsd_single_file.expected deleted file mode 100644 index 3cffc4337..000000000 --- a/test/fixtures/sum/bsd_single_file.expected +++ /dev/null @@ -1 +0,0 @@ -8109 1 diff --git a/test/fixtures/sum/bsd_stdin.expected b/test/fixtures/sum/bsd_stdin.expected deleted file mode 100644 index 3cffc4337..000000000 --- a/test/fixtures/sum/bsd_stdin.expected +++ /dev/null @@ -1 +0,0 @@ -8109 1 diff --git a/test/fixtures/sum/lorem_ipsum.txt b/test/fixtures/sum/lorem_ipsum.txt deleted file mode 100644 index 16752446c..000000000 --- a/test/fixtures/sum/lorem_ipsum.txt +++ /dev/null @@ -1,13 +0,0 @@ -Lorem ipsum dolor sit amet, consectetur adipiscing -elit. Nunc interdum suscipit sem vel ornare. Proin euismod, justo -sed mollis dictum, eros urna ultricies augue, eu pharetra mi ex id -ante. Duis convallis porttitor aliquam. Nunc vitae tincidunt ex. -Suspendisse iaculis ligula ac diam consectetur lacinia. Donec vel -velit dui. Etiam fringilla, dolor quis tempor vehicula, lacus -turpis bibendum velit, et pellentesque elit odio a magna. Cras -vulputate tortor non libero vehicula euismod. Aliquam tincidunt -nisl eget enim cursus, viverra sagittis magna commodo. Cras rhoncus -egestas leo nec blandit. Suspendisse potenti. Etiam ullamcorper -leo vel lacus vestibulum, cursus semper eros efficitur. In hac -habitasse platea dictumst. Phasellus scelerisque vehicula -fringilla. diff --git a/test/fixtures/sum/sysv_multiple_files.expected b/test/fixtures/sum/sysv_multiple_files.expected deleted file mode 100644 index 83a6d6d83..000000000 --- a/test/fixtures/sum/sysv_multiple_files.expected +++ /dev/null @@ -1,2 +0,0 @@ -6985 2 lorem_ipsum.txt -27441 1 alice_in_wonderland.txt diff --git a/test/fixtures/sum/sysv_single_file.expected b/test/fixtures/sum/sysv_single_file.expected deleted file mode 100644 index e0f7252cb..000000000 --- a/test/fixtures/sum/sysv_single_file.expected +++ /dev/null @@ -1 +0,0 @@ -6985 2 lorem_ipsum.txt diff --git a/test/fixtures/sum/sysv_stdin.expected b/test/fixtures/sum/sysv_stdin.expected deleted file mode 100644 index f0fba8c81..000000000 --- a/test/fixtures/sum/sysv_stdin.expected +++ /dev/null @@ -1 +0,0 @@ -6985 2 diff --git a/test/fixtures/tac/delimited_primes.expected b/test/fixtures/tac/delimited_primes.expected deleted file mode 100644 index cf58c9015..000000000 --- a/test/fixtures/tac/delimited_primes.expected +++ /dev/null @@ -1 +0,0 @@ -9789:83:79:73:71:67:61:59:53:47:43:41:37:31:29:23:19:17:13:11:7:5:3:2: \ No newline at end of file diff --git a/test/fixtures/tac/delimited_primes.txt b/test/fixtures/tac/delimited_primes.txt deleted file mode 100644 index 867a26610..000000000 --- a/test/fixtures/tac/delimited_primes.txt +++ /dev/null @@ -1 +0,0 @@ -2:3:5:7:11:13:17:19:23:29:31:37:41:43:47:53:59:61:67:71:73:79:83:89:97 \ No newline at end of file diff --git a/test/fixtures/tac/delimited_primes_before.expected b/test/fixtures/tac/delimited_primes_before.expected deleted file mode 100644 index 13cb1be06..000000000 --- a/test/fixtures/tac/delimited_primes_before.expected +++ /dev/null @@ -1 +0,0 @@ -97:89:83:79:73:71:67:61:59:53:47:43:41:37:31:29:23:19:17:13:11:7:5:3:2 \ No newline at end of file diff --git a/test/fixtures/tac/prime_per_line.expected b/test/fixtures/tac/prime_per_line.expected deleted file mode 100644 index 72413442f..000000000 --- a/test/fixtures/tac/prime_per_line.expected +++ /dev/null @@ -1,25 +0,0 @@ -97 -89 -83 -79 -73 -71 -67 -61 -59 -53 -47 -43 -41 -37 -31 -29 -23 -19 -17 -13 -11 -7 -5 -3 -2 diff --git a/test/fixtures/tac/prime_per_line.txt b/test/fixtures/tac/prime_per_line.txt deleted file mode 100644 index afc67fd93..000000000 --- a/test/fixtures/tac/prime_per_line.txt +++ /dev/null @@ -1,25 +0,0 @@ -2 -3 -5 -7 -11 -13 -17 -19 -23 -29 -31 -37 -41 -43 -47 -53 -59 -61 -67 -71 -73 -79 -83 -89 -97 diff --git a/test/fixtures/tsort/call_graph.expected b/test/fixtures/tsort/call_graph.expected deleted file mode 100644 index e33aa72bd..000000000 --- a/test/fixtures/tsort/call_graph.expected +++ /dev/null @@ -1,17 +0,0 @@ -main -parse_options -tail_file -tail_forever -tail -recheck -write_header -tail_lines -tail_bytes -pretty_name -start_lines -file_lines -pipe_lines -xlseek -start_bytes -pipe_bytes -dump_remainder diff --git a/test/fixtures/tsort/call_graph.txt b/test/fixtures/tsort/call_graph.txt deleted file mode 100644 index c6f94e5b6..000000000 --- a/test/fixtures/tsort/call_graph.txt +++ /dev/null @@ -1,22 +0,0 @@ -main parse_options -main tail_file -main tail_forever -tail_file pretty_name -tail_file write_header -tail_file tail -tail_forever recheck -tail_forever pretty_name -tail_forever write_header -tail_forever dump_remainder -tail tail_lines -tail tail_bytes -tail_lines start_lines -tail_lines dump_remainder -tail_lines file_lines -tail_lines pipe_lines -tail_bytes xlseek -tail_bytes start_bytes -tail_bytes dump_remainder -tail_bytes pipe_bytes -file_lines dump_remainder -recheck pretty_name diff --git a/test/fixtures/wc/alice_in_wonderland.txt b/test/fixtures/wc/alice_in_wonderland.txt deleted file mode 100644 index a95562a1c..000000000 --- a/test/fixtures/wc/alice_in_wonderland.txt +++ /dev/null @@ -1,5 +0,0 @@ -Alice was beginning to get very tired of sitting by -her sister on the bank, and of having nothing to do: once or twice -she had peeped into the book her sister was reading, but it had no -pictures or conversations in it, "and what is the use of a book," -thought Alice "without pictures or conversation?" diff --git a/test/fixtures/wc/lorem_ipsum.txt b/test/fixtures/wc/lorem_ipsum.txt deleted file mode 100644 index 16752446c..000000000 --- a/test/fixtures/wc/lorem_ipsum.txt +++ /dev/null @@ -1,13 +0,0 @@ -Lorem ipsum dolor sit amet, consectetur adipiscing -elit. Nunc interdum suscipit sem vel ornare. Proin euismod, justo -sed mollis dictum, eros urna ultricies augue, eu pharetra mi ex id -ante. Duis convallis porttitor aliquam. Nunc vitae tincidunt ex. -Suspendisse iaculis ligula ac diam consectetur lacinia. Donec vel -velit dui. Etiam fringilla, dolor quis tempor vehicula, lacus -turpis bibendum velit, et pellentesque elit odio a magna. Cras -vulputate tortor non libero vehicula euismod. Aliquam tincidunt -nisl eget enim cursus, viverra sagittis magna commodo. Cras rhoncus -egestas leo nec blandit. Suspendisse potenti. Etiam ullamcorper -leo vel lacus vestibulum, cursus semper eros efficitur. In hac -habitasse platea dictumst. Phasellus scelerisque vehicula -fringilla. diff --git a/test/fixtures/wc/moby_dick.txt b/test/fixtures/wc/moby_dick.txt deleted file mode 100644 index 193dc8e35..000000000 --- a/test/fixtures/wc/moby_dick.txt +++ /dev/null @@ -1,18 +0,0 @@ -Call me Ishmael. Some years ago - never mind how long -precisely - having little or no money in my purse, and nothing -particular to interest me on shore, I thought I would sail about a -little and see the watery part of the world. It is a way I have of -driving off the spleen and regulating the circulation. Whenever I -find myself growing grim about the mouth; whenever it is a damp, -drizzly November in my soul; whenever I find myself involuntarily -pausing before coffin warehouses, and bringing up the rear of every -funeral I meet; and especially whenever my hypos get such an upper -hand of me, that it requires a strong moral principle to prevent me -from deliberately stepping into the street, and methodically -knocking people's hats off - then, I account it high time to get to -sea as soon as I can. This is my substitute for pistol and ball. -With a philosophical flourish Cato throws himself upon his sword; I -quietly take to the ship. There is nothing surprising in this. If -they but knew it, almost all men in their degree, some time or -other, cherish very nearly the same feelings towards the ocean with -me. diff --git a/test/fold.rs b/test/fold.rs deleted file mode 100644 index ecae80303..000000000 --- a/test/fold.rs +++ /dev/null @@ -1,53 +0,0 @@ -use std::fs::File; -use std::io::Read; -use std::path::Path; -use std::process::Command; - -static PROGNAME: &'static str = "./fold"; - -#[test] -fn test_default_80_column_wrap() { - let po = Command::new(PROGNAME) - .arg("lorem_ipsum.txt") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - fold_helper(po.stdout, "lorem_ipsum_80_column.expected"); -} - -#[test] -fn test_40_column_hard_cutoff() { - let po = Command::new(PROGNAME) - .arg("-w") - .arg("40") - .arg("lorem_ipsum.txt") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - fold_helper(po.stdout, "lorem_ipsum_40_column_hard.expected"); -} - -#[test] -fn test_40_column_word_boundary() { - let po = Command::new(PROGNAME) - .arg("-s") - .arg("-w") - .arg("40") - .arg("lorem_ipsum.txt") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - fold_helper(po.stdout, "lorem_ipsum_40_column_word.expected"); -} - -fn fold_helper(output: Vec, filename: &str) { - let mut f = File::open(Path::new(filename)).unwrap_or_else(|err| { - panic!("{}", err) - }); - let mut expected = vec!(); - match f.read_to_end(&mut expected) { - Ok(_) => {}, - Err(err) => panic!("{}", err) - } - assert_eq!(String::from_utf8(output).unwrap(), String::from_utf8(expected).unwrap()); -} diff --git a/test/hashsum.rs b/test/hashsum.rs deleted file mode 100644 index 38f300303..000000000 --- a/test/hashsum.rs +++ /dev/null @@ -1,47 +0,0 @@ -static PROGNAME: &'static str = "./hashsum"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -macro_rules! get_hash( - ($str:expr) => ( - $str.split(' ').collect::>()[0] - ); -); - -macro_rules! test_digest { - ($($t:ident)*) => ($( - - mod $t { - use std::process::Command; - use util::*; - - static DIGEST_ARG: &'static str = concat!("--", stringify!($t)); - static EXPECTED_FILE: &'static str = concat!(stringify!($t), ".expected"); - - #[test] - fn test_single_file() { - let mut cmd = Command::new(::PROGNAME); - let result = run(&mut cmd.arg(DIGEST_ARG).arg("input.txt")); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(get_hash!(result.stdout), get_file_contents(EXPECTED_FILE)); - } - - #[test] - fn test_stdin() { - let input = get_file_contents("input.txt"); - let mut cmd = Command::new(::PROGNAME); - let result = run_piped_stdin(&mut cmd.arg(DIGEST_ARG), input); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(get_hash!(result.stdout), get_file_contents(EXPECTED_FILE)); - } - } - )*) -} - -test_digest! { md5 sha1 sha224 sha256 sha384 sha512 } diff --git a/test/head.rs b/test/head.rs deleted file mode 100644 index 4368225b3..000000000 --- a/test/head.rs +++ /dev/null @@ -1,72 +0,0 @@ -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./head"; -static INPUT: &'static str = "lorem_ipsum.txt"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_stdin_default() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd, get_file_contents(INPUT)); - assert_eq!(result.stdout, get_file_contents("lorem_ipsum_default.expected")); -} - -#[test] -fn test_stdin_1_line_obsolete() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-1"]), get_file_contents(INPUT)); - assert_eq!(result.stdout, get_file_contents("lorem_ipsum_1_line.expected")); -} - -#[test] -fn test_stdin_1_line() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-n", "1"]), get_file_contents(INPUT)); - assert_eq!(result.stdout, get_file_contents("lorem_ipsum_1_line.expected")); -} - -#[test] -fn test_stdin_5_chars() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-c", "5"]), get_file_contents(INPUT)); - assert_eq!(result.stdout, get_file_contents("lorem_ipsum_5_chars.expected")); -} - -#[test] -fn test_single_default() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.arg(INPUT)); - assert_eq!(result.stdout, get_file_contents("lorem_ipsum_default.expected")); -} - -#[test] -fn test_single_1_line_obsolete() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-1", INPUT])); - assert_eq!(result.stdout, get_file_contents("lorem_ipsum_1_line.expected")); -} - -#[test] -fn test_single_1_line() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-n", "1", INPUT])); - assert_eq!(result.stdout, get_file_contents("lorem_ipsum_1_line.expected")); -} - -#[test] -fn test_single_5_chars() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-c", "5", INPUT])); - assert_eq!(result.stdout, get_file_contents("lorem_ipsum_5_chars.expected")); -} - -#[test] -fn test_verbose() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-v", INPUT])); - assert_eq!(result.stdout, get_file_contents("lorem_ipsum_verbose.expected")); -} diff --git a/test/link.rs b/test/link.rs deleted file mode 100644 index 44ce2c2bd..000000000 --- a/test/link.rs +++ /dev/null @@ -1,49 +0,0 @@ -extern crate libc; - -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./link"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_link_existing_file() { - let file = "test_link_existing_file"; - let link = "test_link_existing_file_link"; - - touch(file); - set_file_contents(file, "foobar"); - assert!(file_exists(file)); - - let result = run(Command::new(PROGNAME).args(&[file, link])); - assert_empty_stderr!(result); - assert!(result.success); - assert!(file_exists(file)); - assert!(file_exists(link)); - assert_eq!(get_file_contents(file), get_file_contents(link)); -} - -#[test] -fn test_link_no_circular() { - let link = "test_link_no_circular"; - - let result = run(Command::new(PROGNAME).args(&[link, link])); - assert_eq!(result.stderr, "link: error: No such file or directory (os error 2)\n"); - assert!(!result.success); - assert!(!file_exists(link)); -} - -#[test] -fn test_link_nonexistent_file() { - let file = "test_link_nonexistent_file"; - let link = "test_link_nonexistent_file_link"; - - let result = run(Command::new(PROGNAME).args(&[file, link])); - assert_eq!(result.stderr, "link: error: No such file or directory (os error 2)\n"); - assert!(!result.success); - assert!(!file_exists(file)); - assert!(!file_exists(link)); -} diff --git a/test/ln.rs b/test/ln.rs deleted file mode 100644 index 9020dc0c5..000000000 --- a/test/ln.rs +++ /dev/null @@ -1,354 +0,0 @@ -extern crate libc; - -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./ln"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_symlink_existing_file() { - let file = "test_symlink_existing_file"; - let link = "test_symlink_existing_file_link"; - - touch(file); - - let result = run(Command::new(PROGNAME).args(&["-s", file, link])); - assert_empty_stderr!(result); - assert!(result.success); - assert!(file_exists(file)); - assert!(is_symlink(link)); - assert_eq!(resolve_link(link), file); -} - -#[test] -fn test_symlink_dangling_file() { - let file = "test_symlink_dangling_file"; - let link = "test_symlink_dangling_file_link"; - - let result = run(Command::new(PROGNAME).args(&["-s", file, link])); - assert_empty_stderr!(result); - assert!(result.success); - assert!(!file_exists(file)); - assert!(is_symlink(link)); - assert_eq!(resolve_link(link), file); -} - -#[test] -fn test_symlink_existing_directory() { - let dir = "test_symlink_existing_dir"; - let link = "test_symlink_existing_dir_link"; - - mkdir(dir); - - let result = run(Command::new(PROGNAME).args(&["-s", dir, link])); - assert_empty_stderr!(result); - assert!(result.success); - assert!(dir_exists(dir)); - assert!(is_symlink(link)); - assert_eq!(resolve_link(link), dir); -} - -#[test] -fn test_symlink_dangling_directory() { - let dir = "test_symlink_dangling_dir"; - let link = "test_symlink_dangling_dir_link"; - - let result = run(Command::new(PROGNAME).args(&["-s", dir, link])); - assert_empty_stderr!(result); - assert!(result.success); - assert!(!dir_exists(dir)); - assert!(is_symlink(link)); - assert_eq!(resolve_link(link), dir); -} - -#[test] -fn test_symlink_circular() { - let link = "test_symlink_circular"; - - let result = run(Command::new(PROGNAME).args(&["-s", link])); - assert_empty_stderr!(result); - assert!(result.success); - assert!(is_symlink(link)); - assert_eq!(resolve_link(link), link); -} - -#[test] -fn test_symlink_dont_overwrite() { - let file = "test_symlink_dont_overwrite"; - let link = "test_symlink_dont_overwrite_link"; - - touch(file); - touch(link); - - let result = run(Command::new(PROGNAME).args(&["-s", file, link])); - assert!(!result.success); - assert!(file_exists(file)); - assert!(file_exists(link)); - assert!(!is_symlink(link)); -} - -#[test] -fn test_symlink_overwrite_force() { - let file_a = "test_symlink_overwrite_force_a"; - let file_b = "test_symlink_overwrite_force_b"; - let link = "test_symlink_overwrite_force_link"; - - // Create symlink - symlink(file_a, link); - assert!(is_symlink(link)); - assert_eq!(resolve_link(link), file_a); - - // Force overwrite of existing symlink - let result = run(Command::new(PROGNAME).args(&["--force", "-s", file_b, link])); - assert!(result.success); - assert!(is_symlink(link)); - assert_eq!(resolve_link(link), file_b); -} - -#[test] -fn test_symlink_interactive() { - let file = "test_symlink_interactive_file"; - let link = "test_symlink_interactive_file_link"; - - touch(file); - touch(link); - - let result1 = run_piped_stdin(Command::new(PROGNAME).args(&["-i", "-s", file, link]), b"n"); - - assert_empty_stderr!(result1); - assert!(result1.success); - - assert!(file_exists(file)); - assert!(!is_symlink(link)); - - let result2 = run_piped_stdin(Command::new(PROGNAME).args(&["-i", "-s", file, link]), b"Yesh"); - - assert_empty_stderr!(result2); - assert!(result2.success); - - assert!(file_exists(file)); - assert!(is_symlink(link)); - assert_eq!(resolve_link(link), file); -} - -#[test] -fn test_symlink_simple_backup() { - let file = "test_symlink_simple_backup"; - let link = "test_symlink_simple_backup_link"; - - touch(file); - symlink(file, link); - assert!(file_exists(file)); - assert!(is_symlink(link)); - assert_eq!(resolve_link(link), file); - - let result = run(Command::new(PROGNAME).args(&["-b", "-s", file, link])); - - assert_empty_stderr!(result); - assert!(result.success); - assert!(file_exists(file)); - - assert!(is_symlink(link)); - assert_eq!(resolve_link(link), file); - - let backup = &format!("{}~", link); - assert!(is_symlink(backup)); - assert_eq!(resolve_link(backup), file); -} - -#[test] -fn test_symlink_custom_backup_suffix() { - let file = "test_symlink_custom_backup_suffix"; - let link = "test_symlink_custom_backup_suffix_link"; - let suffix = "super-suffix-of-the-century"; - - touch(file); - symlink(file, link); - assert!(file_exists(file)); - assert!(is_symlink(link)); - assert_eq!(resolve_link(link), file); - - let arg = &format!("--suffix={}", suffix); - let result = run(Command::new(PROGNAME).args(&["-b", arg, "-s", file, link])); - - assert_empty_stderr!(result); - assert!(result.success); - assert!(file_exists(file)); - - assert!(is_symlink(link)); - assert_eq!(resolve_link(link), file); - - let backup = &format!("{}{}", link, suffix); - assert!(is_symlink(backup)); - assert_eq!(resolve_link(backup), file); -} - -#[test] -fn test_symlink_backup_numbering() { - let file = "test_symlink_backup_numbering"; - let link = "test_symlink_backup_numbering_link"; - - touch(file); - symlink(file, link); - assert!(file_exists(file)); - assert!(is_symlink(link)); - assert_eq!(resolve_link(link), file); - - let result = run(Command::new(PROGNAME).args(&["-s", "--backup=t", file, link])); - - assert_empty_stderr!(result); - assert!(result.success); - assert!(file_exists(file)); - - assert!(is_symlink(link)); - assert_eq!(resolve_link(link), file); - - let backup = &format!("{}.~1~", link); - assert!(is_symlink(backup)); - assert_eq!(resolve_link(backup), file); -} - -#[test] -fn test_symlink_existing_backup() { - let file = "test_symlink_existing_backup"; - let link = "test_symlink_existing_backup_link"; - let link_backup = "test_symlink_existing_backup_link.~1~"; - let resulting_backup = "test_symlink_existing_backup_link.~2~"; - - // Create symlink and verify - touch(file); - symlink(file, link); - assert!(file_exists(file)); - assert!(is_symlink(link)); - assert_eq!(resolve_link(link), file); - - // Create backup symlink and verify - symlink(file, link_backup); - assert!(file_exists(file)); - assert!(is_symlink(link_backup)); - assert_eq!(resolve_link(link_backup), file); - - let result = run(Command::new(PROGNAME).args(&["-s", "--backup=nil", file, link])); - - assert_empty_stderr!(result); - assert!(result.success); - assert!(file_exists(file)); - - assert!(is_symlink(link_backup)); - assert_eq!(resolve_link(link_backup), file); - - assert!(is_symlink(resulting_backup)); - assert_eq!(resolve_link(resulting_backup), file); -} - -#[test] -fn test_symlink_target_dir() { - let dir = "test_ln_target_dir_dir"; - let file_a = "test_ln_target_dir_file_a"; - let file_b = "test_ln_target_dir_file_b"; - - touch(file_a); - touch(file_b); - mkdir(dir); - - let result = run(Command::new(PROGNAME).args(&["-s", "-t", dir, file_a, file_b])); - - assert_empty_stderr!(result); - assert!(result.success); - - let file_a_link = &format!("{}/{}", dir, file_a); - assert!(is_symlink(file_a_link)); - assert_eq!(resolve_link(file_a_link), file_a); - - let file_b_link = &format!("{}/{}", dir, file_b); - assert!(is_symlink(file_b_link)); - assert_eq!(resolve_link(file_b_link), file_b); -} - -#[test] -fn test_symlink_overwrite_dir() { - let path_a = "test_symlink_overwrite_dir_a"; - let path_b = "test_symlink_overwrite_dir_b"; - - touch(path_a); - mkdir(path_b); - - let result = run(Command::new(PROGNAME).args(&["-s", "-T", path_a, path_b])); - - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(path_a)); - assert!(is_symlink(path_b)); - assert_eq!(resolve_link(path_b), path_a); -} - -#[test] -fn test_symlink_overwrite_nonempty_dir() { - let path_a = "test_symlink_overwrite_nonempty_dir_a"; - let path_b = "test_symlink_overwrite_nonempty_dir_b"; - let dummy = "test_symlink_overwrite_nonempty_dir_b/file"; - - touch(path_a); - mkdir(path_b); - touch(dummy); - - let result = run(Command::new(PROGNAME).args(&["-v", "-T", "-s", path_a, path_b])); - - // Not same error as GNU; the error message is a Rust builtin - // TODO: test (and implement) correct error message (or at least decide whether to do so) - // Current: "ln: error: Directory not empty (os error 66)" - // GNU: "ln: cannot link 'a' to 'b': Directory not empty" - assert!(result.stderr.len() > 0); - - // Verbose output for the link should not be shown on failure - assert!(result.stdout.len() == 0); - - assert!(!result.success); - assert!(file_exists(path_a)); - assert!(dir_exists(path_b)); -} - -#[test] -fn test_symlink_errors() { - let dir = "test_symlink_errors_dir"; - let file_a = "test_symlink_errors_file_a"; - let file_b = "test_symlink_errors_file_b"; - - mkdir(dir); - touch(file_a); - touch(file_b); - - // $ ln -T -t a b - // ln: cannot combine --target-directory (-t) and --no-target-directory (-T) - let result = run(Command::new(PROGNAME).args(&["-T", "-t", dir, file_a, file_b])); - assert_eq!(result.stderr, - "ln: error: cannot combine --target-directory (-t) and --no-target-directory (-T)\n"); - assert!(!result.success); -} - -#[test] -fn test_symlink_verbose() { - let file_a = "test_symlink_verbose_file_a"; - let file_b = "test_symlink_verbose_file_b"; - - touch(file_a); - - let result = run(Command::new(PROGNAME).args(&["-v", file_a, file_b])); - assert_empty_stderr!(result); - assert_eq!(result.stdout, - format!("'{}' -> '{}'\n", file_b, file_a)); - assert!(result.success); - - touch(file_b); - - let result = run(Command::new(PROGNAME).args(&["-v", "-b", file_a, file_b])); - assert_empty_stderr!(result); - assert_eq!(result.stdout, - format!("'{}' -> '{}' (backup: '{}~')\n", file_b, file_a, file_b)); - assert!(result.success); -} diff --git a/test/mkdir.rs b/test/mkdir.rs deleted file mode 100644 index 463688dc1..000000000 --- a/test/mkdir.rs +++ /dev/null @@ -1,58 +0,0 @@ -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./mkdir"; -static TEST_DIR1: &'static str = "mkdir_test1"; -static TEST_DIR2: &'static str = "mkdir_test2"; -static TEST_DIR3: &'static str = "mkdir_test3"; -static TEST_DIR4: &'static str = "mkdir_test4/mkdir_test4_1"; -static TEST_DIR5: &'static str = "mkdir_test5/mkdir_test5_1"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_mkdir_mkdir() { - let mut cmd = Command::new(PROGNAME); - let exit_success = run(&mut cmd.arg(TEST_DIR1)).success; - cleanup(TEST_DIR1); - assert_eq!(exit_success, true); -} - -#[test] -fn test_mkdir_dup_dir() { - let mut cmd = Command::new(PROGNAME); - let exit_success = run(&mut cmd.arg(TEST_DIR2)).success; - if !exit_success { - cleanup(TEST_DIR2); - panic!(); - } - let exit_success2 = run(&mut cmd.arg(TEST_DIR2)).success; - cleanup(TEST_DIR2); - assert_eq!(exit_success2, false); -} - -#[test] -fn test_mkdir_mode() { - let mut cmd = Command::new(PROGNAME); - let exit_success = run(&mut cmd.arg("-m").arg("755").arg(TEST_DIR3)).success; - cleanup(TEST_DIR3); - assert_eq!(exit_success, true); -} - -#[test] -fn test_mkdir_parent() { - let mut cmd = Command::new(PROGNAME); - let exit_success = run(&mut cmd.arg("-p").arg(TEST_DIR4)).success; - cleanup(TEST_DIR4); - assert_eq!(exit_success, true); -} - -#[test] -fn test_mkdir_no_parent() { - let mut cmd = Command::new(PROGNAME); - let exit_success = run(&mut cmd.arg(TEST_DIR5)).success; - cleanup(TEST_DIR5); - assert_eq!(exit_success, false); -} diff --git a/test/mv.rs b/test/mv.rs deleted file mode 100644 index 9ab811ae9..000000000 --- a/test/mv.rs +++ /dev/null @@ -1,446 +0,0 @@ -extern crate libc; -extern crate time; -extern crate kernel32; -extern crate winapi; -extern crate filetime; - -use filetime::*; -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./mv"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_mv_rename_dir() { - let dir1 = "test_mv_rename_dir"; - let dir2 = "test_mv_rename_dir2"; - - mkdir(dir1); - - let result = run(Command::new(PROGNAME).arg(dir1).arg(dir2)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(dir_exists(dir2)); -} - -#[test] -fn test_mv_rename_file() { - let file1 = "test_mv_rename_file"; - let file2 = "test_mv_rename_file2"; - - touch(file1); - - let result = run(Command::new(PROGNAME).arg(file1).arg(file2)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(file2)); -} - -#[test] -fn test_mv_move_file_into_dir() { - let dir = "test_mv_move_file_into_dir_dir"; - let file = "test_mv_move_file_into_dir_file"; - - mkdir(dir); - touch(file); - - let result = run(Command::new(PROGNAME).arg(file).arg(dir)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(&format!("{}/{}", dir, file))); -} - -#[test] -fn test_mv_strip_slashes() { - let dir = "test_mv_strip_slashes_dir"; - let file = "test_mv_strip_slashes_file"; - let mut source = file.to_owned(); - source.push_str("/"); - - mkdir(dir); - touch(file); - - let result = run(Command::new(PROGNAME).arg(&source).arg(dir)); - assert!(!result.success); - - assert!(!file_exists(&format!("{}/{}", dir, file))); - - let result = run(Command::new(PROGNAME).arg("--strip-trailing-slashes").arg(source).arg(dir)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(&format!("{}/{}", dir, file))); -} - -#[test] -fn test_mv_multiple_files() { - let target_dir = "test_mv_multiple_files_dir"; - let file_a = "test_mv_multiple_file_a"; - let file_b = "test_mv_multiple_file_b"; - - mkdir(target_dir); - touch(file_a); - touch(file_b); - - let result = run(Command::new(PROGNAME).arg(file_a).arg(file_b).arg(target_dir)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(&format!("{}/{}", target_dir, file_a))); - assert!(file_exists(&format!("{}/{}", target_dir, file_b))); -} - -#[test] -fn test_mv_multiple_folders() { - let target_dir = "test_mv_multiple_dirs_dir"; - let dir_a = "test_mv_multiple_dir_a"; - let dir_b = "test_mv_multiple_dir_b"; - - mkdir(target_dir); - mkdir(dir_a); - mkdir(dir_b); - - let result = run(Command::new(PROGNAME).arg(dir_a).arg(dir_b).arg(target_dir)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(dir_exists(&format!("{}/{}", target_dir, dir_a))); - assert!(dir_exists(&format!("{}/{}", target_dir, dir_b))); -} - -#[test] -fn test_mv_interactive() { - let file_a = "test_mv_interactive_file_a"; - let file_b = "test_mv_interactive_file_b"; - - touch(file_a); - touch(file_b); - - - let result1 = run_piped_stdin(Command::new(PROGNAME).arg("-i").arg(file_a).arg(file_b), b"n"); - - assert_empty_stderr!(result1); - assert!(result1.success); - - assert!(file_exists(file_a)); - assert!(file_exists(file_b)); - - - let result2 = run_piped_stdin(Command::new(PROGNAME).arg("-i").arg(file_a).arg(file_b), b"Yesh"); - - assert_empty_stderr!(result2); - assert!(result2.success); - - assert!(!file_exists(file_a)); - assert!(file_exists(file_b)); -} - -#[test] -fn test_mv_no_clobber() { - let file_a = "test_mv_no_clobber_file_a"; - let file_b = "test_mv_no_clobber_file_b"; - - touch(file_a); - touch(file_b); - - let result = run(Command::new(PROGNAME).arg("-n").arg(file_a).arg(file_b)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(file_a)); - assert!(file_exists(file_b)); -} - -#[test] -fn test_mv_replace_file() { - let file_a = "test_mv_replace_file_a"; - let file_b = "test_mv_replace_file_b"; - - touch(file_a); - touch(file_b); - - let result = run(Command::new(PROGNAME).arg(file_a).arg(file_b)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!file_exists(file_a)); - assert!(file_exists(file_b)); -} - -#[test] -fn test_mv_force_replace_file() { - let file_a = "test_mv_force_replace_file_a"; - let file_b = "test_mv_force_replace_file_b"; - - touch(file_a); - touch(file_b); - - let result = run(Command::new(PROGNAME).arg("--force").arg(file_a).arg(file_b)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!file_exists(file_a)); - assert!(file_exists(file_b)); -} - -#[test] -fn test_mv_simple_backup() { - let file_a = "test_mv_simple_backup_file_a"; - let file_b = "test_mv_simple_backup_file_b"; - - touch(file_a); - touch(file_b); - let result = run(Command::new(PROGNAME).arg("-b").arg(file_a).arg(file_b)); - - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!file_exists(file_a)); - assert!(file_exists(file_b)); - assert!(file_exists(&format!("{}~", file_b))); -} - -#[test] -fn test_mv_custom_backup_suffix() { - let file_a = "test_mv_custom_backup_suffix_file_a"; - let file_b = "test_mv_custom_backup_suffix_file_b"; - let suffix = "super-suffix-of-the-century"; - - touch(file_a); - touch(file_b); - let result = run(Command::new(PROGNAME) - .arg("-b").arg(format!("--suffix={}", suffix)) - .arg(file_a).arg(file_b)); - - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!file_exists(file_a)); - assert!(file_exists(file_b)); - assert!(file_exists(&format!("{}{}", file_b, suffix))); -} - -#[test] -fn test_mv_backup_numbering() { - let file_a = "test_mv_backup_numbering_file_a"; - let file_b = "test_mv_backup_numbering_file_b"; - - touch(file_a); - touch(file_b); - let result = run(Command::new(PROGNAME).arg("--backup=t").arg(file_a).arg(file_b)); - - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!file_exists(file_a)); - assert!(file_exists(file_b)); - assert!(file_exists(&format!("{}.~1~", file_b))); -} - -#[test] -fn test_mv_existing_backup() { - let file_a = "test_mv_existing_backup_file_a"; - let file_b = "test_mv_existing_backup_file_b"; - let file_b_backup = "test_mv_existing_backup_file_b.~1~"; - let resulting_backup = "test_mv_existing_backup_file_b.~2~"; - - touch(file_a); - touch(file_b); - touch(file_b_backup); - let result = run(Command::new(PROGNAME).arg("--backup=nil").arg(file_a).arg(file_b)); - - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!file_exists(file_a)); - assert!(file_exists(file_b)); - assert!(file_exists(file_b_backup)); - assert!(file_exists(resulting_backup)); -} - -#[test] -fn test_mv_update_option() { - let file_a = "test_mv_update_option_file_a"; - let file_b = "test_mv_update_option_file_b"; - - touch(file_a); - touch(file_b); - let ts = time::now().to_timespec(); - let now = FileTime::from_seconds_since_1970(ts.sec as u64, ts.nsec as u32); - let later = FileTime::from_seconds_since_1970(ts.sec as u64 + 3600, ts.nsec as u32); - filetime::set_file_times(file_a, now, now).unwrap(); - filetime::set_file_times(file_b, now, later).unwrap(); - - let result1 = run(Command::new(PROGNAME).arg("--update").arg(file_a).arg(file_b)); - - assert_empty_stderr!(result1); - assert!(result1.success); - - assert!(file_exists(file_a)); - assert!(file_exists(file_b)); - - let result2 = run(Command::new(PROGNAME).arg("--update").arg(file_b).arg(file_a)); - - assert_empty_stderr!(result2); - assert!(result2.success); - - assert!(file_exists(file_a)); - assert!(!file_exists(file_b)); -} - -#[test] -fn test_mv_target_dir() { - let dir = "test_mv_target_dir_dir"; - let file_a = "test_mv_target_dir_file_a"; - let file_b = "test_mv_target_dir_file_b"; - - touch(file_a); - touch(file_b); - mkdir(dir); - let result = run(Command::new(PROGNAME).arg("-t").arg(dir).arg(file_a).arg(file_b)); - - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!file_exists(file_a)); - assert!(!file_exists(file_b)); - assert!(file_exists(&format!("{}/{}", dir, file_a))); - assert!(file_exists(&format!("{}/{}", dir, file_b))); -} - -#[test] -fn test_mv_overwrite_dir() { - let dir_a = "test_mv_overwrite_dir_a"; - let dir_b = "test_mv_overwrite_dir_b"; - - mkdir(dir_a); - mkdir(dir_b); - let result = run(Command::new(PROGNAME).arg("-T").arg(dir_a).arg(dir_b)); - - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!dir_exists(dir_a)); - assert!(dir_exists(dir_b)); -} - -#[test] -fn test_mv_overwrite_nonempty_dir() { - let dir_a = "test_mv_overwrite_nonempty_dir_a"; - let dir_b = "test_mv_overwrite_nonempty_dir_b"; - let dummy = "test_mv_overwrite_nonempty_dir_b/file"; - - mkdir(dir_a); - mkdir(dir_b); - touch(dummy); - let result = run(Command::new(PROGNAME).arg("-vT").arg(dir_a).arg(dir_b)); - - // Not same error as GNU; the error message is a rust builtin - // TODO: test (and implement) correct error message (or at least decide whether to do so) - // Current: "mv: error: couldn't rename path (Directory not empty; from=a; to=b)" - // GNU: "mv: cannot move ‘a’ to ‘b’: Directory not empty" - assert!(result.stderr.len() > 0); - - // Verbose output for the move should not be shown on failure - assert!(result.stdout.len() == 0); - - assert!(!result.success); - assert!(dir_exists(dir_a)); - assert!(dir_exists(dir_b)); -} - -#[test] -fn test_mv_backup_dir() { - let dir_a = "test_mv_backup_dir_dir_a"; - let dir_b = "test_mv_backup_dir_dir_b"; - - mkdir(dir_a); - mkdir(dir_b); - let result = run(Command::new(PROGNAME).arg("-vbT").arg(dir_a).arg(dir_b)); - - assert_empty_stderr!(result); - assert_eq!(result.stdout, - format!("‘{}’ -> ‘{}’ (backup: ‘{}~’)\n", dir_a, dir_b, dir_b)); - assert!(result.success); - - assert!(!dir_exists(dir_a)); - assert!(dir_exists(dir_b)); - assert!(dir_exists(&format!("{}~", dir_b))); -} - -#[test] -fn test_mv_errors() { - let dir = "test_mv_errors_dir"; - let file_a = "test_mv_errors_file_a"; - let file_b = "test_mv_errors_file_b"; - mkdir(dir); - touch(file_a); - touch(file_b); - - // $ mv -T -t a b - // mv: cannot combine --target-directory (-t) and --no-target-directory (-T) - let result = run(Command::new(PROGNAME).arg("-T").arg("-t").arg(dir).arg(file_a).arg(file_b)); - assert_eq!(result.stderr, - "mv: error: cannot combine --target-directory (-t) and --no-target-directory (-T)\n"); - assert!(!result.success); - - - // $ touch file && mkdir dir - // $ mv -T file dir - // err == mv: cannot overwrite directory ‘dir’ with non-directory - let result = run(Command::new(PROGNAME).arg("-T").arg(file_a).arg(dir)); - assert_eq!(result.stderr, - format!("mv: error: cannot overwrite directory ‘{}’ with non-directory\n", dir)); - assert!(!result.success); - - // $ mkdir dir && touch file - // $ mv dir file - // err == mv: cannot overwrite non-directory ‘file’ with directory ‘dir’ - let result = run(Command::new(PROGNAME).arg(dir).arg(file_a)); - assert!(result.stderr.len() > 0); - assert!(!result.success); -} - -#[test] -fn test_mv_verbose() { - let dir = "test_mv_verbose_dir"; - let file_a = "test_mv_verbose_file_a"; - let file_b = "test_mv_verbose_file_b"; - mkdir(dir); - touch(file_a); - touch(file_b); - - let result = run(Command::new(PROGNAME).arg("-v").arg(file_a).arg(file_b)); - assert_empty_stderr!(result); - assert_eq!(result.stdout, - format!("‘{}’ -> ‘{}’\n", file_a, file_b)); - assert!(result.success); - - - touch(file_a); - let result = run(Command::new(PROGNAME).arg("-vb").arg(file_a).arg(file_b)); - assert_empty_stderr!(result); - assert_eq!(result.stdout, - format!("‘{}’ -> ‘{}’ (backup: ‘{}~’)\n", file_a, file_b, file_b)); - assert!(result.success); -} - -// Todo: - -// $ touch a b -// $ chmod -w b -// $ ll -// total 0 -// -rw-rw-r-- 1 user user 0 okt 25 11:21 a -// -r--r--r-- 1 user user 0 okt 25 11:21 b -// $ -// $ mv -v a b -// mv: try to overwrite ‘b’, overriding mode 0444 (r--r--r--)? y -// ‘a’ -> ‘b’ diff --git a/test/nl.rs b/test/nl.rs deleted file mode 100644 index 29626908a..000000000 --- a/test/nl.rs +++ /dev/null @@ -1,53 +0,0 @@ -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./nl"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_stdin_nonewline() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd, "No Newline".as_bytes()); - assert_eq!(result.stdout, " 1\tNo Newline\n"); -} -#[test] -fn test_stdin_newline() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-s", "-", "-w", "1"]), "Line One\nLine Two\n".as_bytes()); - assert_eq!(result.stdout, "1-Line One\n2-Line Two\n"); -} - -#[test] -fn test_padding_without_overflow() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-i", "1000", "-s", "x", "-n", "rz", "simple.txt"])); - assert_eq!(result.stdout, "000001xL1\n001001xL2\n002001xL3\n003001xL4\n004001xL5\n005001xL6\n006001xL7\n007001xL8\n008001xL9\n009001xL10\n010001xL11\n011001xL12\n012001xL13\n013001xL14\n014001xL15\n"); -} - -#[test] -fn test_padding_with_overflow() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-i", "1000", "-s", "x", "-n", "rz", "-w", "4", "simple.txt"])); - assert_eq!(result.stdout, "0001xL1\n1001xL2\n2001xL3\n3001xL4\n4001xL5\n5001xL6\n6001xL7\n7001xL8\n8001xL9\n9001xL10\n10001xL11\n11001xL12\n12001xL13\n13001xL14\n14001xL15\n"); -} - -#[test] -fn test_sections_and_styles() { - for &(fixture, output) in [ - ( - "section.txt", - "\nHEADER1\nHEADER2\n\n1 |BODY1\n2 |BODY2\n\nFOOTER1\nFOOTER2\n\nNEXTHEADER1\nNEXTHEADER2\n\n1 |NEXTBODY1\n2 |NEXTBODY2\n\nNEXTFOOTER1\nNEXTFOOTER2\n" - ), - ( - "joinblanklines.txt", - "1 |Nonempty\n2 |Nonempty\n3 |Followed by 10x empty\n\n\n\n\n4 |\n\n\n\n\n5 |\n6 |Followed by 5x empty\n\n\n\n\n7 |\n8 |Followed by 4x empty\n\n\n\n\n9 |Nonempty\n10 |Nonempty\n11 |Nonempty.\n" - ), - ].iter() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-s", "|", "-n", "ln", "-w", "3", "-b", "a", "-l", "5", fixture])); - assert_eq!(result.stdout, output); - } -} diff --git a/test/paste.rs b/test/paste.rs deleted file mode 100644 index b66ed01e7..000000000 --- a/test/paste.rs +++ /dev/null @@ -1,27 +0,0 @@ -use std::fs::File; -use std::io::Read; -use std::path::Path; -use std::process::Command; - -static PROGNAME: &'static str = "./paste"; - -#[test] -fn test_combine_pairs_of_lines() { - let po = Command::new(PROGNAME) - .arg("-s") - .arg("-d") - .arg("\t\n") - .arg("html_colors.txt") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let mut f = File::open(Path::new("html_colors.expected")).unwrap_or_else(|err| { - panic!("{}", err) - }); - let mut expected = vec!(); - match f.read_to_end(&mut expected) { - Ok(_) => {}, - Err(err) => panic!("{}", err) - } - assert_eq!(String::from_utf8(po.stdout).unwrap(), String::from_utf8(expected).unwrap()); -} diff --git a/test/ptx.rs b/test/ptx.rs deleted file mode 100644 index 1c4d4e730..000000000 --- a/test/ptx.rs +++ /dev/null @@ -1,58 +0,0 @@ -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./ptx"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn gnu_ext_disabled_roff_no_ref() { - let opts = vec!["-G", "-R"]; - test_ptx(&opts, "gnu_ext_disabled_roff_no_ref.expected"); -} - -#[test] -fn gnu_ext_disabled_roff_input_ref() { - let opts = vec!["-G", "-r", "-R"]; - test_ptx(&opts, "gnu_ext_disabled_roff_input_ref.expected"); -} - -#[test] -fn gnu_ext_disabled_roff_auto_ref() { - let opts = vec!["-G", "-A", "-R"]; - test_ptx(&opts, "gnu_ext_disabled_roff_auto_ref.expected"); -} - -#[test] -fn gnu_ext_disabled_tex_no_ref() { - let opts = vec!["-G", "-T", "-R"]; - test_ptx(&opts, "gnu_ext_disabled_tex_no_ref.expected"); -} - -#[test] -fn gnu_ext_disabled_tex_input_ref() { - let opts = vec!["-G", "-T", "-r", "-R"]; - test_ptx(&opts, "gnu_ext_disabled_tex_input_ref.expected"); -} - -#[test] -fn gnu_ext_disabled_tex_auto_ref() { - let opts = vec!["-G", "-T", "-A", "-R"]; - test_ptx(&opts, "gnu_ext_disabled_tex_auto_ref.expected"); -} - -#[test] -fn gnu_ext_disabled_ignore_and_only_file() { - let opts = vec!["-G", "-o", "only", "-i", "ignore"]; - test_ptx(&opts, "gnu_ext_disabled_ignore_and_only_file.expected"); -} - -fn test_ptx(opts: &Vec<&str>, expected: &str) { - let mut ptx = Command::new(PROGNAME); - let result = run(&mut ptx.args(opts).arg("input")); - assert!(result.success); - assert_eq!(result.stdout, get_file_contents(expected)); - assert_empty_stderr!(&result); -} diff --git a/test/pwd.rs b/test/pwd.rs deleted file mode 100644 index 0800b3ae4..000000000 --- a/test/pwd.rs +++ /dev/null @@ -1,16 +0,0 @@ -use std::env; -use std::process::Command; -use std::str; - -static PROGNAME: &'static str = "./pwd"; - -#[test] -fn test_default() { - let po = Command::new(PROGNAME) - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap().trim_right(); - let expected = env::current_dir().unwrap().into_os_string().into_string().unwrap(); - assert_eq!(out, expected); -} diff --git a/test/readlink.rs b/test/readlink.rs deleted file mode 100644 index 6471d1d92..000000000 --- a/test/readlink.rs +++ /dev/null @@ -1,80 +0,0 @@ -use std::process::Command; -use std::str; -use util::*; - -static PROGNAME: &'static str = "./readlink"; -static GIBBERISH: &'static str = "supercalifragilisticexpialidocious"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_canonicalize() { - let po = Command::new(PROGNAME) - .arg("-f") - .arg(".") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap().trim_right(); - assert_eq!(out, current_directory()); -} - -#[test] -fn test_canonicalize_existing() { - let po = Command::new(PROGNAME) - .arg("-e") - .arg(".") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap().trim_right(); - assert_eq!(out, current_directory()); -} - -#[test] -fn test_canonicalize_missing() { - let mut expected = current_directory(); - expected.push_str("/"); - expected.push_str(GIBBERISH); - - let po = Command::new(PROGNAME) - .arg("-m") - .arg(GIBBERISH) - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap().trim_right(); - assert_eq!(out, expected); -} - -#[test] -fn test_long_redirection_to_current_dir() { - // Create a 256-character path to current directory - let dir = repeat_str("./", 128); - let po = Command::new(PROGNAME) - .arg("-n") - .arg("-m") - .arg(dir) - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap(); - assert_eq!(out, current_directory()); -} - -#[test] -fn test_long_redirection_to_root() { - // Create a 255-character path to root - let dir = repeat_str("../", 85); - let po = Command::new(PROGNAME) - .arg("-n") - .arg("-m") - .arg(dir) - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap(); - assert_eq!(out, "/"); -} diff --git a/test/realpath.rs b/test/realpath.rs deleted file mode 100644 index 53cd539da..000000000 --- a/test/realpath.rs +++ /dev/null @@ -1,46 +0,0 @@ -use std::process::Command; -use std::str; -use util::*; - -static PROGNAME: &'static str = "./realpath"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_current_directory() { - let po = Command::new(PROGNAME) - .arg(".") - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap().trim_right(); - assert_eq!(out, current_directory()); -} - -#[test] -fn test_long_redirection_to_current_dir() { - // Create a 256-character path to current directory - let dir = repeat_str("./", 128); - let po = Command::new(PROGNAME) - .arg(dir) - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap().trim_right(); - assert_eq!(out, current_directory()); -} - -#[test] -fn test_long_redirection_to_root() { - // Create a 255-character path to root - let dir = repeat_str("../", 85); - let po = Command::new(PROGNAME) - .arg(dir) - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - let out = str::from_utf8(&po.stdout[..]).unwrap().trim_right(); - assert_eq!(out, "/"); -} diff --git a/test/rm.rs b/test/rm.rs deleted file mode 100644 index 5eede78b9..000000000 --- a/test/rm.rs +++ /dev/null @@ -1,140 +0,0 @@ -extern crate libc; - -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./rm"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_rm_one_file() { - let file = "test_rm_one_file"; - - touch(file); - - let result = run(Command::new(PROGNAME).arg(file)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!file_exists(file)); -} - -#[test] -fn test_rm_multiple_files() { - let file_a = "test_rm_multiple_file_a"; - let file_b = "test_rm_multiple_file_b"; - - touch(file_a); - touch(file_b); - - let result = run(Command::new(PROGNAME).arg(file_a).arg(file_b)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!file_exists(file_a)); - assert!(!file_exists(file_b)); -} - -#[test] -fn test_rm_interactive() { - let file_a = "test_rm_interactive_file_a"; - let file_b = "test_rm_interactive_file_b"; - - touch(file_a); - touch(file_b); - - let result1 = run_piped_stdin(Command::new(PROGNAME).arg("-i").arg(file_a).arg(file_b), b"n"); - - assert!(result1.success); - - assert!(file_exists(file_a)); - assert!(file_exists(file_b)); - - let result2 = run_piped_stdin(Command::new(PROGNAME).arg("-i").arg(file_a).arg(file_b), b"Yesh"); - - assert!(result2.success); - - assert!(!file_exists(file_a)); - assert!(file_exists(file_b)); -} - -#[test] -fn test_rm_force() { - let file_a = "test_rm_force_a"; - let file_b = "test_rm_force_b"; - - let result = run(Command::new(PROGNAME).arg("-f").arg(file_a).arg(file_b)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!file_exists(file_a)); - assert!(!file_exists(file_b)); -} - -#[test] -fn test_rm_empty_directory() { - let dir = "test_rm_empty_directory"; - - mkdir(dir); - - let result = run(Command::new(PROGNAME).arg("-d").arg(dir)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!dir_exists(dir)); -} - -#[test] -fn test_rm_recursive() { - let dir = "test_rm_recursive_directory"; - let file_a = "test_rm_recursive_directory/test_rm_recursive_file_a"; - let file_b = "test_rm_recursive_directory/test_rm_recursive_file_b"; - - mkdir(dir); - touch(file_a); - touch(file_b); - - let result = run(Command::new(PROGNAME).arg("-r").arg(dir)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!dir_exists(dir)); - assert!(!file_exists(file_a)); - assert!(!file_exists(file_b)); -} - -#[test] -fn test_rm_errors() { - let dir = "test_rm_errors_directory"; - let file_a = "test_rm_errors_directory/test_rm_errors_file_a"; - let file_b = "test_rm_errors_directory/test_rm_errors_file_b"; - - mkdir(dir); - touch(file_a); - touch(file_b); - - // $ rm test_rm_errors_directory - // rm: error: could not remove directory 'test_rm_errors_directory' (did you mean to pass '-r'?) - let result = run(Command::new(PROGNAME).arg(dir)); - assert_eq!(result.stderr, - "rm: error: could not remove directory 'test_rm_errors_directory' (did you mean to pass '-r'?)\n"); - assert!(!result.success); -} - -#[test] -fn test_rm_verbose() { - let file_a = "test_rm_verbose_file_a"; - let file_b = "test_rm_verbose_file_b"; - - touch(file_a); - touch(file_b); - - let result = run(Command::new(PROGNAME).arg("-v").arg(file_a).arg(file_b)); - assert_empty_stderr!(result); - assert_eq!(result.stdout, - format!("removed '{}'\nremoved '{}'\n", file_a, file_b)); - assert!(result.success); -} diff --git a/test/rmdir.rs b/test/rmdir.rs deleted file mode 100644 index d85265d74..000000000 --- a/test/rmdir.rs +++ /dev/null @@ -1,114 +0,0 @@ -extern crate libc; - -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./rmdir"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_rmdir_empty_directory_no_parents() { - let dir = "test_rmdir_empty_no_parents"; - - mkdir(dir); - assert!(dir_exists(dir)); - - let result = run(Command::new(PROGNAME).arg(dir)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!dir_exists(dir)); -} - -#[test] -fn test_rmdir_empty_directory_with_parents() { - let dir = "test_rmdir_empty/with/parents"; - - mkdir_all(dir); - assert!(dir_exists(dir)); - - let result = run(Command::new(PROGNAME).arg("-p").arg(dir)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!dir_exists(dir)); -} - -#[test] -fn test_rmdir_nonempty_directory_no_parents() { - let dir = "test_rmdir_nonempty_no_parents"; - let file = "test_rmdir_nonempty_no_parents/foo"; - - mkdir(dir); - assert!(dir_exists(dir)); - - touch(file); - assert!(file_exists(file)); - - let result = run(Command::new(PROGNAME).arg(dir)); - assert_eq!(result.stderr, - "rmdir: error: failed to remove 'test_rmdir_nonempty_no_parents': Directory not empty\n"); - assert!(!result.success); - - assert!(dir_exists(dir)); -} - -#[test] -fn test_rmdir_nonempty_directory_with_parents() { - let dir = "test_rmdir_nonempty/with/parents"; - let file = "test_rmdir_nonempty/with/parents/foo"; - - mkdir_all(dir); - assert!(dir_exists(dir)); - - touch(file); - assert!(file_exists(file)); - - let result = run(Command::new(PROGNAME).arg("-p").arg(dir)); - assert_eq!(result.stderr, - "rmdir: error: failed to remove 'test_rmdir_nonempty/with/parents': Directory not empty\n\ - rmdir: error: failed to remove 'test_rmdir_nonempty/with': Directory not empty\n\ - rmdir: error: failed to remove 'test_rmdir_nonempty': Directory not empty\n"); - assert!(!result.success); - - assert!(dir_exists(dir)); -} - -#[test] -fn test_rmdir_ignore_nonempty_directory_no_parents() { - let dir = "test_rmdir_ignore_nonempty_no_parents"; - let file = "test_rmdir_ignore_nonempty_no_parents/foo"; - - mkdir(dir); - assert!(dir_exists(dir)); - - touch(file); - assert!(file_exists(file)); - - let result = run(Command::new(PROGNAME).arg("--ignore-fail-on-non-empty").arg(dir)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(dir_exists(dir)); -} - -#[test] -fn test_rmdir_ignore_nonempty_directory_with_parents() { - let dir = "test_rmdir_ignore_nonempty/with/parents"; - let file = "test_rmdir_ignore_nonempty/with/parents/foo"; - - mkdir_all(dir); - assert!(dir_exists(dir)); - - touch(file); - assert!(file_exists(file)); - - let result = run(Command::new(PROGNAME).arg("--ignore-fail-on-non-empty").arg("-p").arg(dir)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(dir_exists(dir)); -} diff --git a/test/seq.rs b/test/seq.rs deleted file mode 100644 index 806435f33..000000000 --- a/test/seq.rs +++ /dev/null @@ -1,32 +0,0 @@ -use std::process::Command; -use std::str; - -static PROGNAME: &'static str = "./seq"; - -#[test] -fn test_count_up() { - let p = Command::new(PROGNAME).args(&["10"]).output().unwrap(); - let out = str::from_utf8(&p.stdout).unwrap(); - assert_eq!(out, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n"); -} - -#[test] -fn test_count_down() { - let p = Command::new(PROGNAME).args(&["--", "5", "-1", "1"]).output().unwrap(); - let out = str::from_utf8(&p.stdout).unwrap(); - assert_eq!(out, "5\n4\n3\n2\n1\n"); -} - -#[test] -fn test_separator_and_terminator() { - let p = Command::new(PROGNAME).args(&["-s", ",", "-t", "!", "2", "6"]).output().unwrap(); - let out = str::from_utf8(&p.stdout).unwrap(); - assert_eq!(out, "2,3,4,5,6!"); -} - -#[test] -fn test_equalize_widths() { - let p = Command::new(PROGNAME).args(&["-w", "5", "10"]).output().unwrap(); - let out = str::from_utf8(&p.stdout).unwrap(); - assert_eq!(out, "05\n06\n07\n08\n09\n10\n"); -} diff --git a/test/sort.rs b/test/sort.rs deleted file mode 100644 index aa630210c..000000000 --- a/test/sort.rs +++ /dev/null @@ -1,65 +0,0 @@ -use std::fs::File; -use std::io::Read; -use std::path::Path; -use std::process::Command; - -static PROGNAME: &'static str = "./sort"; - -#[test] -fn numeric1() { - numeric_helper(1); -} - -#[test] -fn numeric2() { - numeric_helper(2); -} - -#[test] -fn numeric3() { - numeric_helper(3); -} - -#[test] -fn numeric4() { - numeric_helper(4); -} - -#[test] -fn numeric5() { - numeric_helper(5); -} - -#[test] -fn numeric6() { - numeric_helper(6); -} - -#[test] -fn human1() { - test_helper(&String::from("human1"), &String::from("-H")); -} - -fn numeric_helper(test_num: isize) { - test_helper(&format!("numeric{}", test_num), &String::from("-n")) -} - -fn test_helper(file_name: &String, args: &String) { - let mut cmd = Command::new(PROGNAME); - cmd.arg(args); - let po = match cmd.arg(format!("{}{}", file_name, ".txt")).output() { - Ok(p) => p, - Err(err) => panic!("{}", err) - }; - - let filename = format!("{}{}", file_name, ".ans"); - let mut f = File::open(Path::new(&filename)).unwrap_or_else(|err| { - panic!("{}", err) - }); - let mut answer = vec!(); - match f.read_to_end(&mut answer) { - Ok(_) => {}, - Err(err) => panic!("{}", err) - } - assert_eq!(String::from_utf8(po.stdout).unwrap(), String::from_utf8(answer).unwrap()); -} diff --git a/test/split.rs b/test/split.rs deleted file mode 100644 index 682860100..000000000 --- a/test/split.rs +++ /dev/null @@ -1,160 +0,0 @@ -extern crate libc; -extern crate memchr; -extern crate aho_corasick; -extern crate rand; -extern crate regex_syntax; -extern crate regex; - -use std::fs::{File, read_dir, remove_file}; -use std::io::{Read, Write}; -use std::path::Path; -use std::process::Command; -use rand::{Rng, thread_rng}; -use regex::Regex; -use util::*; - -static PROGNAME: &'static str = "./split"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -fn random_chars(n: usize) -> String { - thread_rng().gen_ascii_chars().take(n).collect::() -} - -struct Glob { - directory: String, - regex: Regex -} - -impl Glob { - fn new(directory: &str, regex: &str) -> Glob { - Glob { - directory: directory.to_string(), - regex: Regex::new(regex).unwrap() - } - } - - fn count(&self) -> usize { - self.collect().len() - } - - fn collect(&self) -> Vec { - read_dir(Path::new(&self.directory)).unwrap().filter_map(|entry| { - let path = entry.unwrap().path(); - let name = path.as_path().to_str().unwrap_or(""); - if self.regex.is_match(name) { Some(name.to_string()) } else { None } - }).collect() - } - - fn collate(&self) -> Vec { - let mut files = self.collect(); - files.sort(); - let mut data: Vec = vec!(); - for name in files.iter() { - data.extend(get_file_contents(name).into_bytes()); - } - data - } - - fn remove_all(&self) { - for name in self.collect().iter() { - let _ = remove_file(name); - } - } -} - -struct RandomFile { - inner: File -} - -impl RandomFile { - fn new(name: &str) -> RandomFile { - RandomFile { inner: File::create(Path::new(name)).unwrap() } - } - - fn add_bytes(&mut self, bytes: usize) { - let chunk_size: usize = if bytes >= 1024 { 1024 } else { bytes }; - let mut n = bytes; - while n > chunk_size { - let _ = write!(self.inner, "{}", random_chars(chunk_size)); - n -= chunk_size; - } - let _ = write!(self.inner, "{}", random_chars(n)); - } - - fn add_lines(&mut self, lines: usize) { - let line_size: usize = 32; - let mut n = lines; - while n > 0 { - let _ = writeln!(self.inner, "{}", random_chars(line_size)); - n -= 1; - } - } -} - -#[test] -fn test_split_default() { - let name = "split_default"; - let glob = Glob::new(".", r"x[:alpha:][:alpha:]$"); - RandomFile::new(name).add_lines(2000); - if !Command::new(PROGNAME).args(&[name]).status().unwrap().success() { - panic!(); - } - assert_eq!(glob.count(), 2); - assert_eq!(glob.collate(), get_file_contents(name).into_bytes()); - glob.remove_all(); -} - -#[test] -fn test_split_num_prefixed_chunks_by_bytes() { - let name = "split_num_prefixed_chunks_by_bytes"; - let glob = Glob::new(".", r"a\d\d$"); - RandomFile::new(name).add_bytes(10000); - if !Command::new(PROGNAME).args(&["-d", "-b", "1000", name, "a"]).status().unwrap().success() { - panic!(); - } - assert_eq!(glob.count(), 10); - assert_eq!(glob.collate(), get_file_contents(name).into_bytes()); - glob.remove_all(); -} - -#[test] -fn test_split_str_prefixed_chunks_by_bytes() { - let name = "split_str_prefixed_chunks_by_bytes"; - let glob = Glob::new(".", r"b[:alpha:][:alpha:]$"); - RandomFile::new(name).add_bytes(10000); - if !Command::new(PROGNAME).args(&["-b", "1000", name, "b"]).status().unwrap().success() { - panic!(); - } - assert_eq!(glob.count(), 10); - assert_eq!(glob.collate(), get_file_contents(name).into_bytes()); - glob.remove_all(); -} - -#[test] -fn test_split_num_prefixed_chunks_by_lines() { - let name = "split_num_prefixed_chunks_by_lines"; - let glob = Glob::new(".", r"c\d\d$"); - RandomFile::new(name).add_lines(10000); - if !Command::new(PROGNAME).args(&["-d", "-l", "1000", name, "c"]).status().unwrap().success() { - panic!(); - } - assert_eq!(glob.count(), 10); - assert_eq!(glob.collate(), get_file_contents(name).into_bytes()); - glob.remove_all(); -} - -#[test] -fn test_split_str_prefixed_chunks_by_lines() { - let name = "split_str_prefixed_chunks_by_lines"; - let glob = Glob::new(".", r"d[:alpha:][:alpha:]$"); - RandomFile::new(name).add_lines(10000); - if !Command::new(PROGNAME).args(&["-l", "1000", name, "d"]).status().unwrap().success() { - panic!(); - } - assert_eq!(glob.count(), 10); - assert_eq!(glob.collate(), get_file_contents(name).into_bytes()); - glob.remove_all(); -} diff --git a/test/stdbuf.rs b/test/stdbuf.rs deleted file mode 100644 index ff7d5259f..000000000 --- a/test/stdbuf.rs +++ /dev/null @@ -1,16 +0,0 @@ -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./stdbuf"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_stdbuf_unbuffered_stdout() { - // This is a basic smoke test - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-o0", "head"]), "The quick brown fox jumps over the lazy dog."); - assert_eq!(result.stdout, "The quick brown fox jumps over the lazy dog."); -} diff --git a/test/sum.rs b/test/sum.rs deleted file mode 100644 index fb4abbf2d..000000000 --- a/test/sum.rs +++ /dev/null @@ -1,70 +0,0 @@ -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./sum"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_bsd_single_file() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.arg("lorem_ipsum.txt")); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, get_file_contents("bsd_single_file.expected")); -} - -#[test] -fn test_bsd_multiple_files() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.arg("lorem_ipsum.txt").arg("alice_in_wonderland.txt")); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, get_file_contents("bsd_multiple_files.expected")); -} - -#[test] -fn test_bsd_stdin() { - let input = get_file_contents("lorem_ipsum.txt"); - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd, input); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, get_file_contents("bsd_stdin.expected")); -} - -#[test] -fn test_sysv_single_file() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.arg("-s").arg("lorem_ipsum.txt")); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, get_file_contents("sysv_single_file.expected")); -} - -#[test] -fn test_sysv_multiple_files() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.arg("-s").arg("lorem_ipsum.txt").arg("alice_in_wonderland.txt")); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, get_file_contents("sysv_multiple_files.expected")); -} - -#[test] -fn test_sysv_stdin() { - let input = get_file_contents("lorem_ipsum.txt"); - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.arg("-s"), input); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, get_file_contents("sysv_stdin.expected")); -} diff --git a/test/tac.rs b/test/tac.rs deleted file mode 100644 index 5ec5a26b4..000000000 --- a/test/tac.rs +++ /dev/null @@ -1,50 +0,0 @@ -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./tac"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_stdin_default() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd, "100\n200\n300\n400\n500"); - assert_eq!(result.stdout, "500400\n300\n200\n100\n"); -} - -#[test] -fn test_stdin_non_newline_separator() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-s", ":"]), "100:200:300:400:500"); - assert_eq!(result.stdout, "500400:300:200:100:"); -} - -#[test] -fn test_stdin_non_newline_separator_before() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-b", "-s", ":"]), "100:200:300:400:500"); - assert_eq!(result.stdout, "500:400:300:200:100"); -} - -#[test] -fn test_single_default() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.arg("prime_per_line.txt")); - assert_eq!(result.stdout, get_file_contents("prime_per_line.expected")); -} - -#[test] -fn test_single_non_newline_separator() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-s", ":", "delimited_primes.txt"])); - assert_eq!(result.stdout, get_file_contents("delimited_primes.expected")); -} - -#[test] -fn test_single_non_newline_separator_before() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-b", "-s", ":", "delimited_primes.txt"])); - assert_eq!(result.stdout, get_file_contents("delimited_primes_before.expected")); -} diff --git a/test/test.rs b/test/test.rs deleted file mode 100644 index af6758ae6..000000000 --- a/test/test.rs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) mahkoh (ju.orth [at] gmail [dot] com) - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use std::process::Command; - -static PROGNAME: &'static str = "./test"; - -#[test] -fn test_op_prec_and_or_1() { - let status = Command::new(PROGNAME).arg(" ").arg("-o").arg("").arg("-a").arg("").status(); - assert_eq!(true, status.unwrap().success()); -} - -#[test] -fn test_op_prec_and_or_2() { - let status = Command::new(PROGNAME).arg("") - .arg("-a") - .arg("") - .arg("-o") - .arg(" ") - .arg("-a") - .arg(" ") - .status(); - assert_eq!(true, status.unwrap().success()); -} - -#[test] -fn test_or_as_filename() { - let status = Command::new(PROGNAME).arg("x").arg("-a").arg("-z").arg("-o").status(); - assert_eq!(status.unwrap().code(), Some(1)); -} diff --git a/test/touch.rs b/test/touch.rs deleted file mode 100644 index 642844f18..000000000 --- a/test/touch.rs +++ /dev/null @@ -1,258 +0,0 @@ -extern crate libc; -extern crate time; -extern crate kernel32; -extern crate winapi; -extern crate filetime; - -use filetime::FileTime; -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./touch"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -fn get_file_times(path: &str) -> (FileTime, FileTime) { - let m = metadata(path); - (FileTime::from_last_access_time(&m), FileTime::from_last_modification_time(&m)) -} - -fn set_file_times(path: &str, atime: FileTime, mtime: FileTime) { - filetime::set_file_times(path, atime, mtime).unwrap() -} - -// Adjusts for local timezone -fn str_to_filetime(format: &str, s: &str) -> FileTime { - let mut tm = time::strptime(s, format).unwrap(); - tm.tm_utcoff = time::now().tm_utcoff; - let ts = tm.to_timespec(); - FileTime::from_seconds_since_1970(ts.sec as u64, ts.nsec as u32) -} - -#[test] -fn test_touch_default() { - let file = "test_touch_default_file"; - - let result = run(Command::new(PROGNAME).arg(file)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(file)); -} - -#[test] -fn test_touch_no_create_file_absent() { - let file = "test_touch_no_create_file_absent"; - - let result = run(Command::new(PROGNAME).arg("-c").arg(file)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!file_exists(file)); -} - -#[test] -fn test_touch_no_create_file_exists() { - let file = "test_touch_no_create_file_exists"; - - touch(file); - assert!(file_exists(file)); - - let result = run(Command::new(PROGNAME).arg("-c").arg(file)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(file)); -} - -#[test] -fn test_touch_set_mdhm_time() { - let file = "test_touch_set_mdhm_time"; - - let result = run(Command::new(PROGNAME).args(&["-t", "01011234", file])); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(file)); - - let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); - let (atime, mtime) = get_file_times(file); - assert_eq!(atime, mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45240); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45240); -} - -#[test] -fn test_touch_set_mdhms_time() { - let file = "test_touch_set_mdhms_time"; - - let result = run(Command::new(PROGNAME).args(&["-t", "01011234.56", file])); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(file)); - - let start_of_year = str_to_filetime("%Y%m%d%H%M.%S", "201501010000.00"); - let (atime, mtime) = get_file_times(file); - assert_eq!(atime, mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45296); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45296); -} - -#[test] -fn test_touch_set_ymdhm_time() { - let file = "test_touch_set_ymdhm_time"; - - let result = run(Command::new(PROGNAME).args(&["-t", "1501011234", file])); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(file)); - - let start_of_year = str_to_filetime("%y%m%d%H%M", "1501010000"); - let (atime, mtime) = get_file_times(file); - assert_eq!(atime, mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45240); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45240); -} - -#[test] -fn test_touch_set_ymdhms_time() { - let file = "test_touch_set_ymdhms_time"; - - let result = run(Command::new(PROGNAME).args(&["-t", "1501011234.56", file])); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(file)); - - let start_of_year = str_to_filetime("%y%m%d%H%M.%S", "1501010000.00"); - let (atime, mtime) = get_file_times(file); - assert_eq!(atime, mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45296); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45296); -} - -#[test] -fn test_touch_set_cymdhm_time() { - let file = "test_touch_set_cymdhm_time"; - - let result = run(Command::new(PROGNAME).args(&["-t", "201501011234", file])); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(file)); - - let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); - let (atime, mtime) = get_file_times(file); - assert_eq!(atime, mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45240); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45240); -} - -#[test] -fn test_touch_set_cymdhms_time() { - let file = "test_touch_set_cymdhms_time"; - - let result = run(Command::new(PROGNAME).args(&["-t", "201501011234.56", file])); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(file)); - - let start_of_year = str_to_filetime("%Y%m%d%H%M.%S", "201501010000.00"); - let (atime, mtime) = get_file_times(file); - assert_eq!(atime, mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45296); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45296); -} - -#[test] -fn test_touch_set_only_atime() { - let file = "test_touch_set_only_atime"; - - let result = run(Command::new(PROGNAME).args(&["-t", "201501011234", "-a", file])); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(file)); - - let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); - let (atime, mtime) = get_file_times(file); - assert!(atime != mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45240); -} - -#[test] -fn test_touch_set_only_mtime() { - let file = "test_touch_set_only_mtime"; - - let result = run(Command::new(PROGNAME).args(&["-t", "201501011234", "-m", file])); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(file)); - - let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); - let (atime, mtime) = get_file_times(file); - assert!(atime != mtime); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45240); -} - -#[test] -fn test_touch_set_both() { - let file = "test_touch_set_both"; - - let result = run(Command::new(PROGNAME).args(&["-t", "201501011234", "-a", "-m", file])); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(file)); - - let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); - let (atime, mtime) = get_file_times(file); - assert_eq!(atime, mtime); - assert_eq!(atime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45240); - assert_eq!(mtime.seconds_relative_to_1970() - start_of_year.seconds_relative_to_1970(), 45240); -} - -#[test] -fn test_touch_reference() { - let file_a = "test_touch_reference_a"; - let file_b = "test_touch_reference_b"; - let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); - - touch(file_a); - set_file_times(file_a, start_of_year, start_of_year); - assert!(file_exists(file_a)); - - let result = run(Command::new(PROGNAME).args(&["-r", file_a, file_b])); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(file_b)); - - let (atime, mtime) = get_file_times(file_b); - assert_eq!(atime, mtime); - assert_eq!(atime, start_of_year); - assert_eq!(mtime, start_of_year); -} - -#[test] -fn test_touch_set_date() { - let file = "test_touch_set_date"; - - let result = run(Command::new(PROGNAME).args(&["-d", "Thu Jan 01 12:34:00 2015", file])); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(file_exists(file)); - - let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501011234"); - let (atime, mtime) = get_file_times(file); - assert_eq!(atime, mtime); - assert_eq!(atime, start_of_year); - assert_eq!(mtime, start_of_year); -} diff --git a/test/tr.rs b/test/tr.rs deleted file mode 100644 index 3da1b9605..000000000 --- a/test/tr.rs +++ /dev/null @@ -1,43 +0,0 @@ -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./tr"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_toupper() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["a-z", "A-Z"]), b"!abcd!"); - assert_eq!(result.stdout, "!ABCD!"); -} - -#[test] -fn test_small_set2() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["0-9", "X"]), b"@0123456789"); - assert_eq!(result.stdout, "@XXXXXXXXXX"); -} - -#[test] -fn test_unicode() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&[", ┬─┬", "╯︵┻━┻"]), "(,°□°), ┬─┬".as_bytes()); - assert_eq!(result.stdout, "(╯°□°)╯︵┻━┻"); -} - -#[test] -fn test_delete() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-d", "a-z"]), b"aBcD"); - assert_eq!(result.stdout, "BD"); -} - -#[test] -fn test_delete_complement() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-d", "-c", "a-z"]), b"aBcD"); - assert_eq!(result.stdout, "ac"); -} diff --git a/test/true.rs b/test/true.rs deleted file mode 100644 index fba9fff36..000000000 --- a/test/true.rs +++ /dev/null @@ -1,9 +0,0 @@ -use std::process::Command; - -static PROGNAME: &'static str = "./true"; - -#[test] -fn test_exit_code() { - let exit_status = Command::new(PROGNAME).status().unwrap().success(); - assert_eq!(exit_status, true); -} diff --git a/test/truncate.rs b/test/truncate.rs deleted file mode 100644 index 3461fcbf9..000000000 --- a/test/truncate.rs +++ /dev/null @@ -1,41 +0,0 @@ -use std::fs; -use std::io::{Seek, SeekFrom, Write}; -use std::path::Path; -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./truncate"; -static TFILE1: &'static str = "truncate_test_1"; -static TFILE2: &'static str = "truncate_test_2"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_increase_file_size() { - let mut file = make_file(TFILE1); - if !Command::new(PROGNAME).args(&["-s", "+5K", TFILE1]).status().unwrap().success() { - panic!(); - } - file.seek(SeekFrom::End(0)).unwrap(); - if file.seek(SeekFrom::Current(0)).unwrap() != 5 * 1024 { - panic!(); - } - fs::remove_file(Path::new(TFILE1)).unwrap(); -} - -#[test] -fn test_decrease_file_size() { - let mut file = make_file(TFILE2); - file.write_all(b"1234567890").unwrap(); - if !Command::new(PROGNAME).args(&["--size=-4", TFILE2]).status().unwrap().success() { - panic!(); - } - file.seek(SeekFrom::End(0)).unwrap(); - if file.seek(SeekFrom::Current(0)).unwrap() != 6 { - println!("{:?}", file.seek(SeekFrom::Current(0))); - panic!(); - } - fs::remove_file(Path::new(TFILE2)).unwrap(); -} diff --git a/test/tsort.rs b/test/tsort.rs deleted file mode 100644 index 18648f3ad..000000000 --- a/test/tsort.rs +++ /dev/null @@ -1,21 +0,0 @@ -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./tsort"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_sort_call_graph() { - let input = "call_graph.txt"; - let output = "call_graph.expected"; - - let po = Command::new(PROGNAME) - .arg(input) - .output() - .unwrap_or_else(|err| panic!("{}", err)); - - assert_eq!(String::from_utf8(po.stdout).unwrap(), String::from_utf8(get_file_contents(output).into_bytes()).unwrap()); -} diff --git a/test/unexpand.rs b/test/unexpand.rs deleted file mode 100644 index c68057730..000000000 --- a/test/unexpand.rs +++ /dev/null @@ -1,115 +0,0 @@ -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./unexpand"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn unexpand_init_0() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-t4"]), " 1\n 2\n 3\n 4\n"); - assert_eq!(result.stdout, " 1\n 2\n 3\n\t4\n"); -} - -#[test] -fn unexpand_init_1() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-t4"]), " 5\n 6\n 7\n 8\n"); - assert_eq!(result.stdout, "\t 5\n\t 6\n\t 7\n\t\t8\n"); -} - -#[test] -fn unexpand_init_list_0() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-t2,4"]), " 1\n 2\n 3\n 4\n"); - assert_eq!(result.stdout, " 1\n\t2\n\t 3\n\t\t4\n"); -} - -#[test] -fn unexpand_init_list_1() { - // Once the list is exhausted, spaces are not converted anymore - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-t2,4"]), " 5\n 6\n 7\n 8\n"); - assert_eq!(result.stdout, "\t\t 5\n\t\t 6\n\t\t 7\n\t\t 8\n"); -} - -#[test] -fn unexpand_aflag_0() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["--"]), "e E\nf F\ng G\nh H\n"); - assert_eq!(result.stdout, "e E\nf F\ng G\nh H\n"); -} - -#[test] -fn unexpand_aflag_1() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-a"]), "e E\nf F\ng G\nh H\n"); - assert_eq!(result.stdout, "e E\nf F\ng\tG\nh\t H\n"); -} - -#[test] -fn unexpand_aflag_2() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-t8"]), "e E\nf F\ng G\nh H\n"); - assert_eq!(result.stdout, "e E\nf F\ng\tG\nh\t H\n"); -} - -#[test] -fn unexpand_first_only_0() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-t3"]), " A B"); - assert_eq!(result.stdout, "\t\t A\t B"); -} - -#[test] -fn unexpand_first_only_1() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-t3", "--first-only"]), " A B"); - assert_eq!(result.stdout, "\t\t A B"); -} - -#[test] -fn unexpand_trailing_space_0() { // evil - // Individual spaces before fields starting with non blanks should not be - // converted, unless they are at the beginning of the line. - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-t4"]), "123 \t1\n123 1\n123 \n123 "); - assert_eq!(result.stdout, "123\t\t1\n123 1\n123 \n123 "); -} - -#[test] -fn unexpand_trailing_space_1() { // super evil - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-t1"]), " abc d e f g "); - assert_eq!(result.stdout, "\tabc d e\t\tf\t\tg "); -} - -#[test] -fn unexpand_spaces_follow_tabs_0() { - // The two first spaces can be included into the first tab. - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd, " \t\t A"); - assert_eq!(result.stdout, "\t\t A"); -} - -#[test] -fn unexpand_spaces_follow_tabs_1() { // evil - // Explanation of what is going on here: - // 'a' -> 'a' // first tabstop (1) - // ' \t' -> '\t' // second tabstop (4) - // ' ' -> '\t' // third tabstop (5) - // ' B \t' -> ' B \t' // after the list is exhausted, nothing must change - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-t1,4,5"]), "a \t B \t"); - assert_eq!(result.stdout, "a\t\t B \t"); -} - -#[test] -fn unexpand_spaces_after_fields() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-a"]), " \t A B C D A\t\n"); - assert_eq!(result.stdout, "\t\tA B C D\t\t A\t\n"); -} diff --git a/test/unlink.rs b/test/unlink.rs deleted file mode 100644 index 1d18d9baf..000000000 --- a/test/unlink.rs +++ /dev/null @@ -1,59 +0,0 @@ -extern crate libc; - -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./unlink"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_unlink_file() { - let file = "test_unlink_file"; - - touch(file); - - let result = run(Command::new(PROGNAME).arg(file)); - assert_empty_stderr!(result); - assert!(result.success); - - assert!(!file_exists(file)); -} - -#[test] -fn test_unlink_multiple_files() { - let file_a = "test_unlink_multiple_file_a"; - let file_b = "test_unlink_multiple_file_b"; - - touch(file_a); - touch(file_b); - - let result = run(Command::new(PROGNAME).arg(file_a).arg(file_b)); - assert_eq!(result.stderr, - "unlink: error: extra operand: 'test_unlink_multiple_file_b'\nTry 'unlink --help' for more information.\n"); - assert!(!result.success); -} - -#[test] -fn test_unlink_directory() { - let dir = "test_unlink_empty_directory"; - - mkdir(dir); - - let result = run(Command::new(PROGNAME).arg(dir)); - assert_eq!(result.stderr, - "unlink: error: cannot unlink 'test_unlink_empty_directory': Not a regular file or symlink\n"); - assert!(!result.success); -} - -#[test] -fn test_unlink_nonexistent() { - let file = "test_unlink_nonexistent"; - - let result = run(Command::new(PROGNAME).arg(file)); - assert_eq!(result.stderr, - "unlink: error: Cannot stat 'test_unlink_nonexistent': No such file or directory (os error 2)\n"); - assert!(!result.success); -} diff --git a/test/wc.rs b/test/wc.rs deleted file mode 100644 index 5cb8f3b59..000000000 --- a/test/wc.rs +++ /dev/null @@ -1,57 +0,0 @@ -use std::process::Command; -use util::*; - -static PROGNAME: &'static str = "./wc"; - -#[path = "common/util.rs"] -#[macro_use] -mod util; - -#[test] -fn test_stdin_default() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd, get_file_contents("lorem_ipsum.txt")); - assert_eq!(result.stdout, " 13 109 772\n"); -} - -#[test] -fn test_stdin_only_bytes() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-c"]), get_file_contents("lorem_ipsum.txt")); - assert_eq!(result.stdout, " 772\n"); -} - -#[test] -fn test_stdin_all_counts() { - let mut cmd = Command::new(PROGNAME); - let result = run_piped_stdin(&mut cmd.args(&["-c", "-m", "-l", "-L", "-w"]), get_file_contents("alice_in_wonderland.txt")); - assert_eq!(result.stdout, " 5 57 302 302 66\n"); -} - -#[test] -fn test_single_default() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.arg("moby_dick.txt")); - assert_eq!(result.stdout, " 18 204 1115 moby_dick.txt\n"); -} - -#[test] -fn test_single_only_lines() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-l", "moby_dick.txt"])); - assert_eq!(result.stdout, " 18 moby_dick.txt\n"); -} - -#[test] -fn test_single_all_counts() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["-c", "-l", "-L", "-m", "-w", "alice_in_wonderland.txt"])); - assert_eq!(result.stdout, " 5 57 302 302 66 alice_in_wonderland.txt\n"); -} - -#[test] -fn test_multiple_default() { - let mut cmd = Command::new(PROGNAME); - let result = run(&mut cmd.args(&["lorem_ipsum.txt", "moby_dick.txt", "alice_in_wonderland.txt"])); - assert_eq!(result.stdout, " 13 109 772 lorem_ipsum.txt\n 18 204 1115 moby_dick.txt\n 5 57 302 alice_in_wonderland.txt\n 36 370 2189 total\n"); -} From 805801ec39cfb3b01e4e4c36aea745af048cea32 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 26 Sep 2020 17:56:07 +0200 Subject: [PATCH 002/606] nproc: remove the extern crate declaration --- src/uu/nproc/Cargo.toml | 1 - src/uu/nproc/src/nproc.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index 1689f3db6..681fe3032 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -15,7 +15,6 @@ edition = "2018" path = "src/nproc.rs" [dependencies] -getopts = "0.2.18" libc = "0.2.42" num_cpus = "1.10" clap = "2.33" diff --git a/src/uu/nproc/src/nproc.rs b/src/uu/nproc/src/nproc.rs index d18952276..049a7ab4e 100644 --- a/src/uu/nproc/src/nproc.rs +++ b/src/uu/nproc/src/nproc.rs @@ -8,7 +8,6 @@ // spell-checker:ignore (ToDO) NPROCESSORS nprocs numstr threadstr sysconf extern crate clap; -extern crate getopts; extern crate num_cpus; #[cfg(unix)] From c660684a8c5430f0f98f6526709edd5ddd230d85 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 26 Sep 2020 18:05:32 +0200 Subject: [PATCH 003/606] nproc: use the variable name --- src/uu/nproc/src/nproc.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/nproc/src/nproc.rs b/src/uu/nproc/src/nproc.rs index 049a7ab4e..ec8aaf90a 100644 --- a/src/uu/nproc/src/nproc.rs +++ b/src/uu/nproc/src/nproc.rs @@ -47,13 +47,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg( Arg::with_name(OPT_ALL) .short("") - .long("all") + .long(OPT_ALL) .help("print the number of cores available to the system"), ) .arg( Arg::with_name(OPT_IGNORE) .short("") - .long("ignore") + .long(OPT_IGNORE) .takes_value(true) .help("ignore up to N cores"), ) From 7b4d81efd4f588bac5742d682d5bae7637cfc089 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 10 Oct 2020 13:29:37 -0500 Subject: [PATCH 004/606] refactor/polish ~ fix `cargo clippy` complaint (needless_collect) --- src/uu/expand/src/expand.rs | 2 +- src/uu/unexpand/src/unexpand.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index 560ffc840..d478c3c73 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -29,7 +29,7 @@ static LONG_HELP: &str = ""; static DEFAULT_TABSTOP: usize = 8; fn tabstops_parse(s: String) -> Vec { - let words = s.split(',').collect::>(); + let words = s.split(','); let nums = words .into_iter() diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index 1ca12ba87..d15e3f73c 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -26,7 +26,7 @@ static VERSION: &str = env!("CARGO_PKG_VERSION"); const DEFAULT_TABSTOP: usize = 8; fn tabstops_parse(s: String) -> Vec { - let words = s.split(',').collect::>(); + let words = s.split(','); let nums = words .into_iter() From 6fa16343f1899cbbdd68ec6211cfdc8825488e75 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 10 Oct 2020 13:33:38 -0500 Subject: [PATCH 005/606] refactor/polish ~ fix `cargo clippy` complaint (same_item_push) --- src/uu/shred/src/shred.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 307684375..8b12f0195 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -69,10 +69,7 @@ struct FilenameGenerator { impl FilenameGenerator { fn new(name_len: usize) -> FilenameGenerator { - let mut indices: Vec = Vec::new(); - for _ in 0..name_len { - indices.push(0); - } + let indices: Vec = vec![0; name_len]; FilenameGenerator { name_len, nameset_indices: RefCell::new(indices), From 10b6926ccc632b3020439157d5381b0812eaa9f0 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 10 Oct 2020 14:16:20 -0500 Subject: [PATCH 006/606] refactor/polish ~ fix `cargo clippy` complaint (allow match_like_matches_macro) --- src/uu/expr/src/tokens.rs | 2 ++ src/uu/fmt/src/parasplit.rs | 4 ++++ src/uu/hashsum/src/hashsum.rs | 2 ++ src/uu/od/src/parse_formats.rs | 2 ++ src/uu/rm/src/rm.rs | 2 ++ 5 files changed, 12 insertions(+) diff --git a/src/uu/expr/src/tokens.rs b/src/uu/expr/src/tokens.rs index 558dae090..b65b0d482 100644 --- a/src/uu/expr/src/tokens.rs +++ b/src/uu/expr/src/tokens.rs @@ -63,6 +63,8 @@ impl Token { } } fn is_a_close_paren(&self) -> bool { + #[allow(clippy::match_like_matches_macro)] + // `matches!(...)` macro not stabilized until rust v1.42 match *self { Token::ParClose => true, _ => false, diff --git a/src/uu/fmt/src/parasplit.rs b/src/uu/fmt/src/parasplit.rs index ddf6f394b..f74a25413 100644 --- a/src/uu/fmt/src/parasplit.rs +++ b/src/uu/fmt/src/parasplit.rs @@ -264,6 +264,8 @@ impl<'a> ParagraphStream<'a> { return false; } + #[allow(clippy::match_like_matches_macro)] + // `matches!(...)` macro not stabilized until rust v1.42 l_slice[..colon_posn].chars().all(|x| match x as usize { y if y < 33 || y > 126 => false, _ => true, @@ -539,6 +541,8 @@ impl<'a> WordSplit<'a> { } fn is_punctuation(c: char) -> bool { + #[allow(clippy::match_like_matches_macro)] + // `matches!(...)` macro not stabilized until rust v1.42 match c { '!' | '.' | '?' => true, _ => false, diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index 733cd8b54..e1bc2e9d9 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -57,6 +57,8 @@ struct Options { } fn is_custom_binary(program: &str) -> bool { + #[allow(clippy::match_like_matches_macro)] + // `matches!(...)` macro not stabilized until rust v1.42 match program { "md5sum" | "sha1sum" | "sha224sum" | "sha256sum" | "sha384sum" | "sha512sum" | "sha3sum" | "sha3-224sum" | "sha3-256sum" | "sha3-384sum" | "sha3-512sum" diff --git a/src/uu/od/src/parse_formats.rs b/src/uu/od/src/parse_formats.rs index 61be92c40..8b32d648c 100644 --- a/src/uu/od/src/parse_formats.rs +++ b/src/uu/od/src/parse_formats.rs @@ -85,6 +85,8 @@ fn od_format_type(type_char: FormatType, byte_size: u8) -> Option bool { + #[allow(clippy::match_like_matches_macro)] + // `matches!(...)` macro not stabilized until rust v1.42 match ch { 'A' | 'j' | 'N' | 'S' | 'w' => true, _ => false, diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 42c7be557..f87f3e1ac 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -302,6 +302,8 @@ fn prompt(msg: &str) -> bool { let stdin = stdin(); let mut stdin = stdin.lock(); + #[allow(clippy::match_like_matches_macro)] + // `matches!(...)` macro not stabilized until rust v1.42 match stdin.read_until(b'\n', &mut buf) { Ok(x) if x > 0 => match buf[0] { b'y' | b'Y' => true, From 46f30f383696ddcb8a2ba31051ada21ec96e78a5 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 10 Oct 2020 15:15:35 -0500 Subject: [PATCH 007/606] refactor/polish ~ fix `cargo clippy` complaint (stable_sort_primitive) --- src/bin/coreutils.rs | 2 +- src/uu/printf/src/tokenize/sub.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bin/coreutils.rs b/src/bin/coreutils.rs index c7a74974f..f813f2ae5 100644 --- a/src/bin/coreutils.rs +++ b/src/bin/coreutils.rs @@ -25,7 +25,7 @@ fn usage(utils: &UtilityMap, name: &str) { println!("Currently defined functions/utilities:\n"); #[allow(clippy::map_clone)] let mut utils: Vec<&str> = utils.keys().map(|&s| s).collect(); - utils.sort(); + utils.sort_unstable(); let display_list = utils.join(", "); let width = cmp::min(textwrap::termwidth(), 100) - 4 * 2; // (opinion/heuristic) max 100 chars wide with 4 character side indentions println!( diff --git a/src/uu/printf/src/tokenize/sub.rs b/src/uu/printf/src/tokenize/sub.rs index bf3fea211..30d684393 100644 --- a/src/uu/printf/src/tokenize/sub.rs +++ b/src/uu/printf/src/tokenize/sub.rs @@ -163,8 +163,8 @@ impl SubParser { 'b', 'c', 'd', 'e', 'E', 'f', 'F', 'g', 'G', 'i', 'o', 's', 'u', 'x', 'X', ]; let mut specifiers = vec!['h', 'j', 'l', 'L', 't', 'z']; - legal_fields.sort(); - specifiers.sort(); + legal_fields.sort_unstable(); + specifiers.sort_unstable(); // divide substitution from %([0-9]+)?(.[0-9+])?([a-zA-Z]) // into min_width, second_field, field_char From 77a04546f088376123f5e86f3090d24d2504f6fc Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 11 Oct 2020 17:38:46 -0500 Subject: [PATCH 008/606] fix/printf ~ use calculated VERSION --- src/uu/printf/src/printf.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/printf/src/printf.rs b/src/uu/printf/src/printf.rs index 246a1dcea..e7ce41d2a 100644 --- a/src/uu/printf/src/printf.rs +++ b/src/uu/printf/src/printf.rs @@ -11,7 +11,7 @@ mod memo; mod tokenize; static NAME: &str = "printf"; -static VERSION: &str = "0.0.1"; +static VERSION: &str = env!("CARGO_PKG_VERSION"); static SHORT_USAGE: &str = "printf: usage: printf [-v var] format [arguments]"; static LONGHELP_LEAD: &str = "printf From df57df8c938d3bc189256379629cd6be86c983a9 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 11 Oct 2020 17:39:33 -0500 Subject: [PATCH 009/606] docs ~ use version calculated from *Cargo.toml* --- docs/conf.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index b12a8be62..74e5e1fb8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -23,6 +23,7 @@ import glob import os +import re # -- General configuration ------------------------------------------------ @@ -55,11 +56,14 @@ author = 'uutils developers' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. -# +# * take version from project "Cargo.toml" +version_file = open(os.path.join("..","Cargo.toml"), "r") +version_file_content = version_file.read() +v = re.search("^\s*version\s*=\s*\"([0-9.]+)\"", version_file_content, re.IGNORECASE | re.MULTILINE) # The short X.Y version. -version = '0.0.1' +version = v.groups()[0] # The full version, including alpha/beta/rc tags. -release = '0.0.1' +release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -179,6 +183,3 @@ texinfo_documents = [ author, 'uutils', 'A cross-platform reimplementation of GNU coreutils in Rust.', 'Miscellaneous'), ] - - - From 79b054b016dd6e24c1a8dd1f0fd7b851e4fff7fc Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 14 Oct 2020 14:37:50 -0500 Subject: [PATCH 010/606] update deps ~ Cargo.lock --- Cargo.lock | 429 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 1 + 2 files changed, 215 insertions(+), 215 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f0b3f99d9..1a24e046a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,7 +19,7 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.10" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -30,7 +30,7 @@ name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -38,9 +38,9 @@ name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hermit-abi 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -50,7 +50,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "autocfg" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -70,7 +70,7 @@ name = "backtrace-sys" version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -114,7 +114,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -142,7 +142,7 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.54" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -162,7 +162,7 @@ dependencies = [ [[package]] name = "clap" -version = "2.33.1" +version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -170,7 +170,7 @@ dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -186,16 +186,17 @@ dependencies = [ name = "coreutils" version = "0.0.1" dependencies = [ - "filetime 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unindent 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "uu_arch 0.0.1", @@ -309,7 +310,7 @@ name = "cpp_build" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -377,7 +378,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -385,12 +386,12 @@ dependencies = [ "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "oorandom 11.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.113 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -404,6 +405,15 @@ dependencies = [ "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crossbeam-channel" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crossbeam-deque" version = "0.7.3" @@ -419,31 +429,21 @@ name = "crossbeam-epoch" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "crossbeam-queue" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "crossbeam-utils" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -457,7 +457,7 @@ dependencies = [ "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -488,7 +488,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "either" -version = "1.5.3" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -496,8 +496,8 @@ name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -526,13 +526,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "filetime" -version = "0.2.10" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -542,7 +542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "fs_extra" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -564,12 +564,12 @@ name = "getopts" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "getrandom" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -589,7 +589,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hermit-abi" -version = "0.1.14" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -607,7 +607,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -622,8 +622,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -631,7 +631,7 @@ name = "itertools" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -639,7 +639,7 @@ name = "itertools" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -649,10 +649,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "js-sys" -version = "0.3.42" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -676,7 +676,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log" -version = "0.4.8" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -712,10 +712,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memoffset" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -735,7 +735,7 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -751,7 +751,7 @@ name = "num-integer" version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -760,7 +760,7 @@ name = "num-traits" version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -768,7 +768,7 @@ name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hermit-abi 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -801,8 +801,8 @@ name = "onig_sys" version = "69.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -816,7 +816,7 @@ version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.16 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -824,12 +824,12 @@ name = "paste-impl" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro-hack 0.5.16 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pkg-config" -version = "0.3.17" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -838,7 +838,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -846,28 +846,28 @@ name = "plotters" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "js-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ppv-lite86" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "proc-macro-hack" -version = "0.5.16" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "proc-macro2" -version = "1.0.18" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -881,7 +881,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -896,7 +896,7 @@ name = "quote" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -908,7 +908,7 @@ dependencies = [ "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -926,7 +926,7 @@ dependencies = [ "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -934,7 +934,7 @@ name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -956,7 +956,7 @@ name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ppv-lite86 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -978,7 +978,7 @@ name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1012,7 +1012,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1025,7 +1025,7 @@ dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1055,22 +1055,22 @@ dependencies = [ [[package]] name = "rayon" -version = "1.3.1" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon-core" -version = "1.7.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-queue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1086,7 +1086,7 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1094,17 +1094,17 @@ name = "redox_termios" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "1.3.9" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1118,7 +1118,7 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1126,7 +1126,7 @@ name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1180,7 +1180,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.114" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1189,27 +1189,27 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "half 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.113" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.56" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1257,12 +1257,12 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.31" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1290,9 +1290,9 @@ dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1300,7 +1300,7 @@ name = "term_grid" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1309,7 +1309,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1319,7 +1319,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1341,7 +1341,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1358,8 +1358,8 @@ version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1367,8 +1367,8 @@ name = "tinytemplate" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1378,7 +1378,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unicode-width" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1388,12 +1388,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unicode-xid" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unindent" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1411,7 +1411,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1518,15 +1518,15 @@ dependencies = [ name = "uu_cp" version = "0.0.1" dependencies = [ - "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1543,7 +1543,7 @@ name = "uu_date" version = "0.0.1" dependencies = [ "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -1552,12 +1552,12 @@ dependencies = [ name = "uu_df" version = "0.0.1" dependencies = [ - "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1599,7 +1599,7 @@ dependencies = [ name = "uu_env" version = "0.0.1" dependencies = [ - "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", @@ -1611,7 +1611,7 @@ name = "uu_expand" version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -1653,7 +1653,7 @@ name = "uu_fmt" version = "0.0.1" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -1670,7 +1670,7 @@ dependencies = [ name = "uu_groups" version = "0.0.1" dependencies = [ - "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -1679,13 +1679,13 @@ dependencies = [ name = "uu_hashsum" version = "0.0.1" dependencies = [ - "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1715,12 +1715,12 @@ dependencies = [ name = "uu_hostname" version = "0.0.1" dependencies = [ - "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1746,7 +1746,7 @@ dependencies = [ name = "uu_join" version = "0.0.1" dependencies = [ - "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -1798,7 +1798,7 @@ dependencies = [ "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -1850,7 +1850,7 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", @@ -1860,7 +1860,7 @@ dependencies = [ name = "uu_mv" version = "0.0.1" dependencies = [ - "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", @@ -1880,12 +1880,12 @@ dependencies = [ name = "uu_nl" version = "0.0.1" dependencies = [ - "aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -1904,8 +1904,7 @@ dependencies = [ name = "uu_nproc" version = "0.0.1" dependencies = [ - "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", @@ -1982,12 +1981,12 @@ dependencies = [ name = "uu_ptx" version = "0.0.1" dependencies = [ - "aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -2062,7 +2061,7 @@ dependencies = [ name = "uu_shred" version = "0.0.1" dependencies = [ - "filetime 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2159,7 +2158,7 @@ dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2177,10 +2176,10 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2198,7 +2197,7 @@ name = "uu_test" version = "0.0.1" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -2218,7 +2217,7 @@ dependencies = [ name = "uu_touch" version = "0.0.1" dependencies = [ - "filetime 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", @@ -2276,7 +2275,7 @@ dependencies = [ name = "uu_uname" version = "0.0.1" dependencies = [ - "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", @@ -2287,7 +2286,7 @@ name = "uu_unexpand" version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -2316,7 +2315,7 @@ name = "uu_uptime" version = "0.0.1" dependencies = [ "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", @@ -2354,17 +2353,17 @@ name = "uu_whoami" version = "0.0.1" dependencies = [ "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_yes" version = "0.0.1" dependencies = [ - "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -2394,9 +2393,9 @@ name = "uucore_procs" version = "0.0.4" source = "git+https://github.com/uutils/uucore.git?branch=canary#869573459f00ba0b4af9f7d828370c105f31a94e" dependencies = [ - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2415,7 +2414,7 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2431,60 +2430,60 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wasm-bindgen" -version = "0.2.65" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.65" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bumpalo 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.65" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.65" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.65" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "web-sys" -version = "0.3.42" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "js-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2502,7 +2501,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2524,7 +2523,7 @@ name = "winapi-util" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2543,11 +2542,11 @@ dependencies = [ [metadata] "checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" "checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5" -"checksum aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" +"checksum aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b476ce7103678b0c6d3d395dbbae31d48ff910bd28be979ba5d48c6351131d0d" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" -"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" "checksum backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)" = "ada4c783bb7e7443c14e0480f429ae2cc99da95065aeab7ee1b81ada0419404f" "checksum backtrace-sys 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "18fbebbe1c9d1f383a9cc7e8ccdb471b91c8d024ee9c2ca5b5346121fe8b4399" "checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" @@ -2560,10 +2559,10 @@ dependencies = [ "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" "checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" -"checksum cc 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)" = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311" +"checksum cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)" = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" "checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" -"checksum clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129" +"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d1cd8699ffa1b18fd388183f7762e0545eddbd5c6ec95e9e3b42a4a71a507ff" "checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" @@ -2574,30 +2573,30 @@ dependencies = [ "checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" "checksum criterion 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "70daa7ceec6cf143990669a04c7df13391d55fb27bd4079d252fca774ba244d8" "checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" +"checksum crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" "checksum crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" "checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -"checksum crossbeam-queue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" "checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" "checksum csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279" "checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" "checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" "checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" "checksum dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" -"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" "checksum failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82" "checksum failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum filetime 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "affc17579b132fc2461adf7c575cc6e8b134ebca52c51f5411388965227dc695" +"checksum filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "3ed85775dcc68644b5c950ac06a2b23768d3bc9390464151aaf27136998dcf9e" "checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -"checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" +"checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fceb69994e330afed50c93524be68c42fa898c2d9fd4ee8da03bd7363acd26f2" "checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +"checksum getrandom 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" "checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" "checksum half 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d36fab90f82edc3c747f9d438e06cf0a491055896f2a279638bb5beed6c40177" -"checksum hermit-abi 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" +"checksum hermit-abi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" "checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" "checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" "checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" @@ -2605,17 +2604,17 @@ dependencies = [ "checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" "checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" "checksum itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" -"checksum js-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)" = "52732a3d3ad72c58ad2dc70624f9c17b46ecd0943b9a4f1ee37c4c18c5d983e2" +"checksum js-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)" = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" -"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +"checksum log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" "checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" "checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" "checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" "checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" -"checksum memoffset 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" +"checksum memoffset 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" "checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" "checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" @@ -2629,12 +2628,12 @@ dependencies = [ "checksum oorandom 11.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a170cebd8021a008ea92e4db85a72f80b35df514ec664b296fdcbb654eac0b2c" "checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" "checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" -"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" +"checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" "checksum platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f2fd076acdc7a98374de6e300bf3af675997225bef21aecac2219553f04dd7e8" "checksum plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0d1685fbe7beba33de0330629da9d955ac75bd54f33d7b79f9a895590124f6bb" -"checksum ppv-lite86 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" -"checksum proc-macro-hack 0.5.16 (registry+https://github.com/rust-lang/crates.io-index)" = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" -"checksum proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" +"checksum ppv-lite86 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" +"checksum proc-macro-hack 0.5.18 (registry+https://github.com/rust-lang/crates.io-index)" = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" +"checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" "checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" @@ -2655,14 +2654,14 @@ dependencies = [ "checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" "checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -"checksum rayon 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080" -"checksum rayon-core 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280" +"checksum rayon 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf6960dc9a5b4ee8d3e4c5787b4a112a8818e0290a42ff664ad60692fdf2032" +"checksum rayon-core 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e8c4fec834fb6e6d2dd5eece3c7b432a52f0ba887cf40e595190c4107edc08bf" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" +"checksum regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8963b85b8ce3074fecffde43b4b0dded83ce2f367dc8d363afc56679f3ee820b" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -"checksum regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)" = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" +"checksum regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)" = "8cab7a364d15cde1e505267766a2d3c4e22a843e1a601f0fa7564c0f82ced11c" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" @@ -2672,16 +2671,16 @@ dependencies = [ "checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)" = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" +"checksum serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)" = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5" "checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.113 (registry+https://github.com/rust-lang/crates.io-index)" = "93c5eaa17d0954cb481cdcfffe9d84fcfa7a1a9f2349271e678677be4c26ae31" -"checksum serde_json 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)" = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3" +"checksum serde_derive 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)" = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8" +"checksum serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)" = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "b5304cfdf27365b7585c25d4af91b35016ed21ef88f17ced89c7093b43dba8b6" +"checksum syn 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e03e57e4fcbfe7749842d53e24ccb9aa12b7252dbe5e91d2acad31834c8b8fdd" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" @@ -2694,10 +2693,10 @@ dependencies = [ "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tinytemplate 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d3dc76004a03cec1c5932bca4cdc2e39aaa798e3f82363dd94f9adf6098c12f" "checksum typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" -"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" +"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -"checksum unindent 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "af41d708427f8fd0e915dcebb2cae0f0e6acb2a939b2d399c265c39a38a18942" +"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +"checksum unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" "checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" "checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" "checksum uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)" = "" @@ -2707,15 +2706,15 @@ dependencies = [ "checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" "checksum walker 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44971d5e5ae4f7904dffb6260ebd3910e7bcae104a94730e04a24cb6af40646b" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "f3edbcc9536ab7eababcc6d2374a0b7bfe13a2b6d562c5e07f370456b1a8f33d" -"checksum wasm-bindgen-backend 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "89ed2fb8c84bfad20ea66b26a3743f3e7ba8735a69fe7d95118c33ec8fc1244d" -"checksum wasm-bindgen-macro 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "eb071268b031a64d92fc6cf691715ca5a40950694d8f683c5bb43db7c730929e" -"checksum wasm-bindgen-macro-support 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "cf592c807080719d1ff2f245a687cbadb3ed28b2077ed7084b47aba8b691f2c6" -"checksum wasm-bindgen-shared 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "72b6c0220ded549d63860c78c38f3bcc558d1ca3f4efa74942c536ddbbb55e87" -"checksum web-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)" = "8be2398f326b7ba09815d0b403095f34dd708579220d099caae89be0b32137b2" +"checksum wasm-bindgen 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" +"checksum wasm-bindgen-backend 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" +"checksum wasm-bindgen-macro 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" +"checksum wasm-bindgen-macro-support 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" +"checksum wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" +"checksum web-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" "checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" diff --git a/Cargo.toml b/Cargo.toml index d6f97ad21..7a5965107 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -324,6 +324,7 @@ whoami = { optional=true, version="0.0.1", package="uu_whoami", path="src/uu/w yes = { optional=true, version="0.0.1", package="uu_yes", path="src/uu/yes" } # # * pinned transitive dependencies +pin_rustc-demangle = { version="0.1.16, < 0.1.17", package="rustc-demangle" } ## rust-demangle v0.1.17 has compiler errors for MinRustV v1.32.0, expects 1.33 pin_same-file = { version="1.0.4, < 1.0.6", package="same-file" } ## same-file v1.0.6 has compiler errors for MinRustV v1.32.0, expects 1.34 pin_winapi-util = { version="0.1.2, < 0.1.3", package="winapi-util" } ## winapi-util v0.1.3 has compiler errors for MinRustV v1.32.0, expects 1.34 From 3a4f12c2fb7575cec02ca971888a771bca630780 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 14 Oct 2020 21:41:13 -0500 Subject: [PATCH 011/606] maint/CICD ~ improve robustness of MinRustV package dependency calculation --- .github/workflows/CICD.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index df4c34564..2cafe77ac 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -136,9 +136,9 @@ jobs: cargo-tree tree -V ## dependencies echo "## dependency list" + cargo fetch --quiet ## * using the 'stable' toolchain is necessary to avoid "unexpected '--filter-platform'" errors - RUSTUP_TOOLCHAIN=stable cargo fetch --quiet - RUSTUP_TOOLCHAIN=stable cargo-tree tree --all --no-dev-dependencies --no-indent --features ${{ matrix.job.features }} | grep -vE "$PWD" | sort --unique + RUSTUP_TOOLCHAIN=stable cargo-tree tree --frozen --all --no-dev-dependencies --no-indent --features ${{ matrix.job.features }} | grep -vE "$PWD" | sort --unique - name: Test uses: actions-rs/cargo@v1 with: From 96092b01fc79f674b0c644ac6bd7dc3951d12805 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 14 Oct 2020 15:34:28 -0500 Subject: [PATCH 012/606] tests/cp ~ disable intermittent failures on MacOS (includes FixME comments) - track repair progress at GH:uutils/coreutils/issues/1590 --- tests/by-util/test_cp.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index f56131a86..753fe9e90 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -112,6 +112,8 @@ fn test_cp_multiple_files() { } #[test] +// FixME: for MacOS, this has intermittent failures; track repair progress at GH:uutils/coreutils/issues/1590 +#[cfg(not(macos))] fn test_cp_recurse() { let (at, mut ucmd) = at_and_ucmd!(); @@ -141,6 +143,8 @@ fn test_cp_with_dirs_t() { } #[test] +// FixME: for MacOS, this has intermittent failures; track repair progress at GH:uutils/coreutils/issues/1590 +#[cfg(not(macos))] fn test_cp_with_dirs() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; From 92075c7d1452c95766cf49539a1e1a19b559b849 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 14 Oct 2020 15:00:45 -0500 Subject: [PATCH 013/606] refactor/polish ~ (factor) fix `cargo clippy` complaint (unused_imports) --- src/uu/factor/src/numeric/mod.rs | 1 - src/uu/factor/src/numeric/montgomery.rs | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uu/factor/src/numeric/mod.rs b/src/uu/factor/src/numeric/mod.rs index 4a2c94cec..d086027b8 100644 --- a/src/uu/factor/src/numeric/mod.rs +++ b/src/uu/factor/src/numeric/mod.rs @@ -9,7 +9,6 @@ mod gcd; pub use gcd::gcd; pub(crate) mod traits; -use traits::{DoubleInt, Int, OverflowingAdd}; mod modular_inverse; pub(crate) use modular_inverse::modular_inverse; diff --git a/src/uu/factor/src/numeric/montgomery.rs b/src/uu/factor/src/numeric/montgomery.rs index 22fcc21a1..e39b1dba1 100644 --- a/src/uu/factor/src/numeric/montgomery.rs +++ b/src/uu/factor/src/numeric/montgomery.rs @@ -7,7 +7,9 @@ // * that was distributed with this source code. use super::*; + use num_traits::identities::{One, Zero}; +use traits::{DoubleInt, Int, OverflowingAdd}; pub(crate) trait Arithmetic: Copy + Sized { // The type of integers mod m, in some opaque representation From 7fc1b16115c84599b68f9c7b8468857cf157be1f Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Sun, 18 Oct 2020 10:47:27 -0700 Subject: [PATCH 014/606] 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. --- src/uu/sort/src/sort.rs | 5 +---- tests/by-util/test_sort.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index dc4dc1d90..11d243bba 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -550,10 +550,7 @@ where for line in iter { let str = format!("{}\n", line); - if let Err(e) = file.write_all(str.as_bytes()) { - show_error!("sort: {0}", e.to_string()); - panic!("Write failed"); - } + crash_if_err!(1, file.write_all(str.as_bytes())) } } diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index d3a4e6397..9ff1b3522 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -118,6 +118,19 @@ fn test_merge_reversed() { .stdout_only_fixture("merge_ints_reversed.expected"); } +#[test] +fn test_pipe() { + // TODO: issue 1608 reports a panic when we attempt to read from stdin, + // which was closed by the other side of the pipe. This test does not + // protect against regressions in that case; we should add one at some + // point. + new_ucmd!() + .pipe_in("one\ntwo\nfour") + .succeeds() + .stdout_is("four\none\ntwo\n") + .stderr_is(""); +} + #[test] fn test_check() { new_ucmd!() From f888616c0beda7bd2c1c34ac291ebcc652f12c53 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 23 Oct 2020 00:33:24 +0200 Subject: [PATCH 015/606] tests(truncate): Add more tests --- tests/by-util/test_truncate.rs | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index 7bb171386..ce7964d57 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -14,6 +14,35 @@ fn test_increase_file_size() { assert!(file.seek(SeekFrom::Current(0)).unwrap() == 5 * 1024); } +#[test] +fn test_increase_file_size_kb() { + let (at, mut ucmd) = at_and_ucmd!(); + let mut file = at.make_file(TFILE1); + ucmd.args(&["-s", "+5KB", TFILE1]).succeeds(); + + file.seek(SeekFrom::End(0)).unwrap(); + assert!(file.seek(SeekFrom::Current(0)).unwrap() == 5 * 1000); +} + +#[test] +fn test_reference() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let mut file = at.make_file(TFILE2); + + scene.ucmd().arg("-s").arg("+5KB").arg(TFILE1).run(); + + scene + .ucmd() + .arg("--reference") + .arg(TFILE1) + .arg(TFILE2) + .run(); + + file.seek(SeekFrom::End(0)).unwrap(); + assert!(file.seek(SeekFrom::Current(0)).unwrap() == 5 * 1000); +} + #[test] fn test_decrease_file_size() { let (at, mut ucmd) = at_and_ucmd!(); @@ -23,3 +52,20 @@ fn test_decrease_file_size() { file.seek(SeekFrom::End(0)).unwrap(); assert!(file.seek(SeekFrom::Current(0)).unwrap() == 6); } + +#[test] +fn test_failed() { + new_ucmd!().fails(); +} + +#[test] +fn test_failed_2() { + let (_at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&[TFILE1]).fails(); +} + +#[test] +fn test_failed_incorrect_arg() { + let (_at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["-s", "+5A", TFILE1]).fails(); +} From 8ad2fd3534d9dabdebc00465caf276bd8411043b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 23 Oct 2020 00:33:58 +0200 Subject: [PATCH 016/606] refactor(truncate): Move to clap --- Cargo.lock | 118 +++++++++++++------------- src/uu/truncate/Cargo.toml | 2 +- src/uu/truncate/src/truncate.rs | 143 ++++++++++++++++++-------------- 3 files changed, 145 insertions(+), 118 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1a24e046a..66fe84236 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,3 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" @@ -108,13 +106,13 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -150,6 +148,11 @@ name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "chrono" version = "0.4.11" @@ -182,6 +185,11 @@ dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "const_fn" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "coreutils" version = "0.0.1" @@ -386,11 +394,11 @@ dependencies = [ "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "oorandom 11.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -407,44 +415,44 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.4.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-deque" -version = "0.7.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" -version = "0.8.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-utils" -version = "0.7.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -453,11 +461,11 @@ name = "csv" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bstr 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -687,11 +695,6 @@ name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "md5" version = "0.3.8" @@ -1055,23 +1058,23 @@ dependencies = [ [[package]] name = "rayon" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon-core" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1180,7 +1183,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1189,17 +1192,17 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "half 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1209,7 +1212,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1257,7 +1260,7 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.44" +version = "1.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1367,7 +1370,7 @@ name = "tinytemplate" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2247,7 +2250,7 @@ dependencies = [ name = "uu_truncate" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -2395,7 +2398,7 @@ source = "git+https://github.com/uutils/uucore.git?branch=canary#869573459f00ba0 dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2447,7 +2450,7 @@ dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2467,7 +2470,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2554,16 +2557,18 @@ dependencies = [ "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" "checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" -"checksum bstr 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "31accafdb70df7871592c058eca3985b71104e15ac32f64706022c58867da931" +"checksum bstr 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "473fc6b38233f9af7baa94fb5852dca389e3d95b8e21c8e3719301462c5d9faf" "checksum bumpalo 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" "checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" "checksum cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)" = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +"checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" "checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" "checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2" "checksum cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d1cd8699ffa1b18fd388183f7762e0545eddbd5c6ec95e9e3b42a4a71a507ff" "checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" "checksum cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" @@ -2573,10 +2578,10 @@ dependencies = [ "checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" "checksum criterion 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "70daa7ceec6cf143990669a04c7df13391d55fb27bd4079d252fca774ba244d8" "checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" -"checksum crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" -"checksum crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" -"checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -"checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +"checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" +"checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" +"checksum crossbeam-epoch 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec0f606a85340376eef0d6d8fec399e6d4a544d648386c6645eb6d0653b27d9f" +"checksum crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5" "checksum csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279" "checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" "checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" @@ -2610,7 +2615,6 @@ dependencies = [ "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" "checksum log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" "checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" -"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" "checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" "checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" @@ -2654,8 +2658,8 @@ dependencies = [ "checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" "checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -"checksum rayon 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf6960dc9a5b4ee8d3e4c5787b4a112a8818e0290a42ff664ad60692fdf2032" -"checksum rayon-core 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e8c4fec834fb6e6d2dd5eece3c7b432a52f0ba887cf40e595190c4107edc08bf" +"checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" +"checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" @@ -2671,16 +2675,16 @@ dependencies = [ "checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)" = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5" +"checksum serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)" = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a" "checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)" = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8" +"checksum serde_derive 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)" = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e" "checksum serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)" = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)" = "e03e57e4fcbfe7749842d53e24ccb9aa12b7252dbe5e91d2acad31834c8b8fdd" +"checksum syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad5de3220ea04da322618ded2c42233d02baca219d6f160a3e9c87cda16c942" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index 7bc4c34c4..4da4b9487 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/truncate.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 6e36eb76e..2457cff2d 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -7,11 +7,12 @@ // spell-checker:ignore (ToDO) RFILE refsize rfilename fsize tsize -extern crate getopts; +extern crate clap; #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs::{metadata, File, OpenOptions}; use std::io::Result; use std::path::Path; @@ -27,78 +28,100 @@ enum TruncateMode { RoundUp, } -static NAME: &str = "truncate"; +static ABOUT: &str = "Shrink or extend the size of each file to the specified size."; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static OPT_NO_CREATE: &str = "no-create"; +static OPT_REFERENCE: &str = "reference"; +static OPT_IO_BLOCKS: &str = "io-blocks"; +static OPT_SIZE: &str = "size"; +static OPT_FILES: &str = "files"; + +fn get_usage() -> String { + format!("{0} [OPTION]... [FILE]...", executable!()) +} + +fn get_long_usage() -> String { + format!( + " + SIZE is an integer with an optional prefix and optional unit. + The available units (K, M, G, T, P, E, Z, and Y) use the following format: + 'KB' => 1000 (kilobytes) + 'K' => 1024 (kibibytes) + 'MB' => 1000*1000 (megabytes) + 'M' => 1024*1024 (mebibytes) + 'GB' => 1000*1000*1000 (gigabytes) + 'G' => 1024*1024*1024 (gibibytes) + SIZE may also be prefixed by one of the following to adjust the size of each + file based on its current size: + '+' => extend by + '-' => reduce by + '<' => at most + '>' => at least + '/' => round down to multiple of + '%' => round up to multiple of" + ) +} + pub fn uumain(args: impl uucore::Args) -> i32 { + /* let args = args.collect_str(); - let mut opts = getopts::Options::new(); + let mut opts = getopts::Options::new();*/ + let usage = get_usage(); + let long_usage = get_long_usage(); - opts.optflag("c", "no-create", "do not create files that do not exist"); - opts.optflag( - "o", - "io-blocks", - "treat SIZE as the number of I/O blocks of the file rather than bytes (NOT IMPLEMENTED)", - ); - opts.optopt( - "r", - "reference", - "base the size of each file on the size of RFILE", - "RFILE", - ); - opts.optopt("s", "size", "set or adjust the size of each file according to SIZE, which is in bytes unless --io-blocks is specified", "SIZE"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(&long_usage[..]) + .arg( + Arg::with_name(OPT_NO_CREATE) + .short("c") + .long(OPT_NO_CREATE) + .help("do not create files that do not exist") + ) + .arg( + Arg::with_name(OPT_IO_BLOCKS) + .short("o") + .long(OPT_IO_BLOCKS) + .help("treat SIZE as the number of I/O blocks of the file rather than bytes (NOT IMPLEMENTED)") + ) + .arg( + Arg::with_name(OPT_REFERENCE) + .short("r") + .long(OPT_REFERENCE) + .help("base the size of each file on the size of RFILE") + .value_name("RFILE") + ) + .arg( + Arg::with_name(OPT_SIZE) + .short("s") + .long("size") + .help("set or adjust the size of each file according to SIZE, which is in bytes unless --io-blocks is specified") + .value_name("SIZE") + ) + .arg(Arg::with_name(OPT_FILES).multiple(true).takes_value(true).min_values(1)) + .get_matches_from(args); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f), - }; + let files: Vec = matches + .values_of(OPT_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage:"); - println!(" {} [OPTION]... FILE...", NAME); - println!(); - print!( - "{}", - opts.usage("Shrink or extend the size of each file to the specified size.") - ); - println!( - " -SIZE is an integer with an optional prefix and optional unit. -The available units (K, M, G, T, P, E, Z, and Y) use the following format: - 'KB' => 1000 (kilobytes) - 'K' => 1024 (kibibytes) - 'MB' => 1000*1000 (megabytes) - 'M' => 1024*1024 (mebibytes) - 'GB' => 1000*1000*1000 (gigabytes) - 'G' => 1024*1024*1024 (gibibytes) -SIZE may also be prefixed by one of the following to adjust the size of each -file based on its current size: - '+' => extend by - '-' => reduce by - '<' => at most - '>' => at least - '/' => round down to multiple of - '%' => round up to multiple of" - ); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else if matches.free.is_empty() { - show_error!("missing an argument"); + if files.is_empty() { + show_error!("Missing an argument"); return 1; } else { - let no_create = matches.opt_present("no-create"); - let io_blocks = matches.opt_present("io-blocks"); - let reference = matches.opt_str("reference"); - let size = matches.opt_str("size"); + let no_create = matches.is_present(OPT_NO_CREATE); + let io_blocks = matches.is_present(OPT_IO_BLOCKS); + let reference = matches.value_of(OPT_REFERENCE).map(String::from); + let size = matches.value_of(OPT_SIZE).map(String::from); if reference.is_none() && size.is_none() { crash!(1, "you must specify either --reference or --size"); } else { - match truncate(no_create, io_blocks, reference, size, matches.free) { + match truncate(no_create, io_blocks, reference, size, files) { Ok(()) => ( /* pass */ ), Err(_) => return 1, } From daa5868da40245a4dc6ec004654e5d7f1d9a2139 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Fri, 23 Oct 2020 10:25:18 -0500 Subject: [PATCH 017/606] maint/CICD ~ add 'Cargo.lock' format testing and protection --- .github/workflows/CICD.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 2cafe77ac..847cf6895 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -119,6 +119,12 @@ jobs: use-tool-cache: true env: RUSTUP_TOOLCHAIN: stable + - name: Confirm compatible 'Cargo.lock' + shell: bash + run: | + # Confirm compatible 'Cargo.lock' + # * 'Cargo.lock' is required to be in a format that `cargo` of MinSRV can interpret (eg, v1-format for MinSRV < v1.38) + cargo fetch --locked --quiet || { echo "::error file=Cargo.lock::Incompatible 'Cargo.lock' format; try \`cargo +${{ env.RUST_MIN_SRV }} update\`" ; exit 1 ; } - name: Info shell: bash run: | @@ -136,9 +142,14 @@ jobs: cargo-tree tree -V ## dependencies echo "## dependency list" - cargo fetch --quiet + cargo fetch --locked --quiet ## * using the 'stable' toolchain is necessary to avoid "unexpected '--filter-platform'" errors RUSTUP_TOOLCHAIN=stable cargo-tree tree --frozen --all --no-dev-dependencies --no-indent --features ${{ matrix.job.features }} | grep -vE "$PWD" | sort --unique + - name: Info + shell: bash + run: | + # Info + - name: Test uses: actions-rs/cargo@v1 with: @@ -348,7 +359,7 @@ jobs: cargo-tree tree -V ## dependencies echo "## dependency list" - cargo fetch --quiet + cargo fetch --locked --quiet cargo-tree tree --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --all --no-dev-dependencies --no-indent | grep -vE "$PWD" | sort --unique - name: Build uses: actions-rs/cargo@v1 From b72972e0b285b86ca6a57a391b0df3200b592684 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 25 Oct 2020 12:22:07 +0100 Subject: [PATCH 018/606] Rename OPT_FILES => ARG_FILES Co-authored-by: Roy Ivy III --- src/uu/truncate/src/truncate.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 2457cff2d..97953436e 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -35,7 +35,8 @@ static OPT_NO_CREATE: &str = "no-create"; static OPT_REFERENCE: &str = "reference"; static OPT_IO_BLOCKS: &str = "io-blocks"; static OPT_SIZE: &str = "size"; -static OPT_FILES: &str = "files"; + +static ARG_FILES: &str = "files"; fn get_usage() -> String { format!("{0} [OPTION]... [FILE]...", executable!()) @@ -102,11 +103,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("set or adjust the size of each file according to SIZE, which is in bytes unless --io-blocks is specified") .value_name("SIZE") ) - .arg(Arg::with_name(OPT_FILES).multiple(true).takes_value(true).min_values(1)) + .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true).min_values(1)) .get_matches_from(args); let files: Vec = matches - .values_of(OPT_FILES) + .values_of(ARG_FILES) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); From 0d4e36d5cd90022f026559c7e6f56ed4071e65a4 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 25 Oct 2020 12:27:04 +0100 Subject: [PATCH 019/606] reorder the args --- src/uu/truncate/src/truncate.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 97953436e..380599bff 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -31,9 +31,9 @@ enum TruncateMode { static ABOUT: &str = "Shrink or extend the size of each file to the specified size."; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static OPT_IO_BLOCKS: &str = "io-blocks"; static OPT_NO_CREATE: &str = "no-create"; static OPT_REFERENCE: &str = "reference"; -static OPT_IO_BLOCKS: &str = "io-blocks"; static OPT_SIZE: &str = "size"; static ARG_FILES: &str = "files"; @@ -77,18 +77,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .after_help(&long_usage[..]) - .arg( - Arg::with_name(OPT_NO_CREATE) - .short("c") - .long(OPT_NO_CREATE) - .help("do not create files that do not exist") - ) .arg( Arg::with_name(OPT_IO_BLOCKS) .short("o") .long(OPT_IO_BLOCKS) .help("treat SIZE as the number of I/O blocks of the file rather than bytes (NOT IMPLEMENTED)") ) + .arg( + Arg::with_name(OPT_NO_CREATE) + .short("c") + .long(OPT_NO_CREATE) + .help("do not create files that do not exist") + ) .arg( Arg::with_name(OPT_REFERENCE) .short("r") @@ -115,8 +115,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { show_error!("Missing an argument"); return 1; } else { - let no_create = matches.is_present(OPT_NO_CREATE); let io_blocks = matches.is_present(OPT_IO_BLOCKS); + let no_create = matches.is_present(OPT_NO_CREATE); let reference = matches.value_of(OPT_REFERENCE).map(String::from); let size = matches.value_of(OPT_SIZE).map(String::from); if reference.is_none() && size.is_none() { From 7c3dccb981bdd71307e56fd9d7a5c522d93edb95 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 25 Oct 2020 12:28:27 +0100 Subject: [PATCH 020/606] remove the useless format --- src/uu/truncate/src/truncate.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 380599bff..04f79f883 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -43,7 +43,7 @@ fn get_usage() -> String { } fn get_long_usage() -> String { - format!( + String::from( " SIZE is an integer with an optional prefix and optional unit. The available units (K, M, G, T, P, E, Z, and Y) use the following format: @@ -60,7 +60,7 @@ fn get_long_usage() -> String { '<' => at most '>' => at least '/' => round down to multiple of - '%' => round up to multiple of" + '%' => round up to multiple of", ) } From 4804e52c979ab5499a0bae7c77fd2afc6dde51f5 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 25 Oct 2020 15:26:10 +0100 Subject: [PATCH 021/606] refactor(users): move to clap and simplify the code a bit --- Cargo.lock | 2 +- src/uu/users/Cargo.toml | 2 +- src/uu/users/src/users.rs | 63 ++++++++++++++++----------------------- 3 files changed, 27 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1a24e046a..1ae0bcd4a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2326,7 +2326,7 @@ dependencies = [ name = "uu_users" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index e232839b3..ce9f9d212 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/users.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["utmpx"] } uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } diff --git a/src/uu/users/src/users.rs b/src/uu/users/src/users.rs index 850b3112c..446d1d753 100644 --- a/src/uu/users/src/users.rs +++ b/src/uu/users/src/users.rs @@ -10,59 +10,44 @@ // Allow dead code here in order to keep all fields, constants here, for consistency. #![allow(dead_code)] -extern crate getopts; +extern crate clap; +#[macro_use] extern crate uucore; use uucore::utmpx::*; -use getopts::Options; +use clap::{App, Arg}; -static NAME: &str = "users"; +static ABOUT: &str = "Output who is currently logged in according to FILE."; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ARG_FILES: &str = "files"; + +fn get_usage() -> String { + format!("{0} [FILE]...", executable!()) +} + pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg(Arg::with_name(ARG_FILES).takes_value(true).max_values(1)) + .get_matches_from(args); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); + let files: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => panic!("{}", f), - }; - - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage:"); - println!(" {} [OPTION]... [FILE]", NAME); - println!(); - println!( - "{}", - opts.usage("Output who is currently logged in according to FILE.") - ); - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let filename = if !matches.free.is_empty() { - matches.free[0].as_ref() + let filename = if !files.is_empty() { + files[0].as_ref() } else { DEFAULT_FILE }; - exec(filename); - - 0 -} - -fn exec(filename: &str) { let mut users = Utmpx::iter_all_records() .read_from(filename) .filter(Utmpx::is_user_process) @@ -73,4 +58,6 @@ fn exec(filename: &str) { users.sort(); println!("{}", users.join(" ")); } + + 0 } From a12509f32e1e02206b8fbb301f1d3a8d98f0a6df Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 25 Oct 2020 15:50:01 +0100 Subject: [PATCH 022/606] Fix some clippy warnings --- src/uu/df/src/df.rs | 4 ++-- src/uu/expand/src/expand.rs | 1 - src/uu/tsort/src/tsort.rs | 2 +- src/uu/unexpand/src/unexpand.rs | 1 - 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index 0f9f440e2..d1541866d 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -676,7 +676,7 @@ fn filter_mount_list(vmi: Vec, paths: &[String], opt: &Options) -> Ve #[allow(clippy::map_entry)] { if acc.contains_key(&id) { - let seen = acc.get(&id).unwrap().replace(mi.clone()); + let seen = acc[&id].replace(mi.clone()); let target_nearer_root = seen.mount_dir.len() > mi.mount_dir.len(); // With bind mounts, prefer items nearer the root of the source let source_below_root = !seen.mount_root.is_empty() @@ -694,7 +694,7 @@ fn filter_mount_list(vmi: Vec, paths: &[String], opt: &Options) -> Ve environments for example. */ || seen.mount_dir != mi.mount_dir) { - acc.get(&id).unwrap().replace(seen); + acc[&id].replace(seen); } } else { acc.insert(id, Cell::new(mi)); diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index d478c3c73..e44282974 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -32,7 +32,6 @@ fn tabstops_parse(s: String) -> Vec { let words = s.split(','); let nums = words - .into_iter() .map(|sn| { sn.parse::() .unwrap_or_else(|_| crash!(1, "{}\n", "tab size contains invalid character(s)")) diff --git a/src/uu/tsort/src/tsort.rs b/src/uu/tsort/src/tsort.rs index e8a1010e1..dc7785645 100644 --- a/src/uu/tsort/src/tsort.rs +++ b/src/uu/tsort/src/tsort.rs @@ -131,7 +131,7 @@ impl Graph { } fn has_edge(&self, from: &str, to: &str) -> bool { - self.in_edges.get(to).unwrap().contains(from) + self.in_edges[to].contains(from) } fn init_node(&mut self, n: &str) { diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index d15e3f73c..57aa29b0a 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -29,7 +29,6 @@ fn tabstops_parse(s: String) -> Vec { let words = s.split(','); let nums = words - .into_iter() .map(|sn| { sn.parse() .unwrap_or_else(|_| crash!(1, "{}\n", "tab size contains invalid character(s)")) From b4969c6cc2f6475bc422513908085452cf825e7f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 20 Oct 2020 22:35:19 +0200 Subject: [PATCH 023/606] test(seq): add a test to check that we don't accept more than 3 args --- tests/by-util/test_seq.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/by-util/test_seq.rs b/tests/by-util/test_seq.rs index 440a2bc98..9ee5c94aa 100644 --- a/tests/by-util/test_seq.rs +++ b/tests/by-util/test_seq.rs @@ -31,3 +31,8 @@ fn test_equalize_widths() { .run() .stdout_is("05\n06\n07\n08\n09\n10\n"); } + +#[test] +fn test_seq_wrong_arg() { + new_ucmd!().args(&["-w", "5", "10", "33", "32"]).fails(); +} From dfb922f66e3b3c0391a524058d0a5c3d577108be Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 20 Oct 2020 23:05:52 +0200 Subject: [PATCH 024/606] refactor(seq): use clap instead of doing arg mgmt by hand --- Cargo.lock | 14 +-- src/uu/seq/Cargo.toml | 2 +- src/uu/seq/src/seq.rs | 207 +++++++++++------------------------------- 3 files changed, 63 insertions(+), 160 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 66fe84236..bd990d93c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1202,7 +1202,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1260,7 +1260,7 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.46" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2055,7 +2055,7 @@ dependencies = [ name = "uu_seq" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -2398,7 +2398,7 @@ source = "git+https://github.com/uutils/uucore.git?branch=canary#869573459f00ba0 dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2450,7 +2450,7 @@ dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2470,7 +2470,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2684,7 +2684,7 @@ dependencies = [ "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad5de3220ea04da322618ded2c42233d02baca219d6f160a3e9c87cda16c942" +"checksum syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index 29d1eb1cf..b7cf3901c 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/seq.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index 57890ab28..64a66d848 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -3,17 +3,25 @@ // spell-checker:ignore (ToDO) istr chiter argptr ilen -extern crate getopts; +extern crate clap; #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::cmp; use std::io::{stdout, Write}; -static NAME: &str = "seq"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Print sequences of numbers"; +static OPT_SEPARATOR: &str = "separator"; +static OPT_TERMINATOR: &str = "terminator"; +static OPT_WIDTHS: &str = "widths"; +static OPT_NUMBERS: &str = "numbers"; +fn get_usage() -> String { + format!("{0} [OPTION]... [FILE]...", executable!()) +} #[derive(Clone)] struct SeqOptions { separator: String, @@ -38,162 +46,57 @@ fn escape_sequences(s: &str) -> String { s.replace("\\n", "\n").replace("\\t", "\t") } -fn parse_options(args: Vec, options: &mut SeqOptions) -> Result, i32> { - let mut seq_args = vec![]; - let mut iter = args.into_iter().skip(1); - while let Some(arg) = iter.next() { - match &arg[..] { - "--help" | "-h" => { - print_help(); - return Err(0); - } - "--version" | "-V" => { - print_version(); - return Err(0); - } - "-s" | "--separator" => match iter.next() { - Some(sep) => options.separator = sep, - None => { - show_error!("expected a separator after {}", arg); - return Err(1); - } - }, - "-t" | "--terminator" => match iter.next() { - Some(term) => options.terminator = Some(term), - None => { - show_error!("expected a terminator after '{}'", arg); - return Err(1); - } - }, - "-w" | "--widths" => options.widths = true, - "--" => { - seq_args.extend(iter); - break; - } - _ => { - if arg.len() > 1 && arg.starts_with('-') { - let argptr: *const String = &arg; // escape from the borrow checker - let mut chiter = unsafe { &(*argptr)[..] }.chars().skip(1); - let mut ch = ' '; - while match chiter.next() { - Some(m) => { - ch = m; - true - } - None => false, - } { - match ch { - 'h' => { - print_help(); - return Err(0); - } - 'V' => { - print_version(); - return Err(0); - } - 's' => match iter.next() { - Some(sep) => { - options.separator = sep; - let next = chiter.next(); - if let Some(n) = next { - show_error!("unexpected character ('{}')", n); - return Err(1); - } - } - None => { - show_error!("expected a separator after {}", arg); - return Err(1); - } - }, - 't' => match iter.next() { - Some(term) => { - options.terminator = Some(term); - let next = chiter.next(); - if let Some(n) = next { - show_error!("unexpected character ('{}')", n); - return Err(1); - } - } - None => { - show_error!("expected a terminator after {}", arg); - return Err(1); - } - }, - 'w' => options.widths = true, - _ => { - seq_args.push(arg); - break; - } - } - } - } else { - seq_args.push(arg); - } - } - }; - } - Ok(seq_args) -} - -fn print_help() { - let mut opts = getopts::Options::new(); - - opts.optopt( - "s", - "separator", - "Separator character (defaults to \\n)", - "", - ); - opts.optopt( - "t", - "terminator", - "Terminator character (defaults to separator)", - "", - ); - opts.optflag( - "w", - "widths", - "Equalize widths of all numbers by padding with zeros", - ); - opts.optflag("h", "help", "print this help text and exit"); - opts.optflag("V", "version", "print version and exit"); - - println!("{} {}\n", NAME, VERSION); - println!( - "Usage:\n {} [-w] [-s string] [-t string] [first [step]] last\n", - NAME - ); - println!("{}", opts.usage("Print sequences of numbers")); -} - -fn print_version() { - println!("{} {}", NAME, VERSION); -} - pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_SEPARATOR) + .short("s") + .long("separator") + .help("Separator character (defaults to \\n)") + .takes_value(true) + .number_of_values(1), + ) + .arg( + Arg::with_name(OPT_TERMINATOR) + .short("t") + .long("terminator") + .help("Terminator character (defaults to separator)") + .takes_value(true) + .number_of_values(1), + ) + .arg( + Arg::with_name(OPT_WIDTHS) + .short("w") + .long("widths") + .help("Equalize widths of all numbers by padding with zeros"), + ) + .arg( + Arg::with_name(OPT_NUMBERS) + .multiple(true) + .takes_value(true) + .max_values(3), + ) + .get_matches_from(args); + + let numbers = matches.values_of(OPT_NUMBERS).unwrap().collect::>(); let mut options = SeqOptions { separator: "\n".to_owned(), terminator: None, widths: false, }; - let free = match parse_options(args, &mut options) { - Ok(m) => m, - Err(f) => return f, - }; - if free.is_empty() || free.len() > 3 { - crash!( - 1, - "too {} operands.\nTry '{} --help' for more information.", - if free.is_empty() { "few" } else { "many" }, - NAME - ); - } + options.separator = matches.value_of(OPT_SEPARATOR).unwrap_or("\n").to_string(); + options.terminator = matches.value_of(OPT_TERMINATOR).map(String::from); + options.widths = matches.is_present(OPT_WIDTHS); + let mut largest_dec = 0; let mut padding = 0; - let first = if free.len() > 1 { - let slice = &free[0][..]; + let first = if numbers.len() > 1 { + let slice = &numbers[0][..]; let len = slice.len(); let dec = slice.find('.').unwrap_or(len); largest_dec = len - dec; @@ -208,8 +111,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } else { 1.0 }; - let step = if free.len() > 2 { - let slice = &free[1][..]; + let step = if numbers.len() > 2 { + let slice = &numbers[1][..]; let len = slice.len(); let dec = slice.find('.').unwrap_or(len); largest_dec = cmp::max(largest_dec, len - dec); @@ -225,7 +128,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 1.0 }; let last = { - let slice = &free[free.len() - 1][..]; + let slice = &numbers[numbers.len() - 1][..]; padding = cmp::max(padding, slice.find('.').unwrap_or_else(|| slice.len())); match parse_float(slice) { Ok(n) => n, From 733fe925ad41a839320c8b140427c530613e80f1 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 18 Oct 2020 22:25:35 +0200 Subject: [PATCH 025/606] refactor(readlink): move to clap --- Cargo.lock | 14 +-- src/uu/readlink/Cargo.toml | 2 +- src/uu/readlink/src/readlink.rs | 147 +++++++++++++++++++------------- 3 files changed, 97 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 66fe84236..f539daf36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1202,7 +1202,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1260,7 +1260,7 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.46" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2007,7 +2007,7 @@ dependencies = [ name = "uu_readlink" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", @@ -2398,7 +2398,7 @@ source = "git+https://github.com/uutils/uucore.git?branch=canary#869573459f00ba0 dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2450,7 +2450,7 @@ dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2470,7 +2470,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2684,7 +2684,7 @@ dependencies = [ "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad5de3220ea04da322618ded2c42233d02baca219d6f160a3e9c87cda16c942" +"checksum syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index 058b778a0..6a46a09cc 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/readlink.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["fs"] } uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } diff --git a/src/uu/readlink/src/readlink.rs b/src/uu/readlink/src/readlink.rs index c4721c58f..f7a68b24a 100644 --- a/src/uu/readlink/src/readlink.rs +++ b/src/uu/readlink/src/readlink.rs @@ -7,11 +7,12 @@ // spell-checker:ignore (ToDO) errno -extern crate getopts; +extern crate clap; #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs; use std::io::{stdout, Write}; use std::path::PathBuf; @@ -19,68 +20,106 @@ use uucore::fs::{canonicalize, CanonicalizeMode}; const NAME: &str = "readlink"; const VERSION: &str = env!("CARGO_PKG_VERSION"); +const ABOUT: &str = "Print value of a symbolic link or canonical file name"; +const OPT_CANONICALIZE: &str = "canonicalize"; +const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing"; +const OPT_CANONICALIZE_EXISTING: &str = "canonicalize-existing"; +const OPT_ZERO: &str = "zero"; +const OPT_NO_NEWLINE: &str = "no-newline"; +const OPT_QUIET: &str = "quiet"; +const OPT_SILENT: &str = "silent"; +const OPT_VERBOSE: &str = "verbose"; +const OPT_FILES: &str = "files"; + +fn get_usage() -> String { + format!("{0} [OPTION]... [FILE]...", executable!()) +} pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); - - let mut opts = getopts::Options::new(); - - opts.optflag( - "f", - "canonicalize", - "canonicalize by following every symlink in every component of the \ - given name recursively; all but the last component must exist", - ); - opts.optflag( - "e", - "canonicalize-existing", - "canonicalize by following every symlink in every component of the \ + let usage = get_usage(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_CANONICALIZE) + .short("f") + .long(OPT_CANONICALIZE) + .help( + "canonicalize by following every symlink in every component of the \ + given name recursively; all but the last component must exist", + ), + ) + .arg( + Arg::with_name(OPT_CANONICALIZE_EXISTING) + .short("e") + .long("canonicalize-existing") + .help( + "canonicalize by following every symlink in every component of the \ given name recursively, all components must exist", - ); - opts.optflag( - "m", - "canonicalize-missing", - "canonicalize by following every symlink in every component of the \ + ), + ) + .arg( + Arg::with_name(OPT_CANONICALIZE_MISSING) + .short("m") + .long(OPT_CANONICALIZE_MISSING) + .help( + "canonicalize by following every symlink in every component of the \ given name recursively, without requirements on components existence", - ); - opts.optflag("n", "no-newline", "do not output the trailing delimiter"); - opts.optflag("q", "quiet", "suppress most error messages"); - opts.optflag("s", "silent", "suppress most error messages"); - opts.optflag("v", "verbose", "report error message"); - opts.optflag("z", "zero", "separate output with NUL rather than newline"); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); + ), + ) + .arg( + Arg::with_name(OPT_NO_NEWLINE) + .short("n") + .long(OPT_NO_NEWLINE) + .help("do not output the trailing delimiter"), + ) + .arg( + Arg::with_name(OPT_QUIET) + .short("q") + .long(OPT_QUIET) + .help("suppress most error messages"), + ) + .arg( + Arg::with_name(OPT_SILENT) + .short("s") + .long(OPT_SILENT) + .help("suppress most error messages"), + ) + .arg( + Arg::with_name(OPT_VERBOSE) + .short("v") + .long(OPT_VERBOSE) + .help("report error message"), + ) + .arg( + Arg::with_name(OPT_ZERO) + .short("z") + .long(OPT_ZERO) + .help("separate output with NUL rather than newline"), + ) + .arg(Arg::with_name(OPT_FILES).multiple(true).takes_value(true)) + .get_matches_from(args); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f), - }; - if matches.opt_present("help") { - show_usage(&opts); - return 0; - } + let mut no_newline = matches.is_present(OPT_NO_NEWLINE); + let use_zero = matches.is_present(OPT_ZERO); + let silent = matches.is_present(OPT_SILENT) || matches.is_present(OPT_QUIET); + let verbose = matches.is_present(OPT_VERBOSE); - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let mut no_newline = matches.opt_present("no-newline"); - let use_zero = matches.opt_present("zero"); - let silent = matches.opt_present("silent") || matches.opt_present("quiet"); - let verbose = matches.opt_present("verbose"); - - let can_mode = if matches.opt_present("canonicalize") { + let can_mode = if matches.is_present(OPT_CANONICALIZE) { CanonicalizeMode::Normal - } else if matches.opt_present("canonicalize-existing") { + } else if matches.is_present(OPT_CANONICALIZE_EXISTING) { CanonicalizeMode::Existing - } else if matches.opt_present("canonicalize-missing") { + } else if matches.is_present(OPT_CANONICALIZE_MISSING) { CanonicalizeMode::Missing } else { CanonicalizeMode::None }; - let files = matches.free; + let files: Vec = matches + .values_of(OPT_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); if files.is_empty() { crash!( 1, @@ -133,11 +172,3 @@ fn show(path: &PathBuf, no_newline: bool, use_zero: bool) { } crash_if_err!(1, stdout().flush()); } - -fn show_usage(opts: &getopts::Options) { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage: {0} [OPTION]... [FILE]...", NAME); - print!("Print value of a symbolic link or canonical file name"); - print!("{}", opts.usage("")); -} From e06aaace59e8d49f701522fc69045c9e3989b71a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 25 Oct 2020 10:07:03 +0100 Subject: [PATCH 026/606] 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 --- src/uu/readlink/src/readlink.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/uu/readlink/src/readlink.rs b/src/uu/readlink/src/readlink.rs index f7a68b24a..ce8a65622 100644 --- a/src/uu/readlink/src/readlink.rs +++ b/src/uu/readlink/src/readlink.rs @@ -20,16 +20,17 @@ use uucore::fs::{canonicalize, CanonicalizeMode}; const NAME: &str = "readlink"; const VERSION: &str = env!("CARGO_PKG_VERSION"); -const ABOUT: &str = "Print value of a symbolic link or canonical file name"; +const ABOUT: &str = "Print value of a symbolic link or canonical file name."; const OPT_CANONICALIZE: &str = "canonicalize"; const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing"; const OPT_CANONICALIZE_EXISTING: &str = "canonicalize-existing"; -const OPT_ZERO: &str = "zero"; const OPT_NO_NEWLINE: &str = "no-newline"; const OPT_QUIET: &str = "quiet"; const OPT_SILENT: &str = "silent"; const OPT_VERBOSE: &str = "verbose"; -const OPT_FILES: &str = "files"; +const OPT_ZERO: &str = "zero"; + +const ARG_FILES: &str = "files"; fn get_usage() -> String { format!("{0} [OPTION]... [FILE]...", executable!()) @@ -98,7 +99,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_ZERO) .help("separate output with NUL rather than newline"), ) - .arg(Arg::with_name(OPT_FILES).multiple(true).takes_value(true)) + .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) .get_matches_from(args); let mut no_newline = matches.is_present(OPT_NO_NEWLINE); @@ -117,7 +118,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; let files: Vec = matches - .values_of(OPT_FILES) + .values_of(ARG_FILES) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); if files.is_empty() { From 75e1c517a0dd6e311fb68bca52eadcb281a9e633 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 25 Oct 2020 11:03:34 +0100 Subject: [PATCH 027/606] 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` --- src/uu/seq/src/seq.rs | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index 64a66d848..d531ffb12 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -13,14 +13,20 @@ use std::cmp; use std::io::{stdout, Write}; static VERSION: &str = env!("CARGO_PKG_VERSION"); -static ABOUT: &str = "Print sequences of numbers"; +static ABOUT: &str = "Display numbers from FIRST to LAST, in steps of INCREMENT."; static OPT_SEPARATOR: &str = "separator"; static OPT_TERMINATOR: &str = "terminator"; static OPT_WIDTHS: &str = "widths"; -static OPT_NUMBERS: &str = "numbers"; + +static ARG_NUMBERS: &str = "numbers"; fn get_usage() -> String { - format!("{0} [OPTION]... [FILE]...", executable!()) + format!( + "{0} [OPTION]... LAST + {0} [OPTION]... FIRST LAST + {0} [OPTION]... FIRST INCREMENT LAST", + executable!() + ) } #[derive(Clone)] struct SeqOptions { @@ -75,14 +81,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("Equalize widths of all numbers by padding with zeros"), ) .arg( - Arg::with_name(OPT_NUMBERS) + Arg::with_name(ARG_NUMBERS) .multiple(true) .takes_value(true) .max_values(3), ) .get_matches_from(args); - let numbers = matches.values_of(OPT_NUMBERS).unwrap().collect::>(); + let numbers = matches.values_of(ARG_NUMBERS).unwrap().collect::>(); let mut options = SeqOptions { separator: "\n".to_owned(), @@ -111,7 +117,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } else { 1.0 }; - let step = if numbers.len() > 2 { + let increment = if numbers.len() > 2 { let slice = &numbers[1][..]; let len = slice.len(); let dec = slice.find('.').unwrap_or(len); @@ -148,7 +154,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; print_seq( first, - step, + increment, last, largest_dec, separator, @@ -160,8 +166,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } -fn done_printing(next: f64, step: f64, last: f64) -> bool { - if step >= 0f64 { +fn done_printing(next: f64, increment: f64, last: f64) -> bool { + if increment >= 0f64 { next > last } else { next < last @@ -171,7 +177,7 @@ fn done_printing(next: f64, step: f64, last: f64) -> bool { #[allow(clippy::too_many_arguments)] fn print_seq( first: f64, - step: f64, + increment: f64, last: f64, largest_dec: usize, separator: String, @@ -180,8 +186,8 @@ fn print_seq( padding: usize, ) { let mut i = 0isize; - let mut value = first + i as f64 * step; - while !done_printing(value, step, last) { + let mut value = first + i as f64 * increment; + while !done_printing(value, increment, last) { let istr = format!("{:.*}", largest_dec, value); let ilen = istr.len(); let before_dec = istr.find('.').unwrap_or(ilen); @@ -192,12 +198,12 @@ fn print_seq( } print!("{}", istr); i += 1; - value = first + i as f64 * step; - if !done_printing(value, step, last) { + value = first + i as f64 * increment; + if !done_printing(value, increment, last) { print!("{}", separator); } } - if (first >= last && step < 0f64) || (first <= last && step > 0f64) { + if (first >= last && increment < 0f64) || (first <= last && increment > 0f64) { print!("{}", terminator); } crash_if_err!(1, stdout().flush()); From 58b0aeabee8cb137876cc2bcbf8fffb31a5cec6b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 18 Oct 2020 21:27:49 +0200 Subject: [PATCH 028/606] refactor(sort): move to clap --- Cargo.lock | 2 +- src/uu/sort/Cargo.toml | 2 +- src/uu/sort/src/sort.rs | 221 ++++++++++++++++++++++++---------------- 3 files changed, 138 insertions(+), 87 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 66fe84236..a0f89567f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2096,7 +2096,7 @@ dependencies = [ name = "uu_sort" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index c9e643cf3..fca462b04 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/sort.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" itertools = "0.8.0" semver = "0.9.0" uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["fs"] } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 11d243bba..18e94f4a6 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -8,13 +8,14 @@ // spell-checker:ignore (ToDO) outfile nondictionary -extern crate getopts; +extern crate clap; extern crate semver; extern crate itertools; #[macro_use] extern crate uucore; +use clap::{App, Arg}; use itertools::Itertools; use semver::Version; use std::cmp::Ordering; @@ -26,8 +27,23 @@ use std::path::Path; use uucore::fs::is_stdin_interactive; // for Iterator::dedup() static NAME: &str = "sort"; +static ABOUT: &str = "sort lines of text files"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +const OPT_NUMERIC_SORT: &str = "numeric-sort"; +const OPT_HUMAN_NUMERIC_SORT: &str = "human-numeric-sort"; +const OPT_MONTH_SORT: &str = "month-sort"; +const OPT_VERSION_SORT: &str = "version-sort"; +const OPT_OUTPUT: &str = "output"; +const OPT_FILES: &str = "files"; +const OPT_MERGE: &str = "merge"; +const OPT_REVERSE: &str = "reverse"; +const OPT_STABLE: &str = "stable"; +const OPT_UNIQUE: &str = "unique"; +const OPT_CHECK: &str = "check"; +const OPT_DICTIONARY_ORDER: &str = "dictionary-order"; +const OPT_IGNORE_CASE: &str = "ignore-case"; + const DECIMAL_PT: char = '.'; const THOUSANDS_SEP: char = ','; @@ -142,68 +158,9 @@ impl<'a> Iterator for FileMerger<'a> { } } } - -pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); - - let mut settings: Settings = Default::default(); - let mut opts = getopts::Options::new(); - - opts.optflag( - "d", - "dictionary-order", - "consider only blanks and alphanumeric characters", - ); - opts.optflag( - "f", - "ignore-case", - "fold lower case to upper case characters", - ); - opts.optflag( - "n", - "numeric-sort", - "compare according to string numerical value", - ); - opts.optflag( - "h", - "human-numeric-sort", - "compare according to human readable sizes, eg 1M > 100k", - ); - opts.optflag( - "M", - "month-sort", - "compare according to month name abbreviation", - ); - opts.optflag("r", "reverse", "reverse the output"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); - opts.optflag("m", "merge", "merge already sorted files; do not sort"); - opts.optopt( - "o", - "output", - "write output to FILENAME instead of stdout", - "FILENAME", - ); - opts.optflag( - "s", - "stable", - "stabilize sort by disabling last-resort comparison", - ); - opts.optflag("u", "unique", "output only the first of an equal run"); - opts.optflag( - "V", - "version-sort", - "Sort by SemVer version number, eg 1.12.2 > 1.1.2", - ); - opts.optflag("c", "check", "check for sorted input; do not sort"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f), - }; - if matches.opt_present("help") { - let msg = format!( - "{0} {1} +fn get_usage() -> String { + format!( + "{0} {1} Usage: {0} [OPTION]... [FILE]... @@ -213,44 +170,138 @@ Write the sorted concatenation of all FILE(s) to standard output. Mandatory arguments for long options are mandatory for short options too. With no FILE, or when FILE is -, read standard input.", - NAME, VERSION - ); - print!("{}", opts.usage(&msg)); - return 0; - } + NAME, VERSION + ) +} - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } +pub fn uumain(args: impl uucore::Args) -> i32 { + let args = args.collect_str(); + let usage = get_usage(); + let mut settings: Settings = Default::default(); - settings.mode = if matches.opt_present("numeric-sort") { + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_DICTIONARY_ORDER) + .short("d") + .long(OPT_DICTIONARY_ORDER) + .help("consider only blanks and alphanumeric characters"), + ) + .arg( + Arg::with_name(OPT_IGNORE_CASE) + .short("f") + .long(OPT_IGNORE_CASE) + .help("fold lower case to upper case characters"), + ) + .arg( + Arg::with_name(OPT_NUMERIC_SORT) + .short("n") + .long(OPT_NUMERIC_SORT) + .help("compare according to string numerical value"), + ) + .arg( + Arg::with_name(OPT_HUMAN_NUMERIC_SORT) + .short("h") + .long(OPT_HUMAN_NUMERIC_SORT) + .help("compare according to human readable sizes, eg 1M > 100k"), + ) + .arg( + Arg::with_name(OPT_MONTH_SORT) + .short("M") + .long(OPT_MONTH_SORT) + .help("compare according to month name abbreviation"), + ) + .arg( + Arg::with_name(OPT_REVERSE) + .short("r") + .long(OPT_REVERSE) + .help("reverse the output"), + ) + .arg( + Arg::with_name("h") + .long("help") + .help("display this help and exit"), + ) + .arg( + Arg::with_name("version") + .long("version") + .help("output version information and exit"), + ) + .arg( + Arg::with_name(OPT_MERGE) + .short("m") + .long(OPT_MERGE) + .help("merge already sorted files; do not sort"), + ) + .arg( + Arg::with_name(OPT_OUTPUT) + .short("o") + .long(OPT_OUTPUT) + .help("write output to FILENAME instead of stdout") + .takes_value(true) + .value_name("FILENAME"), + ) + .arg( + Arg::with_name(OPT_STABLE) + .short("s") + .long(OPT_STABLE) + .help("stabilize sort by disabling last-resort comparison"), + ) + .arg( + Arg::with_name(OPT_UNIQUE) + .short("u") + .long(OPT_UNIQUE) + .help("output only the first of an equal run"), + ) + .arg( + Arg::with_name(OPT_VERSION_SORT) + .short("V") + .long(OPT_VERSION_SORT) + .help("Sort by SemVer version number, eg 1.12.2 > 1.1.2"), + ) + .arg( + Arg::with_name(OPT_CHECK) + .short("c") + .long(OPT_CHECK) + .help("check for sorted input; do not sort"), + ) + .arg(Arg::with_name(OPT_FILES).multiple(true).takes_value(true)) + .get_matches_from(args); + + let mut files: Vec = matches + .values_of(OPT_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + + settings.mode = if matches.is_present(OPT_NUMERIC_SORT) { SortMode::Numeric - } else if matches.opt_present("human-numeric-sort") { + } else if matches.is_present(OPT_HUMAN_NUMERIC_SORT) { SortMode::HumanNumeric - } else if matches.opt_present("month-sort") { + } else if matches.is_present(OPT_MONTH_SORT) { SortMode::Month - } else if matches.opt_present("version-sort") { + } else if matches.is_present(OPT_VERSION_SORT) { SortMode::Version } else { SortMode::Default }; - settings.merge = matches.opt_present("merge"); - settings.reverse = matches.opt_present("reverse"); - settings.outfile = matches.opt_str("output"); - settings.stable = matches.opt_present("stable"); - settings.unique = matches.opt_present("unique"); - settings.check = matches.opt_present("check"); + settings.merge = matches.is_present(OPT_MERGE); + settings.reverse = matches.is_present(OPT_REVERSE); + settings.outfile = matches.value_of(OPT_OUTPUT).map(String::from); + settings.stable = matches.is_present(OPT_STABLE); + settings.unique = matches.is_present(OPT_UNIQUE); + settings.check = matches.is_present(OPT_CHECK); - if matches.opt_present("dictionary-order") { + if matches.is_present(OPT_DICTIONARY_ORDER) { settings.transform_fns.push(remove_nondictionary_chars); } - if matches.opt_present("ignore-case") { + if matches.is_present(OPT_IGNORE_CASE) { settings.transform_fns.push(|s| s.to_uppercase()); } - let mut files = matches.free; + //let mut files = matches.free; if files.is_empty() { /* if no file, default to stdin */ files.push("-".to_owned()); From bd339f142e756dee11dd4c7d50d67fc935477495 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 25 Oct 2020 17:07:17 +0100 Subject: [PATCH 029/606] Improve the "about" description Co-authored-by: Roy Ivy III --- src/uu/users/src/users.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/users/src/users.rs b/src/uu/users/src/users.rs index 446d1d753..cba83f778 100644 --- a/src/uu/users/src/users.rs +++ b/src/uu/users/src/users.rs @@ -18,7 +18,7 @@ use uucore::utmpx::*; use clap::{App, Arg}; -static ABOUT: &str = "Output who is currently logged in according to FILE."; +static ABOUT: &str = "Display who is currently logged in, according to FILE."; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ARG_FILES: &str = "files"; From 7fb5aaa10831a622c71f222c475e6dc0ac2fb72e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 25 Oct 2020 17:07:32 +0100 Subject: [PATCH 030/606] only one file is allowed Co-authored-by: Roy Ivy III --- src/uu/users/src/users.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/users/src/users.rs b/src/uu/users/src/users.rs index cba83f778..4b4cdbeeb 100644 --- a/src/uu/users/src/users.rs +++ b/src/uu/users/src/users.rs @@ -24,7 +24,7 @@ static VERSION: &str = env!("CARGO_PKG_VERSION"); static ARG_FILES: &str = "files"; fn get_usage() -> String { - format!("{0} [FILE]...", executable!()) + format!("{0} [FILE]", executable!()) } pub fn uumain(args: impl uucore::Args) -> i32 { From dc4eb7932917b66b967be2cdc154d70e27296949 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 22 Oct 2020 23:31:04 +0200 Subject: [PATCH 031/606] 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 --- src/uu/sort/src/sort.rs | 130 +++++++++++++++++++--------------------- 1 file changed, 62 insertions(+), 68 deletions(-) diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 18e94f4a6..5e88c7d3b 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -27,25 +27,27 @@ use std::path::Path; use uucore::fs::is_stdin_interactive; // for Iterator::dedup() static NAME: &str = "sort"; -static ABOUT: &str = "sort lines of text files"; +static ABOUT: &str = "Display sorted concatenation of all FILE(s)."; static VERSION: &str = env!("CARGO_PKG_VERSION"); -const OPT_NUMERIC_SORT: &str = "numeric-sort"; -const OPT_HUMAN_NUMERIC_SORT: &str = "human-numeric-sort"; -const OPT_MONTH_SORT: &str = "month-sort"; -const OPT_VERSION_SORT: &str = "version-sort"; -const OPT_OUTPUT: &str = "output"; -const OPT_FILES: &str = "files"; -const OPT_MERGE: &str = "merge"; -const OPT_REVERSE: &str = "reverse"; -const OPT_STABLE: &str = "stable"; -const OPT_UNIQUE: &str = "unique"; -const OPT_CHECK: &str = "check"; -const OPT_DICTIONARY_ORDER: &str = "dictionary-order"; -const OPT_IGNORE_CASE: &str = "ignore-case"; +static OPT_HUMAN_NUMERIC_SORT: &str = "human-numeric-sort"; +static OPT_MONTH_SORT: &str = "month-sort"; +static OPT_NUMERIC_SORT: &str = "numeric-sort"; +static OPT_VERSION_SORT: &str = "version-sort"; -const DECIMAL_PT: char = '.'; -const THOUSANDS_SEP: char = ','; +static OPT_DICTIONARY_ORDER: &str = "dictionary-order"; +static OPT_MERGE: &str = "merge"; +static OPT_CHECK: &str = "check"; +static OPT_IGNORE_CASE: &str = "ignore-case"; +static OPT_OUTPUT: &str = "output"; +static OPT_REVERSE: &str = "reverse"; +static OPT_STABLE: &str = "stable"; +static OPT_UNIQUE: &str = "unique"; + +static ARG_FILES: &str = "files"; + +static DECIMAL_PT: char = '.'; +static THOUSANDS_SEP: char = ','; enum SortMode { Numeric, @@ -183,24 +185,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .version(VERSION) .about(ABOUT) .usage(&usage[..]) - .arg( - Arg::with_name(OPT_DICTIONARY_ORDER) - .short("d") - .long(OPT_DICTIONARY_ORDER) - .help("consider only blanks and alphanumeric characters"), - ) - .arg( - Arg::with_name(OPT_IGNORE_CASE) - .short("f") - .long(OPT_IGNORE_CASE) - .help("fold lower case to upper case characters"), - ) - .arg( - Arg::with_name(OPT_NUMERIC_SORT) - .short("n") - .long(OPT_NUMERIC_SORT) - .help("compare according to string numerical value"), - ) .arg( Arg::with_name(OPT_HUMAN_NUMERIC_SORT) .short("h") @@ -214,20 +198,22 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("compare according to month name abbreviation"), ) .arg( - Arg::with_name(OPT_REVERSE) - .short("r") - .long(OPT_REVERSE) - .help("reverse the output"), + Arg::with_name(OPT_NUMERIC_SORT) + .short("n") + .long(OPT_NUMERIC_SORT) + .help("compare according to string numerical value"), ) .arg( - Arg::with_name("h") - .long("help") - .help("display this help and exit"), + Arg::with_name(OPT_VERSION_SORT) + .short("V") + .long(OPT_VERSION_SORT) + .help("Sort by SemVer version number, eg 1.12.2 > 1.1.2"), ) .arg( - Arg::with_name("version") - .long("version") - .help("output version information and exit"), + Arg::with_name(OPT_DICTIONARY_ORDER) + .short("d") + .long(OPT_DICTIONARY_ORDER) + .help("consider only blanks and alphanumeric characters"), ) .arg( Arg::with_name(OPT_MERGE) @@ -235,6 +221,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_MERGE) .help("merge already sorted files; do not sort"), ) + .arg( + Arg::with_name(OPT_CHECK) + .short("c") + .long(OPT_CHECK) + .help("check for sorted input; do not sort"), + ) + .arg( + Arg::with_name(OPT_IGNORE_CASE) + .short("f") + .long(OPT_IGNORE_CASE) + .help("fold lower case to upper case characters"), + ) .arg( Arg::with_name(OPT_OUTPUT) .short("o") @@ -243,6 +241,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .value_name("FILENAME"), ) + .arg( + Arg::with_name(OPT_REVERSE) + .short("r") + .long(OPT_REVERSE) + .help("reverse the output"), + ) .arg( Arg::with_name(OPT_STABLE) .short("s") @@ -255,52 +259,42 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_UNIQUE) .help("output only the first of an equal run"), ) - .arg( - Arg::with_name(OPT_VERSION_SORT) - .short("V") - .long(OPT_VERSION_SORT) - .help("Sort by SemVer version number, eg 1.12.2 > 1.1.2"), - ) - .arg( - Arg::with_name(OPT_CHECK) - .short("c") - .long(OPT_CHECK) - .help("check for sorted input; do not sort"), - ) - .arg(Arg::with_name(OPT_FILES).multiple(true).takes_value(true)) + .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) .get_matches_from(args); let mut files: Vec = matches - .values_of(OPT_FILES) + .values_of(ARG_FILES) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); - settings.mode = if matches.is_present(OPT_NUMERIC_SORT) { - SortMode::Numeric - } else if matches.is_present(OPT_HUMAN_NUMERIC_SORT) { + settings.mode = if matches.is_present(OPT_HUMAN_NUMERIC_SORT) { SortMode::HumanNumeric } else if matches.is_present(OPT_MONTH_SORT) { SortMode::Month + } else if matches.is_present(OPT_NUMERIC_SORT) { + SortMode::Numeric } else if matches.is_present(OPT_VERSION_SORT) { SortMode::Version } else { SortMode::Default }; - settings.merge = matches.is_present(OPT_MERGE); - settings.reverse = matches.is_present(OPT_REVERSE); - settings.outfile = matches.value_of(OPT_OUTPUT).map(String::from); - settings.stable = matches.is_present(OPT_STABLE); - settings.unique = matches.is_present(OPT_UNIQUE); - settings.check = matches.is_present(OPT_CHECK); - if matches.is_present(OPT_DICTIONARY_ORDER) { settings.transform_fns.push(remove_nondictionary_chars); } + + settings.merge = matches.is_present(OPT_MERGE); + settings.check = matches.is_present(OPT_CHECK); + if matches.is_present(OPT_IGNORE_CASE) { settings.transform_fns.push(|s| s.to_uppercase()); } + settings.outfile = matches.value_of(OPT_OUTPUT).map(String::from); + settings.reverse = matches.is_present(OPT_REVERSE); + settings.stable = matches.is_present(OPT_STABLE); + settings.unique = matches.is_present(OPT_UNIQUE); + //let mut files = matches.free; if files.is_empty() { /* if no file, default to stdin */ From 17a99f8e5343adcd10581cc5c7fa111fe973eb58 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 25 Oct 2020 21:54:04 +0100 Subject: [PATCH 032/606] refactor(printenv): use clap instead of getopts --- Cargo.lock | 14 +++--- src/uu/printenv/Cargo.toml | 2 +- src/uu/printenv/src/printenv.rs | 86 ++++++++++++++++----------------- 3 files changed, 50 insertions(+), 52 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 66fe84236..ff0672eb3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1202,7 +1202,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1260,7 +1260,7 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.46" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1966,7 +1966,7 @@ dependencies = [ name = "uu_printenv" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -2398,7 +2398,7 @@ source = "git+https://github.com/uutils/uucore.git?branch=canary#869573459f00ba0 dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2450,7 +2450,7 @@ dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2470,7 +2470,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2684,7 +2684,7 @@ dependencies = [ "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad5de3220ea04da322618ded2c42233d02baca219d6f160a3e9c87cda16c942" +"checksum syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index d3c4376a6..68db1b689 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/printenv.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } diff --git a/src/uu/printenv/src/printenv.rs b/src/uu/printenv/src/printenv.rs index 16dd6f0b0..cef1c2458 100644 --- a/src/uu/printenv/src/printenv.rs +++ b/src/uu/printenv/src/printenv.rs @@ -7,69 +7,67 @@ /* last synced with: printenv (GNU coreutils) 8.13 */ -extern crate getopts; +extern crate clap; #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::env; -static NAME: &str = "printenv"; +static ABOUT: &str = "Prints the given environment VARIABLE(s), otherwise prints them all."; static VERSION: &str = env!("CARGO_PKG_VERSION"); -pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); +static OPT_NULL: &str = "null"; - let mut opts = getopts::Options::new(); - opts.optflag( - "0", - "null", - "end each output line with 0 byte rather than newline", - ); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f), - }; - if matches.opt_present("help") { - let msg = format!( - "{0} {1} +static ARG_VARIABLES: &str = "variables"; -Usage: - {0} [VARIABLE]... [OPTION]... - -Prints the given environment VARIABLE(s), otherwise prints them all.", - NAME, VERSION - ); - print!("{}", opts.usage(&msg)); - return 0; - } - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - let mut separator = "\n"; - if matches.opt_present("null") { - separator = "\x00"; - }; - - exec(matches.free, separator); - - 0 +fn get_usage() -> String { + format!("{0} [VARIABLE]... [OPTION]...", executable!()) } -pub fn exec(args: Vec, separator: &str) { - if args.is_empty() { +pub fn uumain(args: impl uucore::Args) -> i32 { + let usage = get_usage(); + + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_NULL) + .short("0") + .long(OPT_NULL) + .help("end each output line with 0 byte rather than newline"), + ) + .arg( + Arg::with_name(ARG_VARIABLES) + .multiple(true) + .takes_value(true) + .min_values(1), + ) + .get_matches_from(args); + + let variables: Vec = matches + .values_of(ARG_VARIABLES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + + let mut separator = "\n"; + if matches.is_present(OPT_NULL) { + separator = "\x00"; + } + + if variables.is_empty() { for (env_var, value) in env::vars() { print!("{}={}{}", env_var, value, separator); } - return; + return 0; } - for env_var in &args { + for env_var in variables { if let Ok(var) = env::var(env_var) { print!("{}{}", var, separator); } } + 0 } From af151703b3a94ed345cc1376137b266052bb597d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 25 Oct 2020 21:30:37 +0100 Subject: [PATCH 033/606] refactor(rmdir): use clap instead of getopts --- Cargo.lock | 14 ++--- src/uu/rmdir/Cargo.toml | 2 +- src/uu/rmdir/src/rmdir.rs | 106 ++++++++++++++++++++------------------ 3 files changed, 64 insertions(+), 58 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 66fe84236..358272414 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1202,7 +1202,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1260,7 +1260,7 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.46" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2046,7 +2046,7 @@ dependencies = [ name = "uu_rmdir" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -2398,7 +2398,7 @@ source = "git+https://github.com/uutils/uucore.git?branch=canary#869573459f00ba0 dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2450,7 +2450,7 @@ dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2470,7 +2470,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2684,7 +2684,7 @@ dependencies = [ "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad5de3220ea04da322618ded2c42233d02baca219d6f160a3e9c87cda16c942" +"checksum syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index 1a8705d7c..2c1c15862 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/rmdir.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index 65ea630d1..b551060bd 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -5,69 +5,75 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -extern crate getopts; +extern crate clap; #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs; use std::path::Path; -static NAME: &str = "rmdir"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Remove the DIRECTORY(ies), if they are empty."; +static OPT_IGNORE_FAIL_NON_EMPTY: &str = "ignore-fail-on-non-empty"; +static OPT_PARENTS: &str = "parents"; +static OPT_VERBOSE: &str = "verbose"; + +static ARG_DIRS: &str = "dirs"; + +fn get_usage() -> String { + format!("{0} [OPTION]... DIRECTORY...", executable!()) +} pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_IGNORE_FAIL_NON_EMPTY) + .long(OPT_IGNORE_FAIL_NON_EMPTY) + .help("ignore each failure that is solely because a directory is non-empty"), + ) + .arg( + Arg::with_name(OPT_PARENTS) + .short("p") + .long(OPT_PARENTS) + .help( + "remove DIRECTORY and its ancestors; e.g., + 'rmdir -p a/b/c' is similar to rmdir a/b/c a/b a", + ), + ) + .arg( + Arg::with_name(OPT_VERBOSE) + .short("v") + .long(OPT_VERBOSE) + .help("output a diagnostic for every directory processed"), + ) + .arg( + Arg::with_name(ARG_DIRS) + .multiple(true) + .takes_value(true) + .min_values(1) + .required(true), + ) + .get_matches_from(args); - opts.optflag( - "", - "ignore-fail-on-non-empty", - "ignore each failure that is solely because a directory is non-empty", - ); - opts.optflag("p", "parents", "remove DIRECTORY and its ancestors; e.g., 'rmdir -p a/b/c' is similar to rmdir a/b/c a/b a"); - opts.optflag( - "v", - "verbose", - "output a diagnostic for every directory processed", - ); - opts.optflag("h", "help", "print this help and exit"); - opts.optflag("V", "version", "output version information and exit"); + let dirs: Vec = matches + .values_of(ARG_DIRS) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - return 1; - } - }; + let ignore = matches.is_present(OPT_IGNORE_FAIL_NON_EMPTY); + let parents = matches.is_present(OPT_PARENTS); + let verbose = matches.is_present(OPT_VERBOSE); - if matches.opt_present("help") { - let msg = format!( - "{0} {1} - -Usage: - {0} [OPTION]... DIRECTORY... - -Remove the DIRECTORY(ies), if they are empty.", - NAME, VERSION - ); - print!("{}", opts.usage(&msg)); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else if matches.free.is_empty() { - show_error!("missing an argument"); - show_error!("for help, try '{0} --help'", NAME); - return 1; - } else { - let ignore = matches.opt_present("ignore-fail-on-non-empty"); - let parents = matches.opt_present("parents"); - let verbose = matches.opt_present("verbose"); - match remove(matches.free, ignore, parents, verbose) { - Ok(()) => ( /* pass */ ), - Err(e) => return e, - } + match remove(dirs, ignore, parents, verbose) { + Ok(()) => ( /* pass */ ), + Err(e) => return e, } 0 @@ -115,7 +121,7 @@ fn remove_dir(path: &Path, ignore: bool, verbose: bool) -> Result<(), i32> { show_error!("removing directory '{}': {}", path.display(), e); r = Err(1); } - Ok(_) if verbose => println!("Removed directory '{}'", path.display()), + Ok(_) if verbose => println!("removing directory, '{}'", path.display()), _ => (), } } else if !ignore { From 6158cd57147f2e6e451989354d9a4e17606825d3 Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 29 Jul 2020 19:39:50 +0200 Subject: [PATCH 034/606] factor: Introduce a type alias for exponents This way, we can easily replace u8 with a larger type when moving to support larger integers. --- src/uu/factor/src/factor.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 4e5322084..6a7f688ac 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -61,6 +61,9 @@ impl PartialEq for Decomposition { true } +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct Factors { + f: BTreeMap, } impl Eq for Decomposition {} From b8ef58c0023a9bb608756a815738fb07b0e852d8 Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 29 Jul 2020 19:47:44 +0200 Subject: [PATCH 035/606] factor::Factors: Split off a Decomposition type The new type can be used to represent in-progress factorisations, which contain non-prime factors. --- src/uu/factor/src/factor.rs | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 6a7f688ac..d26315172 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -62,22 +62,42 @@ impl PartialEq for Decomposition { true } #[derive(Clone, Debug, Eq, PartialEq)] -pub struct Factors { - f: BTreeMap, +struct Decomposition(BTreeMap); + +impl Decomposition { + fn one() -> Decomposition { + Decomposition(BTreeMap::new()) + } + + fn add(&mut self, factor: u64, exp: Exponent) { + debug_assert!(exp > 0); + let n = *self.0.get(&factor).unwrap_or(&0); + self.0.insert(factor, exp + n); + } + + #[cfg(test)] + fn product(&self) -> u64 { + self.0 + .iter() + .fold(1, |acc, (p, exp)| acc * p.pow(*exp as u32)) + } } impl Eq for Decomposition {} #[derive(Clone, Debug, Eq, PartialEq)] pub struct Factors(RefCell); +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct Factors(Decomposition); + impl Factors { pub fn one() -> Factors { - Factors(RefCell::new(Decomposition::one())) + Factors(Decomposition::one()) } pub fn add(&mut self, prime: u64, exp: Exponent) { debug_assert!(miller_rabin::is_prime(prime)); - self.0.borrow_mut().add(prime, exp) + self.0.add(prime, exp) } pub fn push(&mut self, prime: u64) { @@ -86,16 +106,13 @@ impl Factors { #[cfg(test)] fn product(&self) -> u64 { - self.0.borrow().product() + self.0.product() } } impl fmt::Display for Factors { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let v = &mut (self.0).borrow_mut().0; - v.sort_unstable(); - - for (p, exp) in v.iter() { + for (p, exp) in (self.0).0.iter() { for _ in 0..*exp { write!(f, " {}", p)? } From 30f9cf32f29763dded7faa721f6efcfecc60b3ab Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 29 Jul 2020 20:38:07 +0200 Subject: [PATCH 036/606] factor::Decomposition: Use a flat vector representation ~18% faster than BTreeMap, and ~5% faster than 'master' --- src/uu/factor/src/factor.rs | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index d26315172..07cad8434 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -7,7 +7,6 @@ extern crate rand; -use std::cell::RefCell; use std::fmt; use crate::numeric::{Arithmetic, Montgomery}; @@ -61,32 +60,9 @@ impl PartialEq for Decomposition { true } -#[derive(Clone, Debug, Eq, PartialEq)] -struct Decomposition(BTreeMap); - -impl Decomposition { - fn one() -> Decomposition { - Decomposition(BTreeMap::new()) - } - - fn add(&mut self, factor: u64, exp: Exponent) { - debug_assert!(exp > 0); - let n = *self.0.get(&factor).unwrap_or(&0); - self.0.insert(factor, exp + n); - } - - #[cfg(test)] - fn product(&self) -> u64 { - self.0 - .iter() - .fold(1, |acc, (p, exp)| acc * p.pow(*exp as u32)) - } } impl Eq for Decomposition {} -#[derive(Clone, Debug, Eq, PartialEq)] -pub struct Factors(RefCell); - #[derive(Clone, Debug, Eq, PartialEq)] pub struct Factors(Decomposition); @@ -112,7 +88,10 @@ impl Factors { impl fmt::Display for Factors { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - for (p, exp) in (self.0).0.iter() { + let mut v = (self.0).0.clone(); + v.sort_unstable(); + + for (p, exp) in v.iter() { for _ in 0..*exp { write!(f, " {}", p)? } From 8643489096af2ce3e5440cf10bccb9b37cc901a0 Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 29 Jul 2020 20:45:45 +0200 Subject: [PATCH 037/606] factor::Factors: Use a RefCell rather than copy data when printing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ~2.9% faster than the previous commit, ~11% faster than “master” overall. --- src/uu/factor/src/factor.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 07cad8434..4e5322084 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -7,6 +7,7 @@ extern crate rand; +use std::cell::RefCell; use std::fmt; use crate::numeric::{Arithmetic, Montgomery}; @@ -64,16 +65,16 @@ impl PartialEq for Decomposition { impl Eq for Decomposition {} #[derive(Clone, Debug, Eq, PartialEq)] -pub struct Factors(Decomposition); +pub struct Factors(RefCell); impl Factors { pub fn one() -> Factors { - Factors(Decomposition::one()) + Factors(RefCell::new(Decomposition::one())) } pub fn add(&mut self, prime: u64, exp: Exponent) { debug_assert!(miller_rabin::is_prime(prime)); - self.0.add(prime, exp) + self.0.borrow_mut().add(prime, exp) } pub fn push(&mut self, prime: u64) { @@ -82,13 +83,13 @@ impl Factors { #[cfg(test)] fn product(&self) -> u64 { - self.0.product() + self.0.borrow().product() } } impl fmt::Display for Factors { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let mut v = (self.0).0.clone(); + let v = &mut (self.0).borrow_mut().0; v.sort_unstable(); for (p, exp) in v.iter() { From 3743a3e1e7a87bdd0ea7b923dc42386bfc14ccd5 Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 29 Jul 2020 20:27:54 +0200 Subject: [PATCH 038/606] factor: Derecursify and refactor ~7% slowdown, paves the way for upcoming improvements --- src/uu/factor/src/factor.rs | 89 ++++++++++++++++++++++--------------- src/uu/factor/src/table.rs | 5 ++- 2 files changed, 55 insertions(+), 39 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 4e5322084..dfe6e9f1a 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -33,7 +33,14 @@ impl Decomposition { } } - #[cfg(test)] + fn is_one(&self) -> bool { + self.0.is_empty() + } + + fn pop(&mut self) -> Option<(u64, Exponent)> { + self.0.pop() + } + fn product(&self) -> u64 { self.0 .iter() @@ -77,11 +84,11 @@ impl Factors { self.0.borrow_mut().add(prime, exp) } + #[cfg(test)] pub fn push(&mut self, prime: u64) { self.add(prime, 1) } - #[cfg(test)] fn product(&self) -> u64 { self.0.borrow().product() } @@ -102,62 +109,70 @@ impl fmt::Display for Factors { } } -fn _factor(num: u64, f: Factors) -> Factors { +fn _find_factor(num: u64) -> Option { use miller_rabin::Result::*; - // Shadow the name, so the recursion automatically goes from “Big” arithmetic to small. - let _factor = |n, f| { - if n < (1 << 32) { - _factor::>(n, f) - } else { - _factor::(n, f) - } - }; - - if num == 1 { - return f; - } - let n = A::new(num); - let divisor = match miller_rabin::test::(n) { - Prime => { - let mut r = f; - r.push(num); - return r; - } - - Composite(d) => d, - Pseudoprime => rho::find_divisor::(n), - }; - - let f = _factor(divisor, f); - _factor(num / divisor, f) + match miller_rabin::test::(n) { + Prime => None, + Composite(d) => Some(d), + Pseudoprime => Some(rho::find_divisor::(n)), + } } -pub fn factor(mut n: u64) -> Factors { +fn find_factor(num: u64) -> Option { + if num < (1 << 32) { + _find_factor::>(num) + } else { + _find_factor::>(num) + } +} + +pub fn factor(num: u64) -> Factors { let mut factors = Factors::one(); - if n < 2 { + if num < 2 { return factors; } - let z = n.trailing_zeros(); + let mut n = num; + let z = num.trailing_zeros(); if z > 0 { factors.add(2, z as Exponent); n >>= z; } + debug_assert_eq!(num, n * factors.product()); if n == 1 { return factors; } - let (factors, n) = table::factor(n, factors); + table::factor(&mut n, &mut factors); + debug_assert_eq!(num, n * factors.product()); - if n < (1 << 32) { - _factor::>(n, factors) - } else { - _factor::>(n, factors) + if n == 1 { + return factors; } + + let mut dec = Decomposition::one(); + dec.add(n, 1); + + while !dec.is_one() { + // Check correctness invariant + debug_assert_eq!(num, factors.product() * dec.product()); + + let (f, e) = dec.pop().unwrap(); + + if let Some(d) = find_factor(f) { + dec.add(f / d, e); + dec.add(d, e); + } else { + // f is prime + factors.add(f, e); + } + } + + factors } #[cfg(test)] diff --git a/src/uu/factor/src/table.rs b/src/uu/factor/src/table.rs index d6ef796fc..b62e801cb 100644 --- a/src/uu/factor/src/table.rs +++ b/src/uu/factor/src/table.rs @@ -14,7 +14,8 @@ use crate::Factors; include!(concat!(env!("OUT_DIR"), "/prime_table.rs")); -pub(crate) fn factor(mut num: u64, mut factors: Factors) -> (Factors, u64) { +pub(crate) fn factor(n: &mut u64, factors: &mut Factors) { + let mut num = *n; for &(prime, inv, ceil) in P_INVS_U64 { if num == 1 { break; @@ -42,5 +43,5 @@ pub(crate) fn factor(mut num: u64, mut factors: Factors) -> (Factors, u64) { } } - (factors, num) + *n = num; } From ce218e01b6fcfadf4a9e55348d98f36dafff6c6b Mon Sep 17 00:00:00 2001 From: nicoo Date: Fri, 31 Jul 2020 14:59:52 +0200 Subject: [PATCH 039/606] factor: Ensure we only need to find every single factor once [WiP] ~17% faster, many optimisation opportunities still missed >:) --- src/uu/factor/src/factor.rs | 40 ++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index dfe6e9f1a..3f0f73c9b 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -10,7 +10,7 @@ extern crate rand; use std::cell::RefCell; use std::fmt; -use crate::numeric::{Arithmetic, Montgomery}; +use crate::numeric::{gcd, Arithmetic, Montgomery}; use crate::{miller_rabin, rho, table}; type Exponent = u8; @@ -164,8 +164,42 @@ pub fn factor(num: u64) -> Factors { let (f, e) = dec.pop().unwrap(); if let Some(d) = find_factor(f) { - dec.add(f / d, e); - dec.add(d, e); + let mut gcd_queue = Decomposition::one(); + gcd_queue.add(d, e); + gcd_queue.add(f / d, e); + + let mut non_trivial_gcd = true; + while non_trivial_gcd { + debug_assert_eq!(f, gcd_queue.product()); + + let mut tmp = Decomposition::one(); + non_trivial_gcd = false; + for i in 0..gcd_queue.0.len() - 1 { + let (a, e_a) = gcd_queue.0[i]; + let (b, e_b) = gcd_queue.0[i + 1]; + + let g = gcd(a, b); + if g != 1 { + non_trivial_gcd = true; + tmp.add(a / g, e_a); + tmp.add(g, e_a + e_b); + if i + 1 == gcd_queue.0.len() { + tmp.add(b / g, e_b) + } else { + gcd_queue.0[i + 1] = (b / g, e_b); + } + } else { + tmp.add(a, e_a); + if i + 1 == gcd_queue.0.len() - 1 { + tmp.add(b, e_b) + } + } + } + gcd_queue = tmp; + } + + debug_assert_eq!(f, gcd_queue.product()); + dec.0.extend(gcd_queue.0); } else { // f is prime factors.add(f, e); From b7b0c76b8ea60297b43777d17d7322d1d45a9e91 Mon Sep 17 00:00:00 2001 From: nicoo Date: Fri, 31 Jul 2020 15:03:27 +0200 Subject: [PATCH 040/606] factor::Decomposition: Optimise as a factor is never added twice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/uu/factor/src/factor.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 3f0f73c9b..7dc4b90d9 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -25,12 +25,10 @@ impl Decomposition { fn add(&mut self, factor: u64, exp: Exponent) { debug_assert!(exp > 0); + // Assert the factor doesn't already exist in the Decomposition object + debug_assert_eq!(self.0.iter_mut().find(|(f, _)| *f == factor), None); - if let Some((_, e)) = self.0.iter_mut().find(|(f, _)| *f == factor) { - *e += exp; - } else { - self.0.push((factor, exp)) - } + self.0.push((factor, exp)) } fn is_one(&self) -> bool { From 78ae0cca31074b0f7fecf43de8023b958b1b336c Mon Sep 17 00:00:00 2001 From: nicoo Date: Sun, 9 Aug 2020 17:23:57 +0200 Subject: [PATCH 041/606] factor: Slightly refactor main loop, fix bug --- src/uu/factor/src/factor.rs | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 7dc4b90d9..f6da886a1 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -173,24 +173,30 @@ pub fn factor(num: u64) -> Factors { let mut tmp = Decomposition::one(); non_trivial_gcd = false; for i in 0..gcd_queue.0.len() - 1 { - let (a, e_a) = gcd_queue.0[i]; - let (b, e_b) = gcd_queue.0[i + 1]; + let (mut a, e_a) = gcd_queue.0[i]; + let (mut b, e_b) = gcd_queue.0[i + 1]; + + if a == 1 { + continue; + } let g = gcd(a, b); if g != 1 { non_trivial_gcd = true; - tmp.add(a / g, e_a); - tmp.add(g, e_a + e_b); - if i + 1 == gcd_queue.0.len() { - tmp.add(b / g, e_b) - } else { - gcd_queue.0[i + 1] = (b / g, e_b); - } - } else { + a /= g; + b /= g; + } + if a != 1 { tmp.add(a, e_a); - if i + 1 == gcd_queue.0.len() - 1 { - tmp.add(b, e_b) - } + } + if g != 1 { + tmp.add(g, e_a + e_b); + } + + if i + 1 != gcd_queue.0.len() - 1 { + gcd_queue.0[i + 1].0 = b; + } else if b != 1 { + tmp.add(b, e_b); } } gcd_queue = tmp; From 0d39732300332e15dd0b1a87b351b0971cfada57 Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 29 Jul 2020 20:51:05 +0200 Subject: [PATCH 042/606] factor::Decomposition: Inline a small number (4) of factors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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”. --- Cargo.lock | 7 +++++++ src/uu/factor/Cargo.toml | 1 + src/uu/factor/src/factor.rs | 10 ++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6b54012e6..74216eefa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1243,6 +1243,11 @@ dependencies = [ "generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "smallvec" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "strsim" version = "0.8.0" @@ -1639,6 +1644,7 @@ dependencies = [ "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -2682,6 +2688,7 @@ dependencies = [ "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" +"checksum smallvec 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index c4dbc96cc..a37ee5249 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -18,6 +18,7 @@ num-traits = "0.2" # used in src/numerics.rs, which is included by build.rs [dependencies] num-traits = "0.2" rand = { version="0.7", features=["small_rng"] } +smallvec = { version="0.6.13, < 1.0" } uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index f6da886a1..b6a38ab79 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -7,6 +7,7 @@ extern crate rand; +use smallvec::SmallVec; use std::cell::RefCell; use std::fmt; @@ -16,11 +17,16 @@ use crate::{miller_rabin, rho, table}; type Exponent = u8; #[derive(Clone, Debug)] -struct Decomposition(Vec<(u64, Exponent)>); +struct Decomposition(SmallVec<[(u64, Exponent); NUM_FACTORS_INLINE]>); + +// The number of factors to inline directly into a `Decomposition` object. +// As a consequence of the Erdős–Kac theorem, the average number of prime +// factors of integers < 10²⁵ ≃ 2⁸³ is 4, so we can use that value. +const NUM_FACTORS_INLINE: usize = 4; impl Decomposition { fn one() -> Decomposition { - Decomposition(Vec::new()) + Decomposition(SmallVec::new()) } fn add(&mut self, factor: u64, exp: Exponent) { From 3bb3080170a981520176ed8f84f2118a1de76895 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 7 Oct 2020 21:21:14 -0500 Subject: [PATCH 043/606] factor/refactor ~ fix `cargo clippy` complaints (allow many_single_char_names) --- src/uu/factor/src/factor.rs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index b6a38ab79..ef34af030 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -140,10 +140,10 @@ pub fn factor(num: u64) -> Factors { } let mut n = num; - let z = num.trailing_zeros(); - if z > 0 { - factors.add(2, z as Exponent); - n >>= z; + let n_zeros = num.trailing_zeros(); + if n_zeros > 0 { + factors.add(2, n_zeros as Exponent); + n >>= n_zeros; } debug_assert_eq!(num, n * factors.product()); @@ -165,22 +165,22 @@ pub fn factor(num: u64) -> Factors { // Check correctness invariant debug_assert_eq!(num, factors.product() * dec.product()); - let (f, e) = dec.pop().unwrap(); + let (factor, exp) = dec.pop().unwrap(); - if let Some(d) = find_factor(f) { + if let Some(divisor) = find_factor(factor) { let mut gcd_queue = Decomposition::one(); - gcd_queue.add(d, e); - gcd_queue.add(f / d, e); + gcd_queue.add(divisor, exp); + gcd_queue.add(factor / divisor, exp); let mut non_trivial_gcd = true; while non_trivial_gcd { - debug_assert_eq!(f, gcd_queue.product()); + debug_assert_eq!(factor, gcd_queue.product()); let mut tmp = Decomposition::one(); non_trivial_gcd = false; for i in 0..gcd_queue.0.len() - 1 { - let (mut a, e_a) = gcd_queue.0[i]; - let (mut b, e_b) = gcd_queue.0[i + 1]; + let (mut a, exp_a) = gcd_queue.0[i]; + let (mut b, exp_b) = gcd_queue.0[i + 1]; if a == 1 { continue; @@ -193,26 +193,26 @@ pub fn factor(num: u64) -> Factors { b /= g; } if a != 1 { - tmp.add(a, e_a); + tmp.add(a, exp_a); } if g != 1 { - tmp.add(g, e_a + e_b); + tmp.add(g, exp_a + exp_b); } if i + 1 != gcd_queue.0.len() - 1 { gcd_queue.0[i + 1].0 = b; } else if b != 1 { - tmp.add(b, e_b); + tmp.add(b, exp_b); } } gcd_queue = tmp; } - debug_assert_eq!(f, gcd_queue.product()); + debug_assert_eq!(factor, gcd_queue.product()); dec.0.extend(gcd_queue.0); } else { - // f is prime - factors.add(f, e); + // factor is prime + factors.add(factor, exp); } } From 2615abe9cc7ef9f866a223448cc65a16a0f2b884 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 7 Oct 2020 22:01:09 -0500 Subject: [PATCH 044/606] tests/factor ~ update RNG usage and variable reports to ease debugging --- Cargo.toml | 2 +- tests/by-util/test_factor.rs | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7a5965107..0f2b63cb5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -331,7 +331,7 @@ pin_winapi-util = { version="0.1.2, < 0.1.3", package="winapi-util" } ## winapi- [dev-dependencies] filetime = "0.2" libc = "0.2" -rand = "0.6" +rand = "0.7" regex = "1.0" tempfile = "3.1" time = "0.1" diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index 358f38fd3..d0eaebac8 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -6,6 +6,7 @@ // that was distributed with this source code. use crate::common::util::*; +use std::time::SystemTime; #[path = "../../src/uu/factor/sieve.rs"] mod sieve; @@ -13,7 +14,7 @@ use self::sieve::Sieve; extern crate rand; use self::rand::distributions::{Distribution, Uniform}; -use self::rand::{rngs::SmallRng, FromEntropy, Rng}; +use self::rand::{rngs::SmallRng, Rng, SeedableRng}; const NUM_PRIMES: usize = 10000; const LOG_PRIMES: f64 = 14.0; // ceil(log2(NUM_PRIMES)) @@ -24,8 +25,13 @@ const NUM_TESTS: usize = 100; fn test_random() { let primes = Sieve::primes().take(NUM_PRIMES).collect::>(); - let mut rng = SmallRng::from_entropy(); - println!("(seed) rng={:?}", rng); + let rng_seed = SystemTime::now() + .duration_since(SystemTime::UNIX_EPOCH) + .unwrap() + .as_secs(); + println!("rng_seed={:?}", rng_seed); + + let mut rng = SmallRng::seed_from_u64(rng_seed); let mut rand_gt = move |min: u64| { let mut product = 1u64; let mut factors = Vec::new(); @@ -73,8 +79,12 @@ fn test_random() { #[test] fn test_random_big() { - let mut rng = SmallRng::from_entropy(); - println!("(seed) rng={:?}", rng); + let rng_seed = SystemTime::now() + .duration_since(SystemTime::UNIX_EPOCH) + .unwrap() + .as_secs(); + println!("rng_seed={:?}", rng_seed); + let mut rng = SmallRng::seed_from_u64(rng_seed); let bitrange_1 = Uniform::new(14usize, 51); let mut rand_64 = move || { // first, choose a random number of bits for the first factor @@ -161,6 +171,8 @@ fn test_big_primes() { } fn run(instring: &[u8], outstring: &[u8]) { + println!("STDIN='{}'", String::from_utf8_lossy(instring)); + println!("STDOUT(expected)='{}'", String::from_utf8_lossy(outstring)); // now run factor new_ucmd!() .pipe_in(instring) From 8593b4c46c500b4f03c4e4f64ff635932ac5e792 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 7 Oct 2020 22:59:44 -0500 Subject: [PATCH 045/606] tests ~ (sub-crate/factor) add tests for known prior factorization failures --- src/uu/factor/src/factor.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index ef34af030..4f625441c 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -224,6 +224,19 @@ mod tests { use super::{factor, Factors}; use quickcheck::quickcheck; + #[test] + fn factor_correctly_recombines_prior_test_failures() { + let prior_failures = [ + // * integers with duplicate factors (ie, N.pow(M)) + 4566769_u64, // == 2137.pow(2) + 2044854919485649_u64, + 18446739546814299361_u64, + 18446738440860217487_u64, + 18446736729316206481_u64, + ]; + assert!(prior_failures.iter().all(|i| factor(*i).product() == *i)); + } + #[test] fn factor_recombines_small() { assert!((1..10_000) @@ -231,6 +244,15 @@ mod tests { .all(|i| factor(i).product() == i)); } + #[test] + fn factor_recombines_small_squares() { + // factor(18446736729316206481) == 4294966441 ** 2 ; causes debug_assert fault for repeated decomposition factor in add() + // ToDO: explain/combine with factor_18446736729316206481 and factor_18446739546814299361 tests + assert!((1..10_000) + .map(|i| (2 * i + 1) * (2 * i + 1)) + .all(|i| factor(i).product() == i)); + } + #[test] fn factor_recombines_overflowing() { assert!((0..250) From 368f47381b7441ddb23bb7460417e0d1ce33e330 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 8 Oct 2020 00:07:03 -0500 Subject: [PATCH 046/606] fix/factor ~ fix fault when factoring number composed of a squared factor --- src/uu/factor/src/factor.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 4f625441c..ffb099f2a 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -169,10 +169,16 @@ pub fn factor(num: u64) -> Factors { if let Some(divisor) = find_factor(factor) { let mut gcd_queue = Decomposition::one(); - gcd_queue.add(divisor, exp); - gcd_queue.add(factor / divisor, exp); - let mut non_trivial_gcd = true; + let quotient = factor / divisor; + if quotient == divisor { + gcd_queue.add(divisor, exp + 1); + } else { + gcd_queue.add(divisor, exp); + gcd_queue.add(quotient, exp); + } + + let mut non_trivial_gcd = quotient != divisor; while non_trivial_gcd { debug_assert_eq!(factor, gcd_queue.product()); From 6eea8c5f307162c9d0004950bc3defa7cdbfe22c Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 8 Oct 2020 18:58:09 -0500 Subject: [PATCH 047/606] perf/factor ~ improve factor() quotient and loop comparison (~6% time improvement) --- src/uu/factor/src/factor.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index ffb099f2a..3cf9783a2 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -171,19 +171,19 @@ pub fn factor(num: u64) -> Factors { let mut gcd_queue = Decomposition::one(); let quotient = factor / divisor; - if quotient == divisor { + let mut trivial_gcd = quotient == divisor; + if trivial_gcd { gcd_queue.add(divisor, exp + 1); } else { gcd_queue.add(divisor, exp); gcd_queue.add(quotient, exp); } - let mut non_trivial_gcd = quotient != divisor; - while non_trivial_gcd { + while !trivial_gcd { debug_assert_eq!(factor, gcd_queue.product()); let mut tmp = Decomposition::one(); - non_trivial_gcd = false; + trivial_gcd = true; for i in 0..gcd_queue.0.len() - 1 { let (mut a, exp_a) = gcd_queue.0[i]; let (mut b, exp_b) = gcd_queue.0[i + 1]; @@ -194,7 +194,7 @@ pub fn factor(num: u64) -> Factors { let g = gcd(a, b); if g != 1 { - non_trivial_gcd = true; + trivial_gcd = false; a /= g; b /= g; } From 6a525c950db0cc38007c14cfbee932a2e52048c9 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 8 Oct 2020 21:13:26 -0500 Subject: [PATCH 048/606] perf/factor ~ tune number of stack inlined decomposition values (~1% time improvement) --- src/uu/factor/src/factor.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 3cf9783a2..524ee9381 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -20,9 +20,9 @@ type Exponent = u8; struct Decomposition(SmallVec<[(u64, Exponent); NUM_FACTORS_INLINE]>); // The number of factors to inline directly into a `Decomposition` object. -// As a consequence of the Erdős–Kac theorem, the average number of prime -// factors of integers < 10²⁵ ≃ 2⁸³ is 4, so we can use that value. -const NUM_FACTORS_INLINE: usize = 4; +// As a consequence of the Erdős–Kac theorem, the average number of prime factors +// of integers < 10²⁵ ≃ 2⁸³ is 4, so we can use a slightly higher value. +const NUM_FACTORS_INLINE: usize = 5; impl Decomposition { fn one() -> Decomposition { From c5296f00d05b62a6f8340a495d51594d0f54e5b3 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 8 Oct 2020 22:45:02 -0500 Subject: [PATCH 049/606] tests/factor ~ test first 100000 integers for expected results --- Cargo.toml | 1 + tests/by-util/test_factor.rs | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 0f2b63cb5..9c8887431 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -333,6 +333,7 @@ filetime = "0.2" libc = "0.2" rand = "0.7" regex = "1.0" +sha1 = { version="0.6", features=["std"] } tempfile = "3.1" time = "0.1" unindent = "0.1" diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index d0eaebac8..33c184ba0 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -21,6 +21,27 @@ const LOG_PRIMES: f64 = 14.0; // ceil(log2(NUM_PRIMES)) const NUM_TESTS: usize = 100; +#[test] +fn test_first_100000_integers() { + extern crate sha1; + + let n_integers = 100_000; + let mut instring = String::new(); + for i in 0..=n_integers { + instring.push_str(&(format!("{} ", i))[..]); + } + + println!("STDIN='{}'", instring); + let result = new_ucmd!().pipe_in(instring.as_bytes()).run(); + let stdout = result.stdout; + + assert!(result.success); + + // `seq 0 100000 | factor | sha1sum` => "4ed2d8403934fa1c76fe4b84c5d4b8850299c359" + let hash_check = sha1::Sha1::from(stdout.as_bytes()).hexdigest(); + assert_eq!(hash_check, "4ed2d8403934fa1c76fe4b84c5d4b8850299c359"); +} + #[test] fn test_random() { let primes = Sieve::primes().take(NUM_PRIMES).collect::>(); From ae06368cd89e3da49fb5bd8dbb61cf4f8357b02d Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 8 Oct 2020 22:59:11 -0500 Subject: [PATCH 050/606] polish/factor ~ correct spelling --- src/uu/factor/src/factor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 524ee9381..a7dc4fa2e 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -269,7 +269,7 @@ mod tests { #[test] fn factor_recombines_strong_pseudoprime() { // This is a strong pseudoprime (wrt. miller_rabin::BASIS) - // and triggered a bug in rho::factor's codepath handling + // and triggered a bug in rho::factor's code path handling // miller_rabbin::Result::Composite let pseudoprime = 17179869183; for _ in 0..20 { @@ -300,7 +300,7 @@ impl quickcheck::Arbitrary for Factors { let mut n = u64::MAX; // Adam Kalai's algorithm for generating uniformly-distributed - // integers and their factorisation. + // integers and their factorization. // // See Generating Random Factored Numbers, Easily, J. Cryptology (2003) 'attempt: loop { From 114fda05192d52ab177bb25fee389d1b32bae08e Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 8 Oct 2020 23:00:33 -0500 Subject: [PATCH 051/606] tests ~ (sub-crate factor) refactor divisor() test for improved readability --- src/uu/factor/src/numeric/gcd.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/uu/factor/src/numeric/gcd.rs b/src/uu/factor/src/numeric/gcd.rs index 01e4a23bd..96a0366a2 100644 --- a/src/uu/factor/src/numeric/gcd.rs +++ b/src/uu/factor/src/numeric/gcd.rs @@ -79,7 +79,11 @@ mod tests { fn divisor(a: u64, b: u64) -> bool { // Test that gcd(a, b) divides a and b let g = gcd(a, b); - (g != 0 && a % g == 0 && b % g == 0) || (g == 0 && a == 0 && b == 0) + if g != 0 { + a % g == 0 && b % g == 0 + } else { + a == 0 && b == 0 // for g == 0 + } } fn commutative(a: u64, b: u64) -> bool { From 94e240a2fc3d36271d1e544e8ccd4d13d4be8b11 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 10 Oct 2020 12:53:09 -0500 Subject: [PATCH 052/606] tests/factor ~ refactor for readability + improve DRY --- Cargo.toml | 1 + tests/by-util/test_factor.rs | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9c8887431..bcf9a7615 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -329,6 +329,7 @@ pin_same-file = { version="1.0.4, < 1.0.6", package="same-file" } ## same-file v pin_winapi-util = { version="0.1.2, < 0.1.3", package="winapi-util" } ## winapi-util v0.1.3 has compiler errors for MinRustV v1.32.0, expects 1.34 [dev-dependencies] +conv = "0.3" filetime = "0.2" libc = "0.2" rand = "0.7" diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index 33c184ba0..5bde17cdb 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -10,15 +10,15 @@ use std::time::SystemTime; #[path = "../../src/uu/factor/sieve.rs"] mod sieve; -use self::sieve::Sieve; +extern crate conv; extern crate rand; + use self::rand::distributions::{Distribution, Uniform}; use self::rand::{rngs::SmallRng, Rng, SeedableRng}; +use self::sieve::Sieve; const NUM_PRIMES: usize = 10000; -const LOG_PRIMES: f64 = 14.0; // ceil(log2(NUM_PRIMES)) - const NUM_TESTS: usize = 100; #[test] @@ -44,6 +44,9 @@ fn test_first_100000_integers() { #[test] fn test_random() { + use conv::prelude::*; + + let log_num_primes = f64::value_from(NUM_PRIMES).unwrap().log2().ceil(); let primes = Sieve::primes().take(NUM_PRIMES).collect::>(); let rng_seed = SystemTime::now() @@ -51,16 +54,16 @@ fn test_random() { .unwrap() .as_secs(); println!("rng_seed={:?}", rng_seed); - let mut rng = SmallRng::seed_from_u64(rng_seed); + let mut rand_gt = move |min: u64| { - let mut product = 1u64; + let mut product = 1_u64; let mut factors = Vec::new(); while product < min { // log distribution---higher probability for lower numbers let factor; loop { - let next = rng.gen_range(0f64, LOG_PRIMES).exp2().floor() as usize; + let next = rng.gen_range(0_f64, log_num_primes).exp2().floor() as usize; if next < NUM_PRIMES { factor = primes[next]; break; @@ -106,7 +109,8 @@ fn test_random_big() { .as_secs(); println!("rng_seed={:?}", rng_seed); let mut rng = SmallRng::seed_from_u64(rng_seed); - let bitrange_1 = Uniform::new(14usize, 51); + + let bitrange_1 = Uniform::new(14_usize, 51); let mut rand_64 = move || { // first, choose a random number of bits for the first factor let f_bit_1 = bitrange_1.sample(&mut rng); @@ -116,11 +120,11 @@ fn test_random_big() { // we will have a number of additional factors equal to nfacts + 1 // where nfacts is in [0, floor(rem/14) ) NOTE half-open interval // Each prime factor is at least 14 bits, hence floor(rem/14) - let nfacts = Uniform::new(0usize, rem / 14).sample(&mut rng); + let nfacts = Uniform::new(0_usize, rem / 14).sample(&mut rng); // we have to distribute extrabits among the (nfacts + 1) values let extrabits = rem - (nfacts + 1) * 14; // (remember, a Range is a half-open interval) - let extrarange = Uniform::new(0usize, extrabits + 1); + let extrarange = Uniform::new(0_usize, extrabits + 1); // to generate an even split of this range, generate n-1 random elements // in the range, add the desired total value to the end, sort this list, @@ -147,7 +151,7 @@ fn test_random_big() { let f_bits = f_bits; let mut nbits = 0; - let mut product = 1u64; + let mut product = 1_u64; let mut factors = Vec::new(); for bit in f_bits { assert!(bit < 37); From 7827716dad1331a6bcae3af338bd834f2bb00a11 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Mon, 26 Oct 2020 15:26:25 -0500 Subject: [PATCH 053/606] update dependencies (Cargo.lock; using `cargo +1.32.0 update`) --- Cargo.lock | 134 ++++++++++++----------------------------------------- 1 file changed, 30 insertions(+), 104 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 74216eefa..0fc90677a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -190,17 +190,27 @@ name = "const_fn" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "conv" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "coreutils" version = "0.0.1" dependencies = [ + "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -476,6 +486,11 @@ dependencies = [ "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "custom_derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "data-encoding" version = "2.1.2" @@ -695,6 +710,11 @@ name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "md5" version = "0.3.8" @@ -914,24 +934,6 @@ dependencies = [ "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand" version = "0.7.3" @@ -945,15 +947,6 @@ dependencies = [ "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand_chacha" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand_chacha" version = "0.2.2" @@ -984,14 +977,6 @@ dependencies = [ "getrandom 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand_hc" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand_hc" version = "0.2.0" @@ -1000,46 +985,6 @@ dependencies = [ "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand_isaac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_jitter" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_os" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_pcg" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand_pcg" version = "0.2.1" @@ -1048,14 +993,6 @@ dependencies = [ "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand_xorshift" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rayon" version = "1.5.0" @@ -1079,14 +1016,6 @@ dependencies = [ "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "redox_syscall" version = "0.1.57" @@ -1245,8 +1174,11 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.4.1" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "strsim" @@ -1644,7 +1576,7 @@ dependencies = [ "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -2575,6 +2507,7 @@ dependencies = [ "checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2" +"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" "checksum cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d1cd8699ffa1b18fd388183f7762e0545eddbd5c6ec95e9e3b42a4a71a507ff" "checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" "checksum cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" @@ -2590,6 +2523,7 @@ dependencies = [ "checksum crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5" "checksum csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279" "checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" "checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" "checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" "checksum dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" @@ -2621,6 +2555,7 @@ dependencies = [ "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" "checksum log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" "checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" +"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" "checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" "checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" @@ -2649,24 +2584,15 @@ dependencies = [ "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" "checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" -"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" "checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" "checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" -"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" "checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" "checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" -"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8963b85b8ce3074fecffde43b4b0dded83ce2f367dc8d363afc56679f3ee820b" @@ -2688,7 +2614,7 @@ dependencies = [ "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" -"checksum smallvec 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f" +"checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" From 58099f4203e8280a02cabf4bb226e281889dea00 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 25 Oct 2020 19:32:38 +0100 Subject: [PATCH 054/606] refactor(wc): use clap instead of getopts --- Cargo.lock | 40 +++++++-------- src/uu/wc/Cargo.toml | 2 +- src/uu/wc/src/wc.rs | 119 +++++++++++++++++++++++++------------------ 3 files changed, 90 insertions(+), 71 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 66fe84236..01acbb0aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,7 +12,7 @@ name = "aho-corasick" version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -20,7 +20,7 @@ name = "aho-corasick" version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -110,7 +110,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -473,7 +473,7 @@ name = "csv-core" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -710,7 +710,7 @@ dependencies = [ [[package]] name = "memchr" -version = "2.3.3" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -819,7 +819,7 @@ version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -827,7 +827,7 @@ name = "paste-impl" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro-hack 0.5.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -862,7 +862,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "proc-macro-hack" -version = "0.5.18" +version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1106,7 +1106,7 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1202,7 +1202,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1260,7 +1260,7 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.46" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1886,7 +1886,7 @@ dependencies = [ "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", @@ -1987,7 +1987,7 @@ dependencies = [ "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", @@ -2338,7 +2338,7 @@ dependencies = [ name = "uu_wc" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -2398,7 +2398,7 @@ source = "git+https://github.com/uutils/uucore.git?branch=canary#869573459f00ba0 dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2450,7 +2450,7 @@ dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2470,7 +2470,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2617,7 +2617,7 @@ dependencies = [ "checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" "checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -"checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" +"checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" "checksum memoffset 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" "checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" "checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" @@ -2636,7 +2636,7 @@ dependencies = [ "checksum platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f2fd076acdc7a98374de6e300bf3af675997225bef21aecac2219553f04dd7e8" "checksum plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0d1685fbe7beba33de0330629da9d955ac75bd54f33d7b79f9a895590124f6bb" "checksum ppv-lite86 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" -"checksum proc-macro-hack 0.5.18 (registry+https://github.com/rust-lang/crates.io-index)" = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" +"checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" "checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" "checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" @@ -2684,7 +2684,7 @@ dependencies = [ "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad5de3220ea04da322618ded2c42233d02baca219d6f160a3e9c87cda16c942" +"checksum syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index 84ad1bb95..b76a641a6 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/wc.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 3aa1b0510..bf3761e5e 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -7,12 +7,11 @@ // spell-checker:ignore (ToDO) fpath -extern crate getopts; - +extern crate clap; #[macro_use] extern crate uucore; -use getopts::{Matches, Options}; +use clap::{App, Arg, ArgMatches}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; @@ -29,13 +28,13 @@ struct Settings { } impl Settings { - fn new(matches: &Matches) -> Settings { + fn new(matches: &ArgMatches) -> Settings { let settings = Settings { - show_bytes: matches.opt_present("bytes"), - show_chars: matches.opt_present("chars"), - show_lines: matches.opt_present("lines"), - show_words: matches.opt_present("words"), - show_max_line_length: matches.opt_present("L"), + show_bytes: matches.is_present(OPT_BYTES), + show_chars: matches.is_present(OPT_CHAR), + show_lines: matches.is_present(OPT_LINES), + show_words: matches.is_present(OPT_WORDS), + show_max_line_length: matches.is_present(OPT_MAX_LINE_LENGTH), }; if settings.show_bytes @@ -66,57 +65,77 @@ struct Result { max_line_length: usize, } -static NAME: &str = "wc"; +static ABOUT: &str = "print newline, word, and byte counts for each file."; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static OPT_BYTES: &str = "bytes"; +static OPT_CHAR: &str = "chars"; +static OPT_LINES: &str = "lines"; +static OPT_MAX_LINE_LENGTH: &str = "max-line-length"; +static OPT_WORDS: &str = "words"; + +static ARG_FILES: &str = "files"; + +fn get_usage() -> String { + format!( + "{0} [OPTION]... [FILE]... + With no FILE, or when FILE is -, read standard input.", + executable!() + ) +} + pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_BYTES) + .short("c") + .long(OPT_BYTES) + .help("print the byte counts"), + ) + .arg( + Arg::with_name(OPT_CHAR) + .short("m") + .long(OPT_CHAR) + .help("print the character counts"), + ) + .arg( + Arg::with_name(OPT_LINES) + .short("l") + .long(OPT_LINES) + .help("print the newline counts"), + ) + .arg( + Arg::with_name(OPT_MAX_LINE_LENGTH) + .short("L") + .long(OPT_MAX_LINE_LENGTH) + .help("print the length of the longest line"), + ) + .arg( + Arg::with_name(OPT_WORDS) + .short("w") + .long(OPT_WORDS) + .help("print the word counts"), + ) + .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) + .get_matches_from(args); - opts.optflag("c", "bytes", "print the byte counts"); - opts.optflag("m", "chars", "print the character counts"); - opts.optflag("l", "lines", "print the newline counts"); - opts.optflag( - "L", - "max-line-length", - "print the length of the longest line", - ); - opts.optflag("w", "words", "print the word counts"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); + let mut files: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); - let mut matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f), - }; - - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage:"); - println!(" {0} [OPTION]... [FILE]...", NAME); - println!(); - println!( - "{}", - opts.usage("Print newline, word and byte counts for each FILE") - ); - println!("With no FILE, or when FILE is -, read standard input."); - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if matches.free.is_empty() { - matches.free.push("-".to_owned()); + if files.is_empty() { + files.push("-".to_owned()); } let settings = Settings::new(&matches); - match wc(matches.free, &settings) { + match wc(files, &settings) { Ok(()) => ( /* pass */ ), Err(e) => return e, } From 1e37c29b1f61334682dd1937aa0f6e19c5a51726 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 26 Oct 2020 22:24:58 +0100 Subject: [PATCH 055/606] refactor(stat): Move to clap --- Cargo.lock | 2 +- src/uu/stat/Cargo.toml | 2 +- src/uu/stat/src/stat.rs | 183 +++++++++++++++++++++------------------- 3 files changed, 99 insertions(+), 88 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6b54012e6..e70f28660 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2116,7 +2116,7 @@ dependencies = [ name = "uu_stat" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index ddc280f5e..f39f20c9a 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/stat.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" time = "0.1.40" uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["entries", "libc"] } uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 859043d7e..4c3384d4b 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -7,8 +7,7 @@ // spell-checker:ignore (ToDO) mtab fsext showfs otype fmtstr prec ftype blocksize nlink rdev fnodes fsid namelen blksize inodes fstype iosize statfs gnulib NBLOCKSIZE -extern crate getopts; -use getopts::Options; +extern crate clap; #[macro_use] mod fsext; @@ -18,6 +17,7 @@ pub use crate::fsext::*; extern crate uucore; use uucore::entries; +use clap::{App, Arg, ArgMatches}; use std::borrow::Cow; use std::convert::AsRef; use std::fs::File; @@ -86,9 +86,17 @@ macro_rules! print_adjusted { }; } -static NAME: &str = "stat"; +static ABOUT: &str = "Display file or file system status."; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static OPT_DEREFERENCE: &str = "dereference"; +static OPT_FILE_SYSTEM: &str = "file-system"; +static OPT_FORMAT: &str = "format"; +static OPT_PRINTF: &str = "printf"; +static OPT_TERSE: &str = "terse"; + +static ARG_FILES: &str = "files"; + const MOUNT_INFO: &str = "/etc/mtab"; pub const F_ALTER: u8 = 1; pub const F_ZERO: u8 = 1 << 1; @@ -332,7 +340,6 @@ impl Stater { let mut tokens = Vec::new(); let bound = fmtstr.len(); let chars = fmtstr.chars().collect::>(); - let mut i = 0_usize; while i < bound { match chars[i] { @@ -453,16 +460,21 @@ impl Stater { Ok(tokens) } - fn new(matches: getopts::Matches) -> Result { - let fmtstr = if matches.opt_present("printf") { - matches.opt_str("printf").expect("Invalid format string") + fn new(matches: ArgMatches) -> Result { + let files: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + + let fmtstr = if matches.is_present(OPT_PRINTF) { + matches.value_of(OPT_PRINTF).expect("Invalid format string") } else { - matches.opt_str("format").unwrap_or_else(|| "".to_owned()) + matches.value_of(OPT_FORMAT).unwrap_or_else(|| "") }; - let use_printf = matches.opt_present("printf"); - let terse = matches.opt_present("terse"); - let showfs = matches.opt_present("file-system"); + let use_printf = matches.is_present(OPT_PRINTF); + let terse = matches.is_present(OPT_TERSE); + let showfs = matches.is_present(OPT_FILE_SYSTEM); let default_tokens = if fmtstr.is_empty() { Stater::generate_tokens(&Stater::default_fmt(showfs, terse, false), use_printf).unwrap() @@ -491,10 +503,10 @@ impl Stater { }; Ok(Stater { - follow: matches.opt_present("dereference"), + follow: matches.is_present(OPT_DEREFERENCE), showfs, from_user: !fmtstr.is_empty(), - files: matches.free, + files, default_tokens, default_dev_tokens, mount_list, @@ -873,76 +885,13 @@ impl Stater { } } -pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); - - let mut opts = Options::new(); - - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); - - opts.optflag("L", "dereference", "follow links"); - opts.optflag( - "f", - "file-system", - "display file system status instead of file status", - ); - opts.optflag("t", "terse", "print the information in terse form"); - - // Omit the unused description as they are too long - opts.optopt("c", "format", "", "FORMAT"); - opts.optopt("", "printf", "", "FORMAT"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_usage_error!("{}", f); - return 1; - } - }; - - if matches.opt_present("help") { - return help(); - } else if matches.opt_present("version") { - return version(); - } - - if matches.free.is_empty() { - show_usage_error!("missing operand"); - return 1; - } - - match Stater::new(matches) { - Ok(stater) => stater.exec(), - Err(e) => { - show_info!("{}", e); - 1 - } - } +fn get_usage() -> String { + format!("{0} [OPTION]... FILE...", executable!()) } -fn version() -> i32 { - println!("{} {}", NAME, VERSION); - 0 -} - -fn help() -> i32 { - let msg = format!( - r#"Usage: {} [OPTION]... FILE... -Display file or file system status. - -Mandatory arguments to long options are mandatory for short options too. - -L, --dereference follow links - -f, --file-system display file system status instead of file status - -c --format=FORMAT use the specified FORMAT instead of the default; - output a newline after each use of FORMAT - --printf=FORMAT like --format, but interpret backslash escapes, - and do not output a mandatory trailing newline; - if you want a newline, include \n in FORMAT - -t, --terse print the information in terse form - --help display this help and exit - --version output version information and exit - +fn get_long_usage() -> String { + String::from( + " The valid format sequences for files (without --file-system): %a access rights in octal (note '#' and '0' printf flags) @@ -993,9 +942,71 @@ Valid format sequences for file systems: NOTE: your shell may have its own version of stat, which usually supersedes the version described here. Please refer to your shell's documentation -for details about the options it supports."#, - NAME - ); - println!("{}", msg); - 0 +for details about the options it supports. +", + ) +} + +pub fn uumain(args: impl uucore::Args) -> i32 { + let usage = get_usage(); + let long_usage = get_long_usage(); + + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(&long_usage[..]) + .arg( + Arg::with_name(OPT_DEREFERENCE) + .short("L") + .long(OPT_DEREFERENCE) + .help("follow links"), + ) + .arg( + Arg::with_name(OPT_FILE_SYSTEM) + .short("f") + .long(OPT_FILE_SYSTEM) + .help("display file system status instead of file status"), + ) + .arg( + Arg::with_name(OPT_TERSE) + .short("t") + .long(OPT_TERSE) + .help("print the information in terse form"), + ) + .arg( + Arg::with_name(OPT_FORMAT) + .short("c") + .long(OPT_FORMAT) + .help( + "use the specified FORMAT instead of the default; + output a newline after each use of FORMAT", + ) + .value_name("FORMAT"), + ) + .arg( + Arg::with_name(OPT_PRINTF) + .long(OPT_PRINTF) + .value_name("FORMAT") + .help( + "like --format, but interpret backslash escapes, + and do not output a mandatory trailing newline; + if you want a newline, include \n in FORMAT", + ), + ) + .arg( + Arg::with_name(ARG_FILES) + .multiple(true) + .takes_value(true) + .min_values(1), + ) + .get_matches_from(args); + + match Stater::new(matches) { + Ok(stater) => stater.exec(), + Err(e) => { + show_info!("{}", e); + 1 + } + } } From 2ad587ccbde562f7409606e19be16d6b8b7c3cf5 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 2 Nov 2020 22:32:44 +0100 Subject: [PATCH 056/606] Update of the about description Co-authored-by: Roy Ivy III --- src/uu/printenv/src/printenv.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/printenv/src/printenv.rs b/src/uu/printenv/src/printenv.rs index cef1c2458..78f90382a 100644 --- a/src/uu/printenv/src/printenv.rs +++ b/src/uu/printenv/src/printenv.rs @@ -15,7 +15,7 @@ extern crate uucore; use clap::{App, Arg}; use std::env; -static ABOUT: &str = "Prints the given environment VARIABLE(s), otherwise prints them all."; +static ABOUT: &str = "Display the values of the specified environment VARIABLE(s), or (with no VARIABLE) display name and value pairs for them all."; static VERSION: &str = env!("CARGO_PKG_VERSION"); static OPT_NULL: &str = "null"; From daf0f96b946a1f456c7122915e25869c346f54b7 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 2 Nov 2020 22:47:55 +0100 Subject: [PATCH 057/606] Update of the about description Co-authored-by: Roy Ivy III --- src/uu/wc/src/wc.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index bf3761e5e..78bc6c2de 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -65,7 +65,8 @@ struct Result { max_line_length: usize, } -static ABOUT: &str = "print newline, word, and byte counts for each file."; +static ABOUT: &str = "Display newline, word, and byte counts for each FILE, and a total line if +more than one FILE is specified."; static VERSION: &str = env!("CARGO_PKG_VERSION"); static OPT_BYTES: &str = "bytes"; From 8bd533ffe837055d4b19e7859f9d0d377cb32650 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 3 Nov 2020 23:10:32 +0100 Subject: [PATCH 058/606] refactor(uptime): some minor improvements --- Cargo.lock | 81 ++++++++++++++++++------------------ src/uu/uptime/Cargo.toml | 3 +- src/uu/uptime/src/uptime.rs | 4 +- tests/by-util/test_uptime.rs | 6 +++ 4 files changed, 49 insertions(+), 45 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 76dd02abc..0f3c4138b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,7 +17,7 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.14" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -158,8 +158,8 @@ name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -187,7 +187,7 @@ dependencies = [ [[package]] name = "const_fn" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -207,7 +207,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -398,14 +398,14 @@ dependencies = [ "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "oorandom 11.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", @@ -448,7 +448,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -462,13 +462,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bstr 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -520,7 +520,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -771,16 +771,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "num-integer" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -800,7 +800,7 @@ name = "number_prefix" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -870,14 +870,14 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "js-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ppv-lite86" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -952,7 +952,7 @@ name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ppv-lite86 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1031,12 +1031,12 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1050,7 +1050,7 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.20" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1571,7 +1571,7 @@ name = "uu_factor" version = "0.0.1" dependencies = [ "criterion 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1625,8 +1625,8 @@ dependencies = [ "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1821,12 +1821,12 @@ dependencies = [ name = "uu_nl" version = "0.0.1" dependencies = [ - "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -1922,12 +1922,12 @@ dependencies = [ name = "uu_ptx" version = "0.0.1" dependencies = [ - "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -2257,7 +2257,6 @@ version = "0.0.1" dependencies = [ "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", @@ -2483,7 +2482,7 @@ dependencies = [ [metadata] "checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" "checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5" -"checksum aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b476ce7103678b0c6d3d395dbbae31d48ff910bd28be979ba5d48c6351131d0d" +"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" @@ -2506,7 +2505,7 @@ dependencies = [ "checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" "checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2" +"checksum const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab" "checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" "checksum cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d1cd8699ffa1b18fd388183f7762e0545eddbd5c6ec95e9e3b42a4a71a507ff" "checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" @@ -2521,7 +2520,7 @@ dependencies = [ "checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" "checksum crossbeam-epoch 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec0f606a85340376eef0d6d8fec399e6d4a544d648386c6645eb6d0653b27d9f" "checksum crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5" -"checksum csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279" +"checksum csv 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fc4666154fd004af3fd6f1da2e81a96fd5a81927fe8ddb6ecc79e2aa6e138b54" "checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" "checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" "checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" @@ -2563,8 +2562,8 @@ dependencies = [ "checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" "checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -"checksum num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" -"checksum num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" "checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" "checksum number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee" "checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" @@ -2576,7 +2575,7 @@ dependencies = [ "checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" "checksum platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f2fd076acdc7a98374de6e300bf3af675997225bef21aecac2219553f04dd7e8" "checksum plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0d1685fbe7beba33de0330629da9d955ac75bd54f33d7b79f9a895590124f6bb" -"checksum ppv-lite86 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" +"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" "checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" "checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" @@ -2595,9 +2594,9 @@ dependencies = [ "checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8963b85b8ce3074fecffde43b4b0dded83ce2f367dc8d363afc56679f3ee820b" +"checksum regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -"checksum regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)" = "8cab7a364d15cde1e505267766a2d3c4e22a843e1a601f0fa7564c0f82ced11c" +"checksum regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index ea1789ab3..511dfd4b7 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -15,10 +15,9 @@ edition = "2018" path = "src/uptime.rs" [dependencies] -getopts = "0.2.18" time = "0.1.40" chrono = "0.4" -clap = "2.32" +clap = "2.33" uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["libc", "utmpx"] } uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index 5c51a535b..f53a15885 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -27,7 +27,7 @@ static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Display the current time, the length of time the system has been up,\n\ the number of users on the system, and the average number of jobs\n\ in the run queue over the last 1, 5 and 15 minutes."; -static OPT_SINCE: &str = "SINCE"; +static OPT_SINCE: &str = "since"; #[cfg(unix)] use uucore::libc::getloadavg; @@ -50,7 +50,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg( Arg::with_name(OPT_SINCE) .short("s") - .long("since") + .long(OPT_SINCE) .help("system up since"), ) .get_matches_from(args); diff --git a/tests/by-util/test_uptime.rs b/tests/by-util/test_uptime.rs index b890ff807..c8f6a11d3 100644 --- a/tests/by-util/test_uptime.rs +++ b/tests/by-util/test_uptime.rs @@ -28,3 +28,9 @@ fn test_uptime_since() { let re = Regex::new(r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}").unwrap(); assert!(re.is_match(&result.stdout.trim())); } + +#[test] +fn test_failed() { + let (_at, mut ucmd) = at_and_ucmd!(); + ucmd.arg("willfail").fails(); +} From 92d5d47434ea14fa67f148e3de2d2094f6bf8d54 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 3 Nov 2020 22:58:01 +0100 Subject: [PATCH 059/606] refactor(pwd): move to clap + add a test --- Cargo.lock | 82 +++++++++++++++++++------------------- src/uu/pwd/Cargo.toml | 2 +- src/uu/pwd/src/pwd.rs | 84 ++++++++++++++++++--------------------- tests/by-util/test_pwd.rs | 6 +++ 4 files changed, 87 insertions(+), 87 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 76dd02abc..d1e3ede9d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,7 +17,7 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.14" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -158,8 +158,8 @@ name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -187,7 +187,7 @@ dependencies = [ [[package]] name = "const_fn" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -207,7 +207,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -398,14 +398,14 @@ dependencies = [ "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "oorandom 11.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", @@ -448,7 +448,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -462,13 +462,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bstr 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -520,7 +520,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -771,16 +771,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "num-integer" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -800,7 +800,7 @@ name = "number_prefix" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -870,14 +870,14 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "js-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ppv-lite86" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -952,7 +952,7 @@ name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ppv-lite86 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1031,12 +1031,12 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1050,7 +1050,7 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.20" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1571,7 +1571,7 @@ name = "uu_factor" version = "0.0.1" dependencies = [ "criterion 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1625,8 +1625,8 @@ dependencies = [ "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1821,12 +1821,12 @@ dependencies = [ name = "uu_nl" version = "0.0.1" dependencies = [ - "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -1922,12 +1922,12 @@ dependencies = [ name = "uu_ptx" version = "0.0.1" dependencies = [ - "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -1936,7 +1936,7 @@ dependencies = [ name = "uu_pwd" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -2483,7 +2483,7 @@ dependencies = [ [metadata] "checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" "checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5" -"checksum aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b476ce7103678b0c6d3d395dbbae31d48ff910bd28be979ba5d48c6351131d0d" +"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" @@ -2506,7 +2506,7 @@ dependencies = [ "checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" "checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2" +"checksum const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab" "checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" "checksum cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d1cd8699ffa1b18fd388183f7762e0545eddbd5c6ec95e9e3b42a4a71a507ff" "checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" @@ -2521,7 +2521,7 @@ dependencies = [ "checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" "checksum crossbeam-epoch 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec0f606a85340376eef0d6d8fec399e6d4a544d648386c6645eb6d0653b27d9f" "checksum crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5" -"checksum csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279" +"checksum csv 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fc4666154fd004af3fd6f1da2e81a96fd5a81927fe8ddb6ecc79e2aa6e138b54" "checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" "checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" "checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" @@ -2563,8 +2563,8 @@ dependencies = [ "checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" "checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -"checksum num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" -"checksum num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" "checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" "checksum number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee" "checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" @@ -2576,7 +2576,7 @@ dependencies = [ "checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" "checksum platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f2fd076acdc7a98374de6e300bf3af675997225bef21aecac2219553f04dd7e8" "checksum plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0d1685fbe7beba33de0330629da9d955ac75bd54f33d7b79f9a895590124f6bb" -"checksum ppv-lite86 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" +"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" "checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" "checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" @@ -2595,9 +2595,9 @@ dependencies = [ "checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8963b85b8ce3074fecffde43b4b0dded83ce2f367dc8d363afc56679f3ee820b" +"checksum regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -"checksum regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)" = "8cab7a364d15cde1e505267766a2d3c4e22a843e1a601f0fa7564c0f82ced11c" +"checksum regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index ef25017d1..bd407a555 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/pwd.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } diff --git a/src/uu/pwd/src/pwd.rs b/src/uu/pwd/src/pwd.rs index 1861c8084..9196328ec 100644 --- a/src/uu/pwd/src/pwd.rs +++ b/src/uu/pwd/src/pwd.rs @@ -5,17 +5,20 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -extern crate getopts; +extern crate clap; #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::env; use std::io; use std::path::{Path, PathBuf}; -static NAME: &str = "pwd"; +static ABOUT: &str = "Display the full filename of the current working directory."; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static OPT_LOGICAL: &str = "logical"; +static OPT_PHYSICAL: &str = "physical"; pub fn absolute_path(path: &Path) -> io::Result { let path_buf = path.canonicalize()?; @@ -32,53 +35,44 @@ pub fn absolute_path(path: &Path) -> io::Result { Ok(path_buf) } +fn get_usage() -> String { + format!("{0} [OPTION]... FILE...", executable!()) +} + pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_LOGICAL) + .short("L") + .long(OPT_LOGICAL) + .help("use PWD from environment, even if it contains symlinks"), + ) + .arg( + Arg::with_name(OPT_PHYSICAL) + .short("P") + .long(OPT_PHYSICAL) + .help("avoid all symlinks"), + ) + .get_matches_from(args); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); - opts.optflag( - "L", - "logical", - "use PWD from environment, even if it contains symlinks", - ); - opts.optflag("P", "physical", "avoid all symlinks"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f), - }; - - if matches.opt_present("help") { - let msg = format!( - "{0} {1} - -Usage: - {0} [OPTION]... - -Print the full filename of the current working directory.", - NAME, VERSION - ); - print!("{}", opts.usage(&msg)); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else { - match env::current_dir() { - Ok(logical_path) => { - if matches.opt_present("logical") { - println!("{}", logical_path.display()); - } else { - match absolute_path(&logical_path) { - Ok(physical_path) => println!("{}", physical_path.display()), - Err(e) => crash!(1, "failed to get absolute path {}", e), - }; - } + match env::current_dir() { + Ok(logical_path) => { + if matches.is_present(OPT_LOGICAL) { + println!("{}", logical_path.display()); + } else { + match absolute_path(&logical_path) { + Ok(physical_path) => println!("{}", physical_path.display()), + Err(e) => crash!(1, "failed to get absolute path {}", e), + }; } - Err(e) => crash!(1, "failed to get current directory {}", e), - }; - } + } + Err(e) => crash!(1, "failed to get current directory {}", e), + }; 0 } diff --git a/tests/by-util/test_pwd.rs b/tests/by-util/test_pwd.rs index aecb700da..b6a6c87a4 100644 --- a/tests/by-util/test_pwd.rs +++ b/tests/by-util/test_pwd.rs @@ -5,3 +5,9 @@ fn test_default() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.run().stdout_is(at.root_dir_resolved() + "\n"); } + +#[test] +fn test_failed() { + let (_at, mut ucmd) = at_and_ucmd!(); + ucmd.arg("willfail").fails(); +} From 897bcb2e67a4a38dd2f2e941662adbb6036affdf Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 8 Nov 2020 17:49:41 +0100 Subject: [PATCH 060/606] refactor(mkdir): Move to clap + add a test --- Cargo.lock | 2 +- src/uu/mkdir/Cargo.toml | 2 +- src/uu/mkdir/src/mkdir.rs | 91 +++++++++++++++++++++---------------- tests/by-util/test_mkdir.rs | 10 ++++ 4 files changed, 63 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 76dd02abc..5bdcea2ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1748,7 +1748,7 @@ dependencies = [ name = "uu_mkdir" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index 89c391fb0..5478e501f 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/mkdir.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["fs", "mode"] } uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index c1c03d8f2..7e53ed8e7 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -5,53 +5,78 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -extern crate getopts; +extern crate clap; #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs; use std::path::Path; -static NAME: &str = "mkdir"; +static ABOUT: &str = "Create the given DIRECTORY(ies) if they do not exist"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static OPT_MODE: &str = "mode"; +static OPT_PARENTS: &str = "parents"; +static OPT_VERBOSE: &str = "verbose"; + +static ARG_DIRS: &str = "dirs"; + +fn get_usage() -> String { + format!("{0} [OPTION]... [USER]", executable!()) +} /** * Handles option parsing */ pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); - - let mut opts = getopts::Options::new(); + let usage = get_usage(); // Linux-specific options, not implemented // opts.optflag("Z", "context", "set SELinux security context" + // " of each created directory to CTX"), - opts.optopt("m", "mode", "set file mode", "755"); - opts.optflag("p", "parents", "make parent directories as needed"); - opts.optflag("v", "verbose", "print a message for each printed directory"); - opts.optflag("h", "help", "display this help"); - opts.optflag("V", "version", "display this version"); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_MODE) + .short("m") + .long(OPT_MODE) + .help("set file mode") + .default_value("755"), + ) + .arg( + Arg::with_name(OPT_PARENTS) + .short("p") + .long(OPT_PARENTS) + .help("make parent directories as needed"), + ) + .arg( + Arg::with_name(OPT_VERBOSE) + .short("v") + .long(OPT_VERBOSE) + .help("print a message for each printed directory"), + ) + .arg( + Arg::with_name(ARG_DIRS) + .multiple(true) + .takes_value(true) + .min_values(1), + ) + .get_matches_from(args); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f), - }; + let dirs: Vec = matches + .values_of(ARG_DIRS) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); - if args.len() == 1 || matches.opt_present("help") { - print_help(&opts); - return 0; - } - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - let verbose = matches.opt_present("verbose"); - let recursive = matches.opt_present("parents"); + let verbose = matches.is_present(OPT_VERBOSE); + let recursive = matches.is_present(OPT_PARENTS); // Translate a ~str in octal form to u16, default to 755 // Not tested on Windows - let mode_match = matches.opts_str(&["mode".to_owned()]); + let mode_match = matches.value_of(OPT_MODE); let mode: u16 = match mode_match { Some(m) => { let res: Option = u16::from_str_radix(&m, 8).ok(); @@ -63,23 +88,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { _ => 0o755 as u16, }; - let dirs = matches.free; - if dirs.is_empty() { - crash!(1, "missing operand"); - } exec(dirs, recursive, mode, verbose) } -fn print_help(opts: &getopts::Options) { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage:"); - print!( - "{}", - opts.usage("Create the given DIRECTORY(ies) if they do not exist") - ); -} - /** * Create the list of new directories */ @@ -120,7 +131,7 @@ fn mkdir(path: &Path, recursive: bool, mode: u16, verbose: bool) -> i32 { } if verbose { - show_info!("created directory '{}'", path.display()); + println!("{}: created directory '{}'", executable!(), path.display()); } #[cfg(any(unix, target_os = "redox"))] diff --git a/tests/by-util/test_mkdir.rs b/tests/by-util/test_mkdir.rs index 70e4e414c..73be9b253 100644 --- a/tests/by-util/test_mkdir.rs +++ b/tests/by-util/test_mkdir.rs @@ -13,6 +13,16 @@ fn test_mkdir_mkdir() { new_ucmd!().arg(TEST_DIR1).succeeds(); } +#[test] +fn test_mkdir_verbose() { + let expected = "mkdir: created directory 'mkdir_test1'\n"; + new_ucmd!() + .arg(TEST_DIR1) + .arg("-v") + .run() + .stdout_is(expected); +} + #[test] fn test_mkdir_dup_dir() { let scene = TestScenario::new(util_name!()); From 5c8e47a4d1e67d7132e7c359a3a75860baf0d2d8 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 8 Nov 2020 17:55:06 +0100 Subject: [PATCH 061/606] Remove version mgmt, it is done by clap --- src/uu/cp/src/cp.rs | 15 --------------- src/uu/df/src/df.rs | 12 ------------ 2 files changed, 27 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 3c04a55e5..85759033a 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -231,11 +231,6 @@ static ABOUT: &str = "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY."; static EXIT_OK: i32 = 0; static EXIT_ERR: i32 = 1; -/// Prints the version -fn print_version() { - println!("{} {}", executable!(), VERSION); -} - fn get_usage() -> String { format!( "{0} [OPTION]... [-T] SOURCE DEST @@ -277,7 +272,6 @@ static OPT_SYMBOLIC_LINK: &str = "symbolic-link"; static OPT_TARGET_DIRECTORY: &str = "target-directory"; static OPT_UPDATE: &str = "update"; static OPT_VERBOSE: &str = "verbose"; -static OPT_VERSION: &str = "version"; #[cfg(unix)] static PRESERVABLE_ATTRIBUTES: &[&str] = &[ @@ -325,10 +319,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_NO_TARGET_DIRECTORY) .conflicts_with(OPT_TARGET_DIRECTORY) .help("Treat DEST as a regular file and not a directory")) - .arg(Arg::with_name(OPT_VERSION) - .short("V") - .long(OPT_VERSION) - .help("output version information and exit")) .arg(Arg::with_name(OPT_INTERACTIVE) .short("i") .long(OPT_INTERACTIVE) @@ -472,11 +462,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .multiple(true)) .get_matches_from(args); - if matches.is_present(OPT_VERSION) { - print_version(); - return EXIT_OK; - } - let options = crash_if_err!(EXIT_ERR, Options::from_matches(&matches)); let paths: Vec = matches .values_of("paths") diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index d1541866d..36edc4ff2 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -106,7 +106,6 @@ static OPT_SYNC: &str = "sync"; static OPT_TYPE: &str = "type"; static OPT_PRINT_TYPE: &str = "print-type"; static OPT_EXCLUDE_TYPE: &str = "exclude-type"; -static OPT_VERSION: &str = "version"; static MOUNT_OPT_BIND: &str = "bind"; @@ -854,21 +853,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .use_delimiter(true) .help("limit listing to file systems not of type TYPE"), ) - .arg( - Arg::with_name(OPT_VERSION) - .short("v") - .long("version") - .help("output version information and exit"), - ) .arg(Arg::with_name(OPT_PATHS).multiple(true)) .help("Filesystem(s) to list") .get_matches_from(args); - if matches.is_present(OPT_VERSION) { - println!("{} {}", executable!(), VERSION); - return EXIT_OK; - } - let paths: Vec = matches .values_of(OPT_PATHS) .map(|v| v.map(ToString::to_string).collect()) From 6095dfee66749df7f05d6633d8993f230d5ac82f Mon Sep 17 00:00:00 2001 From: Joseph Crail Date: Mon, 23 Nov 2015 20:00:51 -0500 Subject: [PATCH 062/606] 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. --- src/uucore/Cargo.toml | 11 ++ src/uucore/c_types.rs | 240 +++++++++++++++++++++++++++++++++++++++ src/uucore/fs.rs | 144 +++++++++++++++++++++++ src/uucore/lib.rs | 14 +++ src/uucore/macros.rs | 220 +++++++++++++++++++++++++++++++++++ src/uucore/parse_time.rs | 35 ++++++ src/uucore/process.rs | 140 +++++++++++++++++++++++ src/uucore/signals.rs | 156 +++++++++++++++++++++++++ src/uucore/utmpx.rs | 125 ++++++++++++++++++++ src/uucore/wide.rs | 35 ++++++ 10 files changed, 1120 insertions(+) create mode 100644 src/uucore/Cargo.toml create mode 100644 src/uucore/c_types.rs create mode 100644 src/uucore/fs.rs create mode 100644 src/uucore/lib.rs create mode 100644 src/uucore/macros.rs create mode 100644 src/uucore/parse_time.rs create mode 100644 src/uucore/process.rs create mode 100644 src/uucore/signals.rs create mode 100644 src/uucore/utmpx.rs create mode 100644 src/uucore/wide.rs diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml new file mode 100644 index 000000000..65c4d6a01 --- /dev/null +++ b/src/uucore/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "uucore" +version = "0.0.1" +authors = [] + +[dependencies] +libc = "*" +time = "*" + +[lib] +path = "lib.rs" diff --git a/src/uucore/c_types.rs b/src/uucore/c_types.rs new file mode 100644 index 000000000..49e01d582 --- /dev/null +++ b/src/uucore/c_types.rs @@ -0,0 +1,240 @@ +#![allow(dead_code, non_camel_case_types, raw_pointer_derive)] + +extern crate libc; + +use self::libc::{ + c_char, + c_int, + uid_t, + gid_t, +}; +#[cfg(any(target_os = "macos", target_os = "freebsd"))] +use self::libc::time_t; +#[cfg(target_os = "macos")] +use self::libc::int32_t; + +use self::libc::getgroups; + +use std::ffi::{CStr, CString}; +use std::io::{Error, Write}; +use std::iter::repeat; +use std::vec::Vec; + +use std::ptr::{null_mut, read}; + +#[cfg(any(target_os = "macos", target_os = "freebsd"))] +#[repr(C)] +#[derive(Clone, Copy)] +pub struct c_passwd { + pub pw_name: *const c_char, /* user name */ + pub pw_passwd: *const c_char, /* user name */ + pub pw_uid: uid_t, /* user uid */ + pub pw_gid: gid_t, /* user gid */ + pub pw_change: time_t, + pub pw_class: *const c_char, + pub pw_gecos: *const c_char, + pub pw_dir: *const c_char, + pub pw_shell: *const c_char, + pub pw_expire: time_t +} + +#[cfg(target_os = "linux")] +#[repr(C)] +#[derive(Clone, Copy)] +pub struct c_passwd { + pub pw_name: *const c_char, /* user name */ + pub pw_passwd: *const c_char, /* user name */ + pub pw_uid: uid_t, /* user uid */ + pub pw_gid: gid_t, /* user gid */ + pub pw_gecos: *const c_char, + pub pw_dir: *const c_char, + pub pw_shell: *const c_char, +} + +#[cfg(any(target_os = "macos", target_os = "freebsd"))] +#[repr(C)] +pub struct utsname { + pub sysname: [c_char; 256], + pub nodename: [c_char; 256], + pub release: [c_char; 256], + pub version: [c_char; 256], + pub machine: [c_char; 256] +} + +#[cfg(target_os = "linux")] +#[repr(C)] +pub struct utsname { + pub sysname: [c_char; 65], + pub nodename: [c_char; 65], + pub release: [c_char; 65], + pub version: [c_char; 65], + pub machine: [c_char; 65], + pub domainame: [c_char; 65] +} + +#[repr(C)] +pub struct c_group { + pub gr_name: *const c_char, // group name + pub gr_passwd: *const c_char, // password + pub gr_gid: gid_t, // group id + pub gr_mem: *const *const c_char, // member list +} + +#[repr(C)] +pub struct c_tm { + pub tm_sec: c_int, /* seconds */ + pub tm_min: c_int, /* minutes */ + pub tm_hour: c_int, /* hours */ + pub tm_mday: c_int, /* day of the month */ + pub tm_mon: c_int, /* month */ + pub tm_year: c_int, /* year */ + pub tm_wday: c_int, /* day of the week */ + pub tm_yday: c_int, /* day in the year */ + pub tm_isdst: c_int /* daylight saving time */ +} + +extern { + pub fn getpwuid(uid: uid_t) -> *const c_passwd; + pub fn getpwnam(login: *const c_char) -> *const c_passwd; + pub fn getgrgid(gid: gid_t) -> *const c_group; + pub fn getgrnam(name: *const c_char) -> *const c_group; + pub fn getgrouplist(name: *const c_char, + gid: gid_t, + groups: *mut gid_t, + ngroups: *mut c_int) -> c_int; +} + +#[cfg(target_os = "macos")] +extern { + pub fn getgroupcount(name: *const c_char, gid: gid_t) -> int32_t; +} + +pub fn get_pw_from_args(free: &Vec) -> Option { + if free.len() == 1 { + let username = &free[0][..]; + + // Passed user as id + if username.chars().all(|c| c.is_digit(10)) { + let id = username.parse::().unwrap(); + let pw_pointer = unsafe { getpwuid(id as uid_t) }; + + if !pw_pointer.is_null() { + Some(unsafe { read(pw_pointer) }) + } else { + crash!(1, "{}: no such user", username); + } + + // Passed the username as a string + } else { + let pw_pointer = unsafe { + let cstr = CString::new(username).unwrap(); + getpwnam(cstr.as_bytes_with_nul().as_ptr() as *const i8) + }; + if !pw_pointer.is_null() { + Some(unsafe { read(pw_pointer) }) + } else { + crash!(1, "{}: no such user", username); + } + } + } else { + None + } +} + +pub fn get_group(groupname: &str) -> Option { + let group = if groupname.chars().all(|c| c.is_digit(10)) { + unsafe { getgrgid(groupname.parse().unwrap()) } + } else { + unsafe { + let cstr = CString::new(groupname).unwrap(); + getgrnam(cstr.as_bytes_with_nul().as_ptr() as *const c_char) + } + }; + + if !group.is_null() { + Some(unsafe { read(group) }) + } + else { + None + } +} + +pub fn get_group_list(name: *const c_char, gid: gid_t) -> Vec { + let mut ngroups: c_int = 32; + let mut groups: Vec = Vec::with_capacity(ngroups as usize); + + if unsafe { get_group_list_internal(name, gid, groups.as_mut_ptr(), &mut ngroups) } == -1 { + groups.reserve(ngroups as usize); + unsafe { get_group_list_internal(name, gid, groups.as_mut_ptr(), &mut ngroups); } + } else { + groups.truncate(ngroups as usize); + } + unsafe { groups.set_len(ngroups as usize); } + + groups +} + +#[cfg(any(target_os = "linux", target_os = "freebsd"))] +#[inline(always)] +unsafe fn get_group_list_internal(name: *const c_char, gid: gid_t, groups: *mut gid_t, grcnt: *mut c_int) -> c_int { + getgrouplist(name, gid, groups, grcnt) +} + +#[cfg(target_os = "macos")] +unsafe fn get_group_list_internal(name: *const c_char, gid: gid_t, groups: *mut gid_t, grcnt: *mut c_int) -> c_int { + let ngroups = getgroupcount(name, gid); + let oldsize = *grcnt; + *grcnt = ngroups; + if oldsize >= ngroups { + getgrouplist(name, gid, groups, grcnt); + 0 + } else { + -1 + } +} + +pub fn get_groups() -> Result, i32> { + let ngroups = unsafe { getgroups(0, null_mut()) }; + if ngroups == -1 { + return Err(Error::last_os_error().raw_os_error().unwrap()) + } + + let mut groups : Vec= repeat(0).take(ngroups as usize).collect(); + let ngroups = unsafe { getgroups(ngroups, groups.as_mut_ptr()) }; + if ngroups == -1 { + Err(Error::last_os_error().raw_os_error().unwrap()) + } else { + groups.truncate(ngroups as usize); + Ok(groups) + } +} + +pub fn group(possible_pw: Option, nflag: bool) { + let groups = match possible_pw { + Some(pw) => Ok(get_group_list(pw.pw_name, pw.pw_gid)), + None => get_groups(), + }; + + match groups { + Err(errno) => + crash!(1, "failed to get group list (errno={})", errno), + Ok(groups) => { + for &g in groups.iter() { + if nflag { + let group = unsafe { getgrgid(g) }; + if !group.is_null() { + let name = unsafe { + let gname = read(group).gr_name; + let bytes= CStr::from_ptr(gname).to_bytes(); + String::from_utf8_lossy(bytes).to_string() + }; + print!("{} ", name); + } + } else { + print!("{} ", g); + } + } + println!(""); + } + } +} diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs new file mode 100644 index 000000000..e0372b357 --- /dev/null +++ b/src/uucore/fs.rs @@ -0,0 +1,144 @@ +/* + * This file is part of the uutils coreutils package. + * + * (c) Joseph Crail + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +// Based on the pattern using by Cargo, I created a shim over the +// standard PathExt trait, so that the unstable path methods could +// be backported to stable (<= 1.1). This will likely be dropped +// when the path trait stabilizes. + +use std::env; +use std::fs; +use std::io::{Error, ErrorKind, Result}; +use std::path::{Component, Path, PathBuf}; + +pub trait UUPathExt { + fn uu_exists(&self) -> bool; + fn uu_is_file(&self) -> bool; + fn uu_is_dir(&self) -> bool; + fn uu_metadata(&self) -> Result; +} + +impl UUPathExt for Path { + fn uu_exists(&self) -> bool { + fs::metadata(self).is_ok() + } + + fn uu_is_file(&self) -> bool { + fs::metadata(self).map(|m| m.is_file()).unwrap_or(false) + } + + fn uu_is_dir(&self) -> bool { + fs::metadata(self).map(|m| m.is_dir()).unwrap_or(false) + } + + fn uu_metadata(&self) -> Result { + fs::metadata(self) + } +} + +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum CanonicalizeMode { + None, + Normal, + Existing, + Missing, +} + +fn resolve>(original: P) -> Result { + const MAX_LINKS_FOLLOWED: u32 = 255; + let mut followed = 0; + let mut result = original.as_ref().to_path_buf(); + loop { + if followed == MAX_LINKS_FOLLOWED { + return Err(Error::new(ErrorKind::InvalidInput, "maximum links followed")); + } + + match fs::metadata(&result) { + Err(e) => return Err(e), + Ok(ref m) if !m.file_type().is_symlink() => break, + Ok(..) => { + followed += 1; + match fs::read_link(&result) { + Ok(path) => { + result.pop(); + result.push(path); + }, + Err(e) => { + return Err(e); + } + } + } + } + } + Ok(result) +} + +pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> Result { + // Create an absolute path + let original = original.as_ref(); + let original = if original.is_absolute() { + original.to_path_buf() + } else { + env::current_dir().unwrap().join(original) + }; + + let mut result = PathBuf::new(); + let mut parts = vec!(); + + // Split path by directory separator; add prefix (Windows-only) and root + // directory to final path buffer; add remaining parts to temporary + // vector for canonicalization. + for part in original.components() { + match part { + Component::Prefix(_) | Component::RootDir => { + result.push(part.as_os_str()); + }, + Component::CurDir => {}, + Component::ParentDir => { + parts.pop(); + }, + Component::Normal(_) => { + parts.push(part.as_os_str()); + } + } + } + + // Resolve the symlinks where possible + if parts.len() > 0 { + for part in parts[..parts.len()-1].iter() { + result.push(part); + + if can_mode == CanonicalizeMode::None { + continue; + } + + match resolve(&result) { + Err(e) => match can_mode { + CanonicalizeMode::Missing => continue, + _ => return Err(e) + }, + Ok(path) => { + result.pop(); + result.push(path); + } + } + } + + result.push(parts.last().unwrap()); + + match resolve(&result) { + Err(e) => { if can_mode == CanonicalizeMode::Existing { return Err(e); } }, + Ok(path) => { + result.pop(); + result.push(path); + } + } + } + Ok(result) +} diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs new file mode 100644 index 000000000..adbe7fe80 --- /dev/null +++ b/src/uucore/lib.rs @@ -0,0 +1,14 @@ +extern crate libc; +extern crate time; + +#[macro_use] +mod macros; + +pub mod c_types; +pub mod fs; +pub mod parse_time; +pub mod process; +#[cfg(unix)] pub mod signals; +#[cfg(unix)] pub mod utmpx; + +#[cfg(windows)] pub mod wide; diff --git a/src/uucore/macros.rs b/src/uucore/macros.rs new file mode 100644 index 000000000..89fa1c2a6 --- /dev/null +++ b/src/uucore/macros.rs @@ -0,0 +1,220 @@ +/* + * This file is part of the uutils coreutils package. + * + * (c) Arcterus + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#[macro_export] +macro_rules! show_error( + ($($args:tt)+) => ({ + pipe_write!(&mut ::std::io::stderr(), "{}: error: ", module_path!()); + pipe_writeln!(&mut ::std::io::stderr(), $($args)+); + }) +); + +#[macro_export] +macro_rules! show_warning( + ($($args:tt)+) => ({ + pipe_write!(&mut ::std::io::stderr(), "{}: warning: ", module_path!()); + pipe_writeln!(&mut ::std::io::stderr(), $($args)+); + }) +); + +#[macro_export] +macro_rules! show_info( + ($($args:tt)+) => ({ + pipe_write!(&mut ::std::io::stderr(), "{}: ", module_path!()); + pipe_writeln!(&mut ::std::io::stderr(), $($args)+); + }) +); + +#[macro_export] +macro_rules! eprint( + ($($args:tt)+) => (pipe_write!(&mut ::std::io::stderr(), $($args)+)) +); + +#[macro_export] +macro_rules! eprintln( + ($($args:tt)+) => (pipe_writeln!(&mut ::std::io::stderr(), $($args)+)) +); + +#[macro_export] +macro_rules! crash( + ($exitcode:expr, $($args:tt)+) => ({ + show_error!($($args)+); + ::std::process::exit($exitcode) + }) +); + +#[macro_export] +macro_rules! exit( + ($exitcode:expr) => ({ + ::std::process::exit($exitcode) + }) +); + +#[macro_export] +macro_rules! crash_if_err( + ($exitcode:expr, $exp:expr) => ( + match $exp { + Ok(m) => m, + Err(f) => crash!($exitcode, "{}", f), + } + ) +); + +#[macro_export] +macro_rules! pipe_crash_if_err( + ($exitcode:expr, $exp:expr) => ( + match $exp { + Ok(_) => (), + Err(f) => { + if f.kind() == ::std::io::ErrorKind::BrokenPipe { + () + } else { + crash!($exitcode, "{}", f) + } + }, + } + ) +); + +#[macro_export] +macro_rules! return_if_err( + ($exitcode:expr, $exp:expr) => ( + match $exp { + Ok(m) => m, + Err(f) => { + show_error!("{}", f); + return $exitcode; + } + } + ) +); + +// XXX: should the pipe_* macros return an Err just to show the write failed? + +#[macro_export] +macro_rules! pipe_print( + ($($args:tt)+) => ( + match write!(&mut ::std::io::stdout(), $($args)+) { + Ok(_) => true, + Err(f) => { + if f.kind() == ::std::io::ErrorKind::BrokenPipe { + false + } else { + panic!("{}", f) + } + } + } + ) +); + +#[macro_export] +macro_rules! pipe_println( + ($($args:tt)+) => ( + match writeln!(&mut ::std::io::stdout(), $($args)+) { + Ok(_) => true, + Err(f) => { + if f.kind() == ::std::io::ErrorKind::BrokenPipe { + false + } else { + panic!("{}", f) + } + } + } + ) +); + +#[macro_export] +macro_rules! pipe_write( + ($fd:expr, $($args:tt)+) => ( + match write!($fd, $($args)+) { + Ok(_) => true, + Err(f) => { + if f.kind() == ::std::io::ErrorKind::BrokenPipe { + false + } else { + panic!("{}", f) + } + } + } + ) +); + +#[macro_export] +macro_rules! pipe_writeln( + ($fd:expr, $($args:tt)+) => ( + match writeln!($fd, $($args)+) { + Ok(_) => true, + Err(f) => { + if f.kind() == ::std::io::ErrorKind::BrokenPipe { + false + } else { + panic!("{}", f) + } + } + } + ) +); + +#[macro_export] +macro_rules! pipe_flush( + () => ( + match ::std::io::stdout().flush() { + Ok(_) => true, + Err(f) => { + if f.kind() == ::std::io::ErrorKind::BrokenPipe { + false + } else { + panic!("{}", f) + } + } + } + ); + ($fd:expr) => ( + match $fd.flush() { + Ok(_) => true, + Err(f) => { + if f.kind() == ::std::io::ErrorKind::BrokenPipe { + false + } else { + panic!("{}", f) + } + } + } + ) +); + +#[macro_export] +macro_rules! safe_write( + ($fd:expr, $($args:tt)+) => ( + match write!($fd, $($args)+) { + Ok(_) => {} + Err(f) => panic!(f.to_string()) + } + ) +); + +#[macro_export] +macro_rules! safe_writeln( + ($fd:expr, $($args:tt)+) => ( + match writeln!($fd, $($args)+) { + Ok(_) => {} + Err(f) => panic!(f.to_string()) + } + ) +); + +#[macro_export] +macro_rules! safe_unwrap( + ($exp:expr) => ( + match $exp { + Ok(m) => m, + Err(f) => crash!(1, "{}", f.to_string()) + } + ) +); diff --git a/src/uucore/parse_time.rs b/src/uucore/parse_time.rs new file mode 100644 index 000000000..608601fe1 --- /dev/null +++ b/src/uucore/parse_time.rs @@ -0,0 +1,35 @@ +/* + * This file is part of the uutils coreutils package. + * + * (c) Arcterus + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +pub fn from_str(string: &str) -> Result { + let len = string.len(); + if len == 0 { + return Err("empty string".to_string()) + } + let slice = &string[..len - 1]; + let (numstr, times) = match string.chars().next_back().unwrap() { + 's' | 'S' => (slice, 1), + 'm' | 'M' => (slice, 60), + 'h' | 'H' => (slice, 60 * 60), + 'd' | 'D' => (slice, 60 * 60 * 24), + val => { + if !val.is_alphabetic() { + (string, 1) + } else if string == "inf" || string == "infinity" { + ("inf", 1) + } else { + return Err(format!("invalid time interval '{}'", string)) + } + } + }; + match numstr.parse::() { + Ok(m) => Ok(m * times as f64), + Err(e) => Err(format!("invalid time interval '{}': {}", string, e)) + } +} diff --git a/src/uucore/process.rs b/src/uucore/process.rs new file mode 100644 index 000000000..d5ac317ea --- /dev/null +++ b/src/uucore/process.rs @@ -0,0 +1,140 @@ +/* + * This file is part of the uutils coreutils package. + * + * (c) Maciej Dziardziel + * + * For the full copyright and license information, please view the LICENSE file + * that was distributed with this source code. + */ + +extern crate libc; + +use libc::{c_int, pid_t}; +use std::fmt; +use std::io; +use std::process::Child; +use std::sync::{Arc, Condvar, Mutex}; +use std::thread; +use time::{Duration, get_time}; +use std::time::Duration as StdDuration; + +// This is basically sys::unix::process::ExitStatus +#[derive(PartialEq, Eq, Clone, Copy, Debug)] +pub enum ExitStatus { + Code(i32), + Signal(i32), +} + +impl ExitStatus { + fn from_status(status: c_int) -> ExitStatus { + if status & 0x7F != 0 { // WIFSIGNALED(status) + ExitStatus::Signal(status & 0x7F) + } else { + ExitStatus::Code(status & 0xFF00 >> 8) + } + } + + pub fn success(&self) -> bool { + match *self { + ExitStatus::Code(code) => code == 0, + _ => false, + } + } + + pub fn code(&self) -> Option { + match *self { + ExitStatus::Code(code) => Some(code), + _ => None, + } + } + + pub fn signal(&self) -> Option { + match *self { + ExitStatus::Signal(code) => Some(code), + _ => None, + } + } +} + +impl fmt::Display for ExitStatus { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + ExitStatus::Code(code) => write!(f, "exit code: {}", code), + ExitStatus::Signal(code) => write!(f, "exit code: {}", code), + } + } +} + +/// Missing methods for Child objects +pub trait ChildExt { + /// Send a signal to a Child process. + fn send_signal(&mut self, signal: usize) -> io::Result<()>; + + /// Wait for a process to finish or return after the specified duration. + fn wait_or_timeout(&mut self, timeout: f64) -> io::Result>; +} + +impl ChildExt for Child { + fn send_signal(&mut self, signal: usize) -> io::Result<()> { + if unsafe { libc::kill(self.id() as pid_t, + signal as i32) } != 0 { + Err(io::Error::last_os_error()) + } else { + Ok(()) + } + } + + fn wait_or_timeout(&mut self, timeout: f64) -> io::Result> { + // The result will be written to that Option, protected by a Mutex + // Then the Condvar will be signaled + let state = Arc::new(( + Mutex::new(Option::None::>), + Condvar::new(), + )); + + // Start the waiting thread + let state_th = state.clone(); + let pid_th = self.id(); + thread::spawn(move || { + let &(ref lock_th, ref cvar_th) = &*state_th; + // Child::wait() would need a &mut to self, can't use that... + // use waitpid() directly, with our own ExitStatus + let mut status: c_int = 0; + let r = unsafe { libc::waitpid(pid_th as i32, &mut status, 0) }; + // Fill the Option and notify on the Condvar + let mut exitstatus_th = lock_th.lock().unwrap(); + if r != pid_th as c_int { + *exitstatus_th = Some(Err(io::Error::last_os_error())); + } else { + let s = ExitStatus::from_status(status); + *exitstatus_th = Some(Ok(s)); + } + cvar_th.notify_one(); + }); + + // Main thread waits + let &(ref lock, ref cvar) = &*state; + let mut exitstatus = lock.lock().unwrap(); + // Condvar::wait_timeout_ms() can wake too soon, in this case wait again + let target = get_time() + + Duration::seconds(timeout as i64) + + Duration::nanoseconds((timeout * 1.0e-6) as i64); + while exitstatus.is_none() { + let now = get_time(); + if now >= target { + return Ok(None) + } + let ms = (target - get_time()).num_milliseconds() as u32; + exitstatus = cvar.wait_timeout(exitstatus, StdDuration::new(0, ms*1000)).unwrap().0; + } + + // Turn Option> into Result> + match exitstatus.take() { + Some(r) => match r { + Ok(s) => Ok(Some(s)), + Err(e) => Err(e), + }, + None => panic!(), + } + } +} diff --git a/src/uucore/signals.rs b/src/uucore/signals.rs new file mode 100644 index 000000000..62db82f1b --- /dev/null +++ b/src/uucore/signals.rs @@ -0,0 +1,156 @@ +/* + * This file is part of the uutils coreutils package. + * + * (c) Maciej Dziardziel + * + * For the full copyright and license information, please view the LICENSE file + * that was distributed with this source code. + */ + +pub static DEFAULT_SIGNAL:usize= 15; + + +pub struct Signal<'a> { pub name:&'a str, pub value: usize} + +/* + +Linux Programmer's Manual + + 1 HUP 2 INT 3 QUIT 4 ILL 5 TRAP 6 ABRT 7 BUS + 8 FPE 9 KILL 10 USR1 11 SEGV 12 USR2 13 PIPE 14 ALRM +15 TERM 16 STKFLT 17 CHLD 18 CONT 19 STOP 20 TSTP 21 TTIN +22 TTOU 23 URG 24 XCPU 25 XFSZ 26 VTALRM 27 PROF 28 WINCH +29 POLL 30 PWR 31 SYS + + +*/ + +#[cfg(target_os = "linux")] +pub static ALL_SIGNALS:[Signal<'static>; 31] = [ + Signal{ name: "HUP", value:1 }, + Signal{ name: "INT", value:2 }, + Signal{ name: "QUIT", value:3 }, + Signal{ name: "ILL", value:4 }, + Signal{ name: "TRAP", value:5 }, + Signal{ name: "ABRT", value:6 }, + Signal{ name: "BUS", value:7 }, + Signal{ name: "FPE", value:8 }, + Signal{ name: "KILL", value:9 }, + Signal{ name: "USR1", value:10 }, + Signal{ name: "SEGV", value:11 }, + Signal{ name: "USR2", value:12 }, + Signal{ name: "PIPE", value:13 }, + Signal{ name: "ALRM", value:14 }, + Signal{ name: "TERM", value:15 }, + Signal{ name: "STKFLT", value:16 }, + Signal{ name: "CHLD", value:17 }, + Signal{ name: "CONT", value:18 }, + Signal{ name: "STOP", value:19 }, + Signal{ name: "TSTP", value:20 }, + Signal{ name: "TTIN", value:21 }, + Signal{ name: "TTOU", value:22 }, + Signal{ name: "URG", value:23 }, + Signal{ name: "XCPU", value:24 }, + Signal{ name: "XFSZ", value:25 }, + Signal{ name: "VTALRM", value:26 }, + Signal{ name: "PROF", value:27 }, + Signal{ name: "WINCH", value:28 }, + Signal{ name: "POLL", value:29 }, + Signal{ name: "PWR", value:30 }, + Signal{ name: "SYS", value:31 }, +]; + + +/* + + +https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/signal.3.html + + +No Name Default Action Description +1 SIGHUP terminate process terminal line hangup +2 SIGINT terminate process interrupt program +3 SIGQUIT create core image quit program +4 SIGILL create core image illegal instruction +5 SIGTRAP create core image trace trap +6 SIGABRT create core image abort program (formerly SIGIOT) +7 SIGEMT create core image emulate instruction executed +8 SIGFPE create core image floating-point exception +9 SIGKILL terminate process kill program +10 SIGBUS create core image bus error +11 SIGSEGV create core image segmentation violation +12 SIGSYS create core image non-existent system call invoked +13 SIGPIPE terminate process write on a pipe with no reader +14 SIGALRM terminate process real-time timer expired +15 SIGTERM terminate process software termination signal +16 SIGURG discard signal urgent condition present on socket +17 SIGSTOP stop process stop (cannot be caught or ignored) +18 SIGTSTP stop process stop signal generated from keyboard +19 SIGCONT discard signal continue after stop +20 SIGCHLD discard signal child status has changed +21 SIGTTIN stop process background read attempted from control terminal +22 SIGTTOU stop process background write attempted to control terminal +23 SIGIO discard signal I/O is possible on a descriptor (see fcntl(2)) +24 SIGXCPU terminate process cpu time limit exceeded (see setrlimit(2)) +25 SIGXFSZ terminate process file size limit exceeded (see setrlimit(2)) +26 SIGVTALRM terminate process virtual time alarm (see setitimer(2)) +27 SIGPROF terminate process profiling timer alarm (see setitimer(2)) +28 SIGWINCH discard signal Window size change +29 SIGINFO discard signal status request from keyboard +30 SIGUSR1 terminate process User defined signal 1 +31 SIGUSR2 terminate process User defined signal 2 + +*/ + +#[cfg(any(target_os = "macos", target_os = "freebsd"))] +pub static ALL_SIGNALS:[Signal<'static>; 31] = [ + Signal{ name: "HUP", value:1 }, + Signal{ name: "INT", value:2 }, + Signal{ name: "QUIT", value:3 }, + Signal{ name: "ILL", value:4 }, + Signal{ name: "TRAP", value:5 }, + Signal{ name: "ABRT", value:6 }, + Signal{ name: "EMT", value:7 }, + Signal{ name: "FPE", value:8 }, + Signal{ name: "KILL", value:9 }, + Signal{ name: "BUS", value:10 }, + Signal{ name: "SEGV", value:11 }, + Signal{ name: "SYS", value:12 }, + Signal{ name: "PIPE", value:13 }, + Signal{ name: "ALRM", value:14 }, + Signal{ name: "TERM", value:15 }, + Signal{ name: "URG", value:16 }, + Signal{ name: "STOP", value:17 }, + Signal{ name: "TSTP", value:18 }, + Signal{ name: "CONT", value:19 }, + Signal{ name: "CHLD", value:20 }, + Signal{ name: "TTIN", value:21 }, + Signal{ name: "TTOU", value:22 }, + Signal{ name: "IO", value:23 }, + Signal{ name: "XCPU", value:24 }, + Signal{ name: "XFSZ", value:25 }, + Signal{ name: "VTALRM", value:26 }, + Signal{ name: "PROF", value:27 }, + Signal{ name: "WINCH", value:28 }, + Signal{ name: "INFO", value:29 }, + Signal{ name: "USR1", value:30 }, + Signal{ name: "USR2", value:31 }, +]; + +pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { + if signal_name_or_value == "0" { + return Some(0); + } + for signal in ALL_SIGNALS.iter() { + let long_name = format!("SIG{}", signal.name); + if signal.name == signal_name_or_value || (signal_name_or_value == signal.value.to_string()) || (long_name == signal_name_or_value) { + return Some(signal.value); + } + } + None +} + +#[inline(always)] +pub fn is_signal(num: usize) -> bool { + num < ALL_SIGNALS.len() +} diff --git a/src/uucore/utmpx.rs b/src/uucore/utmpx.rs new file mode 100644 index 000000000..58bedc91a --- /dev/null +++ b/src/uucore/utmpx.rs @@ -0,0 +1,125 @@ +#![allow(dead_code, non_camel_case_types)] + +extern crate libc; + +pub use self::utmpx::{DEFAULT_FILE,USER_PROCESS,BOOT_TIME,c_utmp}; +#[cfg(target_os = "linux")] +mod utmpx { + use super::libc; + + pub static DEFAULT_FILE: &'static str = "/var/run/utmp"; + + pub const UT_LINESIZE: usize = 32; + pub const UT_NAMESIZE: usize = 32; + pub const UT_IDSIZE: usize = 4; + pub const UT_HOSTSIZE: usize = 256; + + pub const EMPTY: libc::c_short = 0; + pub const RUN_LVL: libc::c_short = 1; + pub const BOOT_TIME: libc::c_short = 2; + pub const NEW_TIME: libc::c_short = 3; + pub const OLD_TIME: libc::c_short = 4; + pub const INIT_PROCESS: libc::c_short = 5; + pub const LOGIN_PROCESS: libc::c_short = 6; + pub const USER_PROCESS: libc::c_short = 7; + pub const DEAD_PROCESS: libc::c_short = 8; + pub const ACCOUNTING: libc::c_short = 9; + + #[repr(C)] + pub struct c_exit_status { + pub e_termination: libc::c_short, + pub e_exit: libc::c_short, + } + + #[repr(C)] + pub struct c_utmp { + pub ut_type: libc::c_short, + pub ut_pid: libc::pid_t, + pub ut_line: [libc::c_char; UT_LINESIZE], + pub ut_id: [libc::c_char; UT_IDSIZE], + + pub ut_user: [libc::c_char; UT_NAMESIZE], + pub ut_host: [libc::c_char; UT_HOSTSIZE], + pub ut_exit: c_exit_status, + pub ut_session: libc::c_long, + pub ut_tv: libc::timeval, + + pub ut_addr_v6: [libc::int32_t; 4], + pub __unused: [libc::c_char; 20], + } +} + +#[cfg(target_os = "macos")] +mod utmpx { + use super::libc; + + pub static DEFAULT_FILE: &'static str = "/var/run/utmpx"; + + pub const UT_LINESIZE: usize = 32; + pub const UT_NAMESIZE: usize = 256; + pub const UT_IDSIZE: usize = 4; + pub const UT_HOSTSIZE: usize = 256; + + pub const EMPTY: libc::c_short = 0; + pub const RUN_LVL: libc::c_short = 1; + pub const BOOT_TIME: libc::c_short = 2; + pub const OLD_TIME: libc::c_short = 3; + pub const NEW_TIME: libc::c_short = 4; + pub const INIT_PROCESS: libc::c_short = 5; + pub const LOGIN_PROCESS: libc::c_short = 6; + pub const USER_PROCESS: libc::c_short = 7; + pub const DEAD_PROCESS: libc::c_short = 8; + pub const ACCOUNTING: libc::c_short = 9; + + #[repr(C)] + pub struct c_exit_status { + pub e_termination: libc::c_short, + pub e_exit: libc::c_short, + } + + #[repr(C)] + pub struct c_utmp { + pub ut_user: [libc::c_char; UT_NAMESIZE], + pub ut_id: [libc::c_char; UT_IDSIZE], + pub ut_line: [libc::c_char; UT_LINESIZE], + pub ut_pid: libc::pid_t, + pub ut_type: libc::c_short, + pub ut_tv: libc::timeval, + pub ut_host: [libc::c_char; UT_HOSTSIZE], + pub __unused: [libc::c_char; 16] + } +} + +#[cfg(target_os = "freebsd")] +mod utmpx { + use super::libc; + + pub static DEFAULT_FILE : &'static str = ""; + + pub const UT_LINESIZE : usize = 16; + pub const UT_NAMESIZE : usize = 32; + pub const UT_IDSIZE : usize = 8; + pub const UT_HOSTSIZE : usize = 128; + + pub const EMPTY : libc::c_short = 0; + pub const BOOT_TIME : libc::c_short = 1; + pub const OLD_TIME : libc::c_short = 2; + pub const NEW_TIME : libc::c_short = 3; + pub const USER_PROCESS : libc::c_short = 4; + pub const INIT_PROCESS : libc::c_short = 5; + pub const LOGIN_PROCESS : libc::c_short = 6; + pub const DEAD_PROCESS : libc::c_short = 7; + pub const SHUTDOWN_TIME : libc::c_short = 8; + + #[repr(C)] + pub struct c_utmp { + pub ut_type : libc::c_short, + pub ut_tv : libc::timeval, + pub ut_id : [libc::c_char; UT_IDSIZE], + pub ut_pid : libc::pid_t, + pub ut_user : [libc::c_char; UT_NAMESIZE], + pub ut_line : [libc::c_char; UT_LINESIZE], + pub ut_host : [libc::c_char; UT_HOSTSIZE], + pub ut_spare : [libc::c_char; 64], + } +} diff --git a/src/uucore/wide.rs b/src/uucore/wide.rs new file mode 100644 index 000000000..189e84438 --- /dev/null +++ b/src/uucore/wide.rs @@ -0,0 +1,35 @@ +/* + * This file is part of the uutils coreutils package. + * + * (c) Peter Atashian + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +use std::ffi::{OsStr, OsString}; +use std::os::windows::ffi::{OsStrExt, OsStringExt}; +pub trait ToWide { + fn to_wide(&self) -> Vec; + fn to_wide_null(&self) -> Vec; +} +impl ToWide for T where T: AsRef { + fn to_wide(&self) -> Vec { + self.as_ref().encode_wide().collect() + } + fn to_wide_null(&self) -> Vec { + self.as_ref().encode_wide().chain(Some(0)).collect() + } +} +pub trait FromWide { + fn from_wide(wide: &[u16]) -> Self; + fn from_wide_null(wide: &[u16]) -> Self; +} +impl FromWide for String { + fn from_wide(wide: &[u16]) -> String { + OsString::from_wide(wide).to_string_lossy().into_owned() + } + fn from_wide_null(wide: &[u16]) -> String { + let len = wide.iter().take_while(|&&c| c != 0).count(); + OsString::from_wide(&wide[..len]).to_string_lossy().into_owned() + } +} \ No newline at end of file From 23e031526212a771f6b436f5377384104944a293 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Fri, 27 Nov 2015 22:21:51 +0100 Subject: [PATCH 063/606] Remove deprecated lint --- src/uucore/c_types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/c_types.rs b/src/uucore/c_types.rs index 49e01d582..54478a107 100644 --- a/src/uucore/c_types.rs +++ b/src/uucore/c_types.rs @@ -1,4 +1,4 @@ -#![allow(dead_code, non_camel_case_types, raw_pointer_derive)] +#![allow(dead_code, non_camel_case_types)] extern crate libc; From 14eccb4335809d2784792357b01cbf01bf0690e1 Mon Sep 17 00:00:00 2001 From: Joseph Crail Date: Sun, 29 Nov 2015 17:27:43 -0500 Subject: [PATCH 064/606] uucore: specify a few modules to be Unix-only --- src/uucore/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index adbe7fe80..17fd1071f 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -4,10 +4,11 @@ extern crate time; #[macro_use] mod macros; -pub mod c_types; pub mod fs; pub mod parse_time; -pub mod process; + +#[cfg(unix)] pub mod c_types; +#[cfg(unix)] pub mod process; #[cfg(unix)] pub mod signals; #[cfg(unix)] pub mod utmpx; From 9c4c9f67824caa3ff20b47811ff5ebbab85a39bd Mon Sep 17 00:00:00 2001 From: Joseph Crail Date: Sun, 29 Nov 2015 21:03:53 -0500 Subject: [PATCH 065/606] 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). --- src/uucore/fs.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index e0372b357..461c70940 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -12,6 +12,7 @@ // be backported to stable (<= 1.1). This will likely be dropped // when the path trait stabilizes. +use ::libc; use std::env; use std::fs; use std::io::{Error, ErrorKind, Result}; @@ -142,3 +143,33 @@ pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> } Ok(result) } + +#[cfg(unix)] +pub fn is_stdin_interactive() -> bool { + unsafe { libc::isatty(libc::STDIN_FILENO) == 1 } +} + +#[cfg(windows)] +pub fn is_stdin_interactive() -> bool { + 0 +} + +#[cfg(unix)] +pub fn is_stdout_interactive() -> bool { + unsafe { libc::isatty(libc::STDOUT_FILENO) == 1 } +} + +#[cfg(windows)] +pub fn is_stdout_interactive() -> bool { + 0 +} + +#[cfg(unix)] +pub fn is_stderr_interactive() -> bool { + unsafe { libc::isatty(libc::STDERR_FILENO) == 1 } +} + +#[cfg(windows)] +pub fn is_stderr_interactive() -> bool { + 0 +} From 3863842fae844c262aa95de91f5a8234ce63b329 Mon Sep 17 00:00:00 2001 From: Joseph Crail Date: Tue, 1 Dec 2015 01:27:08 -0500 Subject: [PATCH 066/606] Fix errors with bools represented as ints. --- src/uucore/fs.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index 461c70940..660086202 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -151,7 +151,7 @@ pub fn is_stdin_interactive() -> bool { #[cfg(windows)] pub fn is_stdin_interactive() -> bool { - 0 + false } #[cfg(unix)] @@ -161,7 +161,7 @@ pub fn is_stdout_interactive() -> bool { #[cfg(windows)] pub fn is_stdout_interactive() -> bool { - 0 + false } #[cfg(unix)] @@ -171,5 +171,5 @@ pub fn is_stderr_interactive() -> bool { #[cfg(windows)] pub fn is_stderr_interactive() -> bool { - 0 + false } From b8ee12f703aab2eabfd180201d583bf6b8b72aaa Mon Sep 17 00:00:00 2001 From: Joseph Crail Date: Tue, 1 Dec 2015 01:27:20 -0500 Subject: [PATCH 067/606] More import fixes for Windows. --- src/uucore/Cargo.toml | 1 + src/uucore/fs.rs | 3 ++- src/uucore/lib.rs | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 65c4d6a01..43866d864 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -6,6 +6,7 @@ authors = [] [dependencies] libc = "*" time = "*" +winapi = "*" [lib] path = "lib.rs" diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index 660086202..f875f679b 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -12,7 +12,8 @@ // be backported to stable (<= 1.1). This will likely be dropped // when the path trait stabilizes. -use ::libc; +#[cfg(unix)] +use super::libc; use std::env; use std::fs; use std::io::{Error, ErrorKind, Result}; diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index 17fd1071f..f5788e8d6 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -1,5 +1,6 @@ extern crate libc; extern crate time; +#[cfg(windows)] extern crate winapi; #[macro_use] mod macros; From 0678332a1f76a2b44c736ff47f0962598ab6ed72 Mon Sep 17 00:00:00 2001 From: Joseph Crail Date: Mon, 7 Dec 2015 21:49:18 -0500 Subject: [PATCH 068/606] Add macro to properly find program name. --- src/uucore/macros.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/uucore/macros.rs b/src/uucore/macros.rs index 89fa1c2a6..8789b7e6c 100644 --- a/src/uucore/macros.rs +++ b/src/uucore/macros.rs @@ -7,10 +7,22 @@ * file that was distributed with this source code. */ +#[macro_export] +macro_rules! executable( + () => ({ + let module = module_path!(); + if &module[0..3] == "uu_" { + &module[3..] + } else { + module + } + }) +); + #[macro_export] macro_rules! show_error( ($($args:tt)+) => ({ - pipe_write!(&mut ::std::io::stderr(), "{}: error: ", module_path!()); + pipe_write!(&mut ::std::io::stderr(), "{}: error: ", executable!()); pipe_writeln!(&mut ::std::io::stderr(), $($args)+); }) ); @@ -18,7 +30,7 @@ macro_rules! show_error( #[macro_export] macro_rules! show_warning( ($($args:tt)+) => ({ - pipe_write!(&mut ::std::io::stderr(), "{}: warning: ", module_path!()); + pipe_write!(&mut ::std::io::stderr(), "{}: warning: ", executable!()); pipe_writeln!(&mut ::std::io::stderr(), $($args)+); }) ); @@ -26,7 +38,7 @@ macro_rules! show_warning( #[macro_export] macro_rules! show_info( ($($args:tt)+) => ({ - pipe_write!(&mut ::std::io::stderr(), "{}: ", module_path!()); + pipe_write!(&mut ::std::io::stderr(), "{}: ", executable!()); pipe_writeln!(&mut ::std::io::stderr(), $($args)+); }) ); From bde309a29fc3ebe2429a622befe76c12bec18cf2 Mon Sep 17 00:00:00 2001 From: Joseph Crail Date: Thu, 10 Dec 2015 14:20:01 -0500 Subject: [PATCH 069/606] 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. --- src/uucore/fs.rs | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index f875f679b..682abe00c 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -7,11 +7,6 @@ * file that was distributed with this source code. */ -// Based on the pattern using by Cargo, I created a shim over the -// standard PathExt trait, so that the unstable path methods could -// be backported to stable (<= 1.1). This will likely be dropped -// when the path trait stabilizes. - #[cfg(unix)] use super::libc; use std::env; @@ -19,31 +14,6 @@ use std::fs; use std::io::{Error, ErrorKind, Result}; use std::path::{Component, Path, PathBuf}; -pub trait UUPathExt { - fn uu_exists(&self) -> bool; - fn uu_is_file(&self) -> bool; - fn uu_is_dir(&self) -> bool; - fn uu_metadata(&self) -> Result; -} - -impl UUPathExt for Path { - fn uu_exists(&self) -> bool { - fs::metadata(self).is_ok() - } - - fn uu_is_file(&self) -> bool { - fs::metadata(self).map(|m| m.is_file()).unwrap_or(false) - } - - fn uu_is_dir(&self) -> bool { - fs::metadata(self).map(|m| m.is_dir()).unwrap_or(false) - } - - fn uu_metadata(&self) -> Result { - fs::metadata(self) - } -} - #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum CanonicalizeMode { None, From ce733b38a96344f6f6ec4f06b5ea36a02e660d19 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Sun, 13 Dec 2015 09:21:15 +0100 Subject: [PATCH 070/606] Fix arm build Fixes #719 --- src/uucore/c_types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/c_types.rs b/src/uucore/c_types.rs index 54478a107..cdc8b3649 100644 --- a/src/uucore/c_types.rs +++ b/src/uucore/c_types.rs @@ -128,7 +128,7 @@ pub fn get_pw_from_args(free: &Vec) -> Option { } else { let pw_pointer = unsafe { let cstr = CString::new(username).unwrap(); - getpwnam(cstr.as_bytes_with_nul().as_ptr() as *const i8) + getpwnam(cstr.as_bytes_with_nul().as_ptr() as *const _) }; if !pw_pointer.is_null() { Some(unsafe { read(pw_pointer) }) From 0a3a2ca935b7c05bc59b8d0063fc37bd58f9006c Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Tue, 5 Jan 2016 20:42:52 +0100 Subject: [PATCH 071/606] Fix clippy warnings --- src/uucore/c_types.rs | 4 ++-- src/uucore/fs.rs | 2 +- src/uucore/parse_time.rs | 2 +- src/uucore/signals.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/uucore/c_types.rs b/src/uucore/c_types.rs index cdc8b3649..477927ba0 100644 --- a/src/uucore/c_types.rs +++ b/src/uucore/c_types.rs @@ -109,7 +109,7 @@ extern { pub fn getgroupcount(name: *const c_char, gid: gid_t) -> int32_t; } -pub fn get_pw_from_args(free: &Vec) -> Option { +pub fn get_pw_from_args(free: &[String]) -> Option { if free.len() == 1 { let username = &free[0][..]; @@ -219,7 +219,7 @@ pub fn group(possible_pw: Option, nflag: bool) { Err(errno) => crash!(1, "failed to get group list (errno={})", errno), Ok(groups) => { - for &g in groups.iter() { + for &g in &groups { if nflag { let group = unsafe { getgrgid(g) }; if !group.is_null() { diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index 682abe00c..19a77e109 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -82,7 +82,7 @@ pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> } // Resolve the symlinks where possible - if parts.len() > 0 { + if !parts.is_empty() { for part in parts[..parts.len()-1].iter() { result.push(part); diff --git a/src/uucore/parse_time.rs b/src/uucore/parse_time.rs index 608601fe1..2315edb98 100644 --- a/src/uucore/parse_time.rs +++ b/src/uucore/parse_time.rs @@ -10,7 +10,7 @@ pub fn from_str(string: &str) -> Result { let len = string.len(); if len == 0 { - return Err("empty string".to_string()) + return Err("empty string".to_owned()) } let slice = &string[..len - 1]; let (numstr, times) = match string.chars().next_back().unwrap() { diff --git a/src/uucore/signals.rs b/src/uucore/signals.rs index 62db82f1b..db360975a 100644 --- a/src/uucore/signals.rs +++ b/src/uucore/signals.rs @@ -141,7 +141,7 @@ pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { if signal_name_or_value == "0" { return Some(0); } - for signal in ALL_SIGNALS.iter() { + for signal in &ALL_SIGNALS { let long_name = format!("SIG{}", signal.name); if signal.name == signal_name_or_value || (signal_name_or_value == signal.value.to_string()) || (long_name == signal_name_or_value) { return Some(signal.value); From 512a6a32010f0184d5ee1fcc0b459b7837346aad Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Wed, 6 Jan 2016 16:34:58 +0100 Subject: [PATCH 072/606] expand, unexpand: fix build on stable --- src/uucore/lib.rs | 1 + src/uucore/utf8.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/uucore/utf8.rs diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index f5788e8d6..53a02aca2 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -7,6 +7,7 @@ mod macros; pub mod fs; pub mod parse_time; +pub mod utf8; #[cfg(unix)] pub mod c_types; #[cfg(unix)] pub mod process; diff --git a/src/uucore/utf8.rs b/src/uucore/utf8.rs new file mode 100644 index 000000000..a6c48b785 --- /dev/null +++ b/src/uucore/utf8.rs @@ -0,0 +1,28 @@ +/* This is taken from the rust_unicode crate. Remove once 'unicode' becomes stable */ + +// https://tools.ietf.org/html/rfc3629 +static UTF8_CHAR_WIDTH: [u8; 256] = [ +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1F +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3F +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5F +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7F +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9F +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBF +0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2, +2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDF +3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEF +4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0, // 0xFF +]; + +/// Given a first byte, determine how many bytes are in this UTF-8 character +#[inline] +pub fn utf8_char_width(b: u8) -> usize { + return UTF8_CHAR_WIDTH[b as usize] as usize; +} + From a149efe45a20c813b1da43aa55046910817483a8 Mon Sep 17 00:00:00 2001 From: Arcterus Date: Sun, 10 Jan 2016 03:39:26 -0800 Subject: [PATCH 073/606] uucore: don't follow symlinks when examining them (fixes #799) --- src/uucore/fs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index 19a77e109..e4929c215 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -31,7 +31,7 @@ fn resolve>(original: P) -> Result { return Err(Error::new(ErrorKind::InvalidInput, "maximum links followed")); } - match fs::metadata(&result) { + match fs::symlink_metadata(&result) { Err(e) => return Err(e), Ok(ref m) if !m.file_type().is_symlink() => break, Ok(..) => { From 713770c9ae2decdedc02fa2caa0d3f6a37abf023 Mon Sep 17 00:00:00 2001 From: Shiroy Date: Wed, 23 Mar 2016 08:44:09 +0100 Subject: [PATCH 074/606] Add missing lib.name for uucore Fix build on Linux --- src/uucore/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 43866d864..758a94d37 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -10,3 +10,4 @@ winapi = "*" [lib] path = "lib.rs" +name = "uucore" From b0588e482ed88c51324b865f2a1ce82755981c8c Mon Sep 17 00:00:00 2001 From: Knight Date: Sat, 21 May 2016 18:19:13 +0800 Subject: [PATCH 075/606] uucore: add disp_err macro --- src/uucore/macros.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/uucore/macros.rs b/src/uucore/macros.rs index 8789b7e6c..21691dc5c 100644 --- a/src/uucore/macros.rs +++ b/src/uucore/macros.rs @@ -43,6 +43,15 @@ macro_rules! show_info( }) ); +#[macro_export] +macro_rules! disp_err( + ($($args:tt)+) => ({ + pipe_write!(&mut ::std::io::stderr(), "{}: ", executable!()); + pipe_writeln!(&mut ::std::io::stderr(), $($args)+); + pipe_writeln!(&mut ::std::io::stderr(), "Try '{} --help' for more information.", executable!()); + }) +); + #[macro_export] macro_rules! eprint( ($($args:tt)+) => (pipe_write!(&mut ::std::io::stderr(), $($args)+)) From 967babd1e64b089198fa289579129e574f39a00a Mon Sep 17 00:00:00 2001 From: Knight Date: Mon, 25 Jul 2016 20:22:43 +0800 Subject: [PATCH 076/606] pinky: implement short format --- src/uucore/utmpx.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/uucore/utmpx.rs b/src/uucore/utmpx.rs index 58bedc91a..037c1d514 100644 --- a/src/uucore/utmpx.rs +++ b/src/uucore/utmpx.rs @@ -2,7 +2,7 @@ extern crate libc; -pub use self::utmpx::{DEFAULT_FILE,USER_PROCESS,BOOT_TIME,c_utmp}; +pub use self::utmpx::{UT_NAMESIZE,UT_LINESIZE,DEFAULT_FILE,USER_PROCESS,BOOT_TIME,c_utmp}; #[cfg(target_os = "linux")] mod utmpx { use super::libc; @@ -25,6 +25,12 @@ mod utmpx { pub const DEAD_PROCESS: libc::c_short = 8; pub const ACCOUNTING: libc::c_short = 9; + #[repr(C)] + pub struct timeval { + pub tv_sec: libc::int32_t, + pub tv_usec: libc::int32_t, + } + #[repr(C)] pub struct c_exit_status { pub e_termination: libc::c_short, @@ -41,8 +47,8 @@ mod utmpx { pub ut_user: [libc::c_char; UT_NAMESIZE], pub ut_host: [libc::c_char; UT_HOSTSIZE], pub ut_exit: c_exit_status, - pub ut_session: libc::c_long, - pub ut_tv: libc::timeval, + pub ut_session: libc::int32_t, + pub ut_tv: timeval, pub ut_addr_v6: [libc::int32_t; 4], pub __unused: [libc::c_char; 20], From 6e2c3ede40b665c4171eab0db101dc4312651f8d Mon Sep 17 00:00:00 2001 From: Knight Date: Tue, 26 Jul 2016 13:32:00 +0800 Subject: [PATCH 077/606] uucore::utmpx: revert the changes --- src/uucore/utmpx.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/uucore/utmpx.rs b/src/uucore/utmpx.rs index 037c1d514..8b6bc742e 100644 --- a/src/uucore/utmpx.rs +++ b/src/uucore/utmpx.rs @@ -25,12 +25,6 @@ mod utmpx { pub const DEAD_PROCESS: libc::c_short = 8; pub const ACCOUNTING: libc::c_short = 9; - #[repr(C)] - pub struct timeval { - pub tv_sec: libc::int32_t, - pub tv_usec: libc::int32_t, - } - #[repr(C)] pub struct c_exit_status { pub e_termination: libc::c_short, @@ -47,8 +41,8 @@ mod utmpx { pub ut_user: [libc::c_char; UT_NAMESIZE], pub ut_host: [libc::c_char; UT_HOSTSIZE], pub ut_exit: c_exit_status, - pub ut_session: libc::int32_t, - pub ut_tv: timeval, + pub ut_session: libc::c_long, + pub ut_tv: libc::timeval, pub ut_addr_v6: [libc::int32_t; 4], pub __unused: [libc::c_char; 20], From 79b683561240c7e6201ad574070674274d04786c Mon Sep 17 00:00:00 2001 From: Knight Date: Tue, 26 Jul 2016 16:43:03 +0800 Subject: [PATCH 078/606] pinky: cleanup the code --- src/uucore/c_types.rs | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/src/uucore/c_types.rs b/src/uucore/c_types.rs index 477927ba0..89169979b 100644 --- a/src/uucore/c_types.rs +++ b/src/uucore/c_types.rs @@ -8,6 +8,8 @@ use self::libc::{ uid_t, gid_t, }; +pub use self::libc::passwd as c_passwd; + #[cfg(any(target_os = "macos", target_os = "freebsd"))] use self::libc::time_t; #[cfg(target_os = "macos")] @@ -22,35 +24,6 @@ use std::vec::Vec; use std::ptr::{null_mut, read}; -#[cfg(any(target_os = "macos", target_os = "freebsd"))] -#[repr(C)] -#[derive(Clone, Copy)] -pub struct c_passwd { - pub pw_name: *const c_char, /* user name */ - pub pw_passwd: *const c_char, /* user name */ - pub pw_uid: uid_t, /* user uid */ - pub pw_gid: gid_t, /* user gid */ - pub pw_change: time_t, - pub pw_class: *const c_char, - pub pw_gecos: *const c_char, - pub pw_dir: *const c_char, - pub pw_shell: *const c_char, - pub pw_expire: time_t -} - -#[cfg(target_os = "linux")] -#[repr(C)] -#[derive(Clone, Copy)] -pub struct c_passwd { - pub pw_name: *const c_char, /* user name */ - pub pw_passwd: *const c_char, /* user name */ - pub pw_uid: uid_t, /* user uid */ - pub pw_gid: gid_t, /* user gid */ - pub pw_gecos: *const c_char, - pub pw_dir: *const c_char, - pub pw_shell: *const c_char, -} - #[cfg(any(target_os = "macos", target_os = "freebsd"))] #[repr(C)] pub struct utsname { From 463c6af4e3b59970a6a427f2670d784fa4f86910 Mon Sep 17 00:00:00 2001 From: Knight Date: Thu, 4 Aug 2016 22:37:54 +0800 Subject: [PATCH 079/606] uucore: update utmpx --- src/uucore/utmpx.rs | 94 +++++++++++++++++++++++++++++---------------- 1 file changed, 61 insertions(+), 33 deletions(-) diff --git a/src/uucore/utmpx.rs b/src/uucore/utmpx.rs index 8b6bc742e..c249e2a94 100644 --- a/src/uucore/utmpx.rs +++ b/src/uucore/utmpx.rs @@ -2,7 +2,26 @@ extern crate libc; -pub use self::utmpx::{UT_NAMESIZE,UT_LINESIZE,DEFAULT_FILE,USER_PROCESS,BOOT_TIME,c_utmp}; +pub use self::utmpx::{UT_NAMESIZE, UT_LINESIZE, DEFAULT_FILE, USER_PROCESS, BOOT_TIME}; +pub use self::utmpx::c_utmp; + +extern "C" { + pub fn getutxent() -> *const c_utmp; + pub fn getutxid(ut: *const c_utmp) -> *const c_utmp; + pub fn getutxline(ut: *const c_utmp) -> *const c_utmp; + pub fn pututxline(ut: *const c_utmp) -> *const c_utmp; + pub fn setutxent(); + pub fn endutxent(); + + #[cfg(any(target_os = "macos", target_os = "linux"))] + pub fn utmpxname(file: *const libc::c_char) -> libc::c_int; +} + +#[cfg(target_os = "freebsd")] +pub unsafe extern fn utmpxname(_file: *const libc::c_char) -> libc::c_int { + 0 +} + #[cfg(target_os = "linux")] mod utmpx { use super::libc; @@ -26,11 +45,18 @@ mod utmpx { pub const ACCOUNTING: libc::c_short = 9; #[repr(C)] - pub struct c_exit_status { + pub struct __exit_status { pub e_termination: libc::c_short, pub e_exit: libc::c_short, } + #[repr(C)] + #[derive(Copy, Clone)] + pub struct __timeval { + pub tv_sec: libc::int32_t, + pub tv_usec: libc::int32_t, + } + #[repr(C)] pub struct c_utmp { pub ut_type: libc::c_short, @@ -40,12 +66,20 @@ mod utmpx { pub ut_user: [libc::c_char; UT_NAMESIZE], pub ut_host: [libc::c_char; UT_HOSTSIZE], - pub ut_exit: c_exit_status, + pub ut_exit: __exit_status, + + #[cfg(target_pointer_width = "32")] pub ut_session: libc::c_long, + #[cfg(target_pointer_width = "32")] pub ut_tv: libc::timeval, + #[cfg(target_pointer_width = "64")] + pub ut_session: libc::int32_t, + #[cfg(target_pointer_width = "64")] + pub ut_tv: __timeval, + pub ut_addr_v6: [libc::int32_t; 4], - pub __unused: [libc::c_char; 20], + __glibc_reserved: [libc::c_char; 20], } } @@ -71,12 +105,6 @@ mod utmpx { pub const DEAD_PROCESS: libc::c_short = 8; pub const ACCOUNTING: libc::c_short = 9; - #[repr(C)] - pub struct c_exit_status { - pub e_termination: libc::c_short, - pub e_exit: libc::c_short, - } - #[repr(C)] pub struct c_utmp { pub ut_user: [libc::c_char; UT_NAMESIZE], @@ -86,7 +114,7 @@ mod utmpx { pub ut_type: libc::c_short, pub ut_tv: libc::timeval, pub ut_host: [libc::c_char; UT_HOSTSIZE], - pub __unused: [libc::c_char; 16] + pub __unused: [libc::uint32_t; 16], } } @@ -94,32 +122,32 @@ mod utmpx { mod utmpx { use super::libc; - pub static DEFAULT_FILE : &'static str = ""; + pub static DEFAULT_FILE: &'static str = ""; - pub const UT_LINESIZE : usize = 16; - pub const UT_NAMESIZE : usize = 32; - pub const UT_IDSIZE : usize = 8; - pub const UT_HOSTSIZE : usize = 128; + pub const UT_LINESIZE: usize = 16; + pub const UT_NAMESIZE: usize = 32; + pub const UT_IDSIZE: usize = 8; + pub const UT_HOSTSIZE: usize = 128; - pub const EMPTY : libc::c_short = 0; - pub const BOOT_TIME : libc::c_short = 1; - pub const OLD_TIME : libc::c_short = 2; - pub const NEW_TIME : libc::c_short = 3; - pub const USER_PROCESS : libc::c_short = 4; - pub const INIT_PROCESS : libc::c_short = 5; - pub const LOGIN_PROCESS : libc::c_short = 6; - pub const DEAD_PROCESS : libc::c_short = 7; - pub const SHUTDOWN_TIME : libc::c_short = 8; + pub const EMPTY: libc::c_short = 0; + pub const BOOT_TIME: libc::c_short = 1; + pub const OLD_TIME: libc::c_short = 2; + pub const NEW_TIME: libc::c_short = 3; + pub const USER_PROCESS: libc::c_short = 4; + pub const INIT_PROCESS: libc::c_short = 5; + pub const LOGIN_PROCESS: libc::c_short = 6; + pub const DEAD_PROCESS: libc::c_short = 7; + pub const SHUTDOWN_TIME: libc::c_short = 8; #[repr(C)] pub struct c_utmp { - pub ut_type : libc::c_short, - pub ut_tv : libc::timeval, - pub ut_id : [libc::c_char; UT_IDSIZE], - pub ut_pid : libc::pid_t, - pub ut_user : [libc::c_char; UT_NAMESIZE], - pub ut_line : [libc::c_char; UT_LINESIZE], - pub ut_host : [libc::c_char; UT_HOSTSIZE], - pub ut_spare : [libc::c_char; 64], + pub ut_type: libc::c_short, + pub ut_tv: libc::timeval, + pub ut_id: [libc::c_char; UT_IDSIZE], + pub ut_pid: libc::pid_t, + pub ut_user: [libc::c_char; UT_NAMESIZE], + pub ut_line: [libc::c_char; UT_LINESIZE], + pub ut_host: [libc::c_char; UT_HOSTSIZE], + pub ut_spare: [libc::c_char; 64], } } From 72d2ab208c0225b4fcc792bbe138b35cb41c37bd Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Thu, 4 Aug 2016 19:16:38 -0400 Subject: [PATCH 080/606] Prefer handling `Duration` over `f32` when dealing with times. Also refactored out usage of the `time` crate in `uucore`. --- src/uucore/Cargo.toml | 1 - src/uucore/lib.rs | 1 - src/uucore/parse_time.rs | 18 +++++++++++++----- src/uucore/process.rs | 18 +++++++----------- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 758a94d37..becf9c2c0 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -5,7 +5,6 @@ authors = [] [dependencies] libc = "*" -time = "*" winapi = "*" [lib] diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index 53a02aca2..00f9f924c 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -1,5 +1,4 @@ extern crate libc; -extern crate time; #[cfg(windows)] extern crate winapi; #[macro_use] diff --git a/src/uucore/parse_time.rs b/src/uucore/parse_time.rs index 2315edb98..6083badd9 100644 --- a/src/uucore/parse_time.rs +++ b/src/uucore/parse_time.rs @@ -7,7 +7,9 @@ * file that was distributed with this source code. */ -pub fn from_str(string: &str) -> Result { +use std::time::Duration; + +pub fn from_str(string: &str) -> Result { let len = string.len(); if len == 0 { return Err("empty string".to_owned()) @@ -28,8 +30,14 @@ pub fn from_str(string: &str) -> Result { } } }; - match numstr.parse::() { - Ok(m) => Ok(m * times as f64), - Err(e) => Err(format!("invalid time interval '{}': {}", string, e)) - } + let num = match numstr.parse::() { + Ok(m) => m, + Err(e) => return Err(format!("invalid time interval '{}': {}", string, e)) + }; + + const NANOS_PER_SEC: u32 = 1_000_000_000; + let whole_secs = num.trunc(); + let nanos = (num.fract() * (NANOS_PER_SEC as f64)).trunc(); + let duration = Duration::new(whole_secs as u64, nanos as u32); + Ok(duration * times) } diff --git a/src/uucore/process.rs b/src/uucore/process.rs index d5ac317ea..7f86c447a 100644 --- a/src/uucore/process.rs +++ b/src/uucore/process.rs @@ -15,8 +15,7 @@ use std::io; use std::process::Child; use std::sync::{Arc, Condvar, Mutex}; use std::thread; -use time::{Duration, get_time}; -use std::time::Duration as StdDuration; +use std::time::{Duration, Instant}; // This is basically sys::unix::process::ExitStatus #[derive(PartialEq, Eq, Clone, Copy, Debug)] @@ -71,7 +70,7 @@ pub trait ChildExt { fn send_signal(&mut self, signal: usize) -> io::Result<()>; /// Wait for a process to finish or return after the specified duration. - fn wait_or_timeout(&mut self, timeout: f64) -> io::Result>; + fn wait_or_timeout(&mut self, timeout: Duration) -> io::Result>; } impl ChildExt for Child { @@ -84,7 +83,7 @@ impl ChildExt for Child { } } - fn wait_or_timeout(&mut self, timeout: f64) -> io::Result> { + fn wait_or_timeout(&mut self, timeout: Duration) -> io::Result> { // The result will be written to that Option, protected by a Mutex // Then the Condvar will be signaled let state = Arc::new(( @@ -116,16 +115,13 @@ impl ChildExt for Child { let &(ref lock, ref cvar) = &*state; let mut exitstatus = lock.lock().unwrap(); // Condvar::wait_timeout_ms() can wake too soon, in this case wait again - let target = get_time() + - Duration::seconds(timeout as i64) + - Duration::nanoseconds((timeout * 1.0e-6) as i64); + let start = Instant::now(); while exitstatus.is_none() { - let now = get_time(); - if now >= target { + if start.elapsed() >= timeout { return Ok(None) } - let ms = (target - get_time()).num_milliseconds() as u32; - exitstatus = cvar.wait_timeout(exitstatus, StdDuration::new(0, ms*1000)).unwrap().0; + let cvar_timeout = timeout - start.elapsed(); + exitstatus = cvar.wait_timeout(exitstatus, cvar_timeout).unwrap().0; } // Turn Option> into Result> From c6909951aae480cc5f6397ceb643b041acd492be Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Thu, 4 Aug 2016 20:02:55 -0400 Subject: [PATCH 081/606] Cleanup logic around `wait_or_timeout` exit status handling. --- src/uucore/process.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/uucore/process.rs b/src/uucore/process.rs index 7f86c447a..bb9bbbc3d 100644 --- a/src/uucore/process.rs +++ b/src/uucore/process.rs @@ -116,21 +116,15 @@ impl ChildExt for Child { let mut exitstatus = lock.lock().unwrap(); // Condvar::wait_timeout_ms() can wake too soon, in this case wait again let start = Instant::now(); - while exitstatus.is_none() { + loop { + if let Some(exitstatus) = exitstatus.take() { + return exitstatus.map(Some); + } if start.elapsed() >= timeout { return Ok(None) } let cvar_timeout = timeout - start.elapsed(); exitstatus = cvar.wait_timeout(exitstatus, cvar_timeout).unwrap().0; } - - // Turn Option> into Result> - match exitstatus.take() { - Some(r) => match r { - Ok(s) => Ok(Some(s)), - Err(e) => Err(e), - }, - None => panic!(), - } } } From bcdb682bf8dbea091bd3efc9986f71041c7a5496 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Fri, 5 Aug 2016 09:05:12 -0400 Subject: [PATCH 082/606] Remove unused imports. --- src/uucore/c_types.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/uucore/c_types.rs b/src/uucore/c_types.rs index 89169979b..ce5b7426b 100644 --- a/src/uucore/c_types.rs +++ b/src/uucore/c_types.rs @@ -10,8 +10,6 @@ use self::libc::{ }; pub use self::libc::passwd as c_passwd; -#[cfg(any(target_os = "macos", target_os = "freebsd"))] -use self::libc::time_t; #[cfg(target_os = "macos")] use self::libc::int32_t; From 2c78b9280122840b10cda7128177f7de33d6ceee Mon Sep 17 00:00:00 2001 From: Knight Date: Sat, 6 Aug 2016 11:45:37 +0800 Subject: [PATCH 083/606] uucore: add module encoding --- src/uucore/Cargo.toml | 1 + src/uucore/encoding.rs | 101 +++++++++++++++++++++++++++++++++++++++++ src/uucore/lib.rs | 1 + 3 files changed, 103 insertions(+) create mode 100644 src/uucore/encoding.rs diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index becf9c2c0..aeab77705 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -6,6 +6,7 @@ authors = [] [dependencies] libc = "*" winapi = "*" +data-encoding = "^1.1" [lib] path = "lib.rs" diff --git a/src/uucore/encoding.rs b/src/uucore/encoding.rs new file mode 100644 index 000000000..4e2273c25 --- /dev/null +++ b/src/uucore/encoding.rs @@ -0,0 +1,101 @@ +// This file is part of the uutils coreutils package. +// +// (c) Jian Zeng +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. +// + +extern crate data_encoding; +use self::data_encoding::{base64, base32, decode}; +use std::io::Read; + +pub type DecodeResult = Result, decode::Error>; + +#[derive(Clone, Copy)] +pub enum Format { + Base32, + Base64, +} +use self::Format::*; + +pub fn encode(f: Format, input: &[u8]) -> String { + match f { + Base32 => base32::encode(input), + Base64 => base64::encode(input), + } +} + +pub fn decode(f: Format, input: &[u8]) -> DecodeResult { + match f { + Base32 => base32::decode(input), + Base64 => base64::decode(input), + } +} + +pub struct Data { + line_wrap: usize, + ignore_garbage: bool, + input: R, + format: Format, + alphabet: &'static str, +} + +impl Data { + pub fn new(input: R, format: Format) -> Self { + Data { + line_wrap: 76, + ignore_garbage: false, + input: input, + format: format, + alphabet: match format { + Base32 => "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", + Base64 => "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=+/", + }, + } + } + + pub fn line_wrap(mut self, wrap: usize) -> Self { + self.line_wrap = wrap; + self + } + + pub fn ignore_garbage(mut self, ignore: bool) -> Self { + self.ignore_garbage = ignore; + self + } + + pub fn decode(&mut self) -> DecodeResult { + let mut buf = String::new(); + self.input.read_to_string(&mut buf).unwrap(); + let clean = if self.ignore_garbage { + buf.chars() + .filter(|&c| self.alphabet.contains(c)) + .collect::() + } else { + buf.chars() + .filter(|&c| c != '\r' && c != '\n') + .collect::() + }; + decode(self.format, clean.as_bytes()) + } + + pub fn encode(&mut self) -> String { + let mut buf: Vec = vec![]; + self.input.read_to_end(&mut buf).unwrap(); + encode(self.format, buf.as_slice()) + } +} + +pub fn wrap_print(line_wrap: usize, res: String) { + if line_wrap == 0 { + return print!("{}", res); + } + use std::cmp::min; + let mut start = 0; + while start < res.len() { + let end = min(start + line_wrap, res.len()); + println!("{}", &res[start..end]); + start = end; + } +} diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index 00f9f924c..d61d93516 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -7,6 +7,7 @@ mod macros; pub mod fs; pub mod parse_time; pub mod utf8; +pub mod encoding; #[cfg(unix)] pub mod c_types; #[cfg(unix)] pub mod process; From 76952579acf638f2dd122222bab95b280f5cd0a1 Mon Sep 17 00:00:00 2001 From: Nathan Ross Date: Mon, 8 Aug 2016 03:05:36 -0400 Subject: [PATCH 084/606] uucore: add message templates --- src/uucore/macros.rs | 109 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/src/uucore/macros.rs b/src/uucore/macros.rs index 21691dc5c..f9a57c884 100644 --- a/src/uucore/macros.rs +++ b/src/uucore/macros.rs @@ -239,3 +239,112 @@ macro_rules! safe_unwrap( } ) ); + +//-- message templates + +//-- message templates : general + +#[macro_export] +macro_rules! snippet_list_join_oxford { + ($conjunction:expr, $valOne:expr, $valTwo:expr) => ( + format!("{}, {} {}", $valOne, $conjunction, $valTwo) + ); + ($conjunction:expr, $valOne:expr, $valTwo:expr $(, $remainingVals:expr)*) => ( + format!("{}, {}", $valOne, snippet_list_join_inner!($conjunction, $valTwo $(, $remainingVals)*)) + ); +} + +#[macro_export] +macro_rules! snippet_list_join_or { + ($valOne:expr, $valTwo:expr) => ( + format!("{} or {}", $valOne, $valTwo) + ); + ($valOne:expr, $valTwo:expr $(, $remainingVals:expr)*) => ( + format!("{}, {}", $valOne, snippet_list_join_oxford!("or", $valTwo $(, $remainingVals)*)) + ); +} + +//-- message templates : help and version + +#[macro_export] +macro_rules! msg_version { + () => ( + format!("{} {}", executable!(), env!("CARGO_PKG_VERSION")) + ) +} + +//-- message templates : invalid input + +#[macro_export] +macro_rules! msg_invalid_input { ($reason: expr) => ( + format!("invalid input: {}", $reason) ); } + +#[macro_export] +macro_rules! snippet_no_file_at_path { ($path:expr) => ( + format!("nonexistent path {}", $path) ); } + +// -- message templates : invalid input : flag + +#[macro_export] +macro_rules! msg_invalid_opt_use { + ($about:expr, $flag:expr) => ( + msg_invalid_input!(format!("The '{}' option {}", $flag, $about)) + ); + ($about:expr, $longflag:expr, $shortflag:expr) => { + msg_invalid_input!(format!("The '{}' ('{}') option {}", $longflag, $shortflag, $about)) + }; +} + +#[macro_export] +macro_rules! msg_opt_only_usable_if { + ($clause:expr, $flag:expr) => ( + msg_invalid_opt_use!(format!("only usable if {}", $clause), $flag) + ); + ($clause:expr, $longflag:expr, $shortflag:expr) => ( + msg_invalid_opt_use!(format!("only usable if {}", $clause), $longflag, $shortflag) + ); +} + +#[macro_export] +macro_rules! msg_opt_invalid_should_be { + ($expects:expr, $received:expr, $flag:expr) => ( + msg_invalid_opt_use!(format!("expects {}, but was provided {}", $expects, $received), $flag) + ); + ($expects:expr, $received:expr, $longflag:expr, $shortflag:expr) => ( + msg_invalid_opt_use!(format!("expects {}, but was provided {}", $expects, $received), $longflag, $shortflag) + ); +} + +// -- message templates : invalid input : args + +#[macro_export] +macro_rules! msg_arg_invalid_value { ($expects:expr, $received:expr) => ( + msg_invalid_input!(format!("expects its argument to be {}, but was provided {}", $expects, $received)) ); } + +#[macro_export] +macro_rules! msg_args_invalid_value { ($expects:expr, $received:expr) => ( + msg_invalid_input!(format!("expects its arguments to be {}, but was provided {}", $expects, $received)) ); } + +#[macro_export] +macro_rules! msg_args_nonexistent_file { ($received:expr) => ( + msg_args_invalid_value!("paths to files", snippet_no_file_at_path!($received)));} + +#[macro_export] +macro_rules! msg_wrong_number_of_arguments { ($received:expr) => ( + msg_args_invalid_value!("wrong number of arguments") ); } + +// -- message templates : invalid input : input combinations + +#[macro_export] +macro_rules! msg_expects_one_of { + ($valOne:expr $(, $remainingVals:expr)*) => ( + msg_invalid_input!(format!("expects one of {}", snippet_list_join_or!($valOne $(, $remainingVals)*))) + ); +} + +#[macro_export] +macro_rules! msg_expects_no_more_than_one_of { + ($valOne:expr $(, $remainingVals:expr)*) => ( + msg_invalid_input!(format!("expects no more than one of {}", snippet_list_join_or!($valOne $(, $remainingVals)*))) ; + ); +} From bcec54f5724b7ceb8f9a0cd791cf28d373e995c3 Mon Sep 17 00:00:00 2001 From: Nathan Ross Date: Mon, 8 Aug 2016 03:27:06 -0400 Subject: [PATCH 085/606] uucore: CoreOptions error and version message templates --- src/uucore/Cargo.toml | 1 + src/uucore/coreopts.rs | 53 ++++++++++++++++++++++++++++++++++++++++++ src/uucore/lib.rs | 1 + 3 files changed, 55 insertions(+) create mode 100644 src/uucore/coreopts.rs diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index aeab77705..1689c734e 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -6,6 +6,7 @@ authors = [] [dependencies] libc = "*" winapi = "*" +getopts = "*" data-encoding = "^1.1" [lib] diff --git a/src/uucore/coreopts.rs b/src/uucore/coreopts.rs new file mode 100644 index 000000000..fa2f31fc2 --- /dev/null +++ b/src/uucore/coreopts.rs @@ -0,0 +1,53 @@ +extern crate getopts; +use std::io::Write; + +pub struct CoreOptions { + pub options : getopts::Options, + longhelp : Option +} + +impl<'a> CoreOptions { + pub fn new() -> Self { + let mut ret = CoreOptions { + options : getopts::Options::new(), + longhelp : None + }; + ret.options + .optflag("", "help", "print usage information") + .optflag("", "version", "print name and version number"); + ret + } + pub fn optopt(&mut self, short_name: &str, long_name: &str, desc: &str, hint: &str) -> &mut CoreOptions { + self.options.optopt(short_name, long_name, desc, hint); + self + } + pub fn optflag(&mut self, short_name: &str, long_name: &str, desc: &str) -> &mut CoreOptions { + self.options.optflag(short_name, long_name, desc); + self + } + pub fn help>(&mut self, longhelp : T) -> &mut CoreOptions { + self.longhelp = Some(longhelp.into()); + self + } + pub fn usage(&self, summary : &str) -> String { + self.options.usage(summary) + } + pub fn parse(&mut self, args : Vec) -> getopts::Matches { + let matches = match self.options.parse(&args[1..]) { + Ok(m) => { Some(m) }, + Err(f) => { + crash!(1, "{}", msg_invalid_input!(format!("{}", f))); + } + }.unwrap(); + if matches.opt_present("help") { + exit!(match self.longhelp { + Some(ref lhelp) => { print!("{}", lhelp); 0} + None => 1 + }); + } else if matches.opt_present("version") { + print!("{}", msg_version!()); + exit!(0); + } + matches + } +} \ No newline at end of file diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index d61d93516..f3cd5bebc 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -8,6 +8,7 @@ pub mod fs; pub mod parse_time; pub mod utf8; pub mod encoding; +pub mod coreopts; #[cfg(unix)] pub mod c_types; #[cfg(unix)] pub mod process; From 789141d926a20d282e27d1895150be4d68df97ef Mon Sep 17 00:00:00 2001 From: Knight Date: Wed, 10 Aug 2016 00:16:06 +0800 Subject: [PATCH 086/606] coreopts: display package name instead of module path --- src/uucore/coreopts.rs | 16 ++++++++++------ src/uucore/macros.rs | 16 ++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/uucore/coreopts.rs b/src/uucore/coreopts.rs index fa2f31fc2..72647accc 100644 --- a/src/uucore/coreopts.rs +++ b/src/uucore/coreopts.rs @@ -3,14 +3,16 @@ use std::io::Write; pub struct CoreOptions { pub options : getopts::Options, + pkgname: &'static str, longhelp : Option } impl<'a> CoreOptions { - pub fn new() -> Self { + pub fn new(name: &'static str) -> Self { let mut ret = CoreOptions { options : getopts::Options::new(), - longhelp : None + pkgname: name, + longhelp: None }; ret.options .optflag("", "help", "print usage information") @@ -36,18 +38,20 @@ impl<'a> CoreOptions { let matches = match self.options.parse(&args[1..]) { Ok(m) => { Some(m) }, Err(f) => { - crash!(1, "{}", msg_invalid_input!(format!("{}", f))); + eprintln!("{}: {}", self.pkgname, f); + eprintln!("Try '{} --help' for more information.", self.pkgname); + exit!(1) } }.unwrap(); if matches.opt_present("help") { exit!(match self.longhelp { - Some(ref lhelp) => { print!("{}", lhelp); 0} + Some(ref lhelp) => { println!("{}", lhelp); 0} None => 1 }); } else if matches.opt_present("version") { - print!("{}", msg_version!()); + println!("{} {}", self.pkgname, env!("CARGO_PKG_VERSION")); exit!(0); } matches } -} \ No newline at end of file +} diff --git a/src/uucore/macros.rs b/src/uucore/macros.rs index f9a57c884..e3a4f06a2 100644 --- a/src/uucore/macros.rs +++ b/src/uucore/macros.rs @@ -261,7 +261,7 @@ macro_rules! snippet_list_join_or { ); ($valOne:expr, $valTwo:expr $(, $remainingVals:expr)*) => ( format!("{}, {}", $valOne, snippet_list_join_oxford!("or", $valTwo $(, $remainingVals)*)) - ); + ); } //-- message templates : help and version @@ -294,7 +294,7 @@ macro_rules! msg_invalid_opt_use { msg_invalid_input!(format!("The '{}' ('{}') option {}", $longflag, $shortflag, $about)) }; } - + #[macro_export] macro_rules! msg_opt_only_usable_if { ($clause:expr, $flag:expr) => ( @@ -327,24 +327,24 @@ macro_rules! msg_args_invalid_value { ($expects:expr, $received:expr) => ( #[macro_export] macro_rules! msg_args_nonexistent_file { ($received:expr) => ( - msg_args_invalid_value!("paths to files", snippet_no_file_at_path!($received)));} + msg_args_invalid_value!("paths to files", snippet_no_file_at_path!($received)));} #[macro_export] macro_rules! msg_wrong_number_of_arguments { ($received:expr) => ( msg_args_invalid_value!("wrong number of arguments") ); } - -// -- message templates : invalid input : input combinations + +// -- message templates : invalid input : input combinations #[macro_export] macro_rules! msg_expects_one_of { ($valOne:expr $(, $remainingVals:expr)*) => ( - msg_invalid_input!(format!("expects one of {}", snippet_list_join_or!($valOne $(, $remainingVals)*))) - ); + msg_invalid_input!(format!("expects one of {}", snippet_list_join_or!($valOne $(, $remainingVals)*))) + ); } #[macro_export] macro_rules! msg_expects_no_more_than_one_of { ($valOne:expr $(, $remainingVals:expr)*) => ( msg_invalid_input!(format!("expects no more than one of {}", snippet_list_join_or!($valOne $(, $remainingVals)*))) ; - ); + ); } From 25018b112b8d6a08e29b574518fdafab005de3cd Mon Sep 17 00:00:00 2001 From: Knight Date: Wed, 10 Aug 2016 00:49:04 +0800 Subject: [PATCH 087/606] uucore: export latest libc --- src/uucore/Cargo.toml | 3 +-- src/uucore/lib.rs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 1689c734e..bb1cf397a 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -4,8 +4,7 @@ version = "0.0.1" authors = [] [dependencies] -libc = "*" -winapi = "*" +libc = { git = "https://github.com/rust-lang/libc.git" } getopts = "*" data-encoding = "^1.1" diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index f3cd5bebc..bbe7bb713 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -1,5 +1,4 @@ -extern crate libc; -#[cfg(windows)] extern crate winapi; +pub extern crate libc; #[macro_use] mod macros; From 68ad14f3c4cb81c731ee3d4cd71ac68d4bd573ab Mon Sep 17 00:00:00 2001 From: Knight Date: Wed, 10 Aug 2016 13:57:40 +0800 Subject: [PATCH 088/606] uucore: conditional enable different features --- src/uucore/Cargo.toml | 15 ++++++++++++++- src/uucore/lib.rs | 28 +++++++++++++++++++--------- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index bb1cf397a..a62afa620 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -6,7 +6,20 @@ authors = [] [dependencies] libc = { git = "https://github.com/rust-lang/libc.git" } getopts = "*" -data-encoding = "^1.1" +time = { version = "*", optional = true } +data-encoding = { version = "^1.1", optional = true } + +[features] +fs = [] +utf8 = [] +encoding = ["data-encoding"] +parse_time = [] +utmpx = ["time"] +c_types = [] +process = [] +signals = [] +wide = [] +default = ["fs", "utf8", "encoding", "parse_time", "utmpx", "c_types", "process", "signals", "wide"] [lib] path = "lib.rs" diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index bbe7bb713..61b3624ae 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -3,15 +3,25 @@ pub extern crate libc; #[macro_use] mod macros; -pub mod fs; -pub mod parse_time; -pub mod utf8; -pub mod encoding; pub mod coreopts; -#[cfg(unix)] pub mod c_types; -#[cfg(unix)] pub mod process; -#[cfg(unix)] pub mod signals; -#[cfg(unix)] pub mod utmpx; +#[cfg(feature = "fs")] +pub mod fs; +#[cfg(feature = "utf8")] +pub mod utf8; +#[cfg(feature = "encoding")] +pub mod encoding; +#[cfg(feature = "parse_time")] +pub mod parse_time; -#[cfg(windows)] pub mod wide; +#[cfg(all(unix, feature = "utmpx"))] +pub mod utmpx; +#[cfg(all(unix, feature = "c_types"))] +pub mod c_types; +#[cfg(all(unix, feature = "process"))] +pub mod process; +#[cfg(all(unix, feature = "signals"))] +pub mod signals; + +#[cfg(all(windows, feature = "wide"))] +pub mod wide; From 3751142ccba5899006de98562d5fc7ccad1eca27 Mon Sep 17 00:00:00 2001 From: Knight Date: Wed, 10 Aug 2016 13:59:30 +0800 Subject: [PATCH 089/606] coreopts: fix error when using `msg_wrong_number_of_arguments` macro --- src/uucore/macros.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/uucore/macros.rs b/src/uucore/macros.rs index e3a4f06a2..c3e7b0c8e 100644 --- a/src/uucore/macros.rs +++ b/src/uucore/macros.rs @@ -322,15 +322,21 @@ macro_rules! msg_arg_invalid_value { ($expects:expr, $received:expr) => ( msg_invalid_input!(format!("expects its argument to be {}, but was provided {}", $expects, $received)) ); } #[macro_export] -macro_rules! msg_args_invalid_value { ($expects:expr, $received:expr) => ( - msg_invalid_input!(format!("expects its arguments to be {}, but was provided {}", $expects, $received)) ); } +macro_rules! msg_args_invalid_value { + ($expects:expr, $received:expr) => ( + msg_invalid_input!(format!("expects its arguments to be {}, but was provided {}", $expects, $received)) + ); + ($msg:expr) => ( + msg_invalid_input!($msg) + ); +} #[macro_export] macro_rules! msg_args_nonexistent_file { ($received:expr) => ( msg_args_invalid_value!("paths to files", snippet_no_file_at_path!($received)));} #[macro_export] -macro_rules! msg_wrong_number_of_arguments { ($received:expr) => ( +macro_rules! msg_wrong_number_of_arguments { () => ( msg_args_invalid_value!("wrong number of arguments") ); } // -- message templates : invalid input : input combinations From 58b6ac939388000060241c6571cb3ca6d206b204 Mon Sep 17 00:00:00 2001 From: Knight Date: Wed, 10 Aug 2016 15:23:07 +0800 Subject: [PATCH 090/606] uucore::utmpx: refine implementation --- src/uucore/utmpx.rs | 335 ++++++++++++++++++++++++++++---------------- 1 file changed, 215 insertions(+), 120 deletions(-) diff --git a/src/uucore/utmpx.rs b/src/uucore/utmpx.rs index c249e2a94..67b959541 100644 --- a/src/uucore/utmpx.rs +++ b/src/uucore/utmpx.rs @@ -1,125 +1,87 @@ -#![allow(dead_code, non_camel_case_types)] +//! Aim to provide platform-independent methods to obtain login records +//! +//! **ONLY** support linux, macos and freebsd for the time being -extern crate libc; +use super::libc; +pub extern crate time; +use self::time::{Tm, Timespec}; -pub use self::utmpx::{UT_NAMESIZE, UT_LINESIZE, DEFAULT_FILE, USER_PROCESS, BOOT_TIME}; -pub use self::utmpx::c_utmp; - -extern "C" { - pub fn getutxent() -> *const c_utmp; - pub fn getutxid(ut: *const c_utmp) -> *const c_utmp; - pub fn getutxline(ut: *const c_utmp) -> *const c_utmp; - pub fn pututxline(ut: *const c_utmp) -> *const c_utmp; - pub fn setutxent(); - pub fn endutxent(); - - #[cfg(any(target_os = "macos", target_os = "linux"))] - pub fn utmpxname(file: *const libc::c_char) -> libc::c_int; -} +use ::std::io::Result as IOResult; +use ::std::io::Error as IOError; +use ::std::ptr; +use ::std::borrow::Cow; +use ::std::ffi::CStr; +use ::std::ffi::CString; +pub use self::ut::*; +use libc::utmpx; +// pub use libc::getutxid; +// pub use libc::getutxline; +// pub use libc::pututxline; +pub use libc::getutxent; +pub use libc::setutxent; +pub use libc::endutxent; +#[cfg(any(target_os = "macos", target_os = "linux"))] +pub use libc::utmpxname; #[cfg(target_os = "freebsd")] -pub unsafe extern fn utmpxname(_file: *const libc::c_char) -> libc::c_int { +pub unsafe extern "C" fn utmpxname(_file: *const libc::c_char) -> libc::c_int { 0 } -#[cfg(target_os = "linux")] -mod utmpx { - use super::libc; +macro_rules! bytes2cow { + ($name:expr) => ( + unsafe { + CStr::from_ptr($name.as_ref().as_ptr()).to_string_lossy() + } + ) +} +#[cfg(target_os = "linux")] +mod ut { pub static DEFAULT_FILE: &'static str = "/var/run/utmp"; - pub const UT_LINESIZE: usize = 32; - pub const UT_NAMESIZE: usize = 32; + pub use libc::__UT_LINESIZE as UT_LINESIZE; + pub use libc::__UT_NAMESIZE as UT_NAMESIZE; + pub use libc::__UT_HOSTSIZE as UT_HOSTSIZE; pub const UT_IDSIZE: usize = 4; - pub const UT_HOSTSIZE: usize = 256; - pub const EMPTY: libc::c_short = 0; - pub const RUN_LVL: libc::c_short = 1; - pub const BOOT_TIME: libc::c_short = 2; - pub const NEW_TIME: libc::c_short = 3; - pub const OLD_TIME: libc::c_short = 4; - pub const INIT_PROCESS: libc::c_short = 5; - pub const LOGIN_PROCESS: libc::c_short = 6; - pub const USER_PROCESS: libc::c_short = 7; - pub const DEAD_PROCESS: libc::c_short = 8; - pub const ACCOUNTING: libc::c_short = 9; - - #[repr(C)] - pub struct __exit_status { - pub e_termination: libc::c_short, - pub e_exit: libc::c_short, - } - - #[repr(C)] - #[derive(Copy, Clone)] - pub struct __timeval { - pub tv_sec: libc::int32_t, - pub tv_usec: libc::int32_t, - } - - #[repr(C)] - pub struct c_utmp { - pub ut_type: libc::c_short, - pub ut_pid: libc::pid_t, - pub ut_line: [libc::c_char; UT_LINESIZE], - pub ut_id: [libc::c_char; UT_IDSIZE], - - pub ut_user: [libc::c_char; UT_NAMESIZE], - pub ut_host: [libc::c_char; UT_HOSTSIZE], - pub ut_exit: __exit_status, - - #[cfg(target_pointer_width = "32")] - pub ut_session: libc::c_long, - #[cfg(target_pointer_width = "32")] - pub ut_tv: libc::timeval, - - #[cfg(target_pointer_width = "64")] - pub ut_session: libc::int32_t, - #[cfg(target_pointer_width = "64")] - pub ut_tv: __timeval, - - pub ut_addr_v6: [libc::int32_t; 4], - __glibc_reserved: [libc::c_char; 20], - } + pub use libc::EMPTY; + pub use libc::RUN_LVL; + pub use libc::BOOT_TIME; + pub use libc::NEW_TIME; + pub use libc::OLD_TIME; + pub use libc::INIT_PROCESS; + pub use libc::LOGIN_PROCESS; + pub use libc::USER_PROCESS; + pub use libc::DEAD_PROCESS; + pub use libc::ACCOUNTING; } #[cfg(target_os = "macos")] -mod utmpx { - use super::libc; - +mod ut { pub static DEFAULT_FILE: &'static str = "/var/run/utmpx"; - pub const UT_LINESIZE: usize = 32; - pub const UT_NAMESIZE: usize = 256; - pub const UT_IDSIZE: usize = 4; - pub const UT_HOSTSIZE: usize = 256; + pub use libc::_UTX_LINESIZE as UT_LINESIZE; + pub use libc::_UTX_USERSIZE as UT_NAMESIZE; + pub use libc::_UTX_HOSTSIZE as UT_HOSTSIZE; + pub use libc::_UTX_IDSIZE as UT_IDSIZE; - pub const EMPTY: libc::c_short = 0; - pub const RUN_LVL: libc::c_short = 1; - pub const BOOT_TIME: libc::c_short = 2; - pub const OLD_TIME: libc::c_short = 3; - pub const NEW_TIME: libc::c_short = 4; - pub const INIT_PROCESS: libc::c_short = 5; - pub const LOGIN_PROCESS: libc::c_short = 6; - pub const USER_PROCESS: libc::c_short = 7; - pub const DEAD_PROCESS: libc::c_short = 8; - pub const ACCOUNTING: libc::c_short = 9; - - #[repr(C)] - pub struct c_utmp { - pub ut_user: [libc::c_char; UT_NAMESIZE], - pub ut_id: [libc::c_char; UT_IDSIZE], - pub ut_line: [libc::c_char; UT_LINESIZE], - pub ut_pid: libc::pid_t, - pub ut_type: libc::c_short, - pub ut_tv: libc::timeval, - pub ut_host: [libc::c_char; UT_HOSTSIZE], - pub __unused: [libc::uint32_t; 16], - } + pub use libc::EMPTY; + pub use libc::RUN_LVL; + pub use libc::BOOT_TIME; + pub use libc::NEW_TIME; + pub use libc::OLD_TIME; + pub use libc::INIT_PROCESS; + pub use libc::LOGIN_PROCESS; + pub use libc::USER_PROCESS; + pub use libc::DEAD_PROCESS; + pub use libc::ACCOUNTING; + pub use libc::SIGNATURE; + pub use libc::SHUTDOWN_TIME; } #[cfg(target_os = "freebsd")] -mod utmpx { +mod ut { use super::libc; pub static DEFAULT_FILE: &'static str = ""; @@ -129,25 +91,158 @@ mod utmpx { pub const UT_IDSIZE: usize = 8; pub const UT_HOSTSIZE: usize = 128; - pub const EMPTY: libc::c_short = 0; - pub const BOOT_TIME: libc::c_short = 1; - pub const OLD_TIME: libc::c_short = 2; - pub const NEW_TIME: libc::c_short = 3; - pub const USER_PROCESS: libc::c_short = 4; - pub const INIT_PROCESS: libc::c_short = 5; - pub const LOGIN_PROCESS: libc::c_short = 6; - pub const DEAD_PROCESS: libc::c_short = 7; - pub const SHUTDOWN_TIME: libc::c_short = 8; + pub use libc::EMPTY; + pub use libc::BOOT_TIME; + pub use libc::OLD_TIME; + pub use libc::NEW_TIME; + pub use libc::USER_PROCESS; + pub use libc::INIT_PROCESS; + pub use libc::LOGIN_PROCESS; + pub use libc::DEAD_PROCESS; + pub use libc::SHUTDOWN_TIME; +} - #[repr(C)] - pub struct c_utmp { - pub ut_type: libc::c_short, - pub ut_tv: libc::timeval, - pub ut_id: [libc::c_char; UT_IDSIZE], - pub ut_pid: libc::pid_t, - pub ut_user: [libc::c_char; UT_NAMESIZE], - pub ut_line: [libc::c_char; UT_LINESIZE], - pub ut_host: [libc::c_char; UT_HOSTSIZE], - pub ut_spare: [libc::c_char; 64], +/// Login records +/// +/// Examples: +/// --------- +/// +/// ``` +/// for ut in Utmpx::iter_all_records() { +/// if ut.is_user_process() { +/// println!("{}: {}", ut.host(), ut.user()) +/// } +/// } +/// ``` +/// +/// Specifying the path to login record: +/// +/// ``` +/// for ut in Utmpx::iter_all_records().read_from("/some/where/else") { +/// if ut.is_user_process() { +/// println!("{}: {}", ut.host(), ut.user()) +/// } +/// } +/// ``` +pub struct Utmpx { + inner: utmpx, +} + +impl Utmpx { + /// A.K.A. ut.ut_type + pub fn record_type(&self) -> i16 { + self.inner.ut_type as i16 + } + /// A.K.A. ut.ut_pid + pub fn pid(&self) -> i32 { + self.inner.ut_pid as i32 + } + /// A.K.A. ut.ut_id + pub fn terminal_suffix(&self) -> Cow { + bytes2cow!(self.inner.ut_id) + } + /// A.K.A. ut.ut_user + pub fn user(&self) -> Cow { + bytes2cow!(self.inner.ut_user) + } + /// A.K.A. ut.ut_host + pub fn host(&self) -> Cow { + bytes2cow!(self.inner.ut_host) + } + /// A.K.A. ut.ut_line + pub fn tty_device(&self) -> Cow { + bytes2cow!(self.inner.ut_line) + } + /// A.K.A. ut.ut_tv + pub fn login_time(&self) -> Tm { + time::at(Timespec::new(self.inner.ut_tv.tv_sec as i64, + self.inner.ut_tv.tv_usec as i32)) + } + /// Consumes the `Utmpx`, returning the underlying C struct utmpx + pub fn into_inner(self) -> utmpx { + self.inner + } + pub fn is_user_process(&self) -> bool { + !self.user().is_empty() && self.record_type() == USER_PROCESS + } + + /// Canonicalize host name using DNS + pub fn canon_host(&self) -> IOResult { + const AI_CANONNAME: libc::c_int = 0x2; + let host = self.host(); + let hints = libc::addrinfo { + ai_flags: AI_CANONNAME, + ai_family: 0, + ai_socktype: 0, + ai_protocol: 0, + ai_addrlen: 0, + ai_addr: ptr::null_mut(), + ai_canonname: ptr::null_mut(), + ai_next: ptr::null_mut(), + }; + let c_host = CString::new(host.as_ref()).unwrap(); + let mut res = ptr::null_mut(); + let status = unsafe { + libc::getaddrinfo(c_host.as_ptr(), + ptr::null(), + &hints as *const _, + &mut res as *mut _) + }; + if status == 0 { + let info: libc::addrinfo = unsafe { ptr::read(res as *const _) }; + // http://lists.gnu.org/archive/html/bug-coreutils/2006-09/msg00300.html + // says Darwin 7.9.0 getaddrinfo returns 0 but sets + // res->ai_canonname to NULL. + let ret = if info.ai_canonname.is_null() { + Ok(String::from(host.as_ref())) + } else { + Ok(unsafe { CString::from_raw(info.ai_canonname).into_string().unwrap() }) + }; + unsafe { + libc::freeaddrinfo(res); + } + ret + } else { + Err(IOError::last_os_error()) + } + } + pub fn iter_all_records() -> UtmpxIter { + UtmpxIter + } +} + +/// Iterator of login records +pub struct UtmpxIter; + +impl UtmpxIter { + /// Sets the name of the utmpx-format file for the other utmpx functions to access. + /// + /// If not set, default record file will be used(file path depends on the target OS) + pub fn read_from(self, f: &str) -> Self { + let res = unsafe { utmpxname(CString::new(f).unwrap().as_ptr()) }; + if res != 0 { + println!("Warning: {}", IOError::last_os_error()); + } + unsafe { + setutxent(); + } + self + } +} + +impl Iterator for UtmpxIter { + type Item = Utmpx; + fn next(&mut self) -> Option { + unsafe { + let res = getutxent(); + if !res.is_null() { + Some(Utmpx { + inner: ptr::read(res as *const _) + }) + } else { + endutxent(); + None + } + } } } From 6a22120d7baea0fa1fae318c01816f926c931014 Mon Sep 17 00:00:00 2001 From: Knight Date: Thu, 11 Aug 2016 15:41:12 +0800 Subject: [PATCH 091/606] uucore::utmpx: change API and fix error --- src/uucore/utmpx.rs | 58 +++++++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/src/uucore/utmpx.rs b/src/uucore/utmpx.rs index 67b959541..0122a1156 100644 --- a/src/uucore/utmpx.rs +++ b/src/uucore/utmpx.rs @@ -2,6 +2,14 @@ //! //! **ONLY** support linux, macos and freebsd for the time being +// This file is part of the uutils coreutils package. +// +// (c) Jian Zeng +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. +// + use super::libc; pub extern crate time; use self::time::{Tm, Timespec}; @@ -9,8 +17,6 @@ use self::time::{Tm, Timespec}; use ::std::io::Result as IOResult; use ::std::io::Error as IOError; use ::std::ptr; -use ::std::borrow::Cow; -use ::std::ffi::CStr; use ::std::ffi::CString; pub use self::ut::*; @@ -28,11 +34,10 @@ pub unsafe extern "C" fn utmpxname(_file: *const libc::c_char) -> libc::c_int { 0 } -macro_rules! bytes2cow { - ($name:expr) => ( - unsafe { - CStr::from_ptr($name.as_ref().as_ptr()).to_string_lossy() - } +// In case the c_char array doesn' t end with NULL +macro_rules! chars2string { + ($arr:expr) => ( + $arr.iter().take_while(|i| **i > 0).map(|&i| i as u8 as char).collect::() ) } @@ -138,26 +143,40 @@ impl Utmpx { self.inner.ut_pid as i32 } /// A.K.A. ut.ut_id - pub fn terminal_suffix(&self) -> Cow { - bytes2cow!(self.inner.ut_id) + pub fn terminal_suffix(&self) -> String { + chars2string!(self.inner.ut_id) } /// A.K.A. ut.ut_user - pub fn user(&self) -> Cow { - bytes2cow!(self.inner.ut_user) + pub fn user(&self) -> String { + chars2string!(self.inner.ut_user) } /// A.K.A. ut.ut_host - pub fn host(&self) -> Cow { - bytes2cow!(self.inner.ut_host) + pub fn host(&self) -> String { + chars2string!(self.inner.ut_host) } /// A.K.A. ut.ut_line - pub fn tty_device(&self) -> Cow { - bytes2cow!(self.inner.ut_line) + pub fn tty_device(&self) -> String { + chars2string!(self.inner.ut_line) } /// A.K.A. ut.ut_tv pub fn login_time(&self) -> Tm { time::at(Timespec::new(self.inner.ut_tv.tv_sec as i64, self.inner.ut_tv.tv_usec as i32)) } + /// A.K.A. ut.ut_exit + /// + /// Return (e_termination, e_exit) + #[cfg(any(target_os = "linux", target_os = "android"))] + pub fn exit_status(&self) -> (i16, i16) { + (self.inner.ut_exit.e_termination, self.inner.ut_exit.e_exit) + } + /// A.K.A. ut.ut_exit + /// + /// Return (0, 0) on Non-Linux platform + #[cfg(not(any(target_os = "linux", target_os = "android")))] + pub fn exit_status(&self) -> (i16, i16) { + (0, 0) + } /// Consumes the `Utmpx`, returning the underlying C struct utmpx pub fn into_inner(self) -> utmpx { self.inner @@ -170,6 +189,7 @@ impl Utmpx { pub fn canon_host(&self) -> IOResult { const AI_CANONNAME: libc::c_int = 0x2; let host = self.host(); + let host = host.split(':').nth(0).unwrap(); let hints = libc::addrinfo { ai_flags: AI_CANONNAME, ai_family: 0, @@ -180,7 +200,7 @@ impl Utmpx { ai_canonname: ptr::null_mut(), ai_next: ptr::null_mut(), }; - let c_host = CString::new(host.as_ref()).unwrap(); + let c_host = CString::new(host).unwrap(); let mut res = ptr::null_mut(); let status = unsafe { libc::getaddrinfo(c_host.as_ptr(), @@ -194,7 +214,7 @@ impl Utmpx { // says Darwin 7.9.0 getaddrinfo returns 0 but sets // res->ai_canonname to NULL. let ret = if info.ai_canonname.is_null() { - Ok(String::from(host.as_ref())) + Ok(String::from(host)) } else { Ok(unsafe { CString::from_raw(info.ai_canonname).into_string().unwrap() }) }; @@ -236,9 +256,7 @@ impl Iterator for UtmpxIter { unsafe { let res = getutxent(); if !res.is_null() { - Some(Utmpx { - inner: ptr::read(res as *const _) - }) + Some(Utmpx { inner: ptr::read(res as *const _) }) } else { endutxent(); None From 73d36a1d88b1ea4e688014e8bb7f70fb6b2e82dd Mon Sep 17 00:00:00 2001 From: Nathan Ross Date: Thu, 11 Aug 2016 12:37:33 -0400 Subject: [PATCH 092/606] uucore: require version; syntax; summary; longhelp --- src/uucore/coreopts.rs | 65 ++++++++++++++++++++++++++++-------------- src/uucore/lib.rs | 1 + src/uucore/macros.rs | 9 ------ 3 files changed, 44 insertions(+), 31 deletions(-) diff --git a/src/uucore/coreopts.rs b/src/uucore/coreopts.rs index 72647accc..303f54cfd 100644 --- a/src/uucore/coreopts.rs +++ b/src/uucore/coreopts.rs @@ -1,36 +1,38 @@ extern crate getopts; use std::io::Write; -pub struct CoreOptions { - pub options : getopts::Options, - pkgname: &'static str, - longhelp : Option +pub struct HelpText<'a> { + pub name : &'a str, + pub version : &'a str, + pub syntax : &'a str, + pub summary : &'a str, + pub long_help : &'a str } -impl<'a> CoreOptions { - pub fn new(name: &'static str) -> Self { +pub struct CoreOptions<'a> { + options : getopts::Options, + help_text : HelpText<'a> +} + +impl<'a> CoreOptions<'a> { + pub fn new(help_text: HelpText<'a>) -> Self { let mut ret = CoreOptions { options : getopts::Options::new(), - pkgname: name, - longhelp: None + help_text : help_text }; ret.options .optflag("", "help", "print usage information") .optflag("", "version", "print name and version number"); ret } - pub fn optopt(&mut self, short_name: &str, long_name: &str, desc: &str, hint: &str) -> &mut CoreOptions { + pub fn optopt(&mut self, short_name: &str, long_name: &str, desc: &str, hint: &str) -> &mut CoreOptions<'a> { self.options.optopt(short_name, long_name, desc, hint); self } - pub fn optflag(&mut self, short_name: &str, long_name: &str, desc: &str) -> &mut CoreOptions { + pub fn optflag(&mut self, short_name: &str, long_name: &str, desc: &str) -> &mut CoreOptions<'a> { self.options.optflag(short_name, long_name, desc); self } - pub fn help>(&mut self, longhelp : T) -> &mut CoreOptions { - self.longhelp = Some(longhelp.into()); - self - } pub fn usage(&self, summary : &str) -> String { self.options.usage(summary) } @@ -38,20 +40,39 @@ impl<'a> CoreOptions { let matches = match self.options.parse(&args[1..]) { Ok(m) => { Some(m) }, Err(f) => { - eprintln!("{}: {}", self.pkgname, f); - eprintln!("Try '{} --help' for more information.", self.pkgname); - exit!(1) + crash!(1, "{}", f); } }.unwrap(); if matches.opt_present("help") { - exit!(match self.longhelp { - Some(ref lhelp) => { println!("{}", lhelp); 0} - None => 1 - }); + print!(" + {0} {1} + + {0} {2} + + {3} + + Reference +{4} +", +self.help_text.name, self.help_text.version, self.help_text.syntax, self.options.usage(self.help_text.summary), self.help_text.long_help); + exit!(0); } else if matches.opt_present("version") { - println!("{} {}", self.pkgname, env!("CARGO_PKG_VERSION")); + print!("{} {}", self.help_text.name, self.help_text.version); exit!(0); } matches } } + +#[macro_export] +macro_rules! new_coreopts { + ($syntax: expr, $summary: expr, $long_help: expr) => ( + uucore::coreopts::CoreOptions::new(uucore::coreopts::HelpText { + name: executable!(), + version: env!("CARGO_PKG_VERSION"), + syntax: $syntax, + summary: $summary, + long_help: $long_help + }) + ); +} \ No newline at end of file diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index 61b3624ae..994112b74 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -3,6 +3,7 @@ pub extern crate libc; #[macro_use] mod macros; +#[macro_use] pub mod coreopts; #[cfg(feature = "fs")] diff --git a/src/uucore/macros.rs b/src/uucore/macros.rs index c3e7b0c8e..a88d78b84 100644 --- a/src/uucore/macros.rs +++ b/src/uucore/macros.rs @@ -264,15 +264,6 @@ macro_rules! snippet_list_join_or { ); } -//-- message templates : help and version - -#[macro_export] -macro_rules! msg_version { - () => ( - format!("{} {}", executable!(), env!("CARGO_PKG_VERSION")) - ) -} - //-- message templates : invalid input #[macro_export] From 50887566ea65e243fa3719e19fbfd7b2307e629b Mon Sep 17 00:00:00 2001 From: nathanross Date: Thu, 11 Aug 2016 23:20:39 -0400 Subject: [PATCH 093/606] uucore: coreopts alignment, spacing, and optional usage --- src/uucore/coreopts.rs | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/uucore/coreopts.rs b/src/uucore/coreopts.rs index 303f54cfd..b2e2e0084 100644 --- a/src/uucore/coreopts.rs +++ b/src/uucore/coreopts.rs @@ -6,7 +6,8 @@ pub struct HelpText<'a> { pub version : &'a str, pub syntax : &'a str, pub summary : &'a str, - pub long_help : &'a str + pub long_help : &'a str, + pub display_usage : bool } pub struct CoreOptions<'a> { @@ -43,21 +44,21 @@ impl<'a> CoreOptions<'a> { crash!(1, "{}", f); } }.unwrap(); - if matches.opt_present("help") { + if matches.opt_present("help") { + let usage_str = if self.help_text.display_usage { + format!("\n {}\n\n Reference\n", + self.options.usage(self.help_text.summary) + ).replace("Options:", " Options:") + } else { String::new() }; print!(" {0} {1} {0} {2} - - {3} - - Reference -{4} -", -self.help_text.name, self.help_text.version, self.help_text.syntax, self.options.usage(self.help_text.summary), self.help_text.long_help); +{3}{4} +", self.help_text.name, self.help_text.version, self.help_text.syntax, usage_str, self.help_text.long_help); exit!(0); } else if matches.opt_present("version") { - print!("{} {}", self.help_text.name, self.help_text.version); + println!("{} {}", self.help_text.name, self.help_text.version); exit!(0); } matches @@ -72,7 +73,18 @@ macro_rules! new_coreopts { version: env!("CARGO_PKG_VERSION"), syntax: $syntax, summary: $summary, - long_help: $long_help + long_help: $long_help, + display_usage: true + }) + ); + ($syntax: expr, $summary: expr, $long_help: expr, $display_usage: expr) => ( + uucore::coreopts::CoreOptions::new(uucore::coreopts::HelpText { + name: executable!(), + version: env!("CARGO_PKG_VERSION"), + syntax: $syntax, + summary: $summary, + long_help: $long_help, + display_usage: $display_usage }) ); } \ No newline at end of file From 0277848de7e69d23763736dd2860ac0fb8fd9107 Mon Sep 17 00:00:00 2001 From: Knight Date: Sat, 13 Aug 2016 02:00:20 +0800 Subject: [PATCH 094/606] uucore: make libc optional --- src/uucore/Cargo.toml | 15 +++++++++------ src/uucore/lib.rs | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index a62afa620..7a53082a7 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -4,22 +4,25 @@ version = "0.0.1" authors = [] [dependencies] -libc = { git = "https://github.com/rust-lang/libc.git" } getopts = "*" time = { version = "*", optional = true } data-encoding = { version = "^1.1", optional = true } +[dependencies.libc] +git = "https://github.com/rust-lang/libc.git" +optional = true + [features] -fs = [] +fs = ["libc"] utf8 = [] encoding = ["data-encoding"] parse_time = [] -utmpx = ["time"] -c_types = [] -process = [] +utmpx = ["time", "libc"] +c_types = ["libc"] +process = ["libc"] signals = [] wide = [] -default = ["fs", "utf8", "encoding", "parse_time", "utmpx", "c_types", "process", "signals", "wide"] +default = ["fs", "libc", "utf8", "encoding", "parse_time", "utmpx", "c_types", "process", "signals", "wide"] [lib] path = "lib.rs" diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index 994112b74..86e24a07a 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -1,3 +1,4 @@ +#[cfg(feature = "libc")] pub extern crate libc; #[macro_use] From 434aae76bc721d5c455f3f6746be799debb67f4f Mon Sep 17 00:00:00 2001 From: Knight Date: Sun, 14 Aug 2016 13:18:46 +0800 Subject: [PATCH 095/606] uucore::utmpx: fix doctest errors --- src/uucore/utmpx.rs | 51 ++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/src/uucore/utmpx.rs b/src/uucore/utmpx.rs index 0122a1156..8ce06df3e 100644 --- a/src/uucore/utmpx.rs +++ b/src/uucore/utmpx.rs @@ -1,7 +1,3 @@ -//! Aim to provide platform-independent methods to obtain login records -//! -//! **ONLY** support linux, macos and freebsd for the time being - // This file is part of the uutils coreutils package. // // (c) Jian Zeng @@ -9,6 +5,31 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // +//! Aims to provide platform-independent methods to obtain login records +//! +//! **ONLY** support linux, macos and freebsd for the time being +//! +//! # Examples: +//! +//! ``` +//! use uucore::utmpx::Utmpx; +//! for ut in Utmpx::iter_all_records() { +//! if ut.is_user_process() { +//! println!("{}: {}", ut.host(), ut.user()) +//! } +//! } +//! ``` +//! +//! Specifying the path to login record: +//! +//! ``` +//! use uucore::utmpx::Utmpx; +//! for ut in Utmpx::iter_all_records().read_from("/some/where/else") { +//! if ut.is_user_process() { +//! println!("{}: {}", ut.host(), ut.user()) +//! } +//! } +//! ``` use super::libc; pub extern crate time; @@ -107,28 +128,6 @@ mod ut { pub use libc::SHUTDOWN_TIME; } -/// Login records -/// -/// Examples: -/// --------- -/// -/// ``` -/// for ut in Utmpx::iter_all_records() { -/// if ut.is_user_process() { -/// println!("{}: {}", ut.host(), ut.user()) -/// } -/// } -/// ``` -/// -/// Specifying the path to login record: -/// -/// ``` -/// for ut in Utmpx::iter_all_records().read_from("/some/where/else") { -/// if ut.is_user_process() { -/// println!("{}: {}", ut.host(), ut.user()) -/// } -/// } -/// ``` pub struct Utmpx { inner: utmpx, } From 5bc227677500355d0cf337ee747e0540d3315fac Mon Sep 17 00:00:00 2001 From: Knight Date: Sun, 14 Aug 2016 13:19:57 +0800 Subject: [PATCH 096/606] Add uucore::entries --- src/uucore/Cargo.toml | 3 +- src/uucore/coreopts.rs | 10 +- src/uucore/entries.rs | 245 +++++++++++++++++++++++++++++++++++++++++ src/uucore/lib.rs | 2 + 4 files changed, 254 insertions(+), 6 deletions(-) create mode 100644 src/uucore/entries.rs diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 7a53082a7..77676c251 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -21,8 +21,9 @@ utmpx = ["time", "libc"] c_types = ["libc"] process = ["libc"] signals = [] +entries = ["libc"] wide = [] -default = ["fs", "libc", "utf8", "encoding", "parse_time", "utmpx", "c_types", "process", "signals", "wide"] +default = ["fs", "libc", "utf8", "encoding", "parse_time", "utmpx", "c_types", "process", "entries", "signals", "wide"] [lib] path = "lib.rs" diff --git a/src/uucore/coreopts.rs b/src/uucore/coreopts.rs index b2e2e0084..ec22af9dd 100644 --- a/src/uucore/coreopts.rs +++ b/src/uucore/coreopts.rs @@ -44,11 +44,11 @@ impl<'a> CoreOptions<'a> { crash!(1, "{}", f); } }.unwrap(); - if matches.opt_present("help") { + if matches.opt_present("help") { let usage_str = if self.help_text.display_usage { - format!("\n {}\n\n Reference\n", + format!("\n {}\n\n Reference\n", self.options.usage(self.help_text.summary) - ).replace("Options:", " Options:") + ).replace("Options:", " Options:") } else { String::new() }; print!(" {0} {1} @@ -66,7 +66,7 @@ impl<'a> CoreOptions<'a> { } #[macro_export] -macro_rules! new_coreopts { +macro_rules! new_coreopts { ($syntax: expr, $summary: expr, $long_help: expr) => ( uucore::coreopts::CoreOptions::new(uucore::coreopts::HelpText { name: executable!(), @@ -87,4 +87,4 @@ macro_rules! new_coreopts { display_usage: $display_usage }) ); -} \ No newline at end of file +} diff --git a/src/uucore/entries.rs b/src/uucore/entries.rs new file mode 100644 index 000000000..5dae92dd3 --- /dev/null +++ b/src/uucore/entries.rs @@ -0,0 +1,245 @@ +// This file is part of the uutils coreutils package. +// +// (c) Jian Zeng +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + +//! Get password/group file entry +//! +//! # Examples: +//! +//! ``` +//! use uucore::entries::{self, Locate}; +//! assert_eq!("root", entries::uid2usr(0).unwrap()); +//! assert_eq!(0, entries::usr2uid("root").unwrap()); +//! assert!(entries::gid2grp(0).is_ok()); +//! assert!(entries::grp2gid("root").is_ok()); +//! +//! assert!(entries::Passwd::locate(0).is_ok()); +//! assert!(entries::Passwd::locate("0").is_ok()); +//! assert!(entries::Passwd::locate("root").is_ok()); +//! +//! assert!(entries::Group::locate(0).is_ok()); +//! assert!(entries::Group::locate("0").is_ok()); +//! assert!(entries::Group::locate("root").is_ok()); +//! ``` + +#[cfg(any(target_os = "freebsd", target_os = "macos"))] +use libc::time_t; +use libc::{uid_t, gid_t, c_char, c_int}; +use libc::{passwd, group, getpwnam, getpwuid, getgrnam, getgrgid, getgroups}; + +use ::std::ptr; +use ::std::io::ErrorKind; +use ::std::io::Error as IOError; +use ::std::io::Result as IOResult; +use ::std::ffi::{CStr, CString}; +use ::std::borrow::Cow; + +extern "C" { + fn getgrouplist(name: *const c_char, gid: gid_t, groups: *mut gid_t, ngroups: *mut c_int) -> c_int; +} + +pub fn get_groups() -> IOResult> { + let ngroups = unsafe { getgroups(0, ptr::null_mut()) }; + if ngroups == -1 { + return Err(IOError::last_os_error()) + } + let mut groups = Vec::with_capacity(ngroups as usize); + let ngroups = unsafe { getgroups(ngroups, groups.as_mut_ptr()) }; + if ngroups == -1 { + Err(IOError::last_os_error()) + } else { + unsafe { + groups.set_len(ngroups as usize); + } + Ok(groups) + } +} + +pub struct Passwd { + inner: passwd, +} + +macro_rules! cstr2cow { + ($v:expr) => ( + unsafe { CStr::from_ptr($v).to_string_lossy() } + ) +} + +impl Passwd { + /// AKA passwd.pw_name + pub fn name(&self) -> Cow { + cstr2cow!(self.inner.pw_name) + } + + /// AKA passwd.pw_uid + pub fn uid(&self) -> uid_t { + self.inner.pw_uid + } + + /// AKA passwd.pw_gid + pub fn gid(&self) -> gid_t { + self.inner.pw_gid + } + + /// AKA passwd.pw_gecos + pub fn user_info(&self) -> Cow { + cstr2cow!(self.inner.pw_gecos) + } + + /// AKA passwd.pw_shell + pub fn user_shell(&self) -> Cow { + cstr2cow!(self.inner.pw_shell) + } + + /// AKA passwd.pw_dir + pub fn user_dir(&self) -> Cow { + cstr2cow!(self.inner.pw_dir) + } + + /// AKA passwd.pw_passwd + pub fn user_passwd(&self) -> Cow { + cstr2cow!(self.inner.pw_passwd) + } + + /// AKA passwd.pw_class + #[cfg(any(target_os = "freebsd", target_os = "macos"))] + pub fn user_access_class(&self) -> Cow { + cstr2cow!(self.inner.pw_class) + } + + /// AKA passwd.pw_change + #[cfg(any(target_os = "freebsd", target_os = "macos"))] + pub fn passwd_change_time(&self) -> time_t { + self.inner.pw_change + } + + /// AKA passwd.pw_expire + #[cfg(any(target_os = "freebsd", target_os = "macos"))] + pub fn expiration(&self) -> time_t { + self.inner.pw_expire + } + + pub fn as_inner(&self) -> &passwd { + &self.inner + } + + pub fn into_inner(self) -> passwd { + self.inner + } + + pub fn belongs_to(&self) -> Vec { + let mut ngroups: c_int = 8; + let mut groups = Vec::with_capacity(ngroups as usize); + let gid = self.inner.pw_gid; + let name = self.inner.pw_name; + unsafe { + if getgrouplist(name, gid, groups.as_mut_ptr(), &mut ngroups) == -1 { + groups.resize(ngroups as usize, 0); + getgrouplist(name, gid, groups.as_mut_ptr(), &mut ngroups); + } + groups.set_len(ngroups as usize); + } + groups.truncate(ngroups as usize); + groups + } +} + +pub struct Group { + inner: group, +} + +impl Group { + /// AKA group.gr_name + pub fn name(&self) -> Cow { + cstr2cow!(self.inner.gr_name) + } + + /// AKA group.gr_gid + pub fn gid(&self) -> gid_t { + self.inner.gr_gid + } + + pub fn as_inner(&self) -> &group { + &self.inner + } + + pub fn into_inner(self) -> group { + self.inner + } +} + +/// Fetch desired entry. +pub trait Locate { + fn locate(key: K) -> IOResult where Self: ::std::marker::Sized; +} + +macro_rules! f { + ($fnam:ident, $fid:ident, $t:ident, $st:ident) => ( + impl Locate<$t> for $st { + fn locate(k: $t) -> IOResult { + unsafe { + let data = $fid(k); + if !data.is_null() { + Ok($st { + inner: ptr::read(data as *const _) + }) + } else { + Err(IOError::new(ErrorKind::NotFound, format!("No such id: {}", k))) + } + } + } + } + + impl<'a> Locate<&'a str> for $st { + fn locate(k: &'a str) -> IOResult { + if let Ok(id) = k.parse::<$t>() { + let data = unsafe { $fid(id) }; + if !data.is_null() { + Ok($st { + inner: unsafe {ptr::read(data as *const _)} + }) + } else { + Err(IOError::new(ErrorKind::NotFound, format!("No such id: {}", id))) + } + } else { + unsafe { + let data = $fnam(CString::new(k).unwrap().as_ptr()); + if !data.is_null() { + Ok($st { + inner: ptr::read(data as *const _) + }) + } else { + Err(IOError::new(ErrorKind::NotFound, format!("Not found: {}", k))) + } + } + } + } + } + ) +} + +f!(getpwnam, getpwuid, uid_t, Passwd); +f!(getgrnam, getgrgid, gid_t, Group); + +#[inline] +pub fn uid2usr(id: uid_t) -> IOResult { + Passwd::locate(id).map(|p| p.name().into_owned()) +} + +#[inline] +pub fn gid2grp(id: gid_t) -> IOResult { + Group::locate(id).map(|p| p.name().into_owned()) +} + +#[inline] +pub fn usr2uid(name: &str) -> IOResult { + Passwd::locate(name).map(|p| p.uid()) +} + +#[inline] +pub fn grp2gid(name: &str) -> IOResult { + Group::locate(name).map(|p| p.gid()) +} diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index 86e24a07a..ff45693aa 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -20,6 +20,8 @@ pub mod parse_time; pub mod utmpx; #[cfg(all(unix, feature = "c_types"))] pub mod c_types; +#[cfg(all(unix, feature = "entries"))] +pub mod entries; #[cfg(all(unix, feature = "process"))] pub mod process; #[cfg(all(unix, feature = "signals"))] From 05b53176054ed98e651feb61e71af121e329751a Mon Sep 17 00:00:00 2001 From: Knight Date: Sat, 20 Aug 2016 02:12:19 +0800 Subject: [PATCH 097/606] uucore::process: add functions to obtain uid/gid, euid/egid --- src/uucore/process.rs | 58 +++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/src/uucore/process.rs b/src/uucore/process.rs index bb9bbbc3d..f6aec5166 100644 --- a/src/uucore/process.rs +++ b/src/uucore/process.rs @@ -1,15 +1,14 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Maciej Dziardziel - * - * For the full copyright and license information, please view the LICENSE file - * that was distributed with this source code. - */ +// This file is part of the uutils coreutils package. +// +// (c) Maciej Dziardziel +// (c) Jian Zeng +// +// For the full copyright and license information, please view the LICENSE file +// that was distributed with this source code. +// -extern crate libc; - -use libc::{c_int, pid_t}; +use super::libc; +use libc::{c_int, pid_t, uid_t, gid_t}; use std::fmt; use std::io; use std::process::Child; @@ -17,6 +16,30 @@ use std::sync::{Arc, Condvar, Mutex}; use std::thread; use std::time::{Duration, Instant}; +pub fn geteuid() -> uid_t { + unsafe { + libc::geteuid() + } +} + +pub fn getegid() -> gid_t { + unsafe { + libc::getegid() + } +} + +pub fn getgid() -> gid_t { + unsafe { + libc::getgid() + } +} + +pub fn getuid() -> uid_t { + unsafe { + libc::getuid() + } +} + // This is basically sys::unix::process::ExitStatus #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub enum ExitStatus { @@ -26,7 +49,8 @@ pub enum ExitStatus { impl ExitStatus { fn from_status(status: c_int) -> ExitStatus { - if status & 0x7F != 0 { // WIFSIGNALED(status) + if status & 0x7F != 0 { + // WIFSIGNALED(status) ExitStatus::Signal(status & 0x7F) } else { ExitStatus::Code(status & 0xFF00 >> 8) @@ -75,8 +99,7 @@ pub trait ChildExt { impl ChildExt for Child { fn send_signal(&mut self, signal: usize) -> io::Result<()> { - if unsafe { libc::kill(self.id() as pid_t, - signal as i32) } != 0 { + if unsafe { libc::kill(self.id() as pid_t, signal as i32) } != 0 { Err(io::Error::last_os_error()) } else { Ok(()) @@ -86,10 +109,7 @@ impl ChildExt for Child { fn wait_or_timeout(&mut self, timeout: Duration) -> io::Result> { // The result will be written to that Option, protected by a Mutex // Then the Condvar will be signaled - let state = Arc::new(( - Mutex::new(Option::None::>), - Condvar::new(), - )); + let state = Arc::new((Mutex::new(Option::None::>), Condvar::new())); // Start the waiting thread let state_th = state.clone(); @@ -121,7 +141,7 @@ impl ChildExt for Child { return exitstatus.map(Some); } if start.elapsed() >= timeout { - return Ok(None) + return Ok(None); } let cvar_timeout = timeout - start.elapsed(); exitstatus = cvar.wait_timeout(exitstatus, cvar_timeout).unwrap().0; From d22814201e7b6075d7aa2ffe95a02cb8a7e90c4f Mon Sep 17 00:00:00 2001 From: Knight Date: Sat, 20 Aug 2016 11:59:21 +0800 Subject: [PATCH 098/606] Add uucore::utsname to get system info --- src/uucore/Cargo.toml | 4 ++-- src/uucore/lib.rs | 2 ++ src/uucore/utsname.rs | 52 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 src/uucore/utsname.rs diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 77676c251..9d53cae62 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -18,12 +18,12 @@ utf8 = [] encoding = ["data-encoding"] parse_time = [] utmpx = ["time", "libc"] -c_types = ["libc"] process = ["libc"] signals = [] entries = ["libc"] wide = [] -default = ["fs", "libc", "utf8", "encoding", "parse_time", "utmpx", "c_types", "process", "entries", "signals", "wide"] +utsname = ["libc"] +default = ["fs", "libc", "utf8", "utsname", "encoding", "parse_time", "utmpx", "process", "entries", "signals", "wide"] [lib] path = "lib.rs" diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index ff45693aa..3a17c886a 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -20,6 +20,8 @@ pub mod parse_time; pub mod utmpx; #[cfg(all(unix, feature = "c_types"))] pub mod c_types; +#[cfg(all(unix, feature = "utsname"))] +pub mod utsname; #[cfg(all(unix, feature = "entries"))] pub mod entries; #[cfg(all(unix, feature = "process"))] diff --git a/src/uucore/utsname.rs b/src/uucore/utsname.rs new file mode 100644 index 000000000..c928c6191 --- /dev/null +++ b/src/uucore/utsname.rs @@ -0,0 +1,52 @@ +// This file is part of the uutils coreutils package. +// +// (c) Jian Zeng +// +// For the full copyright and license information, please view the LICENSE file +// that was distributed with this source code. +// + +use super::libc::{uname, utsname}; +use ::std::mem; +use ::std::ffi::CStr; +use ::std::borrow::Cow; + +macro_rules! cstr2cow { + ($v:expr) => ( + unsafe { CStr::from_ptr($v.as_ref().as_ptr()).to_string_lossy() } + ) +} + +pub struct Uname { + inner: utsname, +} + +impl Uname { + pub fn new() -> Self { + unsafe { + let mut uts: utsname = mem::uninitialized(); + uname(&mut uts); + Uname { inner: uts } + } + } + + pub fn sysname(&self) -> Cow { + cstr2cow!(self.inner.sysname) + } + + pub fn nodename(&self) -> Cow { + cstr2cow!(self.inner.nodename) + } + + pub fn release(&self) -> Cow { + cstr2cow!(self.inner.release) + } + + pub fn version(&self) -> Cow { + cstr2cow!(self.inner.version) + } + + pub fn machine(&self) -> Cow { + cstr2cow!(self.inner.machine) + } +} From 1dab4510b537e18cf22810895802ab49d910d1de Mon Sep 17 00:00:00 2001 From: Knight Date: Sat, 20 Aug 2016 12:00:36 +0800 Subject: [PATCH 099/606] Remove uucore::c_types --- src/uucore/c_types.rs | 211 ------------------------------------------ src/uucore/lib.rs | 2 - 2 files changed, 213 deletions(-) delete mode 100644 src/uucore/c_types.rs diff --git a/src/uucore/c_types.rs b/src/uucore/c_types.rs deleted file mode 100644 index ce5b7426b..000000000 --- a/src/uucore/c_types.rs +++ /dev/null @@ -1,211 +0,0 @@ -#![allow(dead_code, non_camel_case_types)] - -extern crate libc; - -use self::libc::{ - c_char, - c_int, - uid_t, - gid_t, -}; -pub use self::libc::passwd as c_passwd; - -#[cfg(target_os = "macos")] -use self::libc::int32_t; - -use self::libc::getgroups; - -use std::ffi::{CStr, CString}; -use std::io::{Error, Write}; -use std::iter::repeat; -use std::vec::Vec; - -use std::ptr::{null_mut, read}; - -#[cfg(any(target_os = "macos", target_os = "freebsd"))] -#[repr(C)] -pub struct utsname { - pub sysname: [c_char; 256], - pub nodename: [c_char; 256], - pub release: [c_char; 256], - pub version: [c_char; 256], - pub machine: [c_char; 256] -} - -#[cfg(target_os = "linux")] -#[repr(C)] -pub struct utsname { - pub sysname: [c_char; 65], - pub nodename: [c_char; 65], - pub release: [c_char; 65], - pub version: [c_char; 65], - pub machine: [c_char; 65], - pub domainame: [c_char; 65] -} - -#[repr(C)] -pub struct c_group { - pub gr_name: *const c_char, // group name - pub gr_passwd: *const c_char, // password - pub gr_gid: gid_t, // group id - pub gr_mem: *const *const c_char, // member list -} - -#[repr(C)] -pub struct c_tm { - pub tm_sec: c_int, /* seconds */ - pub tm_min: c_int, /* minutes */ - pub tm_hour: c_int, /* hours */ - pub tm_mday: c_int, /* day of the month */ - pub tm_mon: c_int, /* month */ - pub tm_year: c_int, /* year */ - pub tm_wday: c_int, /* day of the week */ - pub tm_yday: c_int, /* day in the year */ - pub tm_isdst: c_int /* daylight saving time */ -} - -extern { - pub fn getpwuid(uid: uid_t) -> *const c_passwd; - pub fn getpwnam(login: *const c_char) -> *const c_passwd; - pub fn getgrgid(gid: gid_t) -> *const c_group; - pub fn getgrnam(name: *const c_char) -> *const c_group; - pub fn getgrouplist(name: *const c_char, - gid: gid_t, - groups: *mut gid_t, - ngroups: *mut c_int) -> c_int; -} - -#[cfg(target_os = "macos")] -extern { - pub fn getgroupcount(name: *const c_char, gid: gid_t) -> int32_t; -} - -pub fn get_pw_from_args(free: &[String]) -> Option { - if free.len() == 1 { - let username = &free[0][..]; - - // Passed user as id - if username.chars().all(|c| c.is_digit(10)) { - let id = username.parse::().unwrap(); - let pw_pointer = unsafe { getpwuid(id as uid_t) }; - - if !pw_pointer.is_null() { - Some(unsafe { read(pw_pointer) }) - } else { - crash!(1, "{}: no such user", username); - } - - // Passed the username as a string - } else { - let pw_pointer = unsafe { - let cstr = CString::new(username).unwrap(); - getpwnam(cstr.as_bytes_with_nul().as_ptr() as *const _) - }; - if !pw_pointer.is_null() { - Some(unsafe { read(pw_pointer) }) - } else { - crash!(1, "{}: no such user", username); - } - } - } else { - None - } -} - -pub fn get_group(groupname: &str) -> Option { - let group = if groupname.chars().all(|c| c.is_digit(10)) { - unsafe { getgrgid(groupname.parse().unwrap()) } - } else { - unsafe { - let cstr = CString::new(groupname).unwrap(); - getgrnam(cstr.as_bytes_with_nul().as_ptr() as *const c_char) - } - }; - - if !group.is_null() { - Some(unsafe { read(group) }) - } - else { - None - } -} - -pub fn get_group_list(name: *const c_char, gid: gid_t) -> Vec { - let mut ngroups: c_int = 32; - let mut groups: Vec = Vec::with_capacity(ngroups as usize); - - if unsafe { get_group_list_internal(name, gid, groups.as_mut_ptr(), &mut ngroups) } == -1 { - groups.reserve(ngroups as usize); - unsafe { get_group_list_internal(name, gid, groups.as_mut_ptr(), &mut ngroups); } - } else { - groups.truncate(ngroups as usize); - } - unsafe { groups.set_len(ngroups as usize); } - - groups -} - -#[cfg(any(target_os = "linux", target_os = "freebsd"))] -#[inline(always)] -unsafe fn get_group_list_internal(name: *const c_char, gid: gid_t, groups: *mut gid_t, grcnt: *mut c_int) -> c_int { - getgrouplist(name, gid, groups, grcnt) -} - -#[cfg(target_os = "macos")] -unsafe fn get_group_list_internal(name: *const c_char, gid: gid_t, groups: *mut gid_t, grcnt: *mut c_int) -> c_int { - let ngroups = getgroupcount(name, gid); - let oldsize = *grcnt; - *grcnt = ngroups; - if oldsize >= ngroups { - getgrouplist(name, gid, groups, grcnt); - 0 - } else { - -1 - } -} - -pub fn get_groups() -> Result, i32> { - let ngroups = unsafe { getgroups(0, null_mut()) }; - if ngroups == -1 { - return Err(Error::last_os_error().raw_os_error().unwrap()) - } - - let mut groups : Vec= repeat(0).take(ngroups as usize).collect(); - let ngroups = unsafe { getgroups(ngroups, groups.as_mut_ptr()) }; - if ngroups == -1 { - Err(Error::last_os_error().raw_os_error().unwrap()) - } else { - groups.truncate(ngroups as usize); - Ok(groups) - } -} - -pub fn group(possible_pw: Option, nflag: bool) { - let groups = match possible_pw { - Some(pw) => Ok(get_group_list(pw.pw_name, pw.pw_gid)), - None => get_groups(), - }; - - match groups { - Err(errno) => - crash!(1, "failed to get group list (errno={})", errno), - Ok(groups) => { - for &g in &groups { - if nflag { - let group = unsafe { getgrgid(g) }; - if !group.is_null() { - let name = unsafe { - let gname = read(group).gr_name; - let bytes= CStr::from_ptr(gname).to_bytes(); - String::from_utf8_lossy(bytes).to_string() - }; - print!("{} ", name); - } - } else { - print!("{} ", g); - } - } - println!(""); - } - } -} diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index 3a17c886a..5f19aa718 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -18,8 +18,6 @@ pub mod parse_time; #[cfg(all(unix, feature = "utmpx"))] pub mod utmpx; -#[cfg(all(unix, feature = "c_types"))] -pub mod c_types; #[cfg(all(unix, feature = "utsname"))] pub mod utsname; #[cfg(all(unix, feature = "entries"))] From 35951ebf66b3b342e7087b44d577a19dae298301 Mon Sep 17 00:00:00 2001 From: Nathan Ross Date: Sat, 13 Aug 2016 22:46:59 -0400 Subject: [PATCH 100/606] uucore: fix utility name in coreopts parsing error messages --- src/uucore/coreopts.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/uucore/coreopts.rs b/src/uucore/coreopts.rs index ec22af9dd..ced6b0dcc 100644 --- a/src/uucore/coreopts.rs +++ b/src/uucore/coreopts.rs @@ -41,7 +41,9 @@ impl<'a> CoreOptions<'a> { let matches = match self.options.parse(&args[1..]) { Ok(m) => { Some(m) }, Err(f) => { - crash!(1, "{}", f); + pipe_write!(&mut ::std::io::stderr(), "{}: error: ", self.help_text.name); + pipe_writeln!(&mut ::std::io::stderr(), "{}", f); + ::std::process::exit(1); } }.unwrap(); if matches.opt_present("help") { From 8cb2edecb10aaaf7292523510fcae3993ad8079e Mon Sep 17 00:00:00 2001 From: Nathan Ross Date: Sat, 13 Aug 2016 23:24:48 -0400 Subject: [PATCH 101/606] uucore: add support for optflagopt to coreopts --- src/uucore/coreopts.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/uucore/coreopts.rs b/src/uucore/coreopts.rs index ced6b0dcc..9683833b1 100644 --- a/src/uucore/coreopts.rs +++ b/src/uucore/coreopts.rs @@ -26,14 +26,18 @@ impl<'a> CoreOptions<'a> { .optflag("", "version", "print name and version number"); ret } - pub fn optopt(&mut self, short_name: &str, long_name: &str, desc: &str, hint: &str) -> &mut CoreOptions<'a> { - self.options.optopt(short_name, long_name, desc, hint); + pub fn optflagopt(&mut self, short_name: &str, long_name: &str, desc: &str, hint: &str) -> &mut CoreOptions<'a> { + self.options.optflagopt(short_name, long_name, desc, hint); self } pub fn optflag(&mut self, short_name: &str, long_name: &str, desc: &str) -> &mut CoreOptions<'a> { self.options.optflag(short_name, long_name, desc); self } + pub fn optopt(&mut self, short_name: &str, long_name: &str, desc: &str, hint: &str) -> &mut CoreOptions<'a> { + self.options.optopt(short_name, long_name, desc, hint); + self + } pub fn usage(&self, summary : &str) -> String { self.options.usage(summary) } From 22fab1444e3c3687f3863c8c4ddb60eb0f3688c8 Mon Sep 17 00:00:00 2001 From: Nathan Ross Date: Sun, 14 Aug 2016 22:49:27 -0400 Subject: [PATCH 102/606] uucore: allow 'wrong number of arguments' macro to be more precise --- src/uucore/macros.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/uucore/macros.rs b/src/uucore/macros.rs index a88d78b84..5e2f68a66 100644 --- a/src/uucore/macros.rs +++ b/src/uucore/macros.rs @@ -327,8 +327,21 @@ macro_rules! msg_args_nonexistent_file { ($received:expr) => ( msg_args_invalid_value!("paths to files", snippet_no_file_at_path!($received)));} #[macro_export] -macro_rules! msg_wrong_number_of_arguments { () => ( - msg_args_invalid_value!("wrong number of arguments") ); } +macro_rules! msg_wrong_number_of_arguments { + () => ( + msg_args_invalid_value!("wrong number of arguments") + ); + ($min:expr, $max:expr) => ( + msg_args_invalid_value!(format!("expects {}-{} arguments", $min, $max)) + ); + ($exact:expr) => ( + if $exact == 1 { + msg_args_invalid_value!("expects 1 argument") + } else { + msg_args_invalid_value!(format!("expects {} arguments", $exact)) + } + ); +} // -- message templates : invalid input : input combinations From b6dcafc6751b14b96d9f54e24979de4c88b27b03 Mon Sep 17 00:00:00 2001 From: knight42 Date: Sat, 27 Aug 2016 23:58:33 +0800 Subject: [PATCH 103/606] uucore::fs: add `fn resolve_relative_path` --- src/uucore/fs.rs | 74 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 23 deletions(-) diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index e4929c215..e2a34d814 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -1,18 +1,39 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Joseph Crail - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +// This file is part of the uutils coreutils package. +// +// (c) Joseph Crail +// (c) Jian Zeng +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. +// #[cfg(unix)] use super::libc; use std::env; use std::fs; -use std::io::{Error, ErrorKind, Result}; +use std::io::{Error, ErrorKind}; +use std::io::Result as IOResult; use std::path::{Component, Path, PathBuf}; +use std::borrow::Cow; + +#[cfg(unix)] +pub fn resolve_relative_path<'a>(path: &'a Path) -> Cow<'a, Path> { + if path.is_absolute() { + return path.into(); + } + let mut result = env::current_dir().unwrap_or(PathBuf::from("/")); + for comp in path.components() { + match comp { + Component::ParentDir => { + result.pop(); + } + Component::CurDir => (), + Component::Normal(s) => result.push(s), + _ => unreachable!(), + } + } + result.into() +} #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum CanonicalizeMode { @@ -22,7 +43,7 @@ pub enum CanonicalizeMode { Missing, } -fn resolve>(original: P) -> Result { +fn resolve>(original: P) -> IOResult { const MAX_LINKS_FOLLOWED: u32 = 255; let mut followed = 0; let mut result = original.as_ref().to_path_buf(); @@ -40,7 +61,7 @@ fn resolve>(original: P) -> Result { Ok(path) => { result.pop(); result.push(path); - }, + } Err(e) => { return Err(e); } @@ -51,7 +72,7 @@ fn resolve>(original: P) -> Result { Ok(result) } -pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> Result { +pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> IOResult { // Create an absolute path let original = original.as_ref(); let original = if original.is_absolute() { @@ -61,20 +82,21 @@ pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> }; let mut result = PathBuf::new(); - let mut parts = vec!(); + let mut parts = vec![]; // Split path by directory separator; add prefix (Windows-only) and root // directory to final path buffer; add remaining parts to temporary // vector for canonicalization. for part in original.components() { match part { - Component::Prefix(_) | Component::RootDir => { + Component::Prefix(_) | + Component::RootDir => { result.push(part.as_os_str()); - }, - Component::CurDir => {}, + } + Component::CurDir => (), Component::ParentDir => { parts.pop(); - }, + } Component::Normal(_) => { parts.push(part.as_os_str()); } @@ -83,7 +105,7 @@ pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> // Resolve the symlinks where possible if !parts.is_empty() { - for part in parts[..parts.len()-1].iter() { + for part in parts[..parts.len() - 1].iter() { result.push(part); if can_mode == CanonicalizeMode::None { @@ -91,10 +113,12 @@ pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> } match resolve(&result) { - Err(e) => match can_mode { - CanonicalizeMode::Missing => continue, - _ => return Err(e) - }, + Err(e) => { + match can_mode { + CanonicalizeMode::Missing => continue, + _ => return Err(e), + } + } Ok(path) => { result.pop(); result.push(path); @@ -105,7 +129,11 @@ pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> result.push(parts.last().unwrap()); match resolve(&result) { - Err(e) => { if can_mode == CanonicalizeMode::Existing { return Err(e); } }, + Err(e) => { + if can_mode == CanonicalizeMode::Existing { + return Err(e); + } + } Ok(path) => { result.pop(); result.push(path); From 09b0b9ad78eb2fe6e37940883c2f807697c10db3 Mon Sep 17 00:00:00 2001 From: knight42 Date: Sun, 28 Aug 2016 19:55:41 +0800 Subject: [PATCH 104/606] chown,chgrp: fix bug in option --preserve-root --- src/uucore/fs.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index e2a34d814..d02895c8d 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -16,20 +16,21 @@ use std::io::Result as IOResult; use std::path::{Component, Path, PathBuf}; use std::borrow::Cow; -#[cfg(unix)] pub fn resolve_relative_path<'a>(path: &'a Path) -> Cow<'a, Path> { - if path.is_absolute() { + if path.components().all(|e| e != Component::ParentDir) { return path.into(); } - let mut result = env::current_dir().unwrap_or(PathBuf::from("/")); + let root = Component::RootDir.as_os_str(); + let mut result = env::current_dir().unwrap_or(PathBuf::from(root)); for comp in path.components() { match comp { Component::ParentDir => { result.pop(); } Component::CurDir => (), - Component::Normal(s) => result.push(s), - _ => unreachable!(), + Component::RootDir | + Component::Normal(_) | + Component::Prefix(_) => result.push(comp.as_os_str()), } } result.into() From cf2be8a6b1de8b8d771fe1f7cb19004f92b04e50 Mon Sep 17 00:00:00 2001 From: Will Wykeham Date: Fri, 18 Nov 2016 13:58:36 +0000 Subject: [PATCH 105/606] Fix a number of Windows build warnings --- src/uucore/fs.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index d02895c8d..6f6ff3e2b 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -14,6 +14,7 @@ use std::fs; use std::io::{Error, ErrorKind}; use std::io::Result as IOResult; use std::path::{Component, Path, PathBuf}; +#[cfg(unix)] use std::borrow::Cow; pub fn resolve_relative_path<'a>(path: &'a Path) -> Cow<'a, Path> { From 3f4dba0de9290c0e5ba54e439ed66fe7ae05bfcb Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 24 Nov 2016 17:15:43 -0500 Subject: [PATCH 106/606] 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. --- src/uucore/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index 5f19aa718..9b1a5e763 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -16,7 +16,7 @@ pub mod encoding; #[cfg(feature = "parse_time")] pub mod parse_time; -#[cfg(all(unix, feature = "utmpx"))] +#[cfg(all(unix, not(target_os = "fuchsia"), feature = "utmpx"))] pub mod utmpx; #[cfg(all(unix, feature = "utsname"))] pub mod utsname; @@ -24,7 +24,7 @@ pub mod utsname; pub mod entries; #[cfg(all(unix, feature = "process"))] pub mod process; -#[cfg(all(unix, feature = "signals"))] +#[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))] pub mod signals; #[cfg(all(windows, feature = "wide"))] From f3639b94530cbf3dea72a7e3cd8b1c9449667e9a Mon Sep 17 00:00:00 2001 From: Joseph Crail Date: Fri, 25 Nov 2016 14:36:56 -0500 Subject: [PATCH 107/606] Fix comment spelling --- src/uucore/utmpx.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/utmpx.rs b/src/uucore/utmpx.rs index 8ce06df3e..ddf976ab9 100644 --- a/src/uucore/utmpx.rs +++ b/src/uucore/utmpx.rs @@ -55,7 +55,7 @@ pub unsafe extern "C" fn utmpxname(_file: *const libc::c_char) -> libc::c_int { 0 } -// In case the c_char array doesn' t end with NULL +// In case the c_char array doesn't end with NULL macro_rules! chars2string { ($arr:expr) => ( $arr.iter().take_while(|i| **i > 0).map(|&i| i as u8 as char).collect::() From f61f30f52b21f04cb34ca517918aadbe5e5b6724 Mon Sep 17 00:00:00 2001 From: Arcterus Date: Sat, 26 Nov 2016 17:16:11 -0800 Subject: [PATCH 108/606] uucore: read symlinked directories correctly in resolve_relative_path() --- src/uucore/fs.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index 6f6ff3e2b..6c16c7177 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -26,6 +26,9 @@ pub fn resolve_relative_path<'a>(path: &'a Path) -> Cow<'a, Path> { for comp in path.components() { match comp { Component::ParentDir => { + if let Ok(p) = result.read_link() { + result = p; + } result.pop(); } Component::CurDir => (), From e2b8741a35c272bf0cd16b97e4cb2ab92724c550 Mon Sep 17 00:00:00 2001 From: Arcterus Date: Wed, 30 Nov 2016 03:51:49 -0800 Subject: [PATCH 109/606] uucore: compile on Windows again --- src/uucore/fs.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index 6c16c7177..6cc0d58da 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -14,7 +14,6 @@ use std::fs; use std::io::{Error, ErrorKind}; use std::io::Result as IOResult; use std::path::{Component, Path, PathBuf}; -#[cfg(unix)] use std::borrow::Cow; pub fn resolve_relative_path<'a>(path: &'a Path) -> Cow<'a, Path> { From e7940828f95d2990c702c6814c2a10bea3822155 Mon Sep 17 00:00:00 2001 From: Matt8898 Date: Sat, 22 Apr 2017 21:33:25 +0200 Subject: [PATCH 110/606] uucore: add support for optflagmulti and optmulti. --- src/uucore/coreopts.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/uucore/coreopts.rs b/src/uucore/coreopts.rs index 9683833b1..da2454508 100644 --- a/src/uucore/coreopts.rs +++ b/src/uucore/coreopts.rs @@ -34,10 +34,18 @@ impl<'a> CoreOptions<'a> { self.options.optflag(short_name, long_name, desc); self } + pub fn optflagmulti(&mut self, short_name: &str, long_name: &str, desc: &str) -> &mut CoreOptions<'a> { + self.options.optflagmulti(short_name, long_name, desc); + self + } pub fn optopt(&mut self, short_name: &str, long_name: &str, desc: &str, hint: &str) -> &mut CoreOptions<'a> { self.options.optopt(short_name, long_name, desc, hint); self } + pub fn optmulti(&mut self, short_name: &str, long_name: &str, desc: &str, hint: &str) -> &mut CoreOptions<'a> { + self.options.optmulti(short_name, long_name, desc, hint); + self + } pub fn usage(&self, summary : &str) -> String { self.options.usage(summary) } From 6998949c063d1b198bd7efe9085b322cbc3e38e6 Mon Sep 17 00:00:00 2001 From: Joshua Miller Date: Sat, 15 Jul 2017 14:03:43 -0500 Subject: [PATCH 111/606] pin dependencies --- src/uucore/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 9d53cae62..eba667645 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -4,8 +4,8 @@ version = "0.0.1" authors = [] [dependencies] -getopts = "*" -time = { version = "*", optional = true } +getopts = "0.2.14" +time = { version = "0.1.38", optional = true } data-encoding = { version = "^1.1", optional = true } [dependencies.libc] From fd555c6d2148c52d86d83b3b816f02615fec6ece Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Thu, 7 Dec 2017 19:40:55 -0800 Subject: [PATCH 112/606] Handle SIGPIPE correctly and autogenerate main() for each util --- src/uucore/lib.rs | 2 ++ src/uucore/panic.rs | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/uucore/panic.rs diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index 9b1a5e763..3c6314d8a 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -7,6 +7,8 @@ mod macros; #[macro_use] pub mod coreopts; +pub mod panic; + #[cfg(feature = "fs")] pub mod fs; #[cfg(feature = "utf8")] diff --git a/src/uucore/panic.rs b/src/uucore/panic.rs new file mode 100644 index 000000000..765e035ab --- /dev/null +++ b/src/uucore/panic.rs @@ -0,0 +1,13 @@ +use std::panic; + +pub fn install_sigpipe_hook() { + let hook = panic::take_hook(); + panic::set_hook(Box::new(move |info| { + if let Some(res) = info.payload().downcast_ref::() { + if res.contains("Broken pipe") { + return; + } + } + hook(info) + })); +} From f0bd170996deff926be62d39846791084ed8eae7 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Sun, 10 Dec 2017 20:11:05 -0800 Subject: [PATCH 113/606] chmod, install: move mode parsing into uucore --- src/uucore/Cargo.toml | 3 +- src/uucore/lib.rs | 2 + src/uucore/mode.rs | 129 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 src/uucore/mode.rs diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index eba667645..236bf7860 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -17,13 +17,14 @@ fs = ["libc"] utf8 = [] encoding = ["data-encoding"] parse_time = [] +mode = ["libc"] utmpx = ["time", "libc"] process = ["libc"] signals = [] entries = ["libc"] wide = [] utsname = ["libc"] -default = ["fs", "libc", "utf8", "utsname", "encoding", "parse_time", "utmpx", "process", "entries", "signals", "wide"] +default = ["fs", "libc", "utf8", "utsname", "encoding", "parse_time", "mode", "utmpx", "process", "entries", "signals", "wide"] [lib] path = "lib.rs" diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index 3c6314d8a..2bbca4b30 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -17,6 +17,8 @@ pub mod utf8; pub mod encoding; #[cfg(feature = "parse_time")] pub mod parse_time; +#[cfg(feature = "mode")] +pub mod mode; #[cfg(all(unix, not(target_os = "fuchsia"), feature = "utmpx"))] pub mod utmpx; diff --git a/src/uucore/mode.rs b/src/uucore/mode.rs new file mode 100644 index 000000000..f8d2123d2 --- /dev/null +++ b/src/uucore/mode.rs @@ -0,0 +1,129 @@ +// This file is part of the uutils coreutils package. +// +// (c) Alex Lyon +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. +// + +use std::error::Error; + +pub fn parse_numeric(fperm: u32, mut mode: &str) -> Result { + let (op, pos) = parse_op(mode, Some('='))?; + mode = mode[pos..].trim_left_matches('0'); + if mode.len() > 4 { + Err(format!("mode is too large ({} > 7777)", mode)) + } else { + match u32::from_str_radix(mode, 8) { + Ok(change) => { + Ok(match op { + '+' => fperm | change, + '-' => fperm & !change, + '=' => change, + _ => unreachable!() + }) + } + Err(err) => Err(err.description().to_owned()) + } + } +} + +pub fn parse_symbolic(mut fperm: u32, mut mode: &str, considering_dir: bool) -> Result { + #[cfg(unix)] + use libc::umask; + + #[cfg(target_os = "redox")] + unsafe fn umask(_mask: u32) -> u32 { + // XXX Redox does not currently have umask + 0 + } + + let (mask, pos) = parse_levels(mode); + if pos == mode.len() { + return Err(format!("invalid mode ({})", mode)); + } + let respect_umask = pos == 0; + let last_umask = unsafe { + umask(0) + }; + mode = &mode[pos..]; + while mode.len() > 0 { + let (op, pos) = parse_op(mode, None)?; + mode = &mode[pos..]; + let (mut srwx, pos) = parse_change(mode, fperm, considering_dir); + if respect_umask { + srwx &= !(last_umask as u32); + } + mode = &mode[pos..]; + match op { + '+' => fperm |= srwx & mask, + '-' => fperm &= !(srwx & mask), + '=' => fperm = (fperm & !mask) | (srwx & mask), + _ => unreachable!() + } + } + unsafe { + umask(last_umask); + } + Ok(fperm) +} + +fn parse_levels(mode: &str) -> (u32, usize) { + let mut mask = 0; + let mut pos = 0; + for ch in mode.chars() { + mask |= match ch { + 'u' => 0o7700, + 'g' => 0o7070, + 'o' => 0o7007, + 'a' => 0o7777, + _ => break + }; + pos += 1; + } + if pos == 0 { + mask = 0o7777; // default to 'a' + } + (mask, pos) +} + +fn parse_op(mode: &str, default: Option) -> Result<(char, usize), String> { + match mode.chars().next() { + Some(ch) => match ch { + '+' | '-' | '=' => Ok((ch, 1)), + _ => match default { + Some(ch) => Ok((ch, 0)), + None => Err(format!("invalid operator (expected +, -, or =, but found {})", ch)) + } + }, + None => Err("unexpected end of mode".to_owned()) + } +} + +fn parse_change(mode: &str, fperm: u32, considering_dir: bool) -> (u32, usize) { + let mut srwx = fperm & 0o7000; + let mut pos = 0; + for ch in mode.chars() { + match ch { + 'r' => srwx |= 0o444, + 'w' => srwx |= 0o222, + 'x' => srwx |= 0o111, + 'X' => { + if considering_dir || (fperm & 0o0111) != 0 { + srwx |= 0o111 + } + } + 's' => srwx |= 0o4000 | 0o2000, + 't' => srwx |= 0o1000, + 'u' => srwx = (fperm & 0o700) | ((fperm >> 3) & 0o070) | ((fperm >> 6) & 0o007), + 'g' => srwx = ((fperm << 3) & 0o700) | (fperm & 0o070) | ((fperm >> 3) & 0o007), + 'o' => srwx = ((fperm << 6) & 0o700) | ((fperm << 3) & 0o070) | (fperm & 0o007), + _ => break + }; + pos += 1; + } + if pos == 0 { + srwx = 0; + } + (srwx, pos) +} \ No newline at end of file From 5544def54e09357cb93273e05d1ec86da081b951 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Sun, 10 Dec 2017 20:57:39 -0800 Subject: [PATCH 114/606] Remove pipe_* macros --- src/uucore/coreopts.rs | 5 +- src/uucore/macros.rs | 140 +++------------------------------------ src/uucore/parse_time.rs | 2 +- 3 files changed, 13 insertions(+), 134 deletions(-) diff --git a/src/uucore/coreopts.rs b/src/uucore/coreopts.rs index da2454508..76895b612 100644 --- a/src/uucore/coreopts.rs +++ b/src/uucore/coreopts.rs @@ -1,5 +1,4 @@ extern crate getopts; -use std::io::Write; pub struct HelpText<'a> { pub name : &'a str, @@ -53,8 +52,8 @@ impl<'a> CoreOptions<'a> { let matches = match self.options.parse(&args[1..]) { Ok(m) => { Some(m) }, Err(f) => { - pipe_write!(&mut ::std::io::stderr(), "{}: error: ", self.help_text.name); - pipe_writeln!(&mut ::std::io::stderr(), "{}", f); + eprint!("{}: error: ", self.help_text.name); + eprintln!("{}", f); ::std::process::exit(1); } }.unwrap(); diff --git a/src/uucore/macros.rs b/src/uucore/macros.rs index 5e2f68a66..03decc92e 100644 --- a/src/uucore/macros.rs +++ b/src/uucore/macros.rs @@ -1,7 +1,7 @@ /* * This file is part of the uutils coreutils package. * - * (c) Arcterus + * (c) Alex Lyon * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -22,46 +22,36 @@ macro_rules! executable( #[macro_export] macro_rules! show_error( ($($args:tt)+) => ({ - pipe_write!(&mut ::std::io::stderr(), "{}: error: ", executable!()); - pipe_writeln!(&mut ::std::io::stderr(), $($args)+); + eprint!("{}: error: ", executable!()); + eprintln!($($args)+); }) ); #[macro_export] macro_rules! show_warning( ($($args:tt)+) => ({ - pipe_write!(&mut ::std::io::stderr(), "{}: warning: ", executable!()); - pipe_writeln!(&mut ::std::io::stderr(), $($args)+); + eprint!("{}: warning: ", executable!()); + eprintln!($($args)+); }) ); #[macro_export] macro_rules! show_info( ($($args:tt)+) => ({ - pipe_write!(&mut ::std::io::stderr(), "{}: ", executable!()); - pipe_writeln!(&mut ::std::io::stderr(), $($args)+); + eprint!("{}: ", executable!()); + eprintln!($($args)+); }) ); #[macro_export] macro_rules! disp_err( ($($args:tt)+) => ({ - pipe_write!(&mut ::std::io::stderr(), "{}: ", executable!()); - pipe_writeln!(&mut ::std::io::stderr(), $($args)+); - pipe_writeln!(&mut ::std::io::stderr(), "Try '{} --help' for more information.", executable!()); + eprint!("{}: ", executable!()); + eprintln!($($args)+); + eprintln!("Try '{} --help' for more information.", executable!()); }) ); -#[macro_export] -macro_rules! eprint( - ($($args:tt)+) => (pipe_write!(&mut ::std::io::stderr(), $($args)+)) -); - -#[macro_export] -macro_rules! eprintln( - ($($args:tt)+) => (pipe_writeln!(&mut ::std::io::stderr(), $($args)+)) -); - #[macro_export] macro_rules! crash( ($exitcode:expr, $($args:tt)+) => ({ @@ -87,22 +77,6 @@ macro_rules! crash_if_err( ) ); -#[macro_export] -macro_rules! pipe_crash_if_err( - ($exitcode:expr, $exp:expr) => ( - match $exp { - Ok(_) => (), - Err(f) => { - if f.kind() == ::std::io::ErrorKind::BrokenPipe { - () - } else { - crash!($exitcode, "{}", f) - } - }, - } - ) -); - #[macro_export] macro_rules! return_if_err( ($exitcode:expr, $exp:expr) => ( @@ -116,100 +90,6 @@ macro_rules! return_if_err( ) ); -// XXX: should the pipe_* macros return an Err just to show the write failed? - -#[macro_export] -macro_rules! pipe_print( - ($($args:tt)+) => ( - match write!(&mut ::std::io::stdout(), $($args)+) { - Ok(_) => true, - Err(f) => { - if f.kind() == ::std::io::ErrorKind::BrokenPipe { - false - } else { - panic!("{}", f) - } - } - } - ) -); - -#[macro_export] -macro_rules! pipe_println( - ($($args:tt)+) => ( - match writeln!(&mut ::std::io::stdout(), $($args)+) { - Ok(_) => true, - Err(f) => { - if f.kind() == ::std::io::ErrorKind::BrokenPipe { - false - } else { - panic!("{}", f) - } - } - } - ) -); - -#[macro_export] -macro_rules! pipe_write( - ($fd:expr, $($args:tt)+) => ( - match write!($fd, $($args)+) { - Ok(_) => true, - Err(f) => { - if f.kind() == ::std::io::ErrorKind::BrokenPipe { - false - } else { - panic!("{}", f) - } - } - } - ) -); - -#[macro_export] -macro_rules! pipe_writeln( - ($fd:expr, $($args:tt)+) => ( - match writeln!($fd, $($args)+) { - Ok(_) => true, - Err(f) => { - if f.kind() == ::std::io::ErrorKind::BrokenPipe { - false - } else { - panic!("{}", f) - } - } - } - ) -); - -#[macro_export] -macro_rules! pipe_flush( - () => ( - match ::std::io::stdout().flush() { - Ok(_) => true, - Err(f) => { - if f.kind() == ::std::io::ErrorKind::BrokenPipe { - false - } else { - panic!("{}", f) - } - } - } - ); - ($fd:expr) => ( - match $fd.flush() { - Ok(_) => true, - Err(f) => { - if f.kind() == ::std::io::ErrorKind::BrokenPipe { - false - } else { - panic!("{}", f) - } - } - } - ) -); - #[macro_export] macro_rules! safe_write( ($fd:expr, $($args:tt)+) => ( diff --git a/src/uucore/parse_time.rs b/src/uucore/parse_time.rs index 6083badd9..05b9f17b1 100644 --- a/src/uucore/parse_time.rs +++ b/src/uucore/parse_time.rs @@ -1,7 +1,7 @@ /* * This file is part of the uutils coreutils package. * - * (c) Arcterus + * (c) Alex Lyon * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. From 64c2c2055bd28276ddf4afa6536b8663da03b535 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Sun, 10 Dec 2017 21:21:24 -0800 Subject: [PATCH 115/606] chmod, install, uucore: fix build on Windows --- src/uucore/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index 2bbca4b30..c1f5b5277 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -17,9 +17,9 @@ pub mod utf8; pub mod encoding; #[cfg(feature = "parse_time")] pub mod parse_time; -#[cfg(feature = "mode")] -pub mod mode; +#[cfg(all(not(windows), feature = "mode"))] +pub mod mode; #[cfg(all(unix, not(target_os = "fuchsia"), feature = "utmpx"))] pub mod utmpx; #[cfg(all(unix, feature = "utsname"))] From 3cec199da10c68219898ea568002ae2f806288de Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Wed, 6 Dec 2017 17:53:36 -0800 Subject: [PATCH 116/606] Add Sphinx documentation to generate man pages --- src/uucore/Cargo.toml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 236bf7860..c0801d925 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -7,10 +7,7 @@ authors = [] getopts = "0.2.14" time = { version = "0.1.38", optional = true } data-encoding = { version = "^1.1", optional = true } - -[dependencies.libc] -git = "https://github.com/rust-lang/libc.git" -optional = true +libc = { version = "0.2.34", optional = true } [features] fs = ["libc"] From f575b8f4f24714929c624136b430cf1e380991ef Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Sun, 4 Mar 2018 17:58:16 -0800 Subject: [PATCH 117/606] arch: add support for building on Windows --- src/uucore/Cargo.toml | 3 +- src/uucore/lib.rs | 4 +- src/uucore/utsname.rs | 120 +++++++++++++++++++++++++++++------------- 3 files changed, 87 insertions(+), 40 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index c0801d925..90be15c92 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -8,6 +8,7 @@ getopts = "0.2.14" time = { version = "0.1.38", optional = true } data-encoding = { version = "^1.1", optional = true } libc = { version = "0.2.34", optional = true } +winapi = { version = "0.3", features = ["sysinfoapi"], optional = true } [features] fs = ["libc"] @@ -20,7 +21,7 @@ process = ["libc"] signals = [] entries = ["libc"] wide = [] -utsname = ["libc"] +utsname = ["libc", "winapi"] default = ["fs", "libc", "utf8", "utsname", "encoding", "parse_time", "mode", "utmpx", "process", "entries", "signals", "wide"] [lib] diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index c1f5b5277..14c2246d4 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -1,5 +1,7 @@ #[cfg(feature = "libc")] pub extern crate libc; +#[cfg(feature = "winapi")] +pub extern crate winapi; #[macro_use] mod macros; @@ -22,7 +24,7 @@ pub mod parse_time; pub mod mode; #[cfg(all(unix, not(target_os = "fuchsia"), feature = "utmpx"))] pub mod utmpx; -#[cfg(all(unix, feature = "utsname"))] +#[cfg(feature = "utsname")] pub mod utsname; #[cfg(all(unix, feature = "entries"))] pub mod entries; diff --git a/src/uucore/utsname.rs b/src/uucore/utsname.rs index c928c6191..a33e3fb19 100644 --- a/src/uucore/utsname.rs +++ b/src/uucore/utsname.rs @@ -6,47 +6,91 @@ // that was distributed with this source code. // -use super::libc::{uname, utsname}; -use ::std::mem; -use ::std::ffi::CStr; -use ::std::borrow::Cow; +pub use self::platform::*; -macro_rules! cstr2cow { - ($v:expr) => ( - unsafe { CStr::from_ptr($v.as_ref().as_ptr()).to_string_lossy() } - ) -} +#[cfg(unix)] +mod platform { + use super::libc::{uname, utsname}; + use ::std::mem; + use ::std::ffi::CStr; + use ::std::borrow::Cow; + use ::std::io; -pub struct Uname { - inner: utsname, -} + macro_rules! cstr2cow { + ($v:expr) => ( + unsafe { CStr::from_ptr($v.as_ref().as_ptr()).to_string_lossy() } + ) + } -impl Uname { - pub fn new() -> Self { - unsafe { - let mut uts: utsname = mem::uninitialized(); - uname(&mut uts); - Uname { inner: uts } + pub struct Uname { + inner: utsname, + } + + impl Uname { + pub fn new() -> io::Result { + unsafe { + let mut uts: utsname = mem::uninitialized(); + if uname(&mut uts) == 0 { + Ok(Uname { inner: uts }) + } else { + Err(io::Error::last_os_error()) + } + } + } + + pub fn sysname(&self) -> Cow { + cstr2cow!(self.inner.sysname) + } + + pub fn nodename(&self) -> Cow { + cstr2cow!(self.inner.nodename) + } + + pub fn release(&self) -> Cow { + cstr2cow!(self.inner.release) + } + + pub fn version(&self) -> Cow { + cstr2cow!(self.inner.version) + } + + pub fn machine(&self) -> Cow { + cstr2cow!(self.inner.machine) } } - - pub fn sysname(&self) -> Cow { - cstr2cow!(self.inner.sysname) - } - - pub fn nodename(&self) -> Cow { - cstr2cow!(self.inner.nodename) - } - - pub fn release(&self) -> Cow { - cstr2cow!(self.inner.release) - } - - pub fn version(&self) -> Cow { - cstr2cow!(self.inner.version) - } - - pub fn machine(&self) -> Cow { - cstr2cow!(self.inner.machine) - } } + +#[cfg(windows)] +mod platform { + use ::winapi::um::sysinfoapi::{SYSTEM_INFO, GetSystemInfo}; + use ::winapi::um::winnt::*; + use ::std::mem; + use ::std::borrow::Cow; + use ::std::io; + + pub struct Uname { + inner: SYSTEM_INFO + } + + impl Uname { + pub fn new() -> io::Result { + unsafe { + let mut info = mem::uninitialized(); + GetSystemInfo(&mut info); + Ok(Uname { inner: info }) + } + } + + // FIXME: need to implement more architectures (e.g. ARM) + pub fn machine(&self) -> Cow { + let arch = unsafe { + match self.inner.u.s().wProcessorArchitecture { + PROCESSOR_ARCHITECTURE_AMD64 => "x86_64", + PROCESSOR_ARCHITECTURE_INTEL => "x86", + _ => unimplemented!() + } + }; + Cow::from(arch) + } + } +} \ No newline at end of file From 7559c0d83d308ba2494baa1deafcbc0e1ff254f5 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Sun, 4 Mar 2018 18:12:15 -0800 Subject: [PATCH 118/606] cp, tail: update winapi --- src/uucore/utsname.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/utsname.rs b/src/uucore/utsname.rs index a33e3fb19..77c0735cf 100644 --- a/src/uucore/utsname.rs +++ b/src/uucore/utsname.rs @@ -10,7 +10,7 @@ pub use self::platform::*; #[cfg(unix)] mod platform { - use super::libc::{uname, utsname}; + use ::libc::{uname, utsname}; use ::std::mem; use ::std::ffi::CStr; use ::std::borrow::Cow; From ca3393bd86309c5480eabf4b3a325c1682b6059d Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Mon, 5 Mar 2018 02:53:08 -0800 Subject: [PATCH 119/606] uucore: read from sys:uname on Redox --- src/uucore/utsname.rs | 59 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/uucore/utsname.rs b/src/uucore/utsname.rs index 77c0735cf..16b94472a 100644 --- a/src/uucore/utsname.rs +++ b/src/uucore/utsname.rs @@ -93,4 +93,63 @@ mod platform { Cow::from(arch) } } +} + +#[cfg(target_os = "redox")] +mod platform { + use ::std::borrow::Cow; + use ::std::io::{self, Read}; + use ::std::fs::File; + + pub struct Uname { + kernel_name: String, + nodename: String, + kernel_release: String, + kernel_version: String, + machine: String + } + + impl Uname { + pub fn new() -> io::Result { + let mut inner = String::new(); + File::open("sys:uname")?.read_to_string(&mut inner)?; + + let mut lines = inner.lines(); + + let kernel_name = lines.next().unwrap(); + let nodename = lines.next().unwrap(); + let kernel_release = lines.next().unwrap(); + let kernel_version = lines.next().unwrap(); + let machine = lines.next().unwrap(); + + // FIXME: don't actually duplicate the data as doing so is wasteful + Ok(Uname { + kernel_name: kernel_name.to_owned(), + nodename: nodename.to_owned(), + kernel_release: kernel_release.to_owned(), + kernel_version: kernel_version.to_owned(), + machine: machine.to_owned() + }) + } + + pub fn sysname(&self) -> Cow { + Cow::from(self.kernel_name.as_str()) + } + + pub fn nodename(&self) -> Cow { + Cow::from(self.nodename.as_str()) + } + + pub fn release(&self) -> Cow { + Cow::from(self.kernel_release.as_str()) + } + + pub fn version(&self) -> Cow { + Cow::from(self.kernel_version.as_str()) + } + + pub fn machine(&self) -> Cow { + Cow::from(self.machine.as_str()) + } + } } \ No newline at end of file From 1c0b1ab3756e1d192497d72622db74378d2ee2dd Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Sun, 11 Mar 2018 18:48:47 -0700 Subject: [PATCH 120/606] uucore: remove utsname.rs (and replace with platform-info) --- src/uucore/Cargo.toml | 4 +- src/uucore/lib.rs | 2 - src/uucore/utsname.rs | 155 ------------------------------------------ 3 files changed, 1 insertion(+), 160 deletions(-) delete mode 100644 src/uucore/utsname.rs diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 90be15c92..e1e56fed3 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -8,7 +8,6 @@ getopts = "0.2.14" time = { version = "0.1.38", optional = true } data-encoding = { version = "^1.1", optional = true } libc = { version = "0.2.34", optional = true } -winapi = { version = "0.3", features = ["sysinfoapi"], optional = true } [features] fs = ["libc"] @@ -21,8 +20,7 @@ process = ["libc"] signals = [] entries = ["libc"] wide = [] -utsname = ["libc", "winapi"] -default = ["fs", "libc", "utf8", "utsname", "encoding", "parse_time", "mode", "utmpx", "process", "entries", "signals", "wide"] +default = ["fs", "libc", "utf8", "encoding", "parse_time", "mode", "utmpx", "process", "entries", "signals", "wide"] [lib] path = "lib.rs" diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index 14c2246d4..dbbc1b825 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -24,8 +24,6 @@ pub mod parse_time; pub mod mode; #[cfg(all(unix, not(target_os = "fuchsia"), feature = "utmpx"))] pub mod utmpx; -#[cfg(feature = "utsname")] -pub mod utsname; #[cfg(all(unix, feature = "entries"))] pub mod entries; #[cfg(all(unix, feature = "process"))] diff --git a/src/uucore/utsname.rs b/src/uucore/utsname.rs deleted file mode 100644 index 16b94472a..000000000 --- a/src/uucore/utsname.rs +++ /dev/null @@ -1,155 +0,0 @@ -// This file is part of the uutils coreutils package. -// -// (c) Jian Zeng -// -// For the full copyright and license information, please view the LICENSE file -// that was distributed with this source code. -// - -pub use self::platform::*; - -#[cfg(unix)] -mod platform { - use ::libc::{uname, utsname}; - use ::std::mem; - use ::std::ffi::CStr; - use ::std::borrow::Cow; - use ::std::io; - - macro_rules! cstr2cow { - ($v:expr) => ( - unsafe { CStr::from_ptr($v.as_ref().as_ptr()).to_string_lossy() } - ) - } - - pub struct Uname { - inner: utsname, - } - - impl Uname { - pub fn new() -> io::Result { - unsafe { - let mut uts: utsname = mem::uninitialized(); - if uname(&mut uts) == 0 { - Ok(Uname { inner: uts }) - } else { - Err(io::Error::last_os_error()) - } - } - } - - pub fn sysname(&self) -> Cow { - cstr2cow!(self.inner.sysname) - } - - pub fn nodename(&self) -> Cow { - cstr2cow!(self.inner.nodename) - } - - pub fn release(&self) -> Cow { - cstr2cow!(self.inner.release) - } - - pub fn version(&self) -> Cow { - cstr2cow!(self.inner.version) - } - - pub fn machine(&self) -> Cow { - cstr2cow!(self.inner.machine) - } - } -} - -#[cfg(windows)] -mod platform { - use ::winapi::um::sysinfoapi::{SYSTEM_INFO, GetSystemInfo}; - use ::winapi::um::winnt::*; - use ::std::mem; - use ::std::borrow::Cow; - use ::std::io; - - pub struct Uname { - inner: SYSTEM_INFO - } - - impl Uname { - pub fn new() -> io::Result { - unsafe { - let mut info = mem::uninitialized(); - GetSystemInfo(&mut info); - Ok(Uname { inner: info }) - } - } - - // FIXME: need to implement more architectures (e.g. ARM) - pub fn machine(&self) -> Cow { - let arch = unsafe { - match self.inner.u.s().wProcessorArchitecture { - PROCESSOR_ARCHITECTURE_AMD64 => "x86_64", - PROCESSOR_ARCHITECTURE_INTEL => "x86", - _ => unimplemented!() - } - }; - Cow::from(arch) - } - } -} - -#[cfg(target_os = "redox")] -mod platform { - use ::std::borrow::Cow; - use ::std::io::{self, Read}; - use ::std::fs::File; - - pub struct Uname { - kernel_name: String, - nodename: String, - kernel_release: String, - kernel_version: String, - machine: String - } - - impl Uname { - pub fn new() -> io::Result { - let mut inner = String::new(); - File::open("sys:uname")?.read_to_string(&mut inner)?; - - let mut lines = inner.lines(); - - let kernel_name = lines.next().unwrap(); - let nodename = lines.next().unwrap(); - let kernel_release = lines.next().unwrap(); - let kernel_version = lines.next().unwrap(); - let machine = lines.next().unwrap(); - - // FIXME: don't actually duplicate the data as doing so is wasteful - Ok(Uname { - kernel_name: kernel_name.to_owned(), - nodename: nodename.to_owned(), - kernel_release: kernel_release.to_owned(), - kernel_version: kernel_version.to_owned(), - machine: machine.to_owned() - }) - } - - pub fn sysname(&self) -> Cow { - Cow::from(self.kernel_name.as_str()) - } - - pub fn nodename(&self) -> Cow { - Cow::from(self.nodename.as_str()) - } - - pub fn release(&self) -> Cow { - Cow::from(self.kernel_release.as_str()) - } - - pub fn version(&self) -> Cow { - Cow::from(self.kernel_version.as_str()) - } - - pub fn machine(&self) -> Cow { - Cow::from(self.machine.as_str()) - } - } -} \ No newline at end of file From f74a1b63336cd0585537f1ef09620a47702c5427 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Mon, 12 Mar 2018 01:20:58 -0700 Subject: [PATCH 121/606] Format everything using rustfmt --- src/uucore/coreopts.rs | 86 +++++++--- src/uucore/encoding.rs | 10 +- src/uucore/entries.rs | 29 ++-- src/uucore/fs.rs | 24 +-- src/uucore/mode.rs | 45 +++--- src/uucore/panic.rs | 2 +- src/uucore/parse_time.rs | 6 +- src/uucore/process.rs | 23 ++- src/uucore/signals.rs | 327 ++++++++++++++++++++++++++++++--------- src/uucore/utf8.rs | 1 - src/uucore/utmpx.rs | 30 ++-- src/uucore/wide.rs | 11 +- 12 files changed, 418 insertions(+), 176 deletions(-) diff --git a/src/uucore/coreopts.rs b/src/uucore/coreopts.rs index 76895b612..58518540f 100644 --- a/src/uucore/coreopts.rs +++ b/src/uucore/coreopts.rs @@ -1,56 +1,84 @@ extern crate getopts; pub struct HelpText<'a> { - pub name : &'a str, - pub version : &'a str, - pub syntax : &'a str, - pub summary : &'a str, - pub long_help : &'a str, - pub display_usage : bool + pub name: &'a str, + pub version: &'a str, + pub syntax: &'a str, + pub summary: &'a str, + pub long_help: &'a str, + pub display_usage: bool, } pub struct CoreOptions<'a> { - options : getopts::Options, - help_text : HelpText<'a> + options: getopts::Options, + help_text: HelpText<'a>, } impl<'a> CoreOptions<'a> { pub fn new(help_text: HelpText<'a>) -> Self { let mut ret = CoreOptions { - options : getopts::Options::new(), - help_text : help_text + options: getopts::Options::new(), + help_text: help_text, }; ret.options .optflag("", "help", "print usage information") .optflag("", "version", "print name and version number"); ret } - pub fn optflagopt(&mut self, short_name: &str, long_name: &str, desc: &str, hint: &str) -> &mut CoreOptions<'a> { + pub fn optflagopt( + &mut self, + short_name: &str, + long_name: &str, + desc: &str, + hint: &str, + ) -> &mut CoreOptions<'a> { self.options.optflagopt(short_name, long_name, desc, hint); self } - pub fn optflag(&mut self, short_name: &str, long_name: &str, desc: &str) -> &mut CoreOptions<'a> { + pub fn optflag( + &mut self, + short_name: &str, + long_name: &str, + desc: &str, + ) -> &mut CoreOptions<'a> { self.options.optflag(short_name, long_name, desc); self } - pub fn optflagmulti(&mut self, short_name: &str, long_name: &str, desc: &str) -> &mut CoreOptions<'a> { + pub fn optflagmulti( + &mut self, + short_name: &str, + long_name: &str, + desc: &str, + ) -> &mut CoreOptions<'a> { self.options.optflagmulti(short_name, long_name, desc); self } - pub fn optopt(&mut self, short_name: &str, long_name: &str, desc: &str, hint: &str) -> &mut CoreOptions<'a> { + pub fn optopt( + &mut self, + short_name: &str, + long_name: &str, + desc: &str, + hint: &str, + ) -> &mut CoreOptions<'a> { self.options.optopt(short_name, long_name, desc, hint); self } - pub fn optmulti(&mut self, short_name: &str, long_name: &str, desc: &str, hint: &str) -> &mut CoreOptions<'a> { + pub fn optmulti( + &mut self, + short_name: &str, + long_name: &str, + desc: &str, + hint: &str, + ) -> &mut CoreOptions<'a> { self.options.optmulti(short_name, long_name, desc, hint); self } - pub fn usage(&self, summary : &str) -> String { + pub fn usage(&self, summary: &str) -> String { self.options.usage(summary) } - pub fn parse(&mut self, args : Vec) -> getopts::Matches { + pub fn parse(&mut self, args: Vec) -> getopts::Matches { let matches = match self.options.parse(&args[1..]) { - Ok(m) => { Some(m) }, + Ok(m) => Some(m), Err(f) => { eprint!("{}: error: ", self.help_text.name); eprintln!("{}", f); @@ -59,16 +87,26 @@ impl<'a> CoreOptions<'a> { }.unwrap(); if matches.opt_present("help") { let usage_str = if self.help_text.display_usage { - format!("\n {}\n\n Reference\n", - self.options.usage(self.help_text.summary) - ).replace("Options:", " Options:") - } else { String::new() }; - print!(" + format!( + "\n {}\n\n Reference\n", + self.options.usage(self.help_text.summary) + ).replace("Options:", " Options:") + } else { + String::new() + }; + print!( + " {0} {1} {0} {2} {3}{4} -", self.help_text.name, self.help_text.version, self.help_text.syntax, usage_str, self.help_text.long_help); +", + self.help_text.name, + self.help_text.version, + self.help_text.syntax, + usage_str, + self.help_text.long_help + ); exit!(0); } else if matches.opt_present("version") { println!("{} {}", self.help_text.name, self.help_text.version); diff --git a/src/uucore/encoding.rs b/src/uucore/encoding.rs index 4e2273c25..f2ff75dd2 100644 --- a/src/uucore/encoding.rs +++ b/src/uucore/encoding.rs @@ -7,7 +7,7 @@ // extern crate data_encoding; -use self::data_encoding::{base64, base32, decode}; +use self::data_encoding::{decode, base32, base64}; use std::io::Read; pub type DecodeResult = Result, decode::Error>; @@ -70,12 +70,12 @@ impl Data { self.input.read_to_string(&mut buf).unwrap(); let clean = if self.ignore_garbage { buf.chars() - .filter(|&c| self.alphabet.contains(c)) - .collect::() + .filter(|&c| self.alphabet.contains(c)) + .collect::() } else { buf.chars() - .filter(|&c| c != '\r' && c != '\n') - .collect::() + .filter(|&c| c != '\r' && c != '\n') + .collect::() }; decode(self.format, clean.as_bytes()) } diff --git a/src/uucore/entries.rs b/src/uucore/entries.rs index 5dae92dd3..3120d54e2 100644 --- a/src/uucore/entries.rs +++ b/src/uucore/entries.rs @@ -27,24 +27,29 @@ #[cfg(any(target_os = "freebsd", target_os = "macos"))] use libc::time_t; -use libc::{uid_t, gid_t, c_char, c_int}; -use libc::{passwd, group, getpwnam, getpwuid, getgrnam, getgrgid, getgroups}; +use libc::{c_char, c_int, gid_t, uid_t}; +use libc::{getgrgid, getgrnam, getgroups, getpwnam, getpwuid, group, passwd}; -use ::std::ptr; -use ::std::io::ErrorKind; -use ::std::io::Error as IOError; -use ::std::io::Result as IOResult; -use ::std::ffi::{CStr, CString}; -use ::std::borrow::Cow; +use std::ptr; +use std::io::ErrorKind; +use std::io::Error as IOError; +use std::io::Result as IOResult; +use std::ffi::{CStr, CString}; +use std::borrow::Cow; extern "C" { - fn getgrouplist(name: *const c_char, gid: gid_t, groups: *mut gid_t, ngroups: *mut c_int) -> c_int; + fn getgrouplist( + name: *const c_char, + gid: gid_t, + groups: *mut gid_t, + ngroups: *mut c_int, + ) -> c_int; } pub fn get_groups() -> IOResult> { let ngroups = unsafe { getgroups(0, ptr::null_mut()) }; if ngroups == -1 { - return Err(IOError::last_os_error()) + return Err(IOError::last_os_error()); } let mut groups = Vec::with_capacity(ngroups as usize); let ngroups = unsafe { getgroups(ngroups, groups.as_mut_ptr()) }; @@ -173,7 +178,9 @@ impl Group { /// Fetch desired entry. pub trait Locate { - fn locate(key: K) -> IOResult where Self: ::std::marker::Sized; + fn locate(key: K) -> IOResult + where + Self: ::std::marker::Sized; } macro_rules! f { diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index 6cc0d58da..1fbf46de0 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -31,9 +31,9 @@ pub fn resolve_relative_path<'a>(path: &'a Path) -> Cow<'a, Path> { result.pop(); } Component::CurDir => (), - Component::RootDir | - Component::Normal(_) | - Component::Prefix(_) => result.push(comp.as_os_str()), + Component::RootDir | Component::Normal(_) | Component::Prefix(_) => { + result.push(comp.as_os_str()) + } } } result.into() @@ -53,7 +53,10 @@ fn resolve>(original: P) -> IOResult { let mut result = original.as_ref().to_path_buf(); loop { if followed == MAX_LINKS_FOLLOWED { - return Err(Error::new(ErrorKind::InvalidInput, "maximum links followed")); + return Err(Error::new( + ErrorKind::InvalidInput, + "maximum links followed", + )); } match fs::symlink_metadata(&result) { @@ -93,8 +96,7 @@ pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> // vector for canonicalization. for part in original.components() { match part { - Component::Prefix(_) | - Component::RootDir => { + Component::Prefix(_) | Component::RootDir => { result.push(part.as_os_str()); } Component::CurDir => (), @@ -117,12 +119,10 @@ pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> } match resolve(&result) { - Err(e) => { - match can_mode { - CanonicalizeMode::Missing => continue, - _ => return Err(e), - } - } + Err(e) => match can_mode { + CanonicalizeMode::Missing => continue, + _ => return Err(e), + }, Ok(path) => { result.pop(); result.push(path); diff --git a/src/uucore/mode.rs b/src/uucore/mode.rs index f8d2123d2..7a08652db 100644 --- a/src/uucore/mode.rs +++ b/src/uucore/mode.rs @@ -15,20 +15,22 @@ pub fn parse_numeric(fperm: u32, mut mode: &str) -> Result { Err(format!("mode is too large ({} > 7777)", mode)) } else { match u32::from_str_radix(mode, 8) { - Ok(change) => { - Ok(match op { - '+' => fperm | change, - '-' => fperm & !change, - '=' => change, - _ => unreachable!() - }) - } - Err(err) => Err(err.description().to_owned()) + Ok(change) => Ok(match op { + '+' => fperm | change, + '-' => fperm & !change, + '=' => change, + _ => unreachable!(), + }), + Err(err) => Err(err.description().to_owned()), } } } -pub fn parse_symbolic(mut fperm: u32, mut mode: &str, considering_dir: bool) -> Result { +pub fn parse_symbolic( + mut fperm: u32, + mut mode: &str, + considering_dir: bool, +) -> Result { #[cfg(unix)] use libc::umask; @@ -43,9 +45,7 @@ pub fn parse_symbolic(mut fperm: u32, mut mode: &str, considering_dir: bool) -> return Err(format!("invalid mode ({})", mode)); } let respect_umask = pos == 0; - let last_umask = unsafe { - umask(0) - }; + let last_umask = unsafe { umask(0) }; mode = &mode[pos..]; while mode.len() > 0 { let (op, pos) = parse_op(mode, None)?; @@ -59,7 +59,7 @@ pub fn parse_symbolic(mut fperm: u32, mut mode: &str, considering_dir: bool) -> '+' => fperm |= srwx & mask, '-' => fperm &= !(srwx & mask), '=' => fperm = (fperm & !mask) | (srwx & mask), - _ => unreachable!() + _ => unreachable!(), } } unsafe { @@ -77,12 +77,12 @@ fn parse_levels(mode: &str) -> (u32, usize) { 'g' => 0o7070, 'o' => 0o7007, 'a' => 0o7777, - _ => break + _ => break, }; pos += 1; } if pos == 0 { - mask = 0o7777; // default to 'a' + mask = 0o7777; // default to 'a' } (mask, pos) } @@ -93,10 +93,13 @@ fn parse_op(mode: &str, default: Option) -> Result<(char, usize), String> '+' | '-' | '=' => Ok((ch, 1)), _ => match default { Some(ch) => Ok((ch, 0)), - None => Err(format!("invalid operator (expected +, -, or =, but found {})", ch)) - } + None => Err(format!( + "invalid operator (expected +, -, or =, but found {})", + ch + )), + }, }, - None => Err("unexpected end of mode".to_owned()) + None => Err("unexpected end of mode".to_owned()), } } @@ -118,7 +121,7 @@ fn parse_change(mode: &str, fperm: u32, considering_dir: bool) -> (u32, usize) { 'u' => srwx = (fperm & 0o700) | ((fperm >> 3) & 0o070) | ((fperm >> 6) & 0o007), 'g' => srwx = ((fperm << 3) & 0o700) | (fperm & 0o070) | ((fperm >> 3) & 0o007), 'o' => srwx = ((fperm << 6) & 0o700) | ((fperm << 3) & 0o070) | (fperm & 0o007), - _ => break + _ => break, }; pos += 1; } @@ -126,4 +129,4 @@ fn parse_change(mode: &str, fperm: u32, considering_dir: bool) -> (u32, usize) { srwx = 0; } (srwx, pos) -} \ No newline at end of file +} diff --git a/src/uucore/panic.rs b/src/uucore/panic.rs index 765e035ab..5cccca4ba 100644 --- a/src/uucore/panic.rs +++ b/src/uucore/panic.rs @@ -1,6 +1,6 @@ use std::panic; -pub fn install_sigpipe_hook() { +pub fn install_sigpipe_hook() { let hook = panic::take_hook(); panic::set_hook(Box::new(move |info| { if let Some(res) = info.payload().downcast_ref::() { diff --git a/src/uucore/parse_time.rs b/src/uucore/parse_time.rs index 05b9f17b1..260455f7d 100644 --- a/src/uucore/parse_time.rs +++ b/src/uucore/parse_time.rs @@ -12,7 +12,7 @@ use std::time::Duration; pub fn from_str(string: &str) -> Result { let len = string.len(); if len == 0 { - return Err("empty string".to_owned()) + return Err("empty string".to_owned()); } let slice = &string[..len - 1]; let (numstr, times) = match string.chars().next_back().unwrap() { @@ -26,13 +26,13 @@ pub fn from_str(string: &str) -> Result { } else if string == "inf" || string == "infinity" { ("inf", 1) } else { - return Err(format!("invalid time interval '{}'", string)) + return Err(format!("invalid time interval '{}'", string)); } } }; let num = match numstr.parse::() { Ok(m) => m, - Err(e) => return Err(format!("invalid time interval '{}': {}", string, e)) + Err(e) => return Err(format!("invalid time interval '{}': {}", string, e)), }; const NANOS_PER_SEC: u32 = 1_000_000_000; diff --git a/src/uucore/process.rs b/src/uucore/process.rs index f6aec5166..11888ae66 100644 --- a/src/uucore/process.rs +++ b/src/uucore/process.rs @@ -8,7 +8,7 @@ // use super::libc; -use libc::{c_int, pid_t, uid_t, gid_t}; +use libc::{c_int, gid_t, pid_t, uid_t}; use std::fmt; use std::io; use std::process::Child; @@ -17,27 +17,19 @@ use std::thread; use std::time::{Duration, Instant}; pub fn geteuid() -> uid_t { - unsafe { - libc::geteuid() - } + unsafe { libc::geteuid() } } pub fn getegid() -> gid_t { - unsafe { - libc::getegid() - } + unsafe { libc::getegid() } } pub fn getgid() -> gid_t { - unsafe { - libc::getgid() - } + unsafe { libc::getgid() } } pub fn getuid() -> uid_t { - unsafe { - libc::getuid() - } + unsafe { libc::getuid() } } // This is basically sys::unix::process::ExitStatus @@ -109,7 +101,10 @@ impl ChildExt for Child { fn wait_or_timeout(&mut self, timeout: Duration) -> io::Result> { // The result will be written to that Option, protected by a Mutex // Then the Condvar will be signaled - let state = Arc::new((Mutex::new(Option::None::>), Condvar::new())); + let state = Arc::new(( + Mutex::new(Option::None::>), + Condvar::new(), + )); // Start the waiting thread let state_th = state.clone(); diff --git a/src/uucore/signals.rs b/src/uucore/signals.rs index db360975a..8887ddfe1 100644 --- a/src/uucore/signals.rs +++ b/src/uucore/signals.rs @@ -7,10 +7,12 @@ * that was distributed with this source code. */ -pub static DEFAULT_SIGNAL:usize= 15; +pub static DEFAULT_SIGNAL: usize = 15; - -pub struct Signal<'a> { pub name:&'a str, pub value: usize} +pub struct Signal<'a> { + pub name: &'a str, + pub value: usize, +} /* @@ -26,41 +28,133 @@ Linux Programmer's Manual */ #[cfg(target_os = "linux")] -pub static ALL_SIGNALS:[Signal<'static>; 31] = [ - Signal{ name: "HUP", value:1 }, - Signal{ name: "INT", value:2 }, - Signal{ name: "QUIT", value:3 }, - Signal{ name: "ILL", value:4 }, - Signal{ name: "TRAP", value:5 }, - Signal{ name: "ABRT", value:6 }, - Signal{ name: "BUS", value:7 }, - Signal{ name: "FPE", value:8 }, - Signal{ name: "KILL", value:9 }, - Signal{ name: "USR1", value:10 }, - Signal{ name: "SEGV", value:11 }, - Signal{ name: "USR2", value:12 }, - Signal{ name: "PIPE", value:13 }, - Signal{ name: "ALRM", value:14 }, - Signal{ name: "TERM", value:15 }, - Signal{ name: "STKFLT", value:16 }, - Signal{ name: "CHLD", value:17 }, - Signal{ name: "CONT", value:18 }, - Signal{ name: "STOP", value:19 }, - Signal{ name: "TSTP", value:20 }, - Signal{ name: "TTIN", value:21 }, - Signal{ name: "TTOU", value:22 }, - Signal{ name: "URG", value:23 }, - Signal{ name: "XCPU", value:24 }, - Signal{ name: "XFSZ", value:25 }, - Signal{ name: "VTALRM", value:26 }, - Signal{ name: "PROF", value:27 }, - Signal{ name: "WINCH", value:28 }, - Signal{ name: "POLL", value:29 }, - Signal{ name: "PWR", value:30 }, - Signal{ name: "SYS", value:31 }, +pub static ALL_SIGNALS: [Signal<'static>; 31] = [ + Signal { + name: "HUP", + value: 1, + }, + Signal { + name: "INT", + value: 2, + }, + Signal { + name: "QUIT", + value: 3, + }, + Signal { + name: "ILL", + value: 4, + }, + Signal { + name: "TRAP", + value: 5, + }, + Signal { + name: "ABRT", + value: 6, + }, + Signal { + name: "BUS", + value: 7, + }, + Signal { + name: "FPE", + value: 8, + }, + Signal { + name: "KILL", + value: 9, + }, + Signal { + name: "USR1", + value: 10, + }, + Signal { + name: "SEGV", + value: 11, + }, + Signal { + name: "USR2", + value: 12, + }, + Signal { + name: "PIPE", + value: 13, + }, + Signal { + name: "ALRM", + value: 14, + }, + Signal { + name: "TERM", + value: 15, + }, + Signal { + name: "STKFLT", + value: 16, + }, + Signal { + name: "CHLD", + value: 17, + }, + Signal { + name: "CONT", + value: 18, + }, + Signal { + name: "STOP", + value: 19, + }, + Signal { + name: "TSTP", + value: 20, + }, + Signal { + name: "TTIN", + value: 21, + }, + Signal { + name: "TTOU", + value: 22, + }, + Signal { + name: "URG", + value: 23, + }, + Signal { + name: "XCPU", + value: 24, + }, + Signal { + name: "XFSZ", + value: 25, + }, + Signal { + name: "VTALRM", + value: 26, + }, + Signal { + name: "PROF", + value: 27, + }, + Signal { + name: "WINCH", + value: 28, + }, + Signal { + name: "POLL", + value: 29, + }, + Signal { + name: "PWR", + value: 30, + }, + Signal { + name: "SYS", + value: 31, + }, ]; - /* @@ -103,38 +197,131 @@ No Name Default Action Description */ #[cfg(any(target_os = "macos", target_os = "freebsd"))] -pub static ALL_SIGNALS:[Signal<'static>; 31] = [ - Signal{ name: "HUP", value:1 }, - Signal{ name: "INT", value:2 }, - Signal{ name: "QUIT", value:3 }, - Signal{ name: "ILL", value:4 }, - Signal{ name: "TRAP", value:5 }, - Signal{ name: "ABRT", value:6 }, - Signal{ name: "EMT", value:7 }, - Signal{ name: "FPE", value:8 }, - Signal{ name: "KILL", value:9 }, - Signal{ name: "BUS", value:10 }, - Signal{ name: "SEGV", value:11 }, - Signal{ name: "SYS", value:12 }, - Signal{ name: "PIPE", value:13 }, - Signal{ name: "ALRM", value:14 }, - Signal{ name: "TERM", value:15 }, - Signal{ name: "URG", value:16 }, - Signal{ name: "STOP", value:17 }, - Signal{ name: "TSTP", value:18 }, - Signal{ name: "CONT", value:19 }, - Signal{ name: "CHLD", value:20 }, - Signal{ name: "TTIN", value:21 }, - Signal{ name: "TTOU", value:22 }, - Signal{ name: "IO", value:23 }, - Signal{ name: "XCPU", value:24 }, - Signal{ name: "XFSZ", value:25 }, - Signal{ name: "VTALRM", value:26 }, - Signal{ name: "PROF", value:27 }, - Signal{ name: "WINCH", value:28 }, - Signal{ name: "INFO", value:29 }, - Signal{ name: "USR1", value:30 }, - Signal{ name: "USR2", value:31 }, +pub static ALL_SIGNALS: [Signal<'static>; 31] = [ + Signal { + name: "HUP", + value: 1, + }, + Signal { + name: "INT", + value: 2, + }, + Signal { + name: "QUIT", + value: 3, + }, + Signal { + name: "ILL", + value: 4, + }, + Signal { + name: "TRAP", + value: 5, + }, + Signal { + name: "ABRT", + value: 6, + }, + Signal { + name: "EMT", + value: 7, + }, + Signal { + name: "FPE", + value: 8, + }, + Signal { + name: "KILL", + value: 9, + }, + Signal { + name: "BUS", + value: 10, + }, + Signal { + name: "SEGV", + value: 11, + }, + Signal { + name: "SYS", + value: 12, + }, + Signal { + name: "PIPE", + value: 13, + }, + Signal { + name: "ALRM", + value: 14, + }, + Signal { + name: "TERM", + value: 15, + }, + Signal { + name: "URG", + value: 16, + }, + Signal { + name: "STOP", + value: 17, + }, + Signal { + name: "TSTP", + value: 18, + }, + Signal { + name: "CONT", + value: 19, + }, + Signal { + name: "CHLD", + value: 20, + }, + Signal { + name: "TTIN", + value: 21, + }, + Signal { + name: "TTOU", + value: 22, + }, + Signal { + name: "IO", + value: 23, + }, + Signal { + name: "XCPU", + value: 24, + }, + Signal { + name: "XFSZ", + value: 25, + }, + Signal { + name: "VTALRM", + value: 26, + }, + Signal { + name: "PROF", + value: 27, + }, + Signal { + name: "WINCH", + value: 28, + }, + Signal { + name: "INFO", + value: 29, + }, + Signal { + name: "USR1", + value: 30, + }, + Signal { + name: "USR2", + value: 31, + }, ]; pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { @@ -143,7 +330,9 @@ pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { } for signal in &ALL_SIGNALS { let long_name = format!("SIG{}", signal.name); - if signal.name == signal_name_or_value || (signal_name_or_value == signal.value.to_string()) || (long_name == signal_name_or_value) { + if signal.name == signal_name_or_value || (signal_name_or_value == signal.value.to_string()) + || (long_name == signal_name_or_value) + { return Some(signal.value); } } diff --git a/src/uucore/utf8.rs b/src/uucore/utf8.rs index a6c48b785..f2d2137a2 100644 --- a/src/uucore/utf8.rs +++ b/src/uucore/utf8.rs @@ -25,4 +25,3 @@ static UTF8_CHAR_WIDTH: [u8; 256] = [ pub fn utf8_char_width(b: u8) -> usize { return UTF8_CHAR_WIDTH[b as usize] as usize; } - diff --git a/src/uucore/utmpx.rs b/src/uucore/utmpx.rs index ddf976ab9..db0605a4e 100644 --- a/src/uucore/utmpx.rs +++ b/src/uucore/utmpx.rs @@ -33,12 +33,12 @@ use super::libc; pub extern crate time; -use self::time::{Tm, Timespec}; +use self::time::{Timespec, Tm}; -use ::std::io::Result as IOResult; -use ::std::io::Error as IOError; -use ::std::ptr; -use ::std::ffi::CString; +use std::io::Result as IOResult; +use std::io::Error as IOError; +use std::ptr; +use std::ffi::CString; pub use self::ut::*; use libc::utmpx; @@ -159,8 +159,10 @@ impl Utmpx { } /// A.K.A. ut.ut_tv pub fn login_time(&self) -> Tm { - time::at(Timespec::new(self.inner.ut_tv.tv_sec as i64, - self.inner.ut_tv.tv_usec as i32)) + time::at(Timespec::new( + self.inner.ut_tv.tv_sec as i64, + self.inner.ut_tv.tv_usec as i32, + )) } /// A.K.A. ut.ut_exit /// @@ -202,10 +204,12 @@ impl Utmpx { let c_host = CString::new(host).unwrap(); let mut res = ptr::null_mut(); let status = unsafe { - libc::getaddrinfo(c_host.as_ptr(), - ptr::null(), - &hints as *const _, - &mut res as *mut _) + libc::getaddrinfo( + c_host.as_ptr(), + ptr::null(), + &hints as *const _, + &mut res as *mut _, + ) }; if status == 0 { let info: libc::addrinfo = unsafe { ptr::read(res as *const _) }; @@ -255,7 +259,9 @@ impl Iterator for UtmpxIter { unsafe { let res = getutxent(); if !res.is_null() { - Some(Utmpx { inner: ptr::read(res as *const _) }) + Some(Utmpx { + inner: ptr::read(res as *const _), + }) } else { endutxent(); None diff --git a/src/uucore/wide.rs b/src/uucore/wide.rs index 189e84438..23088183b 100644 --- a/src/uucore/wide.rs +++ b/src/uucore/wide.rs @@ -12,7 +12,10 @@ pub trait ToWide { fn to_wide(&self) -> Vec; fn to_wide_null(&self) -> Vec; } -impl ToWide for T where T: AsRef { +impl ToWide for T +where + T: AsRef, +{ fn to_wide(&self) -> Vec { self.as_ref().encode_wide().collect() } @@ -30,6 +33,8 @@ impl FromWide for String { } fn from_wide_null(wide: &[u16]) -> String { let len = wide.iter().take_while(|&&c| c != 0).count(); - OsString::from_wide(&wide[..len]).to_string_lossy().into_owned() + OsString::from_wide(&wide[..len]) + .to_string_lossy() + .into_owned() } -} \ No newline at end of file +} From 07de3eda6eee2e563c470692018cb97ce82c3e35 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Mon, 12 Mar 2018 20:21:38 -0700 Subject: [PATCH 122/606] uucore: make features opt-in rather than opt-out --- src/uucore/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index e1e56fed3..d18f834b3 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -20,7 +20,7 @@ process = ["libc"] signals = [] entries = ["libc"] wide = [] -default = ["fs", "libc", "utf8", "encoding", "parse_time", "mode", "utmpx", "process", "entries", "signals", "wide"] +default = [] [lib] path = "lib.rs" From eedf7cb28a61f8af4d8f4db0a9148456c8ae6062 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Wed, 14 Mar 2018 10:21:12 -0700 Subject: [PATCH 123/606] Make the 'cat' utility build on Redox --- src/uucore/Cargo.toml | 3 +++ src/uucore/fs.rs | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index d18f834b3..37f16289c 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -9,6 +9,9 @@ time = { version = "0.1.38", optional = true } data-encoding = { version = "^1.1", optional = true } libc = { version = "0.2.34", optional = true } +[target.'cfg(target_os = "redox")'.dependencies] +termion = "1.5" + [features] fs = ["libc"] utf8 = [] diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index 1fbf46de0..cecaf529f 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -5,12 +5,16 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// + +#[cfg(target_os = "redox")] +extern crate termion; #[cfg(unix)] use super::libc; use std::env; use std::fs; +#[cfg(target_os = "redox")] +use std::io; use std::io::{Error, ErrorKind}; use std::io::Result as IOResult; use std::path::{Component, Path, PathBuf}; @@ -157,6 +161,11 @@ pub fn is_stdin_interactive() -> bool { false } +#[cfg(target_os = "redox")] +pub fn is_stdin_interactive() -> bool { + termion::is_tty(&io::stdin()) +} + #[cfg(unix)] pub fn is_stdout_interactive() -> bool { unsafe { libc::isatty(libc::STDOUT_FILENO) == 1 } @@ -167,6 +176,11 @@ pub fn is_stdout_interactive() -> bool { false } +#[cfg(target_os = "redox")] +pub fn is_stdout_interactive() -> bool { + termion::is_tty(&io::stdout()) +} + #[cfg(unix)] pub fn is_stderr_interactive() -> bool { unsafe { libc::isatty(libc::STDERR_FILENO) == 1 } @@ -176,3 +190,8 @@ pub fn is_stderr_interactive() -> bool { pub fn is_stderr_interactive() -> bool { false } + +#[cfg(target_os = "redox")] +pub fn is_stderr_interactive() -> bool { + termion::is_tty(&io::stderr()) +} From 2ad767586b18299567bc21f2f4afa9954112a23b Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 2 May 2018 23:23:05 +0200 Subject: [PATCH 124/606] chmod: show human-friendly permissions when --changes or --verbose is used. Like GNU chmod. --- src/uucore/fs.rs | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index cecaf529f..78ccfbef3 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -11,8 +11,13 @@ extern crate termion; #[cfg(unix)] use super::libc; +#[cfg(unix)] +use super::libc::{mode_t, S_IRGRP, S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, + S_IWUSR, S_IXGRP, S_IXOTH, S_IXUSR}; use std::env; use std::fs; +#[cfg(any(unix, target_os = "redox"))] +use std::os::unix::fs::MetadataExt; #[cfg(target_os = "redox")] use std::io; use std::io::{Error, ErrorKind}; @@ -20,6 +25,12 @@ use std::io::Result as IOResult; use std::path::{Component, Path, PathBuf}; use std::borrow::Cow; +macro_rules! has { + ($mode:expr, $perm:expr) => ( + $mode & ($perm as u32) != 0 + ) +} + pub fn resolve_relative_path<'a>(path: &'a Path) -> Cow<'a, Path> { if path.components().all(|e| e != Component::ParentDir) { return path.into(); @@ -195,3 +206,63 @@ pub fn is_stderr_interactive() -> bool { pub fn is_stderr_interactive() -> bool { termion::is_tty(&io::stderr()) } + +#[cfg(not(unix))] +#[allow(unused_variables)] +pub fn display_permissions(metadata: &fs::Metadata) -> String { + String::from("---------") +} + +#[cfg(unix)] +pub fn display_permissions(metadata: &fs::Metadata) -> String { + let mode: mode_t = metadata.mode() as mode_t; + display_permissions_unix(mode as u32) +} + +#[cfg(unix)] +pub fn display_permissions_unix(mode: u32) -> String { + let mut result = String::with_capacity(9); + result.push(if has!(mode, S_IRUSR) { 'r' } else { '-' }); + result.push(if has!(mode, S_IWUSR) { 'w' } else { '-' }); + result.push(if has!(mode, S_ISUID) { + if has!(mode, S_IXUSR) { + 's' + } else { + 'S' + } + } else if has!(mode, S_IXUSR) { + 'x' + } else { + '-' + }); + + result.push(if has!(mode, S_IRGRP) { 'r' } else { '-' }); + result.push(if has!(mode, S_IWGRP) { 'w' } else { '-' }); + result.push(if has!(mode, S_ISGID) { + if has!(mode, S_IXGRP) { + 's' + } else { + 'S' + } + } else if has!(mode, S_IXGRP) { + 'x' + } else { + '-' + }); + + result.push(if has!(mode, S_IROTH) { 'r' } else { '-' }); + result.push(if has!(mode, S_IWOTH) { 'w' } else { '-' }); + result.push(if has!(mode, S_ISVTX) { + if has!(mode, S_IXOTH) { + 't' + } else { + 'T' + } + } else if has!(mode, S_IXOTH) { + 'x' + } else { + '-' + }); + + result +} From 40738bfb0a48ded6a5bd1b68b8c2bb689b7d18f0 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Tue, 22 May 2018 09:55:05 -0700 Subject: [PATCH 125/606] uucore: update data_encoding and add wrap_write() --- src/uucore/Cargo.toml | 6 ++-- src/uucore/encoding.rs | 78 ++++++++++++++++++++++++++++-------------- src/uucore/lib.rs | 5 +++ 3 files changed, 61 insertions(+), 28 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 37f16289c..98b8282dd 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -5,8 +5,10 @@ authors = [] [dependencies] getopts = "0.2.14" +failure = { version = "0.1.1", optional = true } +failure_derive = { version = "0.1.1", optional = true } time = { version = "0.1.38", optional = true } -data-encoding = { version = "^1.1", optional = true } +data-encoding = { version = "^2.1", optional = true } libc = { version = "0.2.34", optional = true } [target.'cfg(target_os = "redox")'.dependencies] @@ -15,7 +17,7 @@ termion = "1.5" [features] fs = ["libc"] utf8 = [] -encoding = ["data-encoding"] +encoding = ["data-encoding", "failure", "failure_derive"] parse_time = [] mode = ["libc"] utmpx = ["time", "libc"] diff --git a/src/uucore/encoding.rs b/src/uucore/encoding.rs index f2ff75dd2..0bc8d5be8 100644 --- a/src/uucore/encoding.rs +++ b/src/uucore/encoding.rs @@ -7,10 +7,30 @@ // extern crate data_encoding; -use self::data_encoding::{decode, base32, base64}; -use std::io::Read; +use self::data_encoding::{DecodeError, BASE32, BASE64}; +use std::io::{self, Read, Write}; -pub type DecodeResult = Result, decode::Error>; +#[derive(Fail, Debug)] +pub enum EncodingError { + #[fail(display = "{}", _0)] + Decode(#[cause] DecodeError), + #[fail(display = "{}", _0)] + Io(#[cause] io::Error), +} + +impl From for EncodingError { + fn from(err: io::Error) -> EncodingError { + EncodingError::Io(err) + } +} + +impl From for EncodingError { + fn from(err: DecodeError) -> EncodingError { + EncodingError::Decode(err) + } +} + +pub type DecodeResult = Result, EncodingError>; #[derive(Clone, Copy)] pub enum Format { @@ -21,16 +41,16 @@ use self::Format::*; pub fn encode(f: Format, input: &[u8]) -> String { match f { - Base32 => base32::encode(input), - Base64 => base64::encode(input), + Base32 => BASE32.encode(input), + Base64 => BASE64.encode(input), } } pub fn decode(f: Format, input: &[u8]) -> DecodeResult { - match f { - Base32 => base32::decode(input), - Base64 => base64::decode(input), - } + Ok(match f { + Base32 => BASE32.decode(input)?, + Base64 => BASE64.decode(input)?, + }) } pub struct Data { @@ -38,7 +58,7 @@ pub struct Data { ignore_garbage: bool, input: R, format: Format, - alphabet: &'static str, + alphabet: &'static [u8], } impl Data { @@ -49,8 +69,8 @@ impl Data { input: input, format: format, alphabet: match format { - Base32 => "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", - Base64 => "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=+/", + Base32 => b"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", + Base64 => b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=+/", }, } } @@ -66,18 +86,14 @@ impl Data { } pub fn decode(&mut self) -> DecodeResult { - let mut buf = String::new(); - self.input.read_to_string(&mut buf).unwrap(); - let clean = if self.ignore_garbage { - buf.chars() - .filter(|&c| self.alphabet.contains(c)) - .collect::() + let mut buf = vec![]; + self.input.read_to_end(&mut buf)?; + if self.ignore_garbage { + buf.retain(|c| self.alphabet.contains(c)); } else { - buf.chars() - .filter(|&c| c != '\r' && c != '\n') - .collect::() + buf.retain(|&c| c != b'\r' && c != b'\n'); }; - decode(self.format, clean.as_bytes()) + decode(self.format, &buf) } pub fn encode(&mut self) -> String { @@ -87,15 +103,25 @@ impl Data { } } +// NOTE: this will likely be phased out at some point pub fn wrap_print(line_wrap: usize, res: String) { - if line_wrap == 0 { - return print!("{}", res); - } + let stdout = io::stdout(); + wrap_write(stdout.lock(), line_wrap, res).unwrap(); +} + +pub fn wrap_write(mut writer: W, line_wrap: usize, res: String) -> io::Result<()> { use std::cmp::min; + + if line_wrap == 0 { + return write!(writer, "{}", res); + } + let mut start = 0; while start < res.len() { let end = min(start + line_wrap, res.len()); - println!("{}", &res[start..end]); + writeln!(writer, "{}", &res[start..end])?; start = end; } + + Ok(()) } diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index dbbc1b825..bfa111564 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -2,6 +2,11 @@ pub extern crate libc; #[cfg(feature = "winapi")] pub extern crate winapi; +#[cfg(feature = "failure")] +extern crate failure; +#[cfg(feature = "failure_derive")] +#[macro_use] +extern crate failure_derive; #[macro_use] mod macros; From a31b1047c171b16627cd9a371f9de17d8a55f7bf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 11 Jun 2018 17:13:54 +0000 Subject: [PATCH 126/606] 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] --- src/uucore/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 98b8282dd..946d78bf1 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -9,7 +9,7 @@ failure = { version = "0.1.1", optional = true } failure_derive = { version = "0.1.1", optional = true } time = { version = "0.1.38", optional = true } data-encoding = { version = "^2.1", optional = true } -libc = { version = "0.2.34", optional = true } +libc = { version = "0.2.42", optional = true } [target.'cfg(target_os = "redox")'.dependencies] termion = "1.5" From b21bd0bea3648014891c68d0202327a04c0feb0a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 14 Jun 2018 07:22:03 +0000 Subject: [PATCH 127/606] 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] --- src/uucore/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 946d78bf1..126dc32f4 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -7,7 +7,7 @@ authors = [] getopts = "0.2.14" failure = { version = "0.1.1", optional = true } failure_derive = { version = "0.1.1", optional = true } -time = { version = "0.1.38", optional = true } +time = { version = "0.1.40", optional = true } data-encoding = { version = "^2.1", optional = true } libc = { version = "0.2.42", optional = true } From 99da2451abc597917af5d64f2a1d8b4390f7ec5b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 6 Jul 2018 07:17:46 +0000 Subject: [PATCH 128/606] 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] --- src/uucore/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 126dc32f4..3a5a09a66 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -4,7 +4,7 @@ version = "0.0.1" authors = [] [dependencies] -getopts = "0.2.14" +getopts = "0.2.18" failure = { version = "0.1.1", optional = true } failure_derive = { version = "0.1.1", optional = true } time = { version = "0.1.40", optional = true } From 03d6e733e4f2b8aa1ea7369b37d311b465b99b24 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 28 Jul 2018 21:19:34 -0500 Subject: [PATCH 129/606] uucore: Add globbing for Windows machines --- src/uucore/Cargo.toml | 1 + src/uucore/lib.rs | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 3a5a09a66..c4fda8c07 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -10,6 +10,7 @@ failure_derive = { version = "0.1.1", optional = true } time = { version = "0.1.40", optional = true } data-encoding = { version = "^2.1", optional = true } libc = { version = "0.2.42", optional = true } +wild = "1.0.1" [target.'cfg(target_os = "redox")'.dependencies] termion = "1.5" diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index bfa111564..8cc7494fe 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -1,3 +1,13 @@ +extern crate wild; + +pub fn args() -> Box> { + Box::new( wild::args().map(|s| s.into_string().unwrap()) ) +} + +pub fn args_os() -> Box> { + Box::new( wild::args() ) +} + #[cfg(feature = "libc")] pub extern crate libc; #[cfg(feature = "winapi")] From 9e8b0027350ee4848e41dbcf18a63262c17f73cd Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 5 Aug 2018 21:54:59 -0500 Subject: [PATCH 130/606] uucore: fix: use forked 'wild' crate with case-sensitivity + API fixes --- src/uucore/Cargo.toml | 2 +- src/uucore/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index c4fda8c07..0f49aa139 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -10,7 +10,7 @@ failure_derive = { version = "0.1.1", optional = true } time = { version = "0.1.40", optional = true } data-encoding = { version = "^2.1", optional = true } libc = { version = "0.2.42", optional = true } -wild = "1.0.1" +wild = { git = "https://gitlab.com/rivy/wild.git" } [target.'cfg(target_os = "redox")'.dependencies] termion = "1.5" diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index 8cc7494fe..f3d24d6ce 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -1,11 +1,11 @@ extern crate wild; pub fn args() -> Box> { - Box::new( wild::args().map(|s| s.into_string().unwrap()) ) + wild::args() } pub fn args_os() -> Box> { - Box::new( wild::args() ) + wild::args_os() } #[cfg(feature = "libc")] From bd450ebb94b1868a117d26a008cef9eb35de1b81 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Mon, 3 Sep 2018 11:30:34 -0500 Subject: [PATCH 131/606] uucore: fix: use updated 'wild' crate for globbing --- src/uucore/Cargo.toml | 2 +- src/uucore/lib.rs | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 0f49aa139..578c9eb3b 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -10,7 +10,7 @@ failure_derive = { version = "0.1.1", optional = true } time = { version = "0.1.40", optional = true } data-encoding = { version = "^2.1", optional = true } libc = { version = "0.2.42", optional = true } -wild = { git = "https://gitlab.com/rivy/wild.git" } +wild = "2.0.1" [target.'cfg(target_os = "redox")'.dependencies] termion = "1.5" diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index f3d24d6ce..cc77e9f0e 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -1,13 +1,9 @@ extern crate wild; -pub fn args() -> Box> { +pub fn args() -> impl Iterator { wild::args() } -pub fn args_os() -> Box> { - wild::args_os() -} - #[cfg(feature = "libc")] pub extern crate libc; #[cfg(feature = "winapi")] From de7a6b5afaf9c79e50005d3a3efd63bba83c5553 Mon Sep 17 00:00:00 2001 From: Vinzent Steinberg Date: Mon, 3 Sep 2018 19:02:51 +0200 Subject: [PATCH 132/606] Fix a few clippy warnings --- src/uucore/coreopts.rs | 2 +- src/uucore/encoding.rs | 4 ++-- src/uucore/fs.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uucore/coreopts.rs b/src/uucore/coreopts.rs index 58518540f..c245cf500 100644 --- a/src/uucore/coreopts.rs +++ b/src/uucore/coreopts.rs @@ -18,7 +18,7 @@ impl<'a> CoreOptions<'a> { pub fn new(help_text: HelpText<'a>) -> Self { let mut ret = CoreOptions { options: getopts::Options::new(), - help_text: help_text, + help_text, }; ret.options .optflag("", "help", "print usage information") diff --git a/src/uucore/encoding.rs b/src/uucore/encoding.rs index 0bc8d5be8..ca0e2eeb7 100644 --- a/src/uucore/encoding.rs +++ b/src/uucore/encoding.rs @@ -66,8 +66,8 @@ impl Data { Data { line_wrap: 76, ignore_garbage: false, - input: input, - format: format, + input, + format, alphabet: match format { Base32 => b"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=", Base64 => b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=+/", diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index 78ccfbef3..39a7c4757 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -31,7 +31,7 @@ macro_rules! has { ) } -pub fn resolve_relative_path<'a>(path: &'a Path) -> Cow<'a, Path> { +pub fn resolve_relative_path(path: &Path) -> Cow { if path.components().all(|e| e != Component::ParentDir) { return path.into(); } From 5160f47a9f807eda18dca3c8032d3fd87ef568ef Mon Sep 17 00:00:00 2001 From: Vinzent Steinberg Date: Tue, 4 Sep 2018 14:33:36 +0200 Subject: [PATCH 133/606] Fix more clippy warnings and remove redundant 'static --- src/uucore/utmpx.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uucore/utmpx.rs b/src/uucore/utmpx.rs index db0605a4e..2cb460fc3 100644 --- a/src/uucore/utmpx.rs +++ b/src/uucore/utmpx.rs @@ -64,7 +64,7 @@ macro_rules! chars2string { #[cfg(target_os = "linux")] mod ut { - pub static DEFAULT_FILE: &'static str = "/var/run/utmp"; + pub static DEFAULT_FILE: &str = "/var/run/utmp"; pub use libc::__UT_LINESIZE as UT_LINESIZE; pub use libc::__UT_NAMESIZE as UT_NAMESIZE; @@ -85,7 +85,7 @@ mod ut { #[cfg(target_os = "macos")] mod ut { - pub static DEFAULT_FILE: &'static str = "/var/run/utmpx"; + pub static DEFAULT_FILE: &str = "/var/run/utmpx"; pub use libc::_UTX_LINESIZE as UT_LINESIZE; pub use libc::_UTX_USERSIZE as UT_NAMESIZE; @@ -110,7 +110,7 @@ mod ut { mod ut { use super::libc; - pub static DEFAULT_FILE: &'static str = ""; + pub static DEFAULT_FILE: &str = ""; pub const UT_LINESIZE: usize = 16; pub const UT_NAMESIZE: usize = 32; From 5f582c05e14405648a7181e95f976086d1ef8b24 Mon Sep 17 00:00:00 2001 From: Vinzent Steinberg Date: Tue, 4 Sep 2018 14:49:27 +0200 Subject: [PATCH 134/606] Remove utf8 feature All code it provides can be implemented with `std`. --- src/uucore/lib.rs | 2 -- src/uucore/utf8.rs | 27 --------------------------- 2 files changed, 29 deletions(-) delete mode 100644 src/uucore/utf8.rs diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index cc77e9f0e..dc8c3f904 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -24,8 +24,6 @@ pub mod panic; #[cfg(feature = "fs")] pub mod fs; -#[cfg(feature = "utf8")] -pub mod utf8; #[cfg(feature = "encoding")] pub mod encoding; #[cfg(feature = "parse_time")] diff --git a/src/uucore/utf8.rs b/src/uucore/utf8.rs deleted file mode 100644 index f2d2137a2..000000000 --- a/src/uucore/utf8.rs +++ /dev/null @@ -1,27 +0,0 @@ -/* This is taken from the rust_unicode crate. Remove once 'unicode' becomes stable */ - -// https://tools.ietf.org/html/rfc3629 -static UTF8_CHAR_WIDTH: [u8; 256] = [ -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1F -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3F -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5F -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7F -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9F -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBF -0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDF -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEF -4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0, // 0xFF -]; - -/// Given a first byte, determine how many bytes are in this UTF-8 character -#[inline] -pub fn utf8_char_width(b: u8) -> usize { - return UTF8_CHAR_WIDTH[b as usize] as usize; -} From 6600993c3e99f7e82bf15953290e6c943d3d71a7 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Mon, 3 Sep 2018 17:45:58 -0500 Subject: [PATCH 135/606] fix: gate unix-only macros (silences "unused" warnings) --- src/uucore/fs.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index 39a7c4757..65819afcc 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -25,6 +25,7 @@ use std::io::Result as IOResult; use std::path::{Component, Path, PathBuf}; use std::borrow::Cow; +#[cfg(unix)] macro_rules! has { ($mode:expr, $perm:expr) => ( $mode & ($perm as u32) != 0 From 4e0025cb17b68074b580844c67f2965ce737e184 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Thu, 21 Feb 2019 05:10:12 -0800 Subject: [PATCH 136/606] base32, base64, uucore: merge base32/base64 code --- src/uucore/encoding.rs | 4 ++-- src/uucore/macros.rs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/uucore/encoding.rs b/src/uucore/encoding.rs index ca0e2eeb7..b5b233e4d 100644 --- a/src/uucore/encoding.rs +++ b/src/uucore/encoding.rs @@ -104,9 +104,9 @@ impl Data { } // NOTE: this will likely be phased out at some point -pub fn wrap_print(line_wrap: usize, res: String) { +pub fn wrap_print(data: &Data, res: String) { let stdout = io::stdout(); - wrap_write(stdout.lock(), line_wrap, res).unwrap(); + wrap_write(stdout.lock(), data.line_wrap, res).unwrap(); } pub fn wrap_write(mut writer: W, line_wrap: usize, res: String) -> io::Result<()> { diff --git a/src/uucore/macros.rs b/src/uucore/macros.rs index 03decc92e..28046f2c8 100644 --- a/src/uucore/macros.rs +++ b/src/uucore/macros.rs @@ -11,6 +11,7 @@ macro_rules! executable( () => ({ let module = module_path!(); + let module = module.split("::").next().unwrap_or(module); if &module[0..3] == "uu_" { &module[3..] } else { From 44550ee5b61552b23d1e857372b0eee5006fdcca Mon Sep 17 00:00:00 2001 From: Zachary Dremann Date: Mon, 29 Apr 2019 21:32:28 -0400 Subject: [PATCH 137/606] Add tests for signals (including failing test for `is_signal` --- src/uucore/signals.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/uucore/signals.rs b/src/uucore/signals.rs index 8887ddfe1..a4a7551e8 100644 --- a/src/uucore/signals.rs +++ b/src/uucore/signals.rs @@ -343,3 +343,39 @@ pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { pub fn is_signal(num: usize) -> bool { num < ALL_SIGNALS.len() } + +#[test] +fn signals_all_contiguous() { + for (i, signal) in ALL_SIGNALS.iter().enumerate() { + assert_eq!(signal.value, i + 1); + } +} + +#[test] +fn signals_all_are_signal() { + for signal in &ALL_SIGNALS { + assert!(is_signal(signal.value)); + } +} + +#[test] +fn signal_by_value() { + assert_eq!(signal_by_name_or_value("0"), Some(0)); + for signal in &ALL_SIGNALS { + assert_eq!(signal_by_name_or_value(&signal.value.to_string()), Some(signal.value)); + } +} + +#[test] +fn signal_by_short_name() { + for signal in &ALL_SIGNALS { + assert_eq!(signal_by_name_or_value(signal.name), Some(signal.value)); + } +} + +#[test] +fn signal_by_long_name() { + for signal in &ALL_SIGNALS { + assert_eq!(signal_by_name_or_value(&format!("SIG{}", signal.name)), Some(signal.value)); + } +} From 30df2210f0c7079e746160b9641a293b591bf042 Mon Sep 17 00:00:00 2001 From: Zachary Dremann Date: Mon, 29 Apr 2019 21:35:07 -0400 Subject: [PATCH 138/606] Fix is_signal --- src/uucore/signals.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uucore/signals.rs b/src/uucore/signals.rs index a4a7551e8..ee7bcac99 100644 --- a/src/uucore/signals.rs +++ b/src/uucore/signals.rs @@ -341,7 +341,8 @@ pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { #[inline(always)] pub fn is_signal(num: usize) -> bool { - num < ALL_SIGNALS.len() + // Named signals start at 1 + num <= ALL_SIGNALS.len() } #[test] From c15b18bf5b4ce0b83dcfa43fdc219eb2484ae87b Mon Sep 17 00:00:00 2001 From: Zachary Dremann Date: Mon, 29 Apr 2019 21:53:14 -0400 Subject: [PATCH 139/606] Don't allocate in signal_by_name_or_value --- src/uucore/signals.rs | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/uucore/signals.rs b/src/uucore/signals.rs index ee7bcac99..cbaf580d5 100644 --- a/src/uucore/signals.rs +++ b/src/uucore/signals.rs @@ -325,18 +325,23 @@ pub static ALL_SIGNALS: [Signal<'static>; 31] = [ ]; pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { - if signal_name_or_value == "0" { - return Some(0); - } - for signal in &ALL_SIGNALS { - let long_name = format!("SIG{}", signal.name); - if signal.name == signal_name_or_value || (signal_name_or_value == signal.value.to_string()) - || (long_name == signal_name_or_value) - { - return Some(signal.value); + if let Ok(value) = signal_name_or_value.parse() { + if is_signal(value) { + return Some(value); + } else { + return None; } } - None + let signal_name = if signal_name_or_value.starts_with("SIG") { + &signal_name_or_value[3..] + } else { + &signal_name_or_value[..] + }; + + ALL_SIGNALS + .iter() + .find(|s| s.name == signal_name) + .map(|s| s.value) } #[inline(always)] @@ -363,7 +368,10 @@ fn signals_all_are_signal() { fn signal_by_value() { assert_eq!(signal_by_name_or_value("0"), Some(0)); for signal in &ALL_SIGNALS { - assert_eq!(signal_by_name_or_value(&signal.value.to_string()), Some(signal.value)); + assert_eq!( + signal_by_name_or_value(&signal.value.to_string()), + Some(signal.value) + ); } } @@ -377,6 +385,9 @@ fn signal_by_short_name() { #[test] fn signal_by_long_name() { for signal in &ALL_SIGNALS { - assert_eq!(signal_by_name_or_value(&format!("SIG{}", signal.name)), Some(signal.value)); + assert_eq!( + signal_by_name_or_value(&format!("SIG{}", signal.name)), + Some(signal.value) + ); } } From 77cc8d39c60a8af299d84cbf22ff53951c30a67f Mon Sep 17 00:00:00 2001 From: Zachary Dremann Date: Tue, 30 Apr 2019 21:02:29 -0400 Subject: [PATCH 140/606] Replace starts_with and slice with trim_left_matches --- src/uucore/signals.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/uucore/signals.rs b/src/uucore/signals.rs index cbaf580d5..76a153a03 100644 --- a/src/uucore/signals.rs +++ b/src/uucore/signals.rs @@ -332,11 +332,7 @@ pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { return None; } } - let signal_name = if signal_name_or_value.starts_with("SIG") { - &signal_name_or_value[3..] - } else { - &signal_name_or_value[..] - }; + let signal_name = signal_name_or_value.trim_left_matches("SIG"); ALL_SIGNALS .iter() From d81d3e3c71b1eebdda198699f108d4b909a2df17 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Sun, 28 Apr 2019 19:55:18 -0700 Subject: [PATCH 141/606] Get rid of all warnings on Linux (or at least WSL) --- src/uucore/mode.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/mode.rs b/src/uucore/mode.rs index 7a08652db..26e237a7b 100644 --- a/src/uucore/mode.rs +++ b/src/uucore/mode.rs @@ -10,7 +10,7 @@ use std::error::Error; pub fn parse_numeric(fperm: u32, mut mode: &str) -> Result { let (op, pos) = parse_op(mode, Some('='))?; - mode = mode[pos..].trim_left_matches('0'); + mode = mode[pos..].trim_start_matches('0'); if mode.len() > 4 { Err(format!("mode is too large ({} > 7777)", mode)) } else { From 72c322a882104282dbd0ff03ccf9f4129f29738b Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Wed, 1 May 2019 04:43:14 -0700 Subject: [PATCH 142/606] uucore, yes: add zero-copy on supported platforms (only Linux currently) --- src/uucore/Cargo.toml | 4 + src/uucore/lib.rs | 10 ++ src/uucore/zero_copy/mod.rs | 139 +++++++++++++++++++++++ src/uucore/zero_copy/platform/default.rs | 25 ++++ src/uucore/zero_copy/platform/linux.rs | 105 +++++++++++++++++ src/uucore/zero_copy/platform/mod.rs | 21 ++++ src/uucore/zero_copy/platform/unix.rs | 18 +++ src/uucore/zero_copy/platform/windows.rs | 19 ++++ 8 files changed, 341 insertions(+) create mode 100644 src/uucore/zero_copy/mod.rs create mode 100644 src/uucore/zero_copy/platform/default.rs create mode 100644 src/uucore/zero_copy/platform/linux.rs create mode 100644 src/uucore/zero_copy/platform/mod.rs create mode 100644 src/uucore/zero_copy/platform/unix.rs create mode 100644 src/uucore/zero_copy/platform/windows.rs diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 578c9eb3b..faba36a54 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -11,6 +11,9 @@ time = { version = "0.1.40", optional = true } data-encoding = { version = "^2.1", optional = true } libc = { version = "0.2.42", optional = true } wild = "2.0.1" +nix = { version = "0.13", optional = true } +lazy_static = { version = "1.3", optional = true } +platform-info = { version = "0.0.1", optional = true } [target.'cfg(target_os = "redox")'.dependencies] termion = "1.5" @@ -25,6 +28,7 @@ utmpx = ["time", "libc"] process = ["libc"] signals = [] entries = ["libc"] +zero-copy = ["nix", "libc", "lazy_static", "platform-info"] wide = [] default = [] diff --git a/src/uucore/lib.rs b/src/uucore/lib.rs index dc8c3f904..58e7ff261 100644 --- a/src/uucore/lib.rs +++ b/src/uucore/lib.rs @@ -13,6 +13,13 @@ extern crate failure; #[cfg(feature = "failure_derive")] #[macro_use] extern crate failure_derive; +#[cfg(feature = "nix")] +extern crate nix; +#[cfg(all(feature = "lazy_static", target_os = "linux"))] +#[macro_use] +extern crate lazy_static; +#[cfg(feature = "platform-info")] +extern crate platform_info; #[macro_use] mod macros; @@ -40,5 +47,8 @@ pub mod process; #[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))] pub mod signals; +#[cfg(feature = "zero-copy")] +pub mod zero_copy; + #[cfg(all(windows, feature = "wide"))] pub mod wide; diff --git a/src/uucore/zero_copy/mod.rs b/src/uucore/zero_copy/mod.rs new file mode 100644 index 000000000..70e19a776 --- /dev/null +++ b/src/uucore/zero_copy/mod.rs @@ -0,0 +1,139 @@ +use self::platform::*; + +use std::io::{self, Write}; + +mod platform; + +pub trait AsRawObject { + fn as_raw_object(&self) -> RawObject; +} + +pub trait FromRawObject : Sized { + unsafe fn from_raw_object(obj: RawObject) -> Option; +} + +// TODO: also make a SpliceWriter that takes an input fd and and output fd and uses splice() to +// transfer data +// TODO: make a TeeWriter or something that takes an input fd and two output fds and uses tee() to +// transfer to both output fds + +enum InnerZeroCopyWriter { + Platform(PlatformZeroCopyWriter), + Standard(T), +} + +impl Write for InnerZeroCopyWriter { + fn write(&mut self, buf: &[u8]) -> io::Result { + match self { + InnerZeroCopyWriter::Platform(ref mut writer) => writer.write(buf), + InnerZeroCopyWriter::Standard(ref mut writer) => writer.write(buf), + } + } + + fn flush(&mut self) -> io::Result<()> { + match self { + InnerZeroCopyWriter::Platform(ref mut writer) => writer.flush(), + InnerZeroCopyWriter::Standard(ref mut writer) => writer.flush(), + } + } +} + +pub struct ZeroCopyWriter { + /// This field is never used, but we need it to drop file descriptors + #[allow(dead_code)] + raw_obj_owner: Option, + + inner: InnerZeroCopyWriter, +} + +struct TransformContainer<'a, A: Write + AsRawObject + Sized, B: Write + Sized> { + /// This field is never used and probably could be converted into PhantomData, but might be + /// useful for restructuring later (at the moment it's basically left over from an earlier + /// design) + #[allow(dead_code)] + original: Option<&'a mut A>, + + transformed: Option, +} + +impl<'a, A: Write + AsRawObject + Sized, B: Write + Sized> Write for TransformContainer<'a, A, B> { + fn write(&mut self, bytes: &[u8]) -> io::Result { + self.transformed.as_mut().unwrap().write(bytes) + } + + fn flush(&mut self) -> io::Result<()> { + self.transformed.as_mut().unwrap().flush() + } +} + +impl<'a, A: Write + AsRawObject + Sized, B: Write + Sized> AsRawObject for TransformContainer<'a, A, B> { + fn as_raw_object(&self) -> RawObject { + panic!("Test should never be used") + } +} + +impl ZeroCopyWriter { + pub fn new(writer: T) -> Self { + let raw_obj = writer.as_raw_object(); + match unsafe { PlatformZeroCopyWriter::new(raw_obj) } { + Ok(inner) => { + ZeroCopyWriter { + raw_obj_owner: Some(writer), + inner: InnerZeroCopyWriter::Platform(inner), + } + } + _ => { + // creating the splice writer failed for whatever reason, so just make a default + // writer + ZeroCopyWriter { + raw_obj_owner: None, + inner: InnerZeroCopyWriter::Standard(writer), + } + } + } + } + + pub fn with_default<'a: 'b, 'b, F, W>(writer: &'a mut T, func: F) -> ZeroCopyWriter + where + F: Fn(&'a mut T) -> W, + W: Write + Sized + 'b, + { + let raw_obj = writer.as_raw_object(); + match unsafe { PlatformZeroCopyWriter::new(raw_obj) } { + Ok(inner) => { + ZeroCopyWriter { + raw_obj_owner: Some(TransformContainer { original: Some(writer), transformed: None, }), + inner: InnerZeroCopyWriter::Platform(inner), + } + } + _ => { + // XXX: should func actually consume writer and leave it up to the user to save the value? + // maybe provide a default stdin method then? in some cases it would make more sense for the + // value to be consumed + let real_writer = func(writer); + ZeroCopyWriter { + raw_obj_owner: None, + inner: InnerZeroCopyWriter::Standard(TransformContainer { original: None, transformed: Some(real_writer) }), + } + } + } + } + + // XXX: unsure how to get something like this working without allocating, so not providing it + /*pub fn stdout() -> ZeroCopyWriter { + let mut stdout = io::stdout(); + ZeroCopyWriter::with_default(&mut stdout, |stdout| { + stdout.lock() + }) + }*/ +} + +impl Write for ZeroCopyWriter { + fn write(&mut self, buf: &[u8]) -> io::Result { + self.inner.write(buf) + } + + fn flush(&mut self) -> io::Result<()> { + self.inner.flush() + } +} diff --git a/src/uucore/zero_copy/platform/default.rs b/src/uucore/zero_copy/platform/default.rs new file mode 100644 index 000000000..b0babc3d9 --- /dev/null +++ b/src/uucore/zero_copy/platform/default.rs @@ -0,0 +1,25 @@ +use crate::zero_copy::RawObject; + +use std::io::{self, Write}; + +/// A "zero-copy" writer used on platforms for which we have no actual zero-copy implementation (or +/// which use standard read/write operations for zero-copy I/O). This writer just delegates to the +/// inner writer used to create it. Using this struct avoids going through the machinery used to +/// handle the case where a given writer does not support zero-copy on a platform. +pub struct PlatformZeroCopyWriter; + +impl PlatformZeroCopyWriter { + pub unsafe fn new(_obj: RawObject) -> Result { + Err(()) + } +} + +impl Write for PlatformZeroCopyWriter { + fn write(&mut self, _bytes: &[u8]) -> io::Result { + panic!("should never occur") + } + + fn flush(&mut self) -> io::Result<()> { + panic!("should never occur") + } +} diff --git a/src/uucore/zero_copy/platform/linux.rs b/src/uucore/zero_copy/platform/linux.rs new file mode 100644 index 000000000..7de9c99ab --- /dev/null +++ b/src/uucore/zero_copy/platform/linux.rs @@ -0,0 +1,105 @@ +use std::io::{self, Write}; +use std::os::unix::io::RawFd; + +use libc::{O_APPEND, S_IFIFO, S_IFREG}; +use nix::errno::Errno; +use nix::fcntl::{fcntl, splice, vmsplice, FcntlArg, SpliceFFlags}; +use nix::sys::uio::IoVec; +use nix::sys::stat::{fstat, FileStat}; +use nix::unistd::pipe; +use platform_info::{Uname, PlatformInfo}; + +use crate::zero_copy::{FromRawObject, RawObject}; + +lazy_static! { + static ref IN_WSL: bool = { + let info = PlatformInfo::new().unwrap(); + info.release().contains("Microsoft") + }; +} + +pub struct PlatformZeroCopyWriter { + raw_obj: RawObject, + read_pipe: RawFd, + write_pipe: RawFd, + write_fn: fn(&mut PlatformZeroCopyWriter, &[IoVec<&[u8]>], usize) -> io::Result, +} + +impl PlatformZeroCopyWriter { + pub unsafe fn new(raw_obj: RawObject) -> nix::Result { + if *IN_WSL { + // apparently WSL hasn't implemented vmsplice(), causing writes to fail + // thus, we will just say zero-copy doesn't work there rather than working + // around it + return Err(nix::Error::from(Errno::EOPNOTSUPP)) + } + + let stat_info: FileStat = fstat(raw_obj)?; + let access_mode: libc::c_int = fcntl(raw_obj, FcntlArg::F_GETFL)?; + + let is_regular = (stat_info.st_mode & S_IFREG) != 0; + let is_append = (access_mode & O_APPEND) != 0; + let is_fifo = (stat_info.st_mode & S_IFIFO) != 0; + + if is_regular && !is_append { + let (read_pipe, write_pipe) = pipe()?; + + Ok(PlatformZeroCopyWriter { + raw_obj, + read_pipe, + write_pipe, + write_fn: write_regular, + }) + } else if is_fifo { + Ok(PlatformZeroCopyWriter { + raw_obj, + read_pipe: Default::default(), + write_pipe: Default::default(), + write_fn: write_fifo, + }) + } else { + // FIXME: how to error? + Err(nix::Error::from(Errno::UnknownErrno)) + } + } +} + +impl FromRawObject for PlatformZeroCopyWriter { + unsafe fn from_raw_object(obj: RawObject) -> Option { + PlatformZeroCopyWriter::new(obj).ok() + } +} + +impl Write for PlatformZeroCopyWriter { + fn write(&mut self, buf: &[u8]) -> io::Result { + let iovec = &[IoVec::from_slice(buf)]; + + let func = self.write_fn; + func(self, iovec, buf.len()) + } + + fn flush(&mut self) -> io::Result<()> { + // XXX: not sure if we need anything else + Ok(()) + } +} + +fn write_regular(writer: &mut PlatformZeroCopyWriter, iovec: &[IoVec<&[u8]>], len: usize) -> io::Result { + vmsplice(writer.write_pipe, iovec, SpliceFFlags::empty()) + .and_then(|_| + splice( + writer.read_pipe, + None, + writer.raw_obj, + None, + len, + SpliceFFlags::empty() + ) + ) + .map_err(|_| io::Error::last_os_error()) +} + +fn write_fifo(writer: &mut PlatformZeroCopyWriter, iovec: &[IoVec<&[u8]>], _len: usize) -> io::Result { + vmsplice(writer.raw_obj, iovec, SpliceFFlags::empty()) + .map_err(|_| io::Error::last_os_error()) +} diff --git a/src/uucore/zero_copy/platform/mod.rs b/src/uucore/zero_copy/platform/mod.rs new file mode 100644 index 000000000..313d2d6f2 --- /dev/null +++ b/src/uucore/zero_copy/platform/mod.rs @@ -0,0 +1,21 @@ +#[cfg(unix)] +pub use self::unix::*; +#[cfg(target_os = "linux")] +pub use self::linux::*; +#[cfg(windows)] +pub use self::windows::*; + +// Add any operating systems we support here +#[cfg(not(any(target_os = "linux")))] +pub use self::default::*; + +#[cfg(unix)] +mod unix; +#[cfg(target_os = "linux")] +mod linux; +#[cfg(windows)] +mod windows; + +// Add any operating systems we support here +#[cfg(not(any(target_os = "linux")))] +mod default; diff --git a/src/uucore/zero_copy/platform/unix.rs b/src/uucore/zero_copy/platform/unix.rs new file mode 100644 index 000000000..0a6fd7e24 --- /dev/null +++ b/src/uucore/zero_copy/platform/unix.rs @@ -0,0 +1,18 @@ +use std::os::unix::io::{AsRawFd, FromRawFd, RawFd}; + +use crate::zero_copy::{AsRawObject, FromRawObject}; + +pub type RawObject = RawFd; + +impl AsRawObject for T { + fn as_raw_object(&self) -> RawObject { + self.as_raw_fd() + } +} + +// FIXME: check if this works right +impl FromRawObject for T { + unsafe fn from_raw_object(obj: RawObject) -> Option { + Some(T::from_raw_fd(obj)) + } +} diff --git a/src/uucore/zero_copy/platform/windows.rs b/src/uucore/zero_copy/platform/windows.rs new file mode 100644 index 000000000..745607267 --- /dev/null +++ b/src/uucore/zero_copy/platform/windows.rs @@ -0,0 +1,19 @@ +use std::os::windows::io::{AsRawHandle, FromRawHandle, RawHandle}; + +use crate::zero_copy::{AsRawObject, FromRawObject}; + +pub type RawObject = RawHandle; + +impl AsRawObject for T { + fn as_raw_object(&self) -> RawObject { + self.as_raw_handle() + } +} + +impl FromRawObject for T { + unsafe fn from_raw_object(obj: RawObject) -> Option { + Some(T::from_raw_handle(obj)) + } +} + +// TODO: see if there's some zero-copy stuff in Windows From f79f0716ee968198e37f2628f01e139acaa5e971 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Wed, 1 May 2019 04:58:20 -0700 Subject: [PATCH 143/606] uucore: remove an inaccurate comment --- src/uucore/zero_copy/platform/default.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/uucore/zero_copy/platform/default.rs b/src/uucore/zero_copy/platform/default.rs index b0babc3d9..9d158522c 100644 --- a/src/uucore/zero_copy/platform/default.rs +++ b/src/uucore/zero_copy/platform/default.rs @@ -2,10 +2,6 @@ use crate::zero_copy::RawObject; use std::io::{self, Write}; -/// A "zero-copy" writer used on platforms for which we have no actual zero-copy implementation (or -/// which use standard read/write operations for zero-copy I/O). This writer just delegates to the -/// inner writer used to create it. Using this struct avoids going through the machinery used to -/// handle the case where a given writer does not support zero-copy on a platform. pub struct PlatformZeroCopyWriter; impl PlatformZeroCopyWriter { From 76aef60d80caf504b33d4bb4f9c8cd970012541d Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Wed, 1 May 2019 17:51:59 -0700 Subject: [PATCH 144/606] uucore: allow the Linux zero-copy setup on Android --- src/uucore/zero_copy/platform/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uucore/zero_copy/platform/mod.rs b/src/uucore/zero_copy/platform/mod.rs index 313d2d6f2..039b94b00 100644 --- a/src/uucore/zero_copy/platform/mod.rs +++ b/src/uucore/zero_copy/platform/mod.rs @@ -1,21 +1,21 @@ #[cfg(unix)] pub use self::unix::*; -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] pub use self::linux::*; #[cfg(windows)] pub use self::windows::*; // Add any operating systems we support here -#[cfg(not(any(target_os = "linux")))] +#[cfg(not(any(target_os = "linux", target_os = "android")))] pub use self::default::*; #[cfg(unix)] mod unix; -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] mod linux; #[cfg(windows)] mod windows; // Add any operating systems we support here -#[cfg(not(any(target_os = "linux")))] +#[cfg(not(any(target_os = "linux", target_os = "android")))] mod default; From 12129d1b1c5120d79f9d874f10e3f37d02c5c4c3 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Sun, 12 May 2019 21:15:56 -0700 Subject: [PATCH 145/606] Separate uucore into its own repository --- src/uucore/.appveyor.yml | 162 ++++++++++++++++++ src/uucore/.cirrus.yml | 15 ++ src/uucore/.codecov.yml | 1 + src/uucore/.gitignore | 14 ++ src/uucore/.travis.yml | 47 +++++ src/uucore/Cargo.toml | 5 +- src/uucore/LICENSE | 18 ++ src/uucore/README.md | 33 ++++ src/uucore/{ => src}/coreopts.rs | 0 src/uucore/{ => src}/encoding.rs | 0 src/uucore/{ => src}/entries.rs | 0 src/uucore/{ => src}/fs.rs | 0 src/uucore/{ => src}/lib.rs | 0 src/uucore/{ => src}/macros.rs | 0 src/uucore/{ => src}/mode.rs | 0 src/uucore/{ => src}/panic.rs | 0 src/uucore/{ => src}/parse_time.rs | 0 src/uucore/{ => src}/process.rs | 0 src/uucore/{ => src}/signals.rs | 2 +- src/uucore/{ => src}/utmpx.rs | 0 src/uucore/{ => src}/wide.rs | 0 src/uucore/{ => src}/zero_copy/mod.rs | 0 .../{ => src}/zero_copy/platform/default.rs | 0 .../{ => src}/zero_copy/platform/linux.rs | 0 .../{ => src}/zero_copy/platform/mod.rs | 0 .../{ => src}/zero_copy/platform/unix.rs | 0 .../{ => src}/zero_copy/platform/windows.rs | 0 27 files changed, 292 insertions(+), 5 deletions(-) create mode 100644 src/uucore/.appveyor.yml create mode 100644 src/uucore/.cirrus.yml create mode 100644 src/uucore/.codecov.yml create mode 100644 src/uucore/.gitignore create mode 100644 src/uucore/.travis.yml create mode 100644 src/uucore/LICENSE create mode 100644 src/uucore/README.md rename src/uucore/{ => src}/coreopts.rs (100%) rename src/uucore/{ => src}/encoding.rs (100%) rename src/uucore/{ => src}/entries.rs (100%) rename src/uucore/{ => src}/fs.rs (100%) rename src/uucore/{ => src}/lib.rs (100%) rename src/uucore/{ => src}/macros.rs (100%) rename src/uucore/{ => src}/mode.rs (100%) rename src/uucore/{ => src}/panic.rs (100%) rename src/uucore/{ => src}/parse_time.rs (100%) rename src/uucore/{ => src}/process.rs (100%) rename src/uucore/{ => src}/signals.rs (99%) rename src/uucore/{ => src}/utmpx.rs (100%) rename src/uucore/{ => src}/wide.rs (100%) rename src/uucore/{ => src}/zero_copy/mod.rs (100%) rename src/uucore/{ => src}/zero_copy/platform/default.rs (100%) rename src/uucore/{ => src}/zero_copy/platform/linux.rs (100%) rename src/uucore/{ => src}/zero_copy/platform/mod.rs (100%) rename src/uucore/{ => src}/zero_copy/platform/unix.rs (100%) rename src/uucore/{ => src}/zero_copy/platform/windows.rs (100%) diff --git a/src/uucore/.appveyor.yml b/src/uucore/.appveyor.yml new file mode 100644 index 000000000..ed0ec9b0c --- /dev/null +++ b/src/uucore/.appveyor.yml @@ -0,0 +1,162 @@ +# spell-checker:words POSIX repo SDK SDKs toolchain toolchains +# spell-checker:ignore uutils ARCH ABI BACKTRACE BINDIR cl COMNTOOLS dllcrt findstr maint MINGW MINGWDIR mkdir MSVC MSYS rustc rustlib rustup USERPROFILE vcvarsall + +version: "{build} ~ {branch}" + +branches: + except: + - gh-pages + +os: Visual Studio 2015 + +artifacts: + - path: target\%TARGET%\debug\libuucore.rlib + name: libuucore.rlib + +matrix: + allow_failures: + - CHANNEL: nightly +# - ABI: gnu + +environment: + global: + FEATURES: "" + BUILD_OPTIONS: "--all-features" + TEST_OPTIONS: "--all-features --no-fail-fast" + + matrix: + # minimum version + - CHANNEL: 1.31.0 + ARCH: i686 + ABI: msvc + # "msvc" ABI + - CHANNEL: stable + ARCH: i686 + ABI: msvc + - CHANNEL: stable + ARCH: x86_64 + ABI: msvc +# - CHANNEL: beta +# ARCH: i686 +# ABI: msvc +# - CHANNEL: beta +# ARCH: x86_64 +# ABI: msvc + - CHANNEL: nightly + ARCH: i686 + ABI: msvc + - CHANNEL: nightly + ARCH: x86_64 + ABI: msvc + # "gnu" ABI + - CHANNEL: stable + ARCH: i686 + ABI: gnu + - CHANNEL: stable + ARCH: x86_64 + ABI: gnu +# - CHANNEL: beta +# ARCH: i686 +# ABI: gnu +# - CHANNEL: beta +# ARCH: x86_64 +# ABI: gnu +# - CHANNEL: nightly +# ARCH: i686 +# ABI: gnu +# - CHANNEL: nightly +# ARCH: x86_64 +# ABI: gnu + # * specific gnu compilers + - CHANNEL: stable + ARCH: i686 + ABI: gnu + MINGW_URL: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.2/threads-win32/dwarf/i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z/download + MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z + - CHANNEL: stable + ARCH: x86_64 + ABI: gnu + MINGW_URL: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/7.3.0/threads-posix/seh/x86_64-7.3.0-release-posix-seh-rt_v5-rev0.7z/download#mingw-w64-x86_64-7.3.0-posix-seh.7z + +install: + # force branch checkout (if knowable), then reset to the specific commit ## (can be needed for accurate code coverage info) + # * this allows later apps to see the branch name using standard `git branch` operations, yet always builds the correct specific commit + # * ref: [`@`](https://archive.is/RVpnF) + - if DEFINED APPVEYOR_REPO_BRANCH if /I "%APPVEYOR_REPO_SCM%"=="git" ( git checkout "%APPVEYOR_REPO_BRANCH%" 2>NUL & git reset --hard "%APPVEYOR_REPO_COMMIT%" ) + # ensure CWD is project main directory + - cd "%APPVEYOR_BUILD_FOLDER%" + # create a working area + - ps: if ( ! $env:CI_TEMP_DIR ) { $env:CI_TEMP_DIR = "${env:TEMP}\${env:APPVEYOR_JOB_ID}" ; mkdir -force $env:CI_TEMP_DIR | out-null } + + # define the TARGET host + - set "TARGET=%ARCH%-pc-windows-%ABI%" + + # show relevant environment settings + - ps: ('CHANNEL', 'ARCH', 'ABI', 'FEATURES', 'BUILD_OPTIONS', 'TEST_OPTIONS', 'TARGET') |% { write-host -f yellow "$_=$(get-content -ea silent env:/$_)" } + + # rust installation + # * install `rust` via `rustup` + - appveyor DownloadFile "https://win.rustup.rs/" -FileName "%CI_TEMP_DIR%\rustup-init.exe" + - call "%CI_TEMP_DIR%\rustup-init.exe" -y --default-toolchain %CHANNEL% --default-host %TARGET% --no-modify-path >NUL + - set "PATH=%PATH%;%USERPROFILE%\.cargo\bin" + - ps: $env:TOOLCHAIN = $("$(rustup show active-toolchain)" -split '\s+')[0] + # * set RUST_BACKTRACE for enhanced error messages + - set RUST_BACKTRACE=1 + # * show rust versions + - rustc -vV + - cargo -vV + + # "gnu" ABI setup + # * use the system MinGW/MSYS if we can + - if /i "%ABI%"=="gnu" set MSYS_BINDIR=C:\msys64\usr\bin + - if /i "%ABI%"=="gnu" if /i "%ARCH%"=="i686" set "MSYS_BITS=32" + - if /i "%ABI%"=="gnu" if /i "%ARCH%"=="x86_64" set "MSYS_BITS=64" + - if defined MSYS_BITS set "MSYS_MINGWDIR=C:\msys64\mingw%MSYS_BITS%" + - if defined MSYS_MINGWDIR set "MSYS_BINDIR=C:\msys64\usr\bin" + ## * workaround for rust-lang/rust#47048 / rust-lang/rust#53454 ## !maint: remove when resolved + - if /i "%ABI%"=="gnu" if /i "%ARCH%"=="i686" if not DEFINED MINGW_URL set "MINGW_URL=https://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win32/Personal Builds/mingw-builds/8.1.0/threads-posix/dwarf/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z" + - if /i "%ABI%"=="gnu" if /i "%ARCH%"=="x86_64" if not DEFINED MINGW_URL set "MINGW_URL=https://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win64/Personal Builds/mingw-builds/8.1.0/threads-posix/seh/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z" + ## (end workaround) + # * specific MinGW, if specified + - ps: if ( ! $env:MINGW_ARCHIVE -and $env:MINGW_URL ) { $env:MINGW_ARCHIVE = $($([URI]$env:MINGW_URL).fragment).TrimStart('#') } + - ps: if ( ! $env:MINGW_ARCHIVE -and $env:MINGW_URL ) { $env:MINGW_ARCHIVE = $([URI]$env:MINGW_URL).segments[-1] } + - if defined MINGW_ARCHIVE curl --insecure -fsSL "%MINGW_URL%" -o "%CI_TEMP_DIR%\%MINGW_ARCHIVE%" + - if defined MINGW_ARCHIVE mkdir "%CI_TEMP_DIR%\MinGW" >NUL + - if defined MINGW_ARCHIVE 7z x -y "%CI_TEMP_DIR%\%MINGW_ARCHIVE%" -o"%CI_TEMP_DIR%\MinGW" >NUL + - if defined MINGW_ARCHIVE set "MSYS_MINGWDIR=%CI_TEMP_DIR%\MinGW\mingw%MSYS_BITS%" + - if defined MINGW_ARCHIVE set "MSYS_BINDIR=%MSYS_MINGWDIR%\bin" + # * MinGW/MSYS PATH setup + - if defined MSYS_MINGWDIR set PATH=%MSYS_MINGWDIR%\%ARCH%-w64-mingw32\bin;%MSYS_BINDIR%;%PATH% + ## * workaround for rust-lang/rust#47048 / rust-lang/rust#53454 ## !maint: remove when resolved + # ** ref: , + # ** egs: , + - if /i "%ABI%"=="gnu" rustup install %CHANNEL%-%ARCH%-pc-windows-msvc + - if /i "%ABI%"=="gnu" rustup default %CHANNEL%-%ARCH%-pc-windows-msvc + - if /i "%ABI%"=="gnu" rustup target add %TARGET% + - ps: $env:TOOLCHAIN = $("$(rustup show active-toolchain)" -split '\s+')[0] + - if /i "%ABI%"=="gnu" rustup show + - if /i "%ABI%"=="gnu" rustc -vV + # ** copy libs from gcc toolchain to rust toolchain (more specifically, "crt2.o" and "dllcrt2.o" are needed) + - if defined MSYS_MINGWDIR copy /y "%MSYS_MINGWDIR%\%ARCH%-w64-mingw32\lib\*.o" "%USERPROFILE%\.rustup\toolchains\%TOOLCHAIN%\lib\rustlib\%TARGET%\lib" >NUL + ## (end workaround) + # * show `gcc` info + - if /i "%ABI%"=="gnu" ( where gcc && gcc --version ) + + # "msvc" ABI setup + - if /i "%ABI%" == "msvc" if /i "%ARCH%" == "i686" call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" + - if /i "%ABI%" == "msvc" if /i "%ARCH%" == "x86_64" call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 + - if /i "%ABI%" == "msvc" if /i "%ARCH%" == "x86_64" call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 + # * show `cl` info + - if /i "%ABI%"=="msvc" ( where cl && cl 2>&1 | findstr /i /c:"version" ) + + # finalize options + - ps: if ("$env:FEATURES".length) { $env:BUILD_OPTIONS = $(($env:BUILD_OPTIONS, "--features `"${env:FEATURES}`"")|?{$_}) -join ' ' } + - ps: if ("$env:FEATURES".length) { $env:TEST_OPTIONS = $(($env:TEST_OPTIONS, "--features `"${env:FEATURES}`"")|?{$_}) -join ' ' } + +build_script: + - ps: $env:BUILD_CMD = $(("cargo +${env:TOOLCHAIN} build --target=${env:TARGET}", $env:BUILD_OPTIONS)|?{$_}) -join ' ' + - echo [ `%BUILD_CMD%` ] & %BUILD_CMD% + +test_script: + - ps: $env:TEST_CMD = $(("cargo +${env:TOOLCHAIN} test --target=${env:TARGET}", $env:TEST_OPTIONS)|?{$_}) -join ' ' + - echo [ `%TEST_CMD%` ] & %TEST_CMD% diff --git a/src/uucore/.cirrus.yml b/src/uucore/.cirrus.yml new file mode 100644 index 000000000..b94acfac5 --- /dev/null +++ b/src/uucore/.cirrus.yml @@ -0,0 +1,15 @@ +freebsd_instance: + image: freebsd-12-0-release-amd64 + +task: + name: stable x86_64-unknown-freebsd + setup_script: + - pkg install -y curl + - curl https://sh.rustup.rs -sSf --output rustup.sh + - sh rustup.sh -y + build_script: + - . $HOME/.cargo/env + - cargo build + test_script: + - . $HOME/.cargo/env + - cargo test diff --git a/src/uucore/.codecov.yml b/src/uucore/.codecov.yml new file mode 100644 index 000000000..69cb76019 --- /dev/null +++ b/src/uucore/.codecov.yml @@ -0,0 +1 @@ +comment: false diff --git a/src/uucore/.gitignore b/src/uucore/.gitignore new file mode 100644 index 000000000..b1ac52506 --- /dev/null +++ b/src/uucore/.gitignore @@ -0,0 +1,14 @@ +target/ +/src/*/gen_table +/build/ +/tmp/ +/busybox/ +/.vscode/ +/.vs/ +*~ +.*.swp +.*.swo +.idea +Cargo.lock +lib*.a +/docs/_build diff --git a/src/uucore/.travis.yml b/src/uucore/.travis.yml new file mode 100644 index 000000000..21a7345af --- /dev/null +++ b/src/uucore/.travis.yml @@ -0,0 +1,47 @@ +language: rust + +rust: + - stable + - beta + +os: + - linux + - osx + +env: + global: FEATURES='' CARGO_ARGS='--all-features' + +matrix: + allow_failures: + - rust: nightly + fast_finish: true + include: + - rust: 1.31.0 + - rust: stable + os: linux + - rust: stable + os: osx + - rust: nightly + os: linux + - rust: nightly + os: osx + +cache: + directories: + - $HOME/.cargo + +script: + - cargo build $CARGO_ARGS --features "$FEATURES" + - cargo test $CARGO_ARGS --features "$FEATURES" --no-fail-fast + +addons: + apt: + packages: + - libssl-dev + +after_success: | + if [ "$TRAVIS_OS_NAME" = linux -a "$TRAVIS_RUST_VERSION" = stable ]; then + bash <(curl https://raw.githubusercontent.com/xd009642/tarpaulin/master/travis-install.sh) + cargo tarpaulin --out Xml + bash <(curl -s https://codecov.io/bash) + fi diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index faba36a54..a80e11869 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "uucore" version = "0.0.1" -authors = [] +authors = ["uutils developers"] [dependencies] getopts = "0.2.18" @@ -32,6 +32,3 @@ zero-copy = ["nix", "libc", "lazy_static", "platform-info"] wide = [] default = [] -[lib] -path = "lib.rs" -name = "uucore" diff --git a/src/uucore/LICENSE b/src/uucore/LICENSE new file mode 100644 index 000000000..0177c4ab7 --- /dev/null +++ b/src/uucore/LICENSE @@ -0,0 +1,18 @@ +Copyright (c) Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/uucore/README.md b/src/uucore/README.md new file mode 100644 index 000000000..599b1fdab --- /dev/null +++ b/src/uucore/README.md @@ -0,0 +1,33 @@ +uutils uucore +============= + +[![Discord](https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat)](https://discord.gg/wQVJbvJ) +[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/uutils/uucore/blob/master/LICENSE) +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fuutils%2Fuucore.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fuutils%2Fuucore?ref=badge_shield) +[![LOC](https://tokei.rs/b1/github/uutils/uucore?category=code)](https://github.com/Aaronepower/tokei) +[![dependency status](https://deps.rs/repo/github/uutils/uucore/status.svg)](https://deps.rs/repo/github/uutils/uucore) + +[![Build Status](https://api.travis-ci.org/uutils/coreutils.svg?branch=master)](https://travis-ci.org/uutils/uucore) +[![Build Status (Windows)](https://ci.appveyor.com/api/projects/status/787ltcxgy86r20le?svg=true)](https://ci.appveyor.com/project/Arcterus/uucore) +[![Build Status (FreeBSD)](https://api.cirrus-ci.com/github/uutils/coreutils.svg)](https://cirrus-ci.com/github/uutils/uucore/master) + +----------------------------------------------- + +uucore is a collection of code used by various uutils projects. Currently, +almost all of the code is used by [uutils/coreutils](https://github.com/uutils/coreutils). +In the future, much of this repository may be supplanted by smaller, more +focused repositories/crates. + +### Rust Version ### + +uucore follows Rust's release channels and is tested against stable, beta and nightly. +The current oldest supported version of the Rust compiler is `1.31.0`. + +On both Windows and Redox, only the nightly version is tested currently. + +License +------- + +uucore is licensed under the MIT License - see the `LICENSE` file for details + +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fuutils%2Fuucore.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fuutils%2Fuucore?ref=badge_large) diff --git a/src/uucore/coreopts.rs b/src/uucore/src/coreopts.rs similarity index 100% rename from src/uucore/coreopts.rs rename to src/uucore/src/coreopts.rs diff --git a/src/uucore/encoding.rs b/src/uucore/src/encoding.rs similarity index 100% rename from src/uucore/encoding.rs rename to src/uucore/src/encoding.rs diff --git a/src/uucore/entries.rs b/src/uucore/src/entries.rs similarity index 100% rename from src/uucore/entries.rs rename to src/uucore/src/entries.rs diff --git a/src/uucore/fs.rs b/src/uucore/src/fs.rs similarity index 100% rename from src/uucore/fs.rs rename to src/uucore/src/fs.rs diff --git a/src/uucore/lib.rs b/src/uucore/src/lib.rs similarity index 100% rename from src/uucore/lib.rs rename to src/uucore/src/lib.rs diff --git a/src/uucore/macros.rs b/src/uucore/src/macros.rs similarity index 100% rename from src/uucore/macros.rs rename to src/uucore/src/macros.rs diff --git a/src/uucore/mode.rs b/src/uucore/src/mode.rs similarity index 100% rename from src/uucore/mode.rs rename to src/uucore/src/mode.rs diff --git a/src/uucore/panic.rs b/src/uucore/src/panic.rs similarity index 100% rename from src/uucore/panic.rs rename to src/uucore/src/panic.rs diff --git a/src/uucore/parse_time.rs b/src/uucore/src/parse_time.rs similarity index 100% rename from src/uucore/parse_time.rs rename to src/uucore/src/parse_time.rs diff --git a/src/uucore/process.rs b/src/uucore/src/process.rs similarity index 100% rename from src/uucore/process.rs rename to src/uucore/src/process.rs diff --git a/src/uucore/signals.rs b/src/uucore/src/signals.rs similarity index 99% rename from src/uucore/signals.rs rename to src/uucore/src/signals.rs index 76a153a03..d6ee017b1 100644 --- a/src/uucore/signals.rs +++ b/src/uucore/src/signals.rs @@ -332,7 +332,7 @@ pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { return None; } } - let signal_name = signal_name_or_value.trim_left_matches("SIG"); + let signal_name = signal_name_or_value.trim_start_matches("SIG"); ALL_SIGNALS .iter() diff --git a/src/uucore/utmpx.rs b/src/uucore/src/utmpx.rs similarity index 100% rename from src/uucore/utmpx.rs rename to src/uucore/src/utmpx.rs diff --git a/src/uucore/wide.rs b/src/uucore/src/wide.rs similarity index 100% rename from src/uucore/wide.rs rename to src/uucore/src/wide.rs diff --git a/src/uucore/zero_copy/mod.rs b/src/uucore/src/zero_copy/mod.rs similarity index 100% rename from src/uucore/zero_copy/mod.rs rename to src/uucore/src/zero_copy/mod.rs diff --git a/src/uucore/zero_copy/platform/default.rs b/src/uucore/src/zero_copy/platform/default.rs similarity index 100% rename from src/uucore/zero_copy/platform/default.rs rename to src/uucore/src/zero_copy/platform/default.rs diff --git a/src/uucore/zero_copy/platform/linux.rs b/src/uucore/src/zero_copy/platform/linux.rs similarity index 100% rename from src/uucore/zero_copy/platform/linux.rs rename to src/uucore/src/zero_copy/platform/linux.rs diff --git a/src/uucore/zero_copy/platform/mod.rs b/src/uucore/src/zero_copy/platform/mod.rs similarity index 100% rename from src/uucore/zero_copy/platform/mod.rs rename to src/uucore/src/zero_copy/platform/mod.rs diff --git a/src/uucore/zero_copy/platform/unix.rs b/src/uucore/src/zero_copy/platform/unix.rs similarity index 100% rename from src/uucore/zero_copy/platform/unix.rs rename to src/uucore/src/zero_copy/platform/unix.rs diff --git a/src/uucore/zero_copy/platform/windows.rs b/src/uucore/src/zero_copy/platform/windows.rs similarity index 100% rename from src/uucore/zero_copy/platform/windows.rs rename to src/uucore/src/zero_copy/platform/windows.rs From cdafcce4008df43f65743a238ecf08f8fa3501e9 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Sun, 12 May 2019 21:29:14 -0700 Subject: [PATCH 146/606] Redox is not tested currently, so don't mention it --- src/uucore/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/README.md b/src/uucore/README.md index 599b1fdab..191d41ab7 100644 --- a/src/uucore/README.md +++ b/src/uucore/README.md @@ -23,7 +23,7 @@ focused repositories/crates. uucore follows Rust's release channels and is tested against stable, beta and nightly. The current oldest supported version of the Rust compiler is `1.31.0`. -On both Windows and Redox, only the nightly version is tested currently. +On Windows, only the nightly version is tested currently. License ------- From 12ce90d9cb59a78a1bad4ba88d3b77b7ba696092 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Sun, 12 May 2019 21:57:01 -0700 Subject: [PATCH 147/606] Fix doc-test for entries on macOS --- src/uucore/.cirrus.yml | 4 ++-- src/uucore/src/entries.rs | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/uucore/.cirrus.yml b/src/uucore/.cirrus.yml index b94acfac5..2f8b814bc 100644 --- a/src/uucore/.cirrus.yml +++ b/src/uucore/.cirrus.yml @@ -9,7 +9,7 @@ task: - sh rustup.sh -y build_script: - . $HOME/.cargo/env - - cargo build + - cargo build --all-features test_script: - . $HOME/.cargo/env - - cargo test + - cargo test --all-features diff --git a/src/uucore/src/entries.rs b/src/uucore/src/entries.rs index 3120d54e2..093c095c1 100644 --- a/src/uucore/src/entries.rs +++ b/src/uucore/src/entries.rs @@ -11,10 +11,17 @@ //! //! ``` //! use uucore::entries::{self, Locate}; +//! +//! let root_group = if cfg!(any(target_os = "linux", target_os = "android")) { +//! "root" +//! } else { +//! "wheel" +//! }; +//! //! assert_eq!("root", entries::uid2usr(0).unwrap()); //! assert_eq!(0, entries::usr2uid("root").unwrap()); //! assert!(entries::gid2grp(0).is_ok()); -//! assert!(entries::grp2gid("root").is_ok()); +//! assert!(entries::grp2gid(root_group).is_ok()); //! //! assert!(entries::Passwd::locate(0).is_ok()); //! assert!(entries::Passwd::locate("0").is_ok()); @@ -22,7 +29,7 @@ //! //! assert!(entries::Group::locate(0).is_ok()); //! assert!(entries::Group::locate("0").is_ok()); -//! assert!(entries::Group::locate("root").is_ok()); +//! assert!(entries::Group::locate(root_group).is_ok()); //! ``` #[cfg(any(target_os = "freebsd", target_os = "macos"))] From 217d83526b66ae2370e726e1336864921b0c6059 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Sun, 12 May 2019 22:12:36 -0700 Subject: [PATCH 148/606] Set up for release on crates.io --- src/uucore/Cargo.toml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index a80e11869..66bed3510 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -2,6 +2,18 @@ name = "uucore" version = "0.0.1" authors = ["uutils developers"] +description = "Common cross-platform code used by various uutils projects" + +homepage = "https://github.com/uutils/uucore" +repository = "https://github.com/uutils/uucore" +readme = "README.md" +keywords = ["cross-platform", "uutils", "coreutils"] +categories = ["os"] +license = "MIT" + +[badges] +travis-ci = { repository = "uutils/uucore" } +appveyor = { repository = "uutils/uucore" } [dependencies] getopts = "0.2.18" From 2792d85865595c4d3318db214ae5e9fe0bc8fb7c Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 1 Jan 2020 19:59:38 +0000 Subject: [PATCH 149/606] fix ~ 'musl' environment doesn't support utmpx --- src/uucore/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/lib.rs b/src/uucore/src/lib.rs index 58e7ff261..f6896a2e3 100644 --- a/src/uucore/src/lib.rs +++ b/src/uucore/src/lib.rs @@ -38,7 +38,7 @@ pub mod parse_time; #[cfg(all(not(windows), feature = "mode"))] pub mod mode; -#[cfg(all(unix, not(target_os = "fuchsia"), feature = "utmpx"))] +#[cfg(all(unix, not(target_os = "fuchsia"), not(target_env="musl"), feature = "utmpx"))] pub mod utmpx; #[cfg(all(unix, feature = "entries"))] pub mod entries; From 667ed39ece104ba0adaabb319d03841afb523934 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 2 Jan 2020 05:10:47 +0000 Subject: [PATCH 150/606] 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. --- src/uucore/Cargo.toml | 2 +- src/uucore/src/fs.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 66bed3510..611be8af9 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -16,6 +16,7 @@ travis-ci = { repository = "uutils/uucore" } appveyor = { repository = "uutils/uucore" } [dependencies] +dunce = "1.0.0" getopts = "0.2.18" failure = { version = "0.1.1", optional = true } failure_derive = { version = "0.1.1", optional = true } @@ -43,4 +44,3 @@ entries = ["libc"] zero-copy = ["nix", "libc", "lazy_static", "platform-info"] wide = [] default = [] - diff --git a/src/uucore/src/fs.rs b/src/uucore/src/fs.rs index 65819afcc..39d4b1f5a 100644 --- a/src/uucore/src/fs.rs +++ b/src/uucore/src/fs.rs @@ -6,6 +6,8 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +#[cfg(windows)] +extern crate dunce; #[cfg(target_os = "redox")] extern crate termion; @@ -101,7 +103,7 @@ pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> let original = if original.is_absolute() { original.to_path_buf() } else { - env::current_dir().unwrap().join(original) + dunce::canonicalize(env::current_dir().unwrap()).unwrap().join(original) }; let mut result = PathBuf::new(); From 84d8473e1a9f4a8d98de0bd584f0795fcf7878ed Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 2 Jan 2020 17:26:10 -0600 Subject: [PATCH 151/606] 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: --- src/uucore/Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 611be8af9..1b381aa14 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -27,6 +27,8 @@ wild = "2.0.1" nix = { version = "0.13", optional = true } lazy_static = { version = "1.3", optional = true } platform-info = { version = "0.0.1", optional = true } +# * transitive dependency via 'failure'; pin to <= v0.3.30 to avoid increasing MinSRV to v1.33.0 +backtrace = ">= 0.3.3, <= 0.3.30" [target.'cfg(target_os = "redox")'.dependencies] termion = "1.5" From 96a92b35331ee8e054197ec684340104a98004c3 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 2 Jan 2020 20:57:27 -0600 Subject: [PATCH 152/606] 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: @@ --- src/uucore/Cargo.toml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 1b381aa14..0fcf2021a 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -17,16 +17,16 @@ appveyor = { repository = "uutils/uucore" } [dependencies] dunce = "1.0.0" -getopts = "0.2.18" -failure = { version = "0.1.1", optional = true } -failure_derive = { version = "0.1.1", optional = true } -time = { version = "0.1.40", optional = true } +getopts = "<= 0.2.21" +failure = { version = "<= 0.1.1", optional = true } +failure_derive = { version = "<= 0.1.1", optional = true } +time = { version = "<= 0.1.42", optional = true } data-encoding = { version = "^2.1", optional = true } -libc = { version = "0.2.42", optional = true } +libc = { version = "<= 0.2.66", optional = true } wild = "2.0.1" -nix = { version = "0.13", optional = true } +nix = { version = "<= 0.13", optional = true } lazy_static = { version = "1.3", optional = true } -platform-info = { version = "0.0.1", optional = true } +platform-info = { version = "<= 0.0.1", optional = true } # * transitive dependency via 'failure'; pin to <= v0.3.30 to avoid increasing MinSRV to v1.33.0 backtrace = ">= 0.3.3, <= 0.3.30" From c08674da28a567dd77e64385eaf56d7607757d4d Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Tue, 7 Apr 2020 21:55:04 -0500 Subject: [PATCH 153/606] 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::*; | ^^^^^^^ | ... ``` --- src/uucore/Cargo.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 0fcf2021a..2148eb2d4 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -21,14 +21,16 @@ getopts = "<= 0.2.21" failure = { version = "<= 0.1.1", optional = true } failure_derive = { version = "<= 0.1.1", optional = true } time = { version = "<= 0.1.42", optional = true } -data-encoding = { version = "^2.1", optional = true } libc = { version = "<= 0.2.66", optional = true } wild = "2.0.1" nix = { version = "<= 0.13", optional = true } lazy_static = { version = "1.3", optional = true } platform-info = { version = "<= 0.0.1", optional = true } +## problem dependencies # * transitive dependency via 'failure'; pin to <= v0.3.30 to avoid increasing MinSRV to v1.33.0 backtrace = ">= 0.3.3, <= 0.3.30" +# * data-encoding: require 2.1, but 2.2.0 breaks the build for MinSRV 1.31.0 +data-encoding = { version = "~2.1", optional = true } [target.'cfg(target_os = "redox")'.dependencies] termion = "1.5" From ceee0ec09e1dfd5acb77e6a78242e1b027038a14 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Tue, 7 Apr 2020 22:45:42 -0500 Subject: [PATCH 154/606] 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. --- src/uucore/Cargo.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 2148eb2d4..5fcd76b20 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -21,7 +21,6 @@ getopts = "<= 0.2.21" failure = { version = "<= 0.1.1", optional = true } failure_derive = { version = "<= 0.1.1", optional = true } time = { version = "<= 0.1.42", optional = true } -libc = { version = "<= 0.2.66", optional = true } wild = "2.0.1" nix = { version = "<= 0.13", optional = true } lazy_static = { version = "1.3", optional = true } @@ -31,6 +30,9 @@ platform-info = { version = "<= 0.0.1", optional = true } backtrace = ">= 0.3.3, <= 0.3.30" # * data-encoding: require 2.1, but 2.2.0 breaks the build for MinSRV 1.31.0 data-encoding = { version = "~2.1", optional = true } +# * libc: initial utmp support added in 0.2.15, but 0.2.68 break the build for MinSRV 1.31.0 +libc = { version = "0.2.15, <= 0.2.66", optional = true } + [target.'cfg(target_os = "redox")'.dependencies] termion = "1.5" From 16157f57eb0819b3819284f6281aa4f2ec592d80 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Tue, 7 Apr 2020 22:52:38 -0500 Subject: [PATCH 155/606] maint/build ~ refactor (reorganize) and improve comments within 'Cargo.toml' --- src/uucore/Cargo.toml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 5fcd76b20..255258732 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -12,21 +12,22 @@ categories = ["os"] license = "MIT" [badges] -travis-ci = { repository = "uutils/uucore" } appveyor = { repository = "uutils/uucore" } +travis-ci = { repository = "uutils/uucore" } [dependencies] dunce = "1.0.0" getopts = "<= 0.2.21" +wild = "2.0.1" +## optional failure = { version = "<= 0.1.1", optional = true } failure_derive = { version = "<= 0.1.1", optional = true } -time = { version = "<= 0.1.42", optional = true } -wild = "2.0.1" -nix = { version = "<= 0.13", optional = true } lazy_static = { version = "1.3", optional = true } +nix = { version = "<= 0.13", optional = true } platform-info = { version = "<= 0.0.1", optional = true } -## problem dependencies -# * transitive dependency via 'failure'; pin to <= v0.3.30 to avoid increasing MinSRV to v1.33.0 +time = { version = "<= 0.1.42", optional = true } +## "problem" dependencies +# * backtrace: transitive dependency via 'failure'; pin to <= v0.3.30 to avoid increasing MinSRV to v1.33.0 backtrace = ">= 0.3.3, <= 0.3.30" # * data-encoding: require 2.1, but 2.2.0 breaks the build for MinSRV 1.31.0 data-encoding = { version = "~2.1", optional = true } @@ -38,15 +39,16 @@ libc = { version = "0.2.15, <= 0.2.66", optional = true } termion = "1.5" [features] -fs = ["libc"] -utf8 = [] +default = [] +## non-default features encoding = ["data-encoding", "failure", "failure_derive"] -parse_time = [] +entries = ["libc"] +fs = ["libc"] mode = ["libc"] -utmpx = ["time", "libc"] +parse_time = [] process = ["libc"] signals = [] -entries = ["libc"] -zero-copy = ["nix", "libc", "lazy_static", "platform-info"] +utf8 = [] +utmpx = ["time", "libc"] wide = [] -default = [] +zero-copy = ["nix", "libc", "lazy_static", "platform-info"] From 5b2c2bdfcafe05be0f1dbbaed146ce6b11cdeaf4 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Tue, 7 Apr 2020 23:11:33 -0500 Subject: [PATCH 156/606] maint/CICD ~ fix FreeBSD build on Cirrus CI --- src/uucore/.cirrus.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/uucore/.cirrus.yml b/src/uucore/.cirrus.yml index 2f8b814bc..390f07e3a 100644 --- a/src/uucore/.cirrus.yml +++ b/src/uucore/.cirrus.yml @@ -1,12 +1,11 @@ -freebsd_instance: - image: freebsd-12-0-release-amd64 - task: - name: stable x86_64-unknown-freebsd + name: stable x86_64-unknown-freebsd-12 + freebsd_instance: + image: freebsd-12-1-release-amd64 setup_script: - pkg install -y curl - curl https://sh.rustup.rs -sSf --output rustup.sh - - sh rustup.sh -y + - sh rustup.sh -y --profile=minimal build_script: - . $HOME/.cargo/env - cargo build --all-features From 099b0a207484e4746f516197770fbb99a6753beb Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Tue, 7 Apr 2020 21:36:11 -0500 Subject: [PATCH 157/606] 0.0.2 --- src/uucore/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 255258732..5150212ae 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uucore" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] description = "Common cross-platform code used by various uutils projects" From 6a8a677e8ba2d8f5c6e632969c0ea50d1d3433b1 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 23 May 2020 12:47:37 -0500 Subject: [PATCH 158/606] refactor/polish ~ `cargo fmt` --- src/uucore/src/coreopts.rs | 18 +- src/uucore/src/entries.rs | 39 ++-- src/uucore/src/fs.rs | 22 ++- src/uucore/src/lib.rs | 23 ++- src/uucore/src/macros.rs | 100 ++++++---- src/uucore/src/utmpx.rs | 61 +++--- src/uucore/src/zero_copy/mod.rs | 191 ++++++++++--------- src/uucore/src/zero_copy/platform/default.rs | 18 +- src/uucore/src/zero_copy/platform/linux.rs | 147 +++++++------- src/uucore/src/zero_copy/platform/mod.rs | 8 +- src/uucore/src/zero_copy/platform/unix.rs | 12 +- src/uucore/src/zero_copy/platform/windows.rs | 12 +- 12 files changed, 358 insertions(+), 293 deletions(-) diff --git a/src/uucore/src/coreopts.rs b/src/uucore/src/coreopts.rs index c245cf500..8c62ec9f2 100644 --- a/src/uucore/src/coreopts.rs +++ b/src/uucore/src/coreopts.rs @@ -84,13 +84,15 @@ impl<'a> CoreOptions<'a> { eprintln!("{}", f); ::std::process::exit(1); } - }.unwrap(); + } + .unwrap(); if matches.opt_present("help") { let usage_str = if self.help_text.display_usage { format!( "\n {}\n\n Reference\n", self.options.usage(self.help_text.summary) - ).replace("Options:", " Options:") + ) + .replace("Options:", " Options:") } else { String::new() }; @@ -118,24 +120,24 @@ impl<'a> CoreOptions<'a> { #[macro_export] macro_rules! new_coreopts { - ($syntax: expr, $summary: expr, $long_help: expr) => ( + ($syntax: expr, $summary: expr, $long_help: expr) => { uucore::coreopts::CoreOptions::new(uucore::coreopts::HelpText { name: executable!(), version: env!("CARGO_PKG_VERSION"), syntax: $syntax, summary: $summary, long_help: $long_help, - display_usage: true + display_usage: true, }) - ); - ($syntax: expr, $summary: expr, $long_help: expr, $display_usage: expr) => ( + }; + ($syntax: expr, $summary: expr, $long_help: expr, $display_usage: expr) => { uucore::coreopts::CoreOptions::new(uucore::coreopts::HelpText { name: executable!(), version: env!("CARGO_PKG_VERSION"), syntax: $syntax, summary: $summary, long_help: $long_help, - display_usage: $display_usage + display_usage: $display_usage, }) - ); + }; } diff --git a/src/uucore/src/entries.rs b/src/uucore/src/entries.rs index 093c095c1..a9bc8b2d4 100644 --- a/src/uucore/src/entries.rs +++ b/src/uucore/src/entries.rs @@ -37,12 +37,12 @@ use libc::time_t; use libc::{c_char, c_int, gid_t, uid_t}; use libc::{getgrgid, getgrnam, getgroups, getpwnam, getpwuid, group, passwd}; -use std::ptr; -use std::io::ErrorKind; -use std::io::Error as IOError; -use std::io::Result as IOResult; -use std::ffi::{CStr, CString}; use std::borrow::Cow; +use std::ffi::{CStr, CString}; +use std::io::Error as IOError; +use std::io::ErrorKind; +use std::io::Result as IOResult; +use std::ptr; extern "C" { fn getgrouplist( @@ -75,9 +75,9 @@ pub struct Passwd { } macro_rules! cstr2cow { - ($v:expr) => ( + ($v:expr) => { unsafe { CStr::from_ptr($v).to_string_lossy() } - ) + }; } impl Passwd { @@ -191,17 +191,20 @@ pub trait Locate { } macro_rules! f { - ($fnam:ident, $fid:ident, $t:ident, $st:ident) => ( + ($fnam:ident, $fid:ident, $t:ident, $st:ident) => { impl Locate<$t> for $st { fn locate(k: $t) -> IOResult { unsafe { let data = $fid(k); if !data.is_null() { Ok($st { - inner: ptr::read(data as *const _) + inner: ptr::read(data as *const _), }) } else { - Err(IOError::new(ErrorKind::NotFound, format!("No such id: {}", k))) + Err(IOError::new( + ErrorKind::NotFound, + format!("No such id: {}", k), + )) } } } @@ -213,26 +216,32 @@ macro_rules! f { let data = unsafe { $fid(id) }; if !data.is_null() { Ok($st { - inner: unsafe {ptr::read(data as *const _)} + inner: unsafe { ptr::read(data as *const _) }, }) } else { - Err(IOError::new(ErrorKind::NotFound, format!("No such id: {}", id))) + Err(IOError::new( + ErrorKind::NotFound, + format!("No such id: {}", id), + )) } } else { unsafe { let data = $fnam(CString::new(k).unwrap().as_ptr()); if !data.is_null() { Ok($st { - inner: ptr::read(data as *const _) + inner: ptr::read(data as *const _), }) } else { - Err(IOError::new(ErrorKind::NotFound, format!("Not found: {}", k))) + Err(IOError::new( + ErrorKind::NotFound, + format!("Not found: {}", k), + )) } } } } } - ) + }; } f!(getpwnam, getpwuid, uid_t, Passwd); diff --git a/src/uucore/src/fs.rs b/src/uucore/src/fs.rs index 39d4b1f5a..edd661264 100644 --- a/src/uucore/src/fs.rs +++ b/src/uucore/src/fs.rs @@ -14,24 +14,26 @@ extern crate termion; #[cfg(unix)] use super::libc; #[cfg(unix)] -use super::libc::{mode_t, S_IRGRP, S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, - S_IWUSR, S_IXGRP, S_IXOTH, S_IXUSR}; +use super::libc::{ + mode_t, S_IRGRP, S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, + S_IXGRP, S_IXOTH, S_IXUSR, +}; +use std::borrow::Cow; use std::env; use std::fs; -#[cfg(any(unix, target_os = "redox"))] -use std::os::unix::fs::MetadataExt; #[cfg(target_os = "redox")] use std::io; -use std::io::{Error, ErrorKind}; use std::io::Result as IOResult; +use std::io::{Error, ErrorKind}; +#[cfg(any(unix, target_os = "redox"))] +use std::os::unix::fs::MetadataExt; use std::path::{Component, Path, PathBuf}; -use std::borrow::Cow; #[cfg(unix)] macro_rules! has { - ($mode:expr, $perm:expr) => ( + ($mode:expr, $perm:expr) => { $mode & ($perm as u32) != 0 - ) + }; } pub fn resolve_relative_path(path: &Path) -> Cow { @@ -103,7 +105,9 @@ pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> let original = if original.is_absolute() { original.to_path_buf() } else { - dunce::canonicalize(env::current_dir().unwrap()).unwrap().join(original) + dunce::canonicalize(env::current_dir().unwrap()) + .unwrap() + .join(original) }; let mut result = PathBuf::new(); diff --git a/src/uucore/src/lib.rs b/src/uucore/src/lib.rs index f6896a2e3..4362758ad 100644 --- a/src/uucore/src/lib.rs +++ b/src/uucore/src/lib.rs @@ -1,15 +1,15 @@ extern crate wild; -pub fn args() -> impl Iterator { +pub fn args() -> impl Iterator { wild::args() } +#[cfg(feature = "failure")] +extern crate failure; #[cfg(feature = "libc")] pub extern crate libc; #[cfg(feature = "winapi")] pub extern crate winapi; -#[cfg(feature = "failure")] -extern crate failure; #[cfg(feature = "failure_derive")] #[macro_use] extern crate failure_derive; @@ -29,23 +29,28 @@ pub mod coreopts; pub mod panic; -#[cfg(feature = "fs")] -pub mod fs; #[cfg(feature = "encoding")] pub mod encoding; +#[cfg(feature = "fs")] +pub mod fs; #[cfg(feature = "parse_time")] pub mod parse_time; -#[cfg(all(not(windows), feature = "mode"))] -pub mod mode; -#[cfg(all(unix, not(target_os = "fuchsia"), not(target_env="musl"), feature = "utmpx"))] -pub mod utmpx; #[cfg(all(unix, feature = "entries"))] pub mod entries; +#[cfg(all(not(windows), feature = "mode"))] +pub mod mode; #[cfg(all(unix, feature = "process"))] pub mod process; #[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))] pub mod signals; +#[cfg(all( + unix, + not(target_os = "fuchsia"), + not(target_env = "musl"), + feature = "utmpx" +))] +pub mod utmpx; #[cfg(feature = "zero-copy")] pub mod zero_copy; diff --git a/src/uucore/src/macros.rs b/src/uucore/src/macros.rs index 28046f2c8..5356d9d5d 100644 --- a/src/uucore/src/macros.rs +++ b/src/uucore/src/macros.rs @@ -148,80 +148,108 @@ macro_rules! snippet_list_join_or { //-- message templates : invalid input #[macro_export] -macro_rules! msg_invalid_input { ($reason: expr) => ( - format!("invalid input: {}", $reason) ); } +macro_rules! msg_invalid_input { + ($reason: expr) => { + format!("invalid input: {}", $reason) + }; +} #[macro_export] -macro_rules! snippet_no_file_at_path { ($path:expr) => ( - format!("nonexistent path {}", $path) ); } +macro_rules! snippet_no_file_at_path { + ($path:expr) => { + format!("nonexistent path {}", $path) + }; +} // -- message templates : invalid input : flag #[macro_export] macro_rules! msg_invalid_opt_use { - ($about:expr, $flag:expr) => ( + ($about:expr, $flag:expr) => { msg_invalid_input!(format!("The '{}' option {}", $flag, $about)) - ); + }; ($about:expr, $longflag:expr, $shortflag:expr) => { - msg_invalid_input!(format!("The '{}' ('{}') option {}", $longflag, $shortflag, $about)) + msg_invalid_input!(format!( + "The '{}' ('{}') option {}", + $longflag, $shortflag, $about + )) }; } #[macro_export] macro_rules! msg_opt_only_usable_if { - ($clause:expr, $flag:expr) => ( + ($clause:expr, $flag:expr) => { msg_invalid_opt_use!(format!("only usable if {}", $clause), $flag) - ); - ($clause:expr, $longflag:expr, $shortflag:expr) => ( + }; + ($clause:expr, $longflag:expr, $shortflag:expr) => { msg_invalid_opt_use!(format!("only usable if {}", $clause), $longflag, $shortflag) - ); + }; } #[macro_export] macro_rules! msg_opt_invalid_should_be { - ($expects:expr, $received:expr, $flag:expr) => ( - msg_invalid_opt_use!(format!("expects {}, but was provided {}", $expects, $received), $flag) - ); - ($expects:expr, $received:expr, $longflag:expr, $shortflag:expr) => ( - msg_invalid_opt_use!(format!("expects {}, but was provided {}", $expects, $received), $longflag, $shortflag) - ); + ($expects:expr, $received:expr, $flag:expr) => { + msg_invalid_opt_use!( + format!("expects {}, but was provided {}", $expects, $received), + $flag + ) + }; + ($expects:expr, $received:expr, $longflag:expr, $shortflag:expr) => { + msg_invalid_opt_use!( + format!("expects {}, but was provided {}", $expects, $received), + $longflag, + $shortflag + ) + }; } // -- message templates : invalid input : args #[macro_export] -macro_rules! msg_arg_invalid_value { ($expects:expr, $received:expr) => ( - msg_invalid_input!(format!("expects its argument to be {}, but was provided {}", $expects, $received)) ); } - -#[macro_export] -macro_rules! msg_args_invalid_value { - ($expects:expr, $received:expr) => ( - msg_invalid_input!(format!("expects its arguments to be {}, but was provided {}", $expects, $received)) - ); - ($msg:expr) => ( - msg_invalid_input!($msg) - ); +macro_rules! msg_arg_invalid_value { + ($expects:expr, $received:expr) => { + msg_invalid_input!(format!( + "expects its argument to be {}, but was provided {}", + $expects, $received + )) + }; } #[macro_export] -macro_rules! msg_args_nonexistent_file { ($received:expr) => ( - msg_args_invalid_value!("paths to files", snippet_no_file_at_path!($received)));} +macro_rules! msg_args_invalid_value { + ($expects:expr, $received:expr) => { + msg_invalid_input!(format!( + "expects its arguments to be {}, but was provided {}", + $expects, $received + )) + }; + ($msg:expr) => { + msg_invalid_input!($msg) + }; +} + +#[macro_export] +macro_rules! msg_args_nonexistent_file { + ($received:expr) => { + msg_args_invalid_value!("paths to files", snippet_no_file_at_path!($received)) + }; +} #[macro_export] macro_rules! msg_wrong_number_of_arguments { - () => ( + () => { msg_args_invalid_value!("wrong number of arguments") - ); - ($min:expr, $max:expr) => ( + }; + ($min:expr, $max:expr) => { msg_args_invalid_value!(format!("expects {}-{} arguments", $min, $max)) - ); - ($exact:expr) => ( + }; + ($exact:expr) => { if $exact == 1 { msg_args_invalid_value!("expects 1 argument") } else { msg_args_invalid_value!(format!("expects {} arguments", $exact)) } - ); + }; } // -- message templates : invalid input : input combinations diff --git a/src/uucore/src/utmpx.rs b/src/uucore/src/utmpx.rs index 2cb460fc3..aa6a8ac12 100644 --- a/src/uucore/src/utmpx.rs +++ b/src/uucore/src/utmpx.rs @@ -35,19 +35,19 @@ use super::libc; pub extern crate time; use self::time::{Timespec, Tm}; -use std::io::Result as IOResult; -use std::io::Error as IOError; -use std::ptr; use std::ffi::CString; +use std::io::Error as IOError; +use std::io::Result as IOResult; +use std::ptr; pub use self::ut::*; use libc::utmpx; // pub use libc::getutxid; // pub use libc::getutxline; // pub use libc::pututxline; +pub use libc::endutxent; pub use libc::getutxent; pub use libc::setutxent; -pub use libc::endutxent; #[cfg(any(target_os = "macos", target_os = "linux"))] pub use libc::utmpxname; #[cfg(target_os = "freebsd")] @@ -57,53 +57,56 @@ pub unsafe extern "C" fn utmpxname(_file: *const libc::c_char) -> libc::c_int { // In case the c_char array doesn't end with NULL macro_rules! chars2string { - ($arr:expr) => ( - $arr.iter().take_while(|i| **i > 0).map(|&i| i as u8 as char).collect::() - ) + ($arr:expr) => { + $arr.iter() + .take_while(|i| **i > 0) + .map(|&i| i as u8 as char) + .collect::() + }; } #[cfg(target_os = "linux")] mod ut { pub static DEFAULT_FILE: &str = "/var/run/utmp"; + pub use libc::__UT_HOSTSIZE as UT_HOSTSIZE; pub use libc::__UT_LINESIZE as UT_LINESIZE; pub use libc::__UT_NAMESIZE as UT_NAMESIZE; - pub use libc::__UT_HOSTSIZE as UT_HOSTSIZE; pub const UT_IDSIZE: usize = 4; - pub use libc::EMPTY; - pub use libc::RUN_LVL; + pub use libc::ACCOUNTING; pub use libc::BOOT_TIME; - pub use libc::NEW_TIME; - pub use libc::OLD_TIME; + pub use libc::DEAD_PROCESS; + pub use libc::EMPTY; pub use libc::INIT_PROCESS; pub use libc::LOGIN_PROCESS; + pub use libc::NEW_TIME; + pub use libc::OLD_TIME; + pub use libc::RUN_LVL; pub use libc::USER_PROCESS; - pub use libc::DEAD_PROCESS; - pub use libc::ACCOUNTING; } #[cfg(target_os = "macos")] mod ut { pub static DEFAULT_FILE: &str = "/var/run/utmpx"; - pub use libc::_UTX_LINESIZE as UT_LINESIZE; - pub use libc::_UTX_USERSIZE as UT_NAMESIZE; pub use libc::_UTX_HOSTSIZE as UT_HOSTSIZE; pub use libc::_UTX_IDSIZE as UT_IDSIZE; + pub use libc::_UTX_LINESIZE as UT_LINESIZE; + pub use libc::_UTX_USERSIZE as UT_NAMESIZE; - pub use libc::EMPTY; - pub use libc::RUN_LVL; + pub use libc::ACCOUNTING; pub use libc::BOOT_TIME; - pub use libc::NEW_TIME; - pub use libc::OLD_TIME; + pub use libc::DEAD_PROCESS; + pub use libc::EMPTY; pub use libc::INIT_PROCESS; pub use libc::LOGIN_PROCESS; - pub use libc::USER_PROCESS; - pub use libc::DEAD_PROCESS; - pub use libc::ACCOUNTING; - pub use libc::SIGNATURE; + pub use libc::NEW_TIME; + pub use libc::OLD_TIME; + pub use libc::RUN_LVL; pub use libc::SHUTDOWN_TIME; + pub use libc::SIGNATURE; + pub use libc::USER_PROCESS; } #[cfg(target_os = "freebsd")] @@ -117,15 +120,15 @@ mod ut { pub const UT_IDSIZE: usize = 8; pub const UT_HOSTSIZE: usize = 128; - pub use libc::EMPTY; pub use libc::BOOT_TIME; - pub use libc::OLD_TIME; - pub use libc::NEW_TIME; - pub use libc::USER_PROCESS; + pub use libc::DEAD_PROCESS; + pub use libc::EMPTY; pub use libc::INIT_PROCESS; pub use libc::LOGIN_PROCESS; - pub use libc::DEAD_PROCESS; + pub use libc::NEW_TIME; + pub use libc::OLD_TIME; pub use libc::SHUTDOWN_TIME; + pub use libc::USER_PROCESS; } pub struct Utmpx { diff --git a/src/uucore/src/zero_copy/mod.rs b/src/uucore/src/zero_copy/mod.rs index 70e19a776..f56050a92 100644 --- a/src/uucore/src/zero_copy/mod.rs +++ b/src/uucore/src/zero_copy/mod.rs @@ -5,11 +5,11 @@ use std::io::{self, Write}; mod platform; pub trait AsRawObject { - fn as_raw_object(&self) -> RawObject; + fn as_raw_object(&self) -> RawObject; } -pub trait FromRawObject : Sized { - unsafe fn from_raw_object(obj: RawObject) -> Option; +pub trait FromRawObject: Sized { + unsafe fn from_raw_object(obj: RawObject) -> Option; } // TODO: also make a SpliceWriter that takes an input fd and and output fd and uses splice() to @@ -18,122 +18,129 @@ pub trait FromRawObject : Sized { // transfer to both output fds enum InnerZeroCopyWriter { - Platform(PlatformZeroCopyWriter), - Standard(T), + Platform(PlatformZeroCopyWriter), + Standard(T), } impl Write for InnerZeroCopyWriter { - fn write(&mut self, buf: &[u8]) -> io::Result { - match self { - InnerZeroCopyWriter::Platform(ref mut writer) => writer.write(buf), - InnerZeroCopyWriter::Standard(ref mut writer) => writer.write(buf), - } - } + fn write(&mut self, buf: &[u8]) -> io::Result { + match self { + InnerZeroCopyWriter::Platform(ref mut writer) => writer.write(buf), + InnerZeroCopyWriter::Standard(ref mut writer) => writer.write(buf), + } + } - fn flush(&mut self) -> io::Result<()> { - match self { - InnerZeroCopyWriter::Platform(ref mut writer) => writer.flush(), - InnerZeroCopyWriter::Standard(ref mut writer) => writer.flush(), - } - } + fn flush(&mut self) -> io::Result<()> { + match self { + InnerZeroCopyWriter::Platform(ref mut writer) => writer.flush(), + InnerZeroCopyWriter::Standard(ref mut writer) => writer.flush(), + } + } } pub struct ZeroCopyWriter { - /// This field is never used, but we need it to drop file descriptors - #[allow(dead_code)] - raw_obj_owner: Option, + /// This field is never used, but we need it to drop file descriptors + #[allow(dead_code)] + raw_obj_owner: Option, - inner: InnerZeroCopyWriter, + inner: InnerZeroCopyWriter, } struct TransformContainer<'a, A: Write + AsRawObject + Sized, B: Write + Sized> { - /// This field is never used and probably could be converted into PhantomData, but might be - /// useful for restructuring later (at the moment it's basically left over from an earlier - /// design) - #[allow(dead_code)] - original: Option<&'a mut A>, + /// This field is never used and probably could be converted into PhantomData, but might be + /// useful for restructuring later (at the moment it's basically left over from an earlier + /// design) + #[allow(dead_code)] + original: Option<&'a mut A>, - transformed: Option, + transformed: Option, } impl<'a, A: Write + AsRawObject + Sized, B: Write + Sized> Write for TransformContainer<'a, A, B> { - fn write(&mut self, bytes: &[u8]) -> io::Result { - self.transformed.as_mut().unwrap().write(bytes) - } + fn write(&mut self, bytes: &[u8]) -> io::Result { + self.transformed.as_mut().unwrap().write(bytes) + } - fn flush(&mut self) -> io::Result<()> { - self.transformed.as_mut().unwrap().flush() - } + fn flush(&mut self) -> io::Result<()> { + self.transformed.as_mut().unwrap().flush() + } } -impl<'a, A: Write + AsRawObject + Sized, B: Write + Sized> AsRawObject for TransformContainer<'a, A, B> { - fn as_raw_object(&self) -> RawObject { - panic!("Test should never be used") - } +impl<'a, A: Write + AsRawObject + Sized, B: Write + Sized> AsRawObject + for TransformContainer<'a, A, B> +{ + fn as_raw_object(&self) -> RawObject { + panic!("Test should never be used") + } } impl ZeroCopyWriter { - pub fn new(writer: T) -> Self { - let raw_obj = writer.as_raw_object(); - match unsafe { PlatformZeroCopyWriter::new(raw_obj) } { - Ok(inner) => { - ZeroCopyWriter { - raw_obj_owner: Some(writer), - inner: InnerZeroCopyWriter::Platform(inner), + pub fn new(writer: T) -> Self { + let raw_obj = writer.as_raw_object(); + match unsafe { PlatformZeroCopyWriter::new(raw_obj) } { + Ok(inner) => ZeroCopyWriter { + raw_obj_owner: Some(writer), + inner: InnerZeroCopyWriter::Platform(inner), + }, + _ => { + // creating the splice writer failed for whatever reason, so just make a default + // writer + ZeroCopyWriter { + raw_obj_owner: None, + inner: InnerZeroCopyWriter::Standard(writer), + } } - } - _ => { - // creating the splice writer failed for whatever reason, so just make a default - // writer - ZeroCopyWriter { - raw_obj_owner: None, - inner: InnerZeroCopyWriter::Standard(writer), - } - } - } - } + } + } - pub fn with_default<'a: 'b, 'b, F, W>(writer: &'a mut T, func: F) -> ZeroCopyWriter - where - F: Fn(&'a mut T) -> W, - W: Write + Sized + 'b, - { - let raw_obj = writer.as_raw_object(); - match unsafe { PlatformZeroCopyWriter::new(raw_obj) } { - Ok(inner) => { - ZeroCopyWriter { - raw_obj_owner: Some(TransformContainer { original: Some(writer), transformed: None, }), - inner: InnerZeroCopyWriter::Platform(inner), + pub fn with_default<'a: 'b, 'b, F, W>( + writer: &'a mut T, + func: F, + ) -> ZeroCopyWriter + where + F: Fn(&'a mut T) -> W, + W: Write + Sized + 'b, + { + let raw_obj = writer.as_raw_object(); + match unsafe { PlatformZeroCopyWriter::new(raw_obj) } { + Ok(inner) => ZeroCopyWriter { + raw_obj_owner: Some(TransformContainer { + original: Some(writer), + transformed: None, + }), + inner: InnerZeroCopyWriter::Platform(inner), + }, + _ => { + // XXX: should func actually consume writer and leave it up to the user to save the value? + // maybe provide a default stdin method then? in some cases it would make more sense for the + // value to be consumed + let real_writer = func(writer); + ZeroCopyWriter { + raw_obj_owner: None, + inner: InnerZeroCopyWriter::Standard(TransformContainer { + original: None, + transformed: Some(real_writer), + }), + } } - } - _ => { - // XXX: should func actually consume writer and leave it up to the user to save the value? - // maybe provide a default stdin method then? in some cases it would make more sense for the - // value to be consumed - let real_writer = func(writer); - ZeroCopyWriter { - raw_obj_owner: None, - inner: InnerZeroCopyWriter::Standard(TransformContainer { original: None, transformed: Some(real_writer) }), - } - } - } - } + } + } - // XXX: unsure how to get something like this working without allocating, so not providing it - /*pub fn stdout() -> ZeroCopyWriter { - let mut stdout = io::stdout(); - ZeroCopyWriter::with_default(&mut stdout, |stdout| { - stdout.lock() - }) - }*/ + // XXX: unsure how to get something like this working without allocating, so not providing it + /*pub fn stdout() -> ZeroCopyWriter { + let mut stdout = io::stdout(); + ZeroCopyWriter::with_default(&mut stdout, |stdout| { + stdout.lock() + }) + }*/ } impl Write for ZeroCopyWriter { - fn write(&mut self, buf: &[u8]) -> io::Result { - self.inner.write(buf) - } + fn write(&mut self, buf: &[u8]) -> io::Result { + self.inner.write(buf) + } - fn flush(&mut self) -> io::Result<()> { - self.inner.flush() - } + fn flush(&mut self) -> io::Result<()> { + self.inner.flush() + } } diff --git a/src/uucore/src/zero_copy/platform/default.rs b/src/uucore/src/zero_copy/platform/default.rs index 9d158522c..f6ddfd4bd 100644 --- a/src/uucore/src/zero_copy/platform/default.rs +++ b/src/uucore/src/zero_copy/platform/default.rs @@ -5,17 +5,17 @@ use std::io::{self, Write}; pub struct PlatformZeroCopyWriter; impl PlatformZeroCopyWriter { - pub unsafe fn new(_obj: RawObject) -> Result { - Err(()) - } + pub unsafe fn new(_obj: RawObject) -> Result { + Err(()) + } } impl Write for PlatformZeroCopyWriter { - fn write(&mut self, _bytes: &[u8]) -> io::Result { - panic!("should never occur") - } + fn write(&mut self, _bytes: &[u8]) -> io::Result { + panic!("should never occur") + } - fn flush(&mut self) -> io::Result<()> { - panic!("should never occur") - } + fn flush(&mut self) -> io::Result<()> { + panic!("should never occur") + } } diff --git a/src/uucore/src/zero_copy/platform/linux.rs b/src/uucore/src/zero_copy/platform/linux.rs index 7de9c99ab..36d658ca3 100644 --- a/src/uucore/src/zero_copy/platform/linux.rs +++ b/src/uucore/src/zero_copy/platform/linux.rs @@ -4,102 +4,109 @@ use std::os::unix::io::RawFd; use libc::{O_APPEND, S_IFIFO, S_IFREG}; use nix::errno::Errno; use nix::fcntl::{fcntl, splice, vmsplice, FcntlArg, SpliceFFlags}; -use nix::sys::uio::IoVec; use nix::sys::stat::{fstat, FileStat}; +use nix::sys::uio::IoVec; use nix::unistd::pipe; -use platform_info::{Uname, PlatformInfo}; +use platform_info::{PlatformInfo, Uname}; use crate::zero_copy::{FromRawObject, RawObject}; lazy_static! { - static ref IN_WSL: bool = { - let info = PlatformInfo::new().unwrap(); - info.release().contains("Microsoft") - }; + static ref IN_WSL: bool = { + let info = PlatformInfo::new().unwrap(); + info.release().contains("Microsoft") + }; } pub struct PlatformZeroCopyWriter { - raw_obj: RawObject, - read_pipe: RawFd, - write_pipe: RawFd, - write_fn: fn(&mut PlatformZeroCopyWriter, &[IoVec<&[u8]>], usize) -> io::Result, + raw_obj: RawObject, + read_pipe: RawFd, + write_pipe: RawFd, + write_fn: fn(&mut PlatformZeroCopyWriter, &[IoVec<&[u8]>], usize) -> io::Result, } impl PlatformZeroCopyWriter { - pub unsafe fn new(raw_obj: RawObject) -> nix::Result { - if *IN_WSL { - // apparently WSL hasn't implemented vmsplice(), causing writes to fail - // thus, we will just say zero-copy doesn't work there rather than working - // around it - return Err(nix::Error::from(Errno::EOPNOTSUPP)) - } + pub unsafe fn new(raw_obj: RawObject) -> nix::Result { + if *IN_WSL { + // apparently WSL hasn't implemented vmsplice(), causing writes to fail + // thus, we will just say zero-copy doesn't work there rather than working + // around it + return Err(nix::Error::from(Errno::EOPNOTSUPP)); + } - let stat_info: FileStat = fstat(raw_obj)?; - let access_mode: libc::c_int = fcntl(raw_obj, FcntlArg::F_GETFL)?; + let stat_info: FileStat = fstat(raw_obj)?; + let access_mode: libc::c_int = fcntl(raw_obj, FcntlArg::F_GETFL)?; - let is_regular = (stat_info.st_mode & S_IFREG) != 0; - let is_append = (access_mode & O_APPEND) != 0; - let is_fifo = (stat_info.st_mode & S_IFIFO) != 0; + let is_regular = (stat_info.st_mode & S_IFREG) != 0; + let is_append = (access_mode & O_APPEND) != 0; + let is_fifo = (stat_info.st_mode & S_IFIFO) != 0; - if is_regular && !is_append { - let (read_pipe, write_pipe) = pipe()?; + if is_regular && !is_append { + let (read_pipe, write_pipe) = pipe()?; - Ok(PlatformZeroCopyWriter { - raw_obj, - read_pipe, - write_pipe, - write_fn: write_regular, - }) - } else if is_fifo { - Ok(PlatformZeroCopyWriter { - raw_obj, - read_pipe: Default::default(), - write_pipe: Default::default(), - write_fn: write_fifo, - }) - } else { - // FIXME: how to error? - Err(nix::Error::from(Errno::UnknownErrno)) - } - } + Ok(PlatformZeroCopyWriter { + raw_obj, + read_pipe, + write_pipe, + write_fn: write_regular, + }) + } else if is_fifo { + Ok(PlatformZeroCopyWriter { + raw_obj, + read_pipe: Default::default(), + write_pipe: Default::default(), + write_fn: write_fifo, + }) + } else { + // FIXME: how to error? + Err(nix::Error::from(Errno::UnknownErrno)) + } + } } impl FromRawObject for PlatformZeroCopyWriter { - unsafe fn from_raw_object(obj: RawObject) -> Option { - PlatformZeroCopyWriter::new(obj).ok() - } + unsafe fn from_raw_object(obj: RawObject) -> Option { + PlatformZeroCopyWriter::new(obj).ok() + } } impl Write for PlatformZeroCopyWriter { - fn write(&mut self, buf: &[u8]) -> io::Result { - let iovec = &[IoVec::from_slice(buf)]; + fn write(&mut self, buf: &[u8]) -> io::Result { + let iovec = &[IoVec::from_slice(buf)]; - let func = self.write_fn; - func(self, iovec, buf.len()) - } + let func = self.write_fn; + func(self, iovec, buf.len()) + } - fn flush(&mut self) -> io::Result<()> { - // XXX: not sure if we need anything else - Ok(()) - } + fn flush(&mut self) -> io::Result<()> { + // XXX: not sure if we need anything else + Ok(()) + } } -fn write_regular(writer: &mut PlatformZeroCopyWriter, iovec: &[IoVec<&[u8]>], len: usize) -> io::Result { - vmsplice(writer.write_pipe, iovec, SpliceFFlags::empty()) - .and_then(|_| - splice( - writer.read_pipe, - None, - writer.raw_obj, - None, - len, - SpliceFFlags::empty() - ) - ) - .map_err(|_| io::Error::last_os_error()) +fn write_regular( + writer: &mut PlatformZeroCopyWriter, + iovec: &[IoVec<&[u8]>], + len: usize, +) -> io::Result { + vmsplice(writer.write_pipe, iovec, SpliceFFlags::empty()) + .and_then(|_| { + splice( + writer.read_pipe, + None, + writer.raw_obj, + None, + len, + SpliceFFlags::empty(), + ) + }) + .map_err(|_| io::Error::last_os_error()) } -fn write_fifo(writer: &mut PlatformZeroCopyWriter, iovec: &[IoVec<&[u8]>], _len: usize) -> io::Result { - vmsplice(writer.raw_obj, iovec, SpliceFFlags::empty()) - .map_err(|_| io::Error::last_os_error()) +fn write_fifo( + writer: &mut PlatformZeroCopyWriter, + iovec: &[IoVec<&[u8]>], + _len: usize, +) -> io::Result { + vmsplice(writer.raw_obj, iovec, SpliceFFlags::empty()).map_err(|_| io::Error::last_os_error()) } diff --git a/src/uucore/src/zero_copy/platform/mod.rs b/src/uucore/src/zero_copy/platform/mod.rs index 039b94b00..67e4354c5 100644 --- a/src/uucore/src/zero_copy/platform/mod.rs +++ b/src/uucore/src/zero_copy/platform/mod.rs @@ -1,7 +1,7 @@ -#[cfg(unix)] -pub use self::unix::*; #[cfg(any(target_os = "linux", target_os = "android"))] pub use self::linux::*; +#[cfg(unix)] +pub use self::unix::*; #[cfg(windows)] pub use self::windows::*; @@ -9,10 +9,10 @@ pub use self::windows::*; #[cfg(not(any(target_os = "linux", target_os = "android")))] pub use self::default::*; -#[cfg(unix)] -mod unix; #[cfg(any(target_os = "linux", target_os = "android"))] mod linux; +#[cfg(unix)] +mod unix; #[cfg(windows)] mod windows; diff --git a/src/uucore/src/zero_copy/platform/unix.rs b/src/uucore/src/zero_copy/platform/unix.rs index 0a6fd7e24..1305830e4 100644 --- a/src/uucore/src/zero_copy/platform/unix.rs +++ b/src/uucore/src/zero_copy/platform/unix.rs @@ -5,14 +5,14 @@ use crate::zero_copy::{AsRawObject, FromRawObject}; pub type RawObject = RawFd; impl AsRawObject for T { - fn as_raw_object(&self) -> RawObject { - self.as_raw_fd() - } + fn as_raw_object(&self) -> RawObject { + self.as_raw_fd() + } } // FIXME: check if this works right impl FromRawObject for T { - unsafe fn from_raw_object(obj: RawObject) -> Option { - Some(T::from_raw_fd(obj)) - } + unsafe fn from_raw_object(obj: RawObject) -> Option { + Some(T::from_raw_fd(obj)) + } } diff --git a/src/uucore/src/zero_copy/platform/windows.rs b/src/uucore/src/zero_copy/platform/windows.rs index 745607267..ef86e8635 100644 --- a/src/uucore/src/zero_copy/platform/windows.rs +++ b/src/uucore/src/zero_copy/platform/windows.rs @@ -5,15 +5,15 @@ use crate::zero_copy::{AsRawObject, FromRawObject}; pub type RawObject = RawHandle; impl AsRawObject for T { - fn as_raw_object(&self) -> RawObject { - self.as_raw_handle() - } + fn as_raw_object(&self) -> RawObject { + self.as_raw_handle() + } } impl FromRawObject for T { - unsafe fn from_raw_object(obj: RawObject) -> Option { - Some(T::from_raw_handle(obj)) - } + unsafe fn from_raw_object(obj: RawObject) -> Option { + Some(T::from_raw_handle(obj)) + } } // TODO: see if there's some zero-copy stuff in Windows From b0d02e7f43841ffaf76893994317916e04ee6036 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Fri, 24 Apr 2020 17:18:23 -0500 Subject: [PATCH 159/606] change ~ reorganize code layout/structure --- src/uucore/Cargo.toml | 4 +- src/uucore/src/{lib.rs => lib/features.rs} | 45 +++-------- src/uucore/src/{ => lib/features}/encoding.rs | 4 + src/uucore/src/{ => lib/features}/entries.rs | 0 src/uucore/src/{ => lib/features}/fs.rs | 4 +- src/uucore/src/{ => lib/features}/mode.rs | 4 +- .../src/{ => lib/features}/parse_time.rs | 0 src/uucore/src/{ => lib/features}/process.rs | 1 - src/uucore/src/{ => lib/features}/signals.rs | 0 src/uucore/src/{ => lib/features}/utmpx.rs | 3 - src/uucore/src/{ => lib/features}/wide.rs | 0 .../mod.rs => lib/features/zero_copy.rs} | 0 .../features/zero_copy/platform.rs} | 0 .../features}/zero_copy/platform/default.rs | 2 +- .../features}/zero_copy/platform/linux.rs | 4 +- .../features}/zero_copy/platform/unix.rs | 2 +- .../features}/zero_copy/platform/windows.rs | 2 +- src/uucore/src/lib/lib.rs | 75 +++++++++++++++++++ src/uucore/src/{ => lib}/macros.rs | 34 +++++++++ src/uucore/src/lib/mods.rs | 6 ++ src/uucore/src/{ => lib/mods}/coreopts.rs | 4 +- src/uucore/src/{ => lib/mods}/panic.rs | 0 22 files changed, 141 insertions(+), 53 deletions(-) rename src/uucore/src/{lib.rs => lib/features.rs} (51%) rename src/uucore/src/{ => lib/features}/encoding.rs (98%) rename src/uucore/src/{ => lib/features}/entries.rs (100%) rename src/uucore/src/{ => lib/features}/fs.rs (99%) rename src/uucore/src/{ => lib/features}/mode.rs (97%) rename src/uucore/src/{ => lib/features}/parse_time.rs (100%) rename src/uucore/src/{ => lib/features}/process.rs (99%) rename src/uucore/src/{ => lib/features}/signals.rs (100%) rename src/uucore/src/{ => lib/features}/utmpx.rs (99%) rename src/uucore/src/{ => lib/features}/wide.rs (100%) rename src/uucore/src/{zero_copy/mod.rs => lib/features/zero_copy.rs} (100%) rename src/uucore/src/{zero_copy/platform/mod.rs => lib/features/zero_copy/platform.rs} (100%) rename src/uucore/src/{ => lib/features}/zero_copy/platform/default.rs (90%) rename src/uucore/src/{ => lib/features}/zero_copy/platform/linux.rs (97%) rename src/uucore/src/{ => lib/features}/zero_copy/platform/unix.rs (85%) rename src/uucore/src/{ => lib/features}/zero_copy/platform/windows.rs (87%) create mode 100644 src/uucore/src/lib/lib.rs rename src/uucore/src/{ => lib}/macros.rs (85%) create mode 100644 src/uucore/src/lib/mods.rs rename src/uucore/src/{ => lib/mods}/coreopts.rs (98%) rename src/uucore/src/{ => lib/mods}/panic.rs (100%) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 5150212ae..f26ba6418 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -15,6 +15,9 @@ license = "MIT" appveyor = { repository = "uutils/uucore" } travis-ci = { repository = "uutils/uucore" } +[lib] +path="src/lib/lib.rs" + [dependencies] dunce = "1.0.0" getopts = "<= 0.2.21" @@ -34,7 +37,6 @@ data-encoding = { version = "~2.1", optional = true } # * libc: initial utmp support added in 0.2.15, but 0.2.68 break the build for MinSRV 1.31.0 libc = { version = "0.2.15, <= 0.2.66", optional = true } - [target.'cfg(target_os = "redox")'.dependencies] termion = "1.5" diff --git a/src/uucore/src/lib.rs b/src/uucore/src/lib/features.rs similarity index 51% rename from src/uucore/src/lib.rs rename to src/uucore/src/lib/features.rs index 4362758ad..438963135 100644 --- a/src/uucore/src/lib.rs +++ b/src/uucore/src/lib/features.rs @@ -1,33 +1,6 @@ -extern crate wild; +// features ~ feature-gated modules (core/bundler file) -pub fn args() -> impl Iterator { - wild::args() -} - -#[cfg(feature = "failure")] -extern crate failure; -#[cfg(feature = "libc")] -pub extern crate libc; -#[cfg(feature = "winapi")] -pub extern crate winapi; -#[cfg(feature = "failure_derive")] -#[macro_use] -extern crate failure_derive; -#[cfg(feature = "nix")] -extern crate nix; -#[cfg(all(feature = "lazy_static", target_os = "linux"))] -#[macro_use] -extern crate lazy_static; -#[cfg(feature = "platform-info")] -extern crate platform_info; - -#[macro_use] -mod macros; - -#[macro_use] -pub mod coreopts; - -pub mod panic; +// spell-checker:ignore (uucore/uutils) coreopts libc musl utmpx uucore uutils winapi #[cfg(feature = "encoding")] pub mod encoding; @@ -35,11 +8,16 @@ pub mod encoding; pub mod fs; #[cfg(feature = "parse_time")] pub mod parse_time; +#[cfg(feature = "zero-copy")] +pub mod zero_copy; -#[cfg(all(unix, feature = "entries"))] -pub mod entries; +// * (platform-specific) feature-gated modules +// ** non-windows #[cfg(all(not(windows), feature = "mode"))] pub mod mode; +// ** unix-only +#[cfg(all(unix, feature = "entries"))] +pub mod entries; #[cfg(all(unix, feature = "process"))] pub mod process; #[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))] @@ -51,9 +29,6 @@ pub mod signals; feature = "utmpx" ))] pub mod utmpx; - -#[cfg(feature = "zero-copy")] -pub mod zero_copy; - +// ** windows-only #[cfg(all(windows, feature = "wide"))] pub mod wide; diff --git a/src/uucore/src/encoding.rs b/src/uucore/src/lib/features/encoding.rs similarity index 98% rename from src/uucore/src/encoding.rs rename to src/uucore/src/lib/features/encoding.rs index b5b233e4d..8544eb61c 100644 --- a/src/uucore/src/encoding.rs +++ b/src/uucore/src/lib/features/encoding.rs @@ -7,7 +7,11 @@ // extern crate data_encoding; +extern crate failure; + use self::data_encoding::{DecodeError, BASE32, BASE64}; + +use failure::Fail; use std::io::{self, Read, Write}; #[derive(Fail, Debug)] diff --git a/src/uucore/src/entries.rs b/src/uucore/src/lib/features/entries.rs similarity index 100% rename from src/uucore/src/entries.rs rename to src/uucore/src/lib/features/entries.rs diff --git a/src/uucore/src/fs.rs b/src/uucore/src/lib/features/fs.rs similarity index 99% rename from src/uucore/src/fs.rs rename to src/uucore/src/lib/features/fs.rs index edd661264..d1c0a3f7c 100644 --- a/src/uucore/src/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -12,9 +12,7 @@ extern crate dunce; extern crate termion; #[cfg(unix)] -use super::libc; -#[cfg(unix)] -use super::libc::{ +use libc::{ mode_t, S_IRGRP, S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S_IXOTH, S_IXUSR, }; diff --git a/src/uucore/src/mode.rs b/src/uucore/src/lib/features/mode.rs similarity index 97% rename from src/uucore/src/mode.rs rename to src/uucore/src/lib/features/mode.rs index 26e237a7b..0b43fdb02 100644 --- a/src/uucore/src/mode.rs +++ b/src/uucore/src/lib/features/mode.rs @@ -6,8 +6,6 @@ // file that was distributed with this source code. // -use std::error::Error; - pub fn parse_numeric(fperm: u32, mut mode: &str) -> Result { let (op, pos) = parse_op(mode, Some('='))?; mode = mode[pos..].trim_start_matches('0'); @@ -21,7 +19,7 @@ pub fn parse_numeric(fperm: u32, mut mode: &str) -> Result { '=' => change, _ => unreachable!(), }), - Err(err) => Err(err.description().to_owned()), + Err(err) => Err(err.to_string()), } } } diff --git a/src/uucore/src/parse_time.rs b/src/uucore/src/lib/features/parse_time.rs similarity index 100% rename from src/uucore/src/parse_time.rs rename to src/uucore/src/lib/features/parse_time.rs diff --git a/src/uucore/src/process.rs b/src/uucore/src/lib/features/process.rs similarity index 99% rename from src/uucore/src/process.rs rename to src/uucore/src/lib/features/process.rs index 11888ae66..d0ca39ff4 100644 --- a/src/uucore/src/process.rs +++ b/src/uucore/src/lib/features/process.rs @@ -7,7 +7,6 @@ // that was distributed with this source code. // -use super::libc; use libc::{c_int, gid_t, pid_t, uid_t}; use std::fmt; use std::io; diff --git a/src/uucore/src/signals.rs b/src/uucore/src/lib/features/signals.rs similarity index 100% rename from src/uucore/src/signals.rs rename to src/uucore/src/lib/features/signals.rs diff --git a/src/uucore/src/utmpx.rs b/src/uucore/src/lib/features/utmpx.rs similarity index 99% rename from src/uucore/src/utmpx.rs rename to src/uucore/src/lib/features/utmpx.rs index aa6a8ac12..f1b692e7c 100644 --- a/src/uucore/src/utmpx.rs +++ b/src/uucore/src/lib/features/utmpx.rs @@ -31,7 +31,6 @@ //! } //! ``` -use super::libc; pub extern crate time; use self::time::{Timespec, Tm}; @@ -111,8 +110,6 @@ mod ut { #[cfg(target_os = "freebsd")] mod ut { - use super::libc; - pub static DEFAULT_FILE: &str = ""; pub const UT_LINESIZE: usize = 16; diff --git a/src/uucore/src/wide.rs b/src/uucore/src/lib/features/wide.rs similarity index 100% rename from src/uucore/src/wide.rs rename to src/uucore/src/lib/features/wide.rs diff --git a/src/uucore/src/zero_copy/mod.rs b/src/uucore/src/lib/features/zero_copy.rs similarity index 100% rename from src/uucore/src/zero_copy/mod.rs rename to src/uucore/src/lib/features/zero_copy.rs diff --git a/src/uucore/src/zero_copy/platform/mod.rs b/src/uucore/src/lib/features/zero_copy/platform.rs similarity index 100% rename from src/uucore/src/zero_copy/platform/mod.rs rename to src/uucore/src/lib/features/zero_copy/platform.rs diff --git a/src/uucore/src/zero_copy/platform/default.rs b/src/uucore/src/lib/features/zero_copy/platform/default.rs similarity index 90% rename from src/uucore/src/zero_copy/platform/default.rs rename to src/uucore/src/lib/features/zero_copy/platform/default.rs index f6ddfd4bd..47239a361 100644 --- a/src/uucore/src/zero_copy/platform/default.rs +++ b/src/uucore/src/lib/features/zero_copy/platform/default.rs @@ -1,4 +1,4 @@ -use crate::zero_copy::RawObject; +use crate::features::zero_copy::RawObject; use std::io::{self, Write}; diff --git a/src/uucore/src/zero_copy/platform/linux.rs b/src/uucore/src/lib/features/zero_copy/platform/linux.rs similarity index 97% rename from src/uucore/src/zero_copy/platform/linux.rs rename to src/uucore/src/lib/features/zero_copy/platform/linux.rs index 36d658ca3..4f2412226 100644 --- a/src/uucore/src/zero_copy/platform/linux.rs +++ b/src/uucore/src/lib/features/zero_copy/platform/linux.rs @@ -9,9 +9,9 @@ use nix::sys::uio::IoVec; use nix::unistd::pipe; use platform_info::{PlatformInfo, Uname}; -use crate::zero_copy::{FromRawObject, RawObject}; +use crate::features::zero_copy::{FromRawObject, RawObject}; -lazy_static! { +lazy_static::lazy_static! { static ref IN_WSL: bool = { let info = PlatformInfo::new().unwrap(); info.release().contains("Microsoft") diff --git a/src/uucore/src/zero_copy/platform/unix.rs b/src/uucore/src/lib/features/zero_copy/platform/unix.rs similarity index 85% rename from src/uucore/src/zero_copy/platform/unix.rs rename to src/uucore/src/lib/features/zero_copy/platform/unix.rs index 1305830e4..553549c9b 100644 --- a/src/uucore/src/zero_copy/platform/unix.rs +++ b/src/uucore/src/lib/features/zero_copy/platform/unix.rs @@ -1,6 +1,6 @@ use std::os::unix::io::{AsRawFd, FromRawFd, RawFd}; -use crate::zero_copy::{AsRawObject, FromRawObject}; +use crate::features::zero_copy::{AsRawObject, FromRawObject}; pub type RawObject = RawFd; diff --git a/src/uucore/src/zero_copy/platform/windows.rs b/src/uucore/src/lib/features/zero_copy/platform/windows.rs similarity index 87% rename from src/uucore/src/zero_copy/platform/windows.rs rename to src/uucore/src/lib/features/zero_copy/platform/windows.rs index ef86e8635..8134bfda3 100644 --- a/src/uucore/src/zero_copy/platform/windows.rs +++ b/src/uucore/src/lib/features/zero_copy/platform/windows.rs @@ -1,6 +1,6 @@ use std::os::windows::io::{AsRawHandle, FromRawHandle, RawHandle}; -use crate::zero_copy::{AsRawObject, FromRawObject}; +use crate::features::zero_copy::{AsRawObject, FromRawObject}; pub type RawObject = RawHandle; diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs new file mode 100644 index 000000000..d9e341976 --- /dev/null +++ b/src/uucore/src/lib/lib.rs @@ -0,0 +1,75 @@ +// library ~ (core/bundler file) + +// spell-checker:ignore (uucore/uutils) coreopts libc musl utmpx uucore uutils winapi + +//## external crates + +extern crate wild; + +// * feature-gated external crates +#[cfg(feature = "failure")] +extern crate failure; +#[cfg(feature = "failure_derive")] +extern crate failure_derive; +#[cfg(all(feature = "lazy_static", target_os = "linux"))] +extern crate lazy_static; +#[cfg(feature = "nix")] +extern crate nix; +#[cfg(feature = "platform-info")] +extern crate platform_info; + +// * feature-gated external crates (re-shared as public internal modules) +#[cfg(feature = "libc")] +pub extern crate libc; +#[cfg(feature = "winapi")] +pub extern crate winapi; + +//## internal modules + +mod macros; // crate macros (macro_rules-type; exported to `crate::...`) + +mod features; // feature-gated code modules +mod mods; // core cross-platform modules + +// * cross-platform modules +pub use mods::coreopts; +pub use mods::panic; + +// * feature-gated modules +#[cfg(feature = "encoding")] +pub use features::encoding; +#[cfg(feature = "fs")] +pub use features::fs; +#[cfg(feature = "parse_time")] +pub use features::parse_time; +#[cfg(feature = "zero-copy")] +pub use features::zero_copy; + +// * (platform-specific) feature-gated modules +// ** non-windows +#[cfg(all(not(windows), feature = "mode"))] +pub use features::mode; +// ** unix-only +#[cfg(all(unix, feature = "entries"))] +pub use features::entries; +#[cfg(all(unix, feature = "process"))] +pub use features::process; +#[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))] +pub use features::signals; +#[cfg(all( + unix, + not(target_os = "fuchsia"), + not(target_env = "musl"), + feature = "utmpx" +))] +pub use features::utmpx; +// ** windows-only +#[cfg(all(windows, feature = "wide"))] +pub use features::wide; + +//## core functions + +// args() ... +pub fn args() -> impl Iterator { + wild::args() +} diff --git a/src/uucore/src/macros.rs b/src/uucore/src/lib/macros.rs similarity index 85% rename from src/uucore/src/macros.rs rename to src/uucore/src/lib/macros.rs index 5356d9d5d..f5bef7565 100644 --- a/src/uucore/src/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -7,6 +7,40 @@ * file that was distributed with this source code. */ +// #[macro_export] +// macro_rules! main { ($($arg:tt)+) => ({ +// extern crate uu_arch; +// use std::io::Write; +// use uu_arch::uumain; + +// fn main() { +// uucore::panic::install_sigpipe_hook(); + +// let code = uumain(uucore::args().collect()); +// // Since stdout is line-buffered by default, we need to ensure any pending +// // writes are flushed before exiting. Ideally, this should be enforced by +// // each utility. +// // +// // See: https://github.com/rust-lang/rust/issues/23818 +// // +// std::io::stdout().flush().expect("could not flush stdout"); +// std::process::exit(code); +// } +// })} + +// extern crate proc_macro; +// use proc_macro::TokenStream; +// #[proc_macro_attribute] +// pub fn hello(attr: TokenStream, item: TokenStream) -> TokenStream { +// let result = quote! { +// fn main() { +// uucore::panic::install_sigpipe_hook(); +// std::io::stdout().flush().expect("could not flush stdout"); +// std::process::exit(code); +// } +// }; +// } + #[macro_export] macro_rules! executable( () => ({ diff --git a/src/uucore/src/lib/mods.rs b/src/uucore/src/lib/mods.rs new file mode 100644 index 000000000..542db5cd1 --- /dev/null +++ b/src/uucore/src/lib/mods.rs @@ -0,0 +1,6 @@ +// mods ~ cross-platforms modules (core/bundler file) + +// spell-checker:ignore (uucore/uutils) coreopts libc musl utmpx uucore uutils winapi + +pub mod coreopts; +pub mod panic; diff --git a/src/uucore/src/coreopts.rs b/src/uucore/src/lib/mods/coreopts.rs similarity index 98% rename from src/uucore/src/coreopts.rs rename to src/uucore/src/lib/mods/coreopts.rs index 8c62ec9f2..a7ae0d399 100644 --- a/src/uucore/src/coreopts.rs +++ b/src/uucore/src/lib/mods/coreopts.rs @@ -109,10 +109,10 @@ impl<'a> CoreOptions<'a> { usage_str, self.help_text.long_help ); - exit!(0); + crate::exit!(0); } else if matches.opt_present("version") { println!("{} {}", self.help_text.name, self.help_text.version); - exit!(0); + crate::exit!(0); } matches } diff --git a/src/uucore/src/panic.rs b/src/uucore/src/lib/mods/panic.rs similarity index 100% rename from src/uucore/src/panic.rs rename to src/uucore/src/lib/mods/panic.rs From 503cc53014beceed747ba370b7ad6fa08ea8f70c Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 6 May 2020 12:57:30 -0500 Subject: [PATCH 160/606] change ~ improve naming and documentation of default SIGPIPE handling --- src/uucore/src/lib/mods/panic.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/uucore/src/lib/mods/panic.rs b/src/uucore/src/lib/mods/panic.rs index 5cccca4ba..2f8fb519e 100644 --- a/src/uucore/src/lib/mods/panic.rs +++ b/src/uucore/src/lib/mods/panic.rs @@ -1,6 +1,12 @@ +// spell-checker:ignore () SIGPIPE maint uutils + use std::panic; -pub fn install_sigpipe_hook() { +//## SIGPIPE handling background/discussions ... +//* `uutils` ~ , +//* rust and `rg` ~ , , + +pub fn mute_sigpipe_panic() { let hook = panic::take_hook(); panic::set_hook(Box::new(move |info| { if let Some(res) = info.payload().downcast_ref::() { From 04320634799da9325ff69500a3e05ced0945753d Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 23 May 2020 12:09:40 -0500 Subject: [PATCH 161/606] change ~ add proc-macros module (uucore_procs) with `uucore_procs::main()` - `uucore_procs::main!(UUTIL_NAME)` allows simple, consistent instantiation of `main()` for uutils --- src/uucore/Cargo.toml | 3 ++ src/uucore/src/uucore_procs/Cargo.toml | 18 ++++++++ src/uucore/src/uucore_procs/src/lib.rs | 64 ++++++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 src/uucore/src/uucore_procs/Cargo.toml create mode 100644 src/uucore/src/uucore_procs/src/lib.rs diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index f26ba6418..309c7ebfa 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -18,6 +18,9 @@ travis-ci = { repository = "uutils/uucore" } [lib] path="src/lib/lib.rs" +[workspace] +members=["src/uucore_procs"] + [dependencies] dunce = "1.0.0" getopts = "<= 0.2.21" diff --git a/src/uucore/src/uucore_procs/Cargo.toml b/src/uucore/src/uucore_procs/Cargo.toml new file mode 100644 index 000000000..0e1f9eb6f --- /dev/null +++ b/src/uucore/src/uucore_procs/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "uucore_procs" +version = "0.0.2" +authors = [] +license = "MIT" +description = "`uucore` proc-macros for use by various uutils projects" + +[lib] +proc-macro = true + +[dependencies] +proc-macro2 = "1.0" +quote = "1.0" +syn = { version="1.0" } ## debug: use `features=["extra-traits"]` to add Debug traits to structs (for `println!("{:?}", ...)`) + +[features] +default = [] +debug = [] diff --git a/src/uucore/src/uucore_procs/src/lib.rs b/src/uucore/src/uucore_procs/src/lib.rs new file mode 100644 index 000000000..029dd0fe2 --- /dev/null +++ b/src/uucore/src/uucore_procs/src/lib.rs @@ -0,0 +1,64 @@ +extern crate proc_macro; + +// spell-checker:ignore () sigpipe uucore uumain + +// ref: @@ +// ref: [path construction from LitStr](https://oschwald.github.io/maxminddb-rust/syn/struct.LitStr.html) @@ + +struct Tokens { + expr: syn::Expr, +} + +impl syn::parse::Parse for Tokens { + fn parse(input: syn::parse::ParseStream) -> syn::Result { + Ok(Tokens { + expr: input.parse()?, + }) + } +} + +#[proc_macro] +pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream { + let Tokens { expr } = syn::parse_macro_input!(stream as Tokens); + // eprintln!("expr={:?}", expr); + let expr = match expr { + syn::Expr::Lit(expr) => { + // eprintln!("found Expr::Lit => {:?}", expr); + match expr.lit { + syn::Lit::Str(ref lit) => { + let mut s = lit.value(); + if !s.ends_with("::uumain") { + s += "::uumain"; + } + syn::LitStr::new(&s, proc_macro2::Span::call_site()) + .parse() + .unwrap() + } + _ => panic!(), + } + } + syn::Expr::Path(expr) => { + // eprintln!("found Expr::Path => {:?}", expr); + // let i = &expr.path.segments.last().unwrap().ident; + // eprintln!("... i => {:?}", i); + if &expr.path.segments.last().unwrap().ident.to_string() != "uumain" { + syn::parse_quote!( #expr::uumain ) + } else { + expr + } + } + _ => panic!(), + }; + let f = quote::quote! { #expr(uucore::args().collect()) }; + // eprintln!("f = {:?}", f); + let result = quote::quote! { + fn main() { + use std::io::Write; + uucore::panic::install_sigpipe_hook(); + let code = #f; + std::io::stdout().flush().expect("could not flush stdout"); + std::process::exit(code); + } + }; + proc_macro::TokenStream::from(result) +} From c32ff9e8bbfe58bdae8c047a044ba8a09d75e6e0 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 23 May 2020 12:23:05 -0500 Subject: [PATCH 162/606] change ~ use updated SIGPIPE in procs --- src/uucore/src/uucore_procs/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/uucore_procs/src/lib.rs b/src/uucore/src/uucore_procs/src/lib.rs index 029dd0fe2..cf675a5ab 100644 --- a/src/uucore/src/uucore_procs/src/lib.rs +++ b/src/uucore/src/uucore_procs/src/lib.rs @@ -54,7 +54,7 @@ pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream { let result = quote::quote! { fn main() { use std::io::Write; - uucore::panic::install_sigpipe_hook(); + uucore::panic::mute_sigpipe_panic(); let code = #f; std::io::stdout().flush().expect("could not flush stdout"); std::process::exit(code); From cf2fcd8dc1f305f93096ee4d7b22ce0d17cce1b1 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 6 May 2020 12:59:53 -0500 Subject: [PATCH 163/606] docs/uucore_macros ~ improve commentary/documentation --- src/uucore/src/uucore_procs/src/lib.rs | 48 +++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/uucore/src/uucore_procs/src/lib.rs b/src/uucore/src/uucore_procs/src/lib.rs index cf675a5ab..9b49314f6 100644 --- a/src/uucore/src/uucore_procs/src/lib.rs +++ b/src/uucore/src/uucore_procs/src/lib.rs @@ -1,9 +1,10 @@ extern crate proc_macro; -// spell-checker:ignore () sigpipe uucore uumain +// spell-checker:ignore () SIGPIPE uucore uumain uutils -// ref: @@ -// ref: [path construction from LitStr](https://oschwald.github.io/maxminddb-rust/syn/struct.LitStr.html) @@ +//## rust proc-macro background info +//* ref: @@ +//* ref: [path construction from LitStr](https://oschwald.github.io/maxminddb-rust/syn/struct.LitStr.html) @@ struct Tokens { expr: syn::Expr, @@ -17,30 +18,29 @@ impl syn::parse::Parse for Tokens { } } +// main!( EXPR ) +// generates a `main()` function for utilities within the uutils group +// EXPR == syn::Expr::Lit::String | syn::Expr::Path::Ident ~ EXPR contains the location of the utility `uumain()` function +//* for future use of "eager" macros and more generic use, EXPR may be in either STRING or IDENT form +//* for ease-of-use, the trailing "::uumain" is optional and will be added if needed #[proc_macro] pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream { let Tokens { expr } = syn::parse_macro_input!(stream as Tokens); - // eprintln!("expr={:?}", expr); + // match EXPR as a string literal or an ident path, o/w panic!() let expr = match expr { - syn::Expr::Lit(expr) => { - // eprintln!("found Expr::Lit => {:?}", expr); - match expr.lit { - syn::Lit::Str(ref lit) => { - let mut s = lit.value(); - if !s.ends_with("::uumain") { - s += "::uumain"; - } - syn::LitStr::new(&s, proc_macro2::Span::call_site()) - .parse() - .unwrap() + syn::Expr::Lit(expr) => match expr.lit { + syn::Lit::Str(ref lit) => { + let mut s = lit.value(); + if !s.ends_with("::uumain") { + s += "::uumain"; } - _ => panic!(), + syn::LitStr::new(&s, proc_macro2::Span::call_site()) + .parse() + .unwrap() } - } + _ => panic!(), + }, syn::Expr::Path(expr) => { - // eprintln!("found Expr::Path => {:?}", expr); - // let i = &expr.path.segments.last().unwrap().ident; - // eprintln!("... i => {:?}", i); if &expr.path.segments.last().unwrap().ident.to_string() != "uumain" { syn::parse_quote!( #expr::uumain ) } else { @@ -50,13 +50,13 @@ pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream { _ => panic!(), }; let f = quote::quote! { #expr(uucore::args().collect()) }; - // eprintln!("f = {:?}", f); + // generate a uutils utility `main()` function, tailored for the calling utility let result = quote::quote! { fn main() { use std::io::Write; - uucore::panic::mute_sigpipe_panic(); - let code = #f; - std::io::stdout().flush().expect("could not flush stdout"); + uucore::panic::mute_sigpipe_panic(); // suppress extraneous error output for SIGPIPE failures/panics + let code = #f; // execute utility code + std::io::stdout().flush().expect("could not flush stdout"); // (defensively) flush stdout for utility prior to exit; see std::process::exit(code); } }; From a352657e1f6fb8b9fe5809ed688112d199225917 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 6 May 2020 14:00:06 -0500 Subject: [PATCH 164/606] build/uucore_procs ~ add/improve debug infrastructure - add proc_dbg! macro - use debug feature to trigger debug traits for the syn crate --- src/uucore/src/uucore_procs/Cargo.toml | 5 +++-- src/uucore/src/uucore_procs/src/lib.rs | 29 +++++++++++++++++++++----- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/uucore/src/uucore_procs/Cargo.toml b/src/uucore/src/uucore_procs/Cargo.toml index 0e1f9eb6f..62c60394e 100644 --- a/src/uucore/src/uucore_procs/Cargo.toml +++ b/src/uucore/src/uucore_procs/Cargo.toml @@ -11,8 +11,9 @@ proc-macro = true [dependencies] proc-macro2 = "1.0" quote = "1.0" -syn = { version="1.0" } ## debug: use `features=["extra-traits"]` to add Debug traits to structs (for `println!("{:?}", ...)`) +syn = { version="1.0" } [features] default = [] -debug = [] +## non-default features +debug = ["syn/extra-traits"] ## add Debug traits to syn structs (for `println!("{:?}", ...)`) diff --git a/src/uucore/src/uucore_procs/src/lib.rs b/src/uucore/src/uucore_procs/src/lib.rs index 9b49314f6..f1409f19f 100644 --- a/src/uucore/src/uucore_procs/src/lib.rs +++ b/src/uucore/src/uucore_procs/src/lib.rs @@ -6,6 +6,30 @@ extern crate proc_macro; //* ref: @@ //* ref: [path construction from LitStr](https://oschwald.github.io/maxminddb-rust/syn/struct.LitStr.html) @@ +//## proc_dbg macro +//* used to help debug the compile-time proc_macro code + +#[cfg(feature = "debug")] +macro_rules! proc_dbg { + ($x:expr) => { + dbg!($x) + }; +} +#[cfg(not(feature = "debug"))] +macro_rules! proc_dbg { + ($x:expr) => { + std::convert::identity($x) + }; +} + +//## main!() + +// main!( EXPR ) +// generates a `main()` function for utilities within the uutils group +// EXPR == syn::Expr::Lit::String | syn::Expr::Path::Ident ~ EXPR contains the location of the utility `uumain()` function +//* for future use of "eager" macros and more generic use, EXPR may be in either STRING or IDENT form +//* for ease-of-use, the trailing "::uumain" is optional and will be added if needed + struct Tokens { expr: syn::Expr, } @@ -18,11 +42,6 @@ impl syn::parse::Parse for Tokens { } } -// main!( EXPR ) -// generates a `main()` function for utilities within the uutils group -// EXPR == syn::Expr::Lit::String | syn::Expr::Path::Ident ~ EXPR contains the location of the utility `uumain()` function -//* for future use of "eager" macros and more generic use, EXPR may be in either STRING or IDENT form -//* for ease-of-use, the trailing "::uumain" is optional and will be added if needed #[proc_macro] pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream { let Tokens { expr } = syn::parse_macro_input!(stream as Tokens); From ad30781c0c2b5901145e3dbc21305ef513b26625 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 23 May 2020 18:44:03 -0500 Subject: [PATCH 165/606] build/uucore_procs ~ add debugging statements --- src/uucore/src/uucore_procs/src/lib.rs | 46 ++++++++++++++------------ 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/uucore/src/uucore_procs/src/lib.rs b/src/uucore/src/uucore_procs/src/lib.rs index f1409f19f..3b671ec11 100644 --- a/src/uucore/src/uucore_procs/src/lib.rs +++ b/src/uucore/src/uucore_procs/src/lib.rs @@ -26,9 +26,9 @@ macro_rules! proc_dbg { // main!( EXPR ) // generates a `main()` function for utilities within the uutils group -// EXPR == syn::Expr::Lit::String | syn::Expr::Path::Ident ~ EXPR contains the location of the utility `uumain()` function -//* for future use of "eager" macros and more generic use, EXPR may be in either STRING or IDENT form -//* for ease-of-use, the trailing "::uumain" is optional and will be added if needed +// EXPR == syn::Expr::Lit::String | syn::Expr::Path::Ident ~ EXPR contains the lexical path to the utility `uumain()` function +//* NOTE: EXPR is ultimately expected to be a multi-segment lexical path (eg, `crate::func`); so, if a single segment path is provided, a trailing "::uumain" is automatically added +//* for more generic use (and future use of "eager" macros), EXPR may be in either STRING or IDENT form struct Tokens { expr: syn::Expr, @@ -45,30 +45,32 @@ impl syn::parse::Parse for Tokens { #[proc_macro] pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream { let Tokens { expr } = syn::parse_macro_input!(stream as Tokens); + proc_dbg!(&expr); + + const ARG_PANIC_TEXT: &str = "expected ident lexical path (or a literal string version) to 'uumain()' as argument"; + // match EXPR as a string literal or an ident path, o/w panic!() - let expr = match expr { - syn::Expr::Lit(expr) => match expr.lit { - syn::Lit::Str(ref lit) => { - let mut s = lit.value(); - if !s.ends_with("::uumain") { - s += "::uumain"; - } - syn::LitStr::new(&s, proc_macro2::Span::call_site()) - .parse() - .unwrap() + let mut expr = match expr { + syn::Expr::Lit(expr_lit) => { + match expr_lit.lit { + syn::Lit::Str(ref lit_str) => { lit_str.parse::().unwrap() }, + _ => panic!(ARG_PANIC_TEXT), } - _ => panic!(), }, - syn::Expr::Path(expr) => { - if &expr.path.segments.last().unwrap().ident.to_string() != "uumain" { - syn::parse_quote!( #expr::uumain ) - } else { - expr - } - } - _ => panic!(), + syn::Expr::Path(expr_path) => { expr_path }, + _ => panic!(ARG_PANIC_TEXT), }; + proc_dbg!(&expr); + + // for a single segment ExprPath argument, add trailing '::uumain' segment + if expr.path.segments.len() < 2 { + expr = syn::parse_quote!( #expr::uumain ); + }; + proc_dbg!(&expr); + let f = quote::quote! { #expr(uucore::args().collect()) }; + proc_dbg!(&f); + // generate a uutils utility `main()` function, tailored for the calling utility let result = quote::quote! { fn main() { From 246e4427e4a922857162f89667aa78e4f7c7d4bc Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 25 Apr 2020 01:00:23 -0500 Subject: [PATCH 166/606] docs/build ~ polish descriptions and crate meta-information in Cargo.toml --- src/uucore/Cargo.toml | 8 ++++---- src/uucore/src/uucore_procs/Cargo.toml | 2 +- src/uucore/src/uucore_procs/src/lib.rs | 13 ++++++------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 309c7ebfa..1dbe6bb1a 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -2,14 +2,14 @@ name = "uucore" version = "0.0.2" authors = ["uutils developers"] -description = "Common cross-platform code used by various uutils projects" +license = "MIT" +description = "uutils ~ 'core' uutils code library (cross-platform)" homepage = "https://github.com/uutils/uucore" repository = "https://github.com/uutils/uucore" readme = "README.md" keywords = ["cross-platform", "uutils", "coreutils"] categories = ["os"] -license = "MIT" [badges] appveyor = { repository = "uutils/uucore" } @@ -35,9 +35,9 @@ time = { version = "<= 0.1.42", optional = true } ## "problem" dependencies # * backtrace: transitive dependency via 'failure'; pin to <= v0.3.30 to avoid increasing MinSRV to v1.33.0 backtrace = ">= 0.3.3, <= 0.3.30" -# * data-encoding: require 2.1, but 2.2.0 breaks the build for MinSRV 1.31.0 +# * data-encoding: require v2.1; but v2.2.0 breaks the build for MinSRV v1.31.0 data-encoding = { version = "~2.1", optional = true } -# * libc: initial utmp support added in 0.2.15, but 0.2.68 break the build for MinSRV 1.31.0 +# * libc: initial utmp support added in v0.2.15; but v0.2.68 breaks the build for MinSRV v1.31.0 libc = { version = "0.2.15, <= 0.2.66", optional = true } [target.'cfg(target_os = "redox")'.dependencies] diff --git a/src/uucore/src/uucore_procs/Cargo.toml b/src/uucore/src/uucore_procs/Cargo.toml index 62c60394e..d036f721d 100644 --- a/src/uucore/src/uucore_procs/Cargo.toml +++ b/src/uucore/src/uucore_procs/Cargo.toml @@ -3,7 +3,7 @@ name = "uucore_procs" version = "0.0.2" authors = [] license = "MIT" -description = "`uucore` proc-macros for use by various uutils projects" +description = "uutils ~ 'uucore' proc-macros" [lib] proc-macro = true diff --git a/src/uucore/src/uucore_procs/src/lib.rs b/src/uucore/src/uucore_procs/src/lib.rs index 3b671ec11..44a983b94 100644 --- a/src/uucore/src/uucore_procs/src/lib.rs +++ b/src/uucore/src/uucore_procs/src/lib.rs @@ -47,17 +47,16 @@ pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream { let Tokens { expr } = syn::parse_macro_input!(stream as Tokens); proc_dbg!(&expr); - const ARG_PANIC_TEXT: &str = "expected ident lexical path (or a literal string version) to 'uumain()' as argument"; + const ARG_PANIC_TEXT: &str = + "expected ident lexical path (or a literal string version) to 'uumain()' as argument"; // match EXPR as a string literal or an ident path, o/w panic!() let mut expr = match expr { - syn::Expr::Lit(expr_lit) => { - match expr_lit.lit { - syn::Lit::Str(ref lit_str) => { lit_str.parse::().unwrap() }, - _ => panic!(ARG_PANIC_TEXT), - } + syn::Expr::Lit(expr_lit) => match expr_lit.lit { + syn::Lit::Str(ref lit_str) => lit_str.parse::().unwrap(), + _ => panic!(ARG_PANIC_TEXT), }, - syn::Expr::Path(expr_path) => { expr_path }, + syn::Expr::Path(expr_path) => expr_path, _ => panic!(ARG_PANIC_TEXT), }; proc_dbg!(&expr); From 14df9d2df365538afee6874803d7a89bf95236ef Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 6 May 2020 17:30:48 -0500 Subject: [PATCH 167/606] docs/build ~ polish crate meta-information (uucore_procs) --- src/uucore/src/uucore_procs/Cargo.toml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/uucore/src/uucore_procs/Cargo.toml b/src/uucore/src/uucore_procs/Cargo.toml index d036f721d..32ae3209d 100644 --- a/src/uucore/src/uucore_procs/Cargo.toml +++ b/src/uucore/src/uucore_procs/Cargo.toml @@ -1,10 +1,16 @@ [package] name = "uucore_procs" version = "0.0.2" -authors = [] +authors = ["Roy Ivy III "] license = "MIT" description = "uutils ~ 'uucore' proc-macros" +homepage = "https://github.com/uutils/uucore/uucore_procs" +repository = "https://github.com/uutils/uucore/uucore_procs" +# readme = "README.md" +keywords = ["cross-platform", "proc-macros", "uucore", "uutils"] +# categories = ["os"] + [lib] proc-macro = true From 18b13ed4b401d5a7e463eff7ebb31a318ae596e4 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 23 May 2020 20:57:31 -0500 Subject: [PATCH 168/606] build/uucore_procs ~ fix proc_dbg!() for MinSRV of v1.31.0 --- src/uucore/src/uucore_procs/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/uucore_procs/src/lib.rs b/src/uucore/src/uucore_procs/src/lib.rs index 44a983b94..38847dd55 100644 --- a/src/uucore/src/uucore_procs/src/lib.rs +++ b/src/uucore/src/uucore_procs/src/lib.rs @@ -18,7 +18,7 @@ macro_rules! proc_dbg { #[cfg(not(feature = "debug"))] macro_rules! proc_dbg { ($x:expr) => { - std::convert::identity($x) + $x }; } From e35bd4b79c77e1d3a36255101e023a48f2f58149 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 23 May 2020 21:05:29 -0500 Subject: [PATCH 169/606] update deps (Cargo.toml); MinSRV == v1.31.0 --- src/uucore/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 1dbe6bb1a..060fd5324 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -24,7 +24,7 @@ members=["src/uucore_procs"] [dependencies] dunce = "1.0.0" getopts = "<= 0.2.21" -wild = "2.0.1" +wild = "2.0.0, < 2.0.2" ## optional failure = { version = "<= 0.1.1", optional = true } failure_derive = { version = "<= 0.1.1", optional = true } From b8c22496bbbefcc2e93782cac7b180a52ff7485a Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 23 May 2020 22:03:33 -0500 Subject: [PATCH 170/606] 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 --- src/uucore/src/uucore_procs/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/uucore/src/uucore_procs/src/lib.rs b/src/uucore/src/uucore_procs/src/lib.rs index 38847dd55..762194b2e 100644 --- a/src/uucore/src/uucore_procs/src/lib.rs +++ b/src/uucore/src/uucore_procs/src/lib.rs @@ -1,6 +1,9 @@ +#![allow(dead_code)] // work-around for GH:rust-lang/rust#62127; maint: can be removed when MinSRV >= v1.38.0 +#![allow(unused_macros)] // work-around for GH:rust-lang/rust#62127; maint: can be removed when MinSRV >= v1.38.0 + extern crate proc_macro; -// spell-checker:ignore () SIGPIPE uucore uumain uutils +// spell-checker:ignore () SIGPIPE maint uucore uumain uutils //## rust proc-macro background info //* ref: @@ @@ -43,6 +46,7 @@ impl syn::parse::Parse for Tokens { } #[proc_macro] +#[cfg(not(test))] // work-around for GH:rust-lang/rust#62127; maint: can be removed when MinSRV >= v1.38.0 pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream { let Tokens { expr } = syn::parse_macro_input!(stream as Tokens); proc_dbg!(&expr); From 1013b760c4cf0628990785a2e847271bb3cbf032 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 23 May 2020 22:12:40 -0500 Subject: [PATCH 171/606] fix `cargo clippy` warning (no_effect) --- src/uucore/src/uucore_procs/src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/uucore/src/uucore_procs/src/lib.rs b/src/uucore/src/uucore_procs/src/lib.rs index 762194b2e..4796f57e4 100644 --- a/src/uucore/src/uucore_procs/src/lib.rs +++ b/src/uucore/src/uucore_procs/src/lib.rs @@ -20,9 +20,7 @@ macro_rules! proc_dbg { } #[cfg(not(feature = "debug"))] macro_rules! proc_dbg { - ($x:expr) => { - $x - }; + ($x:expr) => {}; } //## main!() From d6b1052f3f5e4322069622cdb0cf7ccb5fa91928 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 6 May 2020 15:50:27 -0500 Subject: [PATCH 172/606] 0.0.3 --- src/uucore/Cargo.toml | 2 +- src/uucore/src/uucore_procs/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 060fd5324..bf54d8fe9 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uucore" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "uutils ~ 'core' uutils code library (cross-platform)" diff --git a/src/uucore/src/uucore_procs/Cargo.toml b/src/uucore/src/uucore_procs/Cargo.toml index 32ae3209d..6403c4b28 100644 --- a/src/uucore/src/uucore_procs/Cargo.toml +++ b/src/uucore/src/uucore_procs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uucore_procs" -version = "0.0.2" +version = "0.0.3" authors = ["Roy Ivy III "] license = "MIT" description = "uutils ~ 'uucore' proc-macros" From 0c4d314544d47d7bfdec3197fc091a898ef9553f Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 27 May 2020 00:37:13 -0500 Subject: [PATCH 173/606] change/API! ~ `disp_err!()` => `show_usage_error!()` --- src/uucore/src/lib/macros.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index f5bef7565..3f49efa89 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -79,7 +79,7 @@ macro_rules! show_info( ); #[macro_export] -macro_rules! disp_err( +macro_rules! show_usage_error( ($($args:tt)+) => ({ eprint!("{}: ", executable!()); eprintln!($($args)+); From fc6370e16004c3ff9fd62c91b22ef295e2cd2924 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 27 May 2020 11:11:42 -0500 Subject: [PATCH 174/606] change/API! ~ `new_coreopts!()` => `app!()` --- src/uucore/src/lib/mods/coreopts.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/lib/mods/coreopts.rs b/src/uucore/src/lib/mods/coreopts.rs index a7ae0d399..f1e382a3e 100644 --- a/src/uucore/src/lib/mods/coreopts.rs +++ b/src/uucore/src/lib/mods/coreopts.rs @@ -119,7 +119,7 @@ impl<'a> CoreOptions<'a> { } #[macro_export] -macro_rules! new_coreopts { +macro_rules! app { ($syntax: expr, $summary: expr, $long_help: expr) => { uucore::coreopts::CoreOptions::new(uucore::coreopts::HelpText { name: executable!(), From 2f840eedefcaafbe14d8adb8e3764a2ad9560799 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 27 May 2020 00:37:57 -0500 Subject: [PATCH 175/606] docs ~ update meta information --- src/uucore/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index bf54d8fe9..ea8119ddf 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -8,7 +8,7 @@ description = "uutils ~ 'core' uutils code library (cross-platform)" homepage = "https://github.com/uutils/uucore" repository = "https://github.com/uutils/uucore" readme = "README.md" -keywords = ["cross-platform", "uutils", "coreutils"] +keywords = ["cross-platform", "uutils", "core", "library"] categories = ["os"] [badges] From c57a93341298760656a7c51bc6efb8aa45e35a7f Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 27 May 2020 00:38:49 -0500 Subject: [PATCH 176/606] change ~ use crate configuration 'edition=2018' --- src/uucore/Cargo.toml | 1 + src/uucore/src/uucore_procs/Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index ea8119ddf..2fbba3d93 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -10,6 +10,7 @@ repository = "https://github.com/uutils/uucore" readme = "README.md" keywords = ["cross-platform", "uutils", "core", "library"] categories = ["os"] +edition = "2018" [badges] appveyor = { repository = "uutils/uucore" } diff --git a/src/uucore/src/uucore_procs/Cargo.toml b/src/uucore/src/uucore_procs/Cargo.toml index 6403c4b28..8048f02f2 100644 --- a/src/uucore/src/uucore_procs/Cargo.toml +++ b/src/uucore/src/uucore_procs/Cargo.toml @@ -10,6 +10,7 @@ repository = "https://github.com/uutils/uucore/uucore_procs" # readme = "README.md" keywords = ["cross-platform", "proc-macros", "uucore", "uutils"] # categories = ["os"] +edition = "2018" [lib] proc-macro = true From 16d367a41890b11aeccb27abdccf6b0d1bfdaa11 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 27 May 2020 00:41:40 -0500 Subject: [PATCH 177/606] fix 'edition=2018' module import errors --- src/uucore/src/lib/lib.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index d9e341976..71aeb4d32 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -32,40 +32,40 @@ mod features; // feature-gated code modules mod mods; // core cross-platform modules // * cross-platform modules -pub use mods::coreopts; -pub use mods::panic; +pub use crate::mods::coreopts; +pub use crate::mods::panic; // * feature-gated modules #[cfg(feature = "encoding")] -pub use features::encoding; +pub use crate::features::encoding; #[cfg(feature = "fs")] -pub use features::fs; +pub use crate::features::fs; #[cfg(feature = "parse_time")] -pub use features::parse_time; +pub use crate::features::parse_time; #[cfg(feature = "zero-copy")] -pub use features::zero_copy; +pub use crate::features::zero_copy; // * (platform-specific) feature-gated modules // ** non-windows #[cfg(all(not(windows), feature = "mode"))] -pub use features::mode; +pub use crate::features::mode; // ** unix-only #[cfg(all(unix, feature = "entries"))] -pub use features::entries; +pub use crate::features::entries; #[cfg(all(unix, feature = "process"))] -pub use features::process; +pub use crate::features::process; #[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))] -pub use features::signals; +pub use crate::features::signals; #[cfg(all( unix, not(target_os = "fuchsia"), not(target_env = "musl"), feature = "utmpx" ))] -pub use features::utmpx; +pub use crate::features::utmpx; // ** windows-only #[cfg(all(windows, feature = "wide"))] -pub use features::wide; +pub use crate::features::wide; //## core functions From b9642a0253c74c095b8a68c4bd635461a6fc5b92 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 27 May 2020 00:54:37 -0500 Subject: [PATCH 178/606] 0.0.4 --- src/uucore/Cargo.toml | 2 +- src/uucore/src/uucore_procs/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 2fbba3d93..bfd41f951 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uucore" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "uutils ~ 'core' uutils code library (cross-platform)" diff --git a/src/uucore/src/uucore_procs/Cargo.toml b/src/uucore/src/uucore_procs/Cargo.toml index 8048f02f2..7d1d8bfab 100644 --- a/src/uucore/src/uucore_procs/Cargo.toml +++ b/src/uucore/src/uucore_procs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uucore_procs" -version = "0.0.3" +version = "0.0.4" authors = ["Roy Ivy III "] license = "MIT" description = "uutils ~ 'uucore' proc-macros" From 70871edac996e8e1913aeef4cc9e92aecfef72a4 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 27 May 2020 12:20:43 -0500 Subject: [PATCH 179/606] docs/polish ~ remove outdated commentary --- src/uucore/src/lib/macros.rs | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index 3f49efa89..ee2a060d4 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -7,40 +7,6 @@ * file that was distributed with this source code. */ -// #[macro_export] -// macro_rules! main { ($($arg:tt)+) => ({ -// extern crate uu_arch; -// use std::io::Write; -// use uu_arch::uumain; - -// fn main() { -// uucore::panic::install_sigpipe_hook(); - -// let code = uumain(uucore::args().collect()); -// // Since stdout is line-buffered by default, we need to ensure any pending -// // writes are flushed before exiting. Ideally, this should be enforced by -// // each utility. -// // -// // See: https://github.com/rust-lang/rust/issues/23818 -// // -// std::io::stdout().flush().expect("could not flush stdout"); -// std::process::exit(code); -// } -// })} - -// extern crate proc_macro; -// use proc_macro::TokenStream; -// #[proc_macro_attribute] -// pub fn hello(attr: TokenStream, item: TokenStream) -> TokenStream { -// let result = quote! { -// fn main() { -// uucore::panic::install_sigpipe_hook(); -// std::io::stdout().flush().expect("could not flush stdout"); -// std::process::exit(code); -// } -// }; -// } - #[macro_export] macro_rules! executable( () => ({ From 88e5631fa447f923d93264485d36ca84d3465587 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 27 May 2020 13:22:52 -0500 Subject: [PATCH 180/606] docs/polish ~ polish/update commentary and copyrights --- src/uucore/src/lib/features/parse_time.rs | 14 ++++++-------- src/uucore/src/lib/features/process.rs | 2 +- src/uucore/src/lib/features/signals.rs | 14 ++++++-------- src/uucore/src/lib/features/wide.rs | 15 +++++++-------- src/uucore/src/lib/lib.rs | 3 ++- src/uucore/src/lib/macros.rs | 14 ++++++-------- src/uucore/src/uucore_procs/src/lib.rs | 2 ++ 7 files changed, 30 insertions(+), 34 deletions(-) diff --git a/src/uucore/src/lib/features/parse_time.rs b/src/uucore/src/lib/features/parse_time.rs index 260455f7d..e479f62a4 100644 --- a/src/uucore/src/lib/features/parse_time.rs +++ b/src/uucore/src/lib/features/parse_time.rs @@ -1,11 +1,9 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Alex Lyon - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +// This file is part of the uutils coreutils package. +// +// (c) Alex Lyon +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. use std::time::Duration; diff --git a/src/uucore/src/lib/features/process.rs b/src/uucore/src/lib/features/process.rs index d0ca39ff4..96dde84ae 100644 --- a/src/uucore/src/lib/features/process.rs +++ b/src/uucore/src/lib/features/process.rs @@ -41,7 +41,7 @@ pub enum ExitStatus { impl ExitStatus { fn from_status(status: c_int) -> ExitStatus { if status & 0x7F != 0 { - // WIFSIGNALED(status) + // WIFSIGNALED(status) == terminating by/with unhandled signal ExitStatus::Signal(status & 0x7F) } else { ExitStatus::Code(status & 0xFF00 >> 8) diff --git a/src/uucore/src/lib/features/signals.rs b/src/uucore/src/lib/features/signals.rs index d6ee017b1..2652520df 100644 --- a/src/uucore/src/lib/features/signals.rs +++ b/src/uucore/src/lib/features/signals.rs @@ -1,11 +1,9 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Maciej Dziardziel - * - * For the full copyright and license information, please view the LICENSE file - * that was distributed with this source code. - */ +// This file is part of the uutils coreutils package. +// +// (c) Maciej Dziardziel +// +// For the full copyright and license information, please view the LICENSE file +// that was distributed with this source code. pub static DEFAULT_SIGNAL: usize = 15; diff --git a/src/uucore/src/lib/features/wide.rs b/src/uucore/src/lib/features/wide.rs index 23088183b..49ce575a7 100644 --- a/src/uucore/src/lib/features/wide.rs +++ b/src/uucore/src/lib/features/wide.rs @@ -1,11 +1,10 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Peter Atashian - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +// This file is part of the uutils coreutils package. +// +// (c) Peter Atashian +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + use std::ffi::{OsStr, OsString}; use std::os::windows::ffi::{OsStrExt, OsStringExt}; pub trait ToWide { diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 71aeb4d32..c5b26f87e 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -1,6 +1,7 @@ // library ~ (core/bundler file) -// spell-checker:ignore (uucore/uutils) coreopts libc musl utmpx uucore uutils winapi +// Copyright (C) ~ Alex Lyon +// Copyright (C) ~ Roy Ivy III ; MIT license //## external crates diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index ee2a060d4..ff2bb8d3c 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -1,11 +1,9 @@ -/* - * This file is part of the uutils coreutils package. - * - * (c) Alex Lyon - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +// This file is part of the uutils coreutils package. +// +// (c) Alex Lyon +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. #[macro_export] macro_rules! executable( diff --git a/src/uucore/src/uucore_procs/src/lib.rs b/src/uucore/src/uucore_procs/src/lib.rs index 4796f57e4..5b7d99a75 100644 --- a/src/uucore/src/uucore_procs/src/lib.rs +++ b/src/uucore/src/uucore_procs/src/lib.rs @@ -1,6 +1,8 @@ #![allow(dead_code)] // work-around for GH:rust-lang/rust#62127; maint: can be removed when MinSRV >= v1.38.0 #![allow(unused_macros)] // work-around for GH:rust-lang/rust#62127; maint: can be removed when MinSRV >= v1.38.0 +// Copyright (C) ~ Roy Ivy III ; MIT license + extern crate proc_macro; // spell-checker:ignore () SIGPIPE maint uucore uumain uutils From d52fb5c4848d56e24c806615e0c831c74aa5d20c Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 27 May 2020 13:26:55 -0500 Subject: [PATCH 181/606] docs/spell ~ spell-check and addition of exceptions --- src/uucore/src/lib/features.rs | 2 -- src/uucore/src/lib/features/encoding.rs | 3 ++- src/uucore/src/lib/features/entries.rs | 2 ++ src/uucore/src/lib/features/mode.rs | 3 ++- src/uucore/src/lib/features/parse_time.rs | 2 ++ src/uucore/src/lib/features/process.rs | 4 +++- src/uucore/src/lib/features/signals.rs | 3 +++ src/uucore/src/lib/mods.rs | 2 -- src/uucore/src/lib/mods/panic.rs | 2 -- src/uucore/src/uucore_procs/src/lib.rs | 2 -- 10 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/uucore/src/lib/features.rs b/src/uucore/src/lib/features.rs index 438963135..d5927fc6f 100644 --- a/src/uucore/src/lib/features.rs +++ b/src/uucore/src/lib/features.rs @@ -1,7 +1,5 @@ // features ~ feature-gated modules (core/bundler file) -// spell-checker:ignore (uucore/uutils) coreopts libc musl utmpx uucore uutils winapi - #[cfg(feature = "encoding")] pub mod encoding; #[cfg(feature = "fs")] diff --git a/src/uucore/src/lib/features/encoding.rs b/src/uucore/src/lib/features/encoding.rs index 8544eb61c..4bddd522e 100644 --- a/src/uucore/src/lib/features/encoding.rs +++ b/src/uucore/src/lib/features/encoding.rs @@ -4,7 +4,8 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// + +// spell-checker:ignore (strings) ABCDEFGHIJKLMNOPQRSTUVWXYZ extern crate data_encoding; extern crate failure; diff --git a/src/uucore/src/lib/features/entries.rs b/src/uucore/src/lib/features/entries.rs index a9bc8b2d4..a921af2d0 100644 --- a/src/uucore/src/lib/features/entries.rs +++ b/src/uucore/src/lib/features/entries.rs @@ -5,6 +5,8 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +// spell-checker:ignore (vars) Passwd cstr fnam gecos ngroups + //! Get password/group file entry //! //! # Examples: diff --git a/src/uucore/src/lib/features/mode.rs b/src/uucore/src/lib/features/mode.rs index 0b43fdb02..7f102e792 100644 --- a/src/uucore/src/lib/features/mode.rs +++ b/src/uucore/src/lib/features/mode.rs @@ -4,7 +4,8 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// + +// spell-checker:ignore (vars) fperm srwx pub fn parse_numeric(fperm: u32, mut mode: &str) -> Result { let (op, pos) = parse_op(mode, Some('='))?; diff --git a/src/uucore/src/lib/features/parse_time.rs b/src/uucore/src/lib/features/parse_time.rs index e479f62a4..8e822685b 100644 --- a/src/uucore/src/lib/features/parse_time.rs +++ b/src/uucore/src/lib/features/parse_time.rs @@ -5,6 +5,8 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +// spell-checker:ignore (vars) NANOS numstr + use std::time::Duration; pub fn from_str(string: &str) -> Result { diff --git a/src/uucore/src/lib/features/process.rs b/src/uucore/src/lib/features/process.rs index 96dde84ae..f3f9680e8 100644 --- a/src/uucore/src/lib/features/process.rs +++ b/src/uucore/src/lib/features/process.rs @@ -5,7 +5,9 @@ // // For the full copyright and license information, please view the LICENSE file // that was distributed with this source code. -// + +// spell-checker:ignore (vars) cvar exitstatus +// spell-checker:ignore (sys/unix) WIFSIGNALED use libc::{c_int, gid_t, pid_t, uid_t}; use std::fmt; diff --git a/src/uucore/src/lib/features/signals.rs b/src/uucore/src/lib/features/signals.rs index 2652520df..294669eab 100644 --- a/src/uucore/src/lib/features/signals.rs +++ b/src/uucore/src/lib/features/signals.rs @@ -5,6 +5,9 @@ // For the full copyright and license information, please view the LICENSE file // that was distributed with this source code. +// spell-checker:ignore (vars/api) fcntl setrlimit setitimer +// spell-checker:ignore (vars/signals) ABRT ALRM CHLD SEGV SIGABRT SIGALRM SIGBUS SIGCHLD SIGCONT SIGEMT SIGFPE SIGHUP SIGILL SIGINFO SIGINT SIGIO SIGIOT SIGKILL SIGPIPE SIGPROF SIGQUIT SIGSEGV SIGSTOP SIGSYS SIGTERM SIGTRAP SIGTSTP SIGTTIN SIGTTOU SIGURG SIGUSR SIGVTALRM SIGWINCH SIGXCPU SIGXFSZ STKFLT TSTP TTIN TTOU VTALRM XCPU XFSZ + pub static DEFAULT_SIGNAL: usize = 15; pub struct Signal<'a> { diff --git a/src/uucore/src/lib/mods.rs b/src/uucore/src/lib/mods.rs index 542db5cd1..0becc71bd 100644 --- a/src/uucore/src/lib/mods.rs +++ b/src/uucore/src/lib/mods.rs @@ -1,6 +1,4 @@ // mods ~ cross-platforms modules (core/bundler file) -// spell-checker:ignore (uucore/uutils) coreopts libc musl utmpx uucore uutils winapi - pub mod coreopts; pub mod panic; diff --git a/src/uucore/src/lib/mods/panic.rs b/src/uucore/src/lib/mods/panic.rs index 2f8fb519e..6947df2ac 100644 --- a/src/uucore/src/lib/mods/panic.rs +++ b/src/uucore/src/lib/mods/panic.rs @@ -1,5 +1,3 @@ -// spell-checker:ignore () SIGPIPE maint uutils - use std::panic; //## SIGPIPE handling background/discussions ... diff --git a/src/uucore/src/uucore_procs/src/lib.rs b/src/uucore/src/uucore_procs/src/lib.rs index 5b7d99a75..d867c7d10 100644 --- a/src/uucore/src/uucore_procs/src/lib.rs +++ b/src/uucore/src/uucore_procs/src/lib.rs @@ -5,8 +5,6 @@ extern crate proc_macro; -// spell-checker:ignore () SIGPIPE maint uucore uumain uutils - //## rust proc-macro background info //* ref: @@ //* ref: [path construction from LitStr](https://oschwald.github.io/maxminddb-rust/syn/struct.LitStr.html) @@ From 7aa0c92cf8ecb0b594dc699abcd0bb6a8e643467 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 27 May 2020 16:56:21 -0500 Subject: [PATCH 182/606] docs/spell ~ configure VSCode cSpell --- src/uucore/.vscode/cSpell.json | 152 +++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 src/uucore/.vscode/cSpell.json diff --git a/src/uucore/.vscode/cSpell.json b/src/uucore/.vscode/cSpell.json new file mode 100644 index 000000000..80a966e9a --- /dev/null +++ b/src/uucore/.vscode/cSpell.json @@ -0,0 +1,152 @@ +// cSpell Settings +{ + "version": "0.1", // Version of the setting file. Always 0.1 + "language": "en", // language - current active spelling language + // ignoreWords + "ignoreWords": [ + // abbrev/acronyms + "FreeBSD", + "Gmail", + "MacOS", + "MinGW", + "POSIX", + "tcsh", + // crates + "getopts", + "libc", + "termion", + "walkdir", + "winapi", + // jargon + "POSIXLY", + "canonicalization", + "canonicalize", + "precompiled", + "readonly", + "symlink", + "symlinks", + // names + "Alex Lyon", "Alex", "Lyon", + "Derek Chiang", "Derek", "Chiang", + "Evgeniy Klyuchikov", "Evgeniy", "Klyuchikov", + "Fangxu Hu", "Fangxu", "Hu", + "Jian Zeng", "Jian", "Zeng", + "Jimmy Lu", "Jimmy", "Lu", + "Jordi Boggiano", "Jordi", "Boggiano", + "Jordy Dickinson", "Jordy", "Dickinson", + "Joseph Crail", "Joseph", "Crail", + "Joshua S Miller", "Joshua", "Miller", + "Maciej Dziardziel", "Maciej", "Dziardziel", + "Michael Gehring", "Michael", "Gehring", + "Peter Atashian", "Peter", "Atashian", + "Rolf Morel", "Rolf", "Morel", + "Roy Ivy III", "Roy", "Ivy", "III", + "Smigle00", "Smigle", + "Sylvestre Ledru", "Sylvestre", "Ledru", + "Vsevolod Velichko", "Vsevolod", "Velichko", + "anonymousknight", + "kwantam", + // rust + "concat", + "fract", + "rfind", + "trunc", + // rust utils + "clippy", + // tags + "Maint", + // vars/libc + "FILENO", + "HOSTSIZE", + "IDSIZE", + "IFIFO", + "IFREG", + "IRGRP", + "IROTH", + "IRUSR", + "ISGID", + "ISUID", + "ISVTX", + "IWGRP", + "IWOTH", + "IWUSR", + "IXGRP", + "IXOTH", + "IXUSR", + "LINESIZE", + "NAMESIZE", + "USERSIZE", + "addrinfo", + "addrlen", + "canonname", + "chroot", + "freeaddrinfo", + "getaddrinfo", + "getegid", + "geteuid", + "getgid", + "getgrgid", + "getgrnam", + "getgrouplist", + "getgroups", + "getpwnam", + "getpwuid", + "getuid", + "isatty", + "lchown", + "setgid", + "setgroups", + "setuid", + "socktype", + "umask", + "waitpid", + // vars/nix + "EOPNOTSUPP", + "GETFL", + "IoVec", + "errno", + "fcntl", + "fstat", + "unistd", + "vmsplice", + // vars/platform-info + "uname", + // vars/signals + "SIGPIPE", + // vars/sync + "Condvar", + // vars/time + "Timespec", + "nsec", + "nsecs", + "strftime", + "usec", + "usecs", + // vars/utmpx + "endutxent", + "getutxent", + "getutxid", + "getutxline", + "pututxline", + "setutxent", + "utmp", + "utmpx", + "utmpxname", + // uucore + "optflag", + "optflagmulti", + "optflagopt", + "optmulti", + "optopt", + // uutils + "coreopts", + "coreutils", + "musl", + "utmpx", + "uucore", + "uumain", + "uutils" + ], + // words - list of words to be always considered correct + "words": [] +} From 00779a1fb5df0f5aba7bbbd34a5f00bd7eb9474d Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Wed, 27 May 2020 13:42:09 -0500 Subject: [PATCH 183/606] refactor macro variable names (fixes spell-checker/unknown word warnings) --- src/uucore/src/lib/macros.rs | 46 ++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index ff2bb8d3c..0043e93bb 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -53,37 +53,37 @@ macro_rules! show_usage_error( #[macro_export] macro_rules! crash( - ($exitcode:expr, $($args:tt)+) => ({ + ($exit_code:expr, $($args:tt)+) => ({ show_error!($($args)+); - ::std::process::exit($exitcode) + ::std::process::exit($exit_code) }) ); #[macro_export] macro_rules! exit( - ($exitcode:expr) => ({ - ::std::process::exit($exitcode) + ($exit_code:expr) => ({ + ::std::process::exit($exit_code) }) ); #[macro_export] macro_rules! crash_if_err( - ($exitcode:expr, $exp:expr) => ( + ($exit_code:expr, $exp:expr) => ( match $exp { Ok(m) => m, - Err(f) => crash!($exitcode, "{}", f), + Err(f) => crash!($exit_code, "{}", f), } ) ); #[macro_export] macro_rules! return_if_err( - ($exitcode:expr, $exp:expr) => ( + ($exit_code:expr, $exp:expr) => ( match $exp { Ok(m) => m, Err(f) => { show_error!("{}", f); - return $exitcode; + return $exit_code; } } ) @@ -128,8 +128,8 @@ macro_rules! snippet_list_join_oxford { ($conjunction:expr, $valOne:expr, $valTwo:expr) => ( format!("{}, {} {}", $valOne, $conjunction, $valTwo) ); - ($conjunction:expr, $valOne:expr, $valTwo:expr $(, $remainingVals:expr)*) => ( - format!("{}, {}", $valOne, snippet_list_join_inner!($conjunction, $valTwo $(, $remainingVals)*)) + ($conjunction:expr, $valOne:expr, $valTwo:expr $(, $remaining_values:expr)*) => ( + format!("{}, {}", $valOne, snippet_list_join_inner!($conjunction, $valTwo $(, $remaining_values)*)) ); } @@ -138,8 +138,8 @@ macro_rules! snippet_list_join_or { ($valOne:expr, $valTwo:expr) => ( format!("{} or {}", $valOne, $valTwo) ); - ($valOne:expr, $valTwo:expr $(, $remainingVals:expr)*) => ( - format!("{}, {}", $valOne, snippet_list_join_oxford!("or", $valTwo $(, $remainingVals)*)) + ($valOne:expr, $valTwo:expr $(, $remaining_values:expr)*) => ( + format!("{}, {}", $valOne, snippet_list_join_oxford!("or", $valTwo $(, $remaining_values)*)) ); } @@ -166,10 +166,10 @@ macro_rules! msg_invalid_opt_use { ($about:expr, $flag:expr) => { msg_invalid_input!(format!("The '{}' option {}", $flag, $about)) }; - ($about:expr, $longflag:expr, $shortflag:expr) => { + ($about:expr, $long_flag:expr, $short_flag:expr) => { msg_invalid_input!(format!( "The '{}' ('{}') option {}", - $longflag, $shortflag, $about + $long_flag, $short_flag, $about )) }; } @@ -179,8 +179,8 @@ macro_rules! msg_opt_only_usable_if { ($clause:expr, $flag:expr) => { msg_invalid_opt_use!(format!("only usable if {}", $clause), $flag) }; - ($clause:expr, $longflag:expr, $shortflag:expr) => { - msg_invalid_opt_use!(format!("only usable if {}", $clause), $longflag, $shortflag) + ($clause:expr, $long_flag:expr, $short_flag:expr) => { + msg_invalid_opt_use!(format!("only usable if {}", $clause), $long_flag, $short_flag) }; } @@ -192,11 +192,11 @@ macro_rules! msg_opt_invalid_should_be { $flag ) }; - ($expects:expr, $received:expr, $longflag:expr, $shortflag:expr) => { + ($expects:expr, $received:expr, $long_flag:expr, $short_flag:expr) => { msg_invalid_opt_use!( format!("expects {}, but was provided {}", $expects, $received), - $longflag, - $shortflag + $long_flag, + $short_flag ) }; } @@ -254,14 +254,14 @@ macro_rules! msg_wrong_number_of_arguments { #[macro_export] macro_rules! msg_expects_one_of { - ($valOne:expr $(, $remainingVals:expr)*) => ( - msg_invalid_input!(format!("expects one of {}", snippet_list_join_or!($valOne $(, $remainingVals)*))) + ($valOne:expr $(, $remaining_values:expr)*) => ( + msg_invalid_input!(format!("expects one of {}", snippet_list_join_or!($valOne $(, $remaining_values)*))) ); } #[macro_export] macro_rules! msg_expects_no_more_than_one_of { - ($valOne:expr $(, $remainingVals:expr)*) => ( - msg_invalid_input!(format!("expects no more than one of {}", snippet_list_join_or!($valOne $(, $remainingVals)*))) ; + ($valOne:expr $(, $remaining_values:expr)*) => ( + msg_invalid_input!(format!("expects no more than one of {}", snippet_list_join_or!($valOne $(, $remaining_values)*))) ; ); } From 121ab6d847bec3c8036e93539fd8303e3cd4ba36 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 1 Jun 2020 11:01:34 +0200 Subject: [PATCH 184/606] build/deps ~ relax/update the wild dep Co-authored-by: Roy Ivy III --- src/uucore/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index bfd41f951..23aa14757 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -25,7 +25,7 @@ members=["src/uucore_procs"] [dependencies] dunce = "1.0.0" getopts = "<= 0.2.21" -wild = "2.0.0, < 2.0.2" +wild = "2.0.4" ## optional failure = { version = "<= 0.1.1", optional = true } failure_derive = { version = "<= 0.1.1", optional = true } From e8dcca18723cbaa7ed981f4d2c86f52ce8c55948 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Tue, 16 Jun 2020 01:27:12 -0500 Subject: [PATCH 185/606] Use OsString for arguments rather than String --- src/uucore/src/lib/lib.rs | 15 +++++++++++++++ src/uucore/src/uucore_procs/src/lib.rs | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index c5b26f87e..0b1ab63af 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -70,7 +70,22 @@ pub use crate::features::wide; //## core functions +use std::ffi::OsString; + +pub trait Args: Iterator + Sized { + fn collect_str(self) -> Vec { + // FIXME: avoid unwrap() + self.map(|s| s.into_string().unwrap()).collect() + } +} + +impl + Sized> Args for T { } + // args() ... pub fn args() -> impl Iterator { wild::args() } + +pub fn args_os() -> impl Iterator { + wild::args_os() +} diff --git a/src/uucore/src/uucore_procs/src/lib.rs b/src/uucore/src/uucore_procs/src/lib.rs index d867c7d10..aa77316ee 100644 --- a/src/uucore/src/uucore_procs/src/lib.rs +++ b/src/uucore/src/uucore_procs/src/lib.rs @@ -69,7 +69,7 @@ pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream { }; proc_dbg!(&expr); - let f = quote::quote! { #expr(uucore::args().collect()) }; + let f = quote::quote! { #expr(uucore::args_os()) }; proc_dbg!(&f); // generate a uutils utility `main()` function, tailored for the calling utility From 46e2c14f07533be7f4e2eab433cf9fa7b11bef53 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Tue, 16 Jun 2020 04:06:01 -0500 Subject: [PATCH 186/606] Formatting --- src/uucore/src/lib/lib.rs | 6 +++--- src/uucore/src/lib/macros.rs | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 0b1ab63af..005759514 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -74,12 +74,12 @@ use std::ffi::OsString; pub trait Args: Iterator + Sized { fn collect_str(self) -> Vec { - // FIXME: avoid unwrap() - self.map(|s| s.into_string().unwrap()).collect() + // FIXME: avoid unwrap() + self.map(|s| s.into_string().unwrap()).collect() } } -impl + Sized> Args for T { } +impl + Sized> Args for T {} // args() ... pub fn args() -> impl Iterator { diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index 0043e93bb..0aa6d8f0a 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -180,7 +180,11 @@ macro_rules! msg_opt_only_usable_if { msg_invalid_opt_use!(format!("only usable if {}", $clause), $flag) }; ($clause:expr, $long_flag:expr, $short_flag:expr) => { - msg_invalid_opt_use!(format!("only usable if {}", $clause), $long_flag, $short_flag) + msg_invalid_opt_use!( + format!("only usable if {}", $clause), + $long_flag, + $short_flag + ) }; } From aed6f296cf07d981a1d71a8e921433d285d82392 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 8 Nov 2020 19:57:28 -0600 Subject: [PATCH 187/606] change ~ prepare 'uucore' for grafting/re-merge into 'coreutils' --- src/uucore/.appveyor.yml | 162 --------------------------------- src/uucore/.cirrus.yml | 14 --- src/uucore/.codecov.yml | 1 - src/uucore/.gitignore | 14 --- src/uucore/.travis.yml | 47 ---------- src/uucore/.vscode/cSpell.json | 152 ------------------------------- src/uucore/LICENSE | 18 ---- src/uucore/README.md | 33 ------- 8 files changed, 441 deletions(-) delete mode 100644 src/uucore/.appveyor.yml delete mode 100644 src/uucore/.cirrus.yml delete mode 100644 src/uucore/.codecov.yml delete mode 100644 src/uucore/.gitignore delete mode 100644 src/uucore/.travis.yml delete mode 100644 src/uucore/.vscode/cSpell.json delete mode 100644 src/uucore/LICENSE delete mode 100644 src/uucore/README.md diff --git a/src/uucore/.appveyor.yml b/src/uucore/.appveyor.yml deleted file mode 100644 index ed0ec9b0c..000000000 --- a/src/uucore/.appveyor.yml +++ /dev/null @@ -1,162 +0,0 @@ -# spell-checker:words POSIX repo SDK SDKs toolchain toolchains -# spell-checker:ignore uutils ARCH ABI BACKTRACE BINDIR cl COMNTOOLS dllcrt findstr maint MINGW MINGWDIR mkdir MSVC MSYS rustc rustlib rustup USERPROFILE vcvarsall - -version: "{build} ~ {branch}" - -branches: - except: - - gh-pages - -os: Visual Studio 2015 - -artifacts: - - path: target\%TARGET%\debug\libuucore.rlib - name: libuucore.rlib - -matrix: - allow_failures: - - CHANNEL: nightly -# - ABI: gnu - -environment: - global: - FEATURES: "" - BUILD_OPTIONS: "--all-features" - TEST_OPTIONS: "--all-features --no-fail-fast" - - matrix: - # minimum version - - CHANNEL: 1.31.0 - ARCH: i686 - ABI: msvc - # "msvc" ABI - - CHANNEL: stable - ARCH: i686 - ABI: msvc - - CHANNEL: stable - ARCH: x86_64 - ABI: msvc -# - CHANNEL: beta -# ARCH: i686 -# ABI: msvc -# - CHANNEL: beta -# ARCH: x86_64 -# ABI: msvc - - CHANNEL: nightly - ARCH: i686 - ABI: msvc - - CHANNEL: nightly - ARCH: x86_64 - ABI: msvc - # "gnu" ABI - - CHANNEL: stable - ARCH: i686 - ABI: gnu - - CHANNEL: stable - ARCH: x86_64 - ABI: gnu -# - CHANNEL: beta -# ARCH: i686 -# ABI: gnu -# - CHANNEL: beta -# ARCH: x86_64 -# ABI: gnu -# - CHANNEL: nightly -# ARCH: i686 -# ABI: gnu -# - CHANNEL: nightly -# ARCH: x86_64 -# ABI: gnu - # * specific gnu compilers - - CHANNEL: stable - ARCH: i686 - ABI: gnu - MINGW_URL: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.2/threads-win32/dwarf/i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z/download - MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z - - CHANNEL: stable - ARCH: x86_64 - ABI: gnu - MINGW_URL: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/7.3.0/threads-posix/seh/x86_64-7.3.0-release-posix-seh-rt_v5-rev0.7z/download#mingw-w64-x86_64-7.3.0-posix-seh.7z - -install: - # force branch checkout (if knowable), then reset to the specific commit ## (can be needed for accurate code coverage info) - # * this allows later apps to see the branch name using standard `git branch` operations, yet always builds the correct specific commit - # * ref: [`@`](https://archive.is/RVpnF) - - if DEFINED APPVEYOR_REPO_BRANCH if /I "%APPVEYOR_REPO_SCM%"=="git" ( git checkout "%APPVEYOR_REPO_BRANCH%" 2>NUL & git reset --hard "%APPVEYOR_REPO_COMMIT%" ) - # ensure CWD is project main directory - - cd "%APPVEYOR_BUILD_FOLDER%" - # create a working area - - ps: if ( ! $env:CI_TEMP_DIR ) { $env:CI_TEMP_DIR = "${env:TEMP}\${env:APPVEYOR_JOB_ID}" ; mkdir -force $env:CI_TEMP_DIR | out-null } - - # define the TARGET host - - set "TARGET=%ARCH%-pc-windows-%ABI%" - - # show relevant environment settings - - ps: ('CHANNEL', 'ARCH', 'ABI', 'FEATURES', 'BUILD_OPTIONS', 'TEST_OPTIONS', 'TARGET') |% { write-host -f yellow "$_=$(get-content -ea silent env:/$_)" } - - # rust installation - # * install `rust` via `rustup` - - appveyor DownloadFile "https://win.rustup.rs/" -FileName "%CI_TEMP_DIR%\rustup-init.exe" - - call "%CI_TEMP_DIR%\rustup-init.exe" -y --default-toolchain %CHANNEL% --default-host %TARGET% --no-modify-path >NUL - - set "PATH=%PATH%;%USERPROFILE%\.cargo\bin" - - ps: $env:TOOLCHAIN = $("$(rustup show active-toolchain)" -split '\s+')[0] - # * set RUST_BACKTRACE for enhanced error messages - - set RUST_BACKTRACE=1 - # * show rust versions - - rustc -vV - - cargo -vV - - # "gnu" ABI setup - # * use the system MinGW/MSYS if we can - - if /i "%ABI%"=="gnu" set MSYS_BINDIR=C:\msys64\usr\bin - - if /i "%ABI%"=="gnu" if /i "%ARCH%"=="i686" set "MSYS_BITS=32" - - if /i "%ABI%"=="gnu" if /i "%ARCH%"=="x86_64" set "MSYS_BITS=64" - - if defined MSYS_BITS set "MSYS_MINGWDIR=C:\msys64\mingw%MSYS_BITS%" - - if defined MSYS_MINGWDIR set "MSYS_BINDIR=C:\msys64\usr\bin" - ## * workaround for rust-lang/rust#47048 / rust-lang/rust#53454 ## !maint: remove when resolved - - if /i "%ABI%"=="gnu" if /i "%ARCH%"=="i686" if not DEFINED MINGW_URL set "MINGW_URL=https://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win32/Personal Builds/mingw-builds/8.1.0/threads-posix/dwarf/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z" - - if /i "%ABI%"=="gnu" if /i "%ARCH%"=="x86_64" if not DEFINED MINGW_URL set "MINGW_URL=https://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win64/Personal Builds/mingw-builds/8.1.0/threads-posix/seh/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z" - ## (end workaround) - # * specific MinGW, if specified - - ps: if ( ! $env:MINGW_ARCHIVE -and $env:MINGW_URL ) { $env:MINGW_ARCHIVE = $($([URI]$env:MINGW_URL).fragment).TrimStart('#') } - - ps: if ( ! $env:MINGW_ARCHIVE -and $env:MINGW_URL ) { $env:MINGW_ARCHIVE = $([URI]$env:MINGW_URL).segments[-1] } - - if defined MINGW_ARCHIVE curl --insecure -fsSL "%MINGW_URL%" -o "%CI_TEMP_DIR%\%MINGW_ARCHIVE%" - - if defined MINGW_ARCHIVE mkdir "%CI_TEMP_DIR%\MinGW" >NUL - - if defined MINGW_ARCHIVE 7z x -y "%CI_TEMP_DIR%\%MINGW_ARCHIVE%" -o"%CI_TEMP_DIR%\MinGW" >NUL - - if defined MINGW_ARCHIVE set "MSYS_MINGWDIR=%CI_TEMP_DIR%\MinGW\mingw%MSYS_BITS%" - - if defined MINGW_ARCHIVE set "MSYS_BINDIR=%MSYS_MINGWDIR%\bin" - # * MinGW/MSYS PATH setup - - if defined MSYS_MINGWDIR set PATH=%MSYS_MINGWDIR%\%ARCH%-w64-mingw32\bin;%MSYS_BINDIR%;%PATH% - ## * workaround for rust-lang/rust#47048 / rust-lang/rust#53454 ## !maint: remove when resolved - # ** ref: , - # ** egs: , - - if /i "%ABI%"=="gnu" rustup install %CHANNEL%-%ARCH%-pc-windows-msvc - - if /i "%ABI%"=="gnu" rustup default %CHANNEL%-%ARCH%-pc-windows-msvc - - if /i "%ABI%"=="gnu" rustup target add %TARGET% - - ps: $env:TOOLCHAIN = $("$(rustup show active-toolchain)" -split '\s+')[0] - - if /i "%ABI%"=="gnu" rustup show - - if /i "%ABI%"=="gnu" rustc -vV - # ** copy libs from gcc toolchain to rust toolchain (more specifically, "crt2.o" and "dllcrt2.o" are needed) - - if defined MSYS_MINGWDIR copy /y "%MSYS_MINGWDIR%\%ARCH%-w64-mingw32\lib\*.o" "%USERPROFILE%\.rustup\toolchains\%TOOLCHAIN%\lib\rustlib\%TARGET%\lib" >NUL - ## (end workaround) - # * show `gcc` info - - if /i "%ABI%"=="gnu" ( where gcc && gcc --version ) - - # "msvc" ABI setup - - if /i "%ABI%" == "msvc" if /i "%ARCH%" == "i686" call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" - - if /i "%ABI%" == "msvc" if /i "%ARCH%" == "x86_64" call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 - - if /i "%ABI%" == "msvc" if /i "%ARCH%" == "x86_64" call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 - # * show `cl` info - - if /i "%ABI%"=="msvc" ( where cl && cl 2>&1 | findstr /i /c:"version" ) - - # finalize options - - ps: if ("$env:FEATURES".length) { $env:BUILD_OPTIONS = $(($env:BUILD_OPTIONS, "--features `"${env:FEATURES}`"")|?{$_}) -join ' ' } - - ps: if ("$env:FEATURES".length) { $env:TEST_OPTIONS = $(($env:TEST_OPTIONS, "--features `"${env:FEATURES}`"")|?{$_}) -join ' ' } - -build_script: - - ps: $env:BUILD_CMD = $(("cargo +${env:TOOLCHAIN} build --target=${env:TARGET}", $env:BUILD_OPTIONS)|?{$_}) -join ' ' - - echo [ `%BUILD_CMD%` ] & %BUILD_CMD% - -test_script: - - ps: $env:TEST_CMD = $(("cargo +${env:TOOLCHAIN} test --target=${env:TARGET}", $env:TEST_OPTIONS)|?{$_}) -join ' ' - - echo [ `%TEST_CMD%` ] & %TEST_CMD% diff --git a/src/uucore/.cirrus.yml b/src/uucore/.cirrus.yml deleted file mode 100644 index 390f07e3a..000000000 --- a/src/uucore/.cirrus.yml +++ /dev/null @@ -1,14 +0,0 @@ -task: - name: stable x86_64-unknown-freebsd-12 - freebsd_instance: - image: freebsd-12-1-release-amd64 - setup_script: - - pkg install -y curl - - curl https://sh.rustup.rs -sSf --output rustup.sh - - sh rustup.sh -y --profile=minimal - build_script: - - . $HOME/.cargo/env - - cargo build --all-features - test_script: - - . $HOME/.cargo/env - - cargo test --all-features diff --git a/src/uucore/.codecov.yml b/src/uucore/.codecov.yml deleted file mode 100644 index 69cb76019..000000000 --- a/src/uucore/.codecov.yml +++ /dev/null @@ -1 +0,0 @@ -comment: false diff --git a/src/uucore/.gitignore b/src/uucore/.gitignore deleted file mode 100644 index b1ac52506..000000000 --- a/src/uucore/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -target/ -/src/*/gen_table -/build/ -/tmp/ -/busybox/ -/.vscode/ -/.vs/ -*~ -.*.swp -.*.swo -.idea -Cargo.lock -lib*.a -/docs/_build diff --git a/src/uucore/.travis.yml b/src/uucore/.travis.yml deleted file mode 100644 index 21a7345af..000000000 --- a/src/uucore/.travis.yml +++ /dev/null @@ -1,47 +0,0 @@ -language: rust - -rust: - - stable - - beta - -os: - - linux - - osx - -env: - global: FEATURES='' CARGO_ARGS='--all-features' - -matrix: - allow_failures: - - rust: nightly - fast_finish: true - include: - - rust: 1.31.0 - - rust: stable - os: linux - - rust: stable - os: osx - - rust: nightly - os: linux - - rust: nightly - os: osx - -cache: - directories: - - $HOME/.cargo - -script: - - cargo build $CARGO_ARGS --features "$FEATURES" - - cargo test $CARGO_ARGS --features "$FEATURES" --no-fail-fast - -addons: - apt: - packages: - - libssl-dev - -after_success: | - if [ "$TRAVIS_OS_NAME" = linux -a "$TRAVIS_RUST_VERSION" = stable ]; then - bash <(curl https://raw.githubusercontent.com/xd009642/tarpaulin/master/travis-install.sh) - cargo tarpaulin --out Xml - bash <(curl -s https://codecov.io/bash) - fi diff --git a/src/uucore/.vscode/cSpell.json b/src/uucore/.vscode/cSpell.json deleted file mode 100644 index 80a966e9a..000000000 --- a/src/uucore/.vscode/cSpell.json +++ /dev/null @@ -1,152 +0,0 @@ -// cSpell Settings -{ - "version": "0.1", // Version of the setting file. Always 0.1 - "language": "en", // language - current active spelling language - // ignoreWords - "ignoreWords": [ - // abbrev/acronyms - "FreeBSD", - "Gmail", - "MacOS", - "MinGW", - "POSIX", - "tcsh", - // crates - "getopts", - "libc", - "termion", - "walkdir", - "winapi", - // jargon - "POSIXLY", - "canonicalization", - "canonicalize", - "precompiled", - "readonly", - "symlink", - "symlinks", - // names - "Alex Lyon", "Alex", "Lyon", - "Derek Chiang", "Derek", "Chiang", - "Evgeniy Klyuchikov", "Evgeniy", "Klyuchikov", - "Fangxu Hu", "Fangxu", "Hu", - "Jian Zeng", "Jian", "Zeng", - "Jimmy Lu", "Jimmy", "Lu", - "Jordi Boggiano", "Jordi", "Boggiano", - "Jordy Dickinson", "Jordy", "Dickinson", - "Joseph Crail", "Joseph", "Crail", - "Joshua S Miller", "Joshua", "Miller", - "Maciej Dziardziel", "Maciej", "Dziardziel", - "Michael Gehring", "Michael", "Gehring", - "Peter Atashian", "Peter", "Atashian", - "Rolf Morel", "Rolf", "Morel", - "Roy Ivy III", "Roy", "Ivy", "III", - "Smigle00", "Smigle", - "Sylvestre Ledru", "Sylvestre", "Ledru", - "Vsevolod Velichko", "Vsevolod", "Velichko", - "anonymousknight", - "kwantam", - // rust - "concat", - "fract", - "rfind", - "trunc", - // rust utils - "clippy", - // tags - "Maint", - // vars/libc - "FILENO", - "HOSTSIZE", - "IDSIZE", - "IFIFO", - "IFREG", - "IRGRP", - "IROTH", - "IRUSR", - "ISGID", - "ISUID", - "ISVTX", - "IWGRP", - "IWOTH", - "IWUSR", - "IXGRP", - "IXOTH", - "IXUSR", - "LINESIZE", - "NAMESIZE", - "USERSIZE", - "addrinfo", - "addrlen", - "canonname", - "chroot", - "freeaddrinfo", - "getaddrinfo", - "getegid", - "geteuid", - "getgid", - "getgrgid", - "getgrnam", - "getgrouplist", - "getgroups", - "getpwnam", - "getpwuid", - "getuid", - "isatty", - "lchown", - "setgid", - "setgroups", - "setuid", - "socktype", - "umask", - "waitpid", - // vars/nix - "EOPNOTSUPP", - "GETFL", - "IoVec", - "errno", - "fcntl", - "fstat", - "unistd", - "vmsplice", - // vars/platform-info - "uname", - // vars/signals - "SIGPIPE", - // vars/sync - "Condvar", - // vars/time - "Timespec", - "nsec", - "nsecs", - "strftime", - "usec", - "usecs", - // vars/utmpx - "endutxent", - "getutxent", - "getutxid", - "getutxline", - "pututxline", - "setutxent", - "utmp", - "utmpx", - "utmpxname", - // uucore - "optflag", - "optflagmulti", - "optflagopt", - "optmulti", - "optopt", - // uutils - "coreopts", - "coreutils", - "musl", - "utmpx", - "uucore", - "uumain", - "uutils" - ], - // words - list of words to be always considered correct - "words": [] -} diff --git a/src/uucore/LICENSE b/src/uucore/LICENSE deleted file mode 100644 index 0177c4ab7..000000000 --- a/src/uucore/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -Copyright (c) Jordi Boggiano - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/uucore/README.md b/src/uucore/README.md deleted file mode 100644 index 191d41ab7..000000000 --- a/src/uucore/README.md +++ /dev/null @@ -1,33 +0,0 @@ -uutils uucore -============= - -[![Discord](https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat)](https://discord.gg/wQVJbvJ) -[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/uutils/uucore/blob/master/LICENSE) -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fuutils%2Fuucore.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fuutils%2Fuucore?ref=badge_shield) -[![LOC](https://tokei.rs/b1/github/uutils/uucore?category=code)](https://github.com/Aaronepower/tokei) -[![dependency status](https://deps.rs/repo/github/uutils/uucore/status.svg)](https://deps.rs/repo/github/uutils/uucore) - -[![Build Status](https://api.travis-ci.org/uutils/coreutils.svg?branch=master)](https://travis-ci.org/uutils/uucore) -[![Build Status (Windows)](https://ci.appveyor.com/api/projects/status/787ltcxgy86r20le?svg=true)](https://ci.appveyor.com/project/Arcterus/uucore) -[![Build Status (FreeBSD)](https://api.cirrus-ci.com/github/uutils/coreutils.svg)](https://cirrus-ci.com/github/uutils/uucore/master) - ------------------------------------------------ - -uucore is a collection of code used by various uutils projects. Currently, -almost all of the code is used by [uutils/coreutils](https://github.com/uutils/coreutils). -In the future, much of this repository may be supplanted by smaller, more -focused repositories/crates. - -### Rust Version ### - -uucore follows Rust's release channels and is tested against stable, beta and nightly. -The current oldest supported version of the Rust compiler is `1.31.0`. - -On Windows, only the nightly version is tested currently. - -License -------- - -uucore is licensed under the MIT License - see the `LICENSE` file for details - -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fuutils%2Fuucore.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fuutils%2Fuucore?ref=badge_large) From b6cafa9e10dba9951943fc04e8560a85a828789e Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 7 Nov 2020 19:30:10 -0600 Subject: [PATCH 188/606] fix ~ remove extraneous step within GHA MinRSV --- .github/workflows/CICD.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 847cf6895..02f410d14 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -145,10 +145,6 @@ jobs: cargo fetch --locked --quiet ## * using the 'stable' toolchain is necessary to avoid "unexpected '--filter-platform'" errors RUSTUP_TOOLCHAIN=stable cargo-tree tree --frozen --all --no-dev-dependencies --no-indent --features ${{ matrix.job.features }} | grep -vE "$PWD" | sort --unique - - name: Info - shell: bash - run: | - # Info - name: Test uses: actions-rs/cargo@v1 From 07d52c77410f6b443508644042dce1170a0e90ee Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 7 Nov 2020 13:09:06 -0600 Subject: [PATCH 189/606] docs ~ add corrective spell-checker global exceptions --- .github/workflows/CICD.yml | 2 +- .vscode/cSpell.json | 55 ++++++++++++++++++++++++++++++++++++++ .vscode/settings.json | 2 ++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 02f410d14..49eb61fa7 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -1,7 +1,7 @@ name: CICD # spell-checker:ignore (acronyms) CICD MSVC musl -# spell-checker:ignore (env/flags) Ccodegen Coverflow Cpanic RUSTDOCFLAGS RUSTFLAGS Zpanic +# spell-checker:ignore (env/flags) Awarnings Ccodegen Coverflow Cpanic RUSTDOCFLAGS RUSTFLAGS Zpanic # spell-checker:ignore (jargon) SHAs deps softprops toolchain # spell-checker:ignore (names) CodeCOV MacOS MinGW Peltoche rivy # spell-checker:ignore (shell/tools) choco clippy dmake dpkg esac fakeroot gmake grcov halium lcov libssl mkdir popd printf pushd rustc rustfmt rustup shopt xargs diff --git a/.vscode/cSpell.json b/.vscode/cSpell.json index 6319d3d59..8561d69ad 100644 --- a/.vscode/cSpell.json +++ b/.vscode/cSpell.json @@ -8,6 +8,8 @@ "Cygwin", "FreeBSD", "Gmail", + "GNUEABI", + "GNUEABIhf", "Irix", "MacOS", "MinGW", @@ -23,16 +25,31 @@ "Xenix", "flac", "lzma", + // cargo + "cdylib", + "rlib", // crates + "advapi", + "advapi32-sys", + "aho-corasick", + "backtrace", "byteorder", + "chacha", "chrono", + "conv", + "corasick", "filetime", "formatteriteminfo", "getopts", "itertools", + "memchr", "multifilereader", "onig", "peekreader", + "quickcheck", + "rand_chacha", + "smallvec", + "tempfile", "termion", "termios", "termsize", @@ -64,12 +81,14 @@ "colorize", "consts", "dedup", + "demangle", "deque", "dequeue", "enqueue", "executable", "executables", "gibibytes", + "hardfloat", "hardlink", "hardlinks", "hashsums", @@ -87,9 +106,12 @@ "primality", "pseudoprime", "pseudoprimes", + "procs", "readonly", "seedable", "semver", + "shortcode", + "shortcodes", "symlink", "symlinks", "syscall", @@ -144,6 +166,7 @@ "Sunrin SHIMURA", "Sunrin", "SHIMURA", "Smigle00", "Smigle", "Sylvestre Ledru", "Sylvestre", "Ledru", + "T Jameson Little", "Jameson", "Little", "Tobias Bohumir Schottdorf", "Tobias", "Bohumir", "Schottdorf", "Virgile Andreani", "Virgile", "Andreani", "Vsevolod Velichko", "Vsevolod", "Velichko", @@ -151,27 +174,37 @@ "Yury Krivopalov", "Yury", "Krivopalov", "anonymousknight", "kwantam", + "nicoo", + "rivy", // rust "clippy", "concat", + "fract", "powi", + "println", "repr", "rfind", "rustc", "rustfmt", + "struct", + "structs", "substr", "splitn", + "trunc", // shell "passwd", + "pipefail", "tcsh", // tags "Maint", // uutils + "chcon", "chgrp", "chmod", "chown", "chroot", "cksum", + "csplit", "dircolors", "hashsum", "hostid", @@ -190,16 +223,28 @@ "realpath", "relpath", "rmdir", + "runcon", "shuf", "stdbuf", + "stty", "tsort", "uname", "unexpand", "whoami", + // vars/errno + "errno", + "EOPNOTSUPP", + // vars/fcntl + "F_GETFL", + "GETFL", + "fcntl", + "vmsplice", // vars/libc "FILENO", "HOSTSIZE", "IDSIZE", + "IFIFO", + "IFREG", "IRGRP", "IROTH", "IRUSR", @@ -240,10 +285,16 @@ "socktype", "umask", "waitpid", + // vars/nix + "iovec", + "unistd", // vars/signals "SIGPIPE", // vars/sync "Condvar", + // vars/stat + "fstat", + "stat", // vars/time "Timespec", "nsec", @@ -265,9 +316,11 @@ "errhandlingapi", "fileapi", "handleapi", + "lmcons", "minwindef", "processthreadsapi", "synchapi", + "sysinfoapi", "winbase", "winerror", "winnt", @@ -285,10 +338,12 @@ "coreopts", "coreutils", "libc", + "libstdbuf", "musl", "ucmd", "utmpx", "uucore", + "uucore_procs", "uumain", "uutils" ], diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..7a73a41bf --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file From c17307c7572ababdc7108763dbdf253091272fbe Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 7 Nov 2020 13:30:36 -0600 Subject: [PATCH 190/606] fix ~ update workspace pointers to 'uucore' and 'uucore_procs' --- Cargo.toml | 4 ++-- src/uu/arch/Cargo.toml | 4 ++-- src/uu/base32/Cargo.toml | 4 ++-- src/uu/base64/Cargo.toml | 4 ++-- src/uu/basename/Cargo.toml | 4 ++-- src/uu/cat/Cargo.toml | 4 ++-- src/uu/chgrp/Cargo.toml | 4 ++-- src/uu/chmod/Cargo.toml | 4 ++-- src/uu/chown/Cargo.toml | 4 ++-- src/uu/chroot/Cargo.toml | 4 ++-- src/uu/cksum/Cargo.toml | 4 ++-- src/uu/comm/Cargo.toml | 4 ++-- src/uu/cp/Cargo.toml | 4 ++-- src/uu/cut/Cargo.toml | 4 ++-- src/uu/date/Cargo.toml | 4 ++-- src/uu/df/Cargo.toml | 4 ++-- src/uu/dircolors/Cargo.toml | 4 ++-- src/uu/dirname/Cargo.toml | 4 ++-- src/uu/du/Cargo.toml | 4 ++-- src/uu/echo/Cargo.toml | 4 ++-- src/uu/env/Cargo.toml | 4 ++-- src/uu/expand/Cargo.toml | 4 ++-- src/uu/expr/Cargo.toml | 4 ++-- src/uu/factor/Cargo.toml | 4 ++-- src/uu/false/Cargo.toml | 4 ++-- src/uu/fmt/Cargo.toml | 4 ++-- src/uu/fold/Cargo.toml | 4 ++-- src/uu/groups/Cargo.toml | 4 ++-- src/uu/hashsum/Cargo.toml | 4 ++-- src/uu/head/Cargo.toml | 4 ++-- src/uu/hostid/Cargo.toml | 4 ++-- src/uu/hostname/Cargo.toml | 4 ++-- src/uu/id/Cargo.toml | 4 ++-- src/uu/install/Cargo.toml | 4 ++-- src/uu/join/Cargo.toml | 4 ++-- src/uu/kill/Cargo.toml | 4 ++-- src/uu/link/Cargo.toml | 4 ++-- src/uu/ln/Cargo.toml | 4 ++-- src/uu/logname/Cargo.toml | 4 ++-- src/uu/ls/Cargo.toml | 4 ++-- src/uu/mkdir/Cargo.toml | 4 ++-- src/uu/mkfifo/Cargo.toml | 4 ++-- src/uu/mknod/Cargo.toml | 4 ++-- src/uu/mktemp/Cargo.toml | 4 ++-- src/uu/more/Cargo.toml | 4 ++-- src/uu/mv/Cargo.toml | 4 ++-- src/uu/nice/Cargo.toml | 4 ++-- src/uu/nl/Cargo.toml | 4 ++-- src/uu/nohup/Cargo.toml | 4 ++-- src/uu/nproc/Cargo.toml | 4 ++-- src/uu/numfmt/Cargo.toml | 4 ++-- src/uu/od/Cargo.toml | 4 ++-- src/uu/paste/Cargo.toml | 4 ++-- src/uu/pathchk/Cargo.toml | 4 ++-- src/uu/pinky/Cargo.toml | 4 ++-- src/uu/printenv/Cargo.toml | 4 ++-- src/uu/printf/Cargo.toml | 4 ++-- src/uu/ptx/Cargo.toml | 4 ++-- src/uu/pwd/Cargo.toml | 4 ++-- src/uu/readlink/Cargo.toml | 4 ++-- src/uu/realpath/Cargo.toml | 4 ++-- src/uu/relpath/Cargo.toml | 4 ++-- src/uu/rm/Cargo.toml | 4 ++-- src/uu/rmdir/Cargo.toml | 4 ++-- src/uu/seq/Cargo.toml | 4 ++-- src/uu/shred/Cargo.toml | 4 ++-- src/uu/shuf/Cargo.toml | 4 ++-- src/uu/sleep/Cargo.toml | 4 ++-- src/uu/sort/Cargo.toml | 4 ++-- src/uu/split/Cargo.toml | 4 ++-- src/uu/stat/Cargo.toml | 4 ++-- src/uu/stdbuf/Cargo.toml | 4 ++-- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 4 ++-- src/uu/sum/Cargo.toml | 4 ++-- src/uu/sync/Cargo.toml | 4 ++-- src/uu/tac/Cargo.toml | 4 ++-- src/uu/tail/Cargo.toml | 4 ++-- src/uu/tee/Cargo.toml | 4 ++-- src/uu/test/Cargo.toml | 4 ++-- src/uu/timeout/Cargo.toml | 4 ++-- src/uu/touch/Cargo.toml | 4 ++-- src/uu/tr/Cargo.toml | 4 ++-- src/uu/true/Cargo.toml | 4 ++-- src/uu/truncate/Cargo.toml | 4 ++-- src/uu/tsort/Cargo.toml | 4 ++-- src/uu/tty/Cargo.toml | 4 ++-- src/uu/uname/Cargo.toml | 4 ++-- src/uu/unexpand/Cargo.toml | 4 ++-- src/uu/uniq/Cargo.toml | 4 ++-- src/uu/unlink/Cargo.toml | 4 ++-- src/uu/uptime/Cargo.toml | 4 ++-- src/uu/users/Cargo.toml | 4 ++-- src/uu/wc/Cargo.toml | 4 ++-- src/uu/who/Cargo.toml | 4 ++-- src/uu/whoami/Cargo.toml | 4 ++-- src/uu/yes/Cargo.toml | 4 ++-- src/uucore/Cargo.toml | 16 ++++------------ src/{uucore/src => }/uucore_procs/Cargo.toml | 0 src/{uucore/src => }/uucore_procs/src/lib.rs | 0 99 files changed, 196 insertions(+), 204 deletions(-) rename src/{uucore/src => }/uucore_procs/Cargo.toml (100%) rename src/{uucore/src => }/uucore_procs/src/lib.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index bcf9a7615..01b0804a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -225,7 +225,7 @@ test = [ "uu_test" ] [dependencies] lazy_static = { version="1.3" } textwrap = { version="=0.11.0", features=["term_size"] } # !maint: [2020-05-10; rivy] unstable crate using undocumented features; pinned currently, will review -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="src/uucore" } # * uutils uu_test = { optional=true, version="0.0.1", package="uu_test", path="src/uu/test" } # @@ -338,7 +338,7 @@ sha1 = { version="0.6", features=["std"] } tempfile = "3.1" time = "0.1" unindent = "0.1" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["entries"] } +uucore = { version="0.0.4", package="uucore", path="src/uucore", features=["entries"] } [target.'cfg(unix)'.dev-dependencies] rust-users = { version="0.10", package="users" } diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index 9ab1da6dc..18ef47057 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -16,8 +16,8 @@ path = "src/arch.rs" [dependencies] platform-info = "0.0.1" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "arch" diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index ea1482858..16dc3fee2 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/base32.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features = ["encoding"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features = ["encoding"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "base32" diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index ea83605a0..97307467b 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/base64.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features = ["encoding"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features = ["encoding"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "base64" diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index 8373c9fc6..7a567b5fb 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/basename.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "basename" diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 02f7354c3..b28f52db6 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -16,8 +16,8 @@ path = "src/cat.rs" [dependencies] quick-error = "1.2.3" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] unix_socket = "0.5.0" diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index 4e5b6b3b2..ce5b434cc 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/chgrp.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["entries", "fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2.8" [[bin]] diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index eff0cc186..12ca0bbe1 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -16,8 +16,8 @@ path = "src/chmod.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["fs", "mode"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs", "mode"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } walker = "1.0.0" [[bin]] diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index 5b3148b28..92d18ddd4 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -16,8 +16,8 @@ path = "src/chown.rs" [dependencies] glob = "0.3.0" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["entries", "fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" [[bin]] diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index b8a931c09..4281f0110 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -16,8 +16,8 @@ path = "src/chroot.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["entries"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "chroot" diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index ae6b29534..fb934fea2 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -16,8 +16,8 @@ path = "src/cksum.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "cksum" diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index 57cdbc0c4..821b00bbf 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -17,8 +17,8 @@ path = "src/comm.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "comm" diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index 9fa97ccb0..53cefd62f 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -23,8 +23,8 @@ clap = "2.32" filetime = "0.2" libc = "0.2.42" quick-error = "1.2.3" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2.8" [target.'cfg(target_os = "linux")'.dependencies] diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index d504cebb3..0596f4709 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/cut.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "cut" diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index 8c462fb26..8784bab65 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -17,8 +17,8 @@ path = "src/date.rs" [dependencies] chrono = "0.4.4" clap = "2.32" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "date" diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 4144adb41..be007dff0 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -18,8 +18,8 @@ path = "src/df.rs" clap = "2.32" libc = "0.2" number_prefix = "0.2" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "windows")'.dependencies] winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi", "winerror"] } diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index a1bb6010e..364ffa175 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -16,8 +16,8 @@ path = "src/dircolors.rs" [dependencies] glob = "0.3.0" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "dircolors" diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index 847666854..32def4b84 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -16,8 +16,8 @@ path = "src/dirname.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "dirname" diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index 6f14a6a32..067997f0c 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -16,8 +16,8 @@ path = "src/du.rs" [dependencies] time = "0.1.40" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "du" diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index 984f872e8..fbee8aaff 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/echo.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "echo" diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index de54617f4..08c10ee6a 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -18,8 +18,8 @@ path = "src/env.rs" clap = "2.33" libc = "0.2.42" rust-ini = "0.13.0" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "env" diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index 4be65e5f4..eb96f8cb1 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -17,8 +17,8 @@ path = "src/expand.rs" [dependencies] getopts = "0.2.18" unicode-width = "0.1.5" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "expand" diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index 69f350cfd..d0f31bffb 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -17,8 +17,8 @@ path = "src/expr.rs" [dependencies] libc = "0.2.42" onig = "~4.3.2" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "expr" diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index a37ee5249..92faf5c3c 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -19,8 +19,8 @@ num-traits = "0.2" # used in src/numerics.rs, which is included by build.rs num-traits = "0.2" rand = { version="0.7", features=["small_rng"] } smallvec = { version="0.6.13, < 1.0" } -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] criterion = "0.3" diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index 784a44666..168fd9c55 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/false.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "false" diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index 59bb0e2b7..a80b1bdb9 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -17,8 +17,8 @@ path = "src/fmt.rs" [dependencies] libc = "0.2.42" unicode-width = "0.1.5" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "fmt" diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index 10493a9ca..1244fc02d 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/fold.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "fold" diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index fb6d193ed..552220337 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/groups.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["entries"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } clap = "2.32" [[bin]] diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index aeaac7ac3..e59460a89 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -25,8 +25,8 @@ regex-syntax = "0.6.7" sha1 = "0.6.0" sha2 = "0.6.0" sha3 = "0.6.0" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "hashsum" diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index df9f10a72..7be02cdce 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -16,8 +16,8 @@ path = "src/head.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "head" diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index db833ace7..e94c11d44 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -16,8 +16,8 @@ path = "src/hostid.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "hostid" diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index c0b724acd..735f7cab3 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -18,8 +18,8 @@ path = "src/hostname.rs" clap = "2.32" libc = "0.2.42" hostname = { version = "0.3", features = ["set"] } -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["wide"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["wide"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=["sysinfoapi", "winsock2"] } [[bin]] diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index f82a76c44..e2de5931c 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/id.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["entries", "process"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries", "process"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "id" diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 3e00a9bd8..46d7748eb 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -20,8 +20,8 @@ path = "src/install.rs" [dependencies] getopts = "0.2.18" libc = ">= 0.2" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["mode"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["mode"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] time = "0.1.40" diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index 156b4429b..14c621db1 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -16,8 +16,8 @@ path = "src/join.rs" [dependencies] clap = "2.32" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "join" diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index 1562ffb8a..fe8435a25 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -16,8 +16,8 @@ path = "src/kill.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["signals"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["signals"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "kill" diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index 9b9f08f94..d6633719e 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -16,8 +16,8 @@ path = "src/link.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "link" diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index 2a26ca938..4d43e95e0 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -16,8 +16,8 @@ path = "src/ln.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "ln" diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index 450ac4571..ac99826b0 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -16,8 +16,8 @@ path = "src/logname.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "logname" diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index f35f90dc1..2a30e8794 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -23,8 +23,8 @@ term_grid = "0.1.5" termsize = "0.1.6" time = "0.1.40" unicode-width = "0.1.5" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["entries", "fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "ls" diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index 89c391fb0..a0daa2a37 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -17,8 +17,8 @@ path = "src/mkdir.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["fs", "mode"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs", "mode"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "mkdir" diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index c06be0dad..5993a452f 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -17,8 +17,8 @@ path = "src/mkfifo.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "mkfifo" diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index d7058b883..b6573bdbc 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -18,8 +18,8 @@ path = "src/mknod.rs" [dependencies] getopts = "0.2.18" libc = "^0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["mode"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["mode"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "mknod" diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index c9a937ba1..ab35a6021 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -18,8 +18,8 @@ path = "src/mktemp.rs" getopts = "0.2.18" rand = "0.5" tempfile = "3.0" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "mktemp" diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index 56af9e2df..19ee80e18 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -16,8 +16,8 @@ path = "src/more.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "redox")'.dependencies] redox_termios = "0.1" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index 708330800..757e48aff 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -17,8 +17,8 @@ path = "src/mv.rs" [dependencies] getopts = "0.2.18" fs_extra = "1.1.0" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "mv" diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index e9ca8445a..c50863c67 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -17,8 +17,8 @@ path = "src/nice.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "nice" diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index 23d12af1e..33165077f 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -21,8 +21,8 @@ libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" regex-syntax = "0.6.7" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "nl" diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index d349fd22f..c61e865f4 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -17,8 +17,8 @@ path = "src/nohup.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "nohup" diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index 681fe3032..6be8768ac 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -18,8 +18,8 @@ path = "src/nproc.rs" libc = "0.2.42" num_cpus = "1.10" clap = "2.33" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "nproc" diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index b965b6053..e5d527bc8 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -16,8 +16,8 @@ path = "src/numfmt.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "numfmt" diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index dd58a2b89..fea64a161 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -19,8 +19,8 @@ byteorder = "1.3.2" getopts = "0.2.18" half = "1.6" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "od" diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index 200e189c3..68db13025 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -16,8 +16,8 @@ path = "src/paste.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "paste" diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index 3db2a5750..fddd1d1af 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -17,8 +17,8 @@ path = "src/pathchk.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "pathchk" diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index 1f2bfc13b..c5e79dafb 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/pinky.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["utmpx", "entries"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["utmpx", "entries"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "pinky" diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index 68db1b689..35d2345f6 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -16,8 +16,8 @@ path = "src/printenv.rs" [dependencies] clap = "2.33" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "printenv" diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index 7ac01a597..ff98a04bf 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -19,8 +19,8 @@ path = "src/printf.rs" [dependencies] itertools = "0.8.0" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "printf" diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index e906981c6..cf98c755a 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -21,8 +21,8 @@ libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" regex-syntax = "0.6.7" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "ptx" diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index ef25017d1..c34f1ebe8 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -16,8 +16,8 @@ path = "src/pwd.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "pwd" diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index 6a46a09cc..22836078d 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -17,8 +17,8 @@ path = "src/readlink.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "readlink" diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index 4cd083c54..4b4264eff 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -16,8 +16,8 @@ path = "src/realpath.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "realpath" diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index ff2f3120e..5d90838e7 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -16,8 +16,8 @@ path = "src/relpath.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "relpath" diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index 8fbd14663..2568e05ce 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -18,8 +18,8 @@ path = "src/rm.rs" getopts = "0.2.18" walkdir = "2.2.8" remove_dir_all = "0.5.1" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "rm" diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index 2c1c15862..4ca484b0b 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -16,8 +16,8 @@ path = "src/rmdir.rs" [dependencies] clap = "2.33" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "rmdir" diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index b7cf3901c..9344f37f1 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -16,8 +16,8 @@ path = "src/seq.rs" [dependencies] clap = "2.33" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "seq" diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index 12cc3926e..cbea671ba 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -20,8 +20,8 @@ getopts = "0.2.18" libc = "0.2.42" rand = "0.5" time = "0.1.40" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "shred" diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index 128fb939c..fc9faf6d9 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -17,8 +17,8 @@ path = "src/shuf.rs" [dependencies] getopts = "0.2.18" rand = "0.5" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "shuf" diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index 09d3d1289..d2401332e 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -16,8 +16,8 @@ path = "src/sleep.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["parse_time"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["parse_time"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "sleep" diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index fca462b04..736412ddb 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -18,8 +18,8 @@ path = "src/sort.rs" clap = "2.33" itertools = "0.8.0" semver = "0.9.0" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "sort" diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index 90563345a..800e18bfc 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -16,8 +16,8 @@ path = "src/split.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "split" diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index f39f20c9a..260cc7bbb 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -17,8 +17,8 @@ path = "src/stat.rs" [dependencies] clap = "2.33" time = "0.1.40" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["entries", "libc"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries", "libc"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "stat" diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index 9da2e59c7..1615b2aa7 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -17,8 +17,8 @@ path = "src/stdbuf.rs" [dependencies] getopts = "0.2.18" tempfile = "3.1" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [build-dependencies] libstdbuf = { version="0.0.1", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index 0db28c1c4..6fc3ffa77 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -19,8 +19,8 @@ crate-type = ["cdylib", "rlib"] # XXX: note: the rlib is just to prevent Cargo f [dependencies] cpp = "0.4" libc = "0.2" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../../../uucore_procs" } [build-dependencies] cpp_build = "0.4" diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index 2216e905e..9a9e437c3 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -16,8 +16,8 @@ path = "src/sum.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "sum" diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index d6dab2788..cfa00932f 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -17,8 +17,8 @@ path = "src/sync.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["wide"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["wide"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi", "std", "winbase", "winerror"] } [[bin]] diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index b5e3867ee..0ca50d240 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -16,8 +16,8 @@ path = "src/tac.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "tac" diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index a7cc75d7b..22f10094f 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -17,8 +17,8 @@ path = "src/tail.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=["fileapi", "handleapi", "processthreadsapi", "synchapi", "winbase"] } [target.'cfg(target_os = "redox")'.dependencies] diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index 777b9a747..41499e151 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -17,8 +17,8 @@ path = "src/tee.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "tee" diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index 8cc621a63..ff4cc99eb 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -16,8 +16,8 @@ path = "src/test.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "redox")'.dependencies] redox_syscall = "0.1" diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index bc94a4d5a..da9dceea9 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -18,8 +18,8 @@ path = "src/timeout.rs" getopts = "0.2.18" libc = "0.2.42" time = "0.1.40" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["parse_time", "process", "signals"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "timeout" diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index 7372c4347..61743c10c 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -18,8 +18,8 @@ path = "src/touch.rs" filetime = "0.2.1" getopts = "0.2.18" time = "0.1.40" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["libc"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["libc"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "touch" diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index 6f356cc65..b128f128d 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -18,8 +18,8 @@ path = "src/tr.rs" bit-set = "0.5.0" fnv = "1.0.5" getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "tr" diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index a625e1c45..7d8ae5f72 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/true.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "true" diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index 4da4b9487..bf5719266 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -16,8 +16,8 @@ path = "src/truncate.rs" [dependencies] clap = "2.33" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "truncate" diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index 74ea51a94..e34d698c2 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -16,8 +16,8 @@ path = "src/tsort.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "tsort" diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index ea521b431..56909cd9d 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -17,8 +17,8 @@ path = "src/tty.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "tty" diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index fd0a7ca82..30bb9bdbe 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -17,8 +17,8 @@ path = "src/uname.rs" [dependencies] clap = "2.32" platform-info = "0.0.1" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "uname" diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index 933349a51..2ce929b5b 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -17,8 +17,8 @@ path = "src/unexpand.rs" [dependencies] getopts = "0.2.18" unicode-width = "0.1.5" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "unexpand" diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index 6de1088b5..60f32b373 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -16,8 +16,8 @@ path = "src/uniq.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "uniq" diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index 5d13953b9..0ee06c5e0 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -17,8 +17,8 @@ path = "src/unlink.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "unlink" diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index ea1789ab3..39028b2c7 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -19,8 +19,8 @@ getopts = "0.2.18" time = "0.1.40" chrono = "0.4" clap = "2.32" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["libc", "utmpx"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["libc", "utmpx"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "uptime" diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index ce9f9d212..358d2dcbd 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -16,8 +16,8 @@ path = "src/users.rs" [dependencies] clap = "2.33" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["utmpx"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["utmpx"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "users" diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index b76a641a6..303528531 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -16,8 +16,8 @@ path = "src/wc.rs" [dependencies] clap = "2.33" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "wc" diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index 6b3646356..8b3df8890 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/who.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["utmpx"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["utmpx"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "who" diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index ecda1ae2d..4be83d80e 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -17,8 +17,8 @@ path = "src/whoami.rs" [dependencies] advapi32-sys = "0.2.0" clap = "2.32" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["entries", "wide"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries", "wide"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } winapi = { version = "0.3", features = ["lmcons"] } [[bin]] diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index 1424a15ed..b9419c4ec 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -16,8 +16,8 @@ path = "src/yes.rs" [dependencies] clap = "2.32" -uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["zero-copy"] } -uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } +uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["zero-copy"] } +uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } [features] default = [] diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 23aa14757..34101590b 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -5,23 +5,15 @@ authors = ["uutils developers"] license = "MIT" description = "uutils ~ 'core' uutils code library (cross-platform)" -homepage = "https://github.com/uutils/uucore" -repository = "https://github.com/uutils/uucore" -readme = "README.md" -keywords = ["cross-platform", "uutils", "core", "library"] -categories = ["os"] +homepage = "https://github.com/uutils/coreutils" +repository = "https://github.com/uutils/coreutils/tree/master/src/uu/arch" +keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"] +categories = ["command-line-utilities"] edition = "2018" -[badges] -appveyor = { repository = "uutils/uucore" } -travis-ci = { repository = "uutils/uucore" } - [lib] path="src/lib/lib.rs" -[workspace] -members=["src/uucore_procs"] - [dependencies] dunce = "1.0.0" getopts = "<= 0.2.21" diff --git a/src/uucore/src/uucore_procs/Cargo.toml b/src/uucore_procs/Cargo.toml similarity index 100% rename from src/uucore/src/uucore_procs/Cargo.toml rename to src/uucore_procs/Cargo.toml diff --git a/src/uucore/src/uucore_procs/src/lib.rs b/src/uucore_procs/src/lib.rs similarity index 100% rename from src/uucore/src/uucore_procs/src/lib.rs rename to src/uucore_procs/src/lib.rs From 6539b8c6b97b7c8cb37b2cf024eceb54584a2cd5 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 7 Nov 2020 15:18:23 -0600 Subject: [PATCH 191/606] 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. --- Cargo.toml | 4 ++-- src/uu/arch/Cargo.toml | 4 ++-- src/uu/base32/Cargo.toml | 4 ++-- src/uu/base64/Cargo.toml | 4 ++-- src/uu/basename/Cargo.toml | 4 ++-- src/uu/cat/Cargo.toml | 4 ++-- src/uu/chgrp/Cargo.toml | 4 ++-- src/uu/chmod/Cargo.toml | 4 ++-- src/uu/chown/Cargo.toml | 4 ++-- src/uu/chroot/Cargo.toml | 4 ++-- src/uu/cksum/Cargo.toml | 4 ++-- src/uu/comm/Cargo.toml | 4 ++-- src/uu/cp/Cargo.toml | 4 ++-- src/uu/cut/Cargo.toml | 4 ++-- src/uu/date/Cargo.toml | 4 ++-- src/uu/df/Cargo.toml | 4 ++-- src/uu/dircolors/Cargo.toml | 4 ++-- src/uu/dirname/Cargo.toml | 4 ++-- src/uu/du/Cargo.toml | 4 ++-- src/uu/echo/Cargo.toml | 4 ++-- src/uu/env/Cargo.toml | 4 ++-- src/uu/expand/Cargo.toml | 4 ++-- src/uu/expr/Cargo.toml | 4 ++-- src/uu/factor/Cargo.toml | 4 ++-- src/uu/false/Cargo.toml | 4 ++-- src/uu/fmt/Cargo.toml | 4 ++-- src/uu/fold/Cargo.toml | 4 ++-- src/uu/groups/Cargo.toml | 4 ++-- src/uu/hashsum/Cargo.toml | 4 ++-- src/uu/head/Cargo.toml | 4 ++-- src/uu/hostid/Cargo.toml | 4 ++-- src/uu/hostname/Cargo.toml | 4 ++-- src/uu/id/Cargo.toml | 4 ++-- src/uu/install/Cargo.toml | 4 ++-- src/uu/join/Cargo.toml | 4 ++-- src/uu/kill/Cargo.toml | 4 ++-- src/uu/link/Cargo.toml | 4 ++-- src/uu/ln/Cargo.toml | 4 ++-- src/uu/logname/Cargo.toml | 4 ++-- src/uu/ls/Cargo.toml | 4 ++-- src/uu/mkdir/Cargo.toml | 4 ++-- src/uu/mkfifo/Cargo.toml | 4 ++-- src/uu/mknod/Cargo.toml | 4 ++-- src/uu/mktemp/Cargo.toml | 4 ++-- src/uu/more/Cargo.toml | 4 ++-- src/uu/mv/Cargo.toml | 4 ++-- src/uu/nice/Cargo.toml | 4 ++-- src/uu/nl/Cargo.toml | 4 ++-- src/uu/nohup/Cargo.toml | 4 ++-- src/uu/nproc/Cargo.toml | 4 ++-- src/uu/numfmt/Cargo.toml | 4 ++-- src/uu/od/Cargo.toml | 4 ++-- src/uu/paste/Cargo.toml | 4 ++-- src/uu/pathchk/Cargo.toml | 4 ++-- src/uu/pinky/Cargo.toml | 4 ++-- src/uu/printenv/Cargo.toml | 4 ++-- src/uu/printf/Cargo.toml | 4 ++-- src/uu/ptx/Cargo.toml | 4 ++-- src/uu/pwd/Cargo.toml | 4 ++-- src/uu/readlink/Cargo.toml | 4 ++-- src/uu/realpath/Cargo.toml | 4 ++-- src/uu/relpath/Cargo.toml | 4 ++-- src/uu/rm/Cargo.toml | 4 ++-- src/uu/rmdir/Cargo.toml | 4 ++-- src/uu/seq/Cargo.toml | 4 ++-- src/uu/shred/Cargo.toml | 4 ++-- src/uu/shuf/Cargo.toml | 4 ++-- src/uu/sleep/Cargo.toml | 4 ++-- src/uu/sort/Cargo.toml | 4 ++-- src/uu/split/Cargo.toml | 4 ++-- src/uu/stat/Cargo.toml | 4 ++-- src/uu/stdbuf/Cargo.toml | 4 ++-- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 4 ++-- src/uu/sum/Cargo.toml | 4 ++-- src/uu/sync/Cargo.toml | 4 ++-- src/uu/tac/Cargo.toml | 4 ++-- src/uu/tail/Cargo.toml | 4 ++-- src/uu/tee/Cargo.toml | 4 ++-- src/uu/test/Cargo.toml | 4 ++-- src/uu/timeout/Cargo.toml | 4 ++-- src/uu/touch/Cargo.toml | 4 ++-- src/uu/tr/Cargo.toml | 4 ++-- src/uu/true/Cargo.toml | 4 ++-- src/uu/truncate/Cargo.toml | 4 ++-- src/uu/tsort/Cargo.toml | 4 ++-- src/uu/tty/Cargo.toml | 4 ++-- src/uu/uname/Cargo.toml | 4 ++-- src/uu/unexpand/Cargo.toml | 4 ++-- src/uu/uniq/Cargo.toml | 4 ++-- src/uu/unlink/Cargo.toml | 4 ++-- src/uu/uptime/Cargo.toml | 4 ++-- src/uu/users/Cargo.toml | 4 ++-- src/uu/wc/Cargo.toml | 4 ++-- src/uu/who/Cargo.toml | 4 ++-- src/uu/whoami/Cargo.toml | 4 ++-- src/uu/yes/Cargo.toml | 4 ++-- 96 files changed, 192 insertions(+), 192 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 01b0804a8..865a5d8e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -225,7 +225,7 @@ test = [ "uu_test" ] [dependencies] lazy_static = { version="1.3" } textwrap = { version="=0.11.0", features=["term_size"] } # !maint: [2020-05-10; rivy] unstable crate using undocumented features; pinned currently, will review -uucore = { version="0.0.4", package="uucore", path="src/uucore" } +uucore = { version=">=0.0.4", package="uucore", path="src/uucore" } # * uutils uu_test = { optional=true, version="0.0.1", package="uu_test", path="src/uu/test" } # @@ -338,7 +338,7 @@ sha1 = { version="0.6", features=["std"] } tempfile = "3.1" time = "0.1" unindent = "0.1" -uucore = { version="0.0.4", package="uucore", path="src/uucore", features=["entries"] } +uucore = { version=">=0.0.4", package="uucore", path="src/uucore", features=["entries"] } [target.'cfg(unix)'.dev-dependencies] rust-users = { version="0.10", package="users" } diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index 18ef47057..401e7dcdf 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -16,8 +16,8 @@ path = "src/arch.rs" [dependencies] platform-info = "0.0.1" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "arch" diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index 16dc3fee2..57620eb0a 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/base32.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", path="../../uucore", features = ["encoding"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features = ["encoding"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "base32" diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index 97307467b..afc1ecbdc 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/base64.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", path="../../uucore", features = ["encoding"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features = ["encoding"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "base64" diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index 7a567b5fb..943b229cd 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/basename.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "basename" diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index b28f52db6..4d6006520 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -16,8 +16,8 @@ path = "src/cat.rs" [dependencies] quick-error = "1.2.3" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] unix_socket = "0.5.0" diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index ce5b434cc..bd6194bf6 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/chgrp.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2.8" [[bin]] diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index 12ca0bbe1..3c257cd4d 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -16,8 +16,8 @@ path = "src/chmod.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs", "mode"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs", "mode"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } walker = "1.0.0" [[bin]] diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index 92d18ddd4..ebc494761 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -16,8 +16,8 @@ path = "src/chown.rs" [dependencies] glob = "0.3.0" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" [[bin]] diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index 4281f0110..e1d168dfe 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -16,8 +16,8 @@ path = "src/chroot.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "chroot" diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index fb934fea2..bc8853287 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -16,8 +16,8 @@ path = "src/cksum.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "cksum" diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index 821b00bbf..01006d3d0 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -17,8 +17,8 @@ path = "src/comm.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "comm" diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index 53cefd62f..9c57d92a5 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -23,8 +23,8 @@ clap = "2.32" filetime = "0.2" libc = "0.2.42" quick-error = "1.2.3" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2.8" [target.'cfg(target_os = "linux")'.dependencies] diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index 0596f4709..f53dd42a0 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/cut.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "cut" diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index 8784bab65..d2a335d5b 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -17,8 +17,8 @@ path = "src/date.rs" [dependencies] chrono = "0.4.4" clap = "2.32" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "date" diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index be007dff0..25d1433fb 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -18,8 +18,8 @@ path = "src/df.rs" clap = "2.32" libc = "0.2" number_prefix = "0.2" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "windows")'.dependencies] winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi", "winerror"] } diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index 364ffa175..1ac7f8cc9 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -16,8 +16,8 @@ path = "src/dircolors.rs" [dependencies] glob = "0.3.0" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "dircolors" diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index 32def4b84..1503b1c42 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -16,8 +16,8 @@ path = "src/dirname.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "dirname" diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index 067997f0c..a83259b05 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -16,8 +16,8 @@ path = "src/du.rs" [dependencies] time = "0.1.40" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "du" diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index fbee8aaff..95e91a7ca 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/echo.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "echo" diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index 08c10ee6a..a425e77e9 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -18,8 +18,8 @@ path = "src/env.rs" clap = "2.33" libc = "0.2.42" rust-ini = "0.13.0" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "env" diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index eb96f8cb1..9161b44d2 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -17,8 +17,8 @@ path = "src/expand.rs" [dependencies] getopts = "0.2.18" unicode-width = "0.1.5" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "expand" diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index d0f31bffb..a9cc9e527 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -17,8 +17,8 @@ path = "src/expr.rs" [dependencies] libc = "0.2.42" onig = "~4.3.2" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "expr" diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index 92faf5c3c..5bc48c8a1 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -19,8 +19,8 @@ num-traits = "0.2" # used in src/numerics.rs, which is included by build.rs num-traits = "0.2" rand = { version="0.7", features=["small_rng"] } smallvec = { version="0.6.13, < 1.0" } -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] criterion = "0.3" diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index 168fd9c55..4eca91584 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/false.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "false" diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index a80b1bdb9..19b67132f 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -17,8 +17,8 @@ path = "src/fmt.rs" [dependencies] libc = "0.2.42" unicode-width = "0.1.5" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "fmt" diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index 1244fc02d..745f09426 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/fold.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "fold" diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index 552220337..5d29d2063 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/groups.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } clap = "2.32" [[bin]] diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index e59460a89..a54a2beac 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -25,8 +25,8 @@ regex-syntax = "0.6.7" sha1 = "0.6.0" sha2 = "0.6.0" sha3 = "0.6.0" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "hashsum" diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index 7be02cdce..cbce20c31 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -16,8 +16,8 @@ path = "src/head.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "head" diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index e94c11d44..29fd624ab 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -16,8 +16,8 @@ path = "src/hostid.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "hostid" diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index 735f7cab3..d5cecf9bd 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -18,8 +18,8 @@ path = "src/hostname.rs" clap = "2.32" libc = "0.2.42" hostname = { version = "0.3", features = ["set"] } -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["wide"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["wide"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=["sysinfoapi", "winsock2"] } [[bin]] diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index e2de5931c..c5509e71d 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/id.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries", "process"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "process"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "id" diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 46d7748eb..cdf263f5c 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -20,8 +20,8 @@ path = "src/install.rs" [dependencies] getopts = "0.2.18" libc = ">= 0.2" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["mode"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["mode"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] time = "0.1.40" diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index 14c621db1..7e16ebf2f 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -16,8 +16,8 @@ path = "src/join.rs" [dependencies] clap = "2.32" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "join" diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index fe8435a25..60566685b 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -16,8 +16,8 @@ path = "src/kill.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["signals"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["signals"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "kill" diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index d6633719e..3af0e5a50 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -16,8 +16,8 @@ path = "src/link.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "link" diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index 4d43e95e0..14846dcd3 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -16,8 +16,8 @@ path = "src/ln.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "ln" diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index ac99826b0..722824328 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -16,8 +16,8 @@ path = "src/logname.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "logname" diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index 2a30e8794..93ccefe68 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -23,8 +23,8 @@ term_grid = "0.1.5" termsize = "0.1.6" time = "0.1.40" unicode-width = "0.1.5" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "ls" diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index a0daa2a37..e9aa0fe63 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -17,8 +17,8 @@ path = "src/mkdir.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs", "mode"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs", "mode"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "mkdir" diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index 5993a452f..97a925663 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -17,8 +17,8 @@ path = "src/mkfifo.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "mkfifo" diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index b6573bdbc..e98a9400e 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -18,8 +18,8 @@ path = "src/mknod.rs" [dependencies] getopts = "0.2.18" libc = "^0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["mode"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["mode"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "mknod" diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index ab35a6021..b188dbcbe 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -18,8 +18,8 @@ path = "src/mktemp.rs" getopts = "0.2.18" rand = "0.5" tempfile = "3.0" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "mktemp" diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index 19ee80e18..ca9fc8560 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -16,8 +16,8 @@ path = "src/more.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "redox")'.dependencies] redox_termios = "0.1" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index 757e48aff..442b859eb 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -17,8 +17,8 @@ path = "src/mv.rs" [dependencies] getopts = "0.2.18" fs_extra = "1.1.0" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "mv" diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index c50863c67..65addb665 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -17,8 +17,8 @@ path = "src/nice.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "nice" diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index 33165077f..542b8ae5c 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -21,8 +21,8 @@ libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" regex-syntax = "0.6.7" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "nl" diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index c61e865f4..b1df8f1a7 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -17,8 +17,8 @@ path = "src/nohup.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "nohup" diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index 6be8768ac..7bfc7f2e1 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -18,8 +18,8 @@ path = "src/nproc.rs" libc = "0.2.42" num_cpus = "1.10" clap = "2.33" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "nproc" diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index e5d527bc8..93407980c 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -16,8 +16,8 @@ path = "src/numfmt.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "numfmt" diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index fea64a161..611c569a3 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -19,8 +19,8 @@ byteorder = "1.3.2" getopts = "0.2.18" half = "1.6" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "od" diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index 68db13025..3f08b722d 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -16,8 +16,8 @@ path = "src/paste.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "paste" diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index fddd1d1af..0c1885904 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -17,8 +17,8 @@ path = "src/pathchk.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "pathchk" diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index c5e79dafb..f4ccf88a2 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/pinky.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["utmpx", "entries"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["utmpx", "entries"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "pinky" diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index 35d2345f6..0292b455b 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -16,8 +16,8 @@ path = "src/printenv.rs" [dependencies] clap = "2.33" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "printenv" diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index ff98a04bf..a2696486b 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -19,8 +19,8 @@ path = "src/printf.rs" [dependencies] itertools = "0.8.0" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "printf" diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index cf98c755a..5f147c97d 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -21,8 +21,8 @@ libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" regex-syntax = "0.6.7" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "ptx" diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index c34f1ebe8..c61e8bc14 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -16,8 +16,8 @@ path = "src/pwd.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "pwd" diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index 22836078d..18e83178f 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -17,8 +17,8 @@ path = "src/readlink.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "readlink" diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index 4b4264eff..808ec1330 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -16,8 +16,8 @@ path = "src/realpath.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "realpath" diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index 5d90838e7..2d4e67fb1 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -16,8 +16,8 @@ path = "src/relpath.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "relpath" diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index 2568e05ce..942fc361f 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -18,8 +18,8 @@ path = "src/rm.rs" getopts = "0.2.18" walkdir = "2.2.8" remove_dir_all = "0.5.1" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "rm" diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index 4ca484b0b..60a54f4a9 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -16,8 +16,8 @@ path = "src/rmdir.rs" [dependencies] clap = "2.33" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "rmdir" diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index 9344f37f1..380c6d6d6 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -16,8 +16,8 @@ path = "src/seq.rs" [dependencies] clap = "2.33" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "seq" diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index cbea671ba..bccba633c 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -20,8 +20,8 @@ getopts = "0.2.18" libc = "0.2.42" rand = "0.5" time = "0.1.40" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "shred" diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index fc9faf6d9..428c130df 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -17,8 +17,8 @@ path = "src/shuf.rs" [dependencies] getopts = "0.2.18" rand = "0.5" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "shuf" diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index d2401332e..e5c300bf6 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -16,8 +16,8 @@ path = "src/sleep.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["parse_time"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["parse_time"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "sleep" diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 736412ddb..01065a931 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -18,8 +18,8 @@ path = "src/sort.rs" clap = "2.33" itertools = "0.8.0" semver = "0.9.0" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "sort" diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index 800e18bfc..6076423f3 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -16,8 +16,8 @@ path = "src/split.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "split" diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index 260cc7bbb..26cc6b95e 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -17,8 +17,8 @@ path = "src/stat.rs" [dependencies] clap = "2.33" time = "0.1.40" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries", "libc"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "libc"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "stat" diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index 1615b2aa7..70fd32df1 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -17,8 +17,8 @@ path = "src/stdbuf.rs" [dependencies] getopts = "0.2.18" tempfile = "3.1" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [build-dependencies] libstdbuf = { version="0.0.1", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index 6fc3ffa77..878ea4450 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -19,8 +19,8 @@ crate-type = ["cdylib", "rlib"] # XXX: note: the rlib is just to prevent Cargo f [dependencies] cpp = "0.4" libc = "0.2" -uucore = { version="0.0.4", package="uucore", path="../../../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../../../uucore_procs" } [build-dependencies] cpp_build = "0.4" diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index 9a9e437c3..54579d91c 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -16,8 +16,8 @@ path = "src/sum.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "sum" diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index cfa00932f..d12990d78 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -17,8 +17,8 @@ path = "src/sync.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["wide"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["wide"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi", "std", "winbase", "winerror"] } [[bin]] diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index 0ca50d240..9cd7db989 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -16,8 +16,8 @@ path = "src/tac.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "tac" diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index 22f10094f..6eedd8e73 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -17,8 +17,8 @@ path = "src/tail.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=["fileapi", "handleapi", "processthreadsapi", "synchapi", "winbase"] } [target.'cfg(target_os = "redox")'.dependencies] diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index 41499e151..2712df686 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -17,8 +17,8 @@ path = "src/tee.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "tee" diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index ff4cc99eb..120c513ba 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -16,8 +16,8 @@ path = "src/test.rs" [dependencies] libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "redox")'.dependencies] redox_syscall = "0.1" diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index da9dceea9..f4a87d19d 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -18,8 +18,8 @@ path = "src/timeout.rs" getopts = "0.2.18" libc = "0.2.42" time = "0.1.40" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "timeout" diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index 61743c10c..5881875c1 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -18,8 +18,8 @@ path = "src/touch.rs" filetime = "0.2.1" getopts = "0.2.18" time = "0.1.40" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["libc"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["libc"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "touch" diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index b128f128d..364c8ea44 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -18,8 +18,8 @@ path = "src/tr.rs" bit-set = "0.5.0" fnv = "1.0.5" getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "tr" diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index 7d8ae5f72..7c05520da 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/true.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "true" diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index bf5719266..9124c0bdf 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -16,8 +16,8 @@ path = "src/truncate.rs" [dependencies] clap = "2.33" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "truncate" diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index e34d698c2..2c2dfcf42 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -16,8 +16,8 @@ path = "src/tsort.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "tsort" diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index 56909cd9d..d0cb0214c 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -17,8 +17,8 @@ path = "src/tty.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "tty" diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index 30bb9bdbe..4eed217d0 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -17,8 +17,8 @@ path = "src/uname.rs" [dependencies] clap = "2.32" platform-info = "0.0.1" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "uname" diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index 2ce929b5b..57b86f5cd 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -17,8 +17,8 @@ path = "src/unexpand.rs" [dependencies] getopts = "0.2.18" unicode-width = "0.1.5" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "unexpand" diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index 60f32b373..0abdc3ac9 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -16,8 +16,8 @@ path = "src/uniq.rs" [dependencies] getopts = "0.2.18" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "uniq" diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index 0ee06c5e0..a4b84d999 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -17,8 +17,8 @@ path = "src/unlink.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "unlink" diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index 39028b2c7..8b0ff0e79 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -19,8 +19,8 @@ getopts = "0.2.18" time = "0.1.40" chrono = "0.4" clap = "2.32" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["libc", "utmpx"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["libc", "utmpx"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "uptime" diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index 358d2dcbd..e171ecd75 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -16,8 +16,8 @@ path = "src/users.rs" [dependencies] clap = "2.33" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["utmpx"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["utmpx"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "users" diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index 303528531..fe84d17f4 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -16,8 +16,8 @@ path = "src/wc.rs" [dependencies] clap = "2.33" -uucore = { version="0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "wc" diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index 8b3df8890..121299036 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/who.rs" [dependencies] -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["utmpx"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["utmpx"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "who" diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index 4be83d80e..068eaa40a 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -17,8 +17,8 @@ path = "src/whoami.rs" [dependencies] advapi32-sys = "0.2.0" clap = "2.32" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["entries", "wide"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "wide"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } winapi = { version = "0.3", features = ["lmcons"] } [[bin]] diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index b9419c4ec..499baa67c 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -16,8 +16,8 @@ path = "src/yes.rs" [dependencies] clap = "2.32" -uucore = { version="0.0.4", package="uucore", path="../../uucore", features=["zero-copy"] } -uucore_procs = { version="0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["zero-copy"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [features] default = [] From f30a0e3560e2061cefbb5451ec64311348518848 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 7 Nov 2020 19:35:03 -0600 Subject: [PATCH 192/606] maint/deps ~ pin 'cc' crate (avoids forced MinSRV update) --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 865a5d8e0..427c330bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -324,6 +324,7 @@ whoami = { optional=true, version="0.0.1", package="uu_whoami", path="src/uu/w yes = { optional=true, version="0.0.1", package="uu_yes", path="src/uu/yes" } # # * pinned transitive dependencies +pin_cc = { version="1.0.0, < 1.0.62", package="cc" } ## cc v1.0.62 has compiler errors for MinRustV v1.32.0, needs 1.34 (for `std::str::split_ascii_whitespace()`) pin_rustc-demangle = { version="0.1.16, < 0.1.17", package="rustc-demangle" } ## rust-demangle v0.1.17 has compiler errors for MinRustV v1.32.0, expects 1.33 pin_same-file = { version="1.0.4, < 1.0.6", package="same-file" } ## same-file v1.0.6 has compiler errors for MinRustV v1.32.0, expects 1.34 pin_winapi-util = { version="0.1.2, < 0.1.3", package="winapi-util" } ## winapi-util v0.1.3 has compiler errors for MinRustV v1.32.0, expects 1.34 From e9a767a59c9d874569e4994aa09ed1c973f836ad Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 7 Nov 2020 14:08:31 -0600 Subject: [PATCH 193/606] update deps ~ Cargo.lock (via `cargo +1.32.0 update`) --- Cargo.lock | 481 ++++++++++++++++++++++++++--------------------------- 1 file changed, 239 insertions(+), 242 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 76dd02abc..d2c0340b9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,7 +17,7 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.14" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -158,8 +158,8 @@ name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -187,7 +187,7 @@ dependencies = [ [[package]] name = "const_fn" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -202,12 +202,13 @@ dependencies = [ name = "coreutils" version = "0.0.1" dependencies = [ + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -311,7 +312,7 @@ dependencies = [ "uu_who 0.0.1", "uu_whoami 0.0.1", "uu_yes 0.0.1", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -398,14 +399,14 @@ dependencies = [ "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "oorandom 11.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", @@ -448,7 +449,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -462,13 +463,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bstr 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -520,7 +521,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -549,10 +550,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "filetime" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -771,16 +772,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "num-integer" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -800,7 +801,7 @@ name = "number_prefix" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -870,14 +871,14 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "js-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ppv-lite86" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -952,7 +953,7 @@ name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ppv-lite86 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1031,12 +1032,12 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1050,7 +1051,7 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.20" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1359,32 +1360,32 @@ name = "uu_arch" version = "0.0.1" dependencies = [ "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] name = "uu_base32" version = "0.0.1" dependencies = [ - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] name = "uu_base64" version = "0.0.1" dependencies = [ - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] name = "uu_basename" version = "0.0.1" dependencies = [ - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1393,16 +1394,16 @@ version = "0.0.1" dependencies = [ "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] name = "uu_chgrp" version = "0.0.1" dependencies = [ - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1411,8 +1412,8 @@ name = "uu_chmod" version = "0.0.1" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", "walker 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1421,8 +1422,8 @@ name = "uu_chown" version = "0.0.1" dependencies = [ "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1431,8 +1432,8 @@ name = "uu_chroot" version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1440,8 +1441,8 @@ name = "uu_cksum" version = "0.0.1" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1450,8 +1451,8 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1459,12 +1460,12 @@ name = "uu_cp" version = "0.0.1" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1474,8 +1475,8 @@ dependencies = [ name = "uu_cut" version = "0.0.1" dependencies = [ - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1484,8 +1485,8 @@ version = "0.0.1" dependencies = [ "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1495,8 +1496,8 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1505,8 +1506,8 @@ name = "uu_dircolors" version = "0.0.1" dependencies = [ "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1514,8 +1515,8 @@ name = "uu_dirname" version = "0.0.1" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1523,16 +1524,16 @@ name = "uu_du" version = "0.0.1" dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] name = "uu_echo" version = "0.0.1" dependencies = [ - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1542,8 +1543,8 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1552,8 +1553,8 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1562,8 +1563,8 @@ version = "0.0.1" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1571,22 +1572,22 @@ name = "uu_factor" version = "0.0.1" dependencies = [ "criterion 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] name = "uu_false" version = "0.0.1" dependencies = [ - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1595,16 +1596,16 @@ version = "0.0.1" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] name = "uu_fold" version = "0.0.1" dependencies = [ - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1612,8 +1613,8 @@ name = "uu_groups" version = "0.0.1" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1625,13 +1626,13 @@ dependencies = [ "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1639,8 +1640,8 @@ name = "uu_head" version = "0.0.1" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1648,8 +1649,8 @@ name = "uu_hostid" version = "0.0.1" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1659,8 +1660,8 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1668,8 +1669,8 @@ dependencies = [ name = "uu_id" version = "0.0.1" dependencies = [ - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1679,8 +1680,8 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1688,8 +1689,8 @@ name = "uu_join" version = "0.0.1" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1697,8 +1698,8 @@ name = "uu_kill" version = "0.0.1" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1706,8 +1707,8 @@ name = "uu_link" version = "0.0.1" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1715,8 +1716,8 @@ name = "uu_ln" version = "0.0.1" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1724,8 +1725,8 @@ name = "uu_logname" version = "0.0.1" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1740,8 +1741,8 @@ dependencies = [ "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1750,8 +1751,8 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1760,8 +1761,8 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1770,8 +1771,8 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1781,8 +1782,8 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1793,8 +1794,8 @@ dependencies = [ "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1803,8 +1804,8 @@ version = "0.0.1" dependencies = [ "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1813,22 +1814,22 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] name = "uu_nl" version = "0.0.1" dependencies = [ - "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1837,8 +1838,8 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1848,8 +1849,8 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1857,8 +1858,8 @@ name = "uu_numfmt" version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1869,8 +1870,8 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "half 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1878,8 +1879,8 @@ name = "uu_paste" version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1888,16 +1889,16 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] name = "uu_pinky" version = "0.0.1" dependencies = [ - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1905,8 +1906,8 @@ name = "uu_printenv" version = "0.0.1" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1914,22 +1915,22 @@ name = "uu_printf" version = "0.0.1" dependencies = [ "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] name = "uu_ptx" version = "0.0.1" dependencies = [ - "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1937,8 +1938,8 @@ name = "uu_pwd" version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1947,8 +1948,8 @@ version = "0.0.1" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1956,8 +1957,8 @@ name = "uu_realpath" version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1965,8 +1966,8 @@ name = "uu_relpath" version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1975,8 +1976,8 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1985,8 +1986,8 @@ name = "uu_rmdir" version = "0.0.1" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -1994,21 +1995,21 @@ name = "uu_seq" version = "0.0.1" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] name = "uu_shred" version = "0.0.1" dependencies = [ - "filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2017,8 +2018,8 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2026,8 +2027,8 @@ name = "uu_sleep" version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2037,8 +2038,8 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2046,8 +2047,8 @@ name = "uu_split" version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2056,8 +2057,8 @@ version = "0.0.1" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2067,8 +2068,8 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "uu_stdbuf_libstdbuf 0.0.1", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2078,8 +2079,8 @@ dependencies = [ "cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2087,8 +2088,8 @@ name = "uu_sum" version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2097,8 +2098,8 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2107,8 +2108,8 @@ name = "uu_tac" version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2118,8 +2119,8 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2129,8 +2130,8 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2139,8 +2140,8 @@ version = "0.0.1" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2150,19 +2151,19 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] name = "uu_touch" version = "0.0.1" dependencies = [ - "filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2172,16 +2173,16 @@ dependencies = [ "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] name = "uu_true" version = "0.0.1" dependencies = [ - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2189,8 +2190,8 @@ name = "uu_truncate" version = "0.0.1" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2198,8 +2199,8 @@ name = "uu_tsort" version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2208,8 +2209,8 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2218,8 +2219,8 @@ version = "0.0.1" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2228,8 +2229,8 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2237,8 +2238,8 @@ name = "uu_uniq" version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2247,8 +2248,8 @@ version = "0.0.1" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2259,8 +2260,8 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2268,8 +2269,8 @@ name = "uu_users" version = "0.0.1" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2277,16 +2278,16 @@ name = "uu_wc" version = "0.0.1" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] name = "uu_who" version = "0.0.1" dependencies = [ - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] @@ -2295,8 +2296,8 @@ version = "0.0.1" dependencies = [ "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2305,14 +2306,13 @@ name = "uu_yes" version = "0.0.1" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", - "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", + "uucore 0.0.4", + "uucore_procs 0.0.4", ] [[package]] name = "uucore" version = "0.0.4" -source = "git+https://github.com/uutils/uucore.git?branch=canary#869573459f00ba0b4af9f7d828370c105f31a94e" dependencies = [ "backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)", "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2332,7 +2332,6 @@ dependencies = [ [[package]] name = "uucore_procs" version = "0.0.4" -source = "git+https://github.com/uutils/uucore.git?branch=canary#869573459f00ba0b4af9f7d828370c105f31a94e" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2483,7 +2482,7 @@ dependencies = [ [metadata] "checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" "checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5" -"checksum aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b476ce7103678b0c6d3d395dbbae31d48ff910bd28be979ba5d48c6351131d0d" +"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" @@ -2506,7 +2505,7 @@ dependencies = [ "checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" "checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2" +"checksum const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab" "checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" "checksum cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d1cd8699ffa1b18fd388183f7762e0545eddbd5c6ec95e9e3b42a4a71a507ff" "checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" @@ -2521,7 +2520,7 @@ dependencies = [ "checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" "checksum crossbeam-epoch 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec0f606a85340376eef0d6d8fec399e6d4a544d648386c6645eb6d0653b27d9f" "checksum crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5" -"checksum csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279" +"checksum csv 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fc4666154fd004af3fd6f1da2e81a96fd5a81927fe8ddb6ecc79e2aa6e138b54" "checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" "checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" "checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" @@ -2532,7 +2531,7 @@ dependencies = [ "checksum failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82" "checksum failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "3ed85775dcc68644b5c950ac06a2b23768d3bc9390464151aaf27136998dcf9e" +"checksum filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "0c122a393ea57648015bf06fbd3d372378992e86b9ff5a7a497b076a28c79efe" "checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" "checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" @@ -2563,8 +2562,8 @@ dependencies = [ "checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" "checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -"checksum num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" -"checksum num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" "checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" "checksum number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee" "checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" @@ -2576,7 +2575,7 @@ dependencies = [ "checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" "checksum platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f2fd076acdc7a98374de6e300bf3af675997225bef21aecac2219553f04dd7e8" "checksum plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0d1685fbe7beba33de0330629da9d955ac75bd54f33d7b79f9a895590124f6bb" -"checksum ppv-lite86 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" +"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" "checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" "checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" @@ -2595,9 +2594,9 @@ dependencies = [ "checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8963b85b8ce3074fecffde43b4b0dded83ce2f367dc8d363afc56679f3ee820b" +"checksum regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -"checksum regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)" = "8cab7a364d15cde1e505267766a2d3c4e22a843e1a601f0fa7564c0f82ced11c" +"checksum regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" @@ -2636,8 +2635,6 @@ dependencies = [ "checksum unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" "checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" "checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" -"checksum uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)" = "" -"checksum uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)" = "" "checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" From bc1084a9f5c2635c524453b6c1387258907fd7e7 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 7 Nov 2020 19:58:23 -0600 Subject: [PATCH 194/606] uucore/refactor ~ fix `cargo clippy` complaints (or_fun_call) --- src/uucore/src/lib/features/fs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index d1c0a3f7c..6fda8460a 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -39,7 +39,7 @@ pub fn resolve_relative_path(path: &Path) -> Cow { return path.into(); } let root = Component::RootDir.as_os_str(); - let mut result = env::current_dir().unwrap_or(PathBuf::from(root)); + let mut result = env::current_dir().unwrap_or_else(|_| PathBuf::from(root)); for comp in path.components() { match comp { Component::ParentDir => { From 3941d3f18ca721ea6177ff7e3f3bed1008615a49 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 7 Nov 2020 20:00:07 -0600 Subject: [PATCH 195/606] uucore/refactor ~ fix `cargo clippy` complaints (len_zero) --- src/uucore/src/lib/features/mode.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/lib/features/mode.rs b/src/uucore/src/lib/features/mode.rs index 7f102e792..50679d107 100644 --- a/src/uucore/src/lib/features/mode.rs +++ b/src/uucore/src/lib/features/mode.rs @@ -46,7 +46,7 @@ pub fn parse_symbolic( let respect_umask = pos == 0; let last_umask = unsafe { umask(0) }; mode = &mode[pos..]; - while mode.len() > 0 { + while !mode.is_empty() { let (op, pos) = parse_op(mode, None)?; mode = &mode[pos..]; let (mut srwx, pos) = parse_change(mode, fperm, considering_dir); From 9473abf3ba883c6908240f510591b27ffb1fa112 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 7 Nov 2020 20:03:43 -0600 Subject: [PATCH 196/606] uucore/polish ~ fix `cargo clippy` complaints (missing_safety_doc; with ToDO for safety note) --- src/uucore/src/lib/features/zero_copy.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/uucore/src/lib/features/zero_copy.rs b/src/uucore/src/lib/features/zero_copy.rs index f56050a92..1eb2c1547 100644 --- a/src/uucore/src/lib/features/zero_copy.rs +++ b/src/uucore/src/lib/features/zero_copy.rs @@ -9,6 +9,8 @@ pub trait AsRawObject { } pub trait FromRawObject: Sized { + /// # Safety + /// ToDO ... unsafe fn from_raw_object(obj: RawObject) -> Option; } From 66dfd73ffee8dc55faceeca04057a41637bab9c3 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 7 Nov 2020 20:05:24 -0600 Subject: [PATCH 197/606] uucore/refactor ~ fix `cargo clippy` complaints (iter_nth_zero) --- src/uucore/src/lib/features/utmpx.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/lib/features/utmpx.rs b/src/uucore/src/lib/features/utmpx.rs index f1b692e7c..4a101e22c 100644 --- a/src/uucore/src/lib/features/utmpx.rs +++ b/src/uucore/src/lib/features/utmpx.rs @@ -190,7 +190,7 @@ impl Utmpx { pub fn canon_host(&self) -> IOResult { const AI_CANONNAME: libc::c_int = 0x2; let host = self.host(); - let host = host.split(':').nth(0).unwrap(); + let host = host.split(':').next().unwrap(); let hints = libc::addrinfo { ai_flags: AI_CANONNAME, ai_family: 0, From 3dc9f76c7fa6eb0ed236e38ee084ea4ca97984f8 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 7 Nov 2020 20:15:02 -0600 Subject: [PATCH 198/606] uucore/refactor ~ fix `cargo clippy` complaints (*allow* type_complexity) --- src/uucore/src/lib/features/zero_copy/platform/linux.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uucore/src/lib/features/zero_copy/platform/linux.rs b/src/uucore/src/lib/features/zero_copy/platform/linux.rs index 4f2412226..e2bed3061 100644 --- a/src/uucore/src/lib/features/zero_copy/platform/linux.rs +++ b/src/uucore/src/lib/features/zero_copy/platform/linux.rs @@ -22,6 +22,7 @@ pub struct PlatformZeroCopyWriter { raw_obj: RawObject, read_pipe: RawFd, write_pipe: RawFd, + #[allow(clippy::type_complexity)] write_fn: fn(&mut PlatformZeroCopyWriter, &[IoVec<&[u8]>], usize) -> io::Result, } From 2b4b31a9eec2c03805703a54e4510f79c35882ed Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 7 Nov 2020 20:12:35 -0600 Subject: [PATCH 199/606] 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. --- src/uucore/src/lib/features/utmpx.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/uucore/src/lib/features/utmpx.rs b/src/uucore/src/lib/features/utmpx.rs index 4a101e22c..ab3de65fa 100644 --- a/src/uucore/src/lib/features/utmpx.rs +++ b/src/uucore/src/lib/features/utmpx.rs @@ -242,6 +242,8 @@ impl UtmpxIter { /// /// If not set, default record file will be used(file path depends on the target OS) pub fn read_from(self, f: &str) -> Self { + // FixME: discuss and revise a rewrite which is correct and satisfies clippy/rustc + #[allow(clippy::temporary_cstring_as_ptr)] let res = unsafe { utmpxname(CString::new(f).unwrap().as_ptr()) }; if res != 0 { println!("Warning: {}", IOError::last_os_error()); From 688db0d4a27b5fa475f3f9a574713282c3433e55 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 8 Nov 2020 00:04:22 -0600 Subject: [PATCH 200/606] refactor/uucore ~ revise 'Cargo.toml' towards repo norms --- src/uucore/Cargo.toml | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 34101590b..db3b35004 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -7,6 +7,7 @@ description = "uutils ~ 'core' uutils code library (cross-platform)" homepage = "https://github.com/uutils/coreutils" repository = "https://github.com/uutils/coreutils/tree/master/src/uu/arch" +# readme = "README.md" keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"] categories = ["command-line-utilities"] edition = "2018" @@ -18,27 +19,25 @@ path="src/lib/lib.rs" dunce = "1.0.0" getopts = "<= 0.2.21" wild = "2.0.4" -## optional -failure = { version = "<= 0.1.1", optional = true } -failure_derive = { version = "<= 0.1.1", optional = true } -lazy_static = { version = "1.3", optional = true } -nix = { version = "<= 0.13", optional = true } -platform-info = { version = "<= 0.0.1", optional = true } -time = { version = "<= 0.1.42", optional = true } -## "problem" dependencies -# * backtrace: transitive dependency via 'failure'; pin to <= v0.3.30 to avoid increasing MinSRV to v1.33.0 -backtrace = ">= 0.3.3, <= 0.3.30" -# * data-encoding: require v2.1; but v2.2.0 breaks the build for MinSRV v1.31.0 -data-encoding = { version = "~2.1", optional = true } -# * libc: initial utmp support added in v0.2.15; but v0.2.68 breaks the build for MinSRV v1.31.0 -libc = { version = "0.2.15, <= 0.2.66", optional = true } +# * optional +failure = { version="<= 0.1.1", optional=true } +failure_derive = { version="<= 0.1.1", optional=true } +lazy_static = { version="1.3", optional=true } +nix = { version="<= 0.13", optional=true } +platform-info = { version="<= 0.0.1", optional=true } +time = { version="<= 0.1.42", optional=true } +# * "problem" dependencies (pinned) +data-encoding = { version="~2.1", optional=true } ## data-encoding: require v2.1; but v2.2.0 breaks the build for MinSRV v1.31.0 +libc = { version="0.2.15, <= 0.2.66", optional=true } ## libc: initial utmp support added in v0.2.15; but v0.2.68 breaks the build for MinSRV v1.31.0 +# * pinned transitive dependencies +pin_backtrace = { version=">= 0.3.3, <= 0.3.30", package="backtrace" } ## backtrace: transitive dependency via 'failure'; pin to <= v0.3.30 to avoid increasing MinSRV to v1.33.0 [target.'cfg(target_os = "redox")'.dependencies] termion = "1.5" [features] default = [] -## non-default features +# * non-default features encoding = ["data-encoding", "failure", "failure_derive"] entries = ["libc"] fs = ["libc"] From e493ad1f26b76adace901505ff8bbf8dd2cdc939 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 8 Nov 2020 00:04:42 -0600 Subject: [PATCH 201/606] refactor/uucore_procs ~ revise 'Cargo.toml' towards repo norms --- src/uucore_procs/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uucore_procs/Cargo.toml b/src/uucore_procs/Cargo.toml index 7d1d8bfab..774232777 100644 --- a/src/uucore_procs/Cargo.toml +++ b/src/uucore_procs/Cargo.toml @@ -22,5 +22,5 @@ syn = { version="1.0" } [features] default = [] -## non-default features -debug = ["syn/extra-traits"] ## add Debug traits to syn structs (for `println!("{:?}", ...)`) +# * non-default features +debug = ["syn/extra-traits"] ## add Debug traits to syn structures (for `println!("{:?}", ...)`) From 1b9267644c40eeb1c953c3fddf2c63dfab5328b3 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 8 Nov 2020 09:17:07 +0100 Subject: [PATCH 202/606] pin cc version. 1.0.62 fails with rust 1.32 --- Cargo.lock | 95 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 1 + 2 files changed, 49 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 76dd02abc..931470178 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,7 +17,7 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.14" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -158,8 +158,8 @@ name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -187,7 +187,7 @@ dependencies = [ [[package]] name = "const_fn" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -202,12 +202,13 @@ dependencies = [ name = "coreutils" version = "0.0.1" dependencies = [ + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -398,14 +399,14 @@ dependencies = [ "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "oorandom 11.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", @@ -448,7 +449,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -462,13 +463,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bstr 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -520,7 +521,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -549,10 +550,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "filetime" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -771,16 +772,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "num-integer" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -800,7 +801,7 @@ name = "number_prefix" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -870,14 +871,14 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "js-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ppv-lite86" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -952,7 +953,7 @@ name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ppv-lite86 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1031,12 +1032,12 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1050,7 +1051,7 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.20" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1459,7 +1460,7 @@ name = "uu_cp" version = "0.0.1" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1571,7 +1572,7 @@ name = "uu_factor" version = "0.0.1" dependencies = [ "criterion 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1625,8 +1626,8 @@ dependencies = [ "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1821,12 +1822,12 @@ dependencies = [ name = "uu_nl" version = "0.0.1" dependencies = [ - "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -1922,12 +1923,12 @@ dependencies = [ name = "uu_ptx" version = "0.0.1" dependencies = [ - "aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", ] @@ -2002,7 +2003,7 @@ dependencies = [ name = "uu_shred" version = "0.0.1" dependencies = [ - "filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2158,7 +2159,7 @@ dependencies = [ name = "uu_touch" version = "0.0.1" dependencies = [ - "filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", @@ -2483,7 +2484,7 @@ dependencies = [ [metadata] "checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" "checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5" -"checksum aho-corasick 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b476ce7103678b0c6d3d395dbbae31d48ff910bd28be979ba5d48c6351131d0d" +"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" @@ -2506,7 +2507,7 @@ dependencies = [ "checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" "checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum const_fn 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2" +"checksum const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab" "checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" "checksum cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d1cd8699ffa1b18fd388183f7762e0545eddbd5c6ec95e9e3b42a4a71a507ff" "checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" @@ -2521,7 +2522,7 @@ dependencies = [ "checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" "checksum crossbeam-epoch 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec0f606a85340376eef0d6d8fec399e6d4a544d648386c6645eb6d0653b27d9f" "checksum crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5" -"checksum csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279" +"checksum csv 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fc4666154fd004af3fd6f1da2e81a96fd5a81927fe8ddb6ecc79e2aa6e138b54" "checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" "checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" "checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" @@ -2532,7 +2533,7 @@ dependencies = [ "checksum failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82" "checksum failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum filetime 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "3ed85775dcc68644b5c950ac06a2b23768d3bc9390464151aaf27136998dcf9e" +"checksum filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "0c122a393ea57648015bf06fbd3d372378992e86b9ff5a7a497b076a28c79efe" "checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" "checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" @@ -2563,8 +2564,8 @@ dependencies = [ "checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" "checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -"checksum num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" -"checksum num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" "checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" "checksum number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee" "checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" @@ -2576,7 +2577,7 @@ dependencies = [ "checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" "checksum platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f2fd076acdc7a98374de6e300bf3af675997225bef21aecac2219553f04dd7e8" "checksum plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0d1685fbe7beba33de0330629da9d955ac75bd54f33d7b79f9a895590124f6bb" -"checksum ppv-lite86 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" +"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" "checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" "checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" @@ -2595,9 +2596,9 @@ dependencies = [ "checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8963b85b8ce3074fecffde43b4b0dded83ce2f367dc8d363afc56679f3ee820b" +"checksum regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -"checksum regex-syntax 0.6.20 (registry+https://github.com/rust-lang/crates.io-index)" = "8cab7a364d15cde1e505267766a2d3c4e22a843e1a601f0fa7564c0f82ced11c" +"checksum regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" diff --git a/Cargo.toml b/Cargo.toml index bcf9a7615..1ef92d41d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -327,6 +327,7 @@ yes = { optional=true, version="0.0.1", package="uu_yes", path="src/uu/yes" pin_rustc-demangle = { version="0.1.16, < 0.1.17", package="rustc-demangle" } ## rust-demangle v0.1.17 has compiler errors for MinRustV v1.32.0, expects 1.33 pin_same-file = { version="1.0.4, < 1.0.6", package="same-file" } ## same-file v1.0.6 has compiler errors for MinRustV v1.32.0, expects 1.34 pin_winapi-util = { version="0.1.2, < 0.1.3", package="winapi-util" } ## winapi-util v0.1.3 has compiler errors for MinRustV v1.32.0, expects 1.34 +pin_cc = { version="1.0.61, < 1.0.62", package="cc" } ## cc v1.0.62 has compiler errors for MinRustV v1.32.0, expects 1.34 [dev-dependencies] conv = "0.3" From 61520546a5d00a3395a8534bf9690f9ef8ad721e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 8 Nov 2020 23:26:42 +0100 Subject: [PATCH 203/606] refactor(rm): Move to clap + add a test --- Cargo.lock | 2 +- src/uu/rm/Cargo.toml | 2 +- src/uu/rm/src/rm.rs | 195 +++++++++++++++++++++++++-------------- tests/by-util/test_rm.rs | 8 ++ 4 files changed, 135 insertions(+), 72 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 931470178..87a045852 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1974,7 +1974,7 @@ dependencies = [ name = "uu_rm" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index 8fbd14663..02ac4103b 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/rm.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" walkdir = "2.2.8" remove_dir_all = "0.5.1" uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary" } diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index f87f3e1ac..868f26860 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -7,13 +7,14 @@ // spell-checker:ignore (ToDO) bitor ulong -extern crate getopts; +extern crate clap; extern crate remove_dir_all; extern crate walkdir; #[macro_use] extern crate uucore; +use clap::{App, Arg, ArgMatches}; use remove_dir_all::remove_dir_all; use std::collections::VecDeque; use std::fs; @@ -40,83 +41,139 @@ struct Options { verbose: bool, } -static NAME: &str = "rm"; +static ABOUT: &str = "Remove (unlink) the FILE(s)"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static OPT_FORCE: &str = "force"; +static OPT_PROMPT: &str = "prompt"; +static OPT_PROMPT_MORE: &str = "prompt-more"; +static OPT_INTERACTIVE: &str = "interactive"; +static OPT_ONE_FILE_SYSTEM: &str = "one-file-system"; +static OPT_NO_PRESERVE_ROOT: &str = "no-preserve-root"; +static OPT_PRESERVE_ROOT: &str = "preserve-root"; +static OPT_RECURSIVE: &str = "recursive"; +static OPT_DIR: &str = "dir"; +static OPT_VERBOSE: &str = "verbose"; + +static ARG_FILES: &str = "files"; + +fn get_usage() -> String { + format!("{0} [OPTION]... FILE...", executable!()) +} + +fn get_long_usage() -> String { + String::from( + "By default, rm does not remove directories. Use the --recursive (-r) + option to remove each listed directory, too, along with all of its contents + + To remove a file whose name starts with a '-', for example '-foo', + use one of these commands: + rm -- -foo + + rm ./-foo + + Note that if you use rm to remove a file, it might be possible to recover + some of its contents, given sufficient expertise and/or time. For greater + assurance that the contents are truly unrecoverable, consider using shred.", + ) +} pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); + let long_usage = get_long_usage(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(&long_usage[..]) // TODO: make getopts support -R in addition to -r - let mut opts = getopts::Options::new(); - opts.optflag( - "f", - "force", - "ignore nonexistent files and arguments, never prompt", - ); - opts.optflag("i", "", "prompt before every removal"); - opts.optflag("I", "", "prompt once before removing more than three files, or when removing recursively. Less intrusive than -i, while still giving some protection against most mistakes"); - opts.optflagopt( - "", - "interactive", - "prompt according to WHEN: never, once (-I), or always (-i). Without WHEN, prompts always", - "WHEN", - ); - opts.optflag("", "one-file-system", "when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument (NOT IMPLEMENTED)"); - opts.optflag("", "no-preserve-root", "do not treat '/' specially"); - opts.optflag("", "preserve-root", "do not remove '/' (default)"); - opts.optflag( - "r", - "recursive", - "remove directories and their contents recursively", - ); - opts.optflag("d", "dir", "remove empty directories"); - opts.optflag("v", "verbose", "explain what is being done"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); + .arg( + Arg::with_name(OPT_FORCE) + .short("f") + .long(OPT_FORCE) + .help("ignore nonexistent files and arguments, never prompt") + ) + .arg( + Arg::with_name(OPT_PROMPT) + .short("i") + .long("prompt before every removal") + ) + .arg( + Arg::with_name(OPT_PROMPT_MORE) + .short("I") + .help("prompt once before removing more than three files, or when removing recursively. Less intrusive than -i, while still giving some protection against most mistakes") + ) + .arg( + Arg::with_name(OPT_INTERACTIVE) + .long(OPT_INTERACTIVE) + .help("prompt according to WHEN: never, once (-I), or always (-i). Without WHEN, prompts always") + .value_name("WHEN") + .takes_value(true) + ) + .arg( + Arg::with_name(OPT_ONE_FILE_SYSTEM) + .long(OPT_ONE_FILE_SYSTEM) + .help("when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument (NOT IMPLEMENTED)") + ) + .arg( + Arg::with_name(OPT_NO_PRESERVE_ROOT) + .long(OPT_NO_PRESERVE_ROOT) + .help("do not treat '/' specially") + ) + .arg( + Arg::with_name(OPT_PRESERVE_ROOT) + .long(OPT_PRESERVE_ROOT) + .help("do not remove '/' (default)") + ) + .arg( + Arg::with_name(OPT_RECURSIVE).short("r") + .long(OPT_RECURSIVE) + .help("remove directories and their contents recursively") + ) + .arg( + Arg::with_name(OPT_DIR) + .short("d") + .long(OPT_DIR) + .help("remove empty directories") + ) + .arg( + Arg::with_name(OPT_VERBOSE) + .short("v") + .long(OPT_VERBOSE) + .help("explain what is being done") + ) + .arg( + Arg::with_name(ARG_FILES) + .multiple(true) + .takes_value(true) + .min_values(1) + ) + .get_matches_from(args); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f), - }; + let files: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); - let force = matches.opt_present("force"); + let force = matches.is_present(OPT_FORCE); - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage:"); - println!(" {0} [OPTION]... [FILE]...", NAME); - println!(); - println!("{}", opts.usage("Remove (unlink) the FILE(s).")); - println!("By default, rm does not remove directories. Use the --recursive (-r)"); - println!("option to remove each listed directory, too, along with all of its contents"); - println!(); - println!("To remove a file whose name starts with a '-', for example '-foo',"); - println!("use one of these commands:"); - println!("rm -- -foo"); - println!(); - println!("rm ./-foo"); - println!(); - println!("Note that if you use rm to remove a file, it might be possible to recover"); - println!("some of its contents, given sufficient expertise and/or time. For greater"); - println!("assurance that the contents are truly unrecoverable, consider using shred."); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else if matches.free.is_empty() && !force { + if files.is_empty() && !force { + // Still check by hand and not use clap + // Because "rm -f" is a thing show_error!("missing an argument"); - show_error!("for help, try '{0} --help'", NAME); + show_error!("for help, try '{0} --help'", executable!()); return 1; } else { let options = Options { force, interactive: { - if matches.opt_present("i") { + if matches.is_present(OPT_PROMPT) { InteractiveMode::Always - } else if matches.opt_present("I") { + } else if matches.is_present(OPT_PROMPT_MORE) { InteractiveMode::Once - } else if matches.opt_present("interactive") { - match &matches.opt_str("interactive").unwrap()[..] { + } else if matches.is_present(OPT_INTERACTIVE) { + match &matches.value_of(OPT_INTERACTIVE).unwrap()[..] { "none" => InteractiveMode::None, "once" => InteractiveMode::Once, "always" => InteractiveMode::Always, @@ -126,15 +183,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { InteractiveMode::None } }, - one_fs: matches.opt_present("one-file-system"), - preserve_root: !matches.opt_present("no-preserve-root"), - recursive: matches.opt_present("recursive"), - dir: matches.opt_present("dir"), - verbose: matches.opt_present("verbose"), + one_fs: matches.is_present(OPT_ONE_FILE_SYSTEM), + preserve_root: !matches.is_present(OPT_NO_PRESERVE_ROOT), + recursive: matches.is_present(OPT_RECURSIVE), + dir: matches.is_present(OPT_DIR), + verbose: matches.is_present(OPT_VERBOSE), }; - if options.interactive == InteractiveMode::Once - && (options.recursive || matches.free.len() > 3) - { + if options.interactive == InteractiveMode::Once && (options.recursive || files.len() > 3) { let msg = if options.recursive { "Remove all arguments recursively? " } else { @@ -145,7 +200,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } - if remove(matches.free, options) { + if remove(files, options) { return 1; } } diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 88e70946a..7c5a1c787 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -12,6 +12,14 @@ fn test_rm_one_file() { assert!(!at.file_exists(file)); } +#[test] +fn test_rm_failed() { + let (_at, mut ucmd) = at_and_ucmd!(); + let file = "test_rm_one_file"; + + ucmd.arg(file).fails(); // Doesn't exist +} + #[test] fn test_rm_multiple_files() { let (at, mut ucmd) = at_and_ucmd!(); From 2febd13733069de8eb54663eb8697161665e8892 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 11 Nov 2020 22:33:35 +0100 Subject: [PATCH 204/606] refactor(sync): Move to clap + add tests --- Cargo.lock | 2 +- src/uu/sync/Cargo.toml | 2 +- src/uu/sync/src/sync.rs | 63 ++++++++------------------------------ tests/by-util/test_sync.rs | 12 +++++++- 4 files changed, 26 insertions(+), 53 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 931470178..1ab7b0fdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2096,7 +2096,7 @@ dependencies = [ name = "uu_sync" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", "uucore_procs 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index d6dab2788..746554528 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/sync.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["wide"] } uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } diff --git a/src/uu/sync/src/sync.rs b/src/uu/sync/src/sync.rs index bb6d8cd80..c1b6cb8ad 100644 --- a/src/uu/sync/src/sync.rs +++ b/src/uu/sync/src/sync.rs @@ -7,17 +7,14 @@ /* Last synced with: sync (GNU coreutils) 8.13 */ -extern crate getopts; +extern crate clap; extern crate libc; -#[cfg(windows)] #[macro_use] extern crate uucore; -#[cfg(not(windows))] -extern crate uucore; - -static NAME: &str = "sync"; +use clap::App; +static ABOUT: &str = "Synchronize cached writes to persistent storage"; static VERSION: &str = env!("CARGO_PKG_VERSION"); #[cfg(unix)] @@ -118,57 +115,23 @@ mod platform { } } +fn get_usage() -> String { + format!("{0} [OPTION]... FILE...", executable!()) +} + pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = getopts::Options::new(); - - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - _ => { - help(&opts); - return 1; - } - }; - - if matches.opt_present("h") { - help(&opts); - return 0; - } - - if matches.opt_present("V") { - version(); - return 0; - } + let _matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .get_matches_from(args); sync(); 0 } -fn version() { - println!("{} (uutils) {}", NAME, VERSION); - println!("The MIT License"); - println!(); - println!("Author -- Alexander Fomin."); -} - -fn help(opts: &getopts::Options) { - let msg = format!( - "{0} {1} - -Usage: - {0} [OPTION] - -Force changed blocks to disk, update the super block.", - NAME, VERSION - ); - - print!("{}", opts.usage(&msg)); -} - fn sync() -> isize { unsafe { platform::do_sync() } } diff --git a/tests/by-util/test_sync.rs b/tests/by-util/test_sync.rs index 651491045..e4eb72eac 100644 --- a/tests/by-util/test_sync.rs +++ b/tests/by-util/test_sync.rs @@ -1 +1,11 @@ -// ToDO: add tests +use crate::common::util::*; + +#[test] +fn test_sync_default() { + new_ucmd!().run(); +} + +#[test] +fn test_sync_incorrect_arg() { + new_ucmd!().arg("--foo").fails(); +} From 2edfe32c486f654353496ceb91e0858033cf5123 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 13 Nov 2020 18:20:57 +0100 Subject: [PATCH 205/606] refactor(install): move to clap --- Cargo.lock | 2 +- src/uu/install/Cargo.toml | 2 +- src/uu/install/src/install.rs | 389 ++++++++++++++++++---------------- tests/by-util/test_install.rs | 2 +- 4 files changed, 213 insertions(+), 182 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 931470178..49372d3e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1677,7 +1677,7 @@ dependencies = [ name = "uu_install" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4 (git+https://github.com/uutils/uucore.git?branch=canary)", diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 3e00a9bd8..54680987b 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -18,7 +18,7 @@ edition = "2018" path = "src/install.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = ">= 0.2" uucore = { version="0.0.4", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["mode"] } uucore_procs = { version="0.0.4", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 4970689fb..c744579db 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -7,7 +7,7 @@ // spell-checker:ignore (ToDO) rwxr sourcepath targetpath -extern crate getopts; +extern crate clap; extern crate libc; mod mode; @@ -15,15 +15,11 @@ mod mode; #[macro_use] extern crate uucore; +use clap::{App, Arg, ArgMatches}; use std::fs; use std::path::{Path, PathBuf}; use std::result::Result; -static NAME: &str = "install"; -static SUMMARY: &str = "Copy SOURCE to DEST or multiple SOURCE(s) to the existing - DIRECTORY, while setting permission modes and owner/group"; -static LONG_HELP: &str = ""; - const DEFAULT_MODE: u32 = 755; #[allow(dead_code)] @@ -52,14 +48,179 @@ impl Behavior { } } +static ABOUT: &str = "Copy SOURCE to DEST or multiple SOURCE(s) to the existing + DIRECTORY, while setting permission modes and owner/group"; +static VERSION: &str = env!("CARGO_PKG_VERSION"); + +static OPT_COMPARE: &str = "compare"; +static OPT_BACKUP: &str = "backup"; +static OPT_BACKUP_2: &str = "backup2"; +static OPT_DIRECTORY: &str = "directory"; +static OPT_IGNORED: &str = "ignored"; +static OPT_CREATED: &str = "created"; +static OPT_GROUP: &str = "group"; +static OPT_MODE: &str = "mode"; +static OPT_OWNER: &str = "owner"; +static OPT_PRESERVE_TIMESTAMPS: &str = "preserve-timestamps"; +static OPT_STRIP: &str = "strip"; +static OPT_STRIP_PROGRAM: &str = "strip-program"; +static OPT_SUFFIX: &str = "suffix"; +static OPT_TARGET_DIRECTORY: &str = "target-directory"; +static OPT_NO_TARGET_DIRECTORY: &str = "no-target-directory"; +static OPT_VERBOSE: &str = "verbose"; +static OPT_PRESERVE_CONTEXT: &str = "preserve-context"; +static OPT_CONTEXT: &str = "context"; + +static ARG_FILES: &str = "files"; + +fn get_usage() -> String { + format!("{0} [OPTION]... [FILE]...", executable!()) +} + /// Main install utility function, called from main.rs. /// /// Returns a program return code. /// pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let matches = parse_opts(args); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_BACKUP) + .long(OPT_BACKUP) + .help("(unimplemented) make a backup of each existing destination file") + .value_name("CONTROL") + ) + // TODO implement flag + .arg( + Arg::with_name(OPT_BACKUP_2) + .short("b") + .help("(unimplemented) like --backup but does not accept an argument") + ) + .arg( + Arg::with_name(OPT_IGNORED) + .short("c") + .help("ignored") + ) + .arg( + // TODO implement flag + Arg::with_name(OPT_COMPARE) + .short("C") + .long(OPT_COMPARE) + .help("(unimplemented) compare each pair of source and destination files, and in some cases, do not modify the destination at all") + ) + .arg( + Arg::with_name(OPT_DIRECTORY) + .short("d") + .long(OPT_DIRECTORY) + .help("treat all arguments as directory names. create all components of the specified directories") + ) + + .arg( + // TODO implement flag + Arg::with_name(OPT_CREATED) + .short("D") + .help("(unimplemented) create all leading components of DEST except the last, then copy SOURCE to DEST") + ) + .arg( + // TODO implement flag + Arg::with_name(OPT_GROUP) + .short("g") + .long(OPT_GROUP) + .help("(unimplemented) set group ownership, instead of process's current group") + .value_name("GROUP") + ) + .arg( + Arg::with_name(OPT_MODE) + .short("m") + .long(OPT_MODE) + .help("set permission mode (as in chmod), instead of rwxr-xr-x") + .value_name("MODE") + ) + .arg( + // TODO implement flag + Arg::with_name(OPT_OWNER) + .short("o") + .long(OPT_OWNER) + .help("(unimplemented) set ownership (super-user only)") + .value_name("OWNER") + ) + .arg( + // TODO implement flag + Arg::with_name(OPT_PRESERVE_TIMESTAMPS) + .short("p") + .long(OPT_PRESERVE_TIMESTAMPS) + .help("(unimplemented) apply access/modification times of SOURCE files to corresponding destination files") + ) + .arg( + // TODO implement flag + Arg::with_name(OPT_STRIP) + .short("s") + .long(OPT_STRIP) + .help("(unimplemented) strip symbol tables") + ) + .arg( + // TODO implement flag + Arg::with_name(OPT_STRIP_PROGRAM) + .long(OPT_STRIP_PROGRAM) + .help("(unimplemented) program used to strip binaries") + .value_name("PROGRAM") + ) + .arg( + // TODO implement flag + Arg::with_name(OPT_SUFFIX) + .short("S") + .long(OPT_SUFFIX) + .help("(unimplemented) override the usual backup suffix") + .value_name("SUFFIX") + ) + .arg( + // TODO implement flag + Arg::with_name(OPT_TARGET_DIRECTORY) + .short("t") + .long(OPT_TARGET_DIRECTORY) + .help("(unimplemented) move all SOURCE arguments into DIRECTORY") + .value_name("DIRECTORY") + ) + .arg( + // TODO implement flag + Arg::with_name(OPT_NO_TARGET_DIRECTORY) + .short("T") + .long(OPT_NO_TARGET_DIRECTORY) + .help("(unimplemented) treat DEST as a normal file") + + ) + .arg( + Arg::with_name(OPT_VERBOSE) + .short("v") + .long(OPT_VERBOSE) + .help("explain what is being done") + ) + .arg( + // TODO implement flag + Arg::with_name(OPT_PRESERVE_CONTEXT) + .short("P") + .long(OPT_PRESERVE_CONTEXT) + .help("(unimplemented) preserve security context") + ) + .arg( + // TODO implement flag + Arg::with_name(OPT_CONTEXT) + .short("Z") + .long(OPT_CONTEXT) + .help("(unimplemented) set security context of files and directories") + .value_name("CONTEXT") + ) + .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) + .get_matches_from(args); + + let mut paths: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); if let Err(s) = check_unimplemented(&matches) { show_error!("Unimplemented feature: {}", s); @@ -73,146 +234,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } }; - let paths: Vec = { - #[allow(clippy::ptr_arg)] - fn string_to_path(s: &String) -> &Path { - Path::new(s) - }; - let to_owned = |p: &Path| p.to_owned(); - let arguments = matches.free.iter().map(string_to_path); - - arguments.map(to_owned).collect() - }; - match behavior.main_function { - MainFunction::Directory => directory(&paths[..], behavior), - MainFunction::Standard => standard(&paths[..], behavior), + MainFunction::Directory => directory(paths, behavior), + MainFunction::Standard => standard(paths, behavior), } } -/// Build a specification of the command line. -/// -/// Returns a getopts::Options struct. -/// -fn parse_opts(args: Vec) -> getopts::Matches { - let syntax = format!( - "SOURCE DEST - {} SOURCE... DIRECTORY", - NAME - ); - app!(&syntax, SUMMARY, LONG_HELP) - // TODO implement flag - .optflagopt( - "", - "backup", - "(unimplemented) make a backup of each existing destination\n \ - file", - "CONTROL", - ) - // TODO implement flag - .optflag( - "b", - "", - "(unimplemented) like --backup but does not accept an argument", - ) - .optflag("c", "", "ignored") - // TODO implement flag - .optflag( - "C", - "compare", - "(unimplemented) compare each pair of source and destination\n \ - files, and in some cases, do not modify the destination at all", - ) - .optflag( - "d", - "directory", - "treat all arguments as directory names.\n \ - create all components of the specified directories", - ) - // TODO implement flag - .optflag( - "D", - "", - "(unimplemented) create all leading components of DEST except the\n \ - last, then copy SOURCE to DEST", - ) - // TODO implement flag - .optflagopt( - "g", - "group", - "(unimplemented) set group ownership, instead of process's\n \ - current group", - "GROUP", - ) - .optflagopt( - "m", - "mode", - "set permission mode (as in chmod), instead\n \ - of rwxr-xr-x", - "MODE", - ) - // TODO implement flag - .optflagopt( - "o", - "owner", - "(unimplemented) set ownership (super-user only)", - "OWNER", - ) - // TODO implement flag - .optflag( - "p", - "preserve-timestamps", - "(unimplemented) apply access/modification times\n \ - of SOURCE files to corresponding destination files", - ) - // TODO implement flag - .optflag("s", "strip", "(unimplemented) strip symbol tables") - // TODO implement flag - .optflagopt( - "", - "strip-program", - "(unimplemented) program used to strip binaries", - "PROGRAM", - ) - // TODO implement flag - .optopt( - "S", - "suffix", - "(unimplemented) override the usual backup suffix", - "SUFFIX", - ) - // TODO implement flag - .optopt( - "t", - "target-directory", - "(unimplemented) move all SOURCE arguments into\n \ - DIRECTORY", - "DIRECTORY", - ) - // TODO implement flag - .optflag( - "T", - "no-target-directory", - "(unimplemented) treat DEST as a normal file", - ) - .optflag("v", "verbose", "explain what is being done") - // TODO implement flag - .optflag( - "P", - "preserve-context", - "(unimplemented) preserve security context", - ) - // TODO implement flag - .optflagopt( - "Z", - "context", - "(unimplemented) set security context of files and\n \ - directories", - "CONTEXT", - ) - .parse(args) -} - /// Check for unimplemented command line arguments. /// /// Either return the degenerate Ok value, or an Err with string. @@ -221,34 +248,35 @@ fn parse_opts(args: Vec) -> getopts::Matches { /// /// Error datum is a string of the unimplemented argument. /// -fn check_unimplemented(matches: &getopts::Matches) -> Result<(), &str> { - if matches.opt_present("backup") { +/// +fn check_unimplemented<'a>(matches: &ArgMatches) -> Result<(), &'a str> { + if matches.is_present(OPT_BACKUP) { Err("--backup") - } else if matches.opt_present("b") { + } else if matches.is_present(OPT_BACKUP_2) { Err("-b") - } else if matches.opt_present("compare") { + } else if matches.is_present(OPT_COMPARE) { Err("--compare, -C") - } else if matches.opt_present("D") { + } else if matches.is_present(OPT_CREATED) { Err("-D") - } else if matches.opt_present("group") { + } else if matches.is_present(OPT_GROUP) { Err("--group, -g") - } else if matches.opt_present("owner") { + } else if matches.is_present(OPT_OWNER) { Err("--owner, -o") - } else if matches.opt_present("preserve-timestamps") { + } else if matches.is_present(OPT_PRESERVE_TIMESTAMPS) { Err("--preserve-timestamps, -p") - } else if matches.opt_present("strip") { + } else if matches.is_present(OPT_STRIP) { Err("--strip, -s") - } else if matches.opt_present("strip-program") { + } else if matches.is_present(OPT_STRIP_PROGRAM) { Err("--strip-program") - } else if matches.opt_present("suffix") { + } else if matches.is_present(OPT_SUFFIX) { Err("--suffix, -S") - } else if matches.opt_present("target-directory") { + } else if matches.is_present(OPT_TARGET_DIRECTORY) { Err("--target-directory, -t") - } else if matches.opt_present("no-target-directory") { + } else if matches.is_present(OPT_NO_TARGET_DIRECTORY) { Err("--no-target-directory, -T") - } else if matches.opt_present("preserve-context") { + } else if matches.is_present(OPT_PRESERVE_CONTEXT) { Err("--preserve-context, -P") - } else if matches.opt_present("context") { + } else if matches.is_present(OPT_CONTEXT) { Err("--context, -Z") } else { Ok(()) @@ -263,8 +291,8 @@ fn check_unimplemented(matches: &getopts::Matches) -> Result<(), &str> { /// /// In event of failure, returns an integer intended as a program return code. /// -fn behavior(matches: &getopts::Matches) -> Result { - let main_function = if matches.opt_present("directory") { +fn behavior(matches: &ArgMatches) -> Result { + let main_function = if matches.is_present("directory") { MainFunction::Directory } else { MainFunction::Standard @@ -272,8 +300,8 @@ fn behavior(matches: &getopts::Matches) -> Result { let considering_dir: bool = MainFunction::Directory == main_function; - let specified_mode: Option = if matches.opt_present("mode") { - match matches.opt_str("mode") { + let specified_mode: Option = if matches.is_present(OPT_MODE) { + match matches.value_of(OPT_MODE) { Some(x) => match mode::parse(&x[..], considering_dir) { Ok(y) => Some(y), Err(err) => { @@ -285,7 +313,7 @@ fn behavior(matches: &getopts::Matches) -> Result { show_error!( "option '--mode' requires an argument\n \ Try '{} --help' for more information.", - NAME + executable!() ); return Err(1); } @@ -294,27 +322,27 @@ fn behavior(matches: &getopts::Matches) -> Result { None }; - let backup_suffix = if matches.opt_present("suffix") { - match matches.opt_str("suffix") { + let backup_suffix = if matches.is_present(OPT_SUFFIX) { + match matches.value_of(OPT_SUFFIX) { Some(x) => x, None => { show_error!( "option '--suffix' requires an argument\n\ Try '{} --help' for more information.", - NAME + executable!() ); return Err(1); } } } else { - "~".to_owned() + "~" }; Ok(Behavior { main_function, specified_mode, - suffix: backup_suffix, - verbose: matches.opt_present("v"), + suffix: backup_suffix.to_string(), + verbose: matches.is_present("v"), }) } @@ -325,15 +353,15 @@ fn behavior(matches: &getopts::Matches) -> Result { /// /// Returns an integer intended as a program return code. /// -fn directory(paths: &[PathBuf], b: Behavior) -> i32 { +fn directory(paths: Vec, b: Behavior) -> i32 { if paths.is_empty() { - println!("{} with -d requires at least one argument.", NAME); + println!("{} with -d requires at least one argument.", executable!()); 1 } else { let mut all_successful = true; for directory in paths.iter() { - let path = directory.as_path(); + let path = Path::new(directory); if path.exists() { show_info!("cannot create directory '{}': File exists", path.display()); @@ -371,18 +399,21 @@ fn is_new_file_path(path: &Path) -> bool { /// /// Returns an integer intended as a program return code. /// -fn standard(paths: &[PathBuf], b: Behavior) -> i32 { +fn standard(paths: Vec, b: Behavior) -> i32 { if paths.len() < 2 { - println!("{} requires at least 2 arguments.", NAME); + println!("{} requires at least 2 arguments.", executable!()); 1 } else { - let sources = &paths[0..paths.len() - 1]; - let target = &paths[paths.len() - 1]; + let sources = &paths[0..paths.len() - 1] + .iter() + .map(PathBuf::from) + .collect::>(); + let target = Path::new(paths.last().unwrap()); if (target.is_file() || is_new_file_path(target)) && sources.len() == 1 { - copy_file_to_file(&sources[0], target, &b) + copy_file_to_file(&sources[0], &target.to_path_buf(), &b) } else { - copy_files_into_dir(sources, target, &b) + copy_files_into_dir(sources, &target.to_path_buf(), &b) } } } diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index e9e70bd93..3fea04187 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -10,7 +10,7 @@ fn test_install_help() { .succeeds() .no_stderr() .stdout - .contains("Options:")); + .contains("FLAGS:")); } #[test] From 4fec824421e54749934686a6d77ef4729b0e1805 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 15 Nov 2020 22:48:39 +0100 Subject: [PATCH 206/606] change the position of the TODO Co-authored-by: Roy Ivy III --- src/uu/install/src/install.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index c744579db..6e089c430 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -94,8 +94,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("(unimplemented) make a backup of each existing destination file") .value_name("CONTROL") ) - // TODO implement flag .arg( + // TODO implement flag Arg::with_name(OPT_BACKUP_2) .short("b") .help("(unimplemented) like --backup but does not accept an argument") From 5718af023b556a9ec39fde2a1bd06c2b6c631b47 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 15 Nov 2020 22:49:01 +0100 Subject: [PATCH 207/606] use the OPT_VERBOSE Co-authored-by: Roy Ivy III --- src/uu/install/src/install.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 6e089c430..8c7df6961 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -342,7 +342,7 @@ fn behavior(matches: &ArgMatches) -> Result { main_function, specified_mode, suffix: backup_suffix.to_string(), - verbose: matches.is_present("v"), + verbose: matches.is_present(OPT_VERBOSE), }) } From f55d8a22ecfdfd96163c5f47e23a746135b3923f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 15 Nov 2020 22:49:26 +0100 Subject: [PATCH 208/606] remove useless mut Co-authored-by: Roy Ivy III --- src/uu/install/src/install.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 8c7df6961..10e0a3d12 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -217,7 +217,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) .get_matches_from(args); - let mut paths: Vec = matches + let paths: Vec = matches .values_of(ARG_FILES) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); From 55221a18b4c58351e9b831dab188503464f0dc06 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 15 Nov 2020 22:53:49 +0100 Subject: [PATCH 209/606] change order + remove useless import --- src/uu/rm/src/rm.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 868f26860..eaacb9555 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -14,7 +14,7 @@ extern crate walkdir; #[macro_use] extern crate uucore; -use clap::{App, Arg, ArgMatches}; +use clap::{App, Arg}; use remove_dir_all::remove_dir_all; use std::collections::VecDeque; use std::fs; @@ -43,15 +43,15 @@ struct Options { static ABOUT: &str = "Remove (unlink) the FILE(s)"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static OPT_DIR: &str = "dir"; +static OPT_INTERACTIVE: &str = "interactive"; static OPT_FORCE: &str = "force"; +static OPT_NO_PRESERVE_ROOT: &str = "no-preserve-root"; +static OPT_ONE_FILE_SYSTEM: &str = "one-file-system"; +static OPT_PRESERVE_ROOT: &str = "preserve-root"; static OPT_PROMPT: &str = "prompt"; static OPT_PROMPT_MORE: &str = "prompt-more"; -static OPT_INTERACTIVE: &str = "interactive"; -static OPT_ONE_FILE_SYSTEM: &str = "one-file-system"; -static OPT_NO_PRESERVE_ROOT: &str = "no-preserve-root"; -static OPT_PRESERVE_ROOT: &str = "preserve-root"; static OPT_RECURSIVE: &str = "recursive"; -static OPT_DIR: &str = "dir"; static OPT_VERBOSE: &str = "verbose"; static ARG_FILES: &str = "files"; From 27d5256cb64cad2bd6db5e47ab752aaa9ee16bc4 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 16 Nov 2020 22:02:06 +0100 Subject: [PATCH 210/606] Use the correct syntax to define the mode --- src/uu/install/src/install.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 10e0a3d12..c92ef1bca 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -20,7 +20,7 @@ use std::fs; use std::path::{Path, PathBuf}; use std::result::Result; -const DEFAULT_MODE: u32 = 755; +const DEFAULT_MODE: u32 = 0o755; #[allow(dead_code)] pub struct Behavior { From 641aba5bd7c81f1a6537dc800ea439f805809962 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 19 Nov 2020 23:16:31 +0100 Subject: [PATCH 211/606] maint/hostname: Fix a clippy warning 'single_char_push_str' --- src/uu/hostname/src/hostname.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/hostname/src/hostname.rs b/src/uu/hostname/src/hostname.rs index 2e742da9a..b574cf1d5 100644 --- a/src/uu/hostname/src/hostname.rs +++ b/src/uu/hostname/src/hostname.rs @@ -123,7 +123,7 @@ fn display_hostname(matches: &ArgMatches) -> i32 { ip.truncate(len - 2); } output.push_str(&ip); - output.push_str(" "); + output.push(' '); hashset.insert(addr); } } From 41ba5ed913e04bc3b2e158e2408d4b895f96c36f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 21 Nov 2020 09:52:40 +0100 Subject: [PATCH 212/606] refactor(uniq): Move to clap + add a test (#1626) --- Cargo.lock | 2 +- src/uu/uniq/Cargo.toml | 2 +- src/uu/uniq/src/uniq.rs | 237 ++++++++++++++++++++++--------------- tests/by-util/test_uniq.rs | 10 ++ 4 files changed, 151 insertions(+), 100 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 20966391c..e9f8c63b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2237,7 +2237,7 @@ dependencies = [ name = "uu_uniq" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", "uucore_procs 0.0.4", ] diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index 0abdc3ac9..9f06aa9e4 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/uniq.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/uniq/src/uniq.rs b/src/uu/uniq/src/uniq.rs index 4c4ed1ed4..278106873 100644 --- a/src/uu/uniq/src/uniq.rs +++ b/src/uu/uniq/src/uniq.rs @@ -5,19 +5,30 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -extern crate getopts; +extern crate clap; #[macro_use] extern crate uucore; -use getopts::{Matches, Options}; +use clap::{App, Arg, ArgMatches}; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; use std::path::Path; use std::str::FromStr; -static NAME: &str = "uniq"; +static ABOUT: &str = "Report or omit repeated lines."; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static OPT_ALL_REPEATED: &str = "all-repeated"; +static OPT_CHECK_CHARS: &str = "check-chars"; +static OPT_COUNT: &str = "count"; +static OPT_IGNORE_CASE: &str = "ignore-case"; +static OPT_REPEATED: &str = "repeated"; +static OPT_SKIP_FIELDS: &str = "skip-fields"; +static OPT_SKIP_CHARS: &str = "skip-chars"; +static OPT_UNIQUE: &str = "unique"; +static OPT_ZERO_TERMINATED: &str = "zero-terminated"; + +static ARG_FILES: &str = "files"; #[derive(PartialEq)] enum Delimiters { @@ -194,113 +205,143 @@ impl Uniq { } } -fn opt_parsed(opt_name: &str, matches: &Matches) -> Option { - matches.opt_str(opt_name).map(|arg_str| { +fn opt_parsed(opt_name: &str, matches: &ArgMatches) -> Option { + matches.value_of(opt_name).map(|arg_str| { let opt_val: Option = arg_str.parse().ok(); opt_val.unwrap_or_else(|| crash!(1, "Invalid argument for {}: {}", opt_name, arg_str)) }) } +fn get_usage() -> String { + format!("{0} [OPTION]... [INPUT [OUTPUT]]...", executable!()) +} + +fn get_long_usage() -> String { + String::from( + "Filter adjacent matching lines from INPUT (or standard input),\n\ + writing to OUTPUT (or standard output). + Note: 'uniq' does not detect repeated lines unless they are adjacent.\n\ + You may want to sort the input first, or use 'sort -u' without 'uniq'.\n", + ) +} + pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); + let long_usage = get_long_usage(); - let mut opts = Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(&long_usage[..]) + .arg( + Arg::with_name(OPT_ALL_REPEATED) + .short("D") + .long(OPT_ALL_REPEATED) + .possible_values(&["none", "prepend", "separate"]) + .help("print all duplicate lines. Delimiting is done with blank lines") + .value_name("delimit-method") + .default_value("none"), + ) + .arg( + Arg::with_name(OPT_CHECK_CHARS) + .short("w") + .long(OPT_CHECK_CHARS) + .help("compare no more than N characters in lines") + .value_name("N"), + ) + .arg( + Arg::with_name(OPT_COUNT) + .short("c") + .long(OPT_COUNT) + .help("prefix lines by the number of occurrences"), + ) + .arg( + Arg::with_name(OPT_IGNORE_CASE) + .short("i") + .long(OPT_IGNORE_CASE) + .help("ignore differences in case when comparing"), + ) + .arg( + Arg::with_name(OPT_REPEATED) + .short("d") + .long(OPT_REPEATED) + .help("only print duplicate lines"), + ) + .arg( + Arg::with_name(OPT_SKIP_CHARS) + .short("s") + .long(OPT_SKIP_CHARS) + .help("avoid comparing the first N characters") + .value_name("N"), + ) + .arg( + Arg::with_name(OPT_SKIP_FIELDS) + .short("f") + .long(OPT_SKIP_FIELDS) + .help("avoid comparing the first N fields") + .value_name("N"), + ) + .arg( + Arg::with_name(OPT_UNIQUE) + .short("u") + .long(OPT_UNIQUE) + .help("only print unique lines"), + ) + .arg( + Arg::with_name(OPT_ZERO_TERMINATED) + .short("z") + .long(OPT_ZERO_TERMINATED) + .help("end lines with 0 byte, not newline"), + ) + .arg( + Arg::with_name(ARG_FILES) + .multiple(true) + .takes_value(true) + .max_values(2), + ) + .get_matches_from(args); - opts.optflag("c", "count", "prefix lines by the number of occurrences"); - opts.optflag("d", "repeated", "only print duplicate lines"); - opts.optflagopt( - "D", - "all-repeated", - "print all duplicate lines delimit-method={none(default),prepend,separate} Delimiting is done with blank lines", - "delimit-method" - ); - opts.optopt( - "f", - "skip-fields", - "avoid comparing the first N fields", - "N", - ); - opts.optopt( - "s", - "skip-chars", - "avoid comparing the first N characters", - "N", - ); - opts.optopt( - "w", - "check-chars", - "compare no more than N characters in lines", - "N", - ); - opts.optflag( - "i", - "ignore-case", - "ignore differences in case when comparing", - ); - opts.optflag("u", "unique", "only print unique lines"); - opts.optflag("z", "zero-terminated", "end lines with 0 byte, not newline"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); + let files: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f), + let (in_file_name, out_file_name) = match files.len() { + 0 => ("-".to_owned(), "-".to_owned()), + 1 => (files[0].clone(), "-".to_owned()), + 2 => (files[0].clone(), files[1].clone()), + _ => { + // Cannot happen as clap will fail earlier + crash!(1, "Extra operand: {}", files[2]); + } }; - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage:"); - println!(" {0} [OPTION]... [FILE]...", NAME); - println!(); - print!( - "{}", - opts.usage( - "Filter adjacent matching lines from INPUT (or standard input),\n\ - writing to OUTPUT (or standard output)." - ) - ); - println!(); - println!( - "Note: '{0}' does not detect repeated lines unless they are adjacent.\n\ - You may want to sort the input first, or use 'sort -u' without '{0}'.\n", - NAME - ); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else { - let (in_file_name, out_file_name) = match matches.free.len() { - 0 => ("-".to_owned(), "-".to_owned()), - 1 => (matches.free[0].clone(), "-".to_owned()), - 2 => (matches.free[0].clone(), matches.free[1].clone()), - _ => { - crash!(1, "Extra operand: {}", matches.free[2]); - } - }; - let uniq = Uniq { - repeats_only: matches.opt_present("repeated") || matches.opt_present("all-repeated"), - uniques_only: matches.opt_present("unique"), - all_repeated: matches.opt_present("all-repeated"), - delimiters: match matches.opt_default("all-repeated", "none") { - Some(ref opt_arg) if opt_arg != "none" => match &(*opt_arg.as_str()) { - "prepend" => Delimiters::Prepend, - "separate" => Delimiters::Separate, - _ => crash!(1, "Incorrect argument for all-repeated: {}", opt_arg), - }, - _ => Delimiters::None, + let uniq = Uniq { + repeats_only: matches.is_present(OPT_REPEATED) + || matches.occurrences_of(OPT_ALL_REPEATED) > 0, + uniques_only: matches.is_present(OPT_UNIQUE), + all_repeated: matches.occurrences_of(OPT_ALL_REPEATED) > 0, + delimiters: match matches.value_of(OPT_ALL_REPEATED).map(String::from) { + Some(ref opt_arg) if opt_arg != "none" => match &(*opt_arg.as_str()) { + "prepend" => Delimiters::Prepend, + "separate" => Delimiters::Separate, + _ => crash!(1, "Incorrect argument for all-repeated: {}", opt_arg), }, - show_counts: matches.opt_present("count"), - skip_fields: opt_parsed("skip-fields", &matches), - slice_start: opt_parsed("skip-chars", &matches), - slice_stop: opt_parsed("check-chars", &matches), - ignore_case: matches.opt_present("ignore-case"), - zero_terminated: matches.opt_present("zero-terminated"), - }; - uniq.print_uniq( - &mut open_input_file(in_file_name), - &mut open_output_file(out_file_name), - ); - } + _ => Delimiters::None, + }, + show_counts: matches.is_present(OPT_COUNT), + skip_fields: opt_parsed(OPT_SKIP_FIELDS, &matches), + slice_start: opt_parsed(OPT_SKIP_CHARS, &matches), + slice_stop: opt_parsed(OPT_CHECK_CHARS, &matches), + ignore_case: matches.is_present(OPT_IGNORE_CASE), + zero_terminated: matches.is_present(OPT_ZERO_TERMINATED), + }; + uniq.print_uniq( + &mut open_input_file(in_file_name), + &mut open_output_file(out_file_name), + ); + 0 } diff --git a/tests/by-util/test_uniq.rs b/tests/by-util/test_uniq.rs index aa2f8a93f..53d57b49c 100644 --- a/tests/by-util/test_uniq.rs +++ b/tests/by-util/test_uniq.rs @@ -1,6 +1,7 @@ use crate::common::util::*; static INPUT: &'static str = "sorted.txt"; +static OUTPUT: &'static str = "sorted-output.txt"; static SKIP_CHARS: &'static str = "skip-chars.txt"; static SKIP_FIELDS: &'static str = "skip-fields.txt"; static SORTED_ZERO_TERMINATED: &'static str = "sorted-zero-terminated.txt"; @@ -21,6 +22,15 @@ fn test_single_default() { .stdout_is_fixture("sorted-simple.expected"); } +#[test] +fn test_single_default_output() { + let (at, mut ucmd) = at_and_ucmd!(); + let expected = at.read("sorted-simple.expected"); + ucmd.args(&[INPUT, OUTPUT]).run(); + let found = at.read(OUTPUT); + assert_eq!(found, expected); +} + #[test] fn test_stdin_counts() { new_ucmd!() From 5efaa0bf32d2dd59c7585a6bae7800fd8380efc1 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 21 Nov 2020 09:52:50 +0100 Subject: [PATCH 213/606] refactor(id) - move to clap and add more tests (#1628) --- Cargo.lock | 1 + src/uu/id/Cargo.toml | 1 + src/uu/id/src/id.rs | 118 ++++++++++++++++++++++++++++----------- tests/by-util/test_id.rs | 64 ++++++++++++++++++--- 4 files changed, 143 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e9f8c63b5..a5cc30f3e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1669,6 +1669,7 @@ dependencies = [ name = "uu_id" version = "0.0.1" dependencies = [ + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", "uucore_procs 0.0.4", ] diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index c5509e71d..6acae0274 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/id.rs" [dependencies] +clap = "2.33" uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "process"] } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index 252f0b395..c374de050 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -15,8 +15,12 @@ #![allow(non_camel_case_types)] #![allow(dead_code)] +extern crate clap; + #[macro_use] extern crate uucore; + +use clap::{App, Arg}; use std::ffi::CStr; use uucore::entries::{self, Group, Locate, Passwd}; pub use uucore::libc; @@ -68,50 +72,100 @@ mod audit { } } -static SYNTAX: &str = "[OPTION]... [USER]"; -static SUMMARY: &str = "Print user and group information for the specified USER,\n or (when USER omitted) for the current user."; +static ABOUT: &str = "Display user and group information for the specified USER,\n or (when USER omitted) for the current user."; +static VERSION: &str = env!("CARGO_PKG_VERSION"); + +static OPT_AUDIT: &str = "audit"; +static OPT_EFFECTIVE_USER: &str = "effective-user"; +static OPT_GROUP: &str = "group"; +static OPT_GROUPS: &str = "groups"; +static OPT_HUMAN_READABLE: &str = "human-readable"; +static OPT_NAME: &str = "name"; +static OPT_PASSWORD: &str = "password"; +static OPT_REAL_ID: &str = "real-id"; + +static ARG_USERS: &str = "users"; + +fn get_usage() -> String { + format!("{0} [OPTION]... [USER]", executable!()) +} pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = app!(SYNTAX, SUMMARY, ""); - opts.optflag( - "A", - "", - "Display the process audit (not available on Linux)", - ); - opts.optflag("G", "groups", "Display the different group IDs"); - opts.optflag("g", "group", "Display the effective group ID as a number"); - opts.optflag( - "n", - "", - "Display the name of the user or group ID for the -G, -g and -u options", - ); - opts.optflag("P", "", "Display the id as a password file entry"); - opts.optflag("p", "", "Make the output human-readable"); - opts.optflag("r", "", "Display the real ID for the -g and -u options"); - opts.optflag("u", "user", "Display the effective user ID as a number"); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_AUDIT) + .short("A") + .help("Display the process audit (not available on Linux)"), + ) + .arg( + Arg::with_name(OPT_EFFECTIVE_USER) + .short("u") + .long("user") + .help("Display the effective user ID as a number"), + ) + .arg( + Arg::with_name(OPT_GROUP) + .short("g") + .long(OPT_GROUP) + .help("Display the effective group ID as a number"), + ) + .arg( + Arg::with_name(OPT_GROUPS) + .short("G") + .long(OPT_GROUPS) + .help("Display the different group IDs"), + ) + .arg( + Arg::with_name(OPT_HUMAN_READABLE) + .short("p") + .help("Make the output human-readable"), + ) + .arg( + Arg::with_name(OPT_NAME) + .short("n") + .help("Display the name of the user or group ID for the -G, -g and -u options"), + ) + .arg( + Arg::with_name(OPT_PASSWORD) + .short("P") + .help("Display the id as a password file entry"), + ) + .arg( + Arg::with_name(OPT_REAL_ID) + .short("r") + .help("Display the real ID for the -g and -u options"), + ) + .arg(Arg::with_name(ARG_USERS).multiple(true).takes_value(true)) + .get_matches_from(args); - let matches = opts.parse(args); + let users: Vec = matches + .values_of(ARG_USERS) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); - if matches.opt_present("A") { + if matches.is_present(OPT_AUDIT) { auditid(); return 0; } - let possible_pw = if matches.free.is_empty() { + let possible_pw = if users.is_empty() { None } else { - match Passwd::locate(matches.free[0].as_str()) { + match Passwd::locate(users[0].as_str()) { Ok(p) => Some(p), - Err(_) => crash!(1, "No such user/group: {}", matches.free[0]), + Err(_) => crash!(1, "No such user/group: {}", users[0]), } }; - let nflag = matches.opt_present("n"); - let uflag = matches.opt_present("u"); - let gflag = matches.opt_present("g"); - let rflag = matches.opt_present("r"); + let nflag = matches.is_present(OPT_NAME); + let uflag = matches.is_present(OPT_EFFECTIVE_USER); + let gflag = matches.is_present(OPT_GROUP); + let rflag = matches.is_present(OPT_REAL_ID); if gflag { let id = possible_pw @@ -143,7 +197,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 0; } - if matches.opt_present("G") { + if matches.is_present(OPT_GROUPS) { println!( "{}", if nflag { @@ -167,12 +221,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 0; } - if matches.opt_present("P") { + if matches.is_present(OPT_PASSWORD) { pline(possible_pw.map(|v| v.uid())); return 0; }; - if matches.opt_present("p") { + if matches.is_present(OPT_HUMAN_READABLE) { pretty(possible_pw); return 0; } diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index 0541a2a89..116c73995 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -1,5 +1,17 @@ use crate::common::util::*; +fn return_whoami_username() -> String { + let scene = TestScenario::new("whoami"); + let result = scene.cmd("whoami").run(); + if is_ci() && result.stderr.contains("cannot find name for user ID") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return String::from(""); + } + + result.stdout.trim().to_string() +} + #[test] fn test_id() { let scene = TestScenario::new(util_name!()); @@ -29,18 +41,14 @@ fn test_id() { #[test] fn test_id_from_name() { - let mut scene = TestScenario::new("whoami"); - let result = scene.cmd("whoami").run(); - if is_ci() && result.stderr.contains("cannot find name for user ID") { - // In the CI, some server are failing to return whoami. - // As seems to be a configuration issue, ignoring it + let username = return_whoami_username(); + if username == "" { + // Sometimes, the CI is failing here return; } - let username = result.stdout.trim(); - - scene = TestScenario::new(util_name!()); - let result = scene.ucmd().arg(username).succeeds(); + let scene = TestScenario::new(util_name!()); + let result = scene.ucmd().arg(&username).succeeds(); println!("result.stdout = {}", result.stdout); println!("result.stderr = {}", result.stderr); assert!(result.success); @@ -139,3 +147,41 @@ fn test_id_user() { let s1 = String::from(result.stdout.trim()); assert!(s1.parse::().is_ok()); } + +#[test] +fn test_id_pretty_print() { + let username = return_whoami_username(); + if username == "" { + // Sometimes, the CI is failing here + return; + } + + let scene = TestScenario::new(util_name!()); + let result = scene.ucmd().arg("-p").run(); + if result.stdout.trim() == "" { + // Sometimes, the CI is failing here with + // old rust versions on Linux + return; + } + println!("result.stdout = {}", result.stdout); + println!("result.stderr = {}", result.stderr); + assert!(result.success); + assert!(result.stdout.contains(&username)); +} + +#[test] +fn test_id_password_style() { + let username = return_whoami_username(); + if username == "" { + // Sometimes, the CI is failing here + return; + } + let scene = TestScenario::new(util_name!()); + + let result = scene.ucmd().arg("-P").succeeds(); + + println!("result.stdout = {}", result.stdout); + println!("result.stderr = {}", result.stderr); + assert!(result.success); + assert!(result.stdout.starts_with(&username)); +} From bfba889f8e234c0fc6674f17ab4a366ebbe5207f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 21 Nov 2020 09:53:13 +0100 Subject: [PATCH 214/606] refactor(touch): Move to clap + add a test (#1629) --- Cargo.lock | 2 +- src/uu/touch/Cargo.toml | 2 +- src/uu/touch/src/touch.rs | 210 ++++++++++++++++++++---------------- tests/by-util/test_touch.rs | 8 ++ 4 files changed, 129 insertions(+), 93 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a5cc30f3e..5019f227b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2160,8 +2160,8 @@ dependencies = [ name = "uu_touch" version = "0.0.1" dependencies = [ + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", "uucore_procs 0.0.4", diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index 5881875c1..7fc56890a 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -16,7 +16,7 @@ path = "src/touch.rs" [dependencies] filetime = "0.2.1" -getopts = "0.2.18" +clap = "2.33" time = "0.1.40" uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["libc"] } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 48abd63a2..ffde06ca6 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -8,20 +8,31 @@ // spell-checker:ignore (ToDO) filetime strptime utcoff strs datetime MMDDhhmm +extern crate clap; pub extern crate filetime; -extern crate getopts; extern crate time; #[macro_use] extern crate uucore; +use clap::{App, Arg}; use filetime::*; use std::fs::{self, File}; use std::io::Error; use std::path::Path; -static NAME: &str = "touch"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Update the access and modification times of each FILE to the current time."; +static OPT_ACCESS: &str = "access"; +static OPT_CURRENT: &str = "current"; +static OPT_DATE: &str = "date"; +static OPT_MODIFICATION: &str = "modification"; +static OPT_NO_CREATE: &str = "no-create"; +static OPT_NO_DEREF: &str = "no-dereference"; +static OPT_REFERENCE: &str = "reference"; +static OPT_TIME: &str = "time"; + +static ARG_FILES: &str = "files"; // Since touch's date/timestamp parsing doesn't account for timezone, the // returned value from time::strptime() is UTC. We get system's timezone to @@ -41,97 +52,108 @@ macro_rules! local_tm_to_filetime( }) ); +fn get_usage() -> String { + format!("{0} [OPTION]... [USER]", executable!()) +} + pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_ACCESS) + .short("a") + .help("change only the access time"), + ) + .arg( + Arg::with_name(OPT_CURRENT) + .short("t") + .help("use [[CC]YY]MMDDhhmm[.ss] instead of the current time") + .value_name("STAMP") + .takes_value(true), + ) + .arg( + Arg::with_name(OPT_DATE) + .short("d") + .long(OPT_DATE) + .help("parse argument and use it instead of current time") + .value_name("STRING"), + ) + .arg( + Arg::with_name(OPT_MODIFICATION) + .short("m") + .help("change only the modification time"), + ) + .arg( + Arg::with_name(OPT_NO_CREATE) + .short("c") + .long(OPT_NO_CREATE) + .help("do not create any files"), + ) + .arg( + Arg::with_name(OPT_NO_DEREF) + .short("h") + .long(OPT_NO_DEREF) + .help( + "affect each symbolic link instead of any referenced file \ + (only for systems that can change the timestamps of a symlink)", + ), + ) + .arg( + Arg::with_name(OPT_REFERENCE) + .short("r") + .long(OPT_REFERENCE) + .help("use this file's times instead of the current time") + .value_name("FILE"), + ) + .arg( + Arg::with_name(OPT_TIME) + .long(OPT_TIME) + .help( + "change only the specified time: \"access\", \"atime\", or \ + \"use\" are equivalent to -a; \"modify\" or \"mtime\" are \ + equivalent to -m", + ) + .value_name("WORD") + .possible_values(&["access", "atime", "use"]) + .takes_value(true), + ) + .arg( + Arg::with_name(ARG_FILES) + .multiple(true) + .takes_value(true) + .min_values(1), + ) + .get_matches_from(args); - opts.optflag("a", "", "change only the access time"); - opts.optflag("c", "no-create", "do not create any files"); - opts.optopt( - "d", - "date", - "parse argument and use it instead of current time", - "STRING", - ); - opts.optflag( - "h", - "no-dereference", - "affect each symbolic link instead of any referenced file \ - (only for systems that can change the timestamps of a symlink)", - ); - opts.optflag("m", "", "change only the modification time"); - opts.optopt( - "r", - "reference", - "use this file's times instead of the current time", - "FILE", - ); - opts.optopt( - "t", - "", - "use [[CC]YY]MMDDhhmm[.ss] instead of the current time", - "STAMP", - ); - opts.optopt( - "", - "time", - "change only the specified time: \"access\", \"atime\", or \ - \"use\" are equivalent to -a; \"modify\" or \"mtime\" are \ - equivalent to -m", - "WORD", - ); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); + let files: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(e) => panic!("Invalid options\n{}", e), - }; - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if matches.opt_present("help") || matches.free.is_empty() { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage: {} [OPTION]... FILE...", NAME); - println!(); - println!( - "{}", - opts.usage( - "Update the access and modification times of \ - each FILE to the current time." - ) - ); - if matches.free.is_empty() { - return 1; - } - return 0; - } - - if matches.opt_present("date") - && matches.opts_present(&["reference".to_owned(), "t".to_owned()]) - || matches.opt_present("reference") - && matches.opts_present(&["date".to_owned(), "t".to_owned()]) - || matches.opt_present("t") - && matches.opts_present(&["date".to_owned(), "reference".to_owned()]) + if matches.is_present(OPT_DATE) + && (matches.is_present(OPT_REFERENCE) || matches.is_present(OPT_CURRENT)) + || matches.is_present(OPT_REFERENCE) + && (matches.is_present(OPT_DATE) || matches.is_present(OPT_CURRENT)) + || matches.is_present(OPT_CURRENT) + && (matches.is_present(OPT_DATE) || matches.is_present(OPT_REFERENCE)) { panic!("Invalid options: cannot specify reference time from more than one source"); } - let (mut atime, mut mtime) = if matches.opt_present("reference") { + let (mut atime, mut mtime) = if matches.is_present(OPT_REFERENCE) { stat( - &matches.opt_str("reference").unwrap()[..], - !matches.opt_present("no-dereference"), + &matches.value_of(OPT_REFERENCE).unwrap()[..], + !matches.is_present(OPT_NO_DEREF), ) - } else if matches.opts_present(&["date".to_owned(), "t".to_owned()]) { - let timestamp = if matches.opt_present("date") { - parse_date(matches.opt_str("date").unwrap().as_ref()) + } else if matches.is_present(OPT_DATE) || matches.is_present(OPT_CURRENT) { + let timestamp = if matches.is_present(OPT_DATE) { + parse_date(matches.value_of(OPT_DATE).unwrap().as_ref()) } else { - parse_timestamp(matches.opt_str("t").unwrap().as_ref()) + parse_timestamp(matches.value_of(OPT_CURRENT).unwrap().as_ref()) }; (timestamp, timestamp) } else { @@ -139,12 +161,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { (now, now) }; - for filename in &matches.free { + for filename in &files { let path = &filename[..]; if !Path::new(path).exists() { // no-dereference included here for compatibility - if matches.opts_present(&["no-create".to_owned(), "no-dereference".to_owned()]) { + if matches.is_present(OPT_NO_CREATE) || matches.is_present(OPT_NO_DEREF) { continue; } @@ -154,18 +176,24 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; // Minor optimization: if no reference time was specified, we're done. - if !matches.opts_present(&["date".to_owned(), "reference".to_owned(), "t".to_owned()]) { + if !(matches.is_present(OPT_DATE) + || matches.is_present(OPT_REFERENCE) + || matches.is_present(OPT_CURRENT)) + { continue; } } // If changing "only" atime or mtime, grab the existing value of the other. // Note that "-a" and "-m" may be passed together; this is not an xor. - if matches.opts_present(&["a".to_owned(), "m".to_owned(), "time".to_owned()]) { - let st = stat(path, !matches.opt_present("no-dereference")); - let time = matches.opt_strs("time"); + if matches.is_present(OPT_ACCESS) + || matches.is_present(OPT_MODIFICATION) + || matches.is_present(OPT_TIME) + { + let st = stat(path, !matches.is_present(OPT_NO_DEREF)); + let time = matches.value_of(OPT_TIME).unwrap_or(""); - if !(matches.opt_present("a") + if !(matches.is_present(OPT_ACCESS) || time.contains(&"access".to_owned()) || time.contains(&"atime".to_owned()) || time.contains(&"use".to_owned())) @@ -173,7 +201,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { atime = st.0; } - if !(matches.opt_present("m") + if !(matches.is_present(OPT_MODIFICATION) || time.contains(&"modify".to_owned()) || time.contains(&"mtime".to_owned())) { @@ -181,7 +209,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } - if matches.opt_present("h") { + if matches.is_present(OPT_NO_DEREF) { if let Err(e) = set_symlink_file_times(path, atime, mtime) { show_warning!("cannot touch '{}': {}", path, e); } diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 84263376a..7e04beced 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -195,6 +195,14 @@ fn test_touch_set_only_atime() { assert_eq!(atime.unix_seconds() - start_of_year.unix_seconds(), 45240); } +#[test] +fn test_touch_set_only_mtime_failed() { + let (_at, mut ucmd) = at_and_ucmd!(); + let file = "test_touch_set_only_mtime"; + + ucmd.args(&["-t", "2015010112342", "-m", file]).fails(); +} + #[test] fn test_touch_set_only_mtime() { let (at, mut ucmd) = at_and_ucmd!(); From adc9b12f32c4656cde191544136995a01c5d16ba Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 25 Nov 2020 13:09:28 +0100 Subject: [PATCH 215/606] install: fix a typo --- src/uu/install/src/install.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index c92ef1bca..01b38a7bd 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -389,7 +389,7 @@ fn directory(paths: Vec, b: Behavior) -> i32 { } } -/// Test if the path is a a new file path that can be +/// Test if the path is a new file path that can be /// created immediately fn is_new_file_path(path: &Path) -> bool { path.is_file() || !path.exists() && path.parent().map(Path::is_dir).unwrap_or(true) From 63bf6cc59900e4c01ae8769d37258174837a6ade Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 25 Nov 2020 13:41:46 +0100 Subject: [PATCH 216/606] Add a test to verify that install can be used just to copy a simple file example: touch bar.txt && ./target/debug/coreutils install bar.txt foo.txt --- tests/by-util/test_install.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 3fea04187..9a5fb88d0 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -31,6 +31,19 @@ fn test_install_basic() { assert!(at.file_exists(&format!("{}/{}", dir, file2))); } +#[test] +fn test_install_copy_file() { + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "test_install_target_dir_file_a1"; + let file2 = "test_install_target_dir_file_a2"; + + at.touch(file1); + ucmd.arg(file1).arg(file2).succeeds().no_stderr(); + + assert!(at.file_exists(file1)); + assert!(at.file_exists(file2)); +} + #[test] fn test_install_failing_not_dir() { let (at, mut ucmd) = at_and_ucmd!(); From df44534a3e54476e991fa380cb4394e9aa1f8e9a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 25 Nov 2020 13:48:00 +0100 Subject: [PATCH 217/606] test(install): Add tests which should be working but aren't I will work on the fixes --- tests/by-util/test_install.rs | 50 ++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 9a5fb88d0..c47903df3 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -31,19 +31,6 @@ fn test_install_basic() { assert!(at.file_exists(&format!("{}/{}", dir, file2))); } -#[test] -fn test_install_copy_file() { - let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_dir_file_a1"; - let file2 = "test_install_target_dir_file_a2"; - - at.touch(file1); - ucmd.arg(file1).arg(file2).succeeds().no_stderr(); - - assert!(at.file_exists(file1)); - assert!(at.file_exists(file2)); -} - #[test] fn test_install_failing_not_dir() { let (at, mut ucmd) = at_and_ucmd!(); @@ -239,3 +226,40 @@ fn test_install_target_new_file_failing_nonexistent_parent() { assert!(err.contains("not a directory")) } + + +// These two tests are failing but should work +#[test] +fn test_install_copy_file() { + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "test_install_target_dir_file_a1"; + let file2 = "test_install_target_dir_file_a2"; + + at.touch(file1); + ucmd.arg(file1).arg(file2).fails(); + +/* Uncomment when fixed + ucmd.arg(file1).arg(file2).succeeds().no_stderr(); + + assert!(at.file_exists(file1)); + assert!(at.file_exists(file2));*/ +} + +#[test] +#[cfg(target_os = "linux")] +fn test_install_target_file_dev_null() { + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "/dev/null"; + let file2 = "test_install_target_file_file_i2"; + + at.touch(file1); + at.touch(file2); + ucmd.arg(file1).arg(file2).fails(); + + /* Uncomment when fixed + ucmd.arg(file1).arg(file2).succeeds().no_stderr(); + + assert!(at.file_exists(file1)); + assert!(at.file_exists(file2)); + */ +} \ No newline at end of file From 8ef7f394c1eeeaa82f428741f247edef255f708b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 29 Nov 2020 16:26:38 +0100 Subject: [PATCH 218/606] address some new clippy warnings (#1642) --- src/uu/chroot/src/chroot.rs | 14 ++++++-------- src/uu/comm/src/comm.rs | 2 +- src/uu/expr/src/expr.rs | 2 +- src/uu/join/src/join.rs | 5 +---- src/uu/mkdir/src/mkdir.rs | 2 +- src/uu/mktemp/src/mktemp.rs | 2 +- src/uu/nice/src/nice.rs | 2 +- src/uu/nl/src/nl.rs | 2 +- src/uu/nproc/src/nproc.rs | 5 +---- src/uu/od/src/od.rs | 5 +---- .../printf/src/tokenize/num_format/num_format.rs | 4 ++-- src/uu/printf/src/tokenize/unescaped_text.rs | 5 +---- src/uu/sort/src/sort.rs | 5 +---- src/uu/stat/src/stat.rs | 2 +- src/uu/uname/src/uname.rs | 12 ++++++------ src/uu/wc/src/wc.rs | 4 ++-- 16 files changed, 28 insertions(+), 45 deletions(-) diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index 89da2109e..c0205406a 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -17,7 +17,6 @@ use uucore::libc::{self, chroot, setgid, setgroups, setuid}; use std::ffi::CString; use std::io::Error; -use std::iter::FromIterator; use std::path::Path; use std::process::Command; @@ -96,10 +95,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if pstatus.success() { 0 } else { - match pstatus.code() { - Some(i) => i, - None => -1, - } + pstatus.code().unwrap_or(-1) } } @@ -182,11 +178,13 @@ fn set_groups(groups: Vec) -> libc::c_int { fn set_groups_from_str(groups: &str) { if !groups.is_empty() { - let groups_vec: Vec = - FromIterator::from_iter(groups.split(',').map(|x| match entries::grp2gid(x) { + let groups_vec: Vec = groups + .split(',') + .map(|x| match entries::grp2gid(x) { Ok(g) => g, _ => crash!(1, "no such group: {}", x), - })); + }) + .collect(); let err = set_groups(groups_vec); if err != 0 { crash!(1, "cannot set groups: {}", Error::last_os_error()) diff --git a/src/uu/comm/src/comm.rs b/src/uu/comm/src/comm.rs index 8c43f3a17..4e15ce9c9 100644 --- a/src/uu/comm/src/comm.rs +++ b/src/uu/comm/src/comm.rs @@ -41,7 +41,7 @@ fn mkdelim(col: usize, opts: &getopts::Matches) -> String { fn ensure_nl(line: &mut String) { match line.chars().last() { Some('\n') => (), - _ => line.push_str("\n"), + _ => line.push('\n'), } } diff --git a/src/uu/expr/src/expr.rs b/src/uu/expr/src/expr.rs index db970f8a6..b63f8b6a8 100644 --- a/src/uu/expr/src/expr.rs +++ b/src/uu/expr/src/expr.rs @@ -41,7 +41,7 @@ fn process_expr(token_strings: &[String]) -> Result { fn print_expr_ok(expr_result: &str) -> i32 { println!("{}", expr_result); - if expr_result == "0" || expr_result == "" { + if expr_result == "0" || expr_result.is_empty() { 1 } else { 0 diff --git a/src/uu/join/src/join.rs b/src/uu/join/src/join.rs index 23feae662..cbce1be84 100644 --- a/src/uu/join/src/join.rs +++ b/src/uu/join/src/join.rs @@ -696,10 +696,7 @@ fn get_field_number(keys: Option, key: Option) -> usize { return keys; } - match key { - Some(key) => key, - None => 0, - } + key.unwrap_or(0) } /// Parse the specified field string as a natural number and return diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index 7e53ed8e7..ae95e2126 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -85,7 +85,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { _ => crash!(1, "no mode given"), } } - _ => 0o755 as u16, + _ => 0o755_u16, }; exec(dirs, recursive, mode, verbose) diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index 8cae1f70d..508f21d2f 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -96,7 +96,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let (prefix, rand, suffix) = match parse_template(template) { Some((p, r, s)) => match suffix_opt { Some(suf) => { - if s == "" { + if s.is_empty() { (p, r, suf) } else { crash!( diff --git a/src/uu/nice/src/nice.rs b/src/uu/nice/src/nice.rs index 5d5647a51..52fb287b1 100644 --- a/src/uu/nice/src/nice.rs +++ b/src/uu/nice/src/nice.rs @@ -103,7 +103,7 @@ process).", println!("{}", niceness); return 0; } - 10 as c_int + 10_i32 } }; diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 6bf134704..bc8c62016 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -310,7 +310,7 @@ fn nl(reader: &mut BufReader, settings: &Settings) { continue; } // From this point on we format and print a "regular" line. - if line == "" { + if line.is_empty() { // The line is empty, which means that we have to care // about the --join-blank-lines parameter. empty_line_count += 1; diff --git a/src/uu/nproc/src/nproc.rs b/src/uu/nproc/src/nproc.rs index ec8aaf90a..d1dec9005 100644 --- a/src/uu/nproc/src/nproc.rs +++ b/src/uu/nproc/src/nproc.rs @@ -73,10 +73,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if !matches.is_present(OPT_ALL) { // OMP_NUM_THREADS doesn't have an impact on --all ignore += match env::var("OMP_NUM_THREADS") { - Ok(threadstr) => match threadstr.parse() { - Ok(num) => num, - Err(_) => 0, - }, + Ok(threadstr) => threadstr.parse().unwrap_or(0), Err(_) => 0, }; } diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 84848a72c..64371bbe1 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -229,10 +229,7 @@ impl OdOptions { let mut line_bytes = match matches.opt_default("w", "32") { None => 16, - Some(s) => match s.parse::() { - Ok(i) => i, - Err(_) => 0, - }, + Some(s) => s.parse::().unwrap_or(0), }; let min_bytes = formats.iter().fold(1, |max, next| { cmp::max(max, next.formatter_item_info.byte_size) diff --git a/src/uu/printf/src/tokenize/num_format/num_format.rs b/src/uu/printf/src/tokenize/num_format/num_format.rs index 44afd2e66..9a519e95e 100644 --- a/src/uu/printf/src/tokenize/num_format/num_format.rs +++ b/src/uu/printf/src/tokenize/num_format/num_format.rs @@ -64,7 +64,7 @@ fn get_provided(str_in_opt: Option<&String>) -> Option { None => { let so_far = (qchar as u8 as char).to_string(); warn_expected_numeric(&so_far); - 0 as u8 + 0_u8 } }) } @@ -72,7 +72,7 @@ fn get_provided(str_in_opt: Option<&String>) -> Option { _ => None, // no first byte } } else { - Some(0 as u8) + Some(0_u8) } } None => Some(0), diff --git a/src/uu/printf/src/tokenize/unescaped_text.rs b/src/uu/printf/src/tokenize/unescaped_text.rs index b6fdd1aa1..3b9f0123e 100644 --- a/src/uu/printf/src/tokenize/unescaped_text.rs +++ b/src/uu/printf/src/tokenize/unescaped_text.rs @@ -85,10 +85,7 @@ impl UnescapedText { // to the passed byte_vec // in subs_mode change octal behavior fn handle_escaped(byte_vec: &mut Vec, it: &mut PutBackN, subs_mode: bool) { - let ch = match it.next() { - Some(x) => x, - None => '\\', - }; + let ch = it.next().unwrap_or('\\'); match ch { '0'..='9' | 'x' => { let min_len = 1; diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 5e88c7d3b..60e0b4127 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -478,10 +478,7 @@ fn numeric_compare(a: &str, b: &str) -> Ordering { fn human_numeric_convert(a: &str) -> f64 { let int_str: String = a.chars().take_while(|c| c.is_numeric()).collect(); let suffix = a.chars().find(|c| !c.is_numeric()); - let int_part = match int_str.parse::() { - Ok(i) => i, - Err(_) => -1f64, - } as f64; + let int_part = int_str.parse::().unwrap_or(-1f64) as f64; let suffix: f64 = match suffix.unwrap_or('\0') { 'K' => 1000f64, 'M' => 1E6, diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 4c3384d4b..a9588dee0 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -469,7 +469,7 @@ impl Stater { let fmtstr = if matches.is_present(OPT_PRINTF) { matches.value_of(OPT_PRINTF).expect("Invalid format string") } else { - matches.value_of(OPT_FORMAT).unwrap_or_else(|| "") + matches.value_of(OPT_FORMAT).unwrap_or("") }; let use_printf = matches.is_present(OPT_PRINTF); diff --git a/src/uu/uname/src/uname.rs b/src/uu/uname/src/uname.rs index c81c9cfa1..6b25292c5 100644 --- a/src/uu/uname/src/uname.rs +++ b/src/uu/uname/src/uname.rs @@ -111,28 +111,28 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if kernelname || all || none { output.push_str(&uname.sysname()); - output.push_str(" "); + output.push(' '); } if nodename || all { output.push_str(&uname.nodename()); - output.push_str(" "); + output.push(' '); } if kernelrelease || all { output.push_str(&uname.release()); - output.push_str(" "); + output.push(' '); } if kernelversion || all { output.push_str(&uname.version()); - output.push_str(" "); + output.push(' '); } if machine || all { output.push_str(&uname.machine()); - output.push_str(" "); + output.push(' '); } if os || all { output.push_str(HOST_OS); - output.push_str(" "); + output.push(' '); } println!("{}", output.trim_end()); diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 78bc6c2de..a0687e251 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -148,8 +148,8 @@ const CR: u8 = b'\r'; const LF: u8 = b'\n'; const SPACE: u8 = b' '; const TAB: u8 = b'\t'; -const SYN: u8 = 0x16 as u8; -const FF: u8 = 0x0C as u8; +const SYN: u8 = 0x16_u8; +const FF: u8 = 0x0C_u8; #[inline(always)] fn is_word_separator(byte: u8) -> bool { From 89f86249365a3f7c7011c8c0ba9bf3946252e8df Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 29 Nov 2020 16:31:26 +0100 Subject: [PATCH 219/606] 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) --- src/uu/install/src/install.rs | 14 ++++++-------- tests/by-util/test_install.rs | 27 ++++++++++++--------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 01b38a7bd..2b0aaa4c4 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -363,14 +363,12 @@ fn directory(paths: Vec, b: Behavior) -> i32 { for directory in paths.iter() { let path = Path::new(directory); - if path.exists() { - show_info!("cannot create directory '{}': File exists", path.display()); - all_successful = false; - } - - if let Err(e) = fs::create_dir(directory) { - show_info!("{}: {}", path.display(), e.to_string()); - all_successful = false; + // if the path already exist, don't try to create it again + if !path.exists() { + if let Err(e) = fs::create_dir(directory) { + show_info!("{}: {}", path.display(), e.to_string()); + all_successful = false; + } } if mode::chmod(&path, b.mode()).is_err() { diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index c47903df3..130713f58 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -31,6 +31,18 @@ fn test_install_basic() { assert!(at.file_exists(&format!("{}/{}", dir, file2))); } +#[test] +fn test_install_twice_dir() { + let dir = "test_install_target_dir_dir_a"; + let scene = TestScenario::new(util_name!()); + + scene.ucmd().arg("-d").arg(dir).succeeds(); + scene.ucmd().arg("-d").arg(dir).succeeds(); + let at = &scene.fixtures; + + assert!(at.dir_exists(dir)); +} + #[test] fn test_install_failing_not_dir() { let (at, mut ucmd) = at_and_ucmd!(); @@ -87,21 +99,6 @@ fn test_install_component_directories() { assert!(at.dir_exists(component3)); } -#[test] -fn test_install_component_directories_failing() { - let (at, mut ucmd) = at_and_ucmd!(); - let component = "test_install_target_dir_component_d1"; - let directories_arg = "-d"; - - at.mkdir(component); - assert!(ucmd - .arg(directories_arg) - .arg(component) - .fails() - .stderr - .contains("File exists")); -} - #[test] fn test_install_mode_numeric() { let (at, mut ucmd) = at_and_ucmd!(); From 11ecf80a250c01061cfc69b313b45812c392d9d4 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 29 Nov 2020 16:32:21 +0100 Subject: [PATCH 220/606] feature(sync): add --data & --file-system (#1639) --- src/uu/sync/src/sync.rs | 102 ++++++++++++++++++++++++++++++++++--- tests/by-util/test_sync.rs | 30 ++++++++++- 2 files changed, 123 insertions(+), 9 deletions(-) diff --git a/src/uu/sync/src/sync.rs b/src/uu/sync/src/sync.rs index c1b6cb8ad..c94308cdb 100644 --- a/src/uu/sync/src/sync.rs +++ b/src/uu/sync/src/sync.rs @@ -13,20 +13,46 @@ extern crate libc; #[macro_use] extern crate uucore; -use clap::App; +use clap::{App, Arg}; +use std::path::Path; + +static EXIT_ERR: i32 = 1; + static ABOUT: &str = "Synchronize cached writes to persistent storage"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static OPT_FILE_SYSTEM: &str = "file-system"; +static OPT_DATA: &str = "data"; + +static ARG_FILES: &str = "files"; #[cfg(unix)] mod platform { use super::libc; - - extern "C" { - fn sync() -> libc::c_void; - } + use std::fs::File; + use std::os::unix::io::AsRawFd; pub unsafe fn do_sync() -> isize { - sync(); + libc::sync(); + 0 + } + + #[cfg(target_os = "linux")] + pub unsafe fn do_syncfs(files: Vec) -> isize { + for path in files { + let f = File::open(&path).unwrap(); + let fd = f.as_raw_fd(); + libc::syscall(libc::SYS_syncfs, fd); + } + 0 + } + + #[cfg(target_os = "linux")] + pub unsafe fn do_fdatasync(files: Vec) -> isize { + for path in files { + let f = File::open(&path).unwrap(); + let fd = f.as_raw_fd(); + libc::syscall(libc::SYS_fdatasync, fd); + } 0 } } @@ -42,6 +68,7 @@ mod platform { use std::fs::OpenOptions; use std::mem; use std::os::windows::prelude::*; + use std::path::Path; use uucore::wide::{FromWide, ToWide}; unsafe fn flush_volume(name: &str) { @@ -113,6 +140,21 @@ mod platform { } 0 } + + pub unsafe fn do_syncfs(files: Vec) -> isize { + for path in files { + flush_volume( + Path::new(&path) + .components() + .next() + .unwrap() + .as_os_str() + .to_str() + .unwrap(), + ); + } + 0 + } } fn get_usage() -> String { @@ -122,16 +164,60 @@ fn get_usage() -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let _matches = App::new(executable!()) + let matches = App::new(executable!()) .version(VERSION) .about(ABOUT) .usage(&usage[..]) + .arg( + Arg::with_name(OPT_FILE_SYSTEM) + .short("f") + .long(OPT_FILE_SYSTEM) + .conflicts_with(OPT_DATA) + .help("sync the file systems that contain the files (Linux and Windows only)"), + ) + .arg( + Arg::with_name(OPT_DATA) + .short("d") + .long(OPT_DATA) + .conflicts_with(OPT_FILE_SYSTEM) + .help("sync only file data, no unneeded metadata (Linux only)"), + ) + .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) .get_matches_from(args); - sync(); + let files: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + + for f in &files { + if !Path::new(&f).exists() { + crash!(EXIT_ERR, "cannot stat '{}': No such file or directory", f); + } + } + + if matches.is_present(OPT_FILE_SYSTEM) { + #[cfg(any(target_os = "linux", target_os = "windows"))] + syncfs(files); + } else if matches.is_present(OPT_DATA) { + #[cfg(target_os = "linux")] + fdatasync(files); + } else { + sync(); + } 0 } fn sync() -> isize { unsafe { platform::do_sync() } } + +#[cfg(any(target_os = "linux", target_os = "windows"))] +fn syncfs(files: Vec) -> isize { + unsafe { platform::do_syncfs(files) } +} + +#[cfg(target_os = "linux")] +fn fdatasync(files: Vec) -> isize { + unsafe { platform::do_fdatasync(files) } +} diff --git a/tests/by-util/test_sync.rs b/tests/by-util/test_sync.rs index e4eb72eac..138992ee4 100644 --- a/tests/by-util/test_sync.rs +++ b/tests/by-util/test_sync.rs @@ -1,11 +1,39 @@ use crate::common::util::*; +use std::fs; +extern crate tempfile; +use self::tempfile::tempdir; + #[test] fn test_sync_default() { - new_ucmd!().run(); + let result = new_ucmd!().run(); + assert!(result.success); } #[test] fn test_sync_incorrect_arg() { new_ucmd!().arg("--foo").fails(); } + +#[test] +fn test_sync_fs() { + let temporary_directory = tempdir().unwrap(); + let temporary_path = fs::canonicalize(temporary_directory.path()).unwrap(); + let result = new_ucmd!().arg("--file-system").arg(&temporary_path).run(); + assert!(result.success); +} + +#[test] +fn test_sync_data() { + // Todo add a second arg + let temporary_directory = tempdir().unwrap(); + let temporary_path = fs::canonicalize(temporary_directory.path()).unwrap(); + let result = new_ucmd!().arg("--data").arg(&temporary_path).run(); + assert!(result.success); +} + +#[test] +fn test_sync_no_existing_files() { + let result = new_ucmd!().arg("--data").arg("do-no-exist").fails(); + assert!(result.stderr.contains("error: cannot stat")); +} From 261b4e24d6694fc4be338ddb93751e2364b91442 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 26 Nov 2020 21:25:40 +0100 Subject: [PATCH 221/606] feature(install): remove a duplicate check. Already done in is_new_file_path --- src/uu/install/src/install.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 2b0aaa4c4..0435bb9ce 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -390,7 +390,7 @@ fn directory(paths: Vec, b: Behavior) -> i32 { /// Test if the path is a new file path that can be /// created immediately fn is_new_file_path(path: &Path) -> bool { - path.is_file() || !path.exists() && path.parent().map(Path::is_dir).unwrap_or(true) + !path.exists() && path.parent().map(Path::is_dir).unwrap_or(true) } /// Perform an install, given a list of paths and behavior. @@ -409,6 +409,7 @@ fn standard(paths: Vec, b: Behavior) -> i32 { let target = Path::new(paths.last().unwrap()); if (target.is_file() || is_new_file_path(target)) && sources.len() == 1 { + /* If the target already exist or directly creatable */ copy_file_to_file(&sources[0], &target.to_path_buf(), &b) } else { copy_files_into_dir(sources, &target.to_path_buf(), &b) From b07f496b70bc75cd232cfbce901f569925c3e950 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 26 Nov 2020 21:46:03 +0100 Subject: [PATCH 222/606] fix(install): 'install file_a file_b' should just copy the file --- src/uu/install/src/install.rs | 4 +++- tests/by-util/test_install.rs | 8 ++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 0435bb9ce..627803a02 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -390,7 +390,9 @@ fn directory(paths: Vec, b: Behavior) -> i32 { /// Test if the path is a new file path that can be /// created immediately fn is_new_file_path(path: &Path) -> bool { - !path.exists() && path.parent().map(Path::is_dir).unwrap_or(true) + !path.exists() + && (path.parent().map(Path::is_dir).unwrap_or(true) + || path.parent().unwrap().to_string_lossy().is_empty()) // In case of a simple file } /// Perform an install, given a list of paths and behavior. diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 130713f58..ec38d11b0 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -224,7 +224,6 @@ fn test_install_target_new_file_failing_nonexistent_parent() { assert!(err.contains("not a directory")) } - // These two tests are failing but should work #[test] fn test_install_copy_file() { @@ -233,13 +232,10 @@ fn test_install_copy_file() { let file2 = "test_install_target_dir_file_a2"; at.touch(file1); - ucmd.arg(file1).arg(file2).fails(); - -/* Uncomment when fixed ucmd.arg(file1).arg(file2).succeeds().no_stderr(); assert!(at.file_exists(file1)); - assert!(at.file_exists(file2));*/ + assert!(at.file_exists(file2)); } #[test] @@ -259,4 +255,4 @@ fn test_install_target_file_dev_null() { assert!(at.file_exists(file1)); assert!(at.file_exists(file2)); */ -} \ No newline at end of file +} From f76a0ec97223e5b13c372a629fd354004c47fc1d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 4 Aug 2020 23:15:33 +0200 Subject: [PATCH 223/606] feature(cp): implement archive + add missing tests --- src/uu/cp/src/cp.rs | 75 +++++++++---- tests/by-util/test_cp.rs | 227 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 278 insertions(+), 24 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 85759033a..1ad07a53d 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -337,7 +337,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg(Arg::with_name(OPT_RECURSIVE) .short("r") .long(OPT_RECURSIVE) - .help("copy directories recursively")) + // --archive sets this option + .help("copy directories recursively")) .arg(Arg::with_name(OPT_RECURSIVE_ALIAS) .short("R") .help("same as -r")) @@ -395,7 +396,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .use_delimiter(true) .possible_values(PRESERVABLE_ATTRIBUTES) .value_name("ATTR_LIST") - .conflicts_with_all(&[OPT_PRESERVE_DEFAULT_ATTRIBUTES, OPT_NO_PRESERVE, OPT_ARCHIVE]) + .conflicts_with_all(&[OPT_PRESERVE_DEFAULT_ATTRIBUTES, OPT_NO_PRESERVE]) + // -d sets this option + // --archive sets this option .help("Preserve the specified attributes (default: mode(unix only),ownership,timestamps),\ if possible additional attributes: context, links, xattr, all")) .arg(Arg::with_name(OPT_PRESERVE_DEFAULT_ATTRIBUTES) @@ -413,21 +416,22 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .short("-P") .long(OPT_NO_DEREFERENCE) .conflicts_with(OPT_DEREFERENCE) + // -d sets this option .help("never follow symbolic links in SOURCE")) - - // TODO: implement the following args .arg(Arg::with_name(OPT_ARCHIVE) .short("a") .long(OPT_ARCHIVE) .conflicts_with_all(&[OPT_PRESERVE_DEFAULT_ATTRIBUTES, OPT_PRESERVE, OPT_NO_PRESERVE]) - .help("NotImplemented: same as -dR --preserve=all")) + .help("Same as -dR --preserve=all")) + .arg(Arg::with_name(OPT_NO_DEREFERENCE_PRESERVE_LINKS) + .short("d") + .help("same as --no-dereference --preserve=links")) + + // TODO: implement the following args .arg(Arg::with_name(OPT_COPY_CONTENTS) .long(OPT_COPY_CONTENTS) .conflicts_with(OPT_ATTRIBUTES_ONLY) .help("NotImplemented: copy contents of special files when recursive")) - .arg(Arg::with_name(OPT_NO_DEREFERENCE_PRESERVE_LINKS) - .short("d") - .help("NotImplemented: same as --no-dereference --preserve=links")) .arg(Arg::with_name(OPT_DEREFERENCE) .short("L") .long(OPT_DEREFERENCE) @@ -548,12 +552,22 @@ impl FromStr for Attribute { } } +fn add_all_attributes() -> Vec { + let mut attr = Vec::new(); + #[cfg(unix)] + attr.push(Attribute::Mode); + attr.push(Attribute::Ownership); + attr.push(Attribute::Timestamps); + attr.push(Attribute::Context); + attr.push(Attribute::Xattr); + attr.push(Attribute::Links); + attr +} + impl Options { fn from_matches(matches: &ArgMatches) -> CopyResult { let not_implemented_opts = vec![ - OPT_ARCHIVE, OPT_COPY_CONTENTS, - OPT_NO_DEREFERENCE_PRESERVE_LINKS, OPT_DEREFERENCE, OPT_PARENTS, OPT_SPARSE, @@ -590,13 +604,7 @@ impl Options { let mut attributes = Vec::new(); for attribute_str in attribute_strs { if attribute_str == "all" { - #[cfg(unix)] - attributes.push(Attribute::Mode); - attributes.push(Attribute::Ownership); - attributes.push(Attribute::Timestamps); - attributes.push(Attribute::Context); - attributes.push(Attribute::Xattr); - attributes.push(Attribute::Links); + attributes = add_all_attributes(); break; } else { attributes.push(Attribute::from_str(attribute_str)?); @@ -605,6 +613,11 @@ impl Options { attributes } } + } else if matches.is_present(OPT_ARCHIVE) { + // --archive is used. Same as --preserve=all + add_all_attributes() + } else if matches.is_present(OPT_NO_DEREFERENCE_PRESERVE_LINKS) { + vec![Attribute::Links] } else if matches.is_present(OPT_PRESERVE_DEFAULT_ATTRIBUTES) { DEFAULT_ATTRIBUTES.to_vec() } else { @@ -616,7 +629,10 @@ impl Options { copy_contents: matches.is_present(OPT_COPY_CONTENTS), copy_mode: CopyMode::from_matches(matches), dereference: matches.is_present(OPT_DEREFERENCE), - no_dereference: matches.is_present(OPT_NO_DEREFERENCE), + // No dereference is set with -p, -d and --archive + no_dereference: matches.is_present(OPT_NO_DEREFERENCE) + || matches.is_present(OPT_NO_DEREFERENCE_PRESERVE_LINKS) + || matches.is_present(OPT_ARCHIVE), one_file_system: matches.is_present(OPT_ONE_FILE_SYSTEM), overwrite: OverwriteMode::from_matches(matches), parents: matches.is_present(OPT_PARENTS), @@ -797,7 +813,6 @@ fn copy(sources: &[Source], target: &Target, options: &Options) -> CopyResult<() let dest = construct_dest_path(source, target, &target_type, options)?; preserve_hardlinks(&mut hard_links, source, dest, &mut found_hard_link).unwrap(); } - if !found_hard_link { if let Err(error) = copy_source(source, target, &target_type, options) { show_error!("{}", error); @@ -953,7 +968,19 @@ fn copy_directory(root: &Path, target: &Target, options: &Options) -> CopyResult let dest = local_to_target.as_path().to_path_buf(); preserve_hardlinks(&mut hard_links, &source, dest, &mut found_hard_link).unwrap(); if !found_hard_link { - copy_file(path.as_path(), local_to_target.as_path(), options)?; + match copy_file(path.as_path(), local_to_target.as_path(), options) { + Ok(_) => Ok(()), + Err(err) => { + if fs::symlink_metadata(&source)?.file_type().is_symlink() { + // silent the error with a symlink + // In case we do --archive, we might copy the symlink + // before the file itself + Ok(()) + } else { + Err(err) + } + } + }?; } } else { copy_file(path.as_path(), local_to_target.as_path(), options)?; @@ -1026,12 +1053,16 @@ fn copy_attribute(source: &Path, dest: &Path, attribute: &Attribute) -> CopyResu } } }; + Ok(()) } #[cfg(not(windows))] fn symlink_file(source: &Path, dest: &Path, context: &str) -> CopyResult<()> { - Ok(std::os::unix::fs::symlink(source, dest).context(context)?) + match std::os::unix::fs::symlink(source, dest).context(context) { + Ok(_) => Ok(()), + Err(_) => Ok(()), + } } #[cfg(windows)] @@ -1144,11 +1175,9 @@ fn copy_file(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> { .unwrap(); } }; - for attribute in &options.preserve_attributes { copy_attribute(source, dest, attribute)?; } - Ok(()) } diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 753fe9e90..8c0900ba2 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -8,8 +8,16 @@ use std::os::unix::fs; #[cfg(windows)] use std::os::windows::fs::symlink_file; +#[cfg(target_os = "linux")] +use filetime::FileTime; #[cfg(not(windows))] use std::env; +#[cfg(target_os = "linux")] +use std::fs as std_fs; +#[cfg(target_os = "linux")] +use std::thread::sleep; +#[cfg(target_os = "linux")] +use std::time::Duration; static TEST_EXISTING_FILE: &str = "existing_file.txt"; static TEST_HELLO_WORLD_SOURCE: &str = "hello_world.txt"; @@ -209,7 +217,7 @@ fn test_cp_arg_interactive() { } #[test] -#[cfg(target_os = "unix")] +#[cfg(target_os = "linux")] fn test_cp_arg_link() { use std::os::linux::fs::MetadataExt; @@ -491,3 +499,220 @@ fn test_cp_no_deref_folder_to_folder() { let path_to_check = path_to_new_symlink.to_str().unwrap(); assert_eq!(at.read(&path_to_check), "Hello, World!\n"); } + +#[test] +#[cfg(target_os = "linux")] +fn test_cp_archive() { + let (at, mut ucmd) = at_and_ucmd!(); + let ts = time::now().to_timespec(); + let previous = FileTime::from_unix_time(ts.sec as i64 - 3600, ts.nsec as u32); + // set the file creation/modif an hour ago + filetime::set_file_times( + at.plus_as_string(TEST_HELLO_WORLD_SOURCE), + previous, + previous, + ) + .unwrap(); + let result = ucmd + .arg(TEST_HELLO_WORLD_SOURCE) + .arg("--archive") + .arg(TEST_HOW_ARE_YOU_SOURCE) + .run(); + + assert!(result.success); + assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); + + let metadata = std_fs::metadata(at.subdir.join(TEST_HELLO_WORLD_SOURCE)).unwrap(); + let creation = metadata.modified().unwrap(); + + let metadata2 = std_fs::metadata(at.subdir.join(TEST_HOW_ARE_YOU_SOURCE)).unwrap(); + let creation2 = metadata2.modified().unwrap(); + + let scene2 = TestScenario::new("ls"); + let result = scene2.cmd("ls").arg("-al").arg(at.subdir).run(); + + println!("ls dest {}", result.stdout); + assert_eq!(creation, creation2); + assert!(result.success); +} + +#[test] +#[cfg(target_os = "unix")] +fn test_cp_archive_recursive() { + let (at, mut ucmd) = at_and_ucmd!(); + let cwd = env::current_dir().unwrap(); + + // creates + // dir/1 + // dir/1.link => dir/1 + // dir/2 + // dir/2.link => dir/2 + + let file_1 = at.subdir.join(TEST_COPY_TO_FOLDER).join("1"); + let file_1_link = at.subdir.join(TEST_COPY_TO_FOLDER).join("1.link"); + let file_2 = at.subdir.join(TEST_COPY_TO_FOLDER).join("2"); + let file_2_link = at.subdir.join(TEST_COPY_TO_FOLDER).join("2.link"); + + at.touch(&file_1.to_string_lossy()); + at.touch(&file_2.to_string_lossy()); + + // Change the cwd to have a correct symlink + assert!(env::set_current_dir(&at.subdir.join(TEST_COPY_TO_FOLDER)).is_ok()); + + #[cfg(not(windows))] + { + let _r = fs::symlink("1", &file_1_link); + let _r = fs::symlink("2", &file_2_link); + } + #[cfg(windows)] + { + let _r = symlink_file("1", &file_1_link); + let _r = symlink_file("2", &file_2_link); + } + // Back to the initial cwd (breaks the other tests) + assert!(env::set_current_dir(&cwd).is_ok()); + + let resultg = ucmd + .arg("--archive") + .arg(TEST_COPY_TO_FOLDER) + .arg(TEST_COPY_TO_FOLDER_NEW) + .run(); + + let scene2 = TestScenario::new("ls"); + let result = scene2 + .cmd("ls") + .arg("-al") + .arg(&at.subdir.join(TEST_COPY_TO_FOLDER)) + .run(); + + println!("ls dest {}", result.stdout); + + let scene2 = TestScenario::new("ls"); + let result = scene2 + .cmd("ls") + .arg("-al") + .arg(&at.subdir.join(TEST_COPY_TO_FOLDER_NEW)) + .run(); + + println!("ls dest {}", result.stdout); + assert!(at.file_exists( + &at.subdir + .join(TEST_COPY_TO_FOLDER_NEW) + .join("1.link") + .to_string_lossy() + )); + assert!(at.file_exists( + &at.subdir + .join(TEST_COPY_TO_FOLDER_NEW) + .join("2.link") + .to_string_lossy() + )); + assert!(at.file_exists( + &at.subdir + .join(TEST_COPY_TO_FOLDER_NEW) + .join("1") + .to_string_lossy() + )); + assert!(at.file_exists( + &at.subdir + .join(TEST_COPY_TO_FOLDER_NEW) + .join("2") + .to_string_lossy() + )); + + assert!(at.is_symlink( + &at.subdir + .join(TEST_COPY_TO_FOLDER_NEW) + .join("1.link") + .to_string_lossy() + )); + assert!(at.is_symlink( + &at.subdir + .join(TEST_COPY_TO_FOLDER_NEW) + .join("2.link") + .to_string_lossy() + )); + + // fails for now + assert!(resultg.success); +} + +#[test] +#[cfg(target_os = "linux")] +fn test_cp_preserve_timestamps() { + let (at, mut ucmd) = at_and_ucmd!(); + let ts = time::now().to_timespec(); + let previous = FileTime::from_unix_time(ts.sec as i64 - 3600, ts.nsec as u32); + // set the file creation/modif an hour ago + filetime::set_file_times( + at.plus_as_string(TEST_HELLO_WORLD_SOURCE), + previous, + previous, + ) + .unwrap(); + let result = ucmd + .arg(TEST_HELLO_WORLD_SOURCE) + .arg("--preserve=timestamps") + .arg(TEST_HOW_ARE_YOU_SOURCE) + .run(); + + assert!(result.success); + assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); + + let metadata = std_fs::metadata(at.subdir.join(TEST_HELLO_WORLD_SOURCE)).unwrap(); + let creation = metadata.modified().unwrap(); + + let metadata2 = std_fs::metadata(at.subdir.join(TEST_HOW_ARE_YOU_SOURCE)).unwrap(); + let creation2 = metadata2.modified().unwrap(); + + let scene2 = TestScenario::new("ls"); + let result = scene2.cmd("ls").arg("-al").arg(at.subdir).run(); + + println!("ls dest {}", result.stdout); + assert_eq!(creation, creation2); + assert!(result.success); +} + +#[test] +#[cfg(target_os = "linux")] +fn test_cp_dont_preserve_timestamps() { + let (at, mut ucmd) = at_and_ucmd!(); + let ts = time::now().to_timespec(); + let previous = FileTime::from_unix_time(ts.sec as i64 - 3600, ts.nsec as u32); + // set the file creation/modif an hour ago + filetime::set_file_times( + at.plus_as_string(TEST_HELLO_WORLD_SOURCE), + previous, + previous, + ) + .unwrap(); + sleep(Duration::from_secs(3)); + + let result = ucmd + .arg(TEST_HELLO_WORLD_SOURCE) + .arg("--no-preserve=timestamps") + .arg(TEST_HOW_ARE_YOU_SOURCE) + .run(); + + assert!(result.success); + assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); + + let metadata = std_fs::metadata(at.subdir.join(TEST_HELLO_WORLD_SOURCE)).unwrap(); + let creation = metadata.modified().unwrap(); + + let metadata2 = std_fs::metadata(at.subdir.join(TEST_HOW_ARE_YOU_SOURCE)).unwrap(); + let creation2 = metadata2.modified().unwrap(); + + let scene2 = TestScenario::new("ls"); + let result = scene2.cmd("ls").arg("-al").arg(at.subdir).run(); + + println!("ls dest {}", result.stdout); + println!("creation {:?} / {:?}", creation, creation2); + + assert_ne!(creation, creation2); + let res = creation.elapsed().unwrap() - creation2.elapsed().unwrap(); + // Some margins with time check + assert!(res.as_secs() > 3595); + assert!(res.as_secs() < 3605); + assert!(result.success); +} From c483fa501bd0a686eebe191448aa2d4cafc3ebef Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 11 Nov 2020 21:41:02 +0100 Subject: [PATCH 224/606] feature(cp): also implement --dereference/-L --- src/uu/cp/src/cp.rs | 17 ++--- tests/by-util/test_cp.rs | 159 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 167 insertions(+), 9 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 1ad07a53d..fe710621d 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -418,6 +418,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .conflicts_with(OPT_DEREFERENCE) // -d sets this option .help("never follow symbolic links in SOURCE")) + .arg(Arg::with_name(OPT_DEREFERENCE) + .short("L") + .long(OPT_DEREFERENCE) + .conflicts_with(OPT_NO_DEREFERENCE) + .help("always follow symbolic links in SOURCE")) .arg(Arg::with_name(OPT_ARCHIVE) .short("a") .long(OPT_ARCHIVE) @@ -432,11 +437,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_COPY_CONTENTS) .conflicts_with(OPT_ATTRIBUTES_ONLY) .help("NotImplemented: copy contents of special files when recursive")) - .arg(Arg::with_name(OPT_DEREFERENCE) - .short("L") - .long(OPT_DEREFERENCE) - .conflicts_with(OPT_NO_DEREFERENCE) - .help("NotImplemented: always follow symbolic links in SOURCE")) .arg(Arg::with_name(OPT_PARENTS) .long(OPT_PARENTS) .help("NotImplemented: use full source file name under DIRECTORY")) @@ -546,7 +546,7 @@ impl FromStr for Attribute { return Err(Error::InvalidArgument(format!( "invalid attribute '{}'", value - ))) + ))); } }) } @@ -568,7 +568,6 @@ impl Options { fn from_matches(matches: &ArgMatches) -> CopyResult { let not_implemented_opts = vec![ OPT_COPY_CONTENTS, - OPT_DEREFERENCE, OPT_PARENTS, OPT_SPARSE, OPT_STRIP_TRAILING_SLASHES, @@ -649,7 +648,7 @@ impl Options { return Err(Error::InvalidArgument(format!( "invalid argument '{}' for \'reflink\'", value - ))) + ))); } } } else { @@ -927,7 +926,7 @@ fn copy_directory(root: &Path, target: &Target, options: &Options) -> CopyResult for path in WalkDir::new(root) { let p = or_continue!(path); let is_symlink = fs::symlink_metadata(p.path())?.file_type().is_symlink(); - let path = if options.no_dereference && is_symlink { + let path = if (options.no_dereference || options.dereference) && is_symlink { // we are dealing with a symlink. Don't follow it match env::current_dir() { Ok(cwd) => cwd.join(resolve_relative_path(p.path())), diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 8c0900ba2..a18386b97 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -351,6 +351,60 @@ fn test_cp_arg_suffix() { ); } +#[test] +fn test_cp_deref_conflicting_options() { + let (_at, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("-LP") + .arg(TEST_COPY_TO_FOLDER) + .arg(TEST_HELLO_WORLD_SOURCE) + .fails(); +} + +#[test] +fn test_cp_deref() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + #[cfg(not(windows))] + let _r = fs::symlink( + TEST_HELLO_WORLD_SOURCE, + at.subdir.join(TEST_HELLO_WORLD_SOURCE_SYMLINK), + ); + #[cfg(windows)] + let _r = symlink_file( + TEST_HELLO_WORLD_SOURCE, + at.subdir.join(TEST_HELLO_WORLD_SOURCE_SYMLINK), + ); + //using -L option + let result = scene + .ucmd() + .arg("-L") + .arg(TEST_HELLO_WORLD_SOURCE) + .arg(TEST_HELLO_WORLD_SOURCE_SYMLINK) + .arg(TEST_COPY_TO_FOLDER) + .run(); + + // Check that the exit code represents a successful copy. + let exit_success = result.success; + assert!(exit_success); + let path_to_new_symlink = at + .subdir + .join(TEST_COPY_TO_FOLDER) + .join(TEST_HELLO_WORLD_SOURCE_SYMLINK); + // unlike -P/--no-deref, we expect a file, not a link + assert!(at.file_exists( + &path_to_new_symlink + .clone() + .into_os_string() + .into_string() + .unwrap() + )); + // Check the content of the destination file that was copied. + assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n"); + let path_to_check = path_to_new_symlink.to_str().unwrap(); + assert_eq!(at.read(&path_to_check), "Hello, World!\n"); +} #[test] fn test_cp_no_deref() { let scene = TestScenario::new(util_name!()); @@ -395,6 +449,111 @@ fn test_cp_no_deref() { assert_eq!(at.read(&path_to_check), "Hello, World!\n"); } +#[test] +// For now, disable the test on Windows. Symlinks aren't well support on Windows. +// It works on Unix for now and it works locally when run from a powershell +#[cfg(not(windows))] +fn test_cp_deref_folder_to_folder() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let cwd = env::current_dir().unwrap(); + + let path_to_new_symlink = at.subdir.join(TEST_COPY_FROM_FOLDER); + + // Change the cwd to have a correct symlink + assert!(env::set_current_dir(&path_to_new_symlink).is_ok()); + + #[cfg(not(windows))] + let _r = fs::symlink(TEST_HELLO_WORLD_SOURCE, TEST_HELLO_WORLD_SOURCE_SYMLINK); + #[cfg(windows)] + let _r = symlink_file(TEST_HELLO_WORLD_SOURCE, TEST_HELLO_WORLD_SOURCE_SYMLINK); + + // Back to the initial cwd (breaks the other tests) + assert!(env::set_current_dir(&cwd).is_ok()); + + //using -P -R option + let result = scene + .ucmd() + .arg("-L") + .arg("-R") + .arg("-v") + .arg(TEST_COPY_FROM_FOLDER) + .arg(TEST_COPY_TO_FOLDER_NEW) + .run(); + println!("cp output {}", result.stdout); + + // Check that the exit code represents a successful copy. + let exit_success = result.success; + assert!(exit_success); + + #[cfg(not(windows))] + { + let scene2 = TestScenario::new("ls"); + let result = scene2.cmd("ls").arg("-al").arg(path_to_new_symlink).run(); + println!("ls source {}", result.stdout); + + let path_to_new_symlink = at.subdir.join(TEST_COPY_TO_FOLDER_NEW); + + let result = scene2.cmd("ls").arg("-al").arg(path_to_new_symlink).run(); + println!("ls dest {}", result.stdout); + } + + #[cfg(windows)] + { + // No action as this test is disabled but kept in case we want to + // try to make it work in the future. + let a = Command::new("cmd").args(&["/C", "dir"]).output(); + println!("output {:#?}", a); + + let a = Command::new("cmd") + .args(&["/C", "dir", &at.as_string()]) + .output(); + println!("output {:#?}", a); + + let a = Command::new("cmd") + .args(&["/C", "dir", path_to_new_symlink.to_str().unwrap()]) + .output(); + println!("output {:#?}", a); + + let path_to_new_symlink = at.subdir.join(TEST_COPY_FROM_FOLDER); + + let a = Command::new("cmd") + .args(&["/C", "dir", path_to_new_symlink.to_str().unwrap()]) + .output(); + println!("output {:#?}", a); + + let path_to_new_symlink = at.subdir.join(TEST_COPY_TO_FOLDER_NEW); + + let a = Command::new("cmd") + .args(&["/C", "dir", path_to_new_symlink.to_str().unwrap()]) + .output(); + println!("output {:#?}", a); + } + + let path_to_new_symlink = at + .subdir + .join(TEST_COPY_TO_FOLDER_NEW) + .join(TEST_HELLO_WORLD_SOURCE_SYMLINK); + assert!(at.file_exists( + &path_to_new_symlink + .clone() + .into_os_string() + .into_string() + .unwrap() + )); + + let path_to_new = at.subdir.join(TEST_COPY_TO_FOLDER_NEW_FILE); + + // Check the content of the destination file that was copied. + let path_to_check = path_to_new.to_str().unwrap(); + assert_eq!(at.read(path_to_check), "Hello, World!\n"); + + // Check the content of the symlink + let path_to_check = path_to_new_symlink.to_str().unwrap(); + assert_eq!(at.read(&path_to_check), "Hello, World!\n"); +} + #[test] // For now, disable the test on Windows. Symlinks aren't well support on Windows. // It works on Unix for now and it works locally when run from a powershell From 5f47d1249d00e04172cdcc6eabf7a625917c402a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 1 Dec 2020 22:59:14 +0100 Subject: [PATCH 225/606] use the same version of clap everywhere --- Cargo.lock | 101 ++++++++++++++++++------------------- src/uu/cp/Cargo.toml | 2 +- src/uu/date/Cargo.toml | 2 +- src/uu/df/Cargo.toml | 2 +- src/uu/groups/Cargo.toml | 2 +- src/uu/hostname/Cargo.toml | 2 +- src/uu/join/Cargo.toml | 2 +- src/uu/uname/Cargo.toml | 2 +- src/uu/whoami/Cargo.toml | 2 +- src/uu/yes/Cargo.toml | 2 +- 10 files changed, 59 insertions(+), 60 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5019f227b..70684fd4a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -399,11 +399,11 @@ dependencies = [ "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "oorandom 11.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -430,7 +430,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -439,37 +439,36 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-epoch 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-utils" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bstr 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -673,10 +672,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "js-sys" -version = "0.3.45" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wasm-bindgen 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -736,7 +735,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memoffset" -version = "0.5.6" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -831,7 +830,7 @@ dependencies = [ [[package]] name = "oorandom" -version = "11.1.2" +version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -870,10 +869,10 @@ name = "plotters" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "js-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1012,7 +1011,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1132,7 +1131,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1198,7 +1197,7 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.48" +version = "1.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2335,7 +2334,7 @@ version = "0.0.4" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2370,16 +2369,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wasm-bindgen" -version = "0.2.68" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.68" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bumpalo 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2387,43 +2386,43 @@ dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.68" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.68" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.68" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "web-sys" -version = "0.3.45" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "js-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2518,9 +2517,9 @@ dependencies = [ "checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" "checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" "checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" -"checksum crossbeam-epoch 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec0f606a85340376eef0d6d8fec399e6d4a544d648386c6645eb6d0653b27d9f" -"checksum crossbeam-utils 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5" -"checksum csv 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fc4666154fd004af3fd6f1da2e81a96fd5a81927fe8ddb6ecc79e2aa6e138b54" +"checksum crossbeam-epoch 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d" +"checksum crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d" +"checksum csv 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f9d58633299b24b515ac72a3f869f8b91306a3cec616a602843a383acd6f9e97" "checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" "checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" "checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" @@ -2548,7 +2547,7 @@ dependencies = [ "checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" "checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" "checksum itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" -"checksum js-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)" = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" +"checksum js-sys 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" @@ -2558,7 +2557,7 @@ dependencies = [ "checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" "checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" -"checksum memoffset 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +"checksum memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" "checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" "checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" @@ -2569,7 +2568,7 @@ dependencies = [ "checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" "checksum onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" "checksum onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" -"checksum oorandom 11.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a170cebd8021a008ea92e4db85a72f80b35df514ec664b296fdcbb654eac0b2c" +"checksum oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" "checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" "checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" "checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" @@ -2616,7 +2615,7 @@ dependencies = [ "checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" +"checksum syn 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)" = "8833e20724c24de12bbaba5ad230ea61c3eafb05b881c7c9d3cfe8638b187e68" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" @@ -2640,12 +2639,12 @@ dependencies = [ "checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" "checksum walker 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44971d5e5ae4f7904dffb6260ebd3910e7bcae104a94730e04a24cb6af40646b" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum wasm-bindgen 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" -"checksum wasm-bindgen-backend 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" -"checksum wasm-bindgen-macro 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" -"checksum wasm-bindgen-macro-support 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" -"checksum wasm-bindgen-shared 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" -"checksum web-sys 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" +"checksum wasm-bindgen 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" +"checksum wasm-bindgen-backend 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" +"checksum wasm-bindgen-macro 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084" +"checksum wasm-bindgen-macro-support 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" +"checksum wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" +"checksum web-sys 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)" = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3" "checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index 9c57d92a5..a060323d9 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -19,7 +19,7 @@ edition = "2018" path = "src/cp.rs" [dependencies] -clap = "2.32" +clap = "2.33" filetime = "0.2" libc = "0.2.42" quick-error = "1.2.3" diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index d2a335d5b..d6878c939 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -16,7 +16,7 @@ path = "src/date.rs" [dependencies] chrono = "0.4.4" -clap = "2.32" +clap = "2.33" uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 25d1433fb..02ac86fdd 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/df.rs" [dependencies] -clap = "2.32" +clap = "2.33" libc = "0.2" number_prefix = "0.2" uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index 5d29d2063..9f5e498bf 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -17,7 +17,7 @@ path = "src/groups.rs" [dependencies] uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries"] } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } -clap = "2.32" +clap = "2.33" [[bin]] name = "groups" diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index d5cecf9bd..3252bddea 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/hostname.rs" [dependencies] -clap = "2.32" +clap = "2.33" libc = "0.2.42" hostname = { version = "0.3", features = ["set"] } uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["wide"] } diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index 7e16ebf2f..a2f3599e1 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/join.rs" [dependencies] -clap = "2.32" +clap = "2.33" uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index 4eed217d0..9a8aa59db 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/uname.rs" [dependencies] -clap = "2.32" +clap = "2.33" platform-info = "0.0.1" uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index 068eaa40a..fc45321b2 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -16,7 +16,7 @@ path = "src/whoami.rs" [dependencies] advapi32-sys = "0.2.0" -clap = "2.32" +clap = "2.33" uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "wide"] } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } winapi = { version = "0.3", features = ["lmcons"] } diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index 499baa67c..2e987bc02 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/yes.rs" [dependencies] -clap = "2.32" +clap = "2.33" uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["zero-copy"] } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } From d21acc4621f61988ddde54a802db2c4a73022d2b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 8 Dec 2020 23:19:51 +0100 Subject: [PATCH 226/606] cosmetic(cp): use the variable instead of the string --- src/uu/cp/src/cp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index fe710621d..73713555a 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -468,7 +468,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let options = crash_if_err!(EXIT_ERR, Options::from_matches(&matches)); let paths: Vec = matches - .values_of("paths") + .values_of(OPT_PATHS) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); From 3ca8ba997c8e1ae3200619644e380cad3149dfc0 Mon Sep 17 00:00:00 2001 From: Piyush Jaipuriayar Date: Wed, 9 Dec 2020 04:02:02 +0530 Subject: [PATCH 227/606] hashsum: added blake2 as a hashing algorithm (#1651) --- Cargo.lock | 74 ++++++++++++++++++--------- src/uu/hashsum/Cargo.toml | 1 + src/uu/hashsum/src/digest.rs | 24 +++++++++ src/uu/hashsum/src/hashsum.rs | 9 +++- tests/by-util/test_hashsum.rs | 1 + tests/fixtures/hashsum/b2sum.expected | 1 + 6 files changed, 85 insertions(+), 25 deletions(-) create mode 100644 tests/fixtures/hashsum/b2sum.expected diff --git a/Cargo.lock b/Cargo.lock index 70684fd4a..9135d08a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,6 +31,14 @@ dependencies = [ "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "arrayvec" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "atty" version = "0.2.14" @@ -77,12 +85,12 @@ name = "bit-set" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bit-vec 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bit-vec" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -95,6 +103,15 @@ name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "blake2-rfc" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "block-buffer" version = "0.2.0" @@ -112,7 +129,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -190,6 +207,11 @@ name = "const_fn" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "conv" version = "0.3.3" @@ -407,10 +429,10 @@ dependencies = [ "plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -475,7 +497,7 @@ dependencies = [ "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1112,7 +1134,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.117" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1121,27 +1143,27 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "half 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.117" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1197,7 +1219,7 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.53" +version = "1.0.54" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1307,8 +1329,8 @@ name = "tinytemplate" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1620,6 +1642,7 @@ dependencies = [ name = "uu_hashsum" version = "0.0.1" dependencies = [ + "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2334,7 +2357,7 @@ version = "0.0.4" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2386,7 +2409,7 @@ dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2406,7 +2429,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2483,15 +2506,17 @@ dependencies = [ "checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5" "checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" "checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" "checksum backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)" = "ada4c783bb7e7443c14e0480f429ae2cc99da95065aeab7ee1b81ada0419404f" "checksum backtrace-sys 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "18fbebbe1c9d1f383a9cc7e8ccdb471b91c8d024ee9c2ca5b5346121fe8b4399" "checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" -"checksum bit-vec 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5f0dc55f2d8a1a85650ac47858bb001b4c0dd73d79e3c455a842925e68d29cd3" +"checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" "checksum bstr 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "473fc6b38233f9af7baa94fb5852dca389e3d95b8e21c8e3719301462c5d9faf" "checksum bumpalo 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" @@ -2505,6 +2530,7 @@ dependencies = [ "checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab" +"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" "checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" "checksum cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d1cd8699ffa1b18fd388183f7762e0545eddbd5c6ec95e9e3b42a4a71a507ff" "checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" @@ -2605,17 +2631,17 @@ dependencies = [ "checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)" = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a" +"checksum serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)" = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" "checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)" = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e" -"checksum serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)" = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95" +"checksum serde_derive 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)" = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" +"checksum serde_json 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)" = "1500e84d27fe482ed1dc791a56eddc2f230046a040fa908c08bda1d9fb615779" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" "checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 1.0.53 (registry+https://github.com/rust-lang/crates.io-index)" = "8833e20724c24de12bbaba5ad230ea61c3eafb05b881c7c9d3cfe8638b187e68" +"checksum syn 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index a54a2beac..1e1808f59 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -25,6 +25,7 @@ regex-syntax = "0.6.7" sha1 = "0.6.0" sha2 = "0.6.0" sha3 = "0.6.0" +blake2-rfc = "0.2.18" uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/hashsum/src/digest.rs b/src/uu/hashsum/src/digest.rs index ea2953dfd..218de0a36 100644 --- a/src/uu/hashsum/src/digest.rs +++ b/src/uu/hashsum/src/digest.rs @@ -1,3 +1,4 @@ +extern crate blake2_rfc; extern crate digest; extern crate md5; extern crate sha1; @@ -48,6 +49,29 @@ impl Digest for md5::Context { } } +impl Digest for blake2_rfc::blake2b::Blake2b { + fn new() -> Self { + blake2_rfc::blake2b::Blake2b::new(64) + } + + fn input(&mut self, input: &[u8]) { + self.update(input); + } + + fn result(&mut self, out: &mut [u8]) { + let hash_result = &self.clone().finalize(); + out.copy_from_slice(&hash_result.as_bytes()); + } + + fn reset(&mut self) { + *self = blake2_rfc::blake2b::Blake2b::new(64); + } + + fn output_bits(&self) -> usize { + 512 + } +} + impl Digest for sha1::Sha1 { fn new() -> Self { sha1::Sha1::new() diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index e1bc2e9d9..ca31514bc 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -11,6 +11,7 @@ #[macro_use] extern crate clap; +extern crate blake2_rfc; extern crate hex; extern crate md5; extern crate regex; @@ -26,6 +27,7 @@ mod digest; use self::digest::Digest; +use blake2_rfc::blake2b::Blake2b; use clap::{App, Arg, ArgMatches}; use hex::ToHex; use md5::Context as Md5; @@ -62,7 +64,7 @@ fn is_custom_binary(program: &str) -> bool { match program { "md5sum" | "sha1sum" | "sha224sum" | "sha256sum" | "sha384sum" | "sha512sum" | "sha3sum" | "sha3-224sum" | "sha3-256sum" | "sha3-384sum" | "sha3-512sum" - | "shake128sum" | "shake256sum" => true, + | "shake128sum" | "shake256sum" | "b2sum" => true, _ => false, } } @@ -82,6 +84,7 @@ fn detect_algo<'a>( "sha256sum" => ("SHA256", Box::new(Sha256::new()) as Box, 256), "sha384sum" => ("SHA384", Box::new(Sha384::new()) as Box, 384), "sha512sum" => ("SHA512", Box::new(Sha512::new()) as Box, 512), + "b2sum" => ("BLAKE2", Box::new(Blake2b::new(64)) as Box, 512), "sha3sum" => match matches.value_of("bits") { Some(bits_str) => match usize::from_str_radix(&bits_str, 10) { Ok(224) => ( @@ -182,6 +185,9 @@ fn detect_algo<'a>( if matches.is_present("sha512") { set_or_crash("SHA512", Box::new(Sha512::new()), 512) } + if matches.is_present("b2sum") { + set_or_crash("BLAKE2", Box::new(Blake2b::new(64)), 512) + } if matches.is_present("sha3") { match matches.value_of("bits") { Some(bits_str) => match usize::from_str_radix(&bits_str, 10) { @@ -383,6 +389,7 @@ pub fn uumain(mut args: impl uucore::Args) -> i32 { "shake256", "work with SHAKE256 using BITS for the output size", ), + ("b2sum", "work with BLAKE2"), ]; for (name, desc) in algos { diff --git a/tests/by-util/test_hashsum.rs b/tests/by-util/test_hashsum.rs index af4021af4..6e7d59107 100644 --- a/tests/by-util/test_hashsum.rs +++ b/tests/by-util/test_hashsum.rs @@ -43,4 +43,5 @@ test_digest! { sha3_512 sha3 512 shake128_256 shake128 256 shake256_512 shake256 512 + b2sum b2sum 512 } diff --git a/tests/fixtures/hashsum/b2sum.expected b/tests/fixtures/hashsum/b2sum.expected new file mode 100644 index 000000000..a0dae0db4 --- /dev/null +++ b/tests/fixtures/hashsum/b2sum.expected @@ -0,0 +1 @@ +7355dd5276c21cfe0c593b5063b96af3f96a454b33216f58314f44c3ade92e9cd6cec4210a0836246780e9baf927cc50b9a3d7073e8f9bd12780fddbcb930c6d \ No newline at end of file From 516839e081733fd5a66c00230ed7caaac0d20895 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 10 Dec 2020 22:28:17 +0100 Subject: [PATCH 228/606] refactor(mv): move to clap (#1652) --- Cargo.lock | 8 +- src/uu/mv/Cargo.toml | 2 +- src/uu/mv/src/mv.rs | 267 +++++++++++++++++++++------------------ tests/by-util/test_mv.rs | 75 ++++++++++- 4 files changed, 221 insertions(+), 131 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9135d08a8..7cc628900 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,7 +204,7 @@ dependencies = [ [[package]] name = "const_fn" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -471,7 +471,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "const_fn 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1825,8 +1825,8 @@ dependencies = [ name = "uu_mv" version = "0.0.1" dependencies = [ + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", "uucore_procs 0.0.4", ] @@ -2529,7 +2529,7 @@ dependencies = [ "checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" "checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab" +"checksum const_fn 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd51eab21ab4fd6a3bf889e2d0958c0a6e3a61ad04260325e919e652a2a62826" "checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" "checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" "checksum cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d1cd8699ffa1b18fd388183f7762e0545eddbd5c6ec95e9e3b42a4a71a507ff" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index 442b859eb..4773fde78 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/mv.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" fs_extra = "1.1.0" uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index d0d98dafa..3f8fddb02 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -8,12 +8,13 @@ // spell-checker:ignore (ToDO) sourcepath targetpath +extern crate clap; extern crate fs_extra; -extern crate getopts; #[macro_use] extern crate uucore; +use clap::{App, Arg, ArgMatches}; use std::env; use std::fs; use std::io::{self, stdin}; @@ -25,9 +26,6 @@ use std::path::{Path, PathBuf}; use fs_extra::dir::{move_dir, CopyOptions as DirCopyOptions}; -static NAME: &str = "mv"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); - pub struct Behavior { overwrite: OverwriteMode, backup: BackupMode, @@ -53,54 +51,128 @@ pub enum BackupMode { ExistingBackup, } +static ABOUT: &str = "Move SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY."; +static VERSION: &str = env!("CARGO_PKG_VERSION"); + +static OPT_BACKUP: &str = "backup"; +static OPT_BACKUP_NO_ARG: &str = "b"; +static OPT_FORCE: &str = "force"; +static OPT_INTERACTIVE: &str = "interactive"; +static OPT_NO_CLOBBER: &str = "no-clobber"; +static OPT_STRIP_TRAILING_SLASHES: &str = "strip-trailing-slashes"; +static OPT_SUFFIX: &str = "suffix"; +static OPT_TARGET_DIRECTORY: &str = "target-directory"; +static OPT_NO_TARGET_DIRECTORY: &str = "no-target-directory"; +static OPT_UPDATE: &str = "update"; +static OPT_VERBOSE: &str = "verbose"; + +static ARG_FILES: &str = "files"; + +fn get_usage() -> String { + format!( + "{0} [OPTION]... [-T] SOURCE DEST +{0} [OPTION]... SOURCE... DIRECTORY +{0} [OPTION]... -t DIRECTORY SOURCE...", + executable!() + ) +} + pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_BACKUP) + .long(OPT_BACKUP) + .help("make a backup of each existing destination file") + .takes_value(true) + .possible_value("simple") + .possible_value("never") + .possible_value("numbered") + .possible_value("t") + .possible_value("existing") + .possible_value("nil") + .possible_value("none") + .possible_value("off") + .value_name("CONTROL") + ) + .arg( + Arg::with_name(OPT_BACKUP_NO_ARG) + .short(OPT_BACKUP_NO_ARG) + .help("like --backup but does not accept an argument") + ) + .arg( + Arg::with_name(OPT_FORCE) + .short("f") + .long(OPT_FORCE) + .help("do not prompt before overwriting") + ) + .arg( + Arg::with_name(OPT_INTERACTIVE) + .short("i") + .long(OPT_INTERACTIVE) + .help("prompt before override") + ) + .arg( + Arg::with_name(OPT_NO_CLOBBER).short("n") + .long(OPT_NO_CLOBBER) + .help("do not overwrite an existing file") + ) + .arg( + Arg::with_name(OPT_STRIP_TRAILING_SLASHES) + .long(OPT_STRIP_TRAILING_SLASHES) + .help("remove any trailing slashes from each SOURCE argument") + ) + .arg( + Arg::with_name(OPT_SUFFIX) + .short("S") + .long(OPT_SUFFIX) + .help("override the usual backup suffix") + .takes_value(true) + .value_name("SUFFIX") + ) + .arg( + Arg::with_name(OPT_TARGET_DIRECTORY) + .short("t") + .long(OPT_TARGET_DIRECTORY) + .help("move all SOURCE arguments into DIRECTORY") + .takes_value(true) + .value_name("DIRECTORY") + .conflicts_with(OPT_NO_TARGET_DIRECTORY) + ) + .arg( + Arg::with_name(OPT_NO_TARGET_DIRECTORY) + .short("T") + .long(OPT_NO_TARGET_DIRECTORY). + help("treat DEST as a normal file") + ) + .arg( + Arg::with_name(OPT_UPDATE) + .short("u") + .long(OPT_UPDATE) + .help("move only when the SOURCE file is newer than the destination file or when the destination file is missing") + ) + .arg( + Arg::with_name(OPT_VERBOSE) + .short("v") + .long(OPT_VERBOSE).help("explain what is being done") + ) + .arg( + Arg::with_name(ARG_FILES) + .multiple(true) + .takes_value(true) + .min_values(2) + .required(true) + ) + .get_matches_from(args); - opts.optflagopt( - "", - "backup", - "make a backup of each existing destination file", - "CONTROL", - ); - opts.optflag("b", "", "like --backup but does not accept an argument"); - opts.optflag("f", "force", "do not prompt before overwriting"); - opts.optflag("i", "interactive", "prompt before override"); - opts.optflag("n", "no-clobber", "do not overwrite an existing file"); - opts.optflag( - "", - "strip-trailing-slashes", - "remove any trailing slashes from each SOURCE\n \ - argument", - ); - opts.optopt("S", "suffix", "override the usual backup suffix", "SUFFIX"); - opts.optopt( - "t", - "target-directory", - "move all SOURCE arguments into DIRECTORY", - "DIRECTORY", - ); - opts.optflag("T", "no-target-directory", "treat DEST as a normal file"); - opts.optflag( - "u", - "update", - "move only when the SOURCE file is newer\n \ - than the destination file or when the\n \ - destination file is missing", - ); - opts.optflag("v", "verbose", "explain what is being done"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("Invalid options\n{}", f); - return 1; - } - }; - let usage = opts.usage("Move SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY."); + let files: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); let overwrite_mode = determine_overwrite_mode(&matches); let backup_mode = determine_backup_mode(&matches); @@ -109,26 +181,21 @@ pub fn uumain(args: impl uucore::Args) -> i32 { show_error!( "options --backup and --no-clobber are mutually exclusive\n\ Try '{} --help' for more information.", - NAME + executable!() ); return 1; } let backup_suffix = determine_backup_suffix(backup_mode, &matches); - if matches.opt_present("T") && matches.opt_present("t") { - show_error!("cannot combine --target-directory (-t) and --no-target-directory (-T)"); - return 1; - } - let behavior = Behavior { overwrite: overwrite_mode, backup: backup_mode, suffix: backup_suffix, - update: matches.opt_present("u"), - target_dir: matches.opt_str("t"), - no_target_dir: matches.opt_present("T"), - verbose: matches.opt_present("v"), + update: matches.is_present(OPT_UPDATE), + target_dir: matches.value_of(OPT_TARGET_DIRECTORY).map(String::from), + no_target_dir: matches.is_present(OPT_NO_TARGET_DIRECTORY), + verbose: matches.is_present(OPT_VERBOSE), }; let paths: Vec = { @@ -136,60 +203,45 @@ pub fn uumain(args: impl uucore::Args) -> i32 { p.components().as_path() } let to_owned = |p: &Path| p.to_owned(); - let arguments = matches.free.iter().map(Path::new); - if matches.opt_present("strip-trailing-slashes") { - arguments.map(strip_slashes).map(to_owned).collect() + let paths = files.iter().map(Path::new); + + if matches.is_present(OPT_STRIP_TRAILING_SLASHES) { + paths.map(strip_slashes).map(to_owned).collect() } else { - arguments.map(to_owned).collect() + paths.map(to_owned).collect() } }; - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - 0 - } else if matches.opt_present("help") { - help(&usage); - 0 - } else { - exec(&paths[..], behavior) - } + exec(&paths[..], behavior) } -fn determine_overwrite_mode(matches: &getopts::Matches) -> OverwriteMode { +fn determine_overwrite_mode(matches: &ArgMatches) -> OverwriteMode { // This does not exactly match the GNU implementation: // The GNU mv defaults to Force, but if more than one of the // overwrite options are supplied, only the last takes effect. // To default to no-clobber in that situation seems safer: // - if matches.opt_present("no-clobber") { + if matches.is_present(OPT_NO_CLOBBER) { OverwriteMode::NoClobber - } else if matches.opt_present("interactive") { + } else if matches.is_present(OPT_INTERACTIVE) { OverwriteMode::Interactive } else { OverwriteMode::Force } } -fn determine_backup_mode(matches: &getopts::Matches) -> BackupMode { - if matches.opt_present("b") { +fn determine_backup_mode(matches: &ArgMatches) -> BackupMode { + if matches.is_present(OPT_BACKUP_NO_ARG) { BackupMode::SimpleBackup - } else if matches.opt_present("backup") { - match matches.opt_str("backup") { + } else if matches.is_present(OPT_BACKUP) { + match matches.value_of(OPT_BACKUP).map(String::from) { None => BackupMode::SimpleBackup, Some(mode) => match &mode[..] { "simple" | "never" => BackupMode::SimpleBackup, "numbered" | "t" => BackupMode::NumberedBackup, "existing" | "nil" => BackupMode::ExistingBackup, "none" | "off" => BackupMode::NoBackup, - x => { - crash!( - 1, - "invalid argument ‘{}’ for ‘backup type’\n\ - Try '{} --help' for more information.", - x, - NAME - ); - } + _ => panic!(), // cannot happen as it is managed by clap }, } } else { @@ -197,19 +249,9 @@ fn determine_backup_mode(matches: &getopts::Matches) -> BackupMode { } } -fn determine_backup_suffix(backup_mode: BackupMode, matches: &getopts::Matches) -> String { - if matches.opt_present("suffix") { - match matches.opt_str("suffix") { - Some(x) => x, - None => { - crash!( - 1, - "option '--suffix' requires an argument\n\ - Try '{} --help' for more information.", - NAME - ); - } - } +fn determine_backup_suffix(backup_mode: BackupMode, matches: &ArgMatches) -> String { + if matches.is_present(OPT_SUFFIX) { + matches.value_of(OPT_SUFFIX).map(String::from).unwrap() } else if let (Ok(s), BackupMode::SimpleBackup) = (env::var("SIMPLE_BACKUP_SUFFIX"), backup_mode) { @@ -219,29 +261,12 @@ fn determine_backup_suffix(backup_mode: BackupMode, matches: &getopts::Matches) } } -fn help(usage: &str) { - println!( - "{0} {1}\n\n\ - Usage: {0} SOURCE DEST\n \ - or: {0} SOURCE... DIRECTORY\n\n\ - {2}", - NAME, VERSION, usage - ); -} - fn exec(files: &[PathBuf], b: Behavior) -> i32 { if let Some(ref name) = b.target_dir { return move_files_into_dir(files, &PathBuf::from(name), &b); } match files.len() { - 0 | 1 => { - show_error!( - "missing file operand\n\ - Try '{} --help' for more information.", - NAME - ); - return 1; - } + /* case 0/1 are not possible thanks to clap */ 2 => { let source = &files[0]; let target = &files[1]; @@ -302,7 +327,7 @@ fn exec(files: &[PathBuf], b: Behavior) -> i32 { "mv: extra operand ‘{}’\n\ Try '{} --help' for more information.", files[2].display(), - NAME + executable!() ); return 1; } @@ -358,7 +383,7 @@ fn rename(from: &PathBuf, to: &PathBuf, b: &Behavior) -> io::Result<()> { match b.overwrite { OverwriteMode::NoClobber => return Ok(()), OverwriteMode::Interactive => { - print!("{}: overwrite ‘{}’? ", NAME, to.display()); + print!("{}: overwrite ‘{}’? ", executable!(), to.display()); if !read_yes() { return Ok(()); } diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index 3fde65f99..0caeb1ef1 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -17,6 +17,16 @@ fn test_mv_rename_dir() { assert!(at.dir_exists(dir2)); } +#[test] +fn test_mv_fail() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir1 = "test_mv_rename_dir"; + + at.mkdir(dir1); + + ucmd.arg(dir1).fails(); +} + #[test] fn test_mv_rename_file() { let (at, mut ucmd) = at_and_ucmd!(); @@ -301,6 +311,63 @@ fn test_mv_backup_numbering() { assert!(at.file_exists(&format!("{}.~1~", file_b))); } +#[test] +fn test_mv_backup_existing() { + let (at, mut ucmd) = at_and_ucmd!(); + let file_a = "test_mv_backup_numbering_file_a"; + let file_b = "test_mv_backup_numbering_file_b"; + + at.touch(file_a); + at.touch(file_b); + ucmd.arg("--backup=existing") + .arg(file_a) + .arg(file_b) + .succeeds() + .no_stderr(); + + assert!(!at.file_exists(file_a)); + assert!(at.file_exists(file_b)); + assert!(at.file_exists(&format!("{}~", file_b))); +} + +#[test] +fn test_mv_backup_simple() { + let (at, mut ucmd) = at_and_ucmd!(); + let file_a = "test_mv_backup_numbering_file_a"; + let file_b = "test_mv_backup_numbering_file_b"; + + at.touch(file_a); + at.touch(file_b); + ucmd.arg("--backup=simple") + .arg(file_a) + .arg(file_b) + .succeeds() + .no_stderr(); + + assert!(!at.file_exists(file_a)); + assert!(at.file_exists(file_b)); + assert!(at.file_exists(&format!("{}~", file_b))); +} + +#[test] +fn test_mv_backup_none() { + let (at, mut ucmd) = at_and_ucmd!(); + let file_a = "test_mv_backup_numbering_file_a"; + let file_b = "test_mv_backup_numbering_file_b"; + + at.touch(file_a); + at.touch(file_b); + ucmd.arg("--backup=none") + .arg(file_a) + .arg(file_b) + .succeeds() + .no_stderr(); + + assert!(!at.file_exists(file_a)); + assert!(at.file_exists(file_b)); + assert!(!at.file_exists(&format!("{}~", file_b))); +} + #[test] fn test_mv_existing_backup() { let (at, mut ucmd) = at_and_ucmd!(); @@ -459,17 +526,15 @@ fn test_mv_errors() { // $ mv -T -t a b // mv: cannot combine --target-directory (-t) and --no-target-directory (-T) - scene + let result = scene .ucmd() .arg("-T") .arg("-t") .arg(dir) .arg(file_a) .arg(file_b) - .fails() - .stderr_is( - "mv: error: cannot combine --target-directory (-t) and --no-target-directory (-T)\n", - ); + .fails(); + assert!(result.stderr.contains("cannot be used with")); // $ at.touch file && at.mkdir dir // $ mv -T file dir From 068fee2ebdeea0958a5ab515b7c32406bdb92529 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 11 Dec 2020 22:46:36 +0100 Subject: [PATCH 229/606] feature(uname): Implement -p & -i (#1649) Just return 'unknown' for both Closes: #1636 --- src/uu/uname/src/uname.rs | 44 +++++++++++++++++++++++++++---------- tests/by-util/test_uname.rs | 34 ++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 11 deletions(-) diff --git a/src/uu/uname/src/uname.rs b/src/uu/uname/src/uname.rs index 6b25292c5..3e386aed3 100644 --- a/src/uu/uname/src/uname.rs +++ b/src/uu/uname/src/uname.rs @@ -27,6 +27,8 @@ const OPT_NODENAME: &str = "nodename"; const OPT_KERNELVERSION: &str = "kernel-version"; const OPT_KERNELRELEASE: &str = "kernel-release"; const OPT_MACHINE: &str = "machine"; +const OPT_PROCESSOR: &str = "processor"; +const OPT_HWPLATFORM: &str = "hardware-platform"; //FIXME: unimplemented options //const OPT_PROCESSOR: &'static str = "processor"; @@ -76,20 +78,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .short("v") .long(OPT_KERNELVERSION) .help("print the operating system version.")) - - //FIXME: unimplemented options - // .arg(Arg::with_name(OPT_PROCESSOR) - // .short("p") - // .long(OPT_PROCESSOR) - // .help("print the processor type (non-portable)")) - // .arg(Arg::with_name(OPT_HWPLATFORM) - // .short("i") - // .long(OPT_HWPLATFORM) - // .help("print the hardware platform (non-portable)")) + .arg(Arg::with_name(OPT_HWPLATFORM) + .short("i") + .long(OPT_HWPLATFORM) + .help("print the hardware platform (non-portable)")) .arg(Arg::with_name(OPT_MACHINE) .short("m") .long(OPT_MACHINE) .help("print the machine hardware name.")) + .arg(Arg::with_name(OPT_PROCESSOR) + .short("p") + .long(OPT_PROCESSOR) + .help("print the processor type (non-portable)")) .arg(Arg::with_name(OPT_OS) .short("o") .long(OPT_OS) @@ -105,9 +105,19 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let kernelrelease = matches.is_present(OPT_KERNELRELEASE); let kernelversion = matches.is_present(OPT_KERNELVERSION); let machine = matches.is_present(OPT_MACHINE); + let processor = matches.is_present(OPT_PROCESSOR); + let hwplatform = matches.is_present(OPT_HWPLATFORM); let os = matches.is_present(OPT_OS); - let none = !(all || kernelname || nodename || kernelrelease || kernelversion || machine || os); + let none = !(all + || kernelname + || nodename + || kernelrelease + || kernelversion + || machine + || os + || processor + || hwplatform); if kernelname || all || none { output.push_str(&uname.sysname()); @@ -130,6 +140,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { output.push_str(&uname.machine()); output.push(' '); } + if processor || all { + // According to https://stackoverflow.com/posts/394271/revisions + // Most of the time, it returns unknown + output.push_str("unknown"); + output.push(' '); + } + if hwplatform || all { + // According to https://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00063.html + // Most of the time, it returns unknown + output.push_str("unknown"); + output.push(' '); + } if os || all { output.push_str(HOST_OS); output.push(' '); diff --git a/tests/by-util/test_uname.rs b/tests/by-util/test_uname.rs index c0f5632dc..f0e32b430 100644 --- a/tests/by-util/test_uname.rs +++ b/tests/by-util/test_uname.rs @@ -16,6 +16,40 @@ fn test_uname_name() { assert!(result.success); } +#[test] +fn test_uname_processor() { + let (_, mut ucmd) = at_and_ucmd!(); + + let result = ucmd.arg("-p").run(); + assert!(result.success); + assert_eq!(result.stdout.trim_end(), "unknown"); +} + +#[test] +fn test_uname_hwplatform() { + let (_, mut ucmd) = at_and_ucmd!(); + + let result = ucmd.arg("-i").run(); + assert!(result.success); + assert_eq!(result.stdout.trim_end(), "unknown"); +} + +#[test] +fn test_uname_machine() { + let (_, mut ucmd) = at_and_ucmd!(); + + let result = ucmd.arg("-m").run(); + assert!(result.success); +} + +#[test] +fn test_uname_kernel_version() { + let (_, mut ucmd) = at_and_ucmd!(); + + let result = ucmd.arg("-v").run(); + assert!(result.success); +} + #[test] fn test_uname_kernel() { let (_, mut ucmd) = at_and_ucmd!(); From 49b32ea68d0312eed67ab4840a2312d104390f31 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 12 Dec 2020 00:14:00 +0100 Subject: [PATCH 230/606] refactor(chown): move to clap & add tests (#1648) --- Cargo.lock | 1 + src/uu/chown/Cargo.toml | 1 + src/uu/chown/src/chown.rs | 241 +++++++++++++++++--------- tests/by-util/test_chown.rs | 333 ++++++++++++++++++++++++++++++++++++ 4 files changed, 495 insertions(+), 81 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7cc628900..2e24be40e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1442,6 +1442,7 @@ dependencies = [ name = "uu_chown" version = "0.0.1" dependencies = [ + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", "uucore_procs 0.0.4", diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index ebc494761..59a957cf8 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/chown.rs" [dependencies] +clap = "2.33" glob = "0.3.0" uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index 09801769a..3c8a9f0c1 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -13,6 +13,9 @@ pub use uucore::entries::{self, Group, Locate, Passwd}; use uucore::fs::resolve_relative_path; use uucore::libc::{self, gid_t, lchown, uid_t}; +extern crate clap; +use clap::{App, Arg}; + extern crate walkdir; use walkdir::WalkDir; @@ -28,77 +31,165 @@ use std::path::Path; use std::ffi::CString; use std::os::unix::ffi::OsStrExt; -static SYNTAX: &str = - "[OPTION]... [OWNER][:[GROUP]] FILE...\n chown [OPTION]... --reference=RFILE FILE..."; -static SUMMARY: &str = "change file owner and group"; +static ABOUT: &str = "change file owner and group"; +static VERSION: &str = env!("CARGO_PKG_VERSION"); + +static OPT_CHANGES: &str = "changes"; +static OPT_DEREFERENCE: &str = "dereference"; +static OPT_NO_DEREFERENCE: &str = "no-dereference"; +static OPT_FROM: &str = "from"; +static OPT_PRESERVE_ROOT: &str = "preserve-root"; +static OPT_NO_PRESERVE_ROOT: &str = "no-preserve-root"; +static OPT_QUIET: &str = "quiet"; +static OPT_RECURSIVE: &str = "recursive"; +static OPT_REFERENCE: &str = "reference"; +static OPT_SILENT: &str = "silent"; +static OPT_TRAVERSE: &str = "H"; +static OPT_NO_TRAVERSE: &str = "P"; +static OPT_TRAVERSE_EVERY: &str = "L"; +static OPT_VERBOSE: &str = "verbose"; + +static ARG_OWNER: &str = "owner"; +static ARG_FILES: &str = "files"; const FTS_COMFOLLOW: u8 = 1; const FTS_PHYSICAL: u8 = 1 << 1; const FTS_LOGICAL: u8 = 1 << 2; +fn get_usage() -> String { + format!( + "{0} [OPTION]... [OWNER][:[GROUP]] FILE...\n{0} [OPTION]... --reference=RFILE FILE...", + executable!() + ) +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = app!(SYNTAX, SUMMARY, ""); - opts.optflag("c", - "changes", - "like verbose but report only when a change is made") - .optflag("f", "silent", "") - .optflag("", "quiet", "suppress most error messages") - .optflag("v", - "verbose", - "output a diagnostic for every file processed") - .optflag("", "dereference", "affect the referent of each symbolic link (this is the default), rather than the symbolic link itself") - .optflag("h", "no-dereference", "affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)") + let usage = get_usage(); - .optopt("", "from", "change the owner and/or group of each file only if its current owner and/or group match those specified here. Either may be omitted, in which case a match is not required for the omitted attribute", "CURRENT_OWNER:CURRENT_GROUP") - .optopt("", - "reference", - "use RFILE's owner and group rather than specifying OWNER:GROUP values", - "RFILE") - .optflag("", - "no-preserve-root", - "do not treat '/' specially (the default)") - .optflag("", "preserve-root", "fail to operate recursively on '/'") + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_CHANGES) + .short("c") + .long(OPT_CHANGES) + .help("like verbose but report only when a change is made"), + ) + .arg(Arg::with_name(OPT_DEREFERENCE).long(OPT_DEREFERENCE).help( + "affect the referent of each symbolic link (this is the default), rather than the symbolic link itself", + )) + .arg( + Arg::with_name(OPT_NO_DEREFERENCE) + .short("h") + .long(OPT_NO_DEREFERENCE) + .help( + "affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)", + ), + ) + .arg( + Arg::with_name(OPT_FROM) + .long(OPT_FROM) + .help( + "change the owner and/or group of each file only if its current owner and/or group match those specified here. Either may be omitted, in which case a match is not required for the omitted attribute", + ) + .value_name("CURRENT_OWNER:CURRENT_GROUP"), + ) + .arg( + Arg::with_name(OPT_PRESERVE_ROOT) + .long(OPT_PRESERVE_ROOT) + .help("fail to operate recursively on '/'"), + ) + .arg( + Arg::with_name(OPT_NO_PRESERVE_ROOT) + .long(OPT_NO_PRESERVE_ROOT) + .help("do not treat '/' specially (the default)"), + ) + .arg( + Arg::with_name(OPT_QUIET) + .long(OPT_QUIET) + .help("suppress most error messages"), + ) + .arg( + Arg::with_name(OPT_RECURSIVE) + .short("R") + .long(OPT_RECURSIVE) + .help("operate on files and directories recursively"), + ) + .arg( + Arg::with_name(OPT_REFERENCE) + .long(OPT_REFERENCE) + .help("use RFILE's owner and group rather than specifying OWNER:GROUP values") + .value_name("RFILE") + .min_values(1), + ) + .arg(Arg::with_name(OPT_SILENT).short("f").long(OPT_SILENT)) + .arg( + Arg::with_name(OPT_TRAVERSE) + .short(OPT_TRAVERSE) + .help("if a command line argument is a symbolic link to a directory, traverse it") + .overrides_with_all(&[OPT_TRAVERSE_EVERY, OPT_NO_TRAVERSE]), + ) + .arg( + Arg::with_name(OPT_TRAVERSE_EVERY) + .short(OPT_TRAVERSE_EVERY) + .help("traverse every symbolic link to a directory encountered") + .overrides_with_all(&[OPT_TRAVERSE, OPT_NO_TRAVERSE]), + ) + .arg( + Arg::with_name(OPT_NO_TRAVERSE) + .short(OPT_NO_TRAVERSE) + .help("do not traverse any symbolic links (default)") + .overrides_with_all(&[OPT_TRAVERSE, OPT_TRAVERSE_EVERY]), + ) + .arg( + Arg::with_name(OPT_VERBOSE) + .long(OPT_VERBOSE) + .help("output a diagnostic for every file processed"), + ) + .arg( + Arg::with_name(ARG_OWNER) + .multiple(false) + .takes_value(true) + .required(true), + ) + .arg( + Arg::with_name(ARG_FILES) + .multiple(true) + .takes_value(true) + .required(true) + .min_values(1), + ) + .get_matches_from(args); - .optflag("R", - "recursive", - "operate on files and directories recursively") - .optflag("H", - "", - "if a command line argument is a symbolic link to a directory, traverse it") - .optflag("L", - "", - "traverse every symbolic link to a directory encountered") - .optflag("P", "", "do not traverse any symbolic links (default)"); + /* First arg is the owner/group */ + let owner = matches.value_of(ARG_OWNER).unwrap(); - let mut bit_flag = FTS_PHYSICAL; - let mut preserve_root = false; - let mut derefer = -1; - let flags: &[char] = &['H', 'L', 'P']; - for opt in &args { - match opt.as_str() { - // If more than one is specified, only the final one takes effect. - s if s.contains(flags) => { - if let Some(idx) = s.rfind(flags) { - match s.chars().nth(idx).unwrap() { - 'H' => bit_flag = FTS_COMFOLLOW | FTS_PHYSICAL, - 'L' => bit_flag = FTS_LOGICAL, - 'P' => bit_flag = FTS_PHYSICAL, - _ => (), - } - } - } - "--no-preserve-root" => preserve_root = false, - "--preserve-root" => preserve_root = true, - "--dereference" => derefer = 1, - "--no-dereference" => derefer = 0, - _ => (), - } - } + /* Then the list of files */ + let files: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); - let matches = opts.parse(args); - let recursive = matches.opt_present("recursive"); + let preserve_root = matches.is_present(OPT_PRESERVE_ROOT); + + let mut derefer = if matches.is_present(OPT_NO_DEREFERENCE) { + 1 + } else { + 0 + }; + + let mut bit_flag = if matches.is_present(OPT_TRAVERSE) { + FTS_COMFOLLOW | FTS_PHYSICAL + } else if matches.is_present(OPT_TRAVERSE_EVERY) { + FTS_LOGICAL + } else { + FTS_PHYSICAL + }; + + let recursive = matches.is_present(OPT_RECURSIVE); if recursive { if bit_flag == FTS_PHYSICAL { if derefer == 1 { @@ -111,17 +202,17 @@ pub fn uumain(args: impl uucore::Args) -> i32 { bit_flag = FTS_PHYSICAL; } - let verbosity = if matches.opt_present("changes") { + let verbosity = if matches.is_present(OPT_CHANGES) { Verbosity::Changes - } else if matches.opt_present("silent") || matches.opt_present("quiet") { + } else if matches.is_present(OPT_SILENT) || matches.is_present(OPT_QUIET) { Verbosity::Silent - } else if matches.opt_present("verbose") { + } else if matches.is_present(OPT_VERBOSE) { Verbosity::Verbose } else { Verbosity::Normal }; - let filter = if let Some(spec) = matches.opt_str("from") { + let filter = if let Some(spec) = matches.value_of(OPT_FROM) { match parse_spec(&spec) { Ok((Some(uid), None)) => IfFrom::User(uid), Ok((None, Some(gid))) => IfFrom::Group(gid), @@ -136,18 +227,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { IfFrom::All }; - if matches.free.is_empty() { - show_usage_error!("missing operand"); - return 1; - } else if matches.free.len() < 2 && !matches.opt_present("reference") { - show_usage_error!("missing operand after ‘{}’", matches.free[0]); - return 1; - } - - let mut files; let dest_uid: Option; let dest_gid: Option; - if let Some(file) = matches.opt_str("reference") { + if let Some(file) = matches.value_of(OPT_REFERENCE) { match fs::metadata(&file) { Ok(meta) => { dest_gid = Some(meta.gid()); @@ -158,9 +240,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 1; } } - files = matches.free; } else { - match parse_spec(&matches.free[0]) { + match parse_spec(&owner) { Ok((u, g)) => { dest_uid = u; dest_gid = g; @@ -170,8 +251,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 1; } } - files = matches.free; - files.remove(0); } let executor = Chowner { bit_flag, @@ -197,7 +276,7 @@ fn parse_spec(spec: &str) -> Result<(Option, Option), String> { Ok(( Some(match Passwd::locate(args[0]) { Ok(v) => v.uid(), - _ => return Err(format!("invalid user: ‘{}’", spec)), + _ => return Err(format!("invalid user: '{}'", spec)), }), None, )) @@ -206,18 +285,18 @@ fn parse_spec(spec: &str) -> Result<(Option, Option), String> { None, Some(match Group::locate(args[1]) { Ok(v) => v.gid(), - _ => return Err(format!("invalid group: ‘{}’", spec)), + _ => return Err(format!("invalid group: '{}'", spec)), }), )) } else if usr_grp { Ok(( Some(match Passwd::locate(args[0]) { Ok(v) => v.uid(), - _ => return Err(format!("invalid user: ‘{}’", spec)), + _ => return Err(format!("invalid user: '{}'", spec)), }), Some(match Group::locate(args[1]) { Ok(v) => v.gid(), - _ => return Err(format!("invalid group: ‘{}’", spec)), + _ => return Err(format!("invalid group: '{}'", spec)), }), )) } else { diff --git a/tests/by-util/test_chown.rs b/tests/by-util/test_chown.rs index fb487cc16..a943967f2 100644 --- a/tests/by-util/test_chown.rs +++ b/tests/by-util/test_chown.rs @@ -46,3 +46,336 @@ mod test_passgrp { fn test_invalid_option() { new_ucmd!().arg("-w").arg("-q").arg("/").fails(); } + +#[test] +fn test_chown_myself() { + // test chown username file.txt + let scene = TestScenario::new(util_name!()); + let result = scene.cmd("whoami").run(); + if is_ci() && result.stderr.contains("No such user/group") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return; + } + println!("results {}", result.stdout); + let username = result.stdout.trim_end(); + + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "test_install_target_dir_file_a1"; + + at.touch(file1); + let result = ucmd.arg(username).arg(file1).run(); + println!("results stdout {}", result.stdout); + println!("results stderr {}", result.stderr); + if is_ci() && result.stderr.contains("invalid user") { + // In the CI, some server are failing to return id. + // As seems to be a configuration issue, ignoring it + return; + } + assert!(result.success); +} + +#[test] +fn test_chown_myself_second() { + // test chown username: file.txt + let scene = TestScenario::new(util_name!()); + let result = scene.cmd("whoami").run(); + if is_ci() && result.stderr.contains("No such user/group") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return; + } + println!("results {}", result.stdout); + + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "test_install_target_dir_file_a1"; + + at.touch(file1); + let result = ucmd + .arg(result.stdout.trim_end().to_owned() + ":") + .arg(file1) + .run(); + + println!("result.stdout = {}", result.stdout); + println!("result.stderr = {}", result.stderr); + assert!(result.success); +} + +#[test] +fn test_chown_myself_group() { + // test chown username:group file.txt + let scene = TestScenario::new(util_name!()); + let result = scene.cmd("whoami").run(); + if is_ci() && result.stderr.contains("No such user/group") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return; + } + println!("user name = {}", result.stdout); + let username = result.stdout.trim_end(); + + let result = scene.cmd("id").arg("-gn").run(); + if is_ci() && result.stderr.contains("No such user/group") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return; + } + println!("group name = {}", result.stdout); + let group = result.stdout.trim_end(); + + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "test_install_target_dir_file_a1"; + let perm = username.to_owned() + ":" + group; + at.touch(file1); + let result = ucmd.arg(perm).arg(file1).run(); + println!("result.stdout = {}", result.stdout); + println!("result.stderr = {}", result.stderr); + if is_ci() && result.stderr.contains("chown: invalid group:") { + // With some Ubuntu into the CI, we can get this answer + return; + } + assert!(result.success); +} + +#[test] +fn test_chown_only_group() { + // test chown :group file.txt + let scene = TestScenario::new(util_name!()); + let result = scene.cmd("whoami").run(); + if is_ci() && result.stderr.contains("No such user/group") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return; + } + println!("results {}", result.stdout); + + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "test_install_target_dir_file_a1"; + let perm = ":".to_owned() + result.stdout.trim_end(); + at.touch(file1); + let result = ucmd.arg(perm).arg(file1).run(); + + println!("result.stdout = {}", result.stdout); + println!("result.stderr = {}", result.stderr); + + if is_ci() && result.stderr.contains("Operation not permitted") { + // With ubuntu with old Rust in the CI, we can get an error + return; + } + if is_ci() && result.stderr.contains("chown: invalid group:") { + // With mac into the CI, we can get this answer + return; + } + assert!(result.success); +} + +#[test] +fn test_chown_only_id() { + // test chown 1111 file.txt + let result = TestScenario::new("id").ucmd_keepenv().arg("-u").run(); + if is_ci() && result.stderr.contains("No such user/group") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return; + } + println!("result.stdout = {}", result.stdout); + println!("result.stderr = {}", result.stderr); + let id = String::from(result.stdout.trim()); + + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "test_install_target_dir_file_a1"; + + at.touch(file1); + let result = ucmd.arg(id).arg(file1).run(); + + println!("result.stdout = {}", result.stdout); + println!("result.stderr = {}", result.stderr); + if is_ci() && result.stderr.contains("chown: invalid user:") { + // With some Ubuntu into the CI, we can get this answer + return; + } + assert!(result.success); +} + +#[test] +fn test_chown_only_group_id() { + // test chown :1111 file.txt + let result = TestScenario::new("id").ucmd_keepenv().arg("-g").run(); + if is_ci() && result.stderr.contains("No such user/group") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return; + } + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); + let id = String::from(result.stdout.trim()); + + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "test_install_target_dir_file_a1"; + + at.touch(file1); + let perm = ":".to_owned() + &id; + + let result = ucmd.arg(perm).arg(file1).run(); + + println!("result.stdout = {}", result.stdout); + println!("result.stderr = {}", result.stderr); + if is_ci() && result.stderr.contains("chown: invalid group:") { + // With mac into the CI, we can get this answer + return; + } + assert!(result.success); +} + +#[test] +fn test_chown_both_id() { + // test chown 1111:1111 file.txt + let result = TestScenario::new("id").ucmd_keepenv().arg("-u").run(); + if is_ci() && result.stderr.contains("No such user/group") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return; + } + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); + let id_user = String::from(result.stdout.trim()); + + let result = TestScenario::new("id").ucmd_keepenv().arg("-g").run(); + if is_ci() && result.stderr.contains("No such user/group") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return; + } + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); + let id_group = String::from(result.stdout.trim()); + + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "test_install_target_dir_file_a1"; + + at.touch(file1); + let perm = id_user + &":".to_owned() + &id_group; + + let result = ucmd.arg(perm).arg(file1).run(); + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); + + if is_ci() && result.stderr.contains("invalid user") { + // In the CI, some server are failing to return id. + // As seems to be a configuration issue, ignoring it + return; + } + + assert!(result.success); +} + +#[test] +fn test_chown_both_mix() { + // test chown 1111:1111 file.txt + let result = TestScenario::new("id").ucmd_keepenv().arg("-u").run(); + if is_ci() && result.stderr.contains("No such user/group") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return; + } + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); + let id_user = String::from(result.stdout.trim()); + + let result = TestScenario::new("id").ucmd_keepenv().arg("-gn").run(); + if is_ci() && result.stderr.contains("No such user/group") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return; + } + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); + let group_name = String::from(result.stdout.trim()); + + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "test_install_target_dir_file_a1"; + + at.touch(file1); + let perm = id_user + &":".to_owned() + &group_name; + + let result = ucmd.arg(perm).arg(file1).run(); + + if is_ci() && result.stderr.contains("invalid user") { + // In the CI, some server are failing to return id. + // As seems to be a configuration issue, ignoring it + return; + } + assert!(result.success); +} + +#[test] +fn test_chown_recursive() { + let scene = TestScenario::new(util_name!()); + let result = scene.cmd("whoami").run(); + if is_ci() && result.stderr.contains("No such user/group") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return; + } + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); + let username = result.stdout.trim_end(); + + let (at, mut ucmd) = at_and_ucmd!(); + at.mkdir("a"); + at.mkdir("a/b"); + at.mkdir("a/b/c"); + at.mkdir("z"); + at.touch(&at.plus_as_string("a/a")); + at.touch(&at.plus_as_string("a/b/b")); + at.touch(&at.plus_as_string("a/b/c/c")); + at.touch(&at.plus_as_string("z/y")); + + let result = ucmd + .arg("-R") + .arg("--verbose") + .arg(username) + .arg("a") + .arg("z") + .run(); + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); + if is_ci() && result.stderr.contains("invalid user") { + // In the CI, some server are failing to return id. + // As seems to be a configuration issue, ignoring it + return; + } + assert!(result.stdout.contains("ownership of a/a retained as")); + assert!(result.success); +} + +#[test] +fn test_root_preserve() { + let scene = TestScenario::new(util_name!()); + let result = scene.cmd("whoami").run(); + if is_ci() && result.stderr.contains("No such user/group") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return; + } + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); + let username = result.stdout.trim_end(); + + let result = new_ucmd!() + .arg("--preserve-root") + .arg("-R") + .arg(username) + .arg("/") + .fails(); + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); + if is_ci() && result.stderr.contains("invalid user") { + // In the CI, some server are failing to return id. + // As seems to be a configuration issue, ignoring it + return; + } + assert!(result + .stderr + .contains("chown: it is dangerous to operate recursively")); +} From 576aa29f0f47b3456c8d72189c35b133cafa2708 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 12 Dec 2020 10:31:12 +0100 Subject: [PATCH 231/606] refactor(chmod): move from walker to walkdir, simplify the code and add tests (#1645) --- Cargo.lock | 9 +---- src/uu/chmod/Cargo.toml | 2 +- src/uu/chmod/src/chmod.rs | 77 +++++++++++++------------------------ tests/by-util/test_chmod.rs | 67 ++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2e24be40e..3ce4ad288 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -471,6 +471,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "const_fn 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1435,7 +1436,7 @@ dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", "uucore_procs 0.0.4", - "walker 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2381,11 +2382,6 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "walker" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -2664,7 +2660,6 @@ dependencies = [ "checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" -"checksum walker 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44971d5e5ae4f7904dffb6260ebd3910e7bcae104a94730e04a24cb6af40646b" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" "checksum wasm-bindgen 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" "checksum wasm-bindgen-backend 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index 3c257cd4d..3994fea92 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -18,7 +18,7 @@ path = "src/chmod.rs" libc = "0.2.42" uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs", "mode"] } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } -walker = "1.0.0" +walkdir = "2.2" [[bin]] name = "chmod" diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index ce3c3dd96..bcba604e9 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -9,7 +9,7 @@ #[cfg(unix)] extern crate libc; -extern crate walker; +extern crate walkdir; #[macro_use] extern crate uucore; @@ -20,7 +20,7 @@ use std::path::Path; use uucore::fs::display_permissions_unix; #[cfg(not(windows))] use uucore::mode; -use walker::Walker; +use walkdir::WalkDir; const NAME: &str = "chmod"; static SUMMARY: &str = "Change the mode of each FILE to MODE. @@ -150,62 +150,39 @@ impl Chmoder { for filename in &files { let filename = &filename[..]; let file = Path::new(filename); - if file.exists() { - if file.is_dir() { - if !self.preserve_root || filename != "/" { - if self.recursive { - let walk_dir = match Walker::new(&file) { - Ok(m) => m, - Err(f) => { - crash!(1, "{}", f.to_string()); - } - }; - // XXX: here (and elsewhere) we see that this impl will have issues - // with non-UTF-8 filenames. Using OsString won't fix this because - // on Windows OsStrings cannot be built out of non-UTF-8 chars. One - // possible fix is to use CStrings rather than Strings in the args - // to chmod() and chmod_file(). - r = self - .chmod( - walk_dir - .filter_map(|x| match x { - Ok(o) => match o.path().into_os_string().to_str() { - Some(s) => Some(s.to_owned()), - None => None, - }, - Err(_) => None, - }) - .collect(), - ) - .and(r); - r = self.chmod_file(&file, filename).and(r); - } - } else { - show_error!("could not change permissions of directory '{}'", filename); - r = Err(1); - } - } else { - r = self.chmod_file(&file, filename).and(r); - } - } else { + if !file.exists() { show_error!("no such file or directory '{}'", filename); - r = Err(1); + return Err(1); + } + if self.recursive && self.preserve_root && filename == "/" { + show_error!( + "it is dangerous to operate recursively on '{}'\nuse --no-preserve-root to override this failsafe", + filename + ); + return Err(1); + } + if !self.recursive { + r = self.chmod_file(&file).and(r); + } else { + for entry in WalkDir::new(&filename).into_iter().filter_map(|e| e.ok()) { + let file = entry.path(); + r = self.chmod_file(&file).and(r); + } } } - r } #[cfg(windows)] - fn chmod_file(&self, file: &Path, name: &str) -> Result<(), i32> { + fn chmod_file(&self, file: &Path) -> Result<(), i32> { // chmod is useless on Windows // it doesn't set any permissions at all // instead it just sets the readonly attribute on the file Err(0) } #[cfg(any(unix, target_os = "redox"))] - fn chmod_file(&self, file: &Path, name: &str) -> Result<(), i32> { - let mut fperm = match fs::metadata(name) { + fn chmod_file(&self, file: &Path) -> Result<(), i32> { + let mut fperm = match fs::metadata(file) { Ok(meta) => meta.mode() & 0o7777, Err(err) => { if !self.quiet { @@ -215,7 +192,7 @@ impl Chmoder { } }; match self.fmode { - Some(mode) => self.change_file(fperm, mode, file, name)?, + Some(mode) => self.change_file(fperm, mode, file)?, None => { let cmode_unwrapped = self.cmode.clone().unwrap(); for mode in cmode_unwrapped.split(',') { @@ -228,7 +205,7 @@ impl Chmoder { }; match result { Ok(mode) => { - self.change_file(fperm, mode, file, name)?; + self.change_file(fperm, mode, file)?; fperm = mode; } Err(f) => { @@ -246,7 +223,7 @@ impl Chmoder { } #[cfg(unix)] - fn change_file(&self, fperm: u32, mode: u32, file: &Path, path: &str) -> Result<(), i32> { + fn change_file(&self, fperm: u32, mode: u32, file: &Path) -> Result<(), i32> { if fperm == mode { if self.verbose && !self.changes { show_info!( @@ -257,9 +234,7 @@ impl Chmoder { ); } Ok(()) - } else if let Err(err) = - fs::set_permissions(Path::new(path), fs::Permissions::from_mode(mode)) - { + } else if let Err(err) = fs::set_permissions(file, fs::Permissions::from_mode(mode)) { if !self.quiet { show_error!("{}", err); } diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index 612f0860f..1b1a50e0c 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -279,3 +279,70 @@ fn test_chmod_reference_file() { mkfile(&at.plus_as_string(REFERENCE_FILE), REFERENCE_PERMS); run_single_test(&tests[0], at, ucmd); } + +#[test] +fn test_chmod_recursive() { + let _guard = UMASK_MUTEX.lock(); + + let original_umask = unsafe { umask(0) }; + let (at, mut ucmd) = at_and_ucmd!(); + at.mkdir("a"); + at.mkdir("a/b"); + at.mkdir("a/b/c"); + at.mkdir("z"); + mkfile(&at.plus_as_string("a/a"), 0o100444); + mkfile(&at.plus_as_string("a/b/b"), 0o100444); + mkfile(&at.plus_as_string("a/b/c/c"), 0o100444); + mkfile(&at.plus_as_string("z/y"), 0o100444); + + let result = ucmd + .arg("-R") + .arg("--verbose") + .arg("-r,a+w") + .arg("a") + .arg("z") + .succeeds(); + + assert_eq!(at.metadata("z/y").permissions().mode(), 0o100222); + assert_eq!(at.metadata("a/a").permissions().mode(), 0o100222); + assert_eq!(at.metadata("a/b/b").permissions().mode(), 0o100222); + assert_eq!(at.metadata("a/b/c/c").permissions().mode(), 0o100222); + println!("mode {:o}", at.metadata("a").permissions().mode()); + assert_eq!(at.metadata("a").permissions().mode(), 0o40333); + assert_eq!(at.metadata("z").permissions().mode(), 0o40333); + assert!(result.stderr.contains("to 333 (-wx-wx-wx)")); + assert!(result.stderr.contains("to 222 (-w--w--w-)")); + + unsafe { + umask(original_umask); + } +} + +#[test] +fn test_chmod_non_existing_file() { + let (_at, mut ucmd) = at_and_ucmd!(); + let result = ucmd + .arg("-R") + .arg("--verbose") + .arg("-r,a+w") + .arg("dont-exist") + .fails(); + assert_eq!( + result.stderr, + "chmod: error: no such file or directory 'dont-exist'\n" + ); +} + +#[test] +fn test_chmod_preserve_root() { + let (_at, mut ucmd) = at_and_ucmd!(); + let result = ucmd + .arg("-R") + .arg("--preserve-root") + .arg("755") + .arg("/") + .fails(); + assert!(result + .stderr + .contains("chmod: error: it is dangerous to operate recursively on '/'")); +} From d8e345df0a03e7f1dd6f507a51e8a3c827c89882 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 12 Dec 2020 11:04:39 +0100 Subject: [PATCH 232/606] refactor(whoami): only use advapi32/winapi on Windows (#1653) --- src/uu/whoami/Cargo.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index fc45321b2..38bfcfee9 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -15,10 +15,12 @@ edition = "2018" path = "src/whoami.rs" [dependencies] -advapi32-sys = "0.2.0" clap = "2.33" uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "wide"] } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } + +[target.'cfg(target_os = "windows")'.dependencies] +advapi32-sys = "0.2.0" winapi = { version = "0.3", features = ["lmcons"] } [[bin]] From e19010e9fe4708c83184e7256e1283f62521cc86 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 12 Dec 2020 13:10:38 +0100 Subject: [PATCH 233/606] cosmetic: consistency in the walkdir cargo declaration --- Cargo.lock | 1 - src/uu/chgrp/Cargo.toml | 2 +- src/uu/cp/Cargo.toml | 2 +- src/uu/rm/Cargo.toml | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3ce4ad288..955626985 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -471,7 +471,6 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "const_fn 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "const_fn 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index bd6194bf6..3a6d6b18d 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -17,7 +17,7 @@ path = "src/chgrp.rs" [dependencies] uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } -walkdir = "2.2.8" +walkdir = "2.2" [[bin]] name = "chgrp" diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index a060323d9..d387ccfec 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -25,7 +25,7 @@ libc = "0.2.42" quick-error = "1.2.3" uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } -walkdir = "2.2.8" +walkdir = "2.2" [target.'cfg(target_os = "linux")'.dependencies] ioctl-sys = "0.5.2" diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index 8e455eef0..d7fa97428 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -16,7 +16,7 @@ path = "src/rm.rs" [dependencies] clap = "2.33" -walkdir = "2.2.8" +walkdir = "2.2" remove_dir_all = "0.5.1" uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } From 431a4e9f2f1f532bdab5a5074ad16c3a411a8fbf Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 12 Dec 2020 13:12:13 +0100 Subject: [PATCH 234/606] cosmetic: consistency in the clap cargo declaration --- src/uu/hashsum/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index 1e1808f59..8530c1024 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -16,7 +16,7 @@ path = "src/hashsum.rs" [dependencies] digest = "0.6.2" -clap = "2" +clap = "2.33" hex = "0.2.0" libc = "0.2.42" md5 = "0.3.5" From 763de90fdaf0748c9a21ea2c44475c9fd88f2e9f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 15 Nov 2020 23:22:52 +0100 Subject: [PATCH 235/606] refactor(chgrp): move chgrp perms function into the uucore to reuse it into install Will move chown later --- src/uu/chgrp/Cargo.toml | 2 +- src/uu/chgrp/src/chgrp.rs | 90 +++----------------------- src/uucore/Cargo.toml | 1 + src/uucore/src/lib/features.rs | 4 ++ src/uucore/src/lib/features/perms.rs | 96 ++++++++++++++++++++++++++++ src/uucore/src/lib/lib.rs | 2 + 6 files changed, 114 insertions(+), 81 deletions(-) create mode 100644 src/uucore/src/lib/features/perms.rs diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index 3a6d6b18d..9f2e8c4a7 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/chgrp.rs" [dependencies] -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/chgrp/src/chgrp.rs b/src/uu/chgrp/src/chgrp.rs index e60efa0c6..9fc72ab20 100644 --- a/src/uu/chgrp/src/chgrp.rs +++ b/src/uu/chgrp/src/chgrp.rs @@ -11,23 +11,18 @@ extern crate uucore; pub use uucore::entries; use uucore::fs::resolve_relative_path; -use uucore::libc::{self, gid_t, lchown}; +use uucore::libc::gid_t; +use uucore::perms::{wrap_chgrp, Verbosity}; extern crate walkdir; use walkdir::WalkDir; -use std::io::Error as IOError; -use std::io::Result as IOResult; - use std::fs; use std::fs::Metadata; use std::os::unix::fs::MetadataExt; use std::path::Path; -use std::ffi::CString; -use std::os::unix::ffi::OsStrExt; - static SYNTAX: &str = "chgrp [OPTION]... GROUP FILE...\n or : chgrp [OPTION]... --reference=RFILE FILE..."; static SUMMARY: &str = "Change the group of each FILE to GROUP."; @@ -165,14 +160,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { executor.exec() } -#[derive(PartialEq, Debug)] -enum Verbosity { - Silent, - Changes, - Verbose, - Normal, -} - struct Chgrper { dest_gid: gid_t, bit_flag: u8, @@ -201,23 +188,6 @@ impl Chgrper { ret } - fn chgrp>(&self, path: P, dgid: gid_t, follow: bool) -> IOResult<()> { - let path = path.as_ref(); - let s = CString::new(path.as_os_str().as_bytes()).unwrap(); - let ret = unsafe { - if follow { - libc::chown(s.as_ptr(), (0 as gid_t).wrapping_sub(1), dgid) - } else { - lchown(s.as_ptr(), (0 as gid_t).wrapping_sub(1), dgid) - } - }; - if ret == 0 { - Ok(()) - } else { - Err(IOError::last_os_error()) - } - } - #[cfg(windows)] fn is_bind_root>(&self, root: P) -> bool { // TODO: is there an equivalent on Windows? @@ -269,7 +239,13 @@ impl Chgrper { } } - let ret = self.wrap_chgrp(path, &meta, follow_arg); + let ret = wrap_chgrp( + path, + &meta, + self.dest_gid, + follow_arg, + self.verbosity.clone(), + ); if !self.recursive { ret @@ -297,7 +273,7 @@ impl Chgrper { } }; - ret = self.wrap_chgrp(path, &meta, follow); + ret = wrap_chgrp(path, &meta, self.dest_gid, follow, self.verbosity.clone()); } ret } @@ -324,50 +300,4 @@ impl Chgrper { }; Some(meta) } - - fn wrap_chgrp>(&self, path: P, meta: &Metadata, follow: bool) -> i32 { - use self::Verbosity::*; - let mut ret = 0; - let dest_gid = self.dest_gid; - let path = path.as_ref(); - if let Err(e) = self.chgrp(path, dest_gid, follow) { - match self.verbosity { - Silent => (), - _ => { - show_info!("changing group of '{}': {}", path.display(), e); - if self.verbosity == Verbose { - println!( - "failed to change group of {} from {} to {}", - path.display(), - entries::gid2grp(meta.gid()).unwrap(), - entries::gid2grp(dest_gid).unwrap() - ); - }; - } - } - ret = 1; - } else { - let changed = dest_gid != meta.gid(); - if changed { - match self.verbosity { - Changes | Verbose => { - println!( - "changed group of {} from {} to {}", - path.display(), - entries::gid2grp(meta.gid()).unwrap(), - entries::gid2grp(dest_gid).unwrap() - ); - } - _ => (), - }; - } else if self.verbosity == Verbose { - println!( - "group of {} retained as {}", - path.display(), - entries::gid2grp(dest_gid).unwrap() - ); - } - } - ret - } } diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index db3b35004..94b7502d3 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -43,6 +43,7 @@ entries = ["libc"] fs = ["libc"] mode = ["libc"] parse_time = [] +perms = ["libc"] process = ["libc"] signals = [] utf8 = [] diff --git a/src/uucore/src/lib/features.rs b/src/uucore/src/lib/features.rs index d5927fc6f..c26225cb7 100644 --- a/src/uucore/src/lib/features.rs +++ b/src/uucore/src/lib/features.rs @@ -13,11 +13,15 @@ pub mod zero_copy; // ** non-windows #[cfg(all(not(windows), feature = "mode"))] pub mod mode; + // ** unix-only #[cfg(all(unix, feature = "entries"))] pub mod entries; +#[cfg(all(unix, feature = "perms"))] +pub mod perms; #[cfg(all(unix, feature = "process"))] pub mod process; + #[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))] pub mod signals; #[cfg(all( diff --git a/src/uucore/src/lib/features/perms.rs b/src/uucore/src/lib/features/perms.rs new file mode 100644 index 000000000..9eca7ea0e --- /dev/null +++ b/src/uucore/src/lib/features/perms.rs @@ -0,0 +1,96 @@ +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + +pub use crate::features::entries; +use libc::{self, gid_t, lchown}; + +#[macro_use] +pub use crate::*; + +use std::io::Error as IOError; +use std::io::Result as IOResult; + +use std::ffi::CString; +use std::fs::Metadata; +use std::os::unix::fs::MetadataExt; + +use std::os::unix::ffi::OsStrExt; +use std::path::Path; + +#[derive(PartialEq, Clone, Debug)] +pub enum Verbosity { + Silent, + Changes, + Verbose, + Normal, +} + +fn chgrp>(path: P, dgid: gid_t, follow: bool) -> IOResult<()> { + let path = path.as_ref(); + let s = CString::new(path.as_os_str().as_bytes()).unwrap(); + let ret = unsafe { + if follow { + libc::chown(s.as_ptr(), (0 as gid_t).wrapping_sub(1), dgid) + } else { + lchown(s.as_ptr(), (0 as gid_t).wrapping_sub(1), dgid) + } + }; + if ret == 0 { + Ok(()) + } else { + Err(IOError::last_os_error()) + } +} + +pub fn wrap_chgrp>( + path: P, + meta: &Metadata, + dest_gid: gid_t, + follow: bool, + verbosity: Verbosity, +) -> i32 { + use self::Verbosity::*; + let mut ret = 0; + let path = path.as_ref(); + if let Err(e) = chgrp(path, dest_gid, follow) { + match verbosity { + Silent => (), + _ => { + show_info!("changing group of '{}': {}", path.display(), e); + if verbosity == Verbose { + println!( + "failed to change group of {} from {} to {}", + path.display(), + entries::gid2grp(meta.gid()).unwrap(), + entries::gid2grp(dest_gid).unwrap() + ); + }; + } + } + ret = 1; + } else { + let changed = dest_gid != meta.gid(); + if changed { + match verbosity { + Changes | Verbose => { + println!( + "changed group of {} from {} to {}", + path.display(), + entries::gid2grp(meta.gid()).unwrap(), + entries::gid2grp(dest_gid).unwrap() + ); + } + _ => (), + }; + } else if verbosity == Verbose { + println!( + "group of {} retained as {}", + path.display(), + entries::gid2grp(dest_gid).unwrap() + ); + } + } + ret +} diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 005759514..5d08dc9ac 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -53,6 +53,8 @@ pub use crate::features::mode; // ** unix-only #[cfg(all(unix, feature = "entries"))] pub use crate::features::entries; +#[cfg(all(unix, feature = "perms"))] +pub use crate::features::perms; #[cfg(all(unix, feature = "process"))] pub use crate::features::process; #[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))] From 015e18731f83b4e212b31ad040f8e7414bbfb6fb Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 16 Nov 2020 22:54:41 +0100 Subject: [PATCH 236/606] feature(install): install group support --- src/uu/install/Cargo.toml | 2 +- src/uu/install/src/install.rs | 71 +++++++++++++++++++---------------- tests/by-util/test_install.rs | 22 +++++++++++ 3 files changed, 62 insertions(+), 33 deletions(-) diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 93803048b..2ef2a1f33 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -20,7 +20,7 @@ path = "src/install.rs" [dependencies] clap = "2.33" libc = ">= 0.2" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["mode"] } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["mode", "perms"] } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 627803a02..64b3ec2e0 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -16,6 +16,9 @@ mod mode; extern crate uucore; use clap::{App, Arg, ArgMatches}; +use uucore::perms::{wrap_chgrp, Verbosity}; +use uucore::entries::grp2gid; + use std::fs; use std::path::{Path, PathBuf}; use std::result::Result; @@ -27,6 +30,7 @@ pub struct Behavior { main_function: MainFunction, specified_mode: Option, suffix: String, + group: String, verbose: bool, } @@ -126,12 +130,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("(unimplemented) create all leading components of DEST except the last, then copy SOURCE to DEST") ) .arg( - // TODO implement flag Arg::with_name(OPT_GROUP) .short("g") .long(OPT_GROUP) - .help("(unimplemented) set group ownership, instead of process's current group") + .help("set group ownership, instead of process's current group") .value_name("GROUP") + .takes_value(true) ) .arg( Arg::with_name(OPT_MODE) @@ -139,6 +143,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_MODE) .help("set permission mode (as in chmod), instead of rwxr-xr-x") .value_name("MODE") + .takes_value(true) + .min_values(1) ) .arg( // TODO implement flag @@ -176,6 +182,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_SUFFIX) .help("(unimplemented) override the usual backup suffix") .value_name("SUFFIX") + .takes_value(true) + .min_values(1) ) .arg( // TODO implement flag @@ -214,7 +222,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("(unimplemented) set security context of files and directories") .value_name("CONTEXT") ) - .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) + .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true).min_values(1)) .get_matches_from(args); let paths: Vec = matches @@ -258,8 +266,6 @@ fn check_unimplemented<'a>(matches: &ArgMatches) -> Result<(), &'a str> { Err("--compare, -C") } else if matches.is_present(OPT_CREATED) { Err("-D") - } else if matches.is_present(OPT_GROUP) { - Err("--group, -g") } else if matches.is_present(OPT_OWNER) { Err("--owner, -o") } else if matches.is_present(OPT_PRESERVE_TIMESTAMPS) { @@ -292,7 +298,7 @@ fn check_unimplemented<'a>(matches: &ArgMatches) -> Result<(), &'a str> { /// In event of failure, returns an integer intended as a program return code. /// fn behavior(matches: &ArgMatches) -> Result { - let main_function = if matches.is_present("directory") { + let main_function = if matches.is_present(OPT_DIRECTORY) { MainFunction::Directory } else { MainFunction::Standard @@ -310,11 +316,6 @@ fn behavior(matches: &ArgMatches) -> Result { } }, None => { - show_error!( - "option '--mode' requires an argument\n \ - Try '{} --help' for more information.", - executable!() - ); return Err(1); } } @@ -326,11 +327,6 @@ fn behavior(matches: &ArgMatches) -> Result { match matches.value_of(OPT_SUFFIX) { Some(x) => x, None => { - show_error!( - "option '--suffix' requires an argument\n\ - Try '{} --help' for more information.", - executable!() - ); return Err(1); } } @@ -338,10 +334,13 @@ fn behavior(matches: &ArgMatches) -> Result { "~" }; + let group = matches.value_of(OPT_GROUP).unwrap_or_else(|| ""); + Ok(Behavior { main_function, specified_mode, suffix: backup_suffix.to_string(), + group: group.to_string(), verbose: matches.is_present(OPT_VERBOSE), }) } @@ -400,22 +399,16 @@ fn is_new_file_path(path: &Path) -> bool { /// Returns an integer intended as a program return code. /// fn standard(paths: Vec, b: Behavior) -> i32 { - if paths.len() < 2 { - println!("{} requires at least 2 arguments.", executable!()); - 1 - } else { - let sources = &paths[0..paths.len() - 1] - .iter() - .map(PathBuf::from) - .collect::>(); - let target = Path::new(paths.last().unwrap()); + let sources = &paths[0..paths.len() - 1] + .iter() + .map(PathBuf::from) + .collect::>(); + let target = Path::new(paths.last().unwrap()); - if (target.is_file() || is_new_file_path(target)) && sources.len() == 1 { - /* If the target already exist or directly creatable */ - copy_file_to_file(&sources[0], &target.to_path_buf(), &b) - } else { - copy_files_into_dir(sources, &target.to_path_buf(), &b) - } + if (target.is_file() || is_new_file_path(target)) && sources.len() == 1 { + copy_file_to_file(&sources[0], &target.to_path_buf(), &b) + } else { + copy_files_into_dir(sources, &target.to_path_buf(), &b) } } @@ -495,7 +488,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { if let Err(err) = io_result { show_error!( - "install: cannot install ‘{}’ to ‘{}’: {}", + "cannot install ‘{}’ to ‘{}’: {}", from.display(), to.display(), err @@ -507,6 +500,20 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { return Err(()); } + if b.group != "" { + let meta = match fs::metadata(to) { + Ok(meta) => meta, + Err(f) => crash!(1, "{}", f.to_string()), + }; + + let group_id = match grp2gid(&b.group) { + Ok(g) => g, + _ => crash!(1, "no such group: {}", b.group), + }; + wrap_chgrp(to.as_path(), &meta, group_id, false, Verbosity::Normal); + + } + if b.verbose { show_info!("'{}' -> '{}'", from.display(), to.display()); } diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index ec38d11b0..a88099912 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -1,5 +1,6 @@ use crate::common::util::*; use std::os::unix::fs::PermissionsExt; +use rust_users::*; #[test] fn test_install_help() { @@ -206,6 +207,27 @@ fn test_install_target_new_file() { assert!(at.file_exists(&format!("{}/{}", dir, file))); } +#[test] +fn test_install_target_new_file_with_group() { + let (at, mut ucmd) = at_and_ucmd!(); + let file = "test_install_target_new_filer_file_j"; + let dir = "test_install_target_new_file_dir_j"; + let gid = get_effective_gid(); + + at.touch(file); + at.mkdir(dir); + ucmd.arg(file) + .arg("--group") + .arg(gid.to_string()) + .arg(format!("{}/{}", dir, file)) + .succeeds() + .no_stderr(); + + assert!(at.file_exists(file)); + assert!(at.file_exists(&format!("{}/{}", dir, file))); +} + + #[test] fn test_install_target_new_file_failing_nonexistent_parent() { let (at, mut ucmd) = at_and_ucmd!(); From 55c660b986174293985b21f078866b65fdcb323c Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 17 Nov 2020 22:13:58 +0100 Subject: [PATCH 237/606] feature(install): move chown functions into uucore and have install owner support use it --- Cargo.lock | 2 + src/uu/chown/Cargo.toml | 2 +- src/uu/chown/src/chown.rs | 107 +++++---------------------- src/uu/install/src/install.rs | 45 ++++++++--- src/uucore/src/lib/features/perms.rs | 78 ++++++++++++++++++- tests/by-util/test_chown.rs | 15 +++- tests/by-util/test_install.rs | 21 +++++- 7 files changed, 167 insertions(+), 103 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 955626985..43fada101 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index 59a957cf8..5f7169bda 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -17,7 +17,7 @@ path = "src/chown.rs" [dependencies] clap = "2.33" glob = "0.3.0" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index 3c8a9f0c1..8dba8e174 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -11,7 +11,8 @@ extern crate uucore; pub use uucore::entries::{self, Group, Locate, Passwd}; use uucore::fs::resolve_relative_path; -use uucore::libc::{self, gid_t, lchown, uid_t}; +use uucore::libc::{gid_t, uid_t}; +use uucore::perms::{wrap_chown, Verbosity}; extern crate clap; use clap::{App, Arg}; @@ -22,9 +23,6 @@ use walkdir::WalkDir; use std::fs::{self, Metadata}; use std::os::unix::fs::MetadataExt; -use std::io; -use std::io::Result as IOResult; - use std::convert::AsRef; use std::path::Path; @@ -304,14 +302,6 @@ fn parse_spec(spec: &str) -> Result<(Option, Option), String> { } } -#[derive(PartialEq, Debug)] -enum Verbosity { - Silent, - Changes, - Verbose, - Normal, -} - enum IfFrom { All, User(u32), @@ -349,29 +339,6 @@ impl Chowner { ret } - fn chown>( - &self, - path: P, - duid: uid_t, - dgid: gid_t, - follow: bool, - ) -> IOResult<()> { - let path = path.as_ref(); - let s = CString::new(path.as_os_str().as_bytes()).unwrap(); - let ret = unsafe { - if follow { - libc::chown(s.as_ptr(), duid, dgid) - } else { - lchown(s.as_ptr(), duid, dgid) - } - }; - if ret == 0 { - Ok(()) - } else { - Err(io::Error::last_os_error()) - } - } - fn traverse>(&self, root: P) -> i32 { let follow_arg = self.dereference || self.bit_flag != FTS_PHYSICAL; let path = root.as_ref(); @@ -408,7 +375,14 @@ impl Chowner { } let ret = if self.matched(meta.uid(), meta.gid()) { - self.wrap_chown(path, &meta, follow_arg) + wrap_chown( + path, + &meta, + self.dest_uid, + self.dest_gid, + follow_arg, + self.verbosity.clone(), + ) } else { 0 }; @@ -443,7 +417,14 @@ impl Chowner { continue; } - ret = self.wrap_chown(path, &meta, follow); + ret = wrap_chown( + path, + &meta, + self.dest_uid, + self.dest_gid, + follow, + self.verbosity.clone(), + ) } ret } @@ -471,58 +452,6 @@ impl Chowner { Some(meta) } - fn wrap_chown>(&self, path: P, meta: &Metadata, follow: bool) -> i32 { - use self::Verbosity::*; - let mut ret = 0; - let dest_uid = self.dest_uid.unwrap_or_else(|| meta.uid()); - let dest_gid = self.dest_gid.unwrap_or_else(|| meta.gid()); - let path = path.as_ref(); - if let Err(e) = self.chown(path, dest_uid, dest_gid, follow) { - match self.verbosity { - Silent => (), - _ => { - show_info!("changing ownership of '{}': {}", path.display(), e); - if self.verbosity == Verbose { - println!( - "failed to change ownership of {} from {}:{} to {}:{}", - path.display(), - entries::uid2usr(meta.uid()).unwrap(), - entries::gid2grp(meta.gid()).unwrap(), - entries::uid2usr(dest_uid).unwrap(), - entries::gid2grp(dest_gid).unwrap() - ); - }; - } - } - ret = 1; - } else { - let changed = dest_uid != meta.uid() || dest_gid != meta.gid(); - if changed { - match self.verbosity { - Changes | Verbose => { - println!( - "changed ownership of {} from {}:{} to {}:{}", - path.display(), - entries::uid2usr(meta.uid()).unwrap(), - entries::gid2grp(meta.gid()).unwrap(), - entries::uid2usr(dest_uid).unwrap(), - entries::gid2grp(dest_gid).unwrap() - ); - } - _ => (), - }; - } else if self.verbosity == Verbose { - println!( - "ownership of {} retained as {}:{}", - path.display(), - entries::uid2usr(dest_uid).unwrap(), - entries::gid2grp(dest_gid).unwrap() - ); - } - } - ret - } - #[inline] fn matched(&self, uid: uid_t, gid: gid_t) -> bool { match self.filter { diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 64b3ec2e0..6260baa29 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -16,10 +16,11 @@ mod mode; extern crate uucore; use clap::{App, Arg, ArgMatches}; -use uucore::perms::{wrap_chgrp, Verbosity}; -use uucore::entries::grp2gid; +use uucore::entries::{grp2gid, usr2uid}; +use uucore::perms::{wrap_chgrp, wrap_chown, Verbosity}; use std::fs; +use std::os::unix::fs::MetadataExt; use std::path::{Path, PathBuf}; use std::result::Result; @@ -30,6 +31,7 @@ pub struct Behavior { main_function: MainFunction, specified_mode: Option, suffix: String, + owner: String, group: String, verbose: bool, } @@ -147,12 +149,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .min_values(1) ) .arg( - // TODO implement flag Arg::with_name(OPT_OWNER) .short("o") .long(OPT_OWNER) - .help("(unimplemented) set ownership (super-user only)") + .help("set ownership (super-user only)") .value_name("OWNER") + .takes_value(true) ) .arg( // TODO implement flag @@ -266,8 +268,6 @@ fn check_unimplemented<'a>(matches: &ArgMatches) -> Result<(), &'a str> { Err("--compare, -C") } else if matches.is_present(OPT_CREATED) { Err("-D") - } else if matches.is_present(OPT_OWNER) { - Err("--owner, -o") } else if matches.is_present(OPT_PRESERVE_TIMESTAMPS) { Err("--preserve-timestamps, -p") } else if matches.is_present(OPT_STRIP) { @@ -334,13 +334,18 @@ fn behavior(matches: &ArgMatches) -> Result { "~" }; - let group = matches.value_of(OPT_GROUP).unwrap_or_else(|| ""); - Ok(Behavior { main_function, specified_mode, suffix: backup_suffix.to_string(), - group: group.to_string(), + owner: matches + .value_of(OPT_OWNER) + .unwrap_or_else(|| "") + .to_string(), + group: matches + .value_of(OPT_GROUP) + .unwrap_or_else(|| "") + .to_string(), verbose: matches.is_present(OPT_VERBOSE), }) } @@ -500,6 +505,27 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { return Err(()); } + if b.owner != "" { + let meta = match fs::metadata(to) { + Ok(meta) => meta, + Err(f) => crash!(1, "{}", f.to_string()), + }; + + let owner_id = match usr2uid(&b.owner) { + Ok(g) => g, + _ => crash!(1, "no such user: {}", b.owner), + }; + let gid = meta.gid(); + wrap_chown( + to.as_path(), + &meta, + Some(owner_id), + Some(gid), + false, + Verbosity::Normal, + ); + } + if b.group != "" { let meta = match fs::metadata(to) { Ok(meta) => meta, @@ -511,7 +537,6 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { _ => crash!(1, "no such group: {}", b.group), }; wrap_chgrp(to.as_path(), &meta, group_id, false, Verbosity::Normal); - } if b.verbose { diff --git a/src/uucore/src/lib/features/perms.rs b/src/uucore/src/lib/features/perms.rs index 9eca7ea0e..6ea1cfe8f 100644 --- a/src/uucore/src/lib/features/perms.rs +++ b/src/uucore/src/lib/features/perms.rs @@ -4,7 +4,7 @@ // file that was distributed with this source code. pub use crate::features::entries; -use libc::{self, gid_t, lchown}; +use libc::{self, gid_t, lchown, uid_t}; #[macro_use] pub use crate::*; @@ -94,3 +94,79 @@ pub fn wrap_chgrp>( } ret } + +fn chown>(path: P, duid: uid_t, dgid: gid_t, follow: bool) -> IOResult<()> { + let path = path.as_ref(); + let s = CString::new(path.as_os_str().as_bytes()).unwrap(); + let ret = unsafe { + if follow { + libc::chown(s.as_ptr(), duid, dgid) + } else { + lchown(s.as_ptr(), duid, dgid) + } + }; + if ret == 0 { + Ok(()) + } else { + Err(IOError::last_os_error()) + } +} + +pub fn wrap_chown>( + path: P, + meta: &Metadata, + dest_uid: Option, + dest_gid: Option, + follow: bool, + verbosity: Verbosity, +) -> i32 { + use self::Verbosity::*; + let mut ret = 0; + let dest_uid = dest_uid.unwrap_or_else(|| meta.uid()); + let dest_gid = dest_gid.unwrap_or_else(|| meta.gid()); + let path = path.as_ref(); + if let Err(e) = chown(path, dest_uid, dest_gid, follow) { + match verbosity { + Silent => (), + _ => { + show_info!("changing ownership of '{}': {}", path.display(), e); + if verbosity == Verbose { + println!( + "failed to change ownership of {} from {}:{} to {}:{}", + path.display(), + entries::uid2usr(meta.uid()).unwrap(), + entries::gid2grp(meta.gid()).unwrap(), + entries::uid2usr(dest_uid).unwrap(), + entries::gid2grp(dest_gid).unwrap() + ); + }; + } + } + ret = 1; + } else { + let changed = dest_uid != meta.uid() || dest_gid != meta.gid(); + if changed { + match verbosity { + Changes | Verbose => { + println!( + "changed ownership of {} from {}:{} to {}:{}", + path.display(), + entries::uid2usr(meta.uid()).unwrap(), + entries::gid2grp(meta.gid()).unwrap(), + entries::uid2usr(dest_uid).unwrap(), + entries::gid2grp(dest_gid).unwrap() + ); + } + _ => (), + }; + } else if verbosity == Verbose { + println!( + "ownership of {} retained as {}:{}", + path.display(), + entries::uid2usr(dest_uid).unwrap(), + entries::gid2grp(dest_gid).unwrap() + ); + } + } + ret +} diff --git a/tests/by-util/test_chown.rs b/tests/by-util/test_chown.rs index a943967f2..9e526bca9 100644 --- a/tests/by-util/test_chown.rs +++ b/tests/by-util/test_chown.rs @@ -1,7 +1,7 @@ use crate::common::util::*; +use rust_users::*; extern crate chown; -// pub use self::uu_chown::*; #[cfg(test)] mod test_passgrp { @@ -378,4 +378,17 @@ fn test_root_preserve() { assert!(result .stderr .contains("chown: it is dangerous to operate recursively")); + +#[cfg(target_os = "linux")] +fn test_big_p() { + if get_effective_uid() != 0 { + new_ucmd!() + .arg("-RP") + .arg("bin") + .arg("/proc/self/cwd") + .fails() + .stderr_is( + "chown: changing ownership of '/proc/self/cwd': Operation not permitted (os error 1)\n", + ); + } } diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index a88099912..8066bdc25 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -1,6 +1,6 @@ use crate::common::util::*; -use std::os::unix::fs::PermissionsExt; use rust_users::*; +use std::os::unix::fs::PermissionsExt; #[test] fn test_install_help() { @@ -227,6 +227,25 @@ fn test_install_target_new_file_with_group() { assert!(at.file_exists(&format!("{}/{}", dir, file))); } +#[test] +fn test_install_target_new_file_with_owner() { + let (at, mut ucmd) = at_and_ucmd!(); + let file = "test_install_target_new_filer_file_j"; + let dir = "test_install_target_new_file_dir_j"; + let uid = get_effective_uid(); + + at.touch(file); + at.mkdir(dir); + ucmd.arg(file) + .arg("--owner") + .arg(uid.to_string()) + .arg(format!("{}/{}", dir, file)) + .succeeds() + .no_stderr(); + + assert!(at.file_exists(file)); + assert!(at.file_exists(&format!("{}/{}", dir, file))); +} #[test] fn test_install_target_new_file_failing_nonexistent_parent() { From 3024ade0717ec3406582c3d04e4a3faffd149be8 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 18 Nov 2020 23:06:43 +0100 Subject: [PATCH 238/606] refactor(chgrp, install): Show the error in the program instead of the lib --- src/uu/chgrp/src/chgrp.rs | 31 ++++++++++++++++++-- src/uu/chown/src/chown.rs | 35 ++++++++++++++++++++--- src/uu/install/src/install.rs | 20 +++++++++++-- src/uucore/src/lib/features/perms.rs | 42 ++++++++++++++++------------ tests/by-util/test_chgrp.rs | 3 +- 5 files changed, 101 insertions(+), 30 deletions(-) diff --git a/src/uu/chgrp/src/chgrp.rs b/src/uu/chgrp/src/chgrp.rs index 9fc72ab20..b4c3360c5 100644 --- a/src/uu/chgrp/src/chgrp.rs +++ b/src/uu/chgrp/src/chgrp.rs @@ -239,13 +239,24 @@ impl Chgrper { } } - let ret = wrap_chgrp( + let ret = match wrap_chgrp( path, &meta, self.dest_gid, follow_arg, self.verbosity.clone(), - ); + ) { + Ok(n) => { + show_info!("{}", n); + 0 + } + Err(e) => { + if self.verbosity != Verbosity::Silent { + show_info!("{}", e); + } + 1 + } + }; if !self.recursive { ret @@ -273,8 +284,22 @@ impl Chgrper { } }; - ret = wrap_chgrp(path, &meta, self.dest_gid, follow, self.verbosity.clone()); + ret = match wrap_chgrp(path, &meta, self.dest_gid, follow, self.verbosity.clone()) { + Ok(n) => { + if n != "" { + show_info!("{}", n); + } + 0 + } + Err(e) => { + if self.verbosity != Verbosity::Silent { + show_info!("{}", e); + } + 1 + } + } } + ret } diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index 8dba8e174..47279747f 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -375,14 +375,28 @@ impl Chowner { } let ret = if self.matched(meta.uid(), meta.gid()) { - wrap_chown( + match wrap_chown( path, &meta, self.dest_uid, self.dest_gid, follow_arg, self.verbosity.clone(), - ) + ) { + Ok(n) => { + if n != "" { + show_info!("{}", n); + } + 0 + } + Err(e) => { + + if self.verbosity != Verbosity::Silent { + show_info!("{}", e); + } + 1 + } + } } else { 0 }; @@ -417,14 +431,27 @@ impl Chowner { continue; } - ret = wrap_chown( + ret = match wrap_chown( path, &meta, self.dest_uid, self.dest_gid, follow, self.verbosity.clone(), - ) + ) { + Ok(n) => { + if n != "" { + show_info!("{}", n); + } + 0 + } + Err(e) => { + if self.verbosity != Verbosity::Silent { + show_info!("{}", e); + } + 1 + } + } } ret } diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 6260baa29..ce6ba3bf1 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -516,14 +516,21 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { _ => crash!(1, "no such user: {}", b.owner), }; let gid = meta.gid(); - wrap_chown( + match wrap_chown( to.as_path(), &meta, Some(owner_id), Some(gid), false, Verbosity::Normal, - ); + ) { + Ok(n) => { + if n != "" { + show_info!("{}", n); + } + } + Err(e) => show_info!("{}", e), + } } if b.group != "" { @@ -536,7 +543,14 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { Ok(g) => g, _ => crash!(1, "no such group: {}", b.group), }; - wrap_chgrp(to.as_path(), &meta, group_id, false, Verbosity::Normal); + match wrap_chgrp(to.as_path(), &meta, group_id, false, Verbosity::Normal) { + Ok(n) => { + if n != "" { + show_info!("{}", n); + } + } + Err(e) => show_info!("{}", e), + } } if b.verbose { diff --git a/src/uucore/src/lib/features/perms.rs b/src/uucore/src/lib/features/perms.rs index 6ea1cfe8f..25f49012c 100644 --- a/src/uucore/src/lib/features/perms.rs +++ b/src/uucore/src/lib/features/perms.rs @@ -19,6 +19,8 @@ use std::os::unix::fs::MetadataExt; use std::os::unix::ffi::OsStrExt; use std::path::Path; +//type PermResult = Result; + #[derive(PartialEq, Clone, Debug)] pub enum Verbosity { Silent, @@ -50,18 +52,20 @@ pub fn wrap_chgrp>( dest_gid: gid_t, follow: bool, verbosity: Verbosity, -) -> i32 { +) -> Result { use self::Verbosity::*; - let mut ret = 0; let path = path.as_ref(); + let mut out: String = String::new(); + if let Err(e) = chgrp(path, dest_gid, follow) { match verbosity { Silent => (), _ => { - show_info!("changing group of '{}': {}", path.display(), e); + out = format!("changing group of '{}': {}", path.display(), e); if verbosity == Verbose { - println!( - "failed to change group of {} from {} to {}", + out = format!( + "{}\nfailed to change group of {} from {} to {}", + out, path.display(), entries::gid2grp(meta.gid()).unwrap(), entries::gid2grp(dest_gid).unwrap() @@ -69,13 +73,13 @@ pub fn wrap_chgrp>( }; } } - ret = 1; + return Err(out); } else { let changed = dest_gid != meta.gid(); if changed { match verbosity { Changes | Verbose => { - println!( + out = format!( "changed group of {} from {} to {}", path.display(), entries::gid2grp(meta.gid()).unwrap(), @@ -85,14 +89,14 @@ pub fn wrap_chgrp>( _ => (), }; } else if verbosity == Verbose { - println!( + out = format!( "group of {} retained as {}", path.display(), entries::gid2grp(dest_gid).unwrap() ); } } - ret + Ok(out) } fn chown>(path: P, duid: uid_t, dgid: gid_t, follow: bool) -> IOResult<()> { @@ -119,20 +123,22 @@ pub fn wrap_chown>( dest_gid: Option, follow: bool, verbosity: Verbosity, -) -> i32 { +) -> Result { use self::Verbosity::*; - let mut ret = 0; let dest_uid = dest_uid.unwrap_or_else(|| meta.uid()); let dest_gid = dest_gid.unwrap_or_else(|| meta.gid()); let path = path.as_ref(); + let mut out: String = String::new(); + if let Err(e) = chown(path, dest_uid, dest_gid, follow) { match verbosity { Silent => (), _ => { - show_info!("changing ownership of '{}': {}", path.display(), e); + out = format!("changing ownership of '{}': {}", path.display(), e); if verbosity == Verbose { - println!( - "failed to change ownership of {} from {}:{} to {}:{}", + out = format!( + "{}\nfailed to change ownership of {} from {}:{} to {}:{}", + out, path.display(), entries::uid2usr(meta.uid()).unwrap(), entries::gid2grp(meta.gid()).unwrap(), @@ -142,13 +148,13 @@ pub fn wrap_chown>( }; } } - ret = 1; + return Err(out); } else { let changed = dest_uid != meta.uid() || dest_gid != meta.gid(); if changed { match verbosity { Changes | Verbose => { - println!( + out = format!( "changed ownership of {} from {}:{} to {}:{}", path.display(), entries::uid2usr(meta.uid()).unwrap(), @@ -160,7 +166,7 @@ pub fn wrap_chown>( _ => (), }; } else if verbosity == Verbose { - println!( + out = format!( "ownership of {} retained as {}:{}", path.display(), entries::uid2usr(dest_uid).unwrap(), @@ -168,5 +174,5 @@ pub fn wrap_chown>( ); } } - ret + Ok(out) } diff --git a/tests/by-util/test_chgrp.rs b/tests/by-util/test_chgrp.rs index 3bd0c69e5..adc0f6981 100644 --- a/tests/by-util/test_chgrp.rs +++ b/tests/by-util/test_chgrp.rs @@ -110,8 +110,7 @@ fn test_reference() { .arg("--reference=/etc/passwd") .arg("/etc") .fails() - .stderr_is("chgrp: changing group of '/etc': Operation not permitted (os error 1)\n") - .stdout_is("failed to change group of /etc from root to root\n"); + .stderr_is("chgrp: changing group of '/etc': Operation not permitted (os error 1)\nfailed to change group of /etc from root to root"); } } From dca1f2808556a4de1916a6b25bd98c7edd6bd29f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 19 Nov 2020 22:28:13 +0100 Subject: [PATCH 239/606] install: various improvements in output & tests --- Cargo.lock | 2 -- src/uu/chown/src/chown.rs | 4 ---- src/uu/install/src/install.rs | 10 ++------- src/uucore/src/lib/features/perms.rs | 17 ++++++--------- tests/by-util/test_chgrp.rs | 2 +- tests/by-util/test_chown.rs | 8 +++++-- tests/by-util/test_install.rs | 32 ++++++++++++++++++++++------ 7 files changed, 41 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 43fada101..955626985 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,3 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index 47279747f..460f1da86 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -26,9 +26,6 @@ use std::os::unix::fs::MetadataExt; use std::convert::AsRef; use std::path::Path; -use std::ffi::CString; -use std::os::unix::ffi::OsStrExt; - static ABOUT: &str = "change file owner and group"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -390,7 +387,6 @@ impl Chowner { 0 } Err(e) => { - if self.verbosity != Verbosity::Silent { show_info!("{}", e); } diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index ce6ba3bf1..37f69a2f0 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -338,14 +338,8 @@ fn behavior(matches: &ArgMatches) -> Result { main_function, specified_mode, suffix: backup_suffix.to_string(), - owner: matches - .value_of(OPT_OWNER) - .unwrap_or_else(|| "") - .to_string(), - group: matches - .value_of(OPT_GROUP) - .unwrap_or_else(|| "") - .to_string(), + owner: matches.value_of(OPT_OWNER).unwrap_or("").to_string(), + group: matches.value_of(OPT_GROUP).unwrap_or("").to_string(), verbose: matches.is_present(OPT_VERBOSE), }) } diff --git a/src/uucore/src/lib/features/perms.rs b/src/uucore/src/lib/features/perms.rs index 25f49012c..bbe53ac2a 100644 --- a/src/uucore/src/lib/features/perms.rs +++ b/src/uucore/src/lib/features/perms.rs @@ -6,9 +6,6 @@ pub use crate::features::entries; use libc::{self, gid_t, lchown, uid_t}; -#[macro_use] -pub use crate::*; - use std::io::Error as IOError; use std::io::Result as IOResult; @@ -19,8 +16,6 @@ use std::os::unix::fs::MetadataExt; use std::os::unix::ffi::OsStrExt; use std::path::Path; -//type PermResult = Result; - #[derive(PartialEq, Clone, Debug)] pub enum Verbosity { Silent, @@ -64,7 +59,7 @@ pub fn wrap_chgrp>( out = format!("changing group of '{}': {}", path.display(), e); if verbosity == Verbose { out = format!( - "{}\nfailed to change group of {} from {} to {}", + "{}\nfailed to change group of '{}' from {} to {}", out, path.display(), entries::gid2grp(meta.gid()).unwrap(), @@ -80,7 +75,7 @@ pub fn wrap_chgrp>( match verbosity { Changes | Verbose => { out = format!( - "changed group of {} from {} to {}", + "changed group of '{}' from {} to {}", path.display(), entries::gid2grp(meta.gid()).unwrap(), entries::gid2grp(dest_gid).unwrap() @@ -90,7 +85,7 @@ pub fn wrap_chgrp>( }; } else if verbosity == Verbose { out = format!( - "group of {} retained as {}", + "group of '{}' retained as {}", path.display(), entries::gid2grp(dest_gid).unwrap() ); @@ -137,7 +132,7 @@ pub fn wrap_chown>( out = format!("changing ownership of '{}': {}", path.display(), e); if verbosity == Verbose { out = format!( - "{}\nfailed to change ownership of {} from {}:{} to {}:{}", + "{}\nfailed to change ownership of '{}' from {}:{} to {}:{}", out, path.display(), entries::uid2usr(meta.uid()).unwrap(), @@ -155,7 +150,7 @@ pub fn wrap_chown>( match verbosity { Changes | Verbose => { out = format!( - "changed ownership of {} from {}:{} to {}:{}", + "changed ownership of '{}' from {}:{} to {}:{}", path.display(), entries::uid2usr(meta.uid()).unwrap(), entries::gid2grp(meta.gid()).unwrap(), @@ -167,7 +162,7 @@ pub fn wrap_chown>( }; } else if verbosity == Verbose { out = format!( - "ownership of {} retained as {}:{}", + "ownership of '{}' retained as {}:{}", path.display(), entries::uid2usr(dest_uid).unwrap(), entries::gid2grp(dest_gid).unwrap() diff --git a/tests/by-util/test_chgrp.rs b/tests/by-util/test_chgrp.rs index adc0f6981..d5afaf3a7 100644 --- a/tests/by-util/test_chgrp.rs +++ b/tests/by-util/test_chgrp.rs @@ -110,7 +110,7 @@ fn test_reference() { .arg("--reference=/etc/passwd") .arg("/etc") .fails() - .stderr_is("chgrp: changing group of '/etc': Operation not permitted (os error 1)\nfailed to change group of /etc from root to root"); + .stderr_is("chgrp: changing group of '/etc': Operation not permitted (os error 1)\nfailed to change group of '/etc' from root to root"); } } diff --git a/tests/by-util/test_chown.rs b/tests/by-util/test_chown.rs index 9e526bca9..afd6f567f 100644 --- a/tests/by-util/test_chown.rs +++ b/tests/by-util/test_chown.rs @@ -1,5 +1,6 @@ use crate::common::util::*; -use rust_users::*; +#[cfg(target_os = "linux")] +use rust_users::get_effective_uid; extern crate chown; @@ -345,7 +346,9 @@ fn test_chown_recursive() { // As seems to be a configuration issue, ignoring it return; } - assert!(result.stdout.contains("ownership of a/a retained as")); + + assert!(result.stderr.contains("ownership of 'a/a' retained as")); + assert!(result.stderr.contains("ownership of 'z/y' retained as")); assert!(result.success); } @@ -378,6 +381,7 @@ fn test_root_preserve() { assert!(result .stderr .contains("chown: it is dangerous to operate recursively")); +} #[cfg(target_os = "linux")] fn test_big_p() { diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 8066bdc25..89ae515a7 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -216,13 +216,23 @@ fn test_install_target_new_file_with_group() { at.touch(file); at.mkdir(dir); - ucmd.arg(file) + let result = ucmd + .arg(file) .arg("--group") .arg(gid.to_string()) .arg(format!("{}/{}", dir, file)) - .succeeds() - .no_stderr(); + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + + if is_ci() && result.stderr.contains("error: no such group:") { + // In the CI, some server are failing to return the group. + // As seems to be a configuration issue, ignoring it + return; + } + + assert!(result.success); assert!(at.file_exists(file)); assert!(at.file_exists(&format!("{}/{}", dir, file))); } @@ -236,13 +246,23 @@ fn test_install_target_new_file_with_owner() { at.touch(file); at.mkdir(dir); - ucmd.arg(file) + let result = ucmd + .arg(file) .arg("--owner") .arg(uid.to_string()) .arg(format!("{}/{}", dir, file)) - .succeeds() - .no_stderr(); + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + + if is_ci() && result.stderr.contains("error: no such user:") { + // In the CI, some server are failing to return the user id. + // As seems to be a configuration issue, ignoring it + return; + } + + assert!(result.success); assert!(at.file_exists(file)); assert!(at.file_exists(&format!("{}/{}", dir, file))); } From f287309b72ff61b132af50179e7d9c394bfd4e02 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 12 Dec 2020 14:43:56 +0100 Subject: [PATCH 240/606] perms: add some docs --- src/uucore/src/lib/features/perms.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/uucore/src/lib/features/perms.rs b/src/uucore/src/lib/features/perms.rs index bbe53ac2a..66db15451 100644 --- a/src/uucore/src/lib/features/perms.rs +++ b/src/uucore/src/lib/features/perms.rs @@ -16,6 +16,7 @@ use std::os::unix::fs::MetadataExt; use std::os::unix::ffi::OsStrExt; use std::path::Path; +/// The various level of verbosity #[derive(PartialEq, Clone, Debug)] pub enum Verbosity { Silent, @@ -24,6 +25,7 @@ pub enum Verbosity { Normal, } +/// Actually perform the change of group on a path fn chgrp>(path: P, dgid: gid_t, follow: bool) -> IOResult<()> { let path = path.as_ref(); let s = CString::new(path.as_os_str().as_bytes()).unwrap(); @@ -41,6 +43,9 @@ fn chgrp>(path: P, dgid: gid_t, follow: bool) -> IOResult<()> { } } +/// Perform the change of group on a path +/// with the various options +/// and error messages management pub fn wrap_chgrp>( path: P, meta: &Metadata, @@ -94,6 +99,7 @@ pub fn wrap_chgrp>( Ok(out) } +/// Actually perform the change of owner on a path fn chown>(path: P, duid: uid_t, dgid: gid_t, follow: bool) -> IOResult<()> { let path = path.as_ref(); let s = CString::new(path.as_os_str().as_bytes()).unwrap(); @@ -111,6 +117,9 @@ fn chown>(path: P, duid: uid_t, dgid: gid_t, follow: bool) -> IOR } } +/// Perform the change of owner on a path +/// with the various options +/// and error messages management pub fn wrap_chown>( path: P, meta: &Metadata, From cd97adb39d8085f4fca406c9cba6c54641b838e2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 13 Dec 2020 11:30:49 +0100 Subject: [PATCH 241/606] Minor fixes in the tests --- tests/by-util/test_chown.rs | 1 + tests/by-util/test_cp.rs | 15 +++++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/tests/by-util/test_chown.rs b/tests/by-util/test_chown.rs index afd6f567f..7b663e9c9 100644 --- a/tests/by-util/test_chown.rs +++ b/tests/by-util/test_chown.rs @@ -384,6 +384,7 @@ fn test_root_preserve() { } #[cfg(target_os = "linux")] +#[test] fn test_big_p() { if get_effective_uid() != 0 { new_ucmd!() diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index a18386b97..47d28f63a 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -42,8 +42,7 @@ fn test_cp_cp() { .run(); // Check that the exit code represents a successful copy. - let exit_success = result.success; - assert!(exit_success); + assert!(result.success); // Check the content of the destination file that was copied. assert_eq!(at.read(TEST_HELLO_WORLD_DEST), "Hello, World!\n"); @@ -386,8 +385,7 @@ fn test_cp_deref() { .run(); // Check that the exit code represents a successful copy. - let exit_success = result.success; - assert!(exit_success); + assert!(result.success); let path_to_new_symlink = at .subdir .join(TEST_COPY_TO_FOLDER) @@ -430,8 +428,7 @@ fn test_cp_no_deref() { .run(); // Check that the exit code represents a successful copy. - let exit_success = result.success; - assert!(exit_success); + assert!(result.success); let path_to_new_symlink = at .subdir .join(TEST_COPY_TO_FOLDER) @@ -484,8 +481,7 @@ fn test_cp_deref_folder_to_folder() { println!("cp output {}", result.stdout); // Check that the exit code represents a successful copy. - let exit_success = result.success; - assert!(exit_success); + assert!(result.success); #[cfg(not(windows))] { @@ -589,8 +585,7 @@ fn test_cp_no_deref_folder_to_folder() { println!("cp output {}", result.stdout); // Check that the exit code represents a successful copy. - let exit_success = result.success; - assert!(exit_success); + assert!(result.success); #[cfg(not(windows))] { From 8a1628cf890144b1475a61aee6224d6edfe4b861 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 13 Dec 2020 12:06:44 +0100 Subject: [PATCH 242/606] 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 --- src/uu/ls/src/ls.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index d6c7d0d7b..fba6c600b 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -168,11 +168,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .parse(args); - list(matches); - 0 + list(matches) } -fn list(options: getopts::Matches) { +fn list(options: getopts::Matches) -> i32 { let locs: Vec = if options.free.is_empty() { vec![String::from(".")] } else { @@ -181,8 +180,16 @@ fn list(options: getopts::Matches) { let mut files = Vec::::new(); let mut dirs = Vec::::new(); + let mut has_failed = false; for loc in locs { let p = PathBuf::from(&loc); + if !p.exists() { + show_error!("'{}': {}", &loc, "No such file or directory"); + // We found an error, the return code of ls should not be 0 + // And no need to continue the execution + has_failed = true; + continue; + } let mut dir = false; if p.is_dir() && !options.opt_present("d") { @@ -211,6 +218,11 @@ fn list(options: getopts::Matches) { } enter_directory(&dir, &options); } + if has_failed { + 1 + } else { + 0 + } } #[cfg(any(unix, target_os = "redox"))] From ba126afe549aaf10d2186758cf08939d8a5dd162 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 13 Dec 2020 12:08:54 +0100 Subject: [PATCH 243/606] fix(ls): follow the display of GNU ls --- src/uu/ls/src/ls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index fba6c600b..20100568a 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -367,7 +367,7 @@ fn display_items(items: &[PathBuf], strip: Option<&Path>, options: &getopts::Mat match md { Err(e) => { let filename = get_file_name(i, strip); - show_error!("{}: {}", filename, e); + show_error!("'{}': {}", filename, e); None } Ok(md) => Some(display_file_name(&i, strip, &md, options)), From 4068195a94e30f2ae96453e472083a53cce1cdc7 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 13 Dec 2020 12:09:14 +0100 Subject: [PATCH 244/606] test(ls): add more tests --- tests/by-util/test_ls.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 18bd66d2e..88abab58d 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -11,6 +11,40 @@ fn test_ls_ls_i() { new_ucmd!().arg("-il").succeeds(); } +#[test] +fn test_ls_non_existing() { + new_ucmd!().arg("doesntexist").fails(); +} + +#[test] +fn test_ls_files_dirs() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.mkdir("a"); + at.mkdir("a/b"); + at.mkdir("a/b/c"); + at.mkdir("z"); + at.touch(&at.plus_as_string("a/a")); + at.touch(&at.plus_as_string("a/b/b")); + + scene.ucmd().arg("a").succeeds(); + scene.ucmd().arg("a/a").succeeds(); + scene.ucmd().arg("a").arg("z").succeeds(); + + let result = scene.ucmd().arg("doesntexist").fails(); + // Doesn't exist + assert!(result + .stderr + .contains("error: 'doesntexist': No such file or directory")); + + let result = scene.ucmd().arg("a").arg("doesntexist").fails(); + // One exists, the other doesn't + assert!(result + .stderr + .contains("error: 'doesntexist': No such file or directory")); + assert!(result.stdout.contains("a:")); +} + #[test] fn test_ls_ls_color() { new_ucmd!().arg("--color").succeeds(); From b687a2742ca58d37170a3a1e9e35e06e18d3b0b3 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 13 Dec 2020 12:22:31 +0100 Subject: [PATCH 245/606] test(ls): also test ls -R --- tests/by-util/test_ls.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 88abab58d..28cdaf88d 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -45,6 +45,36 @@ fn test_ls_files_dirs() { assert!(result.stdout.contains("a:")); } +#[test] +fn test_ls_recursive() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.mkdir("a"); + at.mkdir("a/b"); + at.mkdir("a/b/c"); + at.mkdir("z"); + at.touch(&at.plus_as_string("a/a")); + at.touch(&at.plus_as_string("a/b/b")); + + scene.ucmd().arg("a").succeeds(); + scene.ucmd().arg("a/a").succeeds(); + let result = scene + .ucmd() + .arg("--color=never") + .arg("-R") + .arg("a") + .arg("z") + .succeeds(); + + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + if cfg!(target_os = "windows") { + assert!(result.stdout.contains("a\\b:\nb")); + } else { + assert!(result.stdout.contains("a/b:\nb")); + } +} + #[test] fn test_ls_ls_color() { new_ucmd!().arg("--color").succeeds(); From d9cf0374bebf914f5dfb5567091240103db404fc Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 13 Dec 2020 18:02:33 +0100 Subject: [PATCH 246/606] fix(sync) - Remove 'unused import' on mac --- src/uu/sync/src/sync.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/uu/sync/src/sync.rs b/src/uu/sync/src/sync.rs index c94308cdb..018ed8398 100644 --- a/src/uu/sync/src/sync.rs +++ b/src/uu/sync/src/sync.rs @@ -28,7 +28,9 @@ static ARG_FILES: &str = "files"; #[cfg(unix)] mod platform { use super::libc; + #[cfg(target_os = "linux")] use std::fs::File; + #[cfg(target_os = "linux")] use std::os::unix::io::AsRawFd; pub unsafe fn do_sync() -> isize { From ef25a6874e1f19092dc81aa1b58171c7dfacc5a1 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 14 Dec 2020 12:45:36 +0100 Subject: [PATCH 247/606] Update of "contributing" documentation --- CONTRIBUTING.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0123c298e..3c40e5dfd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,16 +5,24 @@ standard libraries are stabilized. You may *claim* an item on the to-do list by following these steps: 1. Open an issue named "Implement [the utility of your choice]", e.g. "Implement ls" -2. State that you are working on this utility. -3. Develop the utility. -4. Add integration tests. -5. Add the reference to your utility into Cargo.toml and Makefile. -6. Remove utility from the to-do list in the README. -7. Submit a pull request and close the issue. +1. State that you are working on this utility. +1. Develop the utility +1. Add integration tests. +1. Add the reference to your utility into Cargo.toml and Makefile. +1. Remove utility from the to-do list in the README. +1. Submit a pull request and close the issue. The steps above imply that, before starting to work on a utility, you should search the issues to make sure no one else is working on it. +## Best practices + +1. Follow what GNU is doing in term of options and behavior. +1. Use clap for argument management. +1. Make sure that the code coverage is covering all of the cases, including errors. +1. The code must be clippy-warning-free and rustfmt-compliant. +1. Don't hesitate to move common functions into uucore if they can be reused by other binaries. + ## Commit messages To help the project maintainers review pull requests from contributors across From 2de9abf52bb3ef266b93dec5f94f0bd765a3f10c Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 14 Dec 2020 21:46:18 +0100 Subject: [PATCH 248/606] test(ls): add more ls tests --- tests/by-util/test_ls.rs | 220 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 211 insertions(+), 9 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 28cdaf88d..847f1c591 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1,16 +1,211 @@ use crate::common::util::*; +extern crate regex; +use self::regex::Regex; + +use std::thread::sleep; +use std::time::Duration; + +#[cfg(not(windows))] +extern crate libc; +#[cfg(not(windows))] +use self::libc::umask; +#[cfg(not(windows))] +use std::sync::Mutex; + +#[cfg(not(windows))] +lazy_static! { + static ref UMASK_MUTEX: Mutex<()> = Mutex::new(()); +} + #[test] fn test_ls_ls() { new_ucmd!().succeeds(); } #[test] -fn test_ls_ls_i() { +fn test_ls_i() { new_ucmd!().arg("-i").succeeds(); new_ucmd!().arg("-il").succeeds(); } +#[test] +fn test_ls_a() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch(".test-1"); + + let result = scene.ucmd().run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(!result.stdout.contains(".test-1")); + assert!(!result.stdout.contains("..")); + + let result = scene.ucmd().arg("-a").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(result.stdout.contains(".test-1")); + assert!(result.stdout.contains("..")); + + let result = scene.ucmd().arg("-A").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(result.stdout.contains(".test-1")); + assert!(!result.stdout.contains("..")); +} + +#[test] +fn test_ls_long() { + #[cfg(not(windows))] + let mut last; + #[cfg(not(windows))] + { + let _guard = UMASK_MUTEX.lock(); + last = unsafe { umask(0) }; + + unsafe { + umask(0o002); + } + } + + let (at, mut ucmd) = at_and_ucmd!(); + at.touch(&at.plus_as_string("test-long")); + let result = ucmd.arg("-l").arg("test-long").succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + #[cfg(not(windows))] + assert!(result.stdout.contains("-rw-rw-r--")); + + #[cfg(windows)] + assert!(result.stdout.contains("---------- 1 somebody somegroup")); + + #[cfg(not(windows))] + { + unsafe { + umask(last); + } + } +} + +#[test] +fn test_ls_deref() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let path_regexp = r"(.*)test-long.link -> (.*)test-long(.*)"; + let re = Regex::new(path_regexp).unwrap(); + + at.touch(&at.plus_as_string("test-long")); + at.symlink_file("test-long", "test-long.link"); + assert!(at.is_symlink("test-long.link")); + + let result = scene + .ucmd() + .arg("-l") + .arg("--color=never") + .arg("test-long") + .arg("test-long.link") + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(re.is_match(&result.stdout.trim())); + + let result = scene + .ucmd() + .arg("-L") + .arg("--color=never") + .arg("test-long") + .arg("test-long.link") + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(!re.is_match(&result.stdout.trim())); +} + +#[test] +fn test_ls_order_size() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("test-1"); + at.append("test-1", "1"); + + at.touch("test-2"); + at.append("test-2", "22"); + at.touch("test-3"); + at.append("test-3", "333"); + at.touch("test-4"); + at.append("test-4", "4444"); + + let result = scene.ucmd().arg("-al").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + + let result = scene.ucmd().arg("-S").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + #[cfg(not(windows))] + assert_eq!(result.stdout, "test-4\ntest-3\ntest-2\ntest-1\n"); + #[cfg(windows)] + assert_eq!(result.stdout, "test-4 test-3 test-2 test-1\n"); + + let result = scene.ucmd().arg("-S").arg("-r").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + #[cfg(not(windows))] + assert_eq!(result.stdout, "test-1\ntest-2\ntest-3\ntest-4\n"); + #[cfg(windows)] + assert_eq!(result.stdout, "test-1 test-2 test-3 test-4\n"); +} + +#[test] +fn test_ls_order_creation() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("test-1"); + at.append("test-1", "1"); + sleep(Duration::from_millis(500)); + at.touch("test-2"); + at.append("test-2", "22"); + sleep(Duration::from_millis(500)); + at.touch("test-3"); + at.append("test-3", "333"); + sleep(Duration::from_millis(500)); + at.touch("test-4"); + at.append("test-4", "4444"); + + let result = scene.ucmd().arg("-al").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + + let result = scene.ucmd().arg("-t").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + #[cfg(not(windows))] + assert_eq!(result.stdout, "test-4\ntest-3\ntest-2\ntest-1\n"); + #[cfg(windows)] + assert_eq!(result.stdout, "test-4 test-3 test-2 test-1\n"); + + let result = scene.ucmd().arg("-t").arg("-r").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + #[cfg(not(windows))] + assert_eq!(result.stdout, "test-1\ntest-2\ntest-3\ntest-4\n"); + #[cfg(windows)] + assert_eq!(result.stdout, "test-1 test-2 test-3 test-4\n"); +} + #[test] fn test_ls_non_existing() { new_ucmd!().arg("doesntexist").fails(); @@ -68,16 +263,23 @@ fn test_ls_recursive() { println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); - if cfg!(target_os = "windows") { - assert!(result.stdout.contains("a\\b:\nb")); - } else { - assert!(result.stdout.contains("a/b:\nb")); - } + #[cfg(not(windows))] + assert!(result.stdout.contains("a/b:\nb")); + #[cfg(windows)] + assert!(result.stdout.contains("a\\b:\nb")); } #[test] fn test_ls_ls_color() { - new_ucmd!().arg("--color").succeeds(); - new_ucmd!().arg("--color=always").succeeds(); - new_ucmd!().arg("--color=never").succeeds(); + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.mkdir("a"); + at.mkdir("z"); + at.touch(&at.plus_as_string("a/a")); + scene.ucmd().arg("--color").succeeds(); + scene.ucmd().arg("--color=always").succeeds(); + scene.ucmd().arg("--color=never").succeeds(); + scene.ucmd().arg("--color").arg("a").succeeds(); + scene.ucmd().arg("--color=always").arg("a/a").succeeds(); + scene.ucmd().arg("--color=never").arg("z").succeeds(); } From b133e28d3eaeb52dc71ef58ef29059eddd318121 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 15 Dec 2020 13:36:12 +0100 Subject: [PATCH 249/606] test(ls) - also test the -h option --- tests/by-util/test_ls.rs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 847f1c591..425bd2623 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -60,7 +60,7 @@ fn test_ls_a() { #[test] fn test_ls_long() { #[cfg(not(windows))] - let mut last; + let last; #[cfg(not(windows))] { let _guard = UMASK_MUTEX.lock(); @@ -263,6 +263,7 @@ fn test_ls_recursive() { println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); + assert!(result.success); #[cfg(not(windows))] assert!(result.stdout.contains("a/b:\nb")); #[cfg(windows)] @@ -283,3 +284,26 @@ fn test_ls_ls_color() { scene.ucmd().arg("--color=always").arg("a/a").succeeds(); scene.ucmd().arg("--color=never").arg("z").succeeds(); } + +#[cfg(not(target_os = "macos"))] // Truncate not available on mac +#[test] +fn test_ls_human() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let file = "test_human"; + let result = scene.cmd("truncate").arg("-s").arg("+1000").arg(file).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + let result = scene.ucmd().arg("-hl").arg(file).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(result.stdout.contains("1.00K")); + let result = scene.cmd("truncate").arg("-s").arg("+1000k").arg(file).run(); + let result = scene.ucmd().arg("-hl").arg(file).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(result.stdout.contains("1.02M")); +} From 2916e8d811c32e7074e71edb21748fb9287478b5 Mon Sep 17 00:00:00 2001 From: Hiroki Noda Date: Tue, 15 Dec 2020 23:49:57 +0100 Subject: [PATCH 250/606] tee: implement ignore-interrupts option --- src/uu/tee/src/tee.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index f715f9e7c..8998e6b77 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -12,6 +12,7 @@ extern crate uucore; use std::fs::OpenOptions; use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write}; use std::path::{Path, PathBuf}; +use uucore::libc; static NAME: &str = "tee"; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -38,7 +39,11 @@ fn options(args: &[String]) -> Result { let mut opts = getopts::Options::new(); opts.optflag("a", "append", "append to the given FILEs, do not overwrite"); - opts.optflag("i", "ignore-interrupts", "ignore interrupt signals"); + opts.optflag( + "i", + "ignore-interrupts", + "ignore interrupt signals (ignored on non-Unix platforms)", + ); opts.optflag("h", "help", "display this help and exit"); opts.optflag("V", "version", "output version information and exit"); @@ -86,7 +91,25 @@ fn exec(options: Options) -> Result<()> { } } +#[cfg(unix)] +fn ignore_interrupts() -> Result<()> { + let ret = unsafe { libc::signal(libc::SIGINT, libc::SIG_IGN) }; + if ret == libc::SIG_ERR { + return Err(Error::new(ErrorKind::Other, "")); + } + Ok(()) +} + +#[cfg(not(unix))] +fn ignore_interrupts() -> Result<()> { + // Do nothing. + Ok(()) +} + fn tee(options: Options) -> Result<()> { + if options.ignore_interrupts { + ignore_interrupts()? + } let mut writers: Vec> = options .files .clone() From 607b70a896807372556f9760bcd1c004797ff36c Mon Sep 17 00:00:00 2001 From: Gabriel Ganne Date: Wed, 16 Dec 2020 00:12:47 +0100 Subject: [PATCH 251/606] base32/base64: tolerate non-utf8 encoded inputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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" --- src/uu/base32/src/base_common.rs | 9 +++++++-- src/uu/base64/src/base_common.rs | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/uu/base32/src/base_common.rs b/src/uu/base32/src/base_common.rs index f6db40692..3f1436fb2 100644 --- a/src/uu/base32/src/base_common.rs +++ b/src/uu/base32/src/base_common.rs @@ -8,7 +8,7 @@ // that was distributed with this source code. use std::fs::File; -use std::io::{stdin, BufReader, Read}; +use std::io::{stdin, stdout, BufReader, Read, Write}; use std::path::Path; use uucore::encoding::{wrap_print, Data, Format}; @@ -85,7 +85,12 @@ fn handle_input( wrap_print(&data, encoded); } else { match data.decode() { - Ok(s) => print!("{}", String::from_utf8(s).unwrap()), + Ok(s) => { + if stdout().write_all(&s).is_err() { + // on windows console, writing invalid utf8 returns an error + crash!(1, "Cannot write non-utf8 data"); + } + } Err(_) => crash!(1, "invalid input"), } } diff --git a/src/uu/base64/src/base_common.rs b/src/uu/base64/src/base_common.rs index f6db40692..3f1436fb2 100644 --- a/src/uu/base64/src/base_common.rs +++ b/src/uu/base64/src/base_common.rs @@ -8,7 +8,7 @@ // that was distributed with this source code. use std::fs::File; -use std::io::{stdin, BufReader, Read}; +use std::io::{stdin, stdout, BufReader, Read, Write}; use std::path::Path; use uucore::encoding::{wrap_print, Data, Format}; @@ -85,7 +85,12 @@ fn handle_input( wrap_print(&data, encoded); } else { match data.decode() { - Ok(s) => print!("{}", String::from_utf8(s).unwrap()), + Ok(s) => { + if stdout().write_all(&s).is_err() { + // on windows console, writing invalid utf8 returns an error + crash!(1, "Cannot write non-utf8 data"); + } + } Err(_) => crash!(1, "invalid input"), } } From 5a62dcafaa9f065f343f14c178c292f077a5347d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 16 Dec 2020 23:52:42 +0100 Subject: [PATCH 252/606] 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 $? --- src/uu/cp/src/cp.rs | 19 +++++++++++-------- tests/by-util/test_cp.rs | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 73713555a..e933ce338 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -814,10 +814,17 @@ fn copy(sources: &[Source], target: &Target, options: &Options) -> CopyResult<() } if !found_hard_link { if let Err(error) = copy_source(source, target, &target_type, options) { - show_error!("{}", error); match error { - Error::Skipped(_) => (), - _ => non_fatal_errors = true, + // When using --no-clobber, we don't want to show + // an error message + Error::NotAllFilesCopied => (), + Error::Skipped(_) => { + show_error!("{}", error); + } + _ => { + show_error!("{}", error); + non_fatal_errors = true + } } } } @@ -993,11 +1000,7 @@ fn copy_directory(root: &Path, target: &Target, options: &Options) -> CopyResult impl OverwriteMode { fn verify(&self, path: &Path) -> CopyResult<()> { match *self { - OverwriteMode::NoClobber => Err(Error::Skipped(format!( - "Not overwriting {} because of option '{}'", - path.display(), - OPT_NO_CLOBBER - ))), + OverwriteMode::NoClobber => Err(Error::NotAllFilesCopied), OverwriteMode::Interactive(_) => { if prompt_yes!("{}: overwrite {}? ", executable!(), path.display()) { Ok(()) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 47d28f63a..e7ea67d19 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -255,7 +255,40 @@ fn test_cp_arg_no_clobber() { assert!(result.success); assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "How are you?\n"); - assert!(result.stderr.contains("Not overwriting")); +} + +#[test] +fn test_cp_arg_no_clobber_twice() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch("source.txt"); + let result = scene + .ucmd() + .arg("--no-clobber") + .arg("source.txt") + .arg("dest.txt") + .run(); + + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(result.stderr.is_empty()); + assert_eq!(at.read("source.txt"), ""); + + at.append("source.txt", "some-content"); + let result = scene + .ucmd() + .arg("--no-clobber") + .arg("source.txt") + .arg("dest.txt") + .run(); + + assert!(result.success); + assert_eq!(at.read("source.txt"), "some-content"); + // Should be empty as the "no-clobber" should keep + // the previous version + assert_eq!(at.read("dest.txt"), ""); + assert!(!result.stderr.contains("Not overwriting")); } #[test] From c506b5402b635cd58a60011d8798e685ab745c19 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 17 Dec 2020 20:50:22 +0100 Subject: [PATCH 253/606] fix clippy warnings --- src/uu/tee/src/tee.rs | 2 ++ tests/by-util/test_ls.rs | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index 8998e6b77..1f6e26541 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -12,6 +12,8 @@ extern crate uucore; use std::fs::OpenOptions; use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write}; use std::path::{Path, PathBuf}; + +#[cfg(unix)] use uucore::libc; static NAME: &str = "tee"; diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 425bd2623..270849d95 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -289,18 +289,21 @@ fn test_ls_ls_color() { #[test] fn test_ls_human() { let scene = TestScenario::new(util_name!()); - let at = &scene.fixtures; let file = "test_human"; let result = scene.cmd("truncate").arg("-s").arg("+1000").arg(file).run(); println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); - assert!(result.success); let result = scene.ucmd().arg("-hl").arg(file).run(); println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(result.success); assert!(result.stdout.contains("1.00K")); - let result = scene.cmd("truncate").arg("-s").arg("+1000k").arg(file).run(); + scene + .cmd("truncate") + .arg("-s") + .arg("+1000k") + .arg(file) + .run(); let result = scene.ucmd().arg("-hl").arg(file).run(); println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); From 718695d54141df4351186fa7a11028dd7a0b47e7 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 17 Dec 2020 23:41:52 +0100 Subject: [PATCH 254/606] 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 --- src/uu/install/src/install.rs | 1 - src/uucore/src/lib/features/mode.rs | 2 +- tests/by-util/test_install.rs | 28 ++++++++++++++++++++++++++-- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 37f69a2f0..cf500c9de 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -146,7 +146,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("set permission mode (as in chmod), instead of rwxr-xr-x") .value_name("MODE") .takes_value(true) - .min_values(1) ) .arg( Arg::with_name(OPT_OWNER) diff --git a/src/uucore/src/lib/features/mode.rs b/src/uucore/src/lib/features/mode.rs index 50679d107..8b5e71799 100644 --- a/src/uucore/src/lib/features/mode.rs +++ b/src/uucore/src/lib/features/mode.rs @@ -9,7 +9,7 @@ pub fn parse_numeric(fperm: u32, mut mode: &str) -> Result { let (op, pos) = parse_op(mode, Some('='))?; - mode = mode[pos..].trim_start_matches('0'); + mode = mode[pos..].trim().trim_start_matches('0'); if mode.len() > 4 { Err(format!("mode is too large ({} > 7777)", mode)) } else { diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 89ae515a7..99e2abfd4 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -102,20 +102,44 @@ fn test_install_component_directories() { #[test] fn test_install_mode_numeric() { - let (at, mut ucmd) = at_and_ucmd!(); + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; let dir = "test_install_target_dir_dir_e"; + let dir2 = "test_install_target_dir_dir_e2"; + let file = "test_install_target_dir_file_e"; let mode_arg = "--mode=333"; at.touch(file); at.mkdir(dir); - ucmd.arg(file).arg(dir).arg(mode_arg).succeeds().no_stderr(); + scene + .ucmd() + .arg(file) + .arg(dir) + .arg(mode_arg) + .succeeds() + .no_stderr(); let dest_file = &format!("{}/{}", dir, file); assert!(at.file_exists(file)); assert!(at.file_exists(dest_file)); let permissions = at.metadata(dest_file).permissions(); assert_eq!(0o100333 as u32, PermissionsExt::mode(&permissions)); + + let mode_arg = "-m 0333"; + at.mkdir(dir2); + + let result = scene.ucmd().arg(mode_arg).arg(file).arg(dir2).run(); + + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + + assert!(result.success); + let dest_file = &format!("{}/{}", dir2, file); + assert!(at.file_exists(file)); + assert!(at.file_exists(dest_file)); + let permissions = at.metadata(dest_file).permissions(); + assert_eq!(0o100333 as u32, PermissionsExt::mode(&permissions)); } #[test] From dbc716546b352c8b81af1952915137049ed12239 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 18 Dec 2020 14:41:59 +0100 Subject: [PATCH 255/606] 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 --- src/uu/mkdir/src/mkdir.rs | 1 + tests/by-util/test_mkdir.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index ae95e2126..88580a96e 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -50,6 +50,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(OPT_PARENTS) .short("p") .long(OPT_PARENTS) + .alias("parent") .help("make parent directories as needed"), ) .arg( diff --git a/tests/by-util/test_mkdir.rs b/tests/by-util/test_mkdir.rs index 73be9b253..ef3226c41 100644 --- a/tests/by-util/test_mkdir.rs +++ b/tests/by-util/test_mkdir.rs @@ -40,6 +40,8 @@ fn test_mkdir_parent() { let scene = TestScenario::new(util_name!()); scene.ucmd().arg("-p").arg(TEST_DIR4).succeeds(); scene.ucmd().arg("-p").arg(TEST_DIR4).succeeds(); + scene.ucmd().arg("--parent").arg(TEST_DIR4).succeeds(); + scene.ucmd().arg("--parents").arg(TEST_DIR4).succeeds(); } #[test] From 469abf24275c2e785cf3b453ba0e0a64e1afb362 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 19 Dec 2020 11:17:41 +0100 Subject: [PATCH 256/606] 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 --- src/uu/seq/src/seq.rs | 4 +++- tests/by-util/test_seq.rs | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index d531ffb12..d7fb2de48 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -8,7 +8,7 @@ extern crate clap; #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{App, AppSettings, Arg}; use std::cmp; use std::io::{stdout, Write}; @@ -55,6 +55,7 @@ fn escape_sequences(s: &str) -> String { pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); let matches = App::new(executable!()) + .setting(AppSettings::AllowLeadingHyphen) .version(VERSION) .about(ABOUT) .usage(&usage[..]) @@ -84,6 +85,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(ARG_NUMBERS) .multiple(true) .takes_value(true) + .allow_hyphen_values(true) .max_values(3), ) .get_matches_from(args); diff --git a/tests/by-util/test_seq.rs b/tests/by-util/test_seq.rs index 9ee5c94aa..5e60ab5de 100644 --- a/tests/by-util/test_seq.rs +++ b/tests/by-util/test_seq.rs @@ -14,6 +14,10 @@ fn test_count_down() { .args(&["--", "5", "-1", "1"]) .run() .stdout_is("5\n4\n3\n2\n1\n"); + new_ucmd!() + .args(&["5", "-1", "1"]) + .run() + .stdout_is("5\n4\n3\n2\n1\n"); } #[test] From 8b126868884d29b66beff21bbfb066cc4125fd63 Mon Sep 17 00:00:00 2001 From: Diego Magdaleno <38844659+DiegoMagdaleno@users.noreply.github.com> Date: Sat, 19 Dec 2020 10:54:28 -0600 Subject: [PATCH 257/606] 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 --- src/uu/ls/src/ls.rs | 14 +++++++++++++- tests/by-util/test_ls.rs | 26 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 20100568a..a2f8cab95 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -255,6 +255,18 @@ fn sort_entries(entries: &mut Vec, options: &getopts::Matches) { } } +#[cfg(windows)] +fn is_hidden(file_path: &DirEntry) -> std::io::Result { + let metadata = fs::metadata(file_path.path())?; + let attr = metadata.file_attributes(); + Ok(((attr & 0x2) > 0) || file_path.file_name().to_string_lossy().starts_with('.')) +} + +#[cfg(unix)] +fn is_hidden(file_path: &DirEntry) -> std::io::Result { + Ok(file_path.file_name().to_string_lossy().starts_with('.')) +} + #[cfg(windows)] fn sort_entries(entries: &mut Vec, options: &getopts::Matches) { let mut reverse = options.opt_present("r"); @@ -286,7 +298,7 @@ fn sort_entries(entries: &mut Vec, options: &getopts::Matches) { fn should_display(entry: &DirEntry, options: &getopts::Matches) -> bool { let ffi_name = entry.file_name(); let name = ffi_name.to_string_lossy(); - if !options.opt_present("a") && !options.opt_present("A") && name.starts_with('.') { + if !options.opt_present("a") && !options.opt_present("A") && is_hidden(entry).unwrap() { return false; } if options.opt_present("B") && name.ends_with('~') { diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 270849d95..4dc4168de 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -310,3 +310,29 @@ fn test_ls_human() { assert!(result.success); assert!(result.stdout.contains("1.02M")); } + +#[cfg(windows)] +#[test] +fn test_ls_hidden_windows() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let file = "hiddenWindowsFileNoDot"; + at.touch(file); + // hide the file + scene + .cmd("attrib") + .arg("+h") + .arg("+S") + .arg("+r") + .arg(file) + .run(); + let result = scene.ucmd().run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + let result = scene.ucmd().arg("-a").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(result.stdout.contains(file)); +} From d5764b3096b821f9388c53d5ec73cafda87a94c1 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 21 Dec 2020 21:27:53 +0100 Subject: [PATCH 258/606] Remove useless directive from the GNUmakefile (#1669) --- GNUmakefile | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 01b234a47..ff5a064ca 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -236,18 +236,6 @@ ifeq (${MULTICALL}, y) INSTALLEES := ${INSTALLEES} uutils endif -# Shared library extension -SYSTEM := $(shell uname) -DYLIB_EXT := -ifeq ($(SYSTEM),Linux) - DYLIB_EXT := so - DYLIB_FLAGS := -shared -endif -ifeq ($(SYSTEM),Darwin) - DYLIB_EXT := dylib - DYLIB_FLAGS := -dynamiclib -undefined dynamic_lookup -endif - all: build do_install = $(INSTALL) ${1} From 36d903e611f17504390ed0e4f32c87d1a85c9d3c Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 22 Dec 2020 13:53:20 +0100 Subject: [PATCH 259/606] number-prefix: Move from 0.2 to 0.4 (#1670) --- Cargo.lock | 39 ++++++++++++++++++--------------------- src/uu/df/Cargo.toml | 2 +- src/uu/df/src/df.rs | 14 +++++++------- src/uu/ls/Cargo.toml | 2 +- src/uu/ls/src/ls.rs | 10 ++++++---- 5 files changed, 33 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 955626985..607f0d176 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -819,11 +819,8 @@ dependencies = [ [[package]] name = "number_prefix" -version = "0.2.8" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "numtoa" @@ -938,7 +935,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "quote" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1152,8 +1149,8 @@ version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1219,11 +1216,11 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.54" +version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1517,7 +1514,7 @@ version = "0.0.1" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", "uucore_procs 0.0.4", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1760,7 +1757,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2357,8 +2354,8 @@ name = "uucore_procs" version = "0.0.4" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2404,8 +2401,8 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2414,7 +2411,7 @@ name = "wasm-bindgen-macro" version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-macro-support 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2424,8 +2421,8 @@ version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2586,7 +2583,7 @@ dependencies = [ "checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" "checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" "checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -"checksum number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee" +"checksum number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" "checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" "checksum onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" "checksum onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" @@ -2602,7 +2599,7 @@ dependencies = [ "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" "checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +"checksum quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" "checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" "checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" "checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" @@ -2637,7 +2634,7 @@ dependencies = [ "checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 1.0.54 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44" +"checksum syn 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)" = "a571a711dddd09019ccc628e1b17fe87c59b09d513c06c026877aa708334f37a" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 02ac86fdd..170adaa02 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -17,7 +17,7 @@ path = "src/df.rs" [dependencies] clap = "2.33" libc = "0.2" -number_prefix = "0.2" +number_prefix = "0.4" uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index 36edc4ff2..58b0be4ed 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -28,7 +28,7 @@ use winapi::um::fileapi::{ GetVolumePathNamesForVolumeNameW, QueryDosDeviceW, }; -use number_prefix::{binary_prefix, decimal_prefix, PrefixNames, Prefixed, Standalone}; +use number_prefix::NumberPrefix; use std::cell::Cell; use std::collections::HashMap; use std::collections::HashSet; @@ -716,14 +716,14 @@ fn human_readable(value: u64, base: i64) -> String { // ref: [Binary prefix](https://en.wikipedia.org/wiki/Binary_prefix) @@ // ref: [SI/metric prefix](https://en.wikipedia.org/wiki/Metric_prefix) @@ - 1000 => match decimal_prefix(value as f64) { - Standalone(bytes) => bytes.to_string(), - Prefixed(prefix, bytes) => format!("{:.1}{}", bytes, prefix.symbol()), + 1000 => match NumberPrefix::decimal(value as f64) { + NumberPrefix::Standalone(bytes) => bytes.to_string(), + NumberPrefix::Prefixed(prefix, bytes) => format!("{:.1}{}", bytes, prefix.symbol()), }, - 1024 => match binary_prefix(value as f64) { - Standalone(bytes) => bytes.to_string(), - Prefixed(prefix, bytes) => format!("{:.1}{}", bytes, prefix.symbol()), + 1024 => match NumberPrefix::binary(value as f64) { + NumberPrefix::Standalone(bytes) => bytes.to_string(), + NumberPrefix::Prefixed(prefix, bytes) => format!("{:.1}{}", bytes, prefix.symbol()), }, _ => crash!(EXIT_ERR, "Internal error: Unknown base value {}", base), diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index 93ccefe68..f53026d19 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -18,7 +18,7 @@ path = "src/ls.rs" getopts = "0.2.18" isatty = "0.1" lazy_static = "1.0.1" -number_prefix = "0.2.8" +number_prefix = "0.4" term_grid = "0.1.5" termsize = "0.1.6" time = "0.1.40" diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index a2f8cab95..5a20478bc 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -24,7 +24,7 @@ extern crate uucore; #[cfg(unix)] use isatty::stdout_isatty; -use number_prefix::{decimal_prefix, Prefixed, Standalone}; +use number_prefix::NumberPrefix; use std::cmp::Reverse; #[cfg(unix)] use std::collections::HashMap; @@ -525,9 +525,11 @@ fn display_date(metadata: &Metadata, options: &getopts::Matches) -> String { fn display_file_size(metadata: &Metadata, options: &getopts::Matches) -> String { if options.opt_present("human-readable") { - match decimal_prefix(metadata.len() as f64) { - Standalone(bytes) => bytes.to_string(), - Prefixed(prefix, bytes) => format!("{:.2}{}", bytes, prefix).to_uppercase(), + match NumberPrefix::decimal(metadata.len() as f64) { + NumberPrefix::Standalone(bytes) => bytes.to_string(), + NumberPrefix::Prefixed(prefix, bytes) => { + format!("{:.2}{}", bytes, prefix).to_uppercase() + } } } else { metadata.len().to_string() From 10cd480a0134fd2282ae0379284c64f17cfcf2c3 Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Fri, 25 Dec 2020 03:41:48 -0800 Subject: [PATCH 260/606] rm: allow "-f" to be specified multiple times (#1667) This matches the behavior of GNU rm. Fixes #1663. Co-authored-by: Kevin Burke --- src/uu/rm/src/rm.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index eaacb9555..28f854319 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -92,6 +92,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(OPT_FORCE) .short("f") .long(OPT_FORCE) + .multiple(true) .help("ignore nonexistent files and arguments, never prompt") ) .arg( From da362ced71e0262f859092610b4ee780ad25369c Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 25 Dec 2020 14:21:47 +0100 Subject: [PATCH 261/606] test(rm): Add a test for multiple -f (#1671) --- tests/by-util/test_rm.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 7c5a1c787..f9a4dd0d5 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -85,6 +85,24 @@ fn test_rm_force() { assert!(!at.file_exists(file_b)); } +#[test] +fn test_rm_force_multiple() { + let (at, mut ucmd) = at_and_ucmd!(); + let file_a = "test_rm_force_a"; + let file_b = "test_rm_force_b"; + + ucmd.arg("-f") + .arg("-f") + .arg("-f") + .arg(file_a) + .arg(file_b) + .succeeds() + .no_stderr(); + + assert!(!at.file_exists(file_a)); + assert!(!at.file_exists(file_b)); +} + #[test] fn test_rm_empty_directory() { let (at, mut ucmd) = at_and_ucmd!(); From 89bf7a726e37fb1f9c30a0e348ccb1e69569d20f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Campinas?= Date: Sun, 27 Dec 2020 15:24:02 +0100 Subject: [PATCH 262/606] csplit: refresh of the previous PR --- Cargo.toml | 3 + GNUmakefile | 2 + src/uu/csplit/Cargo.toml | 27 + src/uu/csplit/src/csplit.rs | 760 +++++++++++++++ src/uu/csplit/src/csplitError.rs | 34 + src/uu/csplit/src/main.rs | 2 + src/uu/csplit/src/patterns.rs | 353 +++++++ src/uu/csplit/src/splitname.rs | 397 ++++++++ tests/by-util/test_csplit.rs | 1335 +++++++++++++++++++++++++++ tests/fixtures/csplit/numbers50.txt | 50 + 10 files changed, 2963 insertions(+) create mode 100644 src/uu/csplit/Cargo.toml create mode 100644 src/uu/csplit/src/csplit.rs create mode 100644 src/uu/csplit/src/csplitError.rs create mode 100644 src/uu/csplit/src/main.rs create mode 100644 src/uu/csplit/src/patterns.rs create mode 100644 src/uu/csplit/src/splitname.rs create mode 100644 tests/by-util/test_csplit.rs create mode 100644 tests/fixtures/csplit/numbers50.txt diff --git a/Cargo.toml b/Cargo.toml index 1e6172d49..d937ade3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,6 +37,7 @@ feat_common_core = [ "cksum", "comm", "cp", + "csplit", "cut", "date", "df", @@ -241,6 +242,7 @@ chroot = { optional=true, version="0.0.1", package="uu_chroot", path="src/uu/c cksum = { optional=true, version="0.0.1", package="uu_cksum", path="src/uu/cksum" } comm = { optional=true, version="0.0.1", package="uu_comm", path="src/uu/comm" } cp = { optional=true, version="0.0.1", package="uu_cp", path="src/uu/cp" } +csplit = { optional=true, version="0.0.1", package="uu_csplit", path="src/uu/csplit" } cut = { optional=true, version="0.0.1", package="uu_cut", path="src/uu/cut" } date = { optional=true, version="0.0.1", package="uu_date", path="src/uu/date" } df = { optional=true, version="0.0.1", package="uu_df", path="src/uu/df" } @@ -332,6 +334,7 @@ pin_winapi-util = { version="0.1.2, < 0.1.3", package="winapi-util" } ## winapi- [dev-dependencies] conv = "0.3" filetime = "0.2" +glob = "0.3.0" libc = "0.2" rand = "0.7" regex = "1.0" diff --git a/GNUmakefile b/GNUmakefile index ff5a064ca..3eacc8659 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -53,6 +53,7 @@ PROGS := \ cksum \ comm \ cp \ + csplit \ cut \ df \ dircolors \ @@ -160,6 +161,7 @@ TEST_PROGS := \ cksum \ comm \ cp \ + csplit \ cut \ dircolors \ dirname \ diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml new file mode 100644 index 000000000..f44f80da0 --- /dev/null +++ b/src/uu/csplit/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "uu_csplit" +version = "0.0.1" +authors = ["uutils developers"] +license = "MIT" +description = "csplit ~ (uutils) Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output" + +homepage = "https://github.com/uutils/coreutils" +repository = "https://github.com/uutils/coreutils/tree/master/src/uu/ls" +keywords = ["coreutils", "uutils", "cross-platform", "cli", "utility"] +categories = ["command-line-utilities"] +edition = "2018" + +[lib] +path = "src/csplit.rs" + +[dependencies] +getopts = "0.2.17" +failure = "0.1.1" +failure_derive = "0.1.1" +regex = "1.0.0" +glob = "0.2.11" +uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } + +[[bin]] +name = "csplit" +path = "src/main.rs" diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs new file mode 100644 index 000000000..efdb12738 --- /dev/null +++ b/src/uu/csplit/src/csplit.rs @@ -0,0 +1,760 @@ +#![crate_name = "uu_csplit"] + +#[macro_use] +extern crate failure; +#[macro_use] +extern crate uucore; +extern crate getopts; +extern crate regex; +use std::{fs::{File, remove_file}, io::{BufRead, BufWriter, Write}}; +use std::io::{self, BufReader}; +use getopts::Matches; +use regex::Regex; +/* +mod split_name; +mod patterns; +*/ +mod splitname; +mod patterns; +mod csplitError; + +use crate::splitname::SplitName; +use crate::csplitError::CsplitError; +//mod split_name; + + +//mod csplit; + +static SYNTAX: &'static str = "[OPTION]... FILE PATTERN..."; +static SUMMARY: &'static str = "split a file into sections determined by context lines"; +static LONG_HELP: &'static str = "Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output."; + +static SUFFIX_FORMAT_OPT: &'static str = "suffix-format"; +static SUPPRESS_MATCHED_OPT: &'static str = "suppress-matched"; +static DIGITS_OPT: &'static str = "digits"; +static PREFIX_OPT: &'static str = "prefix"; +static KEEP_FILES_OPT: &'static str = "keep-files"; +static QUIET_OPT: &'static str = "quiet"; +static ELIDE_EMPTY_FILES_OPT: &'static str = "elide-empty-files"; + +/// Command line options for csplit. +pub struct CsplitOptions { + split_name: crate::SplitName, + keep_files: bool, + quiet: bool, + elide_empty_files: bool, + suppress_matched: bool, +} + +impl CsplitOptions { + fn new(matches: &Matches) -> CsplitOptions { + let keep_files = matches.opt_present(KEEP_FILES_OPT); + let quiet = matches.opt_present(QUIET_OPT); + let elide_empty_files = matches.opt_present(ELIDE_EMPTY_FILES_OPT); + let suppress_matched = matches.opt_present(SUPPRESS_MATCHED_OPT); + + CsplitOptions { + split_name: crash_if_err!( + 1, + SplitName::new( + matches.opt_str(PREFIX_OPT), + matches.opt_str(SUFFIX_FORMAT_OPT), + matches.opt_str(DIGITS_OPT) + ) + ), + keep_files, + quiet, + elide_empty_files, + suppress_matched, + } + } +} + +/// Splits a file into severals according to the command line patterns. +/// +/// # Errors +/// +/// - [`io::Error`] if there is some problem reading/writing from/to a file. +/// - [`::CsplitError::LineOutOfRange`] if the linenum pattern is larger than the number of input +/// lines. +/// - [`::CsplitError::LineOutOfRangeOnRepetition`], like previous but after applying the pattern +/// more than once. +/// - [`::CsplitError::MatchNotFound`] if no line matched a regular expression. +/// - [`::CsplitError::MatchNotFoundOnRepetition`], like previous but after applying the pattern +/// more than once. +pub fn csplit( + options: &CsplitOptions, + patterns: Vec, + input: T, +) -> Result<(), CsplitError> +where + T: BufRead, +{ + let mut input_iter = InputSplitter::new(input.lines().enumerate()); + let mut split_writer = SplitWriter::new(&options)?; + let ret = do_csplit(&mut split_writer, patterns, &mut input_iter); + + // consume the rest + input_iter.rewind_buffer(); + if let Some((_, line)) = input_iter.next() { + split_writer.new_writer()?; + split_writer.writeln(line?)?; + for (_, line) in input_iter { + split_writer.writeln(line?)?; + } + split_writer.finish_split()?; + } + // delete files on error by default + if ret.is_err() && !options.keep_files { + split_writer.delete_all_splits()?; + } + ret +} + +fn do_csplit( + split_writer: &mut SplitWriter, + patterns: Vec, + input_iter: &mut InputSplitter, +) -> Result<(), CsplitError> +where + I: Iterator)>, +{ + // split the file based on patterns + for pattern in patterns.into_iter() { + let pattern_as_str = pattern.to_string(); + let is_skip = if let patterns::Pattern::SkipToMatch(_, _, _) = pattern { + true + } else { + false + }; + match pattern { + patterns::Pattern::UpToLine(n, ex) => { + let mut up_to_line = n; + for (_, ith) in ex.iter() { + split_writer.new_writer()?; + match split_writer.do_to_line(&pattern_as_str, up_to_line, input_iter) { + // the error happened when applying the pattern more than once + Err(CsplitError::LineOutOfRange(_)) if ith != 1 => { + return Err(CsplitError::LineOutOfRangeOnRepetition( + pattern_as_str.to_string(), + ith - 1, + )); + } + Err(err) => return Err(err), + // continue the splitting process + Ok(()) => (), + } + up_to_line += n; + } + } + patterns::Pattern::UpToMatch(regex, offset, ex) + | patterns::Pattern::SkipToMatch(regex, offset, ex) => { + for (max, ith) in ex.iter() { + if is_skip { + // when skipping a part of the input, no writer is created + split_writer.as_dev_null(); + } else { + split_writer.new_writer()?; + } + match ( + split_writer.do_to_match(&pattern_as_str, ®ex, offset, input_iter), + max, + ) { + // in case of ::pattern::ExecutePattern::Always, then it's fine not to find a + // matching line + (Err(CsplitError::MatchNotFound(_)), None) => { + return Ok(()); + } + // the error happened when applying the pattern more than once + (Err(CsplitError::MatchNotFound(_)), Some(m)) if m != 1 && ith != 1 => { + return Err(CsplitError::MatchNotFoundOnRepetition( + pattern_as_str.to_string(), + ith - 1, + )); + } + (Err(err), _) => return Err(err), + // continue the splitting process + (Ok(()), _) => (), + }; + } + } + }; + } + Ok(()) +} + +/// Write a portion of the input file into a split which filename is based on an incrementing +/// counter. +struct SplitWriter<'a> { + /// the options set through the command line + options: &'a CsplitOptions, + /// a split counter + counter: usize, + /// the writer to the current split + current_writer: Option>, + /// the size in bytes of the current split + size: usize, + /// flag to indicate that no content should be written to a split + dev_null: bool, +} + +impl<'a> Drop for SplitWriter<'a> { + fn drop(&mut self) { + if self.options.elide_empty_files && self.size == 0 { + let file_name = self.options.split_name.get(self.counter); + remove_file(file_name).expect("Failed to elide split"); + } + } +} + +impl<'a> SplitWriter<'a> { + fn new(options: &CsplitOptions) -> io::Result { + Ok(SplitWriter { + options, + counter: 0, + current_writer: None, + size: 0, + dev_null: false, + }) + } + + /// Creates a new split and returns its filename. + /// + /// # Errors + /// + /// The creation of the split file may fail with some [`io::Error`]. + fn new_writer(&mut self) -> io::Result<()> { + let file_name = self.options.split_name.get(self.counter); + let file = File::create(&file_name)?; + self.current_writer = Some(BufWriter::new(file)); + self.counter += 1; + self.size = 0; + self.dev_null = false; + Ok(()) + } + + /// The current split will not keep any of the read input lines. + fn as_dev_null(&mut self) { + self.dev_null = true; + } + + /// Writes the line to the current split, appending a newline character. + /// If [`dev_null`] is true, then the line is discarded. + /// + /// # Errors + /// + /// Some [`io::Error`] may occur when attempting to write the line. + fn writeln(&mut self, line: String) -> io::Result<()> { + if !self.dev_null { + match self.current_writer { + Some(ref mut current_writer) => { + let bytes = line.as_bytes(); + current_writer.write_all(bytes)?; + current_writer.write(b"\n")?; + self.size += bytes.len() + 1; + } + None => panic!("trying to write to a split that was not created"), + } + } + Ok(()) + } + + /// Perform some operations after completing a split, i.e., either remove it + /// if the [`::ELIDE_EMPTY_FILES_OPT`] option is enabled, or print how much bytes were written + /// to it if [`::QUIET_OPT`] is disabled. + /// + /// # Errors + /// + /// Some [`io::Error`] if the split could not be removed in case it should be elided. + fn finish_split(&mut self) -> io::Result<()> { + if !self.dev_null { + if self.options.elide_empty_files && self.size == 0 { + self.counter -= 1; + } else if !self.options.quiet { + println!("{}", self.size); + } + } + return Ok(()); + } + + /// Removes all the split files that were created. + /// + /// # Errors + /// + /// Returns an [`io::Error`] if there was a problem removing a split. + fn delete_all_splits(&self) -> io::Result<()> { + let mut ret = Ok(()); + for ith in 0..self.counter { + let file_name = self.options.split_name.get(ith); + if let Err(err) = remove_file(file_name) { + ret = Err(err); + } + } + ret + } + + /// Split the input stream up to the line number `n`. + /// + /// If the line number `n` is smaller than the current position in the input, then an empty + /// split is created. + /// + /// # Errors + /// + /// In addition to errors reading/writing from/to a file, if the line number + /// `n` is greater than the total available lines, then a + /// [`::CsplitError::LineOutOfRange`] error is returned. + fn do_to_line( + &mut self, + pattern_as_str: &str, + n: usize, + input_iter: &mut InputSplitter, + ) -> Result<(), CsplitError> + where + I: Iterator)>, + { + input_iter.rewind_buffer(); + input_iter.set_size_of_buffer(1); + + let mut ret = Err(CsplitError::LineOutOfRange(pattern_as_str.to_string())); + while let Some((ln, line)) = input_iter.next() { + let l = line?; + if ln + 1 > n { + if input_iter.add_line_to_buffer(ln, l).is_some() { + panic!("the buffer is big enough to contain 1 line"); + } + ret = Ok(()); + break; + } else if ln + 1 == n { + if !self.options.suppress_matched { + if input_iter.add_line_to_buffer(ln, l).is_some() { + panic!("the buffer is big enough to contain 1 line"); + } + } + ret = Ok(()); + break; + } + self.writeln(l)?; + } + self.finish_split()?; + ret + } + + /// Read lines up to the line matching a [`Regex`]. With a non-zero offset, + /// the block of relevant lines can be extended (if positive), or reduced + /// (if negative). + /// + /// # Errors + /// + /// In addition to errors reading/writing from/to a file, the following errors may be returned: + /// - if no line matched, an [`::CsplitError::MatchNotFound`]. + /// - if there are not enough lines to accomodate the offset, an + /// [`::CsplitError::LineOutOfRange`]. + fn do_to_match( + &mut self, + pattern_as_str: &str, + regex: &Regex, + mut offset: i32, + input_iter: &mut InputSplitter, + ) -> Result<(), CsplitError> + where + I: Iterator)>, + { + if offset >= 0 { + // The offset is zero or positive, no need for a buffer on the lines read. + // NOTE: drain the buffer of input_iter, no match should be done within. + for line in input_iter.drain_buffer() { + self.writeln(line)?; + } + // retain the matching line + input_iter.set_size_of_buffer(1); + + while let Some((ln, line)) = input_iter.next() { + let l = line?; + if regex.is_match(&l) { + match (self.options.suppress_matched, offset) { + // no offset, add the line to the next split + (false, 0) => { + if input_iter.add_line_to_buffer(ln, l).is_some() { + panic!("the buffer is big enough to contain 1 line"); + } + } + // a positive offset, some more lines need to be added to the current split + (false, _) => self.writeln(l)?, + _ => (), + }; + offset -= 1; + + // write the extra lines required by the offset + while offset > 0 { + match input_iter.next() { + Some((_, line)) => { + self.writeln(line?)?; + } + None => { + self.finish_split()?; + return Err(CsplitError::LineOutOfRange( + pattern_as_str.to_string(), + )); + } + }; + offset -= 1; + } + self.finish_split()?; + return Ok(()); + } + self.writeln(l)?; + } + } else { + // With a negative offset we use a buffer to keep the lines within the offset. + // NOTE: do not drain the buffer of input_iter, in case of an LineOutOfRange error + // but do not rewind it either since no match should be done within. + // The consequence is that the buffer may already be full with lines from a previous + // split, which is taken care of when calling `shrink_buffer_to_size`. + let offset_usize = -offset as usize; + input_iter.set_size_of_buffer(offset_usize); + while let Some((ln, line)) = input_iter.next() { + let l = line?; + if regex.is_match(&l) { + for line in input_iter.shrink_buffer_to_size() { + self.writeln(line)?; + } + if !self.options.suppress_matched { + // add 1 to the buffer size to make place for the matched line + input_iter.set_size_of_buffer(offset_usize + 1); + if input_iter.add_line_to_buffer(ln, l).is_some() { + panic!("should be big enough to hold every lines"); + } + } + self.finish_split()?; + if input_iter.buffer_len() < offset_usize { + return Err(CsplitError::LineOutOfRange(pattern_as_str.to_string())); + } + return Ok(()); + } + if let Some(line) = input_iter.add_line_to_buffer(ln, l) { + self.writeln(line)?; + } + } + // no match, drain the buffer into the current split + for line in input_iter.drain_buffer() { + self.writeln(line)?; + } + } + + self.finish_split()?; + Err(CsplitError::MatchNotFound(pattern_as_str.to_string())) + } +} + +/// An iterator which can output items from a buffer filled externally. +/// This is used to pass matching lines to the next split and to support patterns with a negative offset. +struct InputSplitter +where + I: Iterator)>, +{ + iter: I, + buffer: Vec<::Item>, + /// the number of elements the buffer may hold + size: usize, + /// flag to indicate content off the buffer should be returned instead of off the wrapped + /// iterator + rewind: bool, +} + +impl InputSplitter +where + I: Iterator)>, +{ + fn new(iter: I) -> InputSplitter { + InputSplitter { + iter, + buffer: Vec::new(), + rewind: false, + size: 1, + } + } + + /// Rewind the iteration by outputing the buffer's content. + fn rewind_buffer(&mut self) { + self.rewind = true; + } + + /// Shrink the buffer so that its length is equal to the set size, returning an iterator for + /// the elements that were too much. + fn shrink_buffer_to_size<'a>(&'a mut self) -> impl Iterator + 'a { + let mut shrink_offset = 0; + if self.buffer.len() > self.size { + shrink_offset = self.buffer.len() - self.size; + } + self.buffer + .drain(..shrink_offset) + .map(|(_, line)| line.unwrap()) + } + + /// Drain the content of the buffer. + fn drain_buffer<'a>(&'a mut self) -> impl Iterator + 'a { + self.buffer.drain(..).map(|(_, line)| line.unwrap()) + } + + /// Set the maximum number of lines to keep. + fn set_size_of_buffer(&mut self, size: usize) { + self.size = size; + } + + /// Add a line to the buffer. If the buffer has [`size`] elements, then its head is removed and + /// the new line is pushed to the buffer. The removed head is then available in the returned + /// option. + fn add_line_to_buffer(&mut self, ln: usize, line: String) -> Option { + if self.rewind { + self.buffer.insert(0, (ln, Ok(line))); + None + } else if self.buffer.len() >= self.size { + let (_, head_line) = self.buffer.remove(0); + self.buffer.push((ln, Ok(line))); + Some(head_line.unwrap()) + } else { + self.buffer.push((ln, Ok(line))); + None + } + } + + /// Returns the number of lines stored in the buffer + fn buffer_len(&self) -> usize { + self.buffer.len() + } +} + +impl Iterator for InputSplitter +where + I: Iterator)>, +{ + type Item = ::Item; + + fn next(&mut self) -> Option { + if self.rewind { + if !self.buffer.is_empty() { + return Some(self.buffer.remove(0)); + } + self.rewind = false; + } + self.iter.next() + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn input_splitter() { + let input = vec![ + Ok(String::from("aaa")), + Ok(String::from("bbb")), + Ok(String::from("ccc")), + Ok(String::from("ddd")), + ]; + let mut input_splitter = InputSplitter::new(input.into_iter().enumerate()); + + input_splitter.set_size_of_buffer(2); + assert_eq!(input_splitter.buffer_len(), 0); + + match input_splitter.next() { + Some((0, Ok(line))) => { + assert_eq!(line, String::from("aaa")); + assert_eq!(input_splitter.add_line_to_buffer(0, line), None); + assert_eq!(input_splitter.buffer_len(), 1); + } + item @ _ => panic!("wrong item: {:?}", item), + }; + + match input_splitter.next() { + Some((1, Ok(line))) => { + assert_eq!(line, String::from("bbb")); + assert_eq!(input_splitter.add_line_to_buffer(1, line), None); + assert_eq!(input_splitter.buffer_len(), 2); + } + item @ _ => panic!("wrong item: {:?}", item), + }; + + match input_splitter.next() { + Some((2, Ok(line))) => { + assert_eq!(line, String::from("ccc")); + assert_eq!( + input_splitter.add_line_to_buffer(2, line), + Some(String::from("aaa")) + ); + assert_eq!(input_splitter.buffer_len(), 2); + } + item @ _ => panic!("wrong item: {:?}", item), + }; + + input_splitter.rewind_buffer(); + + match input_splitter.next() { + Some((1, Ok(line))) => { + assert_eq!(line, String::from("bbb")); + assert_eq!(input_splitter.buffer_len(), 1); + } + item @ _ => panic!("wrong item: {:?}", item), + }; + + match input_splitter.next() { + Some((2, Ok(line))) => { + assert_eq!(line, String::from("ccc")); + assert_eq!(input_splitter.buffer_len(), 0); + } + item @ _ => panic!("wrong item: {:?}", item), + }; + + match input_splitter.next() { + Some((3, Ok(line))) => { + assert_eq!(line, String::from("ddd")); + assert_eq!(input_splitter.buffer_len(), 0); + } + item @ _ => panic!("wrong item: {:?}", item), + }; + + assert!(input_splitter.next().is_none()); + } + + #[test] + fn input_splitter_interrupt_rewind() { + let input = vec![ + Ok(String::from("aaa")), + Ok(String::from("bbb")), + Ok(String::from("ccc")), + Ok(String::from("ddd")), + ]; + let mut input_splitter = InputSplitter::new(input.into_iter().enumerate()); + + input_splitter.set_size_of_buffer(3); + assert_eq!(input_splitter.buffer_len(), 0); + + match input_splitter.next() { + Some((0, Ok(line))) => { + assert_eq!(line, String::from("aaa")); + assert_eq!(input_splitter.add_line_to_buffer(0, line), None); + assert_eq!(input_splitter.buffer_len(), 1); + } + item @ _ => panic!("wrong item: {:?}", item), + }; + + match input_splitter.next() { + Some((1, Ok(line))) => { + assert_eq!(line, String::from("bbb")); + assert_eq!(input_splitter.add_line_to_buffer(1, line), None); + assert_eq!(input_splitter.buffer_len(), 2); + } + item @ _ => panic!("wrong item: {:?}", item), + }; + + match input_splitter.next() { + Some((2, Ok(line))) => { + assert_eq!(line, String::from("ccc")); + assert_eq!(input_splitter.add_line_to_buffer(2, line), None); + assert_eq!(input_splitter.buffer_len(), 3); + } + item @ _ => panic!("wrong item: {:?}", item), + }; + + input_splitter.rewind_buffer(); + + match input_splitter.next() { + Some((0, Ok(line))) => { + assert_eq!(line, String::from("aaa")); + assert_eq!(input_splitter.add_line_to_buffer(0, line), None); + assert_eq!(input_splitter.buffer_len(), 3); + } + item @ _ => panic!("wrong item: {:?}", item), + }; + + match input_splitter.next() { + Some((0, Ok(line))) => { + assert_eq!(line, String::from("aaa")); + assert_eq!(input_splitter.buffer_len(), 2); + } + item @ _ => panic!("wrong item: {:?}", item), + }; + + match input_splitter.next() { + Some((1, Ok(line))) => { + assert_eq!(line, String::from("bbb")); + assert_eq!(input_splitter.buffer_len(), 1); + } + item @ _ => panic!("wrong item: {:?}", item), + }; + + match input_splitter.next() { + Some((2, Ok(line))) => { + assert_eq!(line, String::from("ccc")); + assert_eq!(input_splitter.buffer_len(), 0); + } + item @ _ => panic!("wrong item: {:?}", item), + }; + + match input_splitter.next() { + Some((3, Ok(line))) => { + assert_eq!(line, String::from("ddd")); + assert_eq!(input_splitter.buffer_len(), 0); + } + item @ _ => panic!("wrong item: {:?}", item), + }; + + assert!(input_splitter.next().is_none()); + } +} + +pub fn uumain(args: impl uucore::Args) -> i32 { + let args = args.collect_str(); + + let matches = app!(SYNTAX, SUMMARY, LONG_HELP) + .optopt( + "b", + SUFFIX_FORMAT_OPT, + "use sprintf FORMAT instead of %02d", + "FORMAT", + ) + .optopt("f", PREFIX_OPT, "use PREFIX instead of 'xx'", "PREFIX") + .optflag("k", KEEP_FILES_OPT, "do not remove output files on errors") + .optflag( + "", + SUPPRESS_MATCHED_OPT, + "suppress the lines matching PATTERN", + ) + .optopt( + "n", + DIGITS_OPT, + "use specified number of digits instead of 2", + "DIGITS", + ) + .optflag("s", QUIET_OPT, "do not print counts of output file sizes") + .optflag("z", ELIDE_EMPTY_FILES_OPT, "remove empty output files") + .parse(args); + + // check for mandatory arguments + if matches.free.is_empty() { + show_error!("missing operand"); + exit!(1); + } + if matches.free.len() == 1 { + show_error!("missing operand after '{}'", matches.free[0]); + exit!(1); + } + // get the patterns to split on + let patterns = return_if_err!(1, patterns::get_patterns(&matches.free[1..])); + // get the file to split + let file_name: &str = &matches.free[0]; + let options = CsplitOptions::new(&matches); + if file_name == "-" { + let stdin = io::stdin(); + crash_if_err!(1, csplit(&options, patterns, stdin.lock())); + } else { + let file = return_if_err!(1, File::open(file_name)); + let file_metadata = return_if_err!(1, file.metadata()); + if !file_metadata.is_file() { + crash!(1, "'{}' is not a regular file", file_name); + } + crash_if_err!(1, csplit(&options, patterns, BufReader::new(file))); + }; + 0 +} diff --git a/src/uu/csplit/src/csplitError.rs b/src/uu/csplit/src/csplitError.rs new file mode 100644 index 000000000..dfbff3cb1 --- /dev/null +++ b/src/uu/csplit/src/csplitError.rs @@ -0,0 +1,34 @@ +use std::io; + +/// Errors thrown by the csplit command +#[derive(Debug, Fail)] +pub enum CsplitError { + #[fail(display = "IO error: {}", _0)] + IoError(io::Error), + #[fail(display = "'{}': line number out of range", _0)] + LineOutOfRange(String), + #[fail(display = "'{}': line number out of range on repetition {}", _0, _1)] + LineOutOfRangeOnRepetition(String, usize), + #[fail(display = "'{}': match not found", _0)] + MatchNotFound(String), + #[fail(display = "'{}': match not found on repetition {}", _0, _1)] + MatchNotFoundOnRepetition(String, usize), + #[fail(display = "line number must be greater than zero")] + LineNumberIsZero, + #[fail(display = "line number '{}' is smaller than preceding line number, {}", _0, _1)] + LineNumberSmallerThanPrevious(usize, usize), + #[fail(display = "invalid pattern: {}", _0)] + InvalidPattern(String), + #[fail(display = "invalid number: '{}'", _0)] + InvalidNumber(String), + #[fail(display = "incorrect conversion specification in suffix")] + SuffixFormatIncorrect, + #[fail(display = "too many % conversion specifications in suffix")] + SuffixFormatTooManyPercents, +} + +impl From for CsplitError { + fn from(error: io::Error) -> Self { + CsplitError::IoError(error) + } +} \ No newline at end of file diff --git a/src/uu/csplit/src/main.rs b/src/uu/csplit/src/main.rs new file mode 100644 index 000000000..5ebe43a18 --- /dev/null +++ b/src/uu/csplit/src/main.rs @@ -0,0 +1,2 @@ + +uucore_procs::main!(uu_csplit); // spell-checker:ignore procs uucore diff --git a/src/uu/csplit/src/patterns.rs b/src/uu/csplit/src/patterns.rs new file mode 100644 index 000000000..1fd1c8b8c --- /dev/null +++ b/src/uu/csplit/src/patterns.rs @@ -0,0 +1,353 @@ +use regex::Regex; +use crate::csplitError::CsplitError; + +/// The definition of a pattern to match on a line. +#[derive(Debug)] +pub enum Pattern { + /// Copy the file's content to a split up to, not including, the given line number. The number + /// of times the pattern is executed is detailed in [`ExecutePattern`]. + UpToLine(usize, ExecutePattern), + /// Copy the file's content to a split up to, not including, the line matching the regex. The + /// integer is an offset relative to the matched line of what to include (if positive) or + /// to exclude (if negative). The number of times the pattern is executed is detailed in + /// [`ExecutePattern`]. + UpToMatch(Regex, i32, ExecutePattern), + /// Skip the file's content up to, not including, the line matching the regex. The integer + /// is an offset relative to the matched line of what to include (if positive) or to exclude + /// (if negative). The number of times the pattern is executed is detailed in [`ExecutePattern`]. + SkipToMatch(Regex, i32, ExecutePattern), +} + +impl ToString for Pattern { + fn to_string(&self) -> String { + match self { + Pattern::UpToLine(n, _) => n.to_string(), + Pattern::UpToMatch(regex, 0, _) => format!("/{}/", regex.as_str()), + Pattern::UpToMatch(regex, offset, _) => format!("/{}/{:+}", regex.as_str(), offset), + Pattern::SkipToMatch(regex, 0, _) => format!("%{}%", regex.as_str()), + Pattern::SkipToMatch(regex, offset, _) => format!("%{}%{:+}", regex.as_str(), offset), + } + } +} + +/// The number of times a pattern can be used. +#[derive(Debug)] +pub enum ExecutePattern { + /// Execute the pattern as many times as possible + Always, + /// Execute the pattern a fixed number of times + Times(usize), +} + +impl ExecutePattern { + pub fn iter(&self) -> ExecutePatternIter { + match self { + ExecutePattern::Times(n) => ExecutePatternIter::new(Some(*n)), + ExecutePattern::Always => ExecutePatternIter::new(None), + } + } +} + +pub struct ExecutePatternIter { + max: Option, + cur: usize, +} + +impl ExecutePatternIter { + fn new(max: Option) -> ExecutePatternIter { + ExecutePatternIter { max, cur: 0 } + } +} + +impl Iterator for ExecutePatternIter { + type Item = (Option, usize); + + fn next(&mut self) -> Option<(Option, usize)> { + match self.max { + // iterate until m is reached + Some(m) => { + if self.cur == m { + None + } else { + self.cur += 1; + Some((self.max, self.cur)) + } + } + // no limit, just increment a counter + None => { + self.cur += 1; + Some((None, self.cur)) + } + } + } +} + +/// Parses the definitions of patterns given on the command line into a list of [`Pattern`]s. +/// +/// # Errors +/// +/// If a pattern is incorrect, a [`::CsplitError::InvalidPattern`] error is returned, which may be +/// due to, e.g.,: +/// - an invalid regular expression; +/// - an invalid number for, e.g., the offset. +pub fn get_patterns(args: &[String]) -> Result, CsplitError> { + let patterns = extract_patterns(args)?; + validate_line_numbers(&patterns)?; + Ok(patterns) +} + +fn extract_patterns(args: &[String]) -> Result, CsplitError> { + let mut patterns = Vec::with_capacity(args.len()); + let to_match_reg = + Regex::new(r"^(/(?P.+)/|%(?P.+)%)(?P[\+-]\d+)?$").unwrap(); + let execute_ntimes_reg = Regex::new(r"^\{(?P\d+)|\*\}$").unwrap(); + let mut iter = args.iter().peekable(); + + while let Some(arg) = iter.next() { + // get the number of times a pattern is repeated, which is at least once plus whatever is + // in the quantifier. + let execute_ntimes = match iter.peek() { + None => ExecutePattern::Times(1), + Some(&next_item) => { + match execute_ntimes_reg.captures(next_item) { + None => ExecutePattern::Times(1), + Some(r) => { + // skip the next item + iter.next(); + if let Some(times) = r.name("TIMES") { + ExecutePattern::Times(times.as_str().parse::().unwrap() + 1) + } else { + ExecutePattern::Always + } + } + } + } + }; + + // get the pattern definition + if let Some(captures) = to_match_reg.captures(arg) { + let offset = match captures.name("OFFSET") { + None => 0, + Some(m) => m.as_str().parse().unwrap(), + }; + if let Some(up_to_match) = captures.name("UPTO") { + let pattern = match Regex::new(up_to_match.as_str()) { + Err(_) => { + return Err(CsplitError::InvalidPattern(arg.to_string())); + } + Ok(reg) => reg, + }; + patterns.push(Pattern::UpToMatch(pattern, offset, execute_ntimes)); + } else if let Some(skip_to_match) = captures.name("SKIPTO") { + let pattern = match Regex::new(skip_to_match.as_str()) { + Err(_) => { + return Err(CsplitError::InvalidPattern(arg.to_string())); + } + Ok(reg) => reg, + }; + patterns.push(Pattern::SkipToMatch(pattern, offset, execute_ntimes)); + } + } else if let Some(line_number) = arg.parse::().ok() { + patterns.push(Pattern::UpToLine(line_number, execute_ntimes)); + } else { + return Err(CsplitError::InvalidPattern(arg.to_string())); + } + } + Ok(patterns) +} + +/// Asserts the line numbers are in increasing order, starting at 1. +fn validate_line_numbers(patterns: &[Pattern]) -> Result<(), CsplitError> { + patterns + .iter() + .filter_map(|pattern| match pattern { + Pattern::UpToLine(line_number, _) => Some(line_number), + _ => None, + }) + .try_fold(0, |prev_ln, ¤t_ln| match (prev_ln, current_ln) { + // a line number cannot be zero + (_, 0) => Err(CsplitError::LineNumberIsZero), + // two consecutifs numbers should not be equal + (n, m) if n == m => { + show_warning!("line number '{}' is the same as preceding line number", n); + Ok(n) + } + // a number cannot be greater than the one that follows + (n, m) if n > m => Err(CsplitError::LineNumberSmallerThanPrevious(m, n)), + (_, m) => Ok(m), + })?; + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn bad_pattern() { + let input = vec!["bad".to_string()]; + assert!(get_patterns(input.as_slice()).is_err()); + } + + #[test] + fn up_to_line_pattern() { + let input: Vec = vec!["24", "42", "{*}", "50", "{4}"] + .into_iter() + .map(|v| v.to_string()) + .collect(); + let patterns = get_patterns(input.as_slice()).unwrap(); + assert_eq!(patterns.len(), 3); + match patterns.get(0) { + Some(Pattern::UpToLine(24, ExecutePattern::Times(1))) => (), + _ => panic!("expected UpToLine pattern"), + }; + match patterns.get(1) { + Some(Pattern::UpToLine(42, ExecutePattern::Always)) => (), + _ => panic!("expected UpToLine pattern"), + }; + match patterns.get(2) { + Some(Pattern::UpToLine(50, ExecutePattern::Times(5))) => (), + _ => panic!("expected UpToLine pattern"), + }; + } + + #[test] + fn up_to_match_pattern() { + let input: Vec = vec![ + "/test1.*end$/", + "/test2.*end$/", + "{*}", + "/test3.*end$/", + "{4}", + "/test4.*end$/+3", + "/test5.*end$/-3", + ].into_iter() + .map(|v| v.to_string()) + .collect(); + let patterns = get_patterns(input.as_slice()).unwrap(); + assert_eq!(patterns.len(), 5); + match patterns.get(0) { + Some(Pattern::UpToMatch(reg, 0, ExecutePattern::Times(1))) => { + let parsed_reg = format!("{}", reg); + assert_eq!(parsed_reg, "test1.*end$"); + } + _ => panic!("expected UpToMatch pattern"), + }; + match patterns.get(1) { + Some(Pattern::UpToMatch(reg, 0, ExecutePattern::Always)) => { + let parsed_reg = format!("{}", reg); + assert_eq!(parsed_reg, "test2.*end$"); + } + _ => panic!("expected UpToMatch pattern"), + }; + match patterns.get(2) { + Some(Pattern::UpToMatch(reg, 0, ExecutePattern::Times(5))) => { + let parsed_reg = format!("{}", reg); + assert_eq!(parsed_reg, "test3.*end$"); + } + _ => panic!("expected UpToMatch pattern"), + }; + match patterns.get(3) { + Some(Pattern::UpToMatch(reg, 3, ExecutePattern::Times(1))) => { + let parsed_reg = format!("{}", reg); + assert_eq!(parsed_reg, "test4.*end$"); + } + _ => panic!("expected UpToMatch pattern"), + }; + match patterns.get(4) { + Some(Pattern::UpToMatch(reg, -3, ExecutePattern::Times(1))) => { + let parsed_reg = format!("{}", reg); + assert_eq!(parsed_reg, "test5.*end$"); + } + _ => panic!("expected UpToMatch pattern"), + }; + } + + #[test] + fn skip_to_match_pattern() { + let input: Vec = vec![ + "%test1.*end$%", + "%test2.*end$%", + "{*}", + "%test3.*end$%", + "{4}", + "%test4.*end$%+3", + "%test5.*end$%-3", + ].into_iter() + .map(|v| v.to_string()) + .collect(); + let patterns = get_patterns(input.as_slice()).unwrap(); + assert_eq!(patterns.len(), 5); + match patterns.get(0) { + Some(Pattern::SkipToMatch(reg, 0, ExecutePattern::Times(1))) => { + let parsed_reg = format!("{}", reg); + assert_eq!(parsed_reg, "test1.*end$"); + } + _ => panic!("expected SkipToMatch pattern"), + }; + match patterns.get(1) { + Some(Pattern::SkipToMatch(reg, 0, ExecutePattern::Always)) => { + let parsed_reg = format!("{}", reg); + assert_eq!(parsed_reg, "test2.*end$"); + } + _ => panic!("expected SkipToMatch pattern"), + }; + match patterns.get(2) { + Some(Pattern::SkipToMatch(reg, 0, ExecutePattern::Times(5))) => { + let parsed_reg = format!("{}", reg); + assert_eq!(parsed_reg, "test3.*end$"); + } + _ => panic!("expected SkipToMatch pattern"), + }; + match patterns.get(3) { + Some(Pattern::SkipToMatch(reg, 3, ExecutePattern::Times(1))) => { + let parsed_reg = format!("{}", reg); + assert_eq!(parsed_reg, "test4.*end$"); + } + _ => panic!("expected SkipToMatch pattern"), + }; + match patterns.get(4) { + Some(Pattern::SkipToMatch(reg, -3, ExecutePattern::Times(1))) => { + let parsed_reg = format!("{}", reg); + assert_eq!(parsed_reg, "test5.*end$"); + } + _ => panic!("expected SkipToMatch pattern"), + }; + } + + #[test] + fn line_number_zero() { + let patterns = vec![Pattern::UpToLine(0, ExecutePattern::Times(1))]; + match validate_line_numbers(&patterns) { + Err(::CsplitError::LineNumberIsZero) => (), + _ => panic!("expected LineNumberIsZero error"), + } + } + + #[test] + fn line_number_smaller_than_previous() { + let input: Vec = vec!["10".to_string(), "5".to_string()]; + match get_patterns(input.as_slice()) { + Err(::CsplitError::LineNumberSmallerThanPrevious(5, 10)) => (), + _ => panic!("expected LineNumberSmallerThanPrevious error"), + } + } + + #[test] + fn line_number_smaller_than_previous_separate() { + let input: Vec = vec!["10".to_string(), "/20/".to_string(), "5".to_string()]; + match get_patterns(input.as_slice()) { + Err(::CsplitError::LineNumberSmallerThanPrevious(5, 10)) => (), + _ => panic!("expected LineNumberSmallerThanPrevious error"), + } + } + + #[test] + fn line_number_zero_separate() { + let input: Vec = vec!["10".to_string(), "/20/".to_string(), "0".to_string()]; + match get_patterns(input.as_slice()) { + Err(::CsplitError::LineNumberIsZero) => (), + _ => panic!("expected LineNumberIsZero error"), + } + } +} diff --git a/src/uu/csplit/src/splitname.rs b/src/uu/csplit/src/splitname.rs new file mode 100644 index 000000000..1082d38ec --- /dev/null +++ b/src/uu/csplit/src/splitname.rs @@ -0,0 +1,397 @@ +use regex::Regex; + +//mod csplit; +use crate::CsplitError; + +/// Computes the filename of a split, taking into consideration a possible user-defined suffix +/// format. +pub struct SplitName { + fn_split_name: Box String>, +} + +impl SplitName { + /// Creates a new SplitName with the given user-defined options: + /// - `prefix_opt` specifies a prefix for all splits. + /// - `format_opt` specifies a custom format for the suffix part of the filename, using the + /// `sprintf` format notation. + /// - `n_digits_opt` defines the width of the split number. + /// + /// # Caveats + /// + /// If `prefix_opt` and `format_opt` are defined, and the `format_opt` has some string appearing + /// before the conversion pattern (e.g., "here-%05d"), then it is appended to the passed prefix + /// via `prefix_opt`. + /// + /// If `n_digits_opt` and `format_opt` are defined, then width defined in `format_opt` is + /// taken. + pub fn new( + prefix_opt: Option, + format_opt: Option, + n_digits_opt: Option, + ) -> Result { + // get the prefix + let prefix = prefix_opt.unwrap_or("xx".to_string()); + // the width for the split offset + let n_digits = match n_digits_opt { + None => 2, + Some(opt) => match opt.parse::() { + Ok(digits) => digits, + Err(_) => return Err(CsplitError::InvalidNumber(opt)), + }, + }; + // translate the custom format into a function + let fn_split_name: Box String> = match format_opt { + None => Box::new(move |n: usize| -> String { + format!("{}{:0width$}", prefix, n, width = n_digits) + }), + Some(custom) => { + let spec = Regex::new( + r"(?P%(?P[0#-])(?P\d+)?(?P[diuoxX]))", + ).unwrap(); + let mut captures_iter = spec.captures_iter(&custom); + let custom_fn: Box String> = match captures_iter.next() { + Some(captures) => { + let all = captures.name("ALL").unwrap(); + let before = custom[0..all.start()].to_owned(); + let after = custom[all.end()..].to_owned(); + let n_digits = match captures.name("WIDTH") { + None => 0, + Some(m) => m.as_str().parse::().unwrap(), + }; + match (captures.name("FLAG"), captures.name("TYPE")) { + (Some(ref f), Some(ref t)) => { + match (f.as_str(), t.as_str()) { + /* + * zero padding + */ + + // decimal + ("0", "d") | ("0", "i") | ("0", "u") => { + Box::new(move |n: usize| -> String { + format!( + "{}{}{:0width$}{}", + prefix, + before, + n, + after, + width = n_digits + ) + }) + } + // octal + ("0", "o") => Box::new(move |n: usize| -> String { + format!( + "{}{}{:0width$o}{}", + prefix, + before, + n, + after, + width = n_digits + ) + }), + // lower hexadecimal + ("0", "x") => Box::new(move |n: usize| -> String { + format!( + "{}{}{:0width$x}{}", + prefix, + before, + n, + after, + width = n_digits + ) + }), + // upper hexadecimal + ("0", "X") => Box::new(move |n: usize| -> String { + format!( + "{}{}{:0width$X}{}", + prefix, + before, + n, + after, + width = n_digits + ) + }), + + /* + * Alternate form + */ + + // octal + ("#", "o") => Box::new(move |n: usize| -> String { + format!( + "{}{}{:>#width$o}{}", + prefix, + before, + n, + after, + width = n_digits + ) + }), + // lower hexadecimal + ("#", "x") => Box::new(move |n: usize| -> String { + format!( + "{}{}{:>#width$x}{}", + prefix, + before, + n, + after, + width = n_digits + ) + }), + // upper hexadecimal + ("#", "X") => Box::new(move |n: usize| -> String { + format!( + "{}{}{:>#width$X}{}", + prefix, + before, + n, + after, + width = n_digits + ) + }), + + /* + * Left adjusted + */ + + // decimal + ("-", "d") | ("-", "i") | ("-", "u") => { + Box::new(move |n: usize| -> String { + format!( + "{}{}{:<#width$}{}", + prefix, + before, + n, + after, + width = n_digits + ) + }) + } + // octal + ("-", "o") => Box::new(move |n: usize| -> String { + format!( + "{}{}{:<#width$o}{}", + prefix, + before, + n, + after, + width = n_digits + ) + }), + // lower hexadecimal + ("-", "x") => Box::new(move |n: usize| -> String { + format!( + "{}{}{:<#width$x}{}", + prefix, + before, + n, + after, + width = n_digits + ) + }), + // upper hexadecimal + ("-", "X") => Box::new(move |n: usize| -> String { + format!( + "{}{}{:<#width$X}{}", + prefix, + before, + n, + after, + width = n_digits + ) + }), + + _ => return Err(CsplitError::SuffixFormatIncorrect), + } + } + _ => return Err(CsplitError::SuffixFormatIncorrect), + } + } + None => return Err(CsplitError::SuffixFormatIncorrect), + }; + + // there cannot be more than one format pattern + if captures_iter.next().is_some() { + return Err(CsplitError::SuffixFormatTooManyPercents); + } + custom_fn + } + }; + + Ok(SplitName { fn_split_name }) + } + + /// Returns the filename of the i-th split. + pub fn get(&self, n: usize) -> String { + (self.fn_split_name)(n) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn invalid_number() { + let split_name = SplitName::new(None, None, Some(String::from("bad"))); + match split_name { + Err(CsplitError::InvalidNumber(_)) => (), + _ => panic!("should fail with InvalidNumber"), + }; + } + + #[test] + fn invalid_suffix_format1() { + let split_name = SplitName::new(None, Some(String::from("no conversion string")), None); + match split_name { + Err(CsplitError::SuffixFormatIncorrect) => (), + _ => panic!("should fail with SuffixFormatIncorrect"), + }; + } + + #[test] + fn invalid_suffix_format2() { + let split_name = SplitName::new(None, Some(String::from("%042a")), None); + match split_name { + Err(CsplitError::SuffixFormatIncorrect) => (), + _ => panic!("should fail with SuffixFormatIncorrect"), + }; + } + + #[test] + fn default_formatter() { + let split_name = SplitName::new(None, None, None).unwrap(); + assert_eq!(split_name.get(2), "xx02"); + } + + #[test] + fn default_formatter_with_prefix() { + let split_name = SplitName::new(Some(String::from("aaa")), None, None).unwrap(); + assert_eq!(split_name.get(2), "aaa02"); + } + + #[test] + fn default_formatter_with_width() { + let split_name = SplitName::new(None, None, Some(String::from("5"))).unwrap(); + assert_eq!(split_name.get(2), "xx00002"); + } + + #[test] + fn zero_padding_decimal1() { + let split_name = SplitName::new(None, Some(String::from("cst-%03d-")), None).unwrap(); + assert_eq!(split_name.get(2), "xxcst-002-"); + } + + #[test] + fn zero_padding_decimal2() { + let split_name = SplitName::new( + Some(String::from("pre-")), + Some(String::from("cst-%03d-post")), + None, + ).unwrap(); + assert_eq!(split_name.get(2), "pre-cst-002-post"); + } + + #[test] + fn zero_padding_decimal3() { + let split_name = SplitName::new( + None, + Some(String::from("cst-%03d-")), + Some(String::from("42")), + ).unwrap(); + assert_eq!(split_name.get(2), "xxcst-002-"); + } + + #[test] + fn zero_padding_decimal4() { + let split_name = SplitName::new(None, Some(String::from("cst-%03i-")), None).unwrap(); + assert_eq!(split_name.get(2), "xxcst-002-"); + } + + #[test] + fn zero_padding_decimal5() { + let split_name = SplitName::new(None, Some(String::from("cst-%03u-")), None).unwrap(); + assert_eq!(split_name.get(2), "xxcst-002-"); + } + + #[test] + fn zero_padding_octal() { + let split_name = SplitName::new(None, Some(String::from("cst-%03o-")), None).unwrap(); + assert_eq!(split_name.get(42), "xxcst-052-"); + } + + #[test] + fn zero_padding_lower_hexa() { + let split_name = SplitName::new(None, Some(String::from("cst-%03x-")), None).unwrap(); + assert_eq!(split_name.get(42), "xxcst-02a-"); + } + + #[test] + fn zero_padding_upper_hexa() { + let split_name = SplitName::new(None, Some(String::from("cst-%03X-")), None).unwrap(); + assert_eq!(split_name.get(42), "xxcst-02A-"); + } + + #[test] + fn alternate_form_octal() { + let split_name = SplitName::new(None, Some(String::from("cst-%#10o-")), None).unwrap(); + assert_eq!(split_name.get(42), "xxcst- 0o52-"); + } + + #[test] + fn alternate_form_lower_hexa() { + let split_name = SplitName::new(None, Some(String::from("cst-%#10x-")), None).unwrap(); + assert_eq!(split_name.get(42), "xxcst- 0x2a-"); + } + + #[test] + fn alternate_form_upper_hexa() { + let split_name = SplitName::new(None, Some(String::from("cst-%#10X-")), None).unwrap(); + assert_eq!(split_name.get(42), "xxcst- 0x2A-"); + } + + #[test] + fn left_adjusted_decimal1() { + let split_name = SplitName::new(None, Some(String::from("cst-%-10d-")), None).unwrap(); + assert_eq!(split_name.get(42), "xxcst-42 -"); + } + + #[test] + fn left_adjusted_decimal2() { + let split_name = SplitName::new(None, Some(String::from("cst-%-10i-")), None).unwrap(); + assert_eq!(split_name.get(42), "xxcst-42 -"); + } + + #[test] + fn left_adjusted_decimal3() { + let split_name = SplitName::new(None, Some(String::from("cst-%-10u-")), None).unwrap(); + assert_eq!(split_name.get(42), "xxcst-42 -"); + } + + #[test] + fn left_adjusted_octal() { + let split_name = SplitName::new(None, Some(String::from("cst-%-10o-")), None).unwrap(); + assert_eq!(split_name.get(42), "xxcst-0o52 -"); + } + + #[test] + fn left_adjusted_lower_hexa() { + let split_name = SplitName::new(None, Some(String::from("cst-%-10x-")), None).unwrap(); + assert_eq!(split_name.get(42), "xxcst-0x2a -"); + } + + #[test] + fn left_adjusted_upper_hexa() { + let split_name = SplitName::new(None, Some(String::from("cst-%-10X-")), None).unwrap(); + assert_eq!(split_name.get(42), "xxcst-0x2A -"); + } + + #[test] + fn too_many_percent() { + let split_name = SplitName::new(None, Some(String::from("%02d-%-3x")), None); + match split_name { + Err(CsplitError::SuffixFormatTooManyPercents) => (), + _ => panic!("should fail with SuffixFormatTooManyPercents"), + }; + } +} diff --git a/tests/by-util/test_csplit.rs b/tests/by-util/test_csplit.rs new file mode 100644 index 000000000..51cab483c --- /dev/null +++ b/tests/by-util/test_csplit.rs @@ -0,0 +1,1335 @@ +use crate::common::util::*; +use glob::glob; + +/// Returns a string of numbers with the given range, each on a new line. +/// The upper bound is not included. +fn generate(from: u32, to: u32) -> String { + (from..to).fold(String::new(), |acc, v| format!("{}{}\n", acc, v)) +} + +#[test] +fn test_stdin() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["-", "10"]) + .pipe_in(generate(1, 51)) + .succeeds() + .stdout_only("18\n123\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), generate(10, 51)); +} + +#[test] +fn test_up_to_line() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "10"]) + .succeeds() + .stdout_only("18\n123\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), generate(10, 51)); +} + +#[test] +fn test_up_to_line_repeat_twice() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "10", "{2}"]) + .succeeds() + .stdout_only("18\n30\n30\n63\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 4); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), generate(10, 20)); + assert_eq!(at.read("xx02"), generate(20, 30)); + assert_eq!(at.read("xx03"), generate(30, 51)); +} + +#[test] +fn test_up_to_line_sequence() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "10", "25"]) + .succeeds() + .stdout_only("18\n45\n78\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 3); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), generate(10, 25)); + assert_eq!(at.read("xx02"), generate(25, 51)); +} + +#[test] +fn test_up_to_match() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/9$/"]) + .succeeds() + .stdout_only("16\n125\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(1, 9)); + assert_eq!(at.read("xx01"), generate(9, 51)); +} + +#[test] +fn test_up_to_match_repeat_twice() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/9$/", "{2}"]) + .succeeds() + .stdout_only("16\n29\n30\n66\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 4); + assert_eq!(at.read("xx00"), generate(1, 9)); + assert_eq!(at.read("xx01"), generate(9, 19)); + assert_eq!(at.read("xx02"), generate(19, 29)); + assert_eq!(at.read("xx03"), generate(29, 51)); +} + +#[test] +fn test_up_to_match_sequence() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/9$/", "/5$/"]) + .succeeds() + .stdout_only("16\n17\n108\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 3); + assert_eq!(at.read("xx00"), generate(1, 9)); + assert_eq!(at.read("xx01"), generate(9, 15)); + assert_eq!(at.read("xx02"), generate(15, 51)); +} + +#[test] +fn test_up_to_match_offset() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/9$/+3"]) + .succeeds() + .stdout_only("24\n117\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(1, 12)); + assert_eq!(at.read("xx01"), generate(12, 51)); +} + +#[test] +fn test_up_to_match_offset_repeat_twice() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/9$/+3", "{2}"]) + .succeeds() + .stdout_only("24\n30\n30\n57\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 4); + assert_eq!(at.read("xx00"), generate(1, 12)); + assert_eq!(at.read("xx01"), generate(12, 22)); + assert_eq!(at.read("xx02"), generate(22, 32)); + assert_eq!(at.read("xx03"), generate(32, 51)); +} + +#[test] +fn test_up_to_match_negative_offset() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/9$/-3"]) + .succeeds() + .stdout_only("10\n131\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(1, 6)); + assert_eq!(at.read("xx01"), generate(6, 51)); +} + +#[test] +fn test_up_to_match_negative_offset_repeat_twice() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/9$/-3", "{2}"]) + .succeeds() + .stdout_only("10\n26\n30\n75\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 4); + assert_eq!(at.read("xx00"), generate(1, 6)); + assert_eq!(at.read("xx01"), generate(6, 16)); + assert_eq!(at.read("xx02"), generate(16, 26)); + assert_eq!(at.read("xx03"), generate(26, 51)); +} + +#[test] +fn test_up_to_match_repeat_always() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/9$/", "{*}"]) + .succeeds() + .stdout_only("16\n29\n30\n30\n30\n6\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 6); + assert_eq!(at.read("xx00"), generate(1, 9)); + assert_eq!(at.read("xx01"), generate(9, 19)); + assert_eq!(at.read("xx02"), generate(19, 29)); + assert_eq!(at.read("xx03"), generate(29, 39)); + assert_eq!(at.read("xx04"), generate(39, 49)); + assert_eq!(at.read("xx05"), generate(49, 51)); +} + +#[test] +fn test_up_to_match_repeat_over() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/9$/", "{50}"]) + .fails() + .stdout_is("16\n29\n30\n30\n30\n6\n") + .stderr_is("csplit: error: '/9$/': match not found on repetition 5"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/9$/", "{50}", "-k"]) + .fails() + .stdout_is("16\n29\n30\n30\n30\n6\n") + .stderr_is("csplit: error: '/9$/': match not found on repetition 5"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 6); + assert_eq!(at.read("xx00"), generate(1, 9)); + assert_eq!(at.read("xx01"), generate(9, 19)); + assert_eq!(at.read("xx02"), generate(19, 29)); + assert_eq!(at.read("xx03"), generate(29, 39)); + assert_eq!(at.read("xx04"), generate(39, 49)); + assert_eq!(at.read("xx05"), generate(49, 51)); +} + +#[test] +fn test_skip_to_match() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%23%"]) + .succeeds() + .stdout_only("84\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 1); + assert_eq!(at.read("xx00"), generate(23, 51)); +} + +#[test] +fn test_skip_to_match_sequence1() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%0$%", "%^4%"]) + .succeeds() + .stdout_only("33\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 1); + assert_eq!(at.read("xx00"), generate(40, 51)); +} + +#[test] +fn test_skip_to_match_sequence2() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%0$%", "{1}", "%^4%"]) + .succeeds() + .stdout_only("33\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 1); + assert_eq!(at.read("xx00"), generate(40, 51)); +} + +#[test] +fn test_skip_to_match_sequence3() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%0$%", "{1}", "/^4/"]) + .succeeds() + .stdout_only("60\n33\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(20, 40)); + assert_eq!(at.read("xx01"), generate(40, 51)); +} + +#[test] +fn test_skip_to_match_sequence4() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%0$%", "/^4/"]) + .succeeds() + .stdout_only("90\n33\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(10, 40)); + assert_eq!(at.read("xx01"), generate(40, 51)); +} + +#[test] +fn test_skip_to_match_offset() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%23%+3"]) + .succeeds() + .stdout_only("75\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 1); + assert_eq!(at.read("xx00"), generate(26, 51)); +} + +#[test] +fn test_skip_to_match_negative_offset() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%23%-3"]) + .succeeds() + .stdout_only("93\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 1); + assert_eq!(at.read("xx00"), generate(20, 51)); +} + +#[test] +fn test_skip_to_match_repeat_always() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%0$%", "{*}"]) + .succeeds() + .no_stdout(); + + let count = glob(&at.plus_as_string("xx*")).unwrap().count(); + assert_eq!(count, 0); +} + +#[test] +fn test_mix() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "13", "%25%", "/0$/"]) + .succeeds() + .stdout_only("27\n15\n63\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 3); + assert_eq!(at.read("xx00"), generate(1, 13)); + assert_eq!(at.read("xx01"), generate(25, 30)); + assert_eq!(at.read("xx02"), generate(30, 51)); +} + +#[test] +fn test_option_keep() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["-k", "numbers50.txt", "/20/", "/nope/"]) + .fails() + .stderr_is("csplit: error: '/nope/': match not found") + .stdout_is("48\n93\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(1, 20)); + assert_eq!(at.read("xx01"), generate(20, 51)); +} + +#[test] +fn test_option_quiet() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["--quiet", "numbers50.txt", "13", "%25%", "/0$/"]) + .succeeds() + .no_stdout(); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 3); + assert_eq!(at.read("xx00"), generate(1, 13)); + assert_eq!(at.read("xx01"), generate(25, 30)); + assert_eq!(at.read("xx02"), generate(30, 51)); +} + +#[test] +fn test_option_prefix() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["--prefix", "dog", "numbers50.txt", "13", "%25%", "/0$/"]) + .succeeds() + .stdout_only("27\n15\n63\n"); + + let count = glob(&at.plus_as_string("dog*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 3); + assert_eq!(at.read("dog00"), generate(1, 13)); + assert_eq!(at.read("dog01"), generate(25, 30)); + assert_eq!(at.read("dog02"), generate(30, 51)); +} + +#[test] +fn test_negative_offset_at_start() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["-", "/a/-1", "{*}"]) + .pipe_in("\na\n") + .succeeds() + .stdout_only("0\n3\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), ""); + assert_eq!(at.read("xx01"), "\na\n"); +} + +#[test] +fn test_up_to_match_option_suppress_matched() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "--suppress-matched", "/0$/", "{*}"]) + .succeeds() + .stdout_only("18\n27\n27\n27\n27\n0\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 6); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), generate(11, 20)); + assert_eq!(at.read("xx02"), generate(21, 30)); + assert_eq!(at.read("xx03"), generate(31, 40)); + assert_eq!(at.read("xx04"), generate(41, 50)); + assert_eq!(at.read("xx05"), ""); +} + +#[test] +fn test_up_to_match_offset_option_suppress_matched() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "--suppress-matched", "/10/+4"]) + .succeeds() + .stdout_only("27\n111\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(1, 10) + &generate(11, 14)); + assert_eq!(at.read("xx01"), generate(14, 51)); +} + +#[test] +fn test_up_to_match_negative_offset_option_suppress_matched() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "--suppress-matched", "/10/-4"]) + .succeeds() + .stdout_only("10\n128\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(1, 6)); + assert_eq!(at.read("xx01"), generate(6, 10) + &generate(11, 51)); +} + +#[test] +fn test_up_to_line_option_suppress_matched() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "--suppress-matched", "10"]) + .succeeds() + .stdout_only("18\n120\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), generate(11, 51)); +} + +#[test] +fn test_skip_to_match_option_suppress_matched() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "--suppress-matched", "%0$%"]) + .succeeds() + .stdout_only("120\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 1); + assert_eq!(at.read("xx00"), generate(11, 51)); +} + +#[test] +fn test_option_elide_empty_file1() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "--suppress-matched", "-z", "/0$/", "{*}"]) + .succeeds() + .stdout_only("18\n27\n27\n27\n27\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 5); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), generate(11, 20)); + assert_eq!(at.read("xx02"), generate(21, 30)); + assert_eq!(at.read("xx03"), generate(31, 40)); + assert_eq!(at.read("xx04"), generate(41, 50)); +} + +#[test] +fn test_option_elide_empty_file2() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["-", "-z", "/a/-1", "{*}"]) + .pipe_in("\na\n") + .succeeds() + .stdout_only("3\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 1); + assert_eq!(at.read("xx00"), "\na\n"); +} + +#[test] +fn test_up_to_match_context_overflow() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/45/+10"]) + .fails() + .stdout_is("141\n") + .stderr_is("csplit: error: '/45/+10': line number out of range"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); + let (at, mut ucmd) = at_and_ucmd!(); + + ucmd.args(&["numbers50.txt", "/45/+10", "-k"]) + .fails() + .stdout_is("141\n") + .stderr_is("csplit: error: '/45/+10': line number out of range"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 1); + assert_eq!(at.read("xx00"), generate(1, 51)); +} + +#[test] +fn test_skip_to_match_context_underflow() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%5%-10"]) + .fails() + .stdout_is("141\n") + .stderr_is("csplit: error: '%5%-10': line number out of range"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%5%-10", "-k"]) + .fails() + .stdout_is("141\n") + .stderr_is("csplit: error: '%5%-10': line number out of range"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 1); + assert_eq!(at.read("xx00"), generate(1, 51)); +} + +#[test] +fn test_skip_to_match_context_overflow() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%45%+10"]) + .fails() + .stderr_only("csplit: error: '%45%+10': line number out of range"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%45%+10", "-k"]) + .fails() + .stderr_only("csplit: error: '%45%+10': line number out of range"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); +} + +#[test] +fn test_up_to_no_match1() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/4/", "/nope/"]) + .fails() + .stdout_is("6\n135\n") + .stderr_is("csplit: error: '/nope/': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/4/", "/nope/", "-k"]) + .fails() + .stdout_is("6\n135\n") + .stderr_is("csplit: error: '/nope/': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(1, 4)); + assert_eq!(at.read("xx01"), generate(4, 51)); +} + +#[test] +fn test_up_to_no_match2() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/4/", "/nope/", "{50}"]) + .fails() + .stdout_is("6\n135\n") + .stderr_is("csplit: error: '/nope/': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/4/", "/nope/", "{50}", "-k"]) + .fails() + .stdout_is("6\n135\n") + .stderr_is("csplit: error: '/nope/': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(1, 4)); + assert_eq!(at.read("xx01"), generate(4, 51)); +} + +#[test] +fn test_up_to_no_match3() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/0$/", "{50}"]) + .fails() + .stdout_is("18\n30\n30\n30\n30\n3\n") + .stderr_is("csplit: error: '/0$/': match not found on repetition 5"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/0$/", "{50}", "-k"]) + .fails() + .stdout_is("18\n30\n30\n30\n30\n3\n") + .stderr_is("csplit: error: '/0$/': match not found on repetition 5"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 6); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), generate(10, 20)); + assert_eq!(at.read("xx02"), generate(20, 30)); + assert_eq!(at.read("xx03"), generate(30, 40)); + assert_eq!(at.read("xx04"), generate(40, 50)); + assert_eq!(at.read("xx05"), "50\n"); +} + +#[test] +fn test_up_to_no_match4() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/nope/", "/4/"]) + .fails() + .stdout_is("141\n") + .stderr_is("csplit: error: '/nope/': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/nope/", "/4/", "-k"]) + .fails() + .stdout_is("141\n") + .stderr_is("csplit: error: '/nope/': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 1); + assert_eq!(at.read("xx00"), generate(1, 51)); +} + +#[test] +fn test_up_to_no_match5() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/nope/", "{*}"]) + .succeeds() + .stdout_only("141\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 1); + assert_eq!(at.read("xx00"), generate(1, 51)); +} + +#[test] +fn test_up_to_no_match6() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/nope/-5"]) + .fails() + .stdout_is("141\n") + .stderr_is("csplit: error: '/nope/-5': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/nope/-5", "-k"]) + .fails() + .stdout_is("141\n") + .stderr_is("csplit: error: '/nope/-5': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 1); + assert_eq!(at.read("xx00"), generate(1, 51)); +} + +#[test] +fn test_up_to_no_match7() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/nope/+5"]) + .fails() + .stdout_is("141\n") + .stderr_is("csplit: error: '/nope/+5': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/nope/+5", "-k"]) + .fails() + .stdout_is("141\n") + .stderr_is("csplit: error: '/nope/+5': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 1); + assert_eq!(at.read("xx00"), generate(1, 51)); +} + +#[test] +fn test_skip_to_no_match1() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%nope%"]) + .fails() + .stderr_only("csplit: error: '%nope%': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); +} + +#[test] +fn test_skip_to_no_match2() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%nope%", "{50}"]) + .fails() + .stderr_only("csplit: error: '%nope%': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); +} + +#[test] +fn test_skip_to_no_match3() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%0$%", "{50}"]) + .fails() + .stderr_only("csplit: error: '%0$%': match not found on repetition 5"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); +} + +#[test] +fn test_skip_to_no_match4() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%nope%", "/4/"]) + .fails() + .stderr_only("csplit: error: '%nope%': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); +} + +#[test] +fn test_skip_to_no_match5() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%nope%", "{*}"]) + .succeeds() + .no_stderr() + .no_stdout(); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); +} + +#[test] +fn test_skip_to_no_match6() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%nope%-5"]) + .fails() + .stderr_only("csplit: error: '%nope%-5': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); +} + +#[test] +fn test_skip_to_no_match7() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%nope%+5"]) + .fails() + .stderr_only("csplit: error: '%nope%+5': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); +} + +#[test] +fn test_no_match() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "%nope%"]) + .fails() + .stderr_only("csplit: error: '%nope%': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/nope/"]) + .fails() + .stdout_is("141\n") + .stderr_is("csplit: error: '/nope/': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); +} + +#[test] +fn test_too_small_linenum() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/20/", "10", "/40/"]) + .succeeds() + .stdout_only("48\n0\n60\n33\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 4); + assert_eq!(at.read("xx00"), generate(1, 20)); + assert_eq!(at.read("xx01"), ""); + assert_eq!(at.read("xx02"), generate(20, 40)); + assert_eq!(at.read("xx03"), generate(40, 51)); +} + +#[test] +fn test_too_small_linenum_equal() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/20/", "20"]) + .succeeds() + .stdout_only("48\n0\n93\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 3); + assert_eq!(at.read("xx00"), generate(1, 20)); + assert_eq!(at.read("xx01"), ""); + assert_eq!(at.read("xx02"), generate(20, 51)); +} + +#[test] +fn test_too_small_linenum_elided() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "-z", "/20/", "10", "/40/"]) + .succeeds() + .stdout_only("48\n60\n33\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 3); + assert_eq!(at.read("xx00"), generate(1, 20)); + assert_eq!(at.read("xx01"), generate(20, 40)); + assert_eq!(at.read("xx02"), generate(40, 51)); +} + +#[test] +fn test_too_small_linenum_negative_offset() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/20/-5", "10", "/40/"]) + .succeeds() + .stdout_only("33\n0\n75\n33\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 4); + assert_eq!(at.read("xx00"), generate(1, 15)); + assert_eq!(at.read("xx01"), ""); + assert_eq!(at.read("xx02"), generate(15, 40)); + assert_eq!(at.read("xx03"), generate(40, 51)); +} + +#[test] +fn test_too_small_linenum_twice() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/20/", "10", "15", "/40/"]) + .succeeds() + .stdout_only("48\n0\n0\n60\n33\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 5); + assert_eq!(at.read("xx00"), generate(1, 20)); + assert_eq!(at.read("xx01"), ""); + assert_eq!(at.read("xx02"), ""); + assert_eq!(at.read("xx03"), generate(20, 40)); + assert_eq!(at.read("xx04"), generate(40, 51)); +} + +#[test] +fn test_too_small_linenum_repeat() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/20/", "10", "{*}"]) + .fails() + .stderr_is("csplit: error: '10': line number out of range on repetition 5") + .stdout_is("48\n0\n0\n30\n30\n30\n3\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/20/", "10", "{*}", "-k"]) + .fails() + .stderr_is("csplit: error: '10': line number out of range on repetition 5") + .stdout_is("48\n0\n0\n30\n30\n30\n3\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 7); + assert_eq!(at.read("xx00"), generate(1, 20)); + assert_eq!(at.read("xx01"), ""); + assert_eq!(at.read("xx02"), ""); + assert_eq!(at.read("xx03"), generate(20, 30)); + assert_eq!(at.read("xx04"), generate(30, 40)); + assert_eq!(at.read("xx05"), generate(40, 50)); + assert_eq!(at.read("xx06"), "50\n"); +} + +#[test] +fn test_linenum_out_of_range1() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "100"]) + .fails() + .stdout_is("141\n") + .stderr_is("csplit: error: '100': line number out of range"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "100", "-k"]) + .fails() + .stdout_is("141\n") + .stderr_is("csplit: error: '100': line number out of range"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 1); + assert_eq!(at.read("xx00"), generate(1, 51)); +} + +#[test] +fn test_linenum_out_of_range2() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "10", "100"]) + .fails() + .stdout_is("18\n123\n") + .stderr_is("csplit: error: '100': line number out of range"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "10", "100", "-k"]) + .fails() + .stdout_is("18\n123\n") + .stderr_is("csplit: error: '100': line number out of range"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), generate(10, 51)); +} + +#[test] +fn test_linenum_out_of_range3() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "40", "{2}"]) + .fails() + .stdout_is("108\n33\n") + .stderr_is("csplit: error: '40': line number out of range on repetition 1"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "40", "{2}", "-k"]) + .fails() + .stdout_is("108\n33\n") + .stderr_is("csplit: error: '40': line number out of range on repetition 1"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(1, 40)); + assert_eq!(at.read("xx01"), generate(40, 51)); +} + +#[test] +fn test_linenum_out_of_range4() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "40", "{*}"]) + .fails() + .stdout_is("108\n33\n") + .stderr_is("csplit: error: '40': line number out of range on repetition 1"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "40", "{*}", "-k"]) + .fails() + .stdout_is("108\n33\n") + .stderr_is("csplit: error: '40': line number out of range on repetition 1"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(1, 40)); + assert_eq!(at.read("xx01"), generate(40, 51)); +} + +#[test] +fn test_skip_to_match_negative_offset_before_a_match() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/20/-10", "/15/"]) + .fails() + .stdout_is("18\n123\n") + .stderr_is("csplit: error: '/15/': match not found"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 0); +} + +#[test] +fn test_skip_to_match_negative_offset_before_a_linenum() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/20/-10", "15"]) + .succeeds() + .stdout_only("18\n15\n108\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 3); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), generate(10, 15)); + assert_eq!(at.read("xx02"), generate(15, 51)); +} + +#[test] +fn test_corner_case1() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/10/", "11"]) + .succeeds() + .stdout_only("18\n3\n120\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 3); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), "10\n"); + assert_eq!(at.read("xx02"), generate(11, 51)); +} + +#[test] +fn test_corner_case2() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/10/-5", "/10/"]) + .fails() + .stderr_is("csplit: error: '/10/': match not found") + .stdout_is("8\n133\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 0); +} + +#[test] +fn test_corner_case3() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/15/-3", "14", "/15/"]) + .fails() + .stderr_is("csplit: error: '/15/': match not found") + .stdout_is("24\n6\n111\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 0); +} + +#[test] +fn test_corner_case4() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/20/-10", "/30/-4"]) + .succeeds() + .stdout_only("18\n48\n75\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 3); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), generate(10, 26)); + assert_eq!(at.read("xx02"), generate(26, 51)); +} + +// NOTE: differs from gnu's output: the empty split is not written +#[test] +fn test_up_to_match_context_underflow() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/5/-10"]) + .fails() + .stdout_is("0\n141\n") + .stderr_is("csplit: error: '/5/-10': line number out of range"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/5/-10", "-k"]) + .fails() + .stdout_is("0\n141\n") + .stderr_is("csplit: error: '/5/-10': line number out of range"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("counting splits") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), ""); + assert_eq!(at.read("xx01"), generate(1, 51)); +} + +// the offset is out of range because of the first pattern +// NOTE: output different than gnu's: the empty split is written but the rest of the input file is not +#[test] +fn test_linenum_range_with_up_to_match1() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "10", "/12/-5"]) + .fails() + .stderr_is("csplit: error: '/12/-5': line number out of range") + .stdout_is("18\n0\n123\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "10", "/12/-5", "-k"]) + .fails() + .stderr_is("csplit: error: '/12/-5': line number out of range") + .stdout_is("18\n0\n123\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 3); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), ""); + assert_eq!(at.read("xx02"), generate(10, 51)); +} + +// the offset is out of range because more lines are needed than physically available +// NOTE: output different than gnu's: the empty split is not written but the rest of the input file is +#[test] +fn test_linenum_range_with_up_to_match2() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "10", "/12/-15"]) + .fails() + .stderr_is("csplit: error: '/12/-15': line number out of range") + .stdout_is("18\n0\n123\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 0); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "10", "/12/-15", "-k"]) + .fails() + .stderr_is("csplit: error: '/12/-15': line number out of range") + .stdout_is("18\n0\n123\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 3); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), ""); + assert_eq!(at.read("xx02"), generate(10, 51)); +} + +// NOTE: output different than gnu's: the pattern /10/ is matched but should not +#[test] +fn test_linenum_range_with_up_to_match3() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "10", "/10/", "-k"]) + .fails() + .stderr_is("csplit: error: '/10/': match not found") + .stdout_is("18\n123\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 2); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), generate(10, 51)); + + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.args(&["numbers50.txt", "/10/", "10"]) + .succeeds() + .stdout_only("18\n0\n123\n"); + + let count = glob(&at.plus_as_string("xx*")) + .expect("there should be splits created") + .count(); + assert_eq!(count, 3); + assert_eq!(at.read("xx00"), generate(1, 10)); + assert_eq!(at.read("xx01"), ""); + assert_eq!(at.read("xx02"), generate(10, 51)); +} diff --git a/tests/fixtures/csplit/numbers50.txt b/tests/fixtures/csplit/numbers50.txt new file mode 100644 index 000000000..96cc55885 --- /dev/null +++ b/tests/fixtures/csplit/numbers50.txt @@ -0,0 +1,50 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 From 3a1eb1e05f3c1d389f897703403095f25cb21184 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 27 Dec 2020 15:33:20 +0100 Subject: [PATCH 263/606] Various fixes before landing csplit --- README.md | 13 +++---- src/uu/csplit/Cargo.toml | 1 + src/uu/csplit/src/csplit.rs | 34 +++++++++---------- .../src/{csplitError.rs => csplit_error.rs} | 0 src/uu/csplit/src/main.rs | 1 - src/uu/csplit/src/patterns.rs | 12 +++---- src/uu/csplit/src/splitname.rs | 3 +- tests/by-util/test_install.rs | 4 +-- 8 files changed, 33 insertions(+), 35 deletions(-) rename src/uu/csplit/src/{csplitError.rs => csplit_error.rs} (100%) diff --git a/README.md b/README.md index 7c1c4eb34..17efa01dd 100644 --- a/README.md +++ b/README.md @@ -289,9 +289,9 @@ Utilities | Done | Semi-Done | To Do | |-----------|-----------|--------| | arch | cp | chcon | -| base32 | expr | csplit | -| base64 | install | dd | -| basename | ls | numfmt | +| base32 | expr | dd | +| base64 | install | numfmt | +| basename | ls | stty | | cat | more | pr | | chgrp | od (`--strings` and 128-bit data types missing) | runcon | | chmod | printf | stty | @@ -299,9 +299,10 @@ Utilities | chroot | split | | | cksum | tail | | | comm | test | | -| cut | date | | -| dircolors | join | | -| dirname | df | | +| csplit | date | | +| cut | join | | +| dircolors | df | | +| dirname | | | | du | | | | echo | | | | env | | | diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index f44f80da0..414ffd3f3 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -21,6 +21,7 @@ failure_derive = "0.1.1" regex = "1.0.0" glob = "0.2.11" uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "csplit" diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index efdb12738..7c75e6309 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -16,26 +16,26 @@ mod patterns; */ mod splitname; mod patterns; -mod csplitError; +mod csplit_error; use crate::splitname::SplitName; -use crate::csplitError::CsplitError; +use crate::csplit_error::CsplitError; //mod split_name; //mod csplit; -static SYNTAX: &'static str = "[OPTION]... FILE PATTERN..."; -static SUMMARY: &'static str = "split a file into sections determined by context lines"; -static LONG_HELP: &'static str = "Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output."; +static SYNTAX: &str = "[OPTION]... FILE PATTERN..."; +static SUMMARY: &str = "split a file into sections determined by context lines"; +static LONG_HELP: &str = "Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output."; -static SUFFIX_FORMAT_OPT: &'static str = "suffix-format"; -static SUPPRESS_MATCHED_OPT: &'static str = "suppress-matched"; -static DIGITS_OPT: &'static str = "digits"; -static PREFIX_OPT: &'static str = "prefix"; -static KEEP_FILES_OPT: &'static str = "keep-files"; -static QUIET_OPT: &'static str = "quiet"; -static ELIDE_EMPTY_FILES_OPT: &'static str = "elide-empty-files"; +static SUFFIX_FORMAT_OPT: &str = "suffix-format"; +static SUPPRESS_MATCHED_OPT: &str = "suppress-matched"; +static DIGITS_OPT: &str = "digits"; +static PREFIX_OPT: &str = "prefix"; +static KEEP_FILES_OPT: &str = "keep-files"; +static QUIET_OPT: &str = "quiet"; +static ELIDE_EMPTY_FILES_OPT: &str = "elide-empty-files"; /// Command line options for csplit. pub struct CsplitOptions { @@ -250,7 +250,7 @@ impl<'a> SplitWriter<'a> { Some(ref mut current_writer) => { let bytes = line.as_bytes(); current_writer.write_all(bytes)?; - current_writer.write(b"\n")?; + current_writer.write_all(b"\n")?; self.size += bytes.len() + 1; } None => panic!("trying to write to a split that was not created"), @@ -274,7 +274,7 @@ impl<'a> SplitWriter<'a> { println!("{}", self.size); } } - return Ok(()); + Ok(()) } /// Removes all the split files that were created. @@ -325,10 +325,8 @@ impl<'a> SplitWriter<'a> { ret = Ok(()); break; } else if ln + 1 == n { - if !self.options.suppress_matched { - if input_iter.add_line_to_buffer(ln, l).is_some() { - panic!("the buffer is big enough to contain 1 line"); - } + if !self.options.suppress_matched && input_iter.add_line_to_buffer(ln, l).is_some() { + panic!("the buffer is big enough to contain 1 line"); } ret = Ok(()); break; diff --git a/src/uu/csplit/src/csplitError.rs b/src/uu/csplit/src/csplit_error.rs similarity index 100% rename from src/uu/csplit/src/csplitError.rs rename to src/uu/csplit/src/csplit_error.rs diff --git a/src/uu/csplit/src/main.rs b/src/uu/csplit/src/main.rs index 5ebe43a18..97aeb3821 100644 --- a/src/uu/csplit/src/main.rs +++ b/src/uu/csplit/src/main.rs @@ -1,2 +1 @@ - uucore_procs::main!(uu_csplit); // spell-checker:ignore procs uucore diff --git a/src/uu/csplit/src/patterns.rs b/src/uu/csplit/src/patterns.rs index 1fd1c8b8c..8ebedee2d 100644 --- a/src/uu/csplit/src/patterns.rs +++ b/src/uu/csplit/src/patterns.rs @@ -1,5 +1,5 @@ use regex::Regex; -use crate::csplitError::CsplitError; +use crate::csplit_error::CsplitError; /// The definition of a pattern to match on a line. #[derive(Debug)] @@ -147,7 +147,7 @@ fn extract_patterns(args: &[String]) -> Result, CsplitError> { }; patterns.push(Pattern::SkipToMatch(pattern, offset, execute_ntimes)); } - } else if let Some(line_number) = arg.parse::().ok() { + } else if let Ok(line_number) = arg.parse::() { patterns.push(Pattern::UpToLine(line_number, execute_ntimes)); } else { return Err(CsplitError::InvalidPattern(arg.to_string())); @@ -319,7 +319,7 @@ mod tests { fn line_number_zero() { let patterns = vec![Pattern::UpToLine(0, ExecutePattern::Times(1))]; match validate_line_numbers(&patterns) { - Err(::CsplitError::LineNumberIsZero) => (), + Err(CsplitError::LineNumberIsZero) => (), _ => panic!("expected LineNumberIsZero error"), } } @@ -328,7 +328,7 @@ mod tests { fn line_number_smaller_than_previous() { let input: Vec = vec!["10".to_string(), "5".to_string()]; match get_patterns(input.as_slice()) { - Err(::CsplitError::LineNumberSmallerThanPrevious(5, 10)) => (), + Err(CsplitError::LineNumberSmallerThanPrevious(5, 10)) => (), _ => panic!("expected LineNumberSmallerThanPrevious error"), } } @@ -337,7 +337,7 @@ mod tests { fn line_number_smaller_than_previous_separate() { let input: Vec = vec!["10".to_string(), "/20/".to_string(), "5".to_string()]; match get_patterns(input.as_slice()) { - Err(::CsplitError::LineNumberSmallerThanPrevious(5, 10)) => (), + Err(CsplitError::LineNumberSmallerThanPrevious(5, 10)) => (), _ => panic!("expected LineNumberSmallerThanPrevious error"), } } @@ -346,7 +346,7 @@ mod tests { fn line_number_zero_separate() { let input: Vec = vec!["10".to_string(), "/20/".to_string(), "0".to_string()]; match get_patterns(input.as_slice()) { - Err(::CsplitError::LineNumberIsZero) => (), + Err(CsplitError::LineNumberIsZero) => (), _ => panic!("expected LineNumberIsZero error"), } } diff --git a/src/uu/csplit/src/splitname.rs b/src/uu/csplit/src/splitname.rs index 1082d38ec..07457920b 100644 --- a/src/uu/csplit/src/splitname.rs +++ b/src/uu/csplit/src/splitname.rs @@ -1,7 +1,6 @@ use regex::Regex; -//mod csplit; -use crate::CsplitError; +use crate::csplit_error::CsplitError; /// Computes the filename of a split, taking into consideration a possible user-defined suffix /// format. diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 99e2abfd4..d91226045 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -323,8 +323,8 @@ fn test_install_copy_file() { assert!(at.file_exists(file2)); } -#[test] -#[cfg(target_os = "linux")] +/*#[test] +#[cfg(target_os = "linux")]*/ fn test_install_target_file_dev_null() { let (at, mut ucmd) = at_and_ucmd!(); let file1 = "/dev/null"; From 7955d346a849c39fa22bf6a4d9cb5da4e6797047 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 28 Dec 2020 14:37:33 +0100 Subject: [PATCH 264/606] csplit - rustfmt --- src/uu/csplit/src/csplit.rs | 25 +++++++++++-------------- src/uu/csplit/src/csplit_error.rs | 7 +++++-- src/uu/csplit/src/patterns.rs | 16 +++++++++------- src/uu/csplit/src/splitname.rs | 15 +++++++-------- 4 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index 7c75e6309..ddf99adf2 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -6,24 +6,20 @@ extern crate failure; extern crate uucore; extern crate getopts; extern crate regex; -use std::{fs::{File, remove_file}, io::{BufRead, BufWriter, Write}}; -use std::io::{self, BufReader}; use getopts::Matches; use regex::Regex; -/* -mod split_name; -mod patterns; -*/ -mod splitname; -mod patterns; +use std::io::{self, BufReader}; +use std::{ + fs::{remove_file, File}, + io::{BufRead, BufWriter, Write}, +}; + mod csplit_error; +mod patterns; +mod splitname; -use crate::splitname::SplitName; use crate::csplit_error::CsplitError; -//mod split_name; - - -//mod csplit; +use crate::splitname::SplitName; static SYNTAX: &str = "[OPTION]... FILE PATTERN..."; static SUMMARY: &str = "split a file into sections determined by context lines"; @@ -325,7 +321,8 @@ impl<'a> SplitWriter<'a> { ret = Ok(()); break; } else if ln + 1 == n { - if !self.options.suppress_matched && input_iter.add_line_to_buffer(ln, l).is_some() { + if !self.options.suppress_matched && input_iter.add_line_to_buffer(ln, l).is_some() + { panic!("the buffer is big enough to contain 1 line"); } ret = Ok(()); diff --git a/src/uu/csplit/src/csplit_error.rs b/src/uu/csplit/src/csplit_error.rs index dfbff3cb1..209a3468d 100644 --- a/src/uu/csplit/src/csplit_error.rs +++ b/src/uu/csplit/src/csplit_error.rs @@ -15,7 +15,10 @@ pub enum CsplitError { MatchNotFoundOnRepetition(String, usize), #[fail(display = "line number must be greater than zero")] LineNumberIsZero, - #[fail(display = "line number '{}' is smaller than preceding line number, {}", _0, _1)] + #[fail( + display = "line number '{}' is smaller than preceding line number, {}", + _0, _1 + )] LineNumberSmallerThanPrevious(usize, usize), #[fail(display = "invalid pattern: {}", _0)] InvalidPattern(String), @@ -31,4 +34,4 @@ impl From for CsplitError { fn from(error: io::Error) -> Self { CsplitError::IoError(error) } -} \ No newline at end of file +} diff --git a/src/uu/csplit/src/patterns.rs b/src/uu/csplit/src/patterns.rs index 8ebedee2d..d2f14578a 100644 --- a/src/uu/csplit/src/patterns.rs +++ b/src/uu/csplit/src/patterns.rs @@ -1,5 +1,5 @@ -use regex::Regex; use crate::csplit_error::CsplitError; +use regex::Regex; /// The definition of a pattern to match on a line. #[derive(Debug)] @@ -221,9 +221,10 @@ mod tests { "{4}", "/test4.*end$/+3", "/test5.*end$/-3", - ].into_iter() - .map(|v| v.to_string()) - .collect(); + ] + .into_iter() + .map(|v| v.to_string()) + .collect(); let patterns = get_patterns(input.as_slice()).unwrap(); assert_eq!(patterns.len(), 5); match patterns.get(0) { @@ -273,9 +274,10 @@ mod tests { "{4}", "%test4.*end$%+3", "%test5.*end$%-3", - ].into_iter() - .map(|v| v.to_string()) - .collect(); + ] + .into_iter() + .map(|v| v.to_string()) + .collect(); let patterns = get_patterns(input.as_slice()).unwrap(); assert_eq!(patterns.len(), 5); match patterns.get(0) { diff --git a/src/uu/csplit/src/splitname.rs b/src/uu/csplit/src/splitname.rs index 07457920b..cdfe9b105 100644 --- a/src/uu/csplit/src/splitname.rs +++ b/src/uu/csplit/src/splitname.rs @@ -44,9 +44,9 @@ impl SplitName { format!("{}{:0width$}", prefix, n, width = n_digits) }), Some(custom) => { - let spec = Regex::new( - r"(?P%(?P[0#-])(?P\d+)?(?P[diuoxX]))", - ).unwrap(); + let spec = + Regex::new(r"(?P%(?P[0#-])(?P\d+)?(?P[diuoxX]))") + .unwrap(); let mut captures_iter = spec.captures_iter(&custom); let custom_fn: Box String> = match captures_iter.next() { Some(captures) => { @@ -63,7 +63,6 @@ impl SplitName { /* * zero padding */ - // decimal ("0", "d") | ("0", "i") | ("0", "u") => { Box::new(move |n: usize| -> String { @@ -114,7 +113,6 @@ impl SplitName { /* * Alternate form */ - // octal ("#", "o") => Box::new(move |n: usize| -> String { format!( @@ -152,7 +150,6 @@ impl SplitName { /* * Left adjusted */ - // decimal ("-", "d") | ("-", "i") | ("-", "u") => { Box::new(move |n: usize| -> String { @@ -287,7 +284,8 @@ mod tests { Some(String::from("pre-")), Some(String::from("cst-%03d-post")), None, - ).unwrap(); + ) + .unwrap(); assert_eq!(split_name.get(2), "pre-cst-002-post"); } @@ -297,7 +295,8 @@ mod tests { None, Some(String::from("cst-%03d-")), Some(String::from("42")), - ).unwrap(); + ) + .unwrap(); assert_eq!(split_name.get(2), "xxcst-002-"); } From c2dc05eb5650f910c466298e96186667f6346c3e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 28 Dec 2020 17:03:04 +0100 Subject: [PATCH 265/606] Rust 1.32 --- Cargo.lock | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 607f0d176..4e9f3c2f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" @@ -227,6 +229,7 @@ dependencies = [ "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -252,6 +255,7 @@ dependencies = [ "uu_cksum 0.0.1", "uu_comm 0.0.1", "uu_cp 0.0.1", + "uu_csplit 0.0.1", "uu_cut 0.0.1", "uu_date 0.0.1", "uu_df 0.0.1", @@ -495,7 +499,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bstr 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -622,6 +626,11 @@ dependencies = [ "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "glob" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "glob" version = "0.3.0" @@ -689,7 +698,7 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1150,7 +1159,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1158,7 +1167,7 @@ name = "serde_json" version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1216,7 +1225,7 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.55" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1490,6 +1499,19 @@ dependencies = [ "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "uu_csplit" +version = "0.0.1" +dependencies = [ + "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.4", + "uucore_procs 0.0.4", +] + [[package]] name = "uu_cut" version = "0.0.1" @@ -2355,7 +2377,7 @@ version = "0.0.4" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2402,7 +2424,7 @@ dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2422,7 +2444,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2556,6 +2578,7 @@ dependencies = [ "checksum generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fceb69994e330afed50c93524be68c42fa898c2d9fd4ee8da03bd7363acd26f2" "checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" "checksum getrandom 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" +"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" "checksum half 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d36fab90f82edc3c747f9d438e06cf0a491055896f2a279638bb5beed6c40177" "checksum hermit-abi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" @@ -2565,7 +2588,7 @@ dependencies = [ "checksum isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e31a8281fc93ec9693494da65fbf28c0c2aa60a2eaec25dc58e2f31952e95edc" "checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" "checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -"checksum itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" +"checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" "checksum js-sys 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" @@ -2634,7 +2657,7 @@ dependencies = [ "checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 1.0.55 (registry+https://github.com/rust-lang/crates.io-index)" = "a571a711dddd09019ccc628e1b17fe87c59b09d513c06c026877aa708334f37a" +"checksum syn 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)" = "a9802ddde94170d186eeee5005b798d9c159fa970403f1be19976d0cfb939b72" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" From bc4c82b132a36f46aaa777e3ff7886a1487656f0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 28 Dec 2020 23:46:13 +0100 Subject: [PATCH 266/606] Fix some clippy warnings --- src/uu/csplit/src/csplit.rs | 52 +++++++++++++++++++--------------- src/uu/csplit/src/splitname.rs | 2 +- tests/by-util/test_install.rs | 4 +-- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index ddf99adf2..b0e341a58 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -8,6 +8,7 @@ extern crate getopts; extern crate regex; use getopts::Matches; use regex::Regex; +use std::cmp::Ordering; use std::io::{self, BufReader}; use std::{ fs::{remove_file, File}, @@ -87,7 +88,7 @@ where T: BufRead, { let mut input_iter = InputSplitter::new(input.lines().enumerate()); - let mut split_writer = SplitWriter::new(&options)?; + let mut split_writer = SplitWriter::new(&options); let ret = do_csplit(&mut split_writer, patterns, &mut input_iter); // consume the rest @@ -98,7 +99,7 @@ where for (_, line) in input_iter { split_writer.writeln(line?)?; } - split_writer.finish_split()?; + split_writer.finish_split(); } // delete files on error by default if ret.is_err() && !options.keep_files { @@ -118,6 +119,7 @@ where // split the file based on patterns for pattern in patterns.into_iter() { let pattern_as_str = pattern.to_string(); + #[allow(clippy::match_like_matches_macro)] let is_skip = if let patterns::Pattern::SkipToMatch(_, _, _) = pattern { true } else { @@ -204,14 +206,14 @@ impl<'a> Drop for SplitWriter<'a> { } impl<'a> SplitWriter<'a> { - fn new(options: &CsplitOptions) -> io::Result { - Ok(SplitWriter { + fn new(options: &CsplitOptions) -> SplitWriter { + SplitWriter { options, counter: 0, current_writer: None, size: 0, dev_null: false, - }) + } } /// Creates a new split and returns its filename. @@ -262,7 +264,7 @@ impl<'a> SplitWriter<'a> { /// # Errors /// /// Some [`io::Error`] if the split could not be removed in case it should be elided. - fn finish_split(&mut self) -> io::Result<()> { + fn finish_split(&mut self) { if !self.dev_null { if self.options.elide_empty_files && self.size == 0 { self.counter -= 1; @@ -270,7 +272,6 @@ impl<'a> SplitWriter<'a> { println!("{}", self.size); } } - Ok(()) } /// Removes all the split files that were created. @@ -314,23 +315,28 @@ impl<'a> SplitWriter<'a> { let mut ret = Err(CsplitError::LineOutOfRange(pattern_as_str.to_string())); while let Some((ln, line)) = input_iter.next() { let l = line?; - if ln + 1 > n { - if input_iter.add_line_to_buffer(ln, l).is_some() { - panic!("the buffer is big enough to contain 1 line"); + match n.cmp(&(&ln + 1)) { + Ordering::Less => { + if input_iter.add_line_to_buffer(ln, l).is_some() { + panic!("the buffer is big enough to contain 1 line"); + } + ret = Ok(()); + break; } - ret = Ok(()); - break; - } else if ln + 1 == n { - if !self.options.suppress_matched && input_iter.add_line_to_buffer(ln, l).is_some() - { - panic!("the buffer is big enough to contain 1 line"); + Ordering::Equal => { + if !self.options.suppress_matched + && input_iter.add_line_to_buffer(ln, l).is_some() + { + panic!("the buffer is big enough to contain 1 line"); + } + ret = Ok(()); + break; } - ret = Ok(()); - break; + Ordering::Greater => (), } self.writeln(l)?; } - self.finish_split()?; + self.finish_split(); ret } @@ -386,7 +392,7 @@ impl<'a> SplitWriter<'a> { self.writeln(line?)?; } None => { - self.finish_split()?; + self.finish_split(); return Err(CsplitError::LineOutOfRange( pattern_as_str.to_string(), )); @@ -394,7 +400,7 @@ impl<'a> SplitWriter<'a> { }; offset -= 1; } - self.finish_split()?; + self.finish_split(); return Ok(()); } self.writeln(l)?; @@ -420,7 +426,7 @@ impl<'a> SplitWriter<'a> { panic!("should be big enough to hold every lines"); } } - self.finish_split()?; + self.finish_split(); if input_iter.buffer_len() < offset_usize { return Err(CsplitError::LineOutOfRange(pattern_as_str.to_string())); } @@ -436,7 +442,7 @@ impl<'a> SplitWriter<'a> { } } - self.finish_split()?; + self.finish_split(); Err(CsplitError::MatchNotFound(pattern_as_str.to_string())) } } diff --git a/src/uu/csplit/src/splitname.rs b/src/uu/csplit/src/splitname.rs index cdfe9b105..66b17ba67 100644 --- a/src/uu/csplit/src/splitname.rs +++ b/src/uu/csplit/src/splitname.rs @@ -29,7 +29,7 @@ impl SplitName { n_digits_opt: Option, ) -> Result { // get the prefix - let prefix = prefix_opt.unwrap_or("xx".to_string()); + let prefix = prefix_opt.unwrap_or_else(|| "xx".to_string()); // the width for the split offset let n_digits = match n_digits_opt { None => 2, diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index d91226045..99e2abfd4 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -323,8 +323,8 @@ fn test_install_copy_file() { assert!(at.file_exists(file2)); } -/*#[test] -#[cfg(target_os = "linux")]*/ +#[test] +#[cfg(target_os = "linux")] fn test_install_target_file_dev_null() { let (at, mut ucmd) = at_and_ucmd!(); let file1 = "/dev/null"; From 7942a642313840f7d756e64c3b6b5bb492401968 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 30 Dec 2020 00:15:29 +0100 Subject: [PATCH 267/606] 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 --- src/bin/coreutils.rs | 3 --- src/uu/arch/src/arch.rs | 1 - src/uu/chmod/src/chmod.rs | 4 ---- src/uu/chown/src/chown.rs | 2 -- src/uu/chroot/src/chroot.rs | 2 -- src/uu/comm/src/comm.rs | 2 -- src/uu/cp/src/cp.rs | 8 -------- src/uu/csplit/src/csplit.rs | 2 -- src/uu/date/src/date.rs | 3 --- src/uu/df/src/df.rs | 6 ------ src/uu/dircolors/src/dircolors.rs | 2 -- src/uu/du/src/du.rs | 2 -- src/uu/expand/src/expand.rs | 3 --- src/uu/expr/src/expr.rs | 1 - src/uu/factor/src/factor.rs | 2 -- src/uu/fmt/src/fmt.rs | 2 -- src/uu/groups/src/groups.rs | 1 - src/uu/hashsum/src/hashsum.rs | 8 -------- src/uu/hostid/src/hostid.rs | 2 -- src/uu/hostname/src/hostname.rs | 6 ------ src/uu/id/src/id.rs | 2 -- src/uu/install/src/install.rs | 3 --- src/uu/install/src/mode.rs | 2 -- src/uu/join/src/join.rs | 2 -- src/uu/kill/src/kill.rs | 2 -- src/uu/logname/src/logname.rs | 2 -- src/uu/ls/src/ls.rs | 9 --------- src/uu/mkdir/src/mkdir.rs | 2 -- src/uu/mkfifo/src/mkfifo.rs | 3 --- src/uu/mknod/src/mknod.rs | 3 --- src/uu/mknod/src/parsemode.rs | 1 - src/uu/mktemp/src/mktemp.rs | 4 ---- src/uu/mktemp/src/tempdir.rs | 1 - src/uu/more/src/more.rs | 2 -- src/uu/mv/src/mv.rs | 3 --- src/uu/nice/src/nice.rs | 3 --- src/uu/nl/src/helper.rs | 3 --- src/uu/nl/src/nl.rs | 6 ------ src/uu/nohup/src/nohup.rs | 3 --- src/uu/nproc/src/nproc.rs | 6 ------ src/uu/numfmt/src/numfmt.rs | 2 -- src/uu/od/src/od.rs | 4 ---- src/uu/paste/src/paste.rs | 2 -- src/uu/pathchk/src/pathchk.rs | 3 --- src/uu/printenv/src/printenv.rs | 2 -- src/uu/printf/src/printf.rs | 3 --- src/uu/ptx/src/ptx.rs | 6 ------ src/uu/pwd/src/pwd.rs | 2 -- src/uu/readlink/src/readlink.rs | 2 -- src/uu/realpath/src/realpath.rs | 2 -- src/uu/relpath/src/relpath.rs | 2 -- src/uu/rm/src/rm.rs | 4 ---- src/uu/rmdir/src/rmdir.rs | 2 -- src/uu/seq/src/seq.rs | 2 -- src/uu/shred/src/shred.rs | 3 --- src/uu/shuf/src/shuf.rs | 3 --- src/uu/sleep/src/sleep.rs | 2 -- src/uu/sort/src/sort.rs | 5 ----- src/uu/split/src/split.rs | 2 -- src/uu/stat/src/stat.rs | 2 -- src/uu/stdbuf/src/libstdbuf/build.rs | 2 -- src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs | 1 - src/uu/stdbuf/src/stdbuf.rs | 3 --- src/uu/sum/src/sum.rs | 2 -- src/uu/sync/src/sync.rs | 1 - src/uu/tac/src/tac.rs | 2 -- src/uu/tail/src/platform/redox.rs | 2 -- src/uu/tail/src/platform/unix.rs | 2 -- src/uu/tail/src/tail.rs | 3 --- src/uu/tee/src/tee.rs | 4 ---- src/uu/test/src/test.rs | 4 ---- src/uu/timeout/src/timeout.rs | 4 ---- src/uu/touch/src/touch.rs | 2 -- src/uu/tr/src/tr.rs | 4 ---- src/uu/truncate/src/truncate.rs | 2 -- src/uu/tsort/src/tsort.rs | 2 -- src/uu/tty/src/tty.rs | 3 --- src/uu/uname/src/uname.rs | 2 -- src/uu/unexpand/src/unexpand.rs | 3 --- src/uu/uniq/src/uniq.rs | 2 -- src/uu/unlink/src/unlink.rs | 3 --- src/uu/uptime/src/uptime.rs | 4 ---- src/uu/users/src/users.rs | 1 - src/uu/wc/src/wc.rs | 1 - src/uu/whoami/src/platform/windows.rs | 2 -- src/uucore/src/lib/features/fs.rs | 5 ----- src/uucore/src/lib/lib.rs | 4 ---- src/uucore/src/lib/mods/coreopts.rs | 2 -- 88 files changed, 251 deletions(-) diff --git a/src/bin/coreutils.rs b/src/bin/coreutils.rs index f813f2ae5..b172edbd3 100644 --- a/src/bin/coreutils.rs +++ b/src/bin/coreutils.rs @@ -5,9 +5,6 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -extern crate textwrap; -extern crate uucore; - use std::cmp; use std::collections::hash_map::HashMap; use std::ffi::OsString; diff --git a/src/uu/arch/src/arch.rs b/src/uu/arch/src/arch.rs index 20c278942..20392b11f 100644 --- a/src/uu/arch/src/arch.rs +++ b/src/uu/arch/src/arch.rs @@ -6,7 +6,6 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -extern crate platform_info; #[macro_use] extern crate uucore; diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index bcba604e9..eee750f90 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -7,10 +7,6 @@ // spell-checker:ignore (ToDO) Chmoder cmode fmode fperm fref ugoa RFILE RFILE's -#[cfg(unix)] -extern crate libc; -extern crate walkdir; - #[macro_use] extern crate uucore; diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index 460f1da86..5ad82872b 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -14,10 +14,8 @@ use uucore::fs::resolve_relative_path; use uucore::libc::{gid_t, uid_t}; use uucore::perms::{wrap_chown, Verbosity}; -extern crate clap; use clap::{App, Arg}; -extern crate walkdir; use walkdir::WalkDir; use std::fs::{self, Metadata}; diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index c0205406a..773207363 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -8,8 +8,6 @@ // spell-checker:ignore (ToDO) NEWROOT Userspec pstatus -extern crate getopts; - #[macro_use] extern crate uucore; use uucore::entries; diff --git a/src/uu/comm/src/comm.rs b/src/uu/comm/src/comm.rs index 4e15ce9c9..3fb1ef395 100644 --- a/src/uu/comm/src/comm.rs +++ b/src/uu/comm/src/comm.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) delim mkdelim -extern crate getopts; - #[macro_use] extern crate uucore; diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index e933ce338..868c35f2d 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -10,22 +10,14 @@ // spell-checker:ignore (ToDO) ficlone linkgs lstat nlink nlinks pathbuf reflink strs xattrs -extern crate clap; -extern crate filetime; #[cfg(target_os = "linux")] #[macro_use] extern crate ioctl_sys; -extern crate libc; #[macro_use] extern crate quick_error; #[macro_use] extern crate uucore; -extern crate walkdir; -#[cfg(unix)] -extern crate xattr; -#[cfg(windows)] -extern crate winapi; #[cfg(windows)] use winapi::um::fileapi::CreateFileW; #[cfg(windows)] diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index b0e341a58..40a1a402c 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -4,8 +4,6 @@ extern crate failure; #[macro_use] extern crate uucore; -extern crate getopts; -extern crate regex; use getopts::Matches; use regex::Regex; use std::cmp::Ordering; diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 895c68b8c..5ee4b1610 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -9,9 +9,6 @@ // spell-checker:ignore (format) MMDDhhmm // spell-checker:ignore (ToDO) DATEFILE -extern crate chrono; - -extern crate clap; #[macro_use] extern crate uucore; diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index 58b0be4ed..e8bb641ec 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -9,17 +9,11 @@ // spell-checker:ignore (ToDO) mountinfo mtab BLOCKSIZE getmntinfo fobj mptr noatime Iused overmounted // spell-checker:ignore (libc/fs) asyncreads asyncwrites autofs bavail bfree bsize charspare cifs debugfs devfs devpts ffree frsize fsid fstypename fusectl inode inodes iosize kernfs mntbufp mntfromname mntonname mqueue namemax pipefs smbfs statfs statvfs subfs syncreads syncwrites sysfs wcslen -extern crate clap; -extern crate libc; -extern crate number_prefix; - #[macro_use] extern crate uucore; use clap::{App, Arg}; -#[cfg(windows)] -extern crate winapi; #[cfg(windows)] use winapi::um::errhandlingapi::GetLastError; #[cfg(windows)] diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index 0b6072999..6cb5f9e1b 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) clrtoeol dircolors eightbit endcode fnmatch leftcode multihardlink rightcode setenv sgid suid -extern crate glob; - #[macro_use] extern crate uucore; diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index f5071e749..4ed80f18b 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) BLOCKSIZE inode inodes ment strs -extern crate time; - #[macro_use] extern crate uucore; diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index e44282974..353c3e6bc 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -9,9 +9,6 @@ // spell-checker:ignore (ToDO) ctype cwidth iflag nbytes nspaces nums tspaces uflag -extern crate getopts; -extern crate unicode_width; - #[macro_use] extern crate uucore; diff --git a/src/uu/expr/src/expr.rs b/src/uu/expr/src/expr.rs index b63f8b6a8..fee85dfe1 100644 --- a/src/uu/expr/src/expr.rs +++ b/src/uu/expr/src/expr.rs @@ -5,7 +5,6 @@ //* For the full copyright and license information, please view the LICENSE //* file that was distributed with this source code. -extern crate onig; #[macro_use] extern crate uucore; diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index a7dc4fa2e..7beb6a043 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -5,8 +5,6 @@ // * For the full copyright and license information, please view the LICENSE file // * that was distributed with this source code. -extern crate rand; - use smallvec::SmallVec; use std::cell::RefCell; use std::fmt; diff --git a/src/uu/fmt/src/fmt.rs b/src/uu/fmt/src/fmt.rs index a7a3103b4..960b20185 100644 --- a/src/uu/fmt/src/fmt.rs +++ b/src/uu/fmt/src/fmt.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) PSKIP linebreak ostream parasplit tabwidth xanti xprefix -extern crate unicode_width; - #[macro_use] extern crate uucore; diff --git a/src/uu/groups/src/groups.rs b/src/uu/groups/src/groups.rs index e2ae61a91..2ce5fe70e 100644 --- a/src/uu/groups/src/groups.rs +++ b/src/uu/groups/src/groups.rs @@ -12,7 +12,6 @@ extern crate uucore; use uucore::entries::{get_groups, gid2grp, Locate, Passwd}; -extern crate clap; use clap::{App, Arg}; static VERSION: &str = env!("CARGO_PKG_VERSION"); diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index ca31514bc..ee7d2a0f7 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -11,14 +11,6 @@ #[macro_use] extern crate clap; -extern crate blake2_rfc; -extern crate hex; -extern crate md5; -extern crate regex; -extern crate regex_syntax; -extern crate sha1; -extern crate sha2; -extern crate sha3; #[macro_use] extern crate uucore; diff --git a/src/uu/hostid/src/hostid.rs b/src/uu/hostid/src/hostid.rs index 162335b3a..5a4909c62 100644 --- a/src/uu/hostid/src/hostid.rs +++ b/src/uu/hostid/src/hostid.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) gethostid -extern crate libc; - #[macro_use] extern crate uucore; diff --git a/src/uu/hostname/src/hostname.rs b/src/uu/hostname/src/hostname.rs index b574cf1d5..f37b6a74d 100644 --- a/src/uu/hostname/src/hostname.rs +++ b/src/uu/hostname/src/hostname.rs @@ -7,12 +7,6 @@ // spell-checker:ignore (ToDO) MAKEWORD addrs hashset -extern crate clap; -extern crate hostname; -extern crate libc; -#[cfg(windows)] -extern crate winapi; - #[macro_use] extern crate uucore; diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index c374de050..f07a850fa 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -15,8 +15,6 @@ #![allow(non_camel_case_types)] #![allow(dead_code)] -extern crate clap; - #[macro_use] extern crate uucore; diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index cf500c9de..b0c6f1930 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (ToDO) rwxr sourcepath targetpath -extern crate clap; -extern crate libc; - mod mode; #[macro_use] diff --git a/src/uu/install/src/mode.rs b/src/uu/install/src/mode.rs index 9c8eb2de0..a3de40c68 100644 --- a/src/uu/install/src/mode.rs +++ b/src/uu/install/src/mode.rs @@ -1,5 +1,3 @@ -extern crate libc; - use std::fs; use std::path::Path; #[cfg(not(windows))] diff --git a/src/uu/join/src/join.rs b/src/uu/join/src/join.rs index cbce1be84..d02a54eb3 100644 --- a/src/uu/join/src/join.rs +++ b/src/uu/join/src/join.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) autoformat FILENUM whitespaces pairable unpairable nocheck -extern crate clap; - #[macro_use] extern crate uucore; diff --git a/src/uu/kill/src/kill.rs b/src/uu/kill/src/kill.rs index d0df6fa3c..9af9c74f7 100644 --- a/src/uu/kill/src/kill.rs +++ b/src/uu/kill/src/kill.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) signalname pids -extern crate libc; - #[macro_use] extern crate uucore; diff --git a/src/uu/logname/src/logname.rs b/src/uu/logname/src/logname.rs index 4537bb9cd..c1f0c31aa 100644 --- a/src/uu/logname/src/logname.rs +++ b/src/uu/logname/src/logname.rs @@ -9,8 +9,6 @@ // spell-checker:ignore (ToDO) getlogin userlogin -extern crate libc; - #[macro_use] extern crate uucore; diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 5a20478bc..389ce48f0 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -7,15 +7,6 @@ // spell-checker:ignore (ToDO) cpio svgz webm somegroup nlink rmvb xspf -extern crate getopts; -#[cfg(unix)] -extern crate isatty; -extern crate number_prefix; -extern crate term_grid; -extern crate termsize; -extern crate time; -extern crate unicode_width; - #[cfg(unix)] #[macro_use] extern crate lazy_static; diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index 88580a96e..6b9fd68ea 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -5,8 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -extern crate clap; - #[macro_use] extern crate uucore; diff --git a/src/uu/mkfifo/src/mkfifo.rs b/src/uu/mkfifo/src/mkfifo.rs index 1906e604a..41582b14a 100644 --- a/src/uu/mkfifo/src/mkfifo.rs +++ b/src/uu/mkfifo/src/mkfifo.rs @@ -5,9 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -extern crate getopts; -extern crate libc; - #[macro_use] extern crate uucore; diff --git a/src/uu/mknod/src/mknod.rs b/src/uu/mknod/src/mknod.rs index 59d6b129f..1343501bb 100644 --- a/src/uu/mknod/src/mknod.rs +++ b/src/uu/mknod/src/mknod.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (ToDO) parsemode makedev sysmacros makenod newmode perror IFBLK IFCHR IFIFO -extern crate getopts; -extern crate libc; - mod parsemode; #[macro_use] diff --git a/src/uu/mknod/src/parsemode.rs b/src/uu/mknod/src/parsemode.rs index b180bb8e5..8f8f9af61 100644 --- a/src/uu/mknod/src/parsemode.rs +++ b/src/uu/mknod/src/parsemode.rs @@ -1,6 +1,5 @@ // spell-checker:ignore (ToDO) fperm -extern crate libc; use libc::{mode_t, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR}; use uucore::mode; diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index 508f21d2f..06645a7d7 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -8,10 +8,6 @@ // spell-checker:ignore (ToDO) tempfile tempdir SUFF TMPDIR tmpname -extern crate getopts; -extern crate rand; -extern crate tempfile; - #[macro_use] extern crate uucore; diff --git a/src/uu/mktemp/src/tempdir.rs b/src/uu/mktemp/src/tempdir.rs index 10c0bb62a..1b6c9d7b3 100644 --- a/src/uu/mktemp/src/tempdir.rs +++ b/src/uu/mktemp/src/tempdir.rs @@ -2,7 +2,6 @@ // Mainly taken from crate `tempdir` -extern crate rand; use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 5e0646b78..de4e10187 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) lflag ICANON tcgetattr tcsetattr TCSADRAIN -extern crate getopts; - #[macro_use] extern crate uucore; diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 3f8fddb02..6575ad37a 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -8,9 +8,6 @@ // spell-checker:ignore (ToDO) sourcepath targetpath -extern crate clap; -extern crate fs_extra; - #[macro_use] extern crate uucore; diff --git a/src/uu/nice/src/nice.rs b/src/uu/nice/src/nice.rs index 52fb287b1..1f79ea09b 100644 --- a/src/uu/nice/src/nice.rs +++ b/src/uu/nice/src/nice.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (ToDO) getpriority execvp setpriority nstr PRIO cstrs ENOENT -extern crate getopts; -extern crate libc; - #[macro_use] extern crate uucore; diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index d3b78ea04..e34cfd2ae 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -1,8 +1,5 @@ // spell-checker:ignore (ToDO) conv -extern crate getopts; -extern crate regex; - // parse_style parses a style string into a NumberingStyle. fn parse_style(chars: &[char]) -> Result { if chars.len() == 1 && chars[0] == 'a' { diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index bc8c62016..105bb196b 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -8,12 +8,6 @@ // spell-checker:ignore (ToDO) corasick memchr -extern crate aho_corasick; -extern crate getopts; -extern crate memchr; -extern crate regex; -extern crate regex_syntax; - #[macro_use] extern crate uucore; diff --git a/src/uu/nohup/src/nohup.rs b/src/uu/nohup/src/nohup.rs index 76919cd7e..67e281e38 100644 --- a/src/uu/nohup/src/nohup.rs +++ b/src/uu/nohup/src/nohup.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (ToDO) execvp SIGHUP cproc vprocmgr cstrs homeout -extern crate getopts; -extern crate libc; - #[macro_use] extern crate uucore; diff --git a/src/uu/nproc/src/nproc.rs b/src/uu/nproc/src/nproc.rs index d1dec9005..4eb538618 100644 --- a/src/uu/nproc/src/nproc.rs +++ b/src/uu/nproc/src/nproc.rs @@ -7,12 +7,6 @@ // spell-checker:ignore (ToDO) NPROCESSORS nprocs numstr threadstr sysconf -extern crate clap; -extern crate num_cpus; - -#[cfg(unix)] -extern crate libc; - #[macro_use] extern crate uucore; diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index bf7c51c9e..2099391b0 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -5,8 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -extern crate getopts; - use getopts::{Matches, Options}; use std::fmt; use std::io::BufRead; diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 64371bbe1..dbf784b76 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -7,10 +7,6 @@ // spell-checker:ignore (ToDO) formatteriteminfo inputdecoder inputoffset mockstream nrofbytes partialreader odfunc multifile exitcode -extern crate byteorder; -extern crate getopts; -extern crate half; - #[macro_use] extern crate uucore; diff --git a/src/uu/paste/src/paste.rs b/src/uu/paste/src/paste.rs index 345e3722a..cff96d18e 100644 --- a/src/uu/paste/src/paste.rs +++ b/src/uu/paste/src/paste.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) delim -extern crate getopts; - #[macro_use] extern crate uucore; diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index 972cd4873..745d0d36c 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -9,9 +9,6 @@ // spell-checker:ignore (ToDO) lstat -extern crate getopts; -extern crate libc; - #[macro_use] extern crate uucore; diff --git a/src/uu/printenv/src/printenv.rs b/src/uu/printenv/src/printenv.rs index 78f90382a..34571ddad 100644 --- a/src/uu/printenv/src/printenv.rs +++ b/src/uu/printenv/src/printenv.rs @@ -7,8 +7,6 @@ /* last synced with: printenv (GNU coreutils) 8.13 */ -extern crate clap; - #[macro_use] extern crate uucore; diff --git a/src/uu/printf/src/printf.rs b/src/uu/printf/src/printf.rs index e7ce41d2a..c2952e5a9 100644 --- a/src/uu/printf/src/printf.rs +++ b/src/uu/printf/src/printf.rs @@ -3,9 +3,6 @@ // spell-checker:ignore (change!) each's // spell-checker:ignore (ToDO) LONGHELP FORMATSTRING templating parameterizing formatstr -extern crate itertools; -extern crate uucore; - mod cli; mod memo; mod tokenize; diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index 3621e1bdf..8421e52bc 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -7,12 +7,6 @@ // spell-checker:ignore (ToDOs) corasick memchr Roff trunc oset iset -extern crate aho_corasick; -extern crate getopts; -extern crate memchr; -extern crate regex; -extern crate regex_syntax; - #[macro_use] extern crate uucore; diff --git a/src/uu/pwd/src/pwd.rs b/src/uu/pwd/src/pwd.rs index 9196328ec..1786d33ee 100644 --- a/src/uu/pwd/src/pwd.rs +++ b/src/uu/pwd/src/pwd.rs @@ -5,8 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -extern crate clap; - #[macro_use] extern crate uucore; diff --git a/src/uu/readlink/src/readlink.rs b/src/uu/readlink/src/readlink.rs index ce8a65622..8bc9a2aeb 100644 --- a/src/uu/readlink/src/readlink.rs +++ b/src/uu/readlink/src/readlink.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) errno -extern crate clap; - #[macro_use] extern crate uucore; diff --git a/src/uu/realpath/src/realpath.rs b/src/uu/realpath/src/realpath.rs index db7ce846b..20aaa2fcb 100644 --- a/src/uu/realpath/src/realpath.rs +++ b/src/uu/realpath/src/realpath.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) retcode -extern crate getopts; - #[macro_use] extern crate uucore; diff --git a/src/uu/relpath/src/relpath.rs b/src/uu/relpath/src/relpath.rs index e48d43b44..4e165df1f 100644 --- a/src/uu/relpath/src/relpath.rs +++ b/src/uu/relpath/src/relpath.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) subpath absto absfrom absbase -extern crate getopts; - #[macro_use] extern crate uucore; diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 28f854319..4c81c97cc 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -7,10 +7,6 @@ // spell-checker:ignore (ToDO) bitor ulong -extern crate clap; -extern crate remove_dir_all; -extern crate walkdir; - #[macro_use] extern crate uucore; diff --git a/src/uu/rmdir/src/rmdir.rs b/src/uu/rmdir/src/rmdir.rs index b551060bd..7a7e8fc9b 100644 --- a/src/uu/rmdir/src/rmdir.rs +++ b/src/uu/rmdir/src/rmdir.rs @@ -5,8 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -extern crate clap; - #[macro_use] extern crate uucore; diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index d7fb2de48..6a8a57a01 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -3,8 +3,6 @@ // spell-checker:ignore (ToDO) istr chiter argptr ilen -extern crate clap; - #[macro_use] extern crate uucore; diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 8b12f0195..9d945ea03 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -8,9 +8,6 @@ // spell-checker:ignore (ToDO) NAMESET FILESIZE fstab coeff journaling writeback REiser journaled -extern crate getopts; -extern crate rand; - use rand::{Rng, ThreadRng}; use std::cell::{Cell, RefCell}; use std::fs; diff --git a/src/uu/shuf/src/shuf.rs b/src/uu/shuf/src/shuf.rs index 6006b7875..9f4bb01c4 100644 --- a/src/uu/shuf/src/shuf.rs +++ b/src/uu/shuf/src/shuf.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (ToDO) cmdline evec seps rvec fdata -extern crate getopts; -extern crate rand; - #[macro_use] extern crate uucore; diff --git a/src/uu/sleep/src/sleep.rs b/src/uu/sleep/src/sleep.rs index 1097da886..f08a6d3a4 100644 --- a/src/uu/sleep/src/sleep.rs +++ b/src/uu/sleep/src/sleep.rs @@ -5,8 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -extern crate getopts; - #[macro_use] extern crate uucore; diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 60e0b4127..8e79ff947 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -7,11 +7,6 @@ #![allow(dead_code)] // spell-checker:ignore (ToDO) outfile nondictionary - -extern crate clap; -extern crate semver; - -extern crate itertools; #[macro_use] extern crate uucore; diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index ee6b8e9fd..c2109a562 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) PREFIXaa -extern crate getopts; - #[macro_use] extern crate uucore; diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index a9588dee0..322f224b3 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) mtab fsext showfs otype fmtstr prec ftype blocksize nlink rdev fnodes fsid namelen blksize inodes fstype iosize statfs gnulib NBLOCKSIZE -extern crate clap; - #[macro_use] mod fsext; pub use crate::fsext::*; diff --git a/src/uu/stdbuf/src/libstdbuf/build.rs b/src/uu/stdbuf/src/libstdbuf/build.rs index 95f55ed94..fc8ddeac8 100644 --- a/src/uu/stdbuf/src/libstdbuf/build.rs +++ b/src/uu/stdbuf/src/libstdbuf/build.rs @@ -1,7 +1,5 @@ // spell-checker:ignore (ToDO) libstdbuf -extern crate cpp_build; - use cpp_build::Config; fn main() { diff --git a/src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs b/src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs index 094c18ba6..fa36d4ab5 100644 --- a/src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs +++ b/src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs @@ -2,7 +2,6 @@ #[macro_use] extern crate cpp; -extern crate libc; #[macro_use] extern crate uucore; diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index dcae42d99..86523144c 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (ToDO) tempdir dyld dylib dragonflybsd optgrps libstdbuf -extern crate getopts; -extern crate tempfile; - #[macro_use] extern crate uucore; diff --git a/src/uu/sum/src/sum.rs b/src/uu/sum/src/sum.rs index 3fb28d15d..5c1652196 100644 --- a/src/uu/sum/src/sum.rs +++ b/src/uu/sum/src/sum.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) sysv -extern crate getopts; - #[macro_use] extern crate uucore; diff --git a/src/uu/sync/src/sync.rs b/src/uu/sync/src/sync.rs index 018ed8398..5d4cb4395 100644 --- a/src/uu/sync/src/sync.rs +++ b/src/uu/sync/src/sync.rs @@ -7,7 +7,6 @@ /* Last synced with: sync (GNU coreutils) 8.13 */ -extern crate clap; extern crate libc; #[macro_use] diff --git a/src/uu/tac/src/tac.rs b/src/uu/tac/src/tac.rs index 91bbea4d8..843babac9 100644 --- a/src/uu/tac/src/tac.rs +++ b/src/uu/tac/src/tac.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) sbytes slen -extern crate getopts; - #[macro_use] extern crate uucore; diff --git a/src/uu/tail/src/platform/redox.rs b/src/uu/tail/src/platform/redox.rs index 2c1efd318..bc6fb5220 100644 --- a/src/uu/tail/src/platform/redox.rs +++ b/src/uu/tail/src/platform/redox.rs @@ -1,7 +1,5 @@ // spell-checker:ignore (ToDO) ENOSYS EPERM -extern crate syscall; - use self::syscall::{Error, ENOSYS, EPERM}; pub type Pid = usize; diff --git a/src/uu/tail/src/platform/unix.rs b/src/uu/tail/src/platform/unix.rs index bbb1f1965..167f693e6 100644 --- a/src/uu/tail/src/platform/unix.rs +++ b/src/uu/tail/src/platform/unix.rs @@ -9,8 +9,6 @@ // spell-checker:ignore (ToDO) errno EPERM ENOSYS -extern crate libc; - use std::io::Error; pub type Pid = libc::pid_t; diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 949c7e5ca..cca70ee0e 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -9,9 +9,6 @@ // spell-checker:ignore (ToDO) seekable seek'd tail'ing ringbuffer ringbuf -extern crate getopts; -extern crate libc; - #[macro_use] extern crate uucore; diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index 1f6e26541..e29945382 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -5,10 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -extern crate getopts; - -extern crate uucore; - use std::fs::OpenOptions; use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write}; use std::path::{Path, PathBuf}; diff --git a/src/uu/test/src/test.rs b/src/uu/test/src/test.rs index dafe1913c..4394e4a8e 100644 --- a/src/uu/test/src/test.rs +++ b/src/uu/test/src/test.rs @@ -7,10 +7,6 @@ // spell-checker:ignore (ToDO) retval paren prec subprec cond -extern crate libc; -#[cfg(target_os = "redox")] -extern crate syscall; - use std::collections::HashMap; use std::str::from_utf8; diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index 59bbeca8f..0dd7c2016 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -7,10 +7,6 @@ // spell-checker:ignore (ToDO) tstr sigstr cmdname setpgid -extern crate getopts; -extern crate libc; -extern crate time; - #[macro_use] extern crate uucore; diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index ffde06ca6..913a5be9b 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -8,9 +8,7 @@ // spell-checker:ignore (ToDO) filetime strptime utcoff strs datetime MMDDhhmm -extern crate clap; pub extern crate filetime; -extern crate time; #[macro_use] extern crate uucore; diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index de65622a3..d60d2559a 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -10,10 +10,6 @@ // spell-checker:ignore (ToDO) allocs bset dflag cflag sflag tflag -extern crate bit_set; -extern crate fnv; -extern crate getopts; - #[macro_use] extern crate uucore; diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 04f79f883..58bd55bcf 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -7,8 +7,6 @@ // spell-checker:ignore (ToDO) RFILE refsize rfilename fsize tsize -extern crate clap; - #[macro_use] extern crate uucore; diff --git a/src/uu/tsort/src/tsort.rs b/src/uu/tsort/src/tsort.rs index dc7785645..0a0023031 100644 --- a/src/uu/tsort/src/tsort.rs +++ b/src/uu/tsort/src/tsort.rs @@ -6,8 +6,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -extern crate getopts; - #[macro_use] extern crate uucore; diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index 177fc8668..110f76d30 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -9,9 +9,6 @@ // spell-checker:ignore (ToDO) ttyname filedesc -extern crate getopts; -extern crate libc; - #[macro_use] extern crate uucore; diff --git a/src/uu/uname/src/uname.rs b/src/uu/uname/src/uname.rs index 3e386aed3..b9b75e2a4 100644 --- a/src/uu/uname/src/uname.rs +++ b/src/uu/uname/src/uname.rs @@ -10,8 +10,6 @@ // spell-checker:ignore (ToDO) nodename kernelname kernelrelease kernelversion sysname hwplatform mnrsv -extern crate clap; -extern crate platform_info; #[macro_use] extern crate uucore; diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index 57aa29b0a..59a2dc6a0 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -9,9 +9,6 @@ // spell-checker:ignore (ToDO) nums aflag uflag scol prevtab amode ctype cwidth nbytes lastcol pctype -extern crate getopts; -extern crate unicode_width; - #[macro_use] extern crate uucore; diff --git a/src/uu/uniq/src/uniq.rs b/src/uu/uniq/src/uniq.rs index 278106873..9261dba9b 100644 --- a/src/uu/uniq/src/uniq.rs +++ b/src/uu/uniq/src/uniq.rs @@ -5,8 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -extern crate clap; - #[macro_use] extern crate uucore; diff --git a/src/uu/unlink/src/unlink.rs b/src/uu/unlink/src/unlink.rs index 6fad6ca48..b85b6ea94 100644 --- a/src/uu/unlink/src/unlink.rs +++ b/src/uu/unlink/src/unlink.rs @@ -9,9 +9,6 @@ // spell-checker:ignore (ToDO) lstat IFLNK IFMT IFREG -extern crate getopts; -extern crate libc; - #[macro_use] extern crate uucore; diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index f53a15885..83d258818 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -10,10 +10,6 @@ // spell-checker:ignore (ToDO) getloadavg upsecs updays nusers loadavg boottime uphours upmins -extern crate chrono; -extern crate clap; -extern crate time; - use chrono::{Local, TimeZone, Utc}; use clap::{App, Arg}; diff --git a/src/uu/users/src/users.rs b/src/uu/users/src/users.rs index 4b4cdbeeb..4bb628441 100644 --- a/src/uu/users/src/users.rs +++ b/src/uu/users/src/users.rs @@ -10,7 +10,6 @@ // Allow dead code here in order to keep all fields, constants here, for consistency. #![allow(dead_code)] -extern crate clap; #[macro_use] extern crate uucore; diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index a0687e251..c6d5d72d8 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -7,7 +7,6 @@ // spell-checker:ignore (ToDO) fpath -extern crate clap; #[macro_use] extern crate uucore; diff --git a/src/uu/whoami/src/platform/windows.rs b/src/uu/whoami/src/platform/windows.rs index 7f9490a76..1d65281bd 100644 --- a/src/uu/whoami/src/platform/windows.rs +++ b/src/uu/whoami/src/platform/windows.rs @@ -9,8 +9,6 @@ // spell-checker:ignore (ToDO) advapi lmcons winnt getusername WCHAR UNLEN -extern crate advapi32; -extern crate uucore; extern crate winapi; use self::winapi::shared::lmcons; diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index 6fda8460a..adf4f6f82 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -6,11 +6,6 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -#[cfg(windows)] -extern crate dunce; -#[cfg(target_os = "redox")] -extern crate termion; - #[cfg(unix)] use libc::{ mode_t, S_IRGRP, S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 5d08dc9ac..6e974f577 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -3,10 +3,6 @@ // Copyright (C) ~ Alex Lyon // Copyright (C) ~ Roy Ivy III ; MIT license -//## external crates - -extern crate wild; - // * feature-gated external crates #[cfg(feature = "failure")] extern crate failure; diff --git a/src/uucore/src/lib/mods/coreopts.rs b/src/uucore/src/lib/mods/coreopts.rs index f1e382a3e..f3fb77335 100644 --- a/src/uucore/src/lib/mods/coreopts.rs +++ b/src/uucore/src/lib/mods/coreopts.rs @@ -1,5 +1,3 @@ -extern crate getopts; - pub struct HelpText<'a> { pub name: &'a str, pub version: &'a str, From 66b503a77e84850af37257cd37098af2c2778c82 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 2 Jan 2021 09:40:40 +0100 Subject: [PATCH 268/606] refactor(mktemp): move to clap --- Cargo.lock | 34 ++++----- src/uu/mktemp/Cargo.toml | 2 +- src/uu/mktemp/src/mktemp.rs | 148 ++++++++++++++++++------------------ 3 files changed, 91 insertions(+), 93 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4e9f3c2f0..77e7e009d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,3 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" @@ -436,7 +434,7 @@ dependencies = [ "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -618,10 +616,10 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -967,7 +965,7 @@ name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "getrandom 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1002,7 +1000,7 @@ name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "getrandom 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1159,12 +1157,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.60" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1225,7 +1223,7 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1336,7 +1334,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1822,7 +1820,7 @@ dependencies = [ name = "uu_mktemp" version = "0.0.1" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -2377,7 +2375,7 @@ version = "0.0.4" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2424,7 +2422,7 @@ dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2444,7 +2442,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2577,7 +2575,7 @@ dependencies = [ "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fceb69994e330afed50c93524be68c42fa898c2d9fd4ee8da03bd7363acd26f2" "checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -"checksum getrandom 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" +"checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" "checksum half 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d36fab90f82edc3c747f9d438e06cf0a491055896f2a279638bb5beed6c40177" @@ -2650,14 +2648,14 @@ dependencies = [ "checksum serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)" = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" "checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" "checksum serde_derive 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)" = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" -"checksum serde_json 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)" = "1500e84d27fe482ed1dc791a56eddc2f230046a040fa908c08bda1d9fb615779" +"checksum serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)" = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" "checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)" = "a9802ddde94170d186eeee5005b798d9c159fa970403f1be19976d0cfb939b72" +"checksum syn 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)" = "4211ce9909eb971f111059df92c45640aad50a619cf55cd76476be803c4c68e6" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index b188dbcbe..175f28b74 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/mktemp.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" rand = "0.5" tempfile = "3.0" uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index 06645a7d7..b9d4aebb6 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -11,6 +11,8 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; + use std::env; use std::iter; use std::mem::forget; @@ -21,76 +23,89 @@ use tempfile::Builder; mod tempdir; -static NAME: &str = "mktemp"; +static ABOUT: &str = "create a temporary file or directory."; static VERSION: &str = env!("CARGO_PKG_VERSION"); static DEFAULT_TEMPLATE: &str = "tmp.XXXXXXXXXX"; -pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); +static OPT_DIRECTORY: &str = "directory"; +static OPT_DRY_RUN: &str = "dry-run"; +static OPT_QUIET: &str = "quiet"; +static OPT_SUFFIX: &str = "suffix"; +static OPT_TMPDIR: &str = "tmpdir"; - let mut opts = getopts::Options::new(); - opts.optflag("d", "directory", "Make a directory instead of a file"); - opts.optflag( - "u", - "dry-run", - "do not create anything; merely print a name (unsafe)", - ); - opts.optflag("q", "quiet", "Fail silently if an error occurs."); - opts.optopt( - "", - "suffix", - "append SUFF to TEMPLATE; SUFF must not contain a path separator. \ +static ARG_TEMPLATE: &str = "template"; + +fn get_usage() -> String { + format!("{0} [OPTION]... [TEMPLATE]", executable!()) +} + +pub fn uumain(args: impl uucore::Args) -> i32 { + let usage = get_usage(); + + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_DIRECTORY) + .short("d") + .long(OPT_DIRECTORY) + .help("Make a directory instead of a file"), + ) + .arg( + Arg::with_name(OPT_DRY_RUN) + .short("u") + .long(OPT_DRY_RUN) + .help("do not create anything; merely print a name (unsafe)"), + ) + .arg( + Arg::with_name(OPT_QUIET) + .short("q") + .long("quiet") + .help("Fail silently if an error occurs."), + ) + .arg( + Arg::with_name(OPT_SUFFIX) + .long(OPT_SUFFIX) + .help( + "append SUFF to TEMPLATE; SUFF must not contain a path separator. \ This option is implied if TEMPLATE does not end with X.", - "SUFF", - ); - opts.optopt( - "p", - "tmpdir", - "interpret TEMPLATE relative to DIR; if DIR is not specified, use \ + ) + .value_name("SUFF"), + ) + .arg( + Arg::with_name(OPT_TMPDIR) + .short("p") + .long(OPT_TMPDIR) + .help( + "interpret TEMPLATE relative to DIR; if DIR is not specified, use \ $TMPDIR if set, else /tmp. With this option, TEMPLATE must not \ be an absolute name; unlike with -t, TEMPLATE may contain \ slashes, but mktemp creates only the final component", - "DIR", - ); + ) + .value_name("DIR"), + ) + .arg( + Arg::with_name(ARG_TEMPLATE) + .multiple(false) + .takes_value(true) + .max_values(1) + .default_value(DEFAULT_TEMPLATE), + ) + .get_matches_from(args); // deprecated option of GNU coreutils - // opts.optflag("t", "", "Generate a template (using the supplied prefix and TMPDIR if set) \ + // .arg( + // Arg::with_name(("t", "", "Generate a template (using the supplied prefix and TMPDIR if set) \ // to create a filename template"); - opts.optflag("", "help", "Print this help and exit"); - opts.optflag("", "version", "print the version and exit"); - // >> early return options - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f), - }; + let template = matches.value_of(ARG_TEMPLATE).unwrap(); - if matches.opt_present("help") { - print_help(&opts); - return 0; - } - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if 1 < matches.free.len() { - crash!(1, "Too many templates"); - } - // << - - let make_dir = matches.opt_present("directory"); - let dry_run = matches.opt_present("dry-run"); - let suffix_opt = matches.opt_str("suffix"); - let suppress_file_err = matches.opt_present("quiet"); - - let template = if matches.free.is_empty() { - DEFAULT_TEMPLATE - } else { - &matches.free[0][..] - }; + let make_dir = matches.is_present(OPT_DIRECTORY); + let dry_run = matches.is_present(OPT_DRY_RUN); + let suppress_file_err = matches.is_present(OPT_QUIET); let (prefix, rand, suffix) = match parse_template(template) { - Some((p, r, s)) => match suffix_opt { + Some((p, r, s)) => match matches.value_of(OPT_SUFFIX) { Some(suf) => { if s.is_empty() { (p, r, suf) @@ -101,9 +116,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) } } - None => (p, r, s.to_owned()), + None => (p, r, s), }, - None => ("", 0, "".to_owned()), + None => ("", 0, ""), }; if rand < 3 { @@ -114,7 +129,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { crash!(1, "suffix cannot contain any path separators"); } - let tmpdir = match matches.opt_str("tmpdir") { + let tmpdir = match matches.value_of(OPT_TMPDIR) { Some(s) => { if PathBuf::from(prefix).is_absolute() { show_info!( @@ -135,21 +150,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } -fn print_help(opts: &getopts::Options) { - let usage = format!( - " Create a temporary file or directory, safely, and print its name. -TEMPLATE must contain at least 3 consecutive 'X's in last component. -If TEMPLATE is not specified, use {}, and --tmpdir is implied", - DEFAULT_TEMPLATE - ); - - println!("{} {}", NAME, VERSION); - println!("SYNOPSIS"); - println!(" {} [OPTION]... [FILE]", NAME); - println!("Usage:"); - print!("{}", opts.usage(&usage[..])); -} - fn parse_template(temp: &str) -> Option<(&str, usize, &str)> { let right = match temp.rfind('X') { Some(r) => r + 1, From a2d6c85e443e1f6183ba78f5244f18cba0a7d581 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 1 Jan 2021 18:36:30 +0100 Subject: [PATCH 269/606] test(cp): cp /dev/null target is supposed to work. Add a test --- tests/by-util/test_cp.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index e7ea67d19..9210e7d17 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -903,3 +903,22 @@ fn test_cp_dont_preserve_timestamps() { assert!(res.as_secs() < 3605); assert!(result.success); } + +#[test] +#[cfg(target_os = "linux")] +fn test_cp_target_file_dev_null() { + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "/dev/null"; + let file2 = "test_cp_target_file_file_i2"; + + at.touch(file1); + at.touch(file2); + ucmd.arg(file1).arg(file2).fails(); + + /* Uncomment when fixed + ucmd.arg(file1).arg(file2).succeeds().no_stderr(); + + assert!(at.file_exists(file1)); + assert!(at.file_exists(file2)); + */ +} From 94e293f2bffab3c516d69e2132448c9135006f0d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 2 Jan 2021 10:14:18 +0100 Subject: [PATCH 270/606] fix formatting fr test_seq --- tests/by-util/test_seq.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_seq.rs b/tests/by-util/test_seq.rs index 5e60ab5de..b1265121b 100644 --- a/tests/by-util/test_seq.rs +++ b/tests/by-util/test_seq.rs @@ -14,7 +14,7 @@ fn test_count_down() { .args(&["--", "5", "-1", "1"]) .run() .stdout_is("5\n4\n3\n2\n1\n"); - new_ucmd!() + new_ucmd!() .args(&["5", "-1", "1"]) .run() .stdout_is("5\n4\n3\n2\n1\n"); From 105e2cb26f9334505515b74f8be86b802037f2af Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 2 Jan 2021 09:53:47 +0100 Subject: [PATCH 271/606] 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 --- src/uu/mktemp/src/mktemp.rs | 19 ++++++----- tests/by-util/test_mktemp.rs | 61 ++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 7 deletions(-) diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index b9d4aebb6..a0edf3df4 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -32,6 +32,7 @@ static OPT_DRY_RUN: &str = "dry-run"; static OPT_QUIET: &str = "quiet"; static OPT_SUFFIX: &str = "suffix"; static OPT_TMPDIR: &str = "tmpdir"; +static OPT_T: &str = "t"; static ARG_TEMPLATE: &str = "template"; @@ -79,12 +80,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_TMPDIR) .help( "interpret TEMPLATE relative to DIR; if DIR is not specified, use \ - $TMPDIR if set, else /tmp. With this option, TEMPLATE must not \ - be an absolute name; unlike with -t, TEMPLATE may contain \ + $TMPDIR if set, else /tmp. With this option, TEMPLATE must not \ + be an absolute name; unlike with -t, TEMPLATE may contain \ slashes, but mktemp creates only the final component", ) .value_name("DIR"), ) + .arg(Arg::with_name(OPT_T).short(OPT_T).help( + "Generate a template (using the supplied prefix and TMPDIR if set) \ + to create a filename template [deprecated]", + )) .arg( Arg::with_name(ARG_TEMPLATE) .multiple(false) @@ -93,10 +98,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .default_value(DEFAULT_TEMPLATE), ) .get_matches_from(args); - // deprecated option of GNU coreutils - // .arg( - // Arg::with_name(("t", "", "Generate a template (using the supplied prefix and TMPDIR if set) \ - // to create a filename template"); let template = matches.value_of(ARG_TEMPLATE).unwrap(); @@ -129,7 +130,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { crash!(1, "suffix cannot contain any path separators"); } - let tmpdir = match matches.value_of(OPT_TMPDIR) { + let mut tmpdir = match matches.value_of(OPT_TMPDIR) { Some(s) => { if PathBuf::from(prefix).is_absolute() { show_info!( @@ -143,6 +144,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { None => env::temp_dir(), }; + if matches.is_present(OPT_T) { + tmpdir = env::temp_dir() + }; + if dry_run { dry_exec(tmpdir, prefix, rand, &suffix) } else { diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index bf75d31bf..747a38d0d 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -65,6 +65,67 @@ fn test_mktemp_mktemp() { .fails(); } +#[test] +fn test_mktemp_mktemp_t() { + let scene = TestScenario::new(util_name!()); + + let pathname = scene.fixtures.as_string(); + + scene + .ucmd() + .env(TMPDIR, &pathname) + .arg("-t") + .arg(TEST_TEMPLATE1) + .succeeds(); + scene + .ucmd() + .env(TMPDIR, &pathname) + .arg("-t") + .arg(TEST_TEMPLATE2) + .fails(); + scene + .ucmd() + .env(TMPDIR, &pathname) + .arg("-t") + .arg(TEST_TEMPLATE3) + .fails(); + scene + .ucmd() + .env(TMPDIR, &pathname) + .arg("-t") + .arg(TEST_TEMPLATE4) + .fails(); + scene + .ucmd() + .env(TMPDIR, &pathname) + .arg("-t") + .arg(TEST_TEMPLATE5) + .succeeds(); + scene + .ucmd() + .env(TMPDIR, &pathname) + .arg("-t") + .arg(TEST_TEMPLATE6) + .succeeds(); + scene + .ucmd() + .env(TMPDIR, &pathname) + .arg("-t") + .arg(TEST_TEMPLATE7) + .succeeds(); + let result = scene + .ucmd() + .env(TMPDIR, &pathname) + .arg("-t") + .arg(TEST_TEMPLATE8) + .fails(); + println!("stdout {}", result.stdout); + println!("stderr {}", result.stderr); + assert!(result + .stderr + .contains("error: suffix cannot contain any path separators")); +} + #[test] fn test_mktemp_make_temp_dir() { let scene = TestScenario::new(util_name!()); From 7f1d47b77a069d2b0c01c26b3c6a5654d7089865 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 2 Jan 2021 22:35:03 +0100 Subject: [PATCH 272/606] refactor(ln): move to clap --- Cargo.lock | 1 + src/uu/ln/Cargo.toml | 1 + src/uu/ln/src/ln.rs | 266 +++++++++++++++++++++++---------------- tests/by-util/test_ln.rs | 6 +- 4 files changed, 160 insertions(+), 114 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 77e7e009d..6f431902c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1756,6 +1756,7 @@ dependencies = [ name = "uu_ln" version = "0.0.1" dependencies = [ + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", "uucore_procs 0.0.4", diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index 14846dcd3..7cde7973d 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/ln.rs" [dependencies] +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 078b9c2ea..1eaa83a23 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -10,6 +10,8 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; + use std::borrow::Cow; use std::ffi::OsStr; use std::fs; @@ -22,19 +24,6 @@ use std::os::windows::fs::{symlink_dir, symlink_file}; use std::path::{Path, PathBuf}; use uucore::fs::{canonicalize, CanonicalizeMode}; -static NAME: &str = "ln"; -static SUMMARY: &str = ""; -static LONG_HELP: &str = " - In the 1st form, create a link to TARGET with the name LINK_NAME. - In the 2nd form, create a link to TARGET in the current directory. - In the 3rd and 4th forms, create links to each TARGET in DIRECTORY. - Create hard links by default, symbolic links with --symbolic. - By default, each destination (name of new link) should not already exist. - When creating hard links, each TARGET must exist. Symbolic links - can hold arbitrary text; if later resolved, a relative link is - interpreted in relation to its parent directory. -"; - pub struct Settings { overwrite: OverwriteMode, backup: BackupMode, @@ -61,143 +50,202 @@ pub enum BackupMode { ExistingBackup, } -pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); +fn get_usage() -> String { + format!( + "{0} [OPTION]... [-T] TARGET LINK_executable!() (1st form) + {0} [OPTION]... TARGET (2nd form) + {0} [OPTION]... TARGET... DIRECTORY (3rd form) + {0} [OPTION]... -t DIRECTORY TARGET... (4th form)", + executable!() + ) +} - let syntax = format!( - "[OPTION]... [-T] TARGET LINK_NAME (1st form) - {0} [OPTION]... TARGET (2nd form) - {0} [OPTION]... TARGET... DIRECTORY (3rd form) - {0} [OPTION]... -t DIRECTORY TARGET... (4th form)", - NAME - ); - let matches = app!(&syntax, SUMMARY, LONG_HELP) - .optflag( - "b", - "", +fn get_long_usage() -> String { + String::from( + " In the 1st form, create a link to TARGET with the name LINK_executable!(). + In the 2nd form, create a link to TARGET in the current directory. + In the 3rd and 4th forms, create links to each TARGET in DIRECTORY. + Create hard links by default, symbolic links with --symbolic. + By default, each destination (name of new link) should not already exist. + When creating hard links, each TARGET must exist. Symbolic links + can hold arbitrary text; if later resolved, a relative link is + interpreted in relation to its parent directory. + ", + ) +} + +static ABOUT: &str = "change file owner and group"; +static VERSION: &str = env!("CARGO_PKG_VERSION"); + +static OPT_B: &str = "b"; +static OPT_BACKUP: &str = "backup"; +static OPT_FORCE: &str = "force"; +static OPT_INTERACTIVE: &str = "interactive"; +static OPT_SYMBOLIC: &str = "symbolic"; +static OPT_SUFFIX: &str = "suffix"; +static OPT_TARGET_DIRECTORY: &str = "target-directory"; +static OPT_NO_TARGET_DIRECTORY: &str = "no-target-directory"; +static OPT_RELATIVE: &str = "relative"; +static OPT_VERBOSE: &str = "verbose"; + +static ARG_FILES: &str = "files"; + +pub fn uumain(args: impl uucore::Args) -> i32 { + let usage = get_usage(); + let long_usage = get_long_usage(); + + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(&long_usage[..]) + .arg(Arg::with_name(OPT_B).short(OPT_B).help( "make a backup of each file that would otherwise be overwritten or \ removed", - ) - .optflagopt( - "", - "backup", - "make a backup of each file that would otherwise be overwritten \ + )) + .arg( + Arg::with_name(OPT_BACKUP) + .long(OPT_BACKUP) + .help( + "make a backup of each file that would otherwise be overwritten \ or removed", - "METHOD", + ) + .takes_value(true) + .possible_value("simple") + .possible_value("never") + .possible_value("numbered") + .possible_value("t") + .possible_value("existing") + .possible_value("nil") + .possible_value("none") + .possible_value("off") + .value_name("METHOD"), ) - // TODO: opts.optflag("d", "directory", "allow users with appropriate privileges to attempt \ + // TODO: opts.arg( + // Arg::with_name(("d", "directory", "allow users with appropriate privileges to attempt \ // to make hard links to directories"); - .optflag("f", "force", "remove existing destination files") - .optflag( - "i", - "interactive", - "prompt whether to remove existing destination files", + .arg( + Arg::with_name(OPT_FORCE) + .short("f") + .long(OPT_FORCE) + .help("remove existing destination files"), ) - // TODO: opts.optflag("L", "logical", "dereference TARGETs that are symbolic links"); - // TODO: opts.optflag("n", "no-dereference", "treat LINK_NAME as a normal file if it is a \ + .arg( + Arg::with_name(OPT_INTERACTIVE) + .short("i") + .long(OPT_INTERACTIVE) + .help("prompt whether to remove existing destination files"), + ) + // TODO: opts.arg( + // Arg::with_name(("L", "logical", "dereference TARGETs that are symbolic links"); + // TODO: opts.arg( + // Arg::with_name(("n", "no-dereference", "treat LINK_executable!() as a normal file if it is a \ // symbolic link to a directory"); - // TODO: opts.optflag("P", "physical", "make hard links directly to symbolic links"); - .optflag("s", "symbolic", "make symbolic links instead of hard links") - .optopt("S", "suffix", "override the usual backup suffix", "SUFFIX") - .optopt( - "t", - "target-directory", - "specify the DIRECTORY in which to create the links", - "DIRECTORY", + // TODO: opts.arg( + // Arg::with_name(("P", "physical", "make hard links directly to symbolic links"); + .arg( + Arg::with_name(OPT_SYMBOLIC) + .short("s") + .long("symbolic") + .help("make symbolic links instead of hard links"), ) - .optflag( - "T", - "no-target-directory", - "treat LINK_NAME as a normal file always", + .arg( + Arg::with_name(OPT_SUFFIX) + .short("S") + .long(OPT_SUFFIX) + .help("override the usual backup suffix") + .value_name("SUFFIX") + .takes_value(true), ) - .optflag( - "r", - "relative", - "create symbolic links relative to link location", + .arg( + Arg::with_name(OPT_TARGET_DIRECTORY) + .short("t") + .long(OPT_TARGET_DIRECTORY) + .help("specify the DIRECTORY in which to create the links") + .value_name("DIRECTORY") + .conflicts_with(OPT_NO_TARGET_DIRECTORY), ) - .optflag("v", "verbose", "print name of each linked file") - .parse(args); + .arg( + Arg::with_name(OPT_NO_TARGET_DIRECTORY) + .short("T") + .long(OPT_NO_TARGET_DIRECTORY) + .help("treat LINK_executable!() as a normal file always"), + ) + .arg( + Arg::with_name(OPT_RELATIVE) + .short("r") + .long(OPT_RELATIVE) + .help("create symbolic links relative to link location"), + ) + .arg( + Arg::with_name(OPT_VERBOSE) + .short("v") + .long(OPT_VERBOSE) + .help("print name of each linked file"), + ) + .arg( + Arg::with_name(ARG_FILES) + .multiple(true) + .takes_value(true) + .required(true) + .min_values(1), + ) + .get_matches_from(args); - let overwrite_mode = if matches.opt_present("force") { + /* the list of files */ + + let paths: Vec = matches + .values_of(ARG_FILES) + .unwrap() + .map(|path| PathBuf::from(path)) + .collect(); + + let overwrite_mode = if matches.is_present(OPT_FORCE) { OverwriteMode::Force - } else if matches.opt_present("interactive") { + } else if matches.is_present(OPT_INTERACTIVE) { OverwriteMode::Interactive } else { OverwriteMode::NoClobber }; - let backup_mode = if matches.opt_present("b") { + let backup_mode = if matches.is_present(OPT_B) { BackupMode::ExistingBackup - } else if matches.opt_present("backup") { - match matches.opt_str("backup") { + } else if matches.is_present(OPT_BACKUP) { + match matches.value_of(OPT_BACKUP) { None => BackupMode::ExistingBackup, Some(mode) => match &mode[..] { "simple" | "never" => BackupMode::SimpleBackup, "numbered" | "t" => BackupMode::NumberedBackup, "existing" | "nil" => BackupMode::ExistingBackup, "none" | "off" => BackupMode::NoBackup, - x => { - show_error!( - "invalid argument '{}' for 'backup method'\n\ - Try '{} --help' for more information.", - x, - NAME - ); - return 1; - } + _ => panic!(), // cannot happen as it is managed by clap }, } } else { BackupMode::NoBackup }; - let backup_suffix = if matches.opt_present("suffix") { - match matches.opt_str("suffix") { - Some(x) => x, - None => { - show_error!( - "option '--suffix' requires an argument\n\ - Try '{} --help' for more information.", - NAME - ); - return 1; - } - } + let backup_suffix = if matches.is_present(OPT_SUFFIX) { + matches.value_of(OPT_SUFFIX).unwrap() } else { - "~".to_owned() + "~" }; - if matches.opt_present("T") && matches.opt_present("t") { - show_error!("cannot combine --target-directory (-t) and --no-target-directory (-T)"); - return 1; - } - let settings = Settings { overwrite: overwrite_mode, backup: backup_mode, - suffix: backup_suffix, - symbolic: matches.opt_present("s"), - relative: matches.opt_present("r"), - target_dir: matches.opt_str("t"), - no_target_dir: matches.opt_present("T"), - verbose: matches.opt_present("v"), + suffix: backup_suffix.to_string(), + symbolic: matches.is_present(OPT_SYMBOLIC), + relative: matches.is_present(OPT_RELATIVE), + target_dir: matches.value_of(OPT_TARGET_DIRECTORY).map(String::from), + no_target_dir: matches.is_present(OPT_NO_TARGET_DIRECTORY), + verbose: matches.is_present(OPT_VERBOSE), }; - let string_to_path = |s: &String| PathBuf::from(s); - let paths: Vec = matches.free.iter().map(string_to_path).collect(); - exec(&paths[..], &settings) } fn exec(files: &[PathBuf], settings: &Settings) -> i32 { - if files.is_empty() { - show_error!( - "missing file operand\nTry '{} --help' for more information.", - NAME - ); - return 1; - } - // Handle cases where we create links in a directory first. if let Some(ref name) = settings.target_dir { // 4th form: a directory is specified by -t. @@ -228,7 +276,7 @@ fn exec(files: &[PathBuf], settings: &Settings) -> i32 { show_error!( "extra operand '{}'\nTry '{} --help' for more information.", files[2].display(), - NAME + executable!() ); return 1; } @@ -321,7 +369,7 @@ fn link(src: &PathBuf, dst: &PathBuf, settings: &Settings) -> Result<()> { match settings.overwrite { OverwriteMode::NoClobber => {} OverwriteMode::Interactive => { - print!("{}: overwrite '{}'? ", NAME, dst.display()); + print!("{}: overwrite '{}'? ", executable!(), dst.display()); if !read_yes() { return Ok(()); } diff --git a/tests/by-util/test_ln.rs b/tests/by-util/test_ln.rs index a84927c4c..e629407e6 100644 --- a/tests/by-util/test_ln.rs +++ b/tests/by-util/test_ln.rs @@ -322,11 +322,7 @@ fn test_symlink_errors() { // $ ln -T -t a b // ln: cannot combine --target-directory (-t) and --no-target-directory (-T) ucmd.args(&["-T", "-t", dir, file_a, file_b]) - .fails() - .stderr_is( - "ln: error: cannot combine --target-directory (-t) and --no-target-directory \ - (-T)\n", - ); + .fails(); } #[test] From 4a23a1a2182ffced12447ce3a9de391a255a9b23 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 3 Jan 2021 00:56:20 +0100 Subject: [PATCH 273/606] feature(ln): Implement -n --- src/uu/ln/src/ln.rs | 81 +++++++++++++++++++++++++--------- tests/by-util/test_ln.rs | 95 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 154 insertions(+), 22 deletions(-) diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 1eaa83a23..d257feb70 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -27,11 +27,13 @@ use uucore::fs::{canonicalize, CanonicalizeMode}; pub struct Settings { overwrite: OverwriteMode, backup: BackupMode, + force: bool, suffix: String, symbolic: bool, relative: bool, target_dir: Option, no_target_dir: bool, + no_dereference: bool, verbose: bool, } @@ -81,6 +83,7 @@ static OPT_B: &str = "b"; static OPT_BACKUP: &str = "backup"; static OPT_FORCE: &str = "force"; static OPT_INTERACTIVE: &str = "interactive"; +static OPT_NO_DEREFERENCE: &str = "no-dereference"; static OPT_SYMBOLIC: &str = "symbolic"; static OPT_SUFFIX: &str = "suffix"; static OPT_TARGET_DIRECTORY: &str = "target-directory"; @@ -136,11 +139,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_INTERACTIVE) .help("prompt whether to remove existing destination files"), ) + .arg( + Arg::with_name(OPT_NO_DEREFERENCE) + .short("n") + .long(OPT_NO_DEREFERENCE) + .help( + "treat LINK_executable!() as a normal file if it is a \ + symbolic link to a directory", + ), + ) // TODO: opts.arg( // Arg::with_name(("L", "logical", "dereference TARGETs that are symbolic links"); - // TODO: opts.arg( - // Arg::with_name(("n", "no-dereference", "treat LINK_executable!() as a normal file if it is a \ - // symbolic link to a directory"); + // // TODO: opts.arg( // Arg::with_name(("P", "physical", "make hard links directly to symbolic links"); .arg( @@ -192,7 +202,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .get_matches_from(args); - /* the list of files */ + /* the list of files */ let paths: Vec = matches .values_of(ARG_FILES) @@ -234,11 +244,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let settings = Settings { overwrite: overwrite_mode, backup: backup_mode, + force: matches.is_present(OPT_FORCE), suffix: backup_suffix.to_string(), symbolic: matches.is_present(OPT_SYMBOLIC), relative: matches.is_present(OPT_RELATIVE), target_dir: matches.value_of(OPT_TARGET_DIRECTORY).map(String::from), no_target_dir: matches.is_present(OPT_NO_TARGET_DIRECTORY), + no_dereference: matches.is_present(OPT_NO_DEREFERENCE), verbose: matches.is_present(OPT_VERBOSE), }; @@ -299,24 +311,47 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &PathBuf, settings: &Setting let mut all_successful = true; for srcpath in files.iter() { - let targetpath = match srcpath.as_os_str().to_str() { - Some(name) => { - match Path::new(name).file_name() { - Some(basename) => target_dir.join(basename), - // This can be None only for "." or "..". Trying - // to create a link with such name will fail with - // EEXIST, which agrees with the behavior of GNU - // coreutils. - None => target_dir.join(name), + let targetpath = if settings.no_dereference && settings.force { + // In that case, we don't want to do link resolution + // We need to clean the target + if is_symlink(target_dir) { + if target_dir.is_file() { + match fs::remove_file(target_dir) { + Err(e) => show_error!("Could not update {}: {}", target_dir.display(), e), + _ => (), + }; + } + if target_dir.is_dir() { + // Not sure why but on Windows, the symlink can be + // considered as a dir + // See test_ln::test_symlink_no_deref_dir + match fs::remove_dir(target_dir) { + Err(e) => show_error!("Could not update {}: {}", target_dir.display(), e), + _ => (), + }; } } - None => { - show_error!( - "cannot stat '{}': No such file or directory", - srcpath.display() - ); - all_successful = false; - continue; + target_dir.clone() + } else { + match srcpath.as_os_str().to_str() { + Some(name) => { + match Path::new(name).file_name() { + Some(basename) => target_dir.join(basename), + // This can be None only for "." or "..". Trying + // to create a link with such name will fail with + // EEXIST, which agrees with the behavior of GNU + // coreutils. + None => target_dir.join(name), + } + } + None => { + show_error!( + "cannot stat '{}': No such file or directory", + srcpath.display() + ); + all_successful = false; + continue; + } } }; @@ -389,6 +424,12 @@ fn link(src: &PathBuf, dst: &PathBuf, settings: &Settings) -> Result<()> { } } + if settings.no_dereference && settings.force { + if dst.exists() { + fs::remove_file(dst)?; + } + } + if settings.symbolic { symlink(&source, dst)?; } else { diff --git a/tests/by-util/test_ln.rs b/tests/by-util/test_ln.rs index e629407e6..89261036d 100644 --- a/tests/by-util/test_ln.rs +++ b/tests/by-util/test_ln.rs @@ -321,8 +321,7 @@ fn test_symlink_errors() { // $ ln -T -t a b // ln: cannot combine --target-directory (-t) and --no-target-directory (-T) - ucmd.args(&["-T", "-t", dir, file_a, file_b]) - .fails(); + ucmd.args(&["-T", "-t", dir, file_a, file_b]).fails(); } #[test] @@ -484,3 +483,95 @@ fn test_symlink_relative_dir() { assert!(at.is_symlink(link)); assert_eq!(at.resolve_link(link), dir); } + +#[test] +fn test_symlink_no_deref_dir() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let dir1 = "foo"; + let dir2 = "bar"; + let link = "baz"; + + at.mkdir(dir1); + at.mkdir(dir2); + scene + .ucmd() + .args(&["-s", dir2, link]) + .succeeds() + .no_stderr(); + assert!(at.dir_exists(dir1)); + assert!(at.dir_exists(dir2)); + assert!(at.is_symlink(link)); + assert_eq!(at.resolve_link(link), dir2); + + // try the normal behavior + scene + .ucmd() + .args(&["-sf", dir1, link]) + .succeeds() + .no_stderr(); + assert!(at.dir_exists(dir1)); + assert!(at.dir_exists(dir2)); + assert!(at.is_symlink("baz/foo")); + assert_eq!(at.resolve_link("baz/foo"), dir1); + + // Doesn't work without the force + scene.ucmd().args(&["-sn", dir1, link]).fails(); + + // Try with the no-deref + let result = scene.ucmd().args(&["-sfn", dir1, link]).run(); + println!("stdout {}", result.stdout); + println!("stderr {}", result.stderr); + assert!(result.success); + assert!(at.dir_exists(dir1)); + assert!(at.dir_exists(dir2)); + assert!(at.is_symlink(link)); + assert_eq!(at.resolve_link(link), dir1); +} + +#[test] +fn test_symlink_no_deref_file() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let file1 = "foo"; + let file2 = "bar"; + let link = "baz"; + + at.touch(file1); + at.touch(file2); + scene + .ucmd() + .args(&["-s", file2, link]) + .succeeds() + .no_stderr(); + assert!(at.file_exists(file1)); + assert!(at.file_exists(file2)); + assert!(at.is_symlink(link)); + assert_eq!(at.resolve_link(link), file2); + + // try the normal behavior + scene + .ucmd() + .args(&["-sf", file1, link]) + .succeeds() + .no_stderr(); + assert!(at.file_exists(file1)); + assert!(at.file_exists(file2)); + assert!(at.is_symlink("baz")); + assert_eq!(at.resolve_link("baz"), file1); + + // Doesn't work without the force + scene.ucmd().args(&["-sn", file1, link]).fails(); + + // Try with the no-deref + let result = scene.ucmd().args(&["-sfn", file1, link]).run(); + println!("stdout {}", result.stdout); + println!("stderr {}", result.stderr); + assert!(result.success); + assert!(at.file_exists(file1)); + assert!(at.file_exists(file2)); + assert!(at.is_symlink(link)); + assert_eq!(at.resolve_link(link), file1); +} From 18c39daed7006436fa5e96d20f3779ffa043b14e Mon Sep 17 00:00:00 2001 From: jaggededgedjustice Date: Tue, 5 Jan 2021 08:10:01 +0000 Subject: [PATCH 274/606] 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. --- src/uu/fold/src/fold.rs | 12 ++++-------- tests/by-util/test_fold.rs | 8 ++++++++ tests/fixtures/fold/lorem_ipsum_new_line.txt | 2 ++ .../fold/lorem_ipsum_new_line_80_column.expected | 11 +++++++++++ 4 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 tests/fixtures/fold/lorem_ipsum_new_line.txt create mode 100644 tests/fixtures/fold/lorem_ipsum_new_line_80_column.expected diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index 75d007dce..05f0725ef 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -97,9 +97,9 @@ fn fold(filenames: Vec, bytes: bool, spaces: bool, width: usize) { } #[inline] -fn fold_file(mut file: BufReader, bytes: bool, spaces: bool, width: usize) { - let mut line = String::new(); - while safe_unwrap!(file.read_line(&mut line)) > 0 { +fn fold_file(file: BufReader, bytes: bool, spaces: bool, width: usize) { + for line_result in file.lines() { + let mut line = safe_unwrap!(line_result); if bytes { let len = line.len(); let mut i = 0; @@ -194,11 +194,7 @@ fn fold_file(mut file: BufReader, bytes: bool, spaces: bool, width: output.push(ch); } if count > 0 { - if newline { - println!("{}", output); - } else { - print!("{}", output); - } + println!("{}", output); } } } diff --git a/tests/by-util/test_fold.rs b/tests/by-util/test_fold.rs index 57f90cee0..c17f300d2 100644 --- a/tests/by-util/test_fold.rs +++ b/tests/by-util/test_fold.rs @@ -23,3 +23,11 @@ fn test_40_column_word_boundary() { .run() .stdout_is_fixture("lorem_ipsum_40_column_word.expected"); } + +#[test] +fn test_default_warp_with_newlines() { + new_ucmd!() + .arg("lorem_ipsum_new_line.txt") + .run() + .stdout_is_fixture("lorem_ipsum_new_line_80_column.expected"); +} diff --git a/tests/fixtures/fold/lorem_ipsum_new_line.txt b/tests/fixtures/fold/lorem_ipsum_new_line.txt new file mode 100644 index 000000000..a844b83d7 --- /dev/null +++ b/tests/fixtures/fold/lorem_ipsum_new_line.txt @@ -0,0 +1,2 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc interdum suscipit sem vel ornare. Proin euismod, justo sed mollis dictum, eros urna ultricies augue, eu pharetra mi ex id ante. Duis convallis porttitor aliquam. Nunc vitae tincidunt ex. Suspendisse iaculis ligula ac diam consectetur lacinia. Donec vel velit dui. Etiam fringilla, dolor quis tempor vehicula, lacus turpis bibendum velit, et pellentesque elit odio a magna. +Cras vulputate tortor non libero vehicula euismod. Aliquam tincidunt nisl eget enim cursus, viverra sagittis magna commodo. Cras rhoncus egestas leo nec blandit. Suspendisse potenti. Etiam ullamcorper leo vel lacus vestibulum, cursus semper eros efficitur. In hac habitasse platea dictumst. Phasellus scelerisque vehicula fringilla. diff --git a/tests/fixtures/fold/lorem_ipsum_new_line_80_column.expected b/tests/fixtures/fold/lorem_ipsum_new_line_80_column.expected new file mode 100644 index 000000000..16ea4bab6 --- /dev/null +++ b/tests/fixtures/fold/lorem_ipsum_new_line_80_column.expected @@ -0,0 +1,11 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc interdum suscipit +sem vel ornare. Proin euismod, justo sed mollis dictum, eros urna ultricies augu +e, eu pharetra mi ex id ante. Duis convallis porttitor aliquam. Nunc vitae tinci +dunt ex. Suspendisse iaculis ligula ac diam consectetur lacinia. Donec vel velit + dui. Etiam fringilla, dolor quis tempor vehicula, lacus turpis bibendum velit, +et pellentesque elit odio a magna. +Cras vulputate tortor non libero vehicula euismod. Aliquam tincidunt nisl eget e +nim cursus, viverra sagittis magna commodo. Cras rhoncus egestas leo nec blandit +. Suspendisse potenti. Etiam ullamcorper leo vel lacus vestibulum, cursus semper + eros efficitur. In hac habitasse platea dictumst. Phasellus scelerisque vehicul +a fringilla. From 138e40707126dca404a68240a3d18ff39fbacd88 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 9 Jan 2021 20:51:18 +0100 Subject: [PATCH 275/606] pin byteorder, version 1.4 fails with Rust 1.32 (#1684) --- Cargo.lock | 67 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 1 + 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6f431902c..12e482b1e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,7 +204,7 @@ dependencies = [ [[package]] name = "const_fn" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -224,6 +224,7 @@ dependencies = [ name = "coreutils" version = "0.0.1" dependencies = [ + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -231,7 +232,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -430,12 +431,12 @@ dependencies = [ "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "tinytemplate 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tinytemplate 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -473,7 +474,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "const_fn 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "const_fn 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -544,7 +545,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1057,13 +1058,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.2" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1076,7 +1077,7 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.21" +version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1157,7 +1158,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1200,7 +1201,7 @@ dependencies = [ [[package]] name = "smallvec" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1223,7 +1224,7 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1312,7 +1313,7 @@ dependencies = [ [[package]] name = "thread_local" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1330,7 +1331,7 @@ dependencies = [ [[package]] name = "tinytemplate" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1505,7 +1506,7 @@ dependencies = [ "failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", "uucore_procs 0.0.4", ] @@ -1616,7 +1617,7 @@ dependencies = [ "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", "uucore_procs 0.0.4", ] @@ -1666,8 +1667,8 @@ dependencies = [ "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1868,8 +1869,8 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", "uucore_procs 0.0.4", ] @@ -1969,8 +1970,8 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", "uucore_procs 0.0.4", ] @@ -2376,7 +2377,7 @@ version = "0.0.4" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2423,7 +2424,7 @@ dependencies = [ "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2443,7 +2444,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2543,7 +2544,7 @@ dependencies = [ "checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" "checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum const_fn 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd51eab21ab4fd6a3bf889e2d0958c0a6e3a61ad04260325e919e652a2a62826" +"checksum const_fn 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6" "checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" "checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" "checksum cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d1cd8699ffa1b18fd388183f7762e0545eddbd5c6ec95e9e3b42a4a71a507ff" @@ -2634,9 +2635,9 @@ dependencies = [ "checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c" +"checksum regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -"checksum regex-syntax 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189" +"checksum regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)" = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" @@ -2653,10 +2654,10 @@ dependencies = [ "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" -"checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" +"checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)" = "4211ce9909eb971f111059df92c45640aad50a619cf55cd76476be803c4c68e6" +"checksum syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)" = "cc60a3d73ea6594cd712d830cc1f0390fd71542d8c8cd24e70cc54cdfd5e05d5" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" @@ -2665,9 +2666,9 @@ dependencies = [ "checksum termion 1.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c22cec9d8978d906be5ac94bceb5a010d885c626c4c8855721a4dbd20e3ac905" "checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +"checksum thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tinytemplate 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d3dc76004a03cec1c5932bca4cdc2e39aaa798e3f82363dd94f9adf6098c12f" +"checksum tinytemplate 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2ada8616fad06a2d0c455adc530de4ef57605a8120cc65da9653e0e9623ca74" "checksum typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" "checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" diff --git a/Cargo.toml b/Cargo.toml index d937ade3f..ecaf74ade 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -330,6 +330,7 @@ pin_cc = { version="1.0.61, < 1.0.62", package="cc" } ## cc v1.0.62 has compiler pin_rustc-demangle = { version="0.1.16, < 0.1.17", package="rustc-demangle" } ## rust-demangle v0.1.17 has compiler errors for MinRustV v1.32.0, expects 1.33 pin_same-file = { version="1.0.4, < 1.0.6", package="same-file" } ## same-file v1.0.6 has compiler errors for MinRustV v1.32.0, expects 1.34 pin_winapi-util = { version="0.1.2, < 0.1.3", package="winapi-util" } ## winapi-util v0.1.3 has compiler errors for MinRustV v1.32.0, expects 1.34 +pin_byteorder = { version="1.3.4, < 1.4.0", package="byteorder" } ## byteorder v1.4 has compiler errors for MinRustV v1.32.0, requires 1.3 (for `use of unstable library feature 'try_from' (see issue #33417)`) [dev-dependencies] conv = "0.3" From d9580c2f3ab6a097b5bd03b233afca3b3ff16663 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 9 Jan 2021 21:21:02 +0100 Subject: [PATCH 276/606] ls: move from isatty (deprecated) to atty (#1685) --- Cargo.lock | 14 +------------- src/uu/ls/Cargo.toml | 4 +++- src/uu/ls/src/ls.rs | 4 +--- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 12e482b1e..2fc6b114b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -668,17 +668,6 @@ name = "ioctl-sys" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "isatty" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "itertools" version = "0.8.2" @@ -1776,8 +1765,8 @@ dependencies = [ name = "uu_ls" version = "0.0.1" dependencies = [ + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2585,7 +2574,6 @@ dependencies = [ "checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" "checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" "checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" -"checksum isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e31a8281fc93ec9693494da65fbf28c0c2aa60a2eaec25dc58e2f31952e95edc" "checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" "checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" "checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index f53026d19..d14c46e0e 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -16,7 +16,6 @@ path = "src/ls.rs" [dependencies] getopts = "0.2.18" -isatty = "0.1" lazy_static = "1.0.1" number_prefix = "0.4" term_grid = "0.1.5" @@ -26,6 +25,9 @@ unicode-width = "0.1.5" uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +[target.'cfg(unix)'.dependencies] +atty = "0.2" + [[bin]] name = "ls" path = "src/main.rs" diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 389ce48f0..6c4ba38b1 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -13,8 +13,6 @@ extern crate lazy_static; #[macro_use] extern crate uucore; -#[cfg(unix)] -use isatty::stdout_isatty; use number_prefix::NumberPrefix; use std::cmp::Reverse; #[cfg(unix)] @@ -627,7 +625,7 @@ fn display_file_name( None => true, Some(val) => match val.as_ref() { "always" | "yes" | "force" => true, - "auto" | "tty" | "if-tty" => stdout_isatty(), + "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout), /* "never" | "no" | "none" | */ _ => false, }, }; From d9ae043a05a597ded1ea6a7f3b6bbd1a8b84cb72 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 10 Jan 2021 18:16:04 +0100 Subject: [PATCH 277/606] update of the version 0.0.1 => 0.0.2 (#1686) --- Cargo.lock | 386 ++++++++++++------------- Cargo.toml | 192 ++++++------ src/uu/arch/Cargo.toml | 2 +- src/uu/base32/Cargo.toml | 2 +- src/uu/base64/Cargo.toml | 2 +- src/uu/basename/Cargo.toml | 2 +- src/uu/cat/Cargo.toml | 2 +- src/uu/chgrp/Cargo.toml | 2 +- src/uu/chmod/Cargo.toml | 2 +- src/uu/chown/Cargo.toml | 2 +- src/uu/chroot/Cargo.toml | 2 +- src/uu/cksum/Cargo.toml | 2 +- src/uu/comm/Cargo.toml | 2 +- src/uu/cp/Cargo.toml | 2 +- src/uu/csplit/Cargo.toml | 2 +- src/uu/cut/Cargo.toml | 2 +- src/uu/date/Cargo.toml | 2 +- src/uu/df/Cargo.toml | 2 +- src/uu/dircolors/Cargo.toml | 2 +- src/uu/dirname/Cargo.toml | 2 +- src/uu/du/Cargo.toml | 2 +- src/uu/echo/Cargo.toml | 2 +- src/uu/env/Cargo.toml | 2 +- src/uu/expand/Cargo.toml | 2 +- src/uu/expr/Cargo.toml | 2 +- src/uu/factor/Cargo.toml | 2 +- src/uu/false/Cargo.toml | 2 +- src/uu/fmt/Cargo.toml | 2 +- src/uu/fold/Cargo.toml | 2 +- src/uu/groups/Cargo.toml | 2 +- src/uu/hashsum/Cargo.toml | 2 +- src/uu/head/Cargo.toml | 2 +- src/uu/hostid/Cargo.toml | 2 +- src/uu/hostname/Cargo.toml | 2 +- src/uu/id/Cargo.toml | 2 +- src/uu/install/Cargo.toml | 2 +- src/uu/join/Cargo.toml | 2 +- src/uu/kill/Cargo.toml | 2 +- src/uu/link/Cargo.toml | 2 +- src/uu/ln/Cargo.toml | 2 +- src/uu/logname/Cargo.toml | 2 +- src/uu/ls/Cargo.toml | 2 +- src/uu/mkdir/Cargo.toml | 2 +- src/uu/mkfifo/Cargo.toml | 2 +- src/uu/mknod/Cargo.toml | 2 +- src/uu/mktemp/Cargo.toml | 2 +- src/uu/more/Cargo.toml | 2 +- src/uu/mv/Cargo.toml | 2 +- src/uu/nice/Cargo.toml | 2 +- src/uu/nl/Cargo.toml | 2 +- src/uu/nohup/Cargo.toml | 2 +- src/uu/nproc/Cargo.toml | 2 +- src/uu/numfmt/Cargo.toml | 2 +- src/uu/od/Cargo.toml | 2 +- src/uu/paste/Cargo.toml | 2 +- src/uu/pathchk/Cargo.toml | 2 +- src/uu/pinky/Cargo.toml | 2 +- src/uu/printenv/Cargo.toml | 2 +- src/uu/printf/Cargo.toml | 2 +- src/uu/ptx/Cargo.toml | 2 +- src/uu/pwd/Cargo.toml | 2 +- src/uu/readlink/Cargo.toml | 2 +- src/uu/realpath/Cargo.toml | 2 +- src/uu/relpath/Cargo.toml | 2 +- src/uu/rm/Cargo.toml | 2 +- src/uu/rmdir/Cargo.toml | 2 +- src/uu/seq/Cargo.toml | 2 +- src/uu/shred/Cargo.toml | 2 +- src/uu/shuf/Cargo.toml | 2 +- src/uu/sleep/Cargo.toml | 2 +- src/uu/sort/Cargo.toml | 2 +- src/uu/split/Cargo.toml | 2 +- src/uu/stat/Cargo.toml | 2 +- src/uu/stdbuf/Cargo.toml | 4 +- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 2 +- src/uu/sum/Cargo.toml | 2 +- src/uu/sync/Cargo.toml | 2 +- src/uu/tac/Cargo.toml | 2 +- src/uu/tail/Cargo.toml | 2 +- src/uu/tee/Cargo.toml | 2 +- src/uu/test/Cargo.toml | 2 +- src/uu/timeout/Cargo.toml | 2 +- src/uu/touch/Cargo.toml | 2 +- src/uu/tr/Cargo.toml | 2 +- src/uu/true/Cargo.toml | 2 +- src/uu/truncate/Cargo.toml | 2 +- src/uu/tsort/Cargo.toml | 2 +- src/uu/tty/Cargo.toml | 2 +- src/uu/uname/Cargo.toml | 2 +- src/uu/unexpand/Cargo.toml | 2 +- src/uu/uniq/Cargo.toml | 2 +- src/uu/unlink/Cargo.toml | 2 +- src/uu/uptime/Cargo.toml | 2 +- src/uu/users/Cargo.toml | 2 +- src/uu/wc/Cargo.toml | 2 +- src/uu/who/Cargo.toml | 2 +- src/uu/whoami/Cargo.toml | 2 +- src/uu/yes/Cargo.toml | 2 +- 98 files changed, 386 insertions(+), 386 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2fc6b114b..6f832202c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -222,7 +222,7 @@ dependencies = [ [[package]] name = "coreutils" -version = "0.0.1" +version = "0.0.2" dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", @@ -242,101 +242,101 @@ dependencies = [ "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_arch 0.0.1", - "uu_base32 0.0.1", - "uu_base64 0.0.1", - "uu_basename 0.0.1", - "uu_cat 0.0.1", - "uu_chgrp 0.0.1", - "uu_chmod 0.0.1", - "uu_chown 0.0.1", - "uu_chroot 0.0.1", - "uu_cksum 0.0.1", - "uu_comm 0.0.1", - "uu_cp 0.0.1", - "uu_csplit 0.0.1", - "uu_cut 0.0.1", - "uu_date 0.0.1", - "uu_df 0.0.1", - "uu_dircolors 0.0.1", - "uu_dirname 0.0.1", - "uu_du 0.0.1", - "uu_echo 0.0.1", - "uu_env 0.0.1", - "uu_expand 0.0.1", - "uu_expr 0.0.1", - "uu_factor 0.0.1", - "uu_false 0.0.1", - "uu_fmt 0.0.1", - "uu_fold 0.0.1", - "uu_groups 0.0.1", - "uu_hashsum 0.0.1", - "uu_head 0.0.1", - "uu_hostid 0.0.1", - "uu_hostname 0.0.1", - "uu_id 0.0.1", - "uu_install 0.0.1", - "uu_join 0.0.1", - "uu_kill 0.0.1", - "uu_link 0.0.1", - "uu_ln 0.0.1", - "uu_logname 0.0.1", - "uu_ls 0.0.1", - "uu_mkdir 0.0.1", - "uu_mkfifo 0.0.1", - "uu_mknod 0.0.1", - "uu_mktemp 0.0.1", - "uu_more 0.0.1", - "uu_mv 0.0.1", - "uu_nice 0.0.1", - "uu_nl 0.0.1", - "uu_nohup 0.0.1", - "uu_nproc 0.0.1", - "uu_numfmt 0.0.1", - "uu_od 0.0.1", - "uu_paste 0.0.1", - "uu_pathchk 0.0.1", - "uu_pinky 0.0.1", - "uu_printenv 0.0.1", - "uu_printf 0.0.1", - "uu_ptx 0.0.1", - "uu_pwd 0.0.1", - "uu_readlink 0.0.1", - "uu_realpath 0.0.1", - "uu_relpath 0.0.1", - "uu_rm 0.0.1", - "uu_rmdir 0.0.1", - "uu_seq 0.0.1", - "uu_shred 0.0.1", - "uu_shuf 0.0.1", - "uu_sleep 0.0.1", - "uu_sort 0.0.1", - "uu_split 0.0.1", - "uu_stat 0.0.1", - "uu_stdbuf 0.0.1", - "uu_sum 0.0.1", - "uu_sync 0.0.1", - "uu_tac 0.0.1", - "uu_tail 0.0.1", - "uu_tee 0.0.1", - "uu_test 0.0.1", - "uu_timeout 0.0.1", - "uu_touch 0.0.1", - "uu_tr 0.0.1", - "uu_true 0.0.1", - "uu_truncate 0.0.1", - "uu_tsort 0.0.1", - "uu_tty 0.0.1", - "uu_uname 0.0.1", - "uu_unexpand 0.0.1", - "uu_uniq 0.0.1", - "uu_unlink 0.0.1", - "uu_uptime 0.0.1", - "uu_users 0.0.1", - "uu_wc 0.0.1", - "uu_who 0.0.1", - "uu_whoami 0.0.1", - "uu_yes 0.0.1", + "uu_arch 0.0.2", + "uu_base32 0.0.2", + "uu_base64 0.0.2", + "uu_basename 0.0.2", + "uu_cat 0.0.2", + "uu_chgrp 0.0.2", + "uu_chmod 0.0.2", + "uu_chown 0.0.2", + "uu_chroot 0.0.2", + "uu_cksum 0.0.2", + "uu_comm 0.0.2", + "uu_cp 0.0.2", + "uu_csplit 0.0.2", + "uu_cut 0.0.2", + "uu_date 0.0.2", + "uu_df 0.0.2", + "uu_dircolors 0.0.2", + "uu_dirname 0.0.2", + "uu_du 0.0.2", + "uu_echo 0.0.2", + "uu_env 0.0.2", + "uu_expand 0.0.2", + "uu_expr 0.0.2", + "uu_factor 0.0.2", + "uu_false 0.0.2", + "uu_fmt 0.0.2", + "uu_fold 0.0.2", + "uu_groups 0.0.2", + "uu_hashsum 0.0.2", + "uu_head 0.0.2", + "uu_hostid 0.0.2", + "uu_hostname 0.0.2", + "uu_id 0.0.2", + "uu_install 0.0.2", + "uu_join 0.0.2", + "uu_kill 0.0.2", + "uu_link 0.0.2", + "uu_ln 0.0.2", + "uu_logname 0.0.2", + "uu_ls 0.0.2", + "uu_mkdir 0.0.2", + "uu_mkfifo 0.0.2", + "uu_mknod 0.0.2", + "uu_mktemp 0.0.2", + "uu_more 0.0.2", + "uu_mv 0.0.2", + "uu_nice 0.0.2", + "uu_nl 0.0.2", + "uu_nohup 0.0.2", + "uu_nproc 0.0.2", + "uu_numfmt 0.0.2", + "uu_od 0.0.2", + "uu_paste 0.0.2", + "uu_pathchk 0.0.2", + "uu_pinky 0.0.2", + "uu_printenv 0.0.2", + "uu_printf 0.0.2", + "uu_ptx 0.0.2", + "uu_pwd 0.0.2", + "uu_readlink 0.0.2", + "uu_realpath 0.0.2", + "uu_relpath 0.0.2", + "uu_rm 0.0.2", + "uu_rmdir 0.0.2", + "uu_seq 0.0.2", + "uu_shred 0.0.2", + "uu_shuf 0.0.2", + "uu_sleep 0.0.2", + "uu_sort 0.0.2", + "uu_split 0.0.2", + "uu_stat 0.0.2", + "uu_stdbuf 0.0.2", + "uu_sum 0.0.2", + "uu_sync 0.0.2", + "uu_tac 0.0.2", + "uu_tail 0.0.2", + "uu_tee 0.0.2", + "uu_test 0.0.2", + "uu_timeout 0.0.2", + "uu_touch 0.0.2", + "uu_tr 0.0.2", + "uu_true 0.0.2", + "uu_truncate 0.0.2", + "uu_tsort 0.0.2", + "uu_tty 0.0.2", + "uu_uname 0.0.2", + "uu_unexpand 0.0.2", + "uu_uniq 0.0.2", + "uu_unlink 0.0.2", + "uu_uptime 0.0.2", + "uu_users 0.0.2", + "uu_wc 0.0.2", + "uu_who 0.0.2", + "uu_whoami 0.0.2", + "uu_yes 0.0.2", "uucore 0.0.4", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1372,7 +1372,7 @@ dependencies = [ [[package]] name = "uu_arch" -version = "0.0.1" +version = "0.0.2" dependencies = [ "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "uu_base32" -version = "0.0.1" +version = "0.0.2" dependencies = [ "uucore 0.0.4", "uucore_procs 0.0.4", @@ -1389,7 +1389,7 @@ dependencies = [ [[package]] name = "uu_base64" -version = "0.0.1" +version = "0.0.2" dependencies = [ "uucore 0.0.4", "uucore_procs 0.0.4", @@ -1397,7 +1397,7 @@ dependencies = [ [[package]] name = "uu_basename" -version = "0.0.1" +version = "0.0.2" dependencies = [ "uucore 0.0.4", "uucore_procs 0.0.4", @@ -1405,7 +1405,7 @@ dependencies = [ [[package]] name = "uu_cat" -version = "0.0.1" +version = "0.0.2" dependencies = [ "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1415,7 +1415,7 @@ dependencies = [ [[package]] name = "uu_chgrp" -version = "0.0.1" +version = "0.0.2" dependencies = [ "uucore 0.0.4", "uucore_procs 0.0.4", @@ -1424,7 +1424,7 @@ dependencies = [ [[package]] name = "uu_chmod" -version = "0.0.1" +version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1434,7 +1434,7 @@ dependencies = [ [[package]] name = "uu_chown" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1445,7 +1445,7 @@ dependencies = [ [[package]] name = "uu_chroot" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1454,7 +1454,7 @@ dependencies = [ [[package]] name = "uu_cksum" -version = "0.0.1" +version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1463,7 +1463,7 @@ dependencies = [ [[package]] name = "uu_comm" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1473,7 +1473,7 @@ dependencies = [ [[package]] name = "uu_cp" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1489,7 +1489,7 @@ dependencies = [ [[package]] name = "uu_csplit" -version = "0.0.1" +version = "0.0.2" dependencies = [ "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1502,7 +1502,7 @@ dependencies = [ [[package]] name = "uu_cut" -version = "0.0.1" +version = "0.0.2" dependencies = [ "uucore 0.0.4", "uucore_procs 0.0.4", @@ -1510,7 +1510,7 @@ dependencies = [ [[package]] name = "uu_date" -version = "0.0.1" +version = "0.0.2" dependencies = [ "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1520,7 +1520,7 @@ dependencies = [ [[package]] name = "uu_df" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1532,7 +1532,7 @@ dependencies = [ [[package]] name = "uu_dircolors" -version = "0.0.1" +version = "0.0.2" dependencies = [ "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1541,7 +1541,7 @@ dependencies = [ [[package]] name = "uu_dirname" -version = "0.0.1" +version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1550,7 +1550,7 @@ dependencies = [ [[package]] name = "uu_du" -version = "0.0.1" +version = "0.0.2" dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1559,7 +1559,7 @@ dependencies = [ [[package]] name = "uu_echo" -version = "0.0.1" +version = "0.0.2" dependencies = [ "uucore 0.0.4", "uucore_procs 0.0.4", @@ -1567,7 +1567,7 @@ dependencies = [ [[package]] name = "uu_env" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1578,7 +1578,7 @@ dependencies = [ [[package]] name = "uu_expand" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1588,7 +1588,7 @@ dependencies = [ [[package]] name = "uu_expr" -version = "0.0.1" +version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1598,7 +1598,7 @@ dependencies = [ [[package]] name = "uu_factor" -version = "0.0.1" +version = "0.0.2" dependencies = [ "criterion 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1613,7 +1613,7 @@ dependencies = [ [[package]] name = "uu_false" -version = "0.0.1" +version = "0.0.2" dependencies = [ "uucore 0.0.4", "uucore_procs 0.0.4", @@ -1621,7 +1621,7 @@ dependencies = [ [[package]] name = "uu_fmt" -version = "0.0.1" +version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1631,7 +1631,7 @@ dependencies = [ [[package]] name = "uu_fold" -version = "0.0.1" +version = "0.0.2" dependencies = [ "uucore 0.0.4", "uucore_procs 0.0.4", @@ -1639,7 +1639,7 @@ dependencies = [ [[package]] name = "uu_groups" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1648,7 +1648,7 @@ dependencies = [ [[package]] name = "uu_hashsum" -version = "0.0.1" +version = "0.0.2" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1667,7 +1667,7 @@ dependencies = [ [[package]] name = "uu_head" -version = "0.0.1" +version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1676,7 +1676,7 @@ dependencies = [ [[package]] name = "uu_hostid" -version = "0.0.1" +version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1685,7 +1685,7 @@ dependencies = [ [[package]] name = "uu_hostname" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "uu_id" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1706,7 +1706,7 @@ dependencies = [ [[package]] name = "uu_install" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1717,7 +1717,7 @@ dependencies = [ [[package]] name = "uu_join" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1726,7 +1726,7 @@ dependencies = [ [[package]] name = "uu_kill" -version = "0.0.1" +version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1735,7 +1735,7 @@ dependencies = [ [[package]] name = "uu_link" -version = "0.0.1" +version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1744,7 +1744,7 @@ dependencies = [ [[package]] name = "uu_ln" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1754,7 +1754,7 @@ dependencies = [ [[package]] name = "uu_logname" -version = "0.0.1" +version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "uu_ls" -version = "0.0.1" +version = "0.0.2" dependencies = [ "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1779,7 +1779,7 @@ dependencies = [ [[package]] name = "uu_mkdir" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1789,7 +1789,7 @@ dependencies = [ [[package]] name = "uu_mkfifo" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1799,7 +1799,7 @@ dependencies = [ [[package]] name = "uu_mknod" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1809,7 +1809,7 @@ dependencies = [ [[package]] name = "uu_mktemp" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1820,7 +1820,7 @@ dependencies = [ [[package]] name = "uu_more" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1832,7 +1832,7 @@ dependencies = [ [[package]] name = "uu_mv" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1842,7 +1842,7 @@ dependencies = [ [[package]] name = "uu_nice" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1852,7 +1852,7 @@ dependencies = [ [[package]] name = "uu_nl" -version = "0.0.1" +version = "0.0.2" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1866,7 +1866,7 @@ dependencies = [ [[package]] name = "uu_nohup" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1876,7 +1876,7 @@ dependencies = [ [[package]] name = "uu_nproc" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1887,7 +1887,7 @@ dependencies = [ [[package]] name = "uu_numfmt" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1896,7 +1896,7 @@ dependencies = [ [[package]] name = "uu_od" -version = "0.0.1" +version = "0.0.2" dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1908,7 +1908,7 @@ dependencies = [ [[package]] name = "uu_paste" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1917,7 +1917,7 @@ dependencies = [ [[package]] name = "uu_pathchk" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1927,7 +1927,7 @@ dependencies = [ [[package]] name = "uu_pinky" -version = "0.0.1" +version = "0.0.2" dependencies = [ "uucore 0.0.4", "uucore_procs 0.0.4", @@ -1935,7 +1935,7 @@ dependencies = [ [[package]] name = "uu_printenv" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1944,7 +1944,7 @@ dependencies = [ [[package]] name = "uu_printf" -version = "0.0.1" +version = "0.0.2" dependencies = [ "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1953,7 +1953,7 @@ dependencies = [ [[package]] name = "uu_ptx" -version = "0.0.1" +version = "0.0.2" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1967,7 +1967,7 @@ dependencies = [ [[package]] name = "uu_pwd" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1976,7 +1976,7 @@ dependencies = [ [[package]] name = "uu_readlink" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1986,7 +1986,7 @@ dependencies = [ [[package]] name = "uu_realpath" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -1995,7 +1995,7 @@ dependencies = [ [[package]] name = "uu_relpath" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -2004,7 +2004,7 @@ dependencies = [ [[package]] name = "uu_rm" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2015,7 +2015,7 @@ dependencies = [ [[package]] name = "uu_rmdir" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "uu_seq" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -2033,7 +2033,7 @@ dependencies = [ [[package]] name = "uu_shred" -version = "0.0.1" +version = "0.0.2" dependencies = [ "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2046,7 +2046,7 @@ dependencies = [ [[package]] name = "uu_shuf" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2056,7 +2056,7 @@ dependencies = [ [[package]] name = "uu_sleep" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -2065,7 +2065,7 @@ dependencies = [ [[package]] name = "uu_sort" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2076,7 +2076,7 @@ dependencies = [ [[package]] name = "uu_split" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -2085,7 +2085,7 @@ dependencies = [ [[package]] name = "uu_stat" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2095,18 +2095,18 @@ dependencies = [ [[package]] name = "uu_stdbuf" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_stdbuf_libstdbuf 0.0.1", + "uu_stdbuf_libstdbuf 0.0.2", "uucore 0.0.4", "uucore_procs 0.0.4", ] [[package]] name = "uu_stdbuf_libstdbuf" -version = "0.0.1" +version = "0.0.2" dependencies = [ "cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2117,7 +2117,7 @@ dependencies = [ [[package]] name = "uu_sum" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -2126,7 +2126,7 @@ dependencies = [ [[package]] name = "uu_sync" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2137,7 +2137,7 @@ dependencies = [ [[package]] name = "uu_tac" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -2146,7 +2146,7 @@ dependencies = [ [[package]] name = "uu_tail" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2158,7 +2158,7 @@ dependencies = [ [[package]] name = "uu_tee" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2168,7 +2168,7 @@ dependencies = [ [[package]] name = "uu_test" -version = "0.0.1" +version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2178,7 +2178,7 @@ dependencies = [ [[package]] name = "uu_timeout" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2189,7 +2189,7 @@ dependencies = [ [[package]] name = "uu_touch" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2200,7 +2200,7 @@ dependencies = [ [[package]] name = "uu_tr" -version = "0.0.1" +version = "0.0.2" dependencies = [ "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2211,7 +2211,7 @@ dependencies = [ [[package]] name = "uu_true" -version = "0.0.1" +version = "0.0.2" dependencies = [ "uucore 0.0.4", "uucore_procs 0.0.4", @@ -2219,7 +2219,7 @@ dependencies = [ [[package]] name = "uu_truncate" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -2228,7 +2228,7 @@ dependencies = [ [[package]] name = "uu_tsort" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -2237,7 +2237,7 @@ dependencies = [ [[package]] name = "uu_tty" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2247,7 +2247,7 @@ dependencies = [ [[package]] name = "uu_uname" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2257,7 +2257,7 @@ dependencies = [ [[package]] name = "uu_unexpand" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2267,7 +2267,7 @@ dependencies = [ [[package]] name = "uu_uniq" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -2276,7 +2276,7 @@ dependencies = [ [[package]] name = "uu_unlink" -version = "0.0.1" +version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2286,7 +2286,7 @@ dependencies = [ [[package]] name = "uu_uptime" -version = "0.0.1" +version = "0.0.2" dependencies = [ "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2297,7 +2297,7 @@ dependencies = [ [[package]] name = "uu_users" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -2306,7 +2306,7 @@ dependencies = [ [[package]] name = "uu_wc" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", @@ -2315,7 +2315,7 @@ dependencies = [ [[package]] name = "uu_who" -version = "0.0.1" +version = "0.0.2" dependencies = [ "uucore 0.0.4", "uucore_procs 0.0.4", @@ -2323,7 +2323,7 @@ dependencies = [ [[package]] name = "uu_whoami" -version = "0.0.1" +version = "0.0.2" dependencies = [ "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2334,7 +2334,7 @@ dependencies = [ [[package]] name = "uu_yes" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.4", diff --git a/Cargo.toml b/Cargo.toml index ecaf74ade..9c327beda 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "coreutils" -version = "0.0.1" # "0.0.1.1" +version = "0.0.2" # "0.0.2.1" authors = ["uutils developers"] license = "MIT" description = "coreutils ~ GNU coreutils (updated); implemented as universal (cross-platform) utils, written in Rust" @@ -228,102 +228,102 @@ lazy_static = { version="1.3" } textwrap = { version="=0.11.0", features=["term_size"] } # !maint: [2020-05-10; rivy] unstable crate using undocumented features; pinned currently, will review uucore = { version=">=0.0.4", package="uucore", path="src/uucore" } # * uutils -uu_test = { optional=true, version="0.0.1", package="uu_test", path="src/uu/test" } +uu_test = { optional=true, version="0.0.2", package="uu_test", path="src/uu/test" } # -arch = { optional=true, version="0.0.1", package="uu_arch", path="src/uu/arch" } -base32 = { optional=true, version="0.0.1", package="uu_base32", path="src/uu/base32" } -base64 = { optional=true, version="0.0.1", package="uu_base64", path="src/uu/base64" } -basename = { optional=true, version="0.0.1", package="uu_basename", path="src/uu/basename" } -cat = { optional=true, version="0.0.1", package="uu_cat", path="src/uu/cat" } -chgrp = { optional=true, version="0.0.1", package="uu_chgrp", path="src/uu/chgrp" } -chmod = { optional=true, version="0.0.1", package="uu_chmod", path="src/uu/chmod" } -chown = { optional=true, version="0.0.1", package="uu_chown", path="src/uu/chown" } -chroot = { optional=true, version="0.0.1", package="uu_chroot", path="src/uu/chroot" } -cksum = { optional=true, version="0.0.1", package="uu_cksum", path="src/uu/cksum" } -comm = { optional=true, version="0.0.1", package="uu_comm", path="src/uu/comm" } -cp = { optional=true, version="0.0.1", package="uu_cp", path="src/uu/cp" } -csplit = { optional=true, version="0.0.1", package="uu_csplit", path="src/uu/csplit" } -cut = { optional=true, version="0.0.1", package="uu_cut", path="src/uu/cut" } -date = { optional=true, version="0.0.1", package="uu_date", path="src/uu/date" } -df = { optional=true, version="0.0.1", package="uu_df", path="src/uu/df" } -dircolors= { optional=true, version="0.0.1", package="uu_dircolors", path="src/uu/dircolors" } -dirname = { optional=true, version="0.0.1", package="uu_dirname", path="src/uu/dirname" } -du = { optional=true, version="0.0.1", package="uu_du", path="src/uu/du" } -echo = { optional=true, version="0.0.1", package="uu_echo", path="src/uu/echo" } -env = { optional=true, version="0.0.1", package="uu_env", path="src/uu/env" } -expand = { optional=true, version="0.0.1", package="uu_expand", path="src/uu/expand" } -expr = { optional=true, version="0.0.1", package="uu_expr", path="src/uu/expr" } -factor = { optional=true, version="0.0.1", package="uu_factor", path="src/uu/factor" } -false = { optional=true, version="0.0.1", package="uu_false", path="src/uu/false" } -fmt = { optional=true, version="0.0.1", package="uu_fmt", path="src/uu/fmt" } -fold = { optional=true, version="0.0.1", package="uu_fold", path="src/uu/fold" } -groups = { optional=true, version="0.0.1", package="uu_groups", path="src/uu/groups" } -hashsum = { optional=true, version="0.0.1", package="uu_hashsum", path="src/uu/hashsum" } -head = { optional=true, version="0.0.1", package="uu_head", path="src/uu/head" } -hostid = { optional=true, version="0.0.1", package="uu_hostid", path="src/uu/hostid" } -hostname = { optional=true, version="0.0.1", package="uu_hostname", path="src/uu/hostname" } -id = { optional=true, version="0.0.1", package="uu_id", path="src/uu/id" } -install = { optional=true, version="0.0.1", package="uu_install", path="src/uu/install" } -join = { optional=true, version="0.0.1", package="uu_join", path="src/uu/join" } -kill = { optional=true, version="0.0.1", package="uu_kill", path="src/uu/kill" } -link = { optional=true, version="0.0.1", package="uu_link", path="src/uu/link" } -ln = { optional=true, version="0.0.1", package="uu_ln", path="src/uu/ln" } -ls = { optional=true, version="0.0.1", package="uu_ls", path="src/uu/ls" } -logname = { optional=true, version="0.0.1", package="uu_logname", path="src/uu/logname" } -mkdir = { optional=true, version="0.0.1", package="uu_mkdir", path="src/uu/mkdir" } -mkfifo = { optional=true, version="0.0.1", package="uu_mkfifo", path="src/uu/mkfifo" } -mknod = { optional=true, version="0.0.1", package="uu_mknod", path="src/uu/mknod" } -mktemp = { optional=true, version="0.0.1", package="uu_mktemp", path="src/uu/mktemp" } -more = { optional=true, version="0.0.1", package="uu_more", path="src/uu/more" } -mv = { optional=true, version="0.0.1", package="uu_mv", path="src/uu/mv" } -nice = { optional=true, version="0.0.1", package="uu_nice", path="src/uu/nice" } -nl = { optional=true, version="0.0.1", package="uu_nl", path="src/uu/nl" } -nohup = { optional=true, version="0.0.1", package="uu_nohup", path="src/uu/nohup" } -nproc = { optional=true, version="0.0.1", package="uu_nproc", path="src/uu/nproc" } -numfmt = { optional=true, version="0.0.1", package="uu_numfmt", path="src/uu/numfmt" } -od = { optional=true, version="0.0.1", package="uu_od", path="src/uu/od" } -paste = { optional=true, version="0.0.1", package="uu_paste", path="src/uu/paste" } -pathchk = { optional=true, version="0.0.1", package="uu_pathchk", path="src/uu/pathchk" } -pinky = { optional=true, version="0.0.1", package="uu_pinky", path="src/uu/pinky" } -printenv = { optional=true, version="0.0.1", package="uu_printenv", path="src/uu/printenv" } -printf = { optional=true, version="0.0.1", package="uu_printf", path="src/uu/printf" } -ptx = { optional=true, version="0.0.1", package="uu_ptx", path="src/uu/ptx" } -pwd = { optional=true, version="0.0.1", package="uu_pwd", path="src/uu/pwd" } -readlink = { optional=true, version="0.0.1", package="uu_readlink", path="src/uu/readlink" } -realpath = { optional=true, version="0.0.1", package="uu_realpath", path="src/uu/realpath" } -relpath = { optional=true, version="0.0.1", package="uu_relpath", path="src/uu/relpath" } -rm = { optional=true, version="0.0.1", package="uu_rm", path="src/uu/rm" } -rmdir = { optional=true, version="0.0.1", package="uu_rmdir", path="src/uu/rmdir" } -seq = { optional=true, version="0.0.1", package="uu_seq", path="src/uu/seq" } -shred = { optional=true, version="0.0.1", package="uu_shred", path="src/uu/shred" } -shuf = { optional=true, version="0.0.1", package="uu_shuf", path="src/uu/shuf" } -sleep = { optional=true, version="0.0.1", package="uu_sleep", path="src/uu/sleep" } -sort = { optional=true, version="0.0.1", package="uu_sort", path="src/uu/sort" } -split = { optional=true, version="0.0.1", package="uu_split", path="src/uu/split" } -stat = { optional=true, version="0.0.1", package="uu_stat", path="src/uu/stat" } -stdbuf = { optional=true, version="0.0.1", package="uu_stdbuf", path="src/uu/stdbuf" } -sum = { optional=true, version="0.0.1", package="uu_sum", path="src/uu/sum" } -sync = { optional=true, version="0.0.1", package="uu_sync", path="src/uu/sync" } -tac = { optional=true, version="0.0.1", package="uu_tac", path="src/uu/tac" } -tail = { optional=true, version="0.0.1", package="uu_tail", path="src/uu/tail" } -tee = { optional=true, version="0.0.1", package="uu_tee", path="src/uu/tee" } -timeout = { optional=true, version="0.0.1", package="uu_timeout", path="src/uu/timeout" } -touch = { optional=true, version="0.0.1", package="uu_touch", path="src/uu/touch" } -tr = { optional=true, version="0.0.1", package="uu_tr", path="src/uu/tr" } -true = { optional=true, version="0.0.1", package="uu_true", path="src/uu/true" } -truncate = { optional=true, version="0.0.1", package="uu_truncate", path="src/uu/truncate" } -tsort = { optional=true, version="0.0.1", package="uu_tsort", path="src/uu/tsort" } -tty = { optional=true, version="0.0.1", package="uu_tty", path="src/uu/tty" } -uname = { optional=true, version="0.0.1", package="uu_uname", path="src/uu/uname" } -unexpand = { optional=true, version="0.0.1", package="uu_unexpand", path="src/uu/unexpand" } -uniq = { optional=true, version="0.0.1", package="uu_uniq", path="src/uu/uniq" } -unlink = { optional=true, version="0.0.1", package="uu_unlink", path="src/uu/unlink" } -uptime = { optional=true, version="0.0.1", package="uu_uptime", path="src/uu/uptime" } -users = { optional=true, version="0.0.1", package="uu_users", path="src/uu/users" } -wc = { optional=true, version="0.0.1", package="uu_wc", path="src/uu/wc" } -who = { optional=true, version="0.0.1", package="uu_who", path="src/uu/who" } -whoami = { optional=true, version="0.0.1", package="uu_whoami", path="src/uu/whoami" } -yes = { optional=true, version="0.0.1", package="uu_yes", path="src/uu/yes" } +arch = { optional=true, version="0.0.2", package="uu_arch", path="src/uu/arch" } +base32 = { optional=true, version="0.0.2", package="uu_base32", path="src/uu/base32" } +base64 = { optional=true, version="0.0.2", package="uu_base64", path="src/uu/base64" } +basename = { optional=true, version="0.0.2", package="uu_basename", path="src/uu/basename" } +cat = { optional=true, version="0.0.2", package="uu_cat", path="src/uu/cat" } +chgrp = { optional=true, version="0.0.2", package="uu_chgrp", path="src/uu/chgrp" } +chmod = { optional=true, version="0.0.2", package="uu_chmod", path="src/uu/chmod" } +chown = { optional=true, version="0.0.2", package="uu_chown", path="src/uu/chown" } +chroot = { optional=true, version="0.0.2", package="uu_chroot", path="src/uu/chroot" } +cksum = { optional=true, version="0.0.2", package="uu_cksum", path="src/uu/cksum" } +comm = { optional=true, version="0.0.2", package="uu_comm", path="src/uu/comm" } +cp = { optional=true, version="0.0.2", package="uu_cp", path="src/uu/cp" } +csplit = { optional=true, version="0.0.2", package="uu_csplit", path="src/uu/csplit" } +cut = { optional=true, version="0.0.2", package="uu_cut", path="src/uu/cut" } +date = { optional=true, version="0.0.2", package="uu_date", path="src/uu/date" } +df = { optional=true, version="0.0.2", package="uu_df", path="src/uu/df" } +dircolors= { optional=true, version="0.0.2", package="uu_dircolors", path="src/uu/dircolors" } +dirname = { optional=true, version="0.0.2", package="uu_dirname", path="src/uu/dirname" } +du = { optional=true, version="0.0.2", package="uu_du", path="src/uu/du" } +echo = { optional=true, version="0.0.2", package="uu_echo", path="src/uu/echo" } +env = { optional=true, version="0.0.2", package="uu_env", path="src/uu/env" } +expand = { optional=true, version="0.0.2", package="uu_expand", path="src/uu/expand" } +expr = { optional=true, version="0.0.2", package="uu_expr", path="src/uu/expr" } +factor = { optional=true, version="0.0.2", package="uu_factor", path="src/uu/factor" } +false = { optional=true, version="0.0.2", package="uu_false", path="src/uu/false" } +fmt = { optional=true, version="0.0.2", package="uu_fmt", path="src/uu/fmt" } +fold = { optional=true, version="0.0.2", package="uu_fold", path="src/uu/fold" } +groups = { optional=true, version="0.0.2", package="uu_groups", path="src/uu/groups" } +hashsum = { optional=true, version="0.0.2", package="uu_hashsum", path="src/uu/hashsum" } +head = { optional=true, version="0.0.2", package="uu_head", path="src/uu/head" } +hostid = { optional=true, version="0.0.2", package="uu_hostid", path="src/uu/hostid" } +hostname = { optional=true, version="0.0.2", package="uu_hostname", path="src/uu/hostname" } +id = { optional=true, version="0.0.2", package="uu_id", path="src/uu/id" } +install = { optional=true, version="0.0.2", package="uu_install", path="src/uu/install" } +join = { optional=true, version="0.0.2", package="uu_join", path="src/uu/join" } +kill = { optional=true, version="0.0.2", package="uu_kill", path="src/uu/kill" } +link = { optional=true, version="0.0.2", package="uu_link", path="src/uu/link" } +ln = { optional=true, version="0.0.2", package="uu_ln", path="src/uu/ln" } +ls = { optional=true, version="0.0.2", package="uu_ls", path="src/uu/ls" } +logname = { optional=true, version="0.0.2", package="uu_logname", path="src/uu/logname" } +mkdir = { optional=true, version="0.0.2", package="uu_mkdir", path="src/uu/mkdir" } +mkfifo = { optional=true, version="0.0.2", package="uu_mkfifo", path="src/uu/mkfifo" } +mknod = { optional=true, version="0.0.2", package="uu_mknod", path="src/uu/mknod" } +mktemp = { optional=true, version="0.0.2", package="uu_mktemp", path="src/uu/mktemp" } +more = { optional=true, version="0.0.2", package="uu_more", path="src/uu/more" } +mv = { optional=true, version="0.0.2", package="uu_mv", path="src/uu/mv" } +nice = { optional=true, version="0.0.2", package="uu_nice", path="src/uu/nice" } +nl = { optional=true, version="0.0.2", package="uu_nl", path="src/uu/nl" } +nohup = { optional=true, version="0.0.2", package="uu_nohup", path="src/uu/nohup" } +nproc = { optional=true, version="0.0.2", package="uu_nproc", path="src/uu/nproc" } +numfmt = { optional=true, version="0.0.2", package="uu_numfmt", path="src/uu/numfmt" } +od = { optional=true, version="0.0.2", package="uu_od", path="src/uu/od" } +paste = { optional=true, version="0.0.2", package="uu_paste", path="src/uu/paste" } +pathchk = { optional=true, version="0.0.2", package="uu_pathchk", path="src/uu/pathchk" } +pinky = { optional=true, version="0.0.2", package="uu_pinky", path="src/uu/pinky" } +printenv = { optional=true, version="0.0.2", package="uu_printenv", path="src/uu/printenv" } +printf = { optional=true, version="0.0.2", package="uu_printf", path="src/uu/printf" } +ptx = { optional=true, version="0.0.2", package="uu_ptx", path="src/uu/ptx" } +pwd = { optional=true, version="0.0.2", package="uu_pwd", path="src/uu/pwd" } +readlink = { optional=true, version="0.0.2", package="uu_readlink", path="src/uu/readlink" } +realpath = { optional=true, version="0.0.2", package="uu_realpath", path="src/uu/realpath" } +relpath = { optional=true, version="0.0.2", package="uu_relpath", path="src/uu/relpath" } +rm = { optional=true, version="0.0.2", package="uu_rm", path="src/uu/rm" } +rmdir = { optional=true, version="0.0.2", package="uu_rmdir", path="src/uu/rmdir" } +seq = { optional=true, version="0.0.2", package="uu_seq", path="src/uu/seq" } +shred = { optional=true, version="0.0.2", package="uu_shred", path="src/uu/shred" } +shuf = { optional=true, version="0.0.2", package="uu_shuf", path="src/uu/shuf" } +sleep = { optional=true, version="0.0.2", package="uu_sleep", path="src/uu/sleep" } +sort = { optional=true, version="0.0.2", package="uu_sort", path="src/uu/sort" } +split = { optional=true, version="0.0.2", package="uu_split", path="src/uu/split" } +stat = { optional=true, version="0.0.2", package="uu_stat", path="src/uu/stat" } +stdbuf = { optional=true, version="0.0.2", package="uu_stdbuf", path="src/uu/stdbuf" } +sum = { optional=true, version="0.0.2", package="uu_sum", path="src/uu/sum" } +sync = { optional=true, version="0.0.2", package="uu_sync", path="src/uu/sync" } +tac = { optional=true, version="0.0.2", package="uu_tac", path="src/uu/tac" } +tail = { optional=true, version="0.0.2", package="uu_tail", path="src/uu/tail" } +tee = { optional=true, version="0.0.2", package="uu_tee", path="src/uu/tee" } +timeout = { optional=true, version="0.0.2", package="uu_timeout", path="src/uu/timeout" } +touch = { optional=true, version="0.0.2", package="uu_touch", path="src/uu/touch" } +tr = { optional=true, version="0.0.2", package="uu_tr", path="src/uu/tr" } +true = { optional=true, version="0.0.2", package="uu_true", path="src/uu/true" } +truncate = { optional=true, version="0.0.2", package="uu_truncate", path="src/uu/truncate" } +tsort = { optional=true, version="0.0.2", package="uu_tsort", path="src/uu/tsort" } +tty = { optional=true, version="0.0.2", package="uu_tty", path="src/uu/tty" } +uname = { optional=true, version="0.0.2", package="uu_uname", path="src/uu/uname" } +unexpand = { optional=true, version="0.0.2", package="uu_unexpand", path="src/uu/unexpand" } +uniq = { optional=true, version="0.0.2", package="uu_uniq", path="src/uu/uniq" } +unlink = { optional=true, version="0.0.2", package="uu_unlink", path="src/uu/unlink" } +uptime = { optional=true, version="0.0.2", package="uu_uptime", path="src/uu/uptime" } +users = { optional=true, version="0.0.2", package="uu_users", path="src/uu/users" } +wc = { optional=true, version="0.0.2", package="uu_wc", path="src/uu/wc" } +who = { optional=true, version="0.0.2", package="uu_who", path="src/uu/who" } +whoami = { optional=true, version="0.0.2", package="uu_whoami", path="src/uu/whoami" } +yes = { optional=true, version="0.0.2", package="uu_yes", path="src/uu/yes" } # # * pinned transitive dependencies pin_cc = { version="1.0.61, < 1.0.62", package="cc" } ## cc v1.0.62 has compiler errors for MinRustV v1.32.0, requires 1.34 (for `std::str::split_ascii_whitespace()`) diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index 401e7dcdf..f341c5bdf 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_arch" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "arch ~ (uutils) display machine architecture" diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index 57620eb0a..7af19ea55 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base32" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "base32 ~ (uutils) decode/encode input (base32-encoding)" diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index afc1ecbdc..cfac369e5 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base64" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "base64 ~ (uutils) decode/encode input (base64-encoding)" diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index 943b229cd..e630c518d 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_basename" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "basename ~ (uutils) display PATHNAME with leading directory components removed" diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 4d6006520..452959e59 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cat" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "cat ~ (uutils) concatenate and display input" diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index 9f2e8c4a7..91e4adc91 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chgrp" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "chgrp ~ (uutils) change the group ownership of FILE" diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index 3994fea92..a59612e3f 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chmod" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "chmod ~ (uutils) change mode of FILE" diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index 5f7169bda..dffd57c71 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chown" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "chown ~ (uutils) change the ownership of FILE" diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index e1d168dfe..3090573bd 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chroot" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "chroot ~ (uutils) run COMMAND under a new root directory" diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index bc8853287..c9394c8c6 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cksum" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "cksum ~ (uutils) display CRC and size of input" diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index 01006d3d0..cb7bcb7e3 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_comm" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "comm ~ (uutils) compare sorted inputs" diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index d387ccfec..adcdc2c54 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cp" -version = "0.0.1" +version = "0.0.2" authors = [ "Jordy Dickinson ", "Joshua S. Miller ", diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index 414ffd3f3..30dc17477 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_csplit" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "csplit ~ (uutils) Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output" diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index f53dd42a0..6e01a3e75 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cut" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "cut ~ (uutils) display byte/field columns of input lines" diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index d6878c939..7df872219 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_date" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "date ~ (uutils) display or set the current time" diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 170adaa02..466149d2b 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_df" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "df ~ (uutils) display file system information" diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index 1ac7f8cc9..9e72a9b2a 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dircolors" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "dircolors ~ (uutils) display commands to set LS_COLORS" diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index 1503b1c42..77b842bbd 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dirname" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "dirname ~ (uutils) display parent directory of PATHNAME" diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index a83259b05..a2ba37b9d 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_du" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "du ~ (uutils) display disk usage" diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index 95e91a7ca..60d525847 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_echo" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "echo ~ (uutils) display TEXT" diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index a425e77e9..45594cbb2 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_env" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "env ~ (uutils) set each NAME to VALUE in the environment and run COMMAND" diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index 9161b44d2..a584d609e 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expand" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "expand ~ (uutils) convert input tabs to spaces" diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index a9cc9e527..f0d381388 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expr" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "expr ~ (uutils) display the value of EXPRESSION" diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index 5bc48c8a1..b25d14909 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_factor" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "factor ~ (uutils) display the prime factors of each NUMBER" diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index 4eca91584..8a3e04a58 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_false" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "false ~ (uutils) do nothing and fail" diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index 19b67132f..905e43d7a 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fmt" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "fmt ~ (uutils) reformat each paragraph of input" diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index 745f09426..0fb132c07 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fold" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "fold ~ (uutils) wrap each line of input" diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index 9f5e498bf..0b9ff9bc8 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_groups" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "groups ~ (uutils) display group memberships for USERNAME" diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index 8530c1024..4c2e5c9d6 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hashsum" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "hashsum ~ (uutils) display or check input digests" diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index cbce20c31..378356773 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_head" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "head ~ (uutils) display the first lines of input" diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index 29fd624ab..9ed1ab250 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostid" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "hostid ~ (uutils) display the numeric identifier of the current host" diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index 3252bddea..b4abe6974 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostname" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "hostname ~ (uutils) display or set the host name of the current host" diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index 6acae0274..6b1fb620e 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_id" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "id ~ (uutils) display user and group information for USER" diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 2ef2a1f33..b0cd59468 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_install" -version = "0.0.1" +version = "0.0.2" authors = [ "Ben Eills ", "uutils developers", diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index a2f3599e1..b319a380f 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_join" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "join ~ (uutils) merge lines from inputs with matching join fields" diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index 60566685b..4fda76cce 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_kill" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "kill ~ (uutils) send a signal to a process" diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index 3af0e5a50..df9be0a18 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_link" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "link ~ (uutils) create a hard (file system) link to FILE" diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index 7cde7973d..c50ee2859 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ln" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "ln ~ (uutils) create a (file system) link to TARGET" diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index 722824328..f6800b09a 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_logname" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "logname ~ (uutils) display the login name of the current user" diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index d14c46e0e..1d659c1af 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ls" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "ls ~ (uutils) display directory contents" diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index 90dde5238..da5afabcf 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkdir" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "mkdir ~ (uutils) create DIRECTORY" diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index 97a925663..742893563 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkfifo" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "mkfifo ~ (uutils) create FIFOs (named pipes)" diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index e98a9400e..8e5d153e7 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mknod" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "mknod ~ (uutils) create special file NAME of TYPE" diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index 175f28b74..c2a952dbe 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mktemp" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "mktemp ~ (uutils) create and display a temporary file or directory from TEMPLATE" diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index ca9fc8560..060c618f0 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_more" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "more ~ (uutils) input perusal filter" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index 4773fde78..60b8fd3fd 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mv" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "mv ~ (uutils) move (rename) SOURCE to DESTINATION" diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index 65addb665..98eff50a7 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nice" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "nice ~ (uutils) run PROGRAM with modified scheduling priority" diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index 542b8ae5c..7f052cabb 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nl" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "nl ~ (uutils) display input with added line numbers" diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index b1df8f1a7..6309e9073 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nohup" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "nohup ~ (uutils) run COMMAND, ignoring hangup signals" diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index 7bfc7f2e1..ca185b99a 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nproc" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "nproc ~ (uutils) display the number of processing units available" diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index 93407980c..4bf3c6a3f 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_numfmt" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "numfmt ~ (uutils) reformat NUMBER" diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index 611c569a3..55bc1e904 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_od" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "od ~ (uutils) display formatted representation of input" diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index 3f08b722d..112c45fbb 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_paste" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "paste ~ (uutils) merge lines from inputs" diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index 0c1885904..4fe8a060d 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pathchk" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "pathchk ~ (uutils) diagnose invalid or non-portable PATHNAME" diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index f4ccf88a2..704d876b9 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pinky" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "pinky ~ (uutils) display user information" diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index 0292b455b..ccabbc20c 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printenv" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "printenv ~ (uutils) display value of environment VAR" diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index a2696486b..756be99c2 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printf" -version = "0.0.1" +version = "0.0.2" authors = [ "Nathan Ross", "uutils developers", diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index 5f147c97d..83afb5f82 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ptx" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "ptx ~ (uutils) display a permuted index of input" diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index 876aee173..ec9577e92 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pwd" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "pwd ~ (uutils) display current working directory" diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index 18e83178f..b5fee203c 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_readlink" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "readlink ~ (uutils) display resolved path of PATHNAME" diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index 808ec1330..6c29df74b 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_realpath" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "realpath ~ (uutils) display resolved absolute path of PATHNAME" diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index 2d4e67fb1..62e559c39 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_relpath" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "relpath ~ (uutils) display relative path of PATHNAME_TO from PATHNAME_FROM" diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index d7fa97428..dcd24a4f0 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rm" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "rm ~ (uutils) remove PATHNAME" diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index 60a54f4a9..2244f8274 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rmdir" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "rmdir ~ (uutils) remove empty DIRECTORY" diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index 380c6d6d6..dac71cbde 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_seq" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "seq ~ (uutils) display a sequence of numbers" diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index bccba633c..f866bae30 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shred" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "shred ~ (uutils) hide former FILE contents with repeated overwrites" diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index 428c130df..b70b74f79 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shuf" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "shuf ~ (uutils) display random permutations of input lines" diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index e5c300bf6..7070a5ed3 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sleep" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "sleep ~ (uutils) pause for DURATION" diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 01065a931..ddea16e02 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sort" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "sort ~ (uutils) sort input lines" diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index 6076423f3..d9cf90f33 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_split" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "split ~ (uutils) split input into output files" diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index 26cc6b95e..a11d17e3d 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stat" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "stat ~ (uutils) display FILE status" diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index 70fd32df1..0c2e227ba 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "stdbuf ~ (uutils) run COMMAND with modified standard stream buffering" @@ -21,7 +21,7 @@ uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } [build-dependencies] -libstdbuf = { version="0.0.1", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } +libstdbuf = { version="0.0.2", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } [[bin]] name = "stdbuf" diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index 878ea4450..0bce89372 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf_libstdbuf" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "stdbuf/libstdbuf ~ (uutils); dynamic library required for stdbuf" diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index 54579d91c..9cd164a45 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sum" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "sum ~ (uutils) display checksum and block counts for input" diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index a5a18f770..d920723c2 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sync" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "sync ~ (uutils) synchronize cache writes to storage" diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index 9cd7db989..5325224e4 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tac" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "tac ~ (uutils) concatenate and display input lines in reverse order" diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index 6eedd8e73..ee1e8e857 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tail" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "tail ~ (uutils) display the last lines of input" diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index 2712df686..2d8e72e8a 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tee" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "tee ~ (uutils) display input and copy to FILE" diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index 120c513ba..dfdbbbf66 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_test" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "test ~ (uutils) evaluate comparison and file type expressions" diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index f4a87d19d..a2dc22557 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_timeout" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "timeout ~ (uutils) run COMMAND with a DURATION time limit" diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index 7fc56890a..f34abc78e 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_touch" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "touch ~ (uutils) change FILE timestamps" diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index 364c8ea44..b84654c3b 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tr" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "tr ~ (uutils) translate characters within input and display" diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index 7c05520da..faf2996de 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_true" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "true ~ (uutils) do nothing and succeed" diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index 9124c0bdf..bcf971dd5 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_truncate" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "truncate ~ (uutils) truncate (or extend) FILE to SIZE" diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index 2c2dfcf42..99069f9ea 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tsort" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "tsort ~ (uutils) topologically sort input (partially ordered) pairs" diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index d0cb0214c..8a957160a 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tty" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "tty ~ (uutils) display the name of the terminal connected to standard input" diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index 9a8aa59db..1626d1d68 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uname" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "uname ~ (uutils) display system information" diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index 57b86f5cd..1e952b39d 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unexpand" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "unexpand ~ (uutils) convert input spaces to tabs" diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index 9f06aa9e4..05770cd0f 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uniq" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "uniq ~ (uutils) filter identical adjacent lines from input" diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index a4b84d999..d0e1ce9f8 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unlink" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "unlink ~ (uutils) remove a (file system) link to FILE" diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index 960db95f7..982f49496 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uptime" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "uptime ~ (uutils) display dynamic system information" diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index e171ecd75..93cc97c21 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_users" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "users ~ (uutils) display names of currently logged-in users" diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index fe84d17f4..0a9afcf80 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_wc" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "wc ~ (uutils) display newline, word, and byte counts for input" diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index 121299036..b413cd809 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_who" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "who ~ (uutils) display information about currently logged-in users" diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index 38bfcfee9..23ac5b9fd 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_whoami" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "whoami ~ (uutils) display user name of current effective user ID" diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index 2e987bc02..ed3916463 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_yes" -version = "0.0.1" +version = "0.0.2" authors = ["uutils developers"] license = "MIT" description = "yes ~ (uutils) repeatedly display a line with STRING (or 'y')" From 57e24c9118889b8bfed6adca6f19d4a9ef889d2e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 10 Jan 2021 18:24:27 +0100 Subject: [PATCH 278/606] also update uucore & uucore_procs versions to 0.0.5 --- Cargo.lock | 390 ++++++++++++++++++------------------ src/uucore/Cargo.toml | 2 +- src/uucore_procs/Cargo.toml | 2 +- 3 files changed, 197 insertions(+), 197 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6f832202c..f50b87ee9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -337,7 +337,7 @@ dependencies = [ "uu_who 0.0.2", "uu_whoami 0.0.2", "uu_yes 0.0.2", - "uucore 0.0.4", + "uucore 0.0.5", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1375,32 +1375,32 @@ name = "uu_arch" version = "0.0.2" dependencies = [ "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] name = "uu_base32" version = "0.0.2" dependencies = [ - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] name = "uu_base64" version = "0.0.2" dependencies = [ - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] name = "uu_basename" version = "0.0.2" dependencies = [ - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1409,16 +1409,16 @@ version = "0.0.2" dependencies = [ "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] name = "uu_chgrp" version = "0.0.2" dependencies = [ - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1427,8 +1427,8 @@ name = "uu_chmod" version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1438,8 +1438,8 @@ version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1448,8 +1448,8 @@ name = "uu_chroot" version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1457,8 +1457,8 @@ name = "uu_cksum" version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1467,8 +1467,8 @@ version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1480,8 +1480,8 @@ dependencies = [ "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1496,16 +1496,16 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cut" version = "0.0.2" dependencies = [ - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1514,8 +1514,8 @@ version = "0.0.2" dependencies = [ "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1525,8 +1525,8 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1535,8 +1535,8 @@ name = "uu_dircolors" version = "0.0.2" dependencies = [ "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1544,8 +1544,8 @@ name = "uu_dirname" version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1553,16 +1553,16 @@ name = "uu_du" version = "0.0.2" dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] name = "uu_echo" version = "0.0.2" dependencies = [ - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1572,8 +1572,8 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1582,8 +1582,8 @@ version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1592,8 +1592,8 @@ version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1607,16 +1607,16 @@ dependencies = [ "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] name = "uu_false" version = "0.0.2" dependencies = [ - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1625,16 +1625,16 @@ version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] name = "uu_fold" version = "0.0.2" dependencies = [ - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1642,8 +1642,8 @@ name = "uu_groups" version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1661,8 +1661,8 @@ dependencies = [ "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1670,8 +1670,8 @@ name = "uu_head" version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1679,8 +1679,8 @@ name = "uu_hostid" version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1690,8 +1690,8 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1700,8 +1700,8 @@ name = "uu_id" version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1711,8 +1711,8 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1720,8 +1720,8 @@ name = "uu_join" version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1729,8 +1729,8 @@ name = "uu_kill" version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1738,8 +1738,8 @@ name = "uu_link" version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1748,8 +1748,8 @@ version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1757,8 +1757,8 @@ name = "uu_logname" version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1773,8 +1773,8 @@ dependencies = [ "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1783,8 +1783,8 @@ version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1793,8 +1793,8 @@ version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1803,8 +1803,8 @@ version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1814,8 +1814,8 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1826,8 +1826,8 @@ dependencies = [ "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1836,8 +1836,8 @@ version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1846,8 +1846,8 @@ version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1860,8 +1860,8 @@ dependencies = [ "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1870,8 +1870,8 @@ version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1881,8 +1881,8 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1890,8 +1890,8 @@ name = "uu_numfmt" version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1902,8 +1902,8 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "half 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1911,8 +1911,8 @@ name = "uu_paste" version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1921,16 +1921,16 @@ version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pinky" version = "0.0.2" dependencies = [ - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1938,8 +1938,8 @@ name = "uu_printenv" version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1947,8 +1947,8 @@ name = "uu_printf" version = "0.0.2" dependencies = [ "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1961,8 +1961,8 @@ dependencies = [ "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1970,8 +1970,8 @@ name = "uu_pwd" version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1980,8 +1980,8 @@ version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1989,8 +1989,8 @@ name = "uu_realpath" version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -1998,8 +1998,8 @@ name = "uu_relpath" version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2008,8 +2008,8 @@ version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2018,8 +2018,8 @@ name = "uu_rmdir" version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2027,8 +2027,8 @@ name = "uu_seq" version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2040,8 +2040,8 @@ dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2050,8 +2050,8 @@ version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2059,8 +2059,8 @@ name = "uu_sleep" version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2070,8 +2070,8 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2079,8 +2079,8 @@ name = "uu_split" version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2089,8 +2089,8 @@ version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2100,8 +2100,8 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "uu_stdbuf_libstdbuf 0.0.2", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2111,8 +2111,8 @@ dependencies = [ "cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2120,8 +2120,8 @@ name = "uu_sum" version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2130,8 +2130,8 @@ version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2140,8 +2140,8 @@ name = "uu_tac" version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2151,8 +2151,8 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2162,8 +2162,8 @@ version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2172,8 +2172,8 @@ version = "0.0.2" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2183,8 +2183,8 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2194,8 +2194,8 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2205,16 +2205,16 @@ dependencies = [ "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] name = "uu_true" version = "0.0.2" dependencies = [ - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2222,8 +2222,8 @@ name = "uu_truncate" version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2231,8 +2231,8 @@ name = "uu_tsort" version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2241,8 +2241,8 @@ version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2251,8 +2251,8 @@ version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2261,8 +2261,8 @@ version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2270,8 +2270,8 @@ name = "uu_uniq" version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2280,8 +2280,8 @@ version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2291,8 +2291,8 @@ dependencies = [ "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2300,8 +2300,8 @@ name = "uu_users" version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2309,16 +2309,16 @@ name = "uu_wc" version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] name = "uu_who" version = "0.0.2" dependencies = [ - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] @@ -2327,8 +2327,8 @@ version = "0.0.2" dependencies = [ "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2337,13 +2337,13 @@ name = "uu_yes" version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.4", - "uucore_procs 0.0.4", + "uucore 0.0.5", + "uucore_procs 0.0.5", ] [[package]] name = "uucore" -version = "0.0.4" +version = "0.0.5" dependencies = [ "backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)", "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2362,7 +2362,7 @@ dependencies = [ [[package]] name = "uucore_procs" -version = "0.0.4" +version = "0.0.5" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 94b7502d3..c48512004 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uucore" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "uutils ~ 'core' uutils code library (cross-platform)" diff --git a/src/uucore_procs/Cargo.toml b/src/uucore_procs/Cargo.toml index 774232777..195912ff6 100644 --- a/src/uucore_procs/Cargo.toml +++ b/src/uucore_procs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uucore_procs" -version = "0.0.4" +version = "0.0.5" authors = ["Roy Ivy III "] license = "MIT" description = "uutils ~ 'uucore' proc-macros" From b8e886ad1abf46188cd9db9fac54364074de10d9 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 10 Jan 2021 18:27:20 +0100 Subject: [PATCH 279/606] bump the minimal version of uucore & uucore_procs --- Cargo.toml | 4 ++-- src/uu/arch/Cargo.toml | 4 ++-- src/uu/base32/Cargo.toml | 4 ++-- src/uu/base64/Cargo.toml | 4 ++-- src/uu/basename/Cargo.toml | 4 ++-- src/uu/cat/Cargo.toml | 4 ++-- src/uu/chgrp/Cargo.toml | 4 ++-- src/uu/chmod/Cargo.toml | 4 ++-- src/uu/chown/Cargo.toml | 4 ++-- src/uu/chroot/Cargo.toml | 4 ++-- src/uu/cksum/Cargo.toml | 4 ++-- src/uu/comm/Cargo.toml | 4 ++-- src/uu/cp/Cargo.toml | 4 ++-- src/uu/csplit/Cargo.toml | 4 ++-- src/uu/cut/Cargo.toml | 4 ++-- src/uu/date/Cargo.toml | 4 ++-- src/uu/df/Cargo.toml | 4 ++-- src/uu/dircolors/Cargo.toml | 4 ++-- src/uu/dirname/Cargo.toml | 4 ++-- src/uu/du/Cargo.toml | 4 ++-- src/uu/echo/Cargo.toml | 4 ++-- src/uu/env/Cargo.toml | 4 ++-- src/uu/expand/Cargo.toml | 4 ++-- src/uu/expr/Cargo.toml | 4 ++-- src/uu/factor/Cargo.toml | 4 ++-- src/uu/false/Cargo.toml | 4 ++-- src/uu/fmt/Cargo.toml | 4 ++-- src/uu/fold/Cargo.toml | 4 ++-- src/uu/groups/Cargo.toml | 4 ++-- src/uu/hashsum/Cargo.toml | 4 ++-- src/uu/head/Cargo.toml | 4 ++-- src/uu/hostid/Cargo.toml | 4 ++-- src/uu/hostname/Cargo.toml | 4 ++-- src/uu/id/Cargo.toml | 4 ++-- src/uu/install/Cargo.toml | 4 ++-- src/uu/join/Cargo.toml | 4 ++-- src/uu/kill/Cargo.toml | 4 ++-- src/uu/link/Cargo.toml | 4 ++-- src/uu/ln/Cargo.toml | 4 ++-- src/uu/logname/Cargo.toml | 4 ++-- src/uu/ls/Cargo.toml | 4 ++-- src/uu/mkdir/Cargo.toml | 4 ++-- src/uu/mkfifo/Cargo.toml | 4 ++-- src/uu/mknod/Cargo.toml | 4 ++-- src/uu/mktemp/Cargo.toml | 4 ++-- src/uu/more/Cargo.toml | 4 ++-- src/uu/mv/Cargo.toml | 4 ++-- src/uu/nice/Cargo.toml | 4 ++-- src/uu/nl/Cargo.toml | 4 ++-- src/uu/nohup/Cargo.toml | 4 ++-- src/uu/nproc/Cargo.toml | 4 ++-- src/uu/numfmt/Cargo.toml | 4 ++-- src/uu/od/Cargo.toml | 4 ++-- src/uu/paste/Cargo.toml | 4 ++-- src/uu/pathchk/Cargo.toml | 4 ++-- src/uu/pinky/Cargo.toml | 4 ++-- src/uu/printenv/Cargo.toml | 4 ++-- src/uu/printf/Cargo.toml | 4 ++-- src/uu/ptx/Cargo.toml | 4 ++-- src/uu/pwd/Cargo.toml | 4 ++-- src/uu/readlink/Cargo.toml | 4 ++-- src/uu/realpath/Cargo.toml | 4 ++-- src/uu/relpath/Cargo.toml | 4 ++-- src/uu/rm/Cargo.toml | 4 ++-- src/uu/rmdir/Cargo.toml | 4 ++-- src/uu/seq/Cargo.toml | 4 ++-- src/uu/shred/Cargo.toml | 4 ++-- src/uu/shuf/Cargo.toml | 4 ++-- src/uu/sleep/Cargo.toml | 4 ++-- src/uu/sort/Cargo.toml | 4 ++-- src/uu/split/Cargo.toml | 4 ++-- src/uu/stat/Cargo.toml | 4 ++-- src/uu/stdbuf/Cargo.toml | 4 ++-- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 4 ++-- src/uu/sum/Cargo.toml | 4 ++-- src/uu/sync/Cargo.toml | 4 ++-- src/uu/tac/Cargo.toml | 4 ++-- src/uu/tail/Cargo.toml | 4 ++-- src/uu/tee/Cargo.toml | 4 ++-- src/uu/test/Cargo.toml | 4 ++-- src/uu/timeout/Cargo.toml | 4 ++-- src/uu/touch/Cargo.toml | 4 ++-- src/uu/tr/Cargo.toml | 4 ++-- src/uu/true/Cargo.toml | 4 ++-- src/uu/truncate/Cargo.toml | 4 ++-- src/uu/tsort/Cargo.toml | 4 ++-- src/uu/tty/Cargo.toml | 4 ++-- src/uu/uname/Cargo.toml | 4 ++-- src/uu/unexpand/Cargo.toml | 4 ++-- src/uu/uniq/Cargo.toml | 4 ++-- src/uu/unlink/Cargo.toml | 4 ++-- src/uu/uptime/Cargo.toml | 4 ++-- src/uu/users/Cargo.toml | 4 ++-- src/uu/wc/Cargo.toml | 4 ++-- src/uu/who/Cargo.toml | 4 ++-- src/uu/whoami/Cargo.toml | 4 ++-- src/uu/yes/Cargo.toml | 4 ++-- 97 files changed, 194 insertions(+), 194 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9c327beda..4206db26b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -226,7 +226,7 @@ test = [ "uu_test" ] [dependencies] lazy_static = { version="1.3" } textwrap = { version="=0.11.0", features=["term_size"] } # !maint: [2020-05-10; rivy] unstable crate using undocumented features; pinned currently, will review -uucore = { version=">=0.0.4", package="uucore", path="src/uucore" } +uucore = { version=">=0.0.5", package="uucore", path="src/uucore" } # * uutils uu_test = { optional=true, version="0.0.2", package="uu_test", path="src/uu/test" } # @@ -343,7 +343,7 @@ sha1 = { version="0.6", features=["std"] } tempfile = "3.1" time = "0.1" unindent = "0.1" -uucore = { version=">=0.0.4", package="uucore", path="src/uucore", features=["entries"] } +uucore = { version=">=0.0.5", package="uucore", path="src/uucore", features=["entries"] } [target.'cfg(unix)'.dev-dependencies] rust-users = { version="0.10", package="users" } diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index f341c5bdf..7ec7ff78c 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -16,8 +16,8 @@ path = "src/arch.rs" [dependencies] platform-info = "0.0.1" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "arch" diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index 7af19ea55..0886364ab 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/base32.rs" [dependencies] -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features = ["encoding"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features = ["encoding"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "base32" diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index cfac369e5..f08c36a9d 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/base64.rs" [dependencies] -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features = ["encoding"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features = ["encoding"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "base64" diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index e630c518d..c89b7e056 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/basename.rs" [dependencies] -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "basename" diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 452959e59..e6bcd32fb 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -16,8 +16,8 @@ path = "src/cat.rs" [dependencies] quick-error = "1.2.3" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] unix_socket = "0.5.0" diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index 91e4adc91..39260a18c 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/chgrp.rs" [dependencies] -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" [[bin]] diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index a59612e3f..9a417117e 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -16,8 +16,8 @@ path = "src/chmod.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs", "mode"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs", "mode"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" [[bin]] diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index dffd57c71..569699790 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -17,8 +17,8 @@ path = "src/chown.rs" [dependencies] clap = "2.33" glob = "0.3.0" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" [[bin]] diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index 3090573bd..27db348d3 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -16,8 +16,8 @@ path = "src/chroot.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "chroot" diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index c9394c8c6..91259c74f 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -16,8 +16,8 @@ path = "src/cksum.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "cksum" diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index cb7bcb7e3..eadfdc832 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -17,8 +17,8 @@ path = "src/comm.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "comm" diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index adcdc2c54..64369c3c7 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -23,8 +23,8 @@ clap = "2.33" filetime = "0.2" libc = "0.2.42" quick-error = "1.2.3" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" [target.'cfg(target_os = "linux")'.dependencies] diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index 30dc17477..b8c637540 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -20,8 +20,8 @@ failure = "0.1.1" failure_derive = "0.1.1" regex = "1.0.0" glob = "0.2.11" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "csplit" diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index 6e01a3e75..64f49efa5 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/cut.rs" [dependencies] -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "cut" diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index 7df872219..f6966038a 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -17,8 +17,8 @@ path = "src/date.rs" [dependencies] chrono = "0.4.4" clap = "2.33" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "date" diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 466149d2b..d4851335a 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -18,8 +18,8 @@ path = "src/df.rs" clap = "2.33" libc = "0.2" number_prefix = "0.4" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "windows")'.dependencies] winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi", "winerror"] } diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index 9e72a9b2a..1698328b3 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -16,8 +16,8 @@ path = "src/dircolors.rs" [dependencies] glob = "0.3.0" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "dircolors" diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index 77b842bbd..ece0189d5 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -16,8 +16,8 @@ path = "src/dirname.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "dirname" diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index a2ba37b9d..dfb64b5e3 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -16,8 +16,8 @@ path = "src/du.rs" [dependencies] time = "0.1.40" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "du" diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index 60d525847..36e8ea8e6 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/echo.rs" [dependencies] -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "echo" diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index 45594cbb2..159cf91aa 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -18,8 +18,8 @@ path = "src/env.rs" clap = "2.33" libc = "0.2.42" rust-ini = "0.13.0" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "env" diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index a584d609e..b854b1bb3 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -17,8 +17,8 @@ path = "src/expand.rs" [dependencies] getopts = "0.2.18" unicode-width = "0.1.5" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "expand" diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index f0d381388..bdba32dc3 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -17,8 +17,8 @@ path = "src/expr.rs" [dependencies] libc = "0.2.42" onig = "~4.3.2" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "expr" diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index b25d14909..da38f2797 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -19,8 +19,8 @@ num-traits = "0.2" # used in src/numerics.rs, which is included by build.rs num-traits = "0.2" rand = { version="0.7", features=["small_rng"] } smallvec = { version="0.6.13, < 1.0" } -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] criterion = "0.3" diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index 8a3e04a58..9c3ec6882 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/false.rs" [dependencies] -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "false" diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index 905e43d7a..6ab94a81e 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -17,8 +17,8 @@ path = "src/fmt.rs" [dependencies] libc = "0.2.42" unicode-width = "0.1.5" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "fmt" diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index 0fb132c07..57d8c569d 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/fold.rs" [dependencies] -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "fold" diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index 0b9ff9bc8..4a39f3276 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/groups.rs" [dependencies] -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } clap = "2.33" [[bin]] diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index 4c2e5c9d6..92a34c518 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -26,8 +26,8 @@ sha1 = "0.6.0" sha2 = "0.6.0" sha3 = "0.6.0" blake2-rfc = "0.2.18" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "hashsum" diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index 378356773..096a1c54b 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -16,8 +16,8 @@ path = "src/head.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "head" diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index 9ed1ab250..2a58bad83 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -16,8 +16,8 @@ path = "src/hostid.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "hostid" diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index b4abe6974..eadf102b0 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -18,8 +18,8 @@ path = "src/hostname.rs" clap = "2.33" libc = "0.2.42" hostname = { version = "0.3", features = ["set"] } -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["wide"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["wide"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=["sysinfoapi", "winsock2"] } [[bin]] diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index 6b1fb620e..43e51e464 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -16,8 +16,8 @@ path = "src/id.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "process"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries", "process"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "id" diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index b0cd59468..eee0e1c65 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -20,8 +20,8 @@ path = "src/install.rs" [dependencies] clap = "2.33" libc = ">= 0.2" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["mode", "perms"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["mode", "perms"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] time = "0.1.40" diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index b319a380f..493f68b84 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -16,8 +16,8 @@ path = "src/join.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "join" diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index 4fda76cce..56609e163 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -16,8 +16,8 @@ path = "src/kill.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["signals"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["signals"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "kill" diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index df9be0a18..a1b35566b 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -16,8 +16,8 @@ path = "src/link.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "link" diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index c50ee2859..3c700bb43 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -17,8 +17,8 @@ path = "src/ln.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "ln" diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index f6800b09a..75b95ebc6 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -16,8 +16,8 @@ path = "src/logname.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "logname" diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index 1d659c1af..db4d12bb0 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -22,8 +22,8 @@ term_grid = "0.1.5" termsize = "0.1.6" time = "0.1.40" unicode-width = "0.1.5" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "fs"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] atty = "0.2" diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index da5afabcf..7fa1517fa 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -17,8 +17,8 @@ path = "src/mkdir.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs", "mode"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs", "mode"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "mkdir" diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index 742893563..8c079748b 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -17,8 +17,8 @@ path = "src/mkfifo.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "mkfifo" diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index 8e5d153e7..eba24bf7d 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -18,8 +18,8 @@ path = "src/mknod.rs" [dependencies] getopts = "0.2.18" libc = "^0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["mode"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["mode"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "mknod" diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index c2a952dbe..0d21a398d 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -18,8 +18,8 @@ path = "src/mktemp.rs" clap = "2.33" rand = "0.5" tempfile = "3.0" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "mktemp" diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index 060c618f0..c2466df53 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -16,8 +16,8 @@ path = "src/more.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "redox")'.dependencies] redox_termios = "0.1" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index 60b8fd3fd..775f486f2 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -17,8 +17,8 @@ path = "src/mv.rs" [dependencies] clap = "2.33" fs_extra = "1.1.0" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "mv" diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index 98eff50a7..22ed128b0 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -17,8 +17,8 @@ path = "src/nice.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "nice" diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index 7f052cabb..dc21dfcc2 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -21,8 +21,8 @@ libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" regex-syntax = "0.6.7" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "nl" diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index 6309e9073..8a7808757 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -17,8 +17,8 @@ path = "src/nohup.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "nohup" diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index ca185b99a..dafe0af9b 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -18,8 +18,8 @@ path = "src/nproc.rs" libc = "0.2.42" num_cpus = "1.10" clap = "2.33" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "nproc" diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index 4bf3c6a3f..7ef4125a3 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -16,8 +16,8 @@ path = "src/numfmt.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "numfmt" diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index 55bc1e904..f538d11f7 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -19,8 +19,8 @@ byteorder = "1.3.2" getopts = "0.2.18" half = "1.6" libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "od" diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index 112c45fbb..b06a919e1 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -16,8 +16,8 @@ path = "src/paste.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "paste" diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index 4fe8a060d..6ad0a7e81 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -17,8 +17,8 @@ path = "src/pathchk.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "pathchk" diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index 704d876b9..3d48c0bf1 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/pinky.rs" [dependencies] -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["utmpx", "entries"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["utmpx", "entries"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "pinky" diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index ccabbc20c..630416979 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -16,8 +16,8 @@ path = "src/printenv.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "printenv" diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index 756be99c2..635c7e9e5 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -19,8 +19,8 @@ path = "src/printf.rs" [dependencies] itertools = "0.8.0" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "printf" diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index 83afb5f82..1338d752d 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -21,8 +21,8 @@ libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" regex-syntax = "0.6.7" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "ptx" diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index ec9577e92..b97af4d3c 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -16,8 +16,8 @@ path = "src/pwd.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "pwd" diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index b5fee203c..3f568e8e0 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -17,8 +17,8 @@ path = "src/readlink.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "readlink" diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index 6c29df74b..cd055eda3 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -16,8 +16,8 @@ path = "src/realpath.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "realpath" diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index 62e559c39..07dd7be56 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -16,8 +16,8 @@ path = "src/relpath.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "relpath" diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index dcd24a4f0..534d34e04 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -18,8 +18,8 @@ path = "src/rm.rs" clap = "2.33" walkdir = "2.2" remove_dir_all = "0.5.1" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "rm" diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index 2244f8274..265591f1d 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -16,8 +16,8 @@ path = "src/rmdir.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "rmdir" diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index dac71cbde..9d75fd444 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -16,8 +16,8 @@ path = "src/seq.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "seq" diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index f866bae30..cfe426eb4 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -20,8 +20,8 @@ getopts = "0.2.18" libc = "0.2.42" rand = "0.5" time = "0.1.40" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "shred" diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index b70b74f79..7ae131d8a 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -17,8 +17,8 @@ path = "src/shuf.rs" [dependencies] getopts = "0.2.18" rand = "0.5" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "shuf" diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index 7070a5ed3..d5d91c0bb 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -16,8 +16,8 @@ path = "src/sleep.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["parse_time"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["parse_time"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "sleep" diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index ddea16e02..fd08d2afd 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -18,8 +18,8 @@ path = "src/sort.rs" clap = "2.33" itertools = "0.8.0" semver = "0.9.0" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "sort" diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index d9cf90f33..d81494d43 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -16,8 +16,8 @@ path = "src/split.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "split" diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index a11d17e3d..dd1043448 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -17,8 +17,8 @@ path = "src/stat.rs" [dependencies] clap = "2.33" time = "0.1.40" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "libc"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries", "libc"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "stat" diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index 0c2e227ba..3c17715fb 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -17,8 +17,8 @@ path = "src/stdbuf.rs" [dependencies] getopts = "0.2.18" tempfile = "3.1" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [build-dependencies] libstdbuf = { version="0.0.2", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index 0bce89372..e3465dc9b 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -19,8 +19,8 @@ crate-type = ["cdylib", "rlib"] # XXX: note: the rlib is just to prevent Cargo f [dependencies] cpp = "0.4" libc = "0.2" -uucore = { version=">=0.0.4", package="uucore", path="../../../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../../../uucore_procs" } [build-dependencies] cpp_build = "0.4" diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index 9cd164a45..72ca4e98e 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -16,8 +16,8 @@ path = "src/sum.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "sum" diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index d920723c2..42c5eee00 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -17,8 +17,8 @@ path = "src/sync.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["wide"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["wide"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi", "std", "winbase", "winerror"] } [[bin]] diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index 5325224e4..5cd3424fd 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -16,8 +16,8 @@ path = "src/tac.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "tac" diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index ee1e8e857..b7a00cf69 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -17,8 +17,8 @@ path = "src/tail.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=["fileapi", "handleapi", "processthreadsapi", "synchapi", "winbase"] } [target.'cfg(target_os = "redox")'.dependencies] diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index 2d8e72e8a..14f221840 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -17,8 +17,8 @@ path = "src/tee.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "tee" diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index dfdbbbf66..a3c204488 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -16,8 +16,8 @@ path = "src/test.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "redox")'.dependencies] redox_syscall = "0.1" diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index a2dc22557..006f80631 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -18,8 +18,8 @@ path = "src/timeout.rs" getopts = "0.2.18" libc = "0.2.42" time = "0.1.40" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "timeout" diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index f34abc78e..e5f693207 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -18,8 +18,8 @@ path = "src/touch.rs" filetime = "0.2.1" clap = "2.33" time = "0.1.40" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["libc"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["libc"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "touch" diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index b84654c3b..a1d375457 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -18,8 +18,8 @@ path = "src/tr.rs" bit-set = "0.5.0" fnv = "1.0.5" getopts = "0.2.18" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "tr" diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index faf2996de..1da4a8420 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/true.rs" [dependencies] -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "true" diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index bcf971dd5..9f51be240 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -16,8 +16,8 @@ path = "src/truncate.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "truncate" diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index 99069f9ea..2e9ddaa96 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -16,8 +16,8 @@ path = "src/tsort.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "tsort" diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index 8a957160a..25f14e273 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -17,8 +17,8 @@ path = "src/tty.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["fs"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "tty" diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index 1626d1d68..e0a69b996 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -17,8 +17,8 @@ path = "src/uname.rs" [dependencies] clap = "2.33" platform-info = "0.0.1" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "uname" diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index 1e952b39d..3033702b7 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -17,8 +17,8 @@ path = "src/unexpand.rs" [dependencies] getopts = "0.2.18" unicode-width = "0.1.5" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "unexpand" diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index 05770cd0f..fb5dc0368 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -16,8 +16,8 @@ path = "src/uniq.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "uniq" diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index d0e1ce9f8..a937d0df0 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -17,8 +17,8 @@ path = "src/unlink.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "unlink" diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index 982f49496..b93b2ad7b 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -18,8 +18,8 @@ path = "src/uptime.rs" time = "0.1.40" chrono = "0.4" clap = "2.33" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["libc", "utmpx"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["libc", "utmpx"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "uptime" diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index 93cc97c21..2c1fbf5c3 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -16,8 +16,8 @@ path = "src/users.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["utmpx"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["utmpx"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "users" diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index 0a9afcf80..4a6d27bea 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -16,8 +16,8 @@ path = "src/wc.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "wc" diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index b413cd809..20438d5f1 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/who.rs" [dependencies] -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["utmpx"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["utmpx"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] name = "who" diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index 23ac5b9fd..f4d992871 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -16,8 +16,8 @@ path = "src/whoami.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["entries", "wide"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries", "wide"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "windows")'.dependencies] advapi32-sys = "0.2.0" diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index ed3916463..5d20280d3 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -16,8 +16,8 @@ path = "src/yes.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["zero-copy"] } -uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" } +uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["zero-copy"] } +uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [features] default = [] From 04b92f3e9449674c2a92d8bada1bfb64e2637c95 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 11 Jan 2021 22:01:14 +0100 Subject: [PATCH 280/606] 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 --- Cargo.lock | 119 ++++++------------------ src/uu/csplit/Cargo.toml | 3 +- src/uu/csplit/src/csplit.rs | 2 - src/uu/csplit/src/csplit_error.rs | 27 +++--- src/uucore/Cargo.toml | 7 +- src/uucore/src/lib/features/encoding.rs | 27 ++---- src/uucore/src/lib/lib.rs | 4 - 7 files changed, 53 insertions(+), 136 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f50b87ee9..3814de008 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -49,37 +49,11 @@ dependencies = [ "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "autocfg" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "backtrace" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "backtrace-sys 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "backtrace-sys" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "bit-set" version = "0.5.2" @@ -544,29 +518,10 @@ name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "failure" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "failure_derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "fake-simd" version = "0.1.2" @@ -718,7 +673,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log" -version = "0.4.11" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -920,7 +875,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1201,16 +1156,6 @@ name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "syn" -version = "0.11.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "syn" version = "1.0.58" @@ -1221,23 +1166,6 @@ dependencies = [ "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "synom" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "synstructure" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "tempfile" version = "3.1.0" @@ -1300,6 +1228,24 @@ dependencies = [ "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "thiserror" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "thiserror-impl 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "thread_local" version = "1.1.0" @@ -1367,7 +1313,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1491,11 +1437,10 @@ dependencies = [ name = "uu_csplit" version = "0.0.2" dependencies = [ - "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", "uucore_procs 0.0.5", ] @@ -2345,17 +2290,15 @@ dependencies = [ name = "uucore" version = "0.0.5" dependencies = [ - "backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)", "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2410,7 +2353,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bumpalo 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2512,10 +2455,7 @@ dependencies = [ "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" "checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -"checksum backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)" = "ada4c783bb7e7443c14e0480f429ae2cc99da95065aeab7ee1b81ada0419404f" -"checksum backtrace-sys 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "18fbebbe1c9d1f383a9cc7e8ccdb471b91c8d024ee9c2ca5b5346121fe8b4399" "checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" "checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" @@ -2557,8 +2497,6 @@ dependencies = [ "checksum dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" "checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -"checksum failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82" -"checksum failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "0c122a393ea57648015bf06fbd3d372378992e86b9ff5a7a497b076a28c79efe" "checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" @@ -2581,7 +2519,7 @@ dependencies = [ "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" -"checksum log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +"checksum log 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "fcf3805d4480bb5b86070dcfeb9e2cb2ebc148adb753c5cca5f884d1d65a42b2" "checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" "checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" "checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" @@ -2644,16 +2582,15 @@ dependencies = [ "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" "checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)" = "cc60a3d73ea6594cd712d830cc1f0390fd71542d8c8cd24e70cc54cdfd5e05d5" -"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" -"checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" "checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" "checksum termion 1.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c22cec9d8978d906be5ac94bceb5a010d885c626c4c8855721a4dbd20e3ac905" "checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +"checksum thiserror 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)" = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146" +"checksum thiserror-impl 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1" "checksum thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tinytemplate 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2ada8616fad06a2d0c455adc530de4ef57605a8120cc65da9653e0e9623ca74" diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index b8c637540..d03bcb0a6 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -16,8 +16,7 @@ path = "src/csplit.rs" [dependencies] getopts = "0.2.17" -failure = "0.1.1" -failure_derive = "0.1.1" +thiserror = "1.0" regex = "1.0.0" glob = "0.2.11" uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries", "fs"] } diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index 40a1a402c..41149a343 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -1,7 +1,5 @@ #![crate_name = "uu_csplit"] -#[macro_use] -extern crate failure; #[macro_use] extern crate uucore; use getopts::Matches; diff --git a/src/uu/csplit/src/csplit_error.rs b/src/uu/csplit/src/csplit_error.rs index 209a3468d..b7059f6e0 100644 --- a/src/uu/csplit/src/csplit_error.rs +++ b/src/uu/csplit/src/csplit_error.rs @@ -1,32 +1,33 @@ use std::io; +use thiserror::Error; /// Errors thrown by the csplit command -#[derive(Debug, Fail)] +#[derive(Debug, Error)] pub enum CsplitError { - #[fail(display = "IO error: {}", _0)] + #[error("IO error: {}", _0)] IoError(io::Error), - #[fail(display = "'{}': line number out of range", _0)] + #[error("'{}': line number out of range", _0)] LineOutOfRange(String), - #[fail(display = "'{}': line number out of range on repetition {}", _0, _1)] + #[error("'{}': line number out of range on repetition {}", _0, _1)] LineOutOfRangeOnRepetition(String, usize), - #[fail(display = "'{}': match not found", _0)] + #[error("'{}': match not found", _0)] MatchNotFound(String), - #[fail(display = "'{}': match not found on repetition {}", _0, _1)] + #[error("'{}': match not found on repetition {}", _0, _1)] MatchNotFoundOnRepetition(String, usize), - #[fail(display = "line number must be greater than zero")] + #[error("line number must be greater than zero")] LineNumberIsZero, - #[fail( - display = "line number '{}' is smaller than preceding line number, {}", + #[error( + "line number '{}' is smaller than preceding line number, {}", _0, _1 )] LineNumberSmallerThanPrevious(usize, usize), - #[fail(display = "invalid pattern: {}", _0)] + #[error("invalid pattern: {}", _0)] InvalidPattern(String), - #[fail(display = "invalid number: '{}'", _0)] + #[error("invalid number: '{}'", _0)] InvalidNumber(String), - #[fail(display = "incorrect conversion specification in suffix")] + #[error("incorrect conversion specification in suffix")] SuffixFormatIncorrect, - #[fail(display = "too many % conversion specifications in suffix")] + #[error("too many % conversion specifications in suffix")] SuffixFormatTooManyPercents, } diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index c48512004..2fc8b7b6e 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -20,8 +20,7 @@ dunce = "1.0.0" getopts = "<= 0.2.21" wild = "2.0.4" # * optional -failure = { version="<= 0.1.1", optional=true } -failure_derive = { version="<= 0.1.1", optional=true } +thiserror = { version="1.0", optional=true } lazy_static = { version="1.3", optional=true } nix = { version="<= 0.13", optional=true } platform-info = { version="<= 0.0.1", optional=true } @@ -29,8 +28,6 @@ time = { version="<= 0.1.42", optional=true } # * "problem" dependencies (pinned) data-encoding = { version="~2.1", optional=true } ## data-encoding: require v2.1; but v2.2.0 breaks the build for MinSRV v1.31.0 libc = { version="0.2.15, <= 0.2.66", optional=true } ## libc: initial utmp support added in v0.2.15; but v0.2.68 breaks the build for MinSRV v1.31.0 -# * pinned transitive dependencies -pin_backtrace = { version=">= 0.3.3, <= 0.3.30", package="backtrace" } ## backtrace: transitive dependency via 'failure'; pin to <= v0.3.30 to avoid increasing MinSRV to v1.33.0 [target.'cfg(target_os = "redox")'.dependencies] termion = "1.5" @@ -38,7 +35,7 @@ termion = "1.5" [features] default = [] # * non-default features -encoding = ["data-encoding", "failure", "failure_derive"] +encoding = ["data-encoding", "thiserror"] entries = ["libc"] fs = ["libc"] mode = ["libc"] diff --git a/src/uucore/src/lib/features/encoding.rs b/src/uucore/src/lib/features/encoding.rs index 4bddd522e..03fa0ed8b 100644 --- a/src/uucore/src/lib/features/encoding.rs +++ b/src/uucore/src/lib/features/encoding.rs @@ -8,31 +8,20 @@ // spell-checker:ignore (strings) ABCDEFGHIJKLMNOPQRSTUVWXYZ extern crate data_encoding; -extern crate failure; use self::data_encoding::{DecodeError, BASE32, BASE64}; -use failure::Fail; use std::io::{self, Read, Write}; -#[derive(Fail, Debug)] +#[cfg(feature = "thiserror")] +use thiserror::Error; + +#[derive(Debug, Error)] pub enum EncodingError { - #[fail(display = "{}", _0)] - Decode(#[cause] DecodeError), - #[fail(display = "{}", _0)] - Io(#[cause] io::Error), -} - -impl From for EncodingError { - fn from(err: io::Error) -> EncodingError { - EncodingError::Io(err) - } -} - -impl From for EncodingError { - fn from(err: DecodeError) -> EncodingError { - EncodingError::Decode(err) - } + #[error("{}", _0)] + Decode(#[from] DecodeError), + #[error("{}", _0)] + Io(#[from] io::Error), } pub type DecodeResult = Result, EncodingError>; diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 6e974f577..768843409 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -4,10 +4,6 @@ // Copyright (C) ~ Roy Ivy III ; MIT license // * feature-gated external crates -#[cfg(feature = "failure")] -extern crate failure; -#[cfg(feature = "failure_derive")] -extern crate failure_derive; #[cfg(all(feature = "lazy_static", target_os = "linux"))] extern crate lazy_static; #[cfg(feature = "nix")] From ac7cac29106fd03219b753dcc0a1419b6e520c4d Mon Sep 17 00:00:00 2001 From: Gaurang Tandon <1gaurangtandon@gmail.com> Date: Tue, 12 Jan 2021 22:14:11 +0530 Subject: [PATCH 281/606] tail: moving to clap from getopt (#1689) --- Cargo.lock | 106 ++++++++++++++++++---- src/uu/tail/Cargo.toml | 2 +- src/uu/tail/src/tail.rs | 196 +++++++++++++++++++--------------------- 3 files changed, 179 insertions(+), 125 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3814de008..70f39ae3f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -103,7 +103,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -210,7 +210,7 @@ dependencies = [ "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -406,9 +406,9 @@ dependencies = [ "plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -474,7 +474,7 @@ dependencies = [ "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -580,6 +580,16 @@ dependencies = [ "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "getrandom" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.10.1+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "glob" version = "0.2.11" @@ -918,6 +928,17 @@ dependencies = [ "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_chacha" version = "0.2.2" @@ -927,6 +948,15 @@ dependencies = [ "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_core" version = "0.3.1" @@ -948,6 +978,14 @@ dependencies = [ "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_core" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_hc" version = "0.2.0" @@ -956,6 +994,14 @@ dependencies = [ "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_pcg" version = "0.2.1" @@ -992,6 +1038,14 @@ name = "redox_syscall" version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "redox_syscall" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "redox_termios" version = "0.1.1" @@ -1083,7 +1137,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.118" +version = "1.0.119" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1092,12 +1146,12 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "half 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.118" +version = "1.0.119" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1112,7 +1166,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1168,13 +1222,13 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1269,7 +1323,7 @@ name = "tinytemplate" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1758,7 +1812,7 @@ version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", "uucore_procs 0.0.5", ] @@ -2043,7 +2097,7 @@ name = "uu_stdbuf" version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "uu_stdbuf_libstdbuf 0.0.2", "uucore 0.0.5", "uucore_procs 0.0.5", @@ -2093,7 +2147,7 @@ dependencies = [ name = "uu_tail" version = "0.0.2" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -2337,6 +2391,11 @@ name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "wasi" +version = "0.10.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "wasm-bindgen" version = "0.2.69" @@ -2505,6 +2564,7 @@ dependencies = [ "checksum generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fceb69994e330afed50c93524be68c42fa898c2d9fd4ee8da03bd7363acd26f2" "checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" "checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +"checksum getrandom 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4060f4657be78b8e766215b02b18a2e862d83745545de804638e2b545e81aee6" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" "checksum half 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d36fab90f82edc3c747f9d438e06cf0a491055896f2a279638bb5beed6c40177" @@ -2551,15 +2611,20 @@ dependencies = [ "checksum quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" "checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" "checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +"checksum rand 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c24fcd450d3fa2b592732565aa4f17a27a61c65ece4726353e000939b0edee34" "checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +"checksum rand_chacha 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" "checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +"checksum rand_core 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5" "checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +"checksum rand_hc 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" "checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" "checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" "checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +"checksum redox_syscall 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" @@ -2573,9 +2638,9 @@ dependencies = [ "checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)" = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" +"checksum serde 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)" = "9bdd36f49e35b61d49efd8aa7fc068fd295961fd2286d0b2ee9a4c7a14e99cc3" "checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.118 (registry+https://github.com/rust-lang/crates.io-index)" = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" +"checksum serde_derive 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)" = "552954ce79a059ddd5fd68c271592374bd15cab2274970380c000118aeffe1cd" "checksum serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)" = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" @@ -2583,7 +2648,7 @@ dependencies = [ "checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)" = "cc60a3d73ea6594cd712d830cc1f0390fd71542d8c8cd24e70cc54cdfd5e05d5" -"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +"checksum tempfile 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" "checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" "checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" "checksum termion 1.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c22cec9d8978d906be5ac94bceb5a010d885c626c4c8855721a4dbd20e3ac905" @@ -2604,6 +2669,7 @@ dependencies = [ "checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" +"checksum wasi 0.10.1+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "93c6c3420963c5c64bca373b25e77acb562081b9bb4dd5bb864187742186cea9" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" "checksum wasm-bindgen 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" "checksum wasm-bindgen-backend 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index b7a00cf69..74afa4ae8 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/tail.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index cca70ee0e..6d80172cc 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -9,23 +9,35 @@ // spell-checker:ignore (ToDO) seekable seek'd tail'ing ringbuffer ringbuf +#[macro_use] +extern crate clap; + #[macro_use] extern crate uucore; mod platform; +use clap::{App, Arg}; use std::collections::VecDeque; use std::error::Error; use std::fmt; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, Read, Seek, SeekFrom, Write}; use std::path::Path; -use std::str::from_utf8; use std::thread::sleep; use std::time::Duration; -static NAME: &str = "tail"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); +static OPT_BYTES: &str = "bytes"; +static OPT_FOLLOW: &str = "follow"; +static OPT_LINES: &str = "lines"; +static OPT_PID: &str = "pid"; +static OPT_QUIET: &str = "quiet"; +static OPT_SILENT: &str = "silent"; +static OPT_SLEEP_INT: &str = "sleep-interval"; +static OPT_VERBOSE: &str = "verbose"; +static OPT_ZERO_TERM: &str = "zero-terminated"; + +static ARG_FILES: &str = "files"; enum FilterMode { Bytes(u64), @@ -54,65 +66,78 @@ impl Default for Settings { #[allow(clippy::cognitive_complexity)] pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); - let mut settings: Settings = Default::default(); - // handle obsolete -number syntax - let options = match obsolete(&args[1..]) { - (args, Some(n)) => { - settings.mode = FilterMode::Lines(n, b'\n'); - args - } - (args, None) => args, - }; + let app = App::new(executable!()) + .version(crate_version!()) + .about("output the last part of files") + .arg( + Arg::with_name(OPT_BYTES) + .short("c") + .long(OPT_BYTES) + .takes_value(true) + .help("Number of bytes to print"), + ) + .arg( + Arg::with_name(OPT_FOLLOW) + .short("f") + .long(OPT_FOLLOW) + .help("Print the file as it grows"), + ) + .arg( + Arg::with_name(OPT_LINES) + .short("n") + .long(OPT_LINES) + .takes_value(true) + .help("Number of lines to print"), + ) + .arg( + Arg::with_name(OPT_PID) + .long(OPT_PID) + .takes_value(true) + .help("with -f, terminate after process ID, PID dies"), + ) + .arg( + Arg::with_name(OPT_QUIET) + .short("q") + .long(OPT_QUIET) + .help("never output headers giving file names"), + ) + .arg( + Arg::with_name(OPT_SILENT) + .long(OPT_SILENT) + .help("synonym of --quiet"), + ) + .arg( + Arg::with_name(OPT_SLEEP_INT) + .short("s") + .long(OPT_SLEEP_INT) + .help("Number or seconds to sleep between polling the file when running with -f"), + ) + .arg( + Arg::with_name(OPT_VERBOSE) + .short("v") + .long(OPT_VERBOSE) + .help("always output headers giving file names"), + ) + .arg( + Arg::with_name(OPT_ZERO_TERM) + .short("z") + .long(OPT_ZERO_TERM) + .help("Line delimiter is NUL, not newline"), + ) + .arg( + Arg::with_name(ARG_FILES) + .multiple(true) + .takes_value(true) + .min_values(1), + ); - let args = options; + let matches = app.get_matches_from(args); - let mut opts = getopts::Options::new(); - - opts.optopt("c", "bytes", "Number of bytes to print", "k"); - opts.optopt("n", "lines", "Number of lines to print", "k"); - opts.optflag("f", "follow", "Print the file as it grows"); - opts.optopt( - "s", - "sleep-interval", - "Number or seconds to sleep between polling the file when running with -f", - "n", - ); - opts.optopt( - "", - "pid", - "with -f, terminate after process ID, PID dies", - "PID", - ); - opts.optflag("z", "zero-terminated", "Line delimiter is NUL, not newline"); - opts.optflag("h", "help", "help"); - opts.optflag("V", "version", "version"); - opts.optflag("v", "verbose", "always output headers giving file names"); - opts.optflag("q", "quiet", "never output headers giving file names"); - opts.optflag("", "silent", "synonym of --quiet"); - - let given_options = match opts.parse(&args) { - Ok(m) => m, - Err(_) => { - println!("{}", opts.usage("")); - return 1; - } - }; - - if given_options.opt_present("h") { - println!("{}", opts.usage("")); - return 0; - } - if given_options.opt_present("V") { - version(); - return 0; - } - - settings.follow = given_options.opt_present("f"); + settings.follow = matches.is_present(OPT_FOLLOW); if settings.follow { - if let Some(n) = given_options.opt_str("s") { + if let Some(n) = matches.value_of(OPT_SLEEP_INT) { let parsed: Option = n.parse().ok(); if let Some(m) = parsed { settings.sleep_msec = m * 1000 @@ -120,7 +145,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } - if let Some(pid_str) = given_options.opt_str("pid") { + if let Some(pid_str) = matches.value_of(OPT_PID) { if let Ok(pid) = pid_str.parse() { settings.pid = pid; if pid != 0 { @@ -136,7 +161,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } - match given_options.opt_str("n") { + match matches.value_of(OPT_LINES) { Some(n) => { let mut slice: &str = n.as_ref(); if slice.chars().next().unwrap_or('_') == '+' { @@ -152,7 +177,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } None => { - if let Some(n) = given_options.opt_str("c") { + if let Some(n) = matches.value_of(OPT_BYTES) { let mut slice: &str = n.as_ref(); if slice.chars().next().unwrap_or('_') == '+' { settings.beginning = true; @@ -169,16 +194,19 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } }; - if given_options.opt_present("z") { + if matches.is_present(OPT_ZERO_TERM) { if let FilterMode::Lines(count, _) = settings.mode { settings.mode = FilterMode::Lines(count, 0); } } - let verbose = given_options.opt_present("v"); - let quiet = given_options.opt_present("q") || given_options.opt_present("silent"); + let verbose = matches.is_present(OPT_VERBOSE); + let quiet = matches.is_present(OPT_QUIET) || matches.is_present(OPT_SILENT); - let files = given_options.free; + let files: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); if files.is_empty() { let mut buffer = BufReader::new(stdin()); @@ -313,42 +341,6 @@ pub fn parse_size(mut size_slice: &str) -> Result { } } -// It searches for an option in the form of -123123 -// -// In case is found, the options vector will get rid of that object so that -// getopts works correctly. -fn obsolete(options: &[String]) -> (Vec, Option) { - let mut options: Vec = options.to_vec(); - let mut a = 0; - let b = options.len(); - - while a < b { - let current = options[a].clone(); - let current = current.as_bytes(); - - if current.len() > 1 && current[0] == b'-' { - let len = current.len(); - for pos in 1..len { - // Ensure that the argument is only made out of digits - if !(current[pos] as char).is_numeric() { - break; - } - - // If this is the last number - if pos == len - 1 { - options.remove(a); - let number: Option = from_utf8(¤t[1..len]).unwrap().parse().ok(); - return (options, Some(number.unwrap())); - } - } - } - - a += 1; - } - - (options, None) -} - /// When reading files in reverse in `bounded_tail`, this is the size of each /// block read at a time. const BLOCK_SIZE: u64 = 1 << 16; @@ -563,7 +555,3 @@ fn print_byte(stdout: &mut T, ch: u8) { fn print_string(_: &mut T, s: &str) { print!("{}", s); } - -fn version() { - println!("{} {}", NAME, VERSION); -} From 0bb5adad3f5bfe55814389177b2e41229361c522 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 16 Jan 2021 21:15:03 +0100 Subject: [PATCH 282/606] make: also build date (#1691) --- GNUmakefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/GNUmakefile b/GNUmakefile index 3eacc8659..28044f5f6 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -55,6 +55,7 @@ PROGS := \ cp \ csplit \ cut \ + date \ df \ dircolors \ dirname \ @@ -163,6 +164,7 @@ TEST_PROGS := \ cp \ csplit \ cut \ + date \ dircolors \ dirname \ echo \ From 88911be6e002e0f66bcfb6fbac5593cc3066dae9 Mon Sep 17 00:00:00 2001 From: Felipe Lema <1232306+FelipeLema@users.noreply.github.com> Date: Mon, 18 Jan 2021 10:42:44 -0300 Subject: [PATCH 283/606] `--filter` argument for `split` (#1681) --- src/uu/split/src/platform/mod.rs | 11 +++ src/uu/split/src/platform/unix.rs | 124 +++++++++++++++++++++++++++ src/uu/split/src/platform/windows.rs | 19 ++++ src/uu/split/src/split.rs | 35 +++++--- tests/by-util/test_split.rs | 74 +++++++++++++++- tests/common/util.rs | 4 + 6 files changed, 253 insertions(+), 14 deletions(-) create mode 100644 src/uu/split/src/platform/mod.rs create mode 100644 src/uu/split/src/platform/unix.rs create mode 100644 src/uu/split/src/platform/windows.rs diff --git a/src/uu/split/src/platform/mod.rs b/src/uu/split/src/platform/mod.rs new file mode 100644 index 000000000..020c01a4a --- /dev/null +++ b/src/uu/split/src/platform/mod.rs @@ -0,0 +1,11 @@ +#[cfg(unix)] +pub use self::unix::instantiate_current_writer; + +#[cfg(windows)] +pub use self::windows::instantiate_current_writer; + +#[cfg(unix)] +mod unix; + +#[cfg(windows)] +mod windows; diff --git a/src/uu/split/src/platform/unix.rs b/src/uu/split/src/platform/unix.rs new file mode 100644 index 000000000..45333ceb2 --- /dev/null +++ b/src/uu/split/src/platform/unix.rs @@ -0,0 +1,124 @@ +use std::env; +use std::io::Write; +use std::io::{BufWriter, Result}; +use std::process::{Child, Command, Stdio}; +/// A writer that writes to a shell_process' stdin +/// +/// We use a shell process (not directy calling a sub-process) so we can forward the name of the +/// corresponding output file (xaa, xab, xac… ). This is the way it was implemented in GNU split. +struct FilterWriter { + /// Running shell process + shell_process: Child, +} + +impl Write for FilterWriter { + fn write(&mut self, buf: &[u8]) -> Result { + self.shell_process + .stdin + .as_mut() + .expect("failed to get shell stdin") + .write(buf) + } + fn flush(&mut self) -> Result<()> { + self.shell_process + .stdin + .as_mut() + .expect("failed to get shell stdin") + .flush() + } +} + +/// Have an environment variable set at a value during this lifetime +struct WithEnvVarSet { + /// Env var key + _previous_var_key: String, + /// Previous value set to this key + _previous_var_value: std::result::Result, +} +impl WithEnvVarSet { + /// Save previous value assigned to key, set key=value + fn new(key: &str, value: &str) -> WithEnvVarSet { + let previous_env_value = env::var(key); + env::set_var(key, value); + WithEnvVarSet { + _previous_var_key: String::from(key), + _previous_var_value: previous_env_value, + } + } +} + +impl Drop for WithEnvVarSet { + /// Restore previous value now that this is being dropped by context + fn drop(&mut self) { + if let Ok(ref prev_value) = self._previous_var_value { + env::set_var(&self._previous_var_key, &prev_value); + } else { + env::remove_var(&self._previous_var_key) + } + } +} +impl FilterWriter { + /// Create a new filter running a command with $FILE pointing at the output name + /// + /// #Arguments + /// + /// * `command` - The shell command to execute + /// * `filepath` - Path of the output file (forwarded to command as $FILE) + fn new(command: &str, filepath: &str) -> FilterWriter { + // set $FILE, save previous value (if there was one) + let _with_env_var_set = WithEnvVarSet::new("FILE", &filepath); + + let shell_process = Command::new(env::var("SHELL").unwrap_or("/bin/sh".to_owned())) + .arg("-c") + .arg(command) + .stdin(Stdio::piped()) + .spawn() + .expect("Couldn't spawn filter command"); + + FilterWriter { + shell_process: shell_process, + } + } +} + +impl Drop for FilterWriter { + /// flush stdin, close it and wait on `shell_process` before dropping self + fn drop(&mut self) { + { + // close stdin by dropping it + let _stdin = self.shell_process.stdin.as_mut(); + } + let exit_status = self + .shell_process + .wait() + .expect("Couldn't wait for child process"); + if let Some(return_code) = exit_status.code() { + if return_code != 0 { + crash!(1, "Shell process returned {}", return_code); + } + } else { + crash!(1, "Shell process terminated by signal") + } + } +} + +/// Instantiate either a file writer or a "write to shell process's stdin" writer +pub fn instantiate_current_writer( + filter: &Option, + filename: &str, +) -> BufWriter> { + match filter { + None => BufWriter::new(Box::new( + // write to the next file + std::fs::OpenOptions::new() + .write(true) + .create(true) + .open(std::path::Path::new(&filename)) + .unwrap(), + ) as Box), + Some(ref filter_command) => BufWriter::new(Box::new( + // spawn a shell command and write to it + FilterWriter::new(&filter_command, &filename), + ) as Box), + } +} diff --git a/src/uu/split/src/platform/windows.rs b/src/uu/split/src/platform/windows.rs new file mode 100644 index 000000000..e67518f2a --- /dev/null +++ b/src/uu/split/src/platform/windows.rs @@ -0,0 +1,19 @@ +use std::io::BufWriter; +use std::io::Write; +/// Get a file writer +/// +/// Unlike the unix version of this function, this _always_ returns +/// a file writer +pub fn instantiate_current_writer( + _filter: &Option, + filename: &str, +) -> BufWriter> { + BufWriter::new(Box::new( + // write to the next file + std::fs::OpenOptions::new() + .write(true) + .create(true) + .open(std::path::Path::new(&filename)) + .unwrap(), + ) as Box) +} diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index c2109a562..3f51d9447 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -10,8 +10,11 @@ #[macro_use] extern crate uucore; +mod platform; + use std::char; -use std::fs::{File, OpenOptions}; +use std::env; +use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; use std::path::Path; @@ -47,6 +50,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { "additional suffix to append to output file names", "SUFFIX", ); + opts.optopt( + "", + "filter", + "write to shell COMMAND file name is $FILE (Currently not implemented for Windows)", + "COMMAND", + ); opts.optopt("l", "lines", "put NUMBER lines per output file", "NUMBER"); opts.optflag( "", @@ -92,6 +101,7 @@ size is 1000, and default PREFIX is 'x'. With no INPUT, or when INPUT is suffix_length: 0, additional_suffix: "".to_owned(), input: "".to_owned(), + filter: None, strategy: "".to_owned(), strategy_param: "".to_owned(), verbose: false, @@ -138,6 +148,14 @@ size is 1000, and default PREFIX is 'x'. With no INPUT, or when INPUT is settings.input = input; settings.prefix = prefix; + settings.filter = matches.opt_str("filter"); + + if settings.filter.is_some() && cfg!(windows) { + // see https://github.com/rust-lang/rust/issues/29494 + show_error!("--filter is currently not supported in this platform"); + exit!(-1); + } + split(&settings) } @@ -147,6 +165,8 @@ struct Settings { suffix_length: usize, additional_suffix: String, input: String, + /// When supplied, a shell command to output to instead of xaa, xab … + filter: Option, strategy: String, strategy_param: String, verbose: bool, @@ -323,7 +343,6 @@ fn split(settings: &Settings) -> i32 { _ => {} } } - if control.request_new_file { let mut filename = settings.prefix.clone(); filename.push_str( @@ -336,17 +355,9 @@ fn split(settings: &Settings) -> i32 { ); filename.push_str(settings.additional_suffix.as_ref()); - if fileno != 0 { - crash_if_err!(1, writer.flush()); - } + crash_if_err!(1, writer.flush()); fileno += 1; - writer = BufWriter::new(Box::new( - OpenOptions::new() - .write(true) - .create(true) - .open(Path::new(&filename)) - .unwrap(), - ) as Box); + writer = platform::instantiate_current_writer(&settings.filter, filename.as_str()); control.request_new_file = false; if settings.verbose { println!("creating file '{}'", filename); diff --git a/tests/by-util/test_split.rs b/tests/by-util/test_split.rs index 5ed1a271d..88e97803c 100644 --- a/tests/by-util/test_split.rs +++ b/tests/by-util/test_split.rs @@ -4,6 +4,8 @@ extern crate regex; use self::rand::{thread_rng, Rng}; use self::regex::Regex; use crate::common::util::*; +#[cfg(not(windows))] +use std::env; use std::fs::{read_dir, File}; use std::io::Write; use std::path::Path; @@ -32,6 +34,7 @@ impl Glob { self.collect().len() } + /// Get all files in `self.directory` that match `self.regex` fn collect(&self) -> Vec { read_dir(Path::new(&self.directory.subdir)) .unwrap() @@ -49,6 +52,7 @@ impl Glob { .collect() } + /// Accumulate bytes of all files in `self.collect()` fn collate(&self) -> Vec { let mut files = self.collect(); files.sort(); @@ -60,11 +64,16 @@ impl Glob { } } +/// File handle that user can add random bytes (line-formatted or not) to struct RandomFile { inner: File, } impl RandomFile { + /// Size of each line that's being generated + const LINESIZE: usize = 32; + + /// `create()` file handle located at `at` / `name` fn new(at: &AtPath, name: &str) -> RandomFile { RandomFile { inner: File::create(&at.plus(name)).unwrap(), @@ -81,11 +90,11 @@ impl RandomFile { let _ = write!(self.inner, "{}", random_chars(n)); } + /// Add n lines each of size `RandomFile::LINESIZE` fn add_lines(&mut self, lines: usize) { - let line_size: usize = 32; let mut n = lines; while n > 0 { - let _ = writeln!(self.inner, "{}", random_chars(line_size)); + let _ = writeln!(self.inner, "{}", random_chars(RandomFile::LINESIZE)); n -= 1; } } @@ -156,3 +165,64 @@ fn test_split_additional_suffix() { assert_eq!(glob.count(), 2); assert_eq!(glob.collate(), at.read(name).into_bytes()); } + +// note: the test_filter* tests below are unix-only +// windows support has been waived for now because of the difficulty of getting +// the `cmd` call right +// see https://github.com/rust-lang/rust/issues/29494 + +#[test] +#[cfg(unix)] +fn test_filter() { + // like `test_split_default()` but run a command before writing + let (at, mut ucmd) = at_and_ucmd!(); + let name = "filtered"; + let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$"); + let n_lines = 3; + RandomFile::new(&at, name).add_lines(n_lines); + + // change all characters to 'i' + ucmd.args(&["--filter=sed s/./i/g > $FILE", name]) + .succeeds(); + // assert all characters are 'i' / no character is not 'i' + // (assert that command succeded) + assert!( + glob.collate().iter().find(|&&c| { + // is not i + c != ('i' as u8) + // is not newline + && c != ('\n' as u8) + }) == None + ); +} + +#[test] +#[cfg(unix)] +fn test_filter_with_env_var_set() { + // This test will ensure that if $FILE env var was set before running --filter, it'll stay that + // way + // implemented like `test_split_default()` but run a command before writing + let (at, mut ucmd) = at_and_ucmd!(); + let name = "filtered"; + let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$"); + let n_lines = 3; + RandomFile::new(&at, name).add_lines(n_lines); + + let env_var_value = "somevalue"; + env::set_var("FILE", &env_var_value); + ucmd.args(&[format!("--filter={}", "cat > $FILE").as_str(), name]) + .succeeds(); + assert_eq!(glob.collate(), at.read(name).into_bytes()); + assert!(env::var("FILE").unwrap_or("var was unset".to_owned()) == env_var_value); +} + +#[test] +#[cfg(unix)] +fn test_filter_command_fails() { + let (at, mut ucmd) = at_and_ucmd!(); + let name = "filter-will-fail"; + RandomFile::new(&at, name).add_lines(4); + + ucmd.args(&["--filter=/a/path/that/totally/does/not/exist", name]) + .fails(); +} diff --git a/tests/common/util.rs b/tests/common/util.rs index b581b8de9..b01f5014d 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -72,8 +72,12 @@ pub fn repeat_str(s: &str, n: u32) -> String { pub struct CmdResult { //tmpd is used for convenience functions for asserts against fixtures tmpd: Option>, + /// zero-exit from running the Command? + /// see [`success`] pub success: bool, + /// captured utf-8 standard output after running the Command pub stdout: String, + /// captured utf-8 standard error after running the Command pub stderr: String, } From 013bb285cd51ea744dfe73e1bc21f6048756106b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 18 Jan 2021 23:09:00 +0100 Subject: [PATCH 284/606] bug(chmod): chmod on symlink pointing to non existing file is failing (#1694) --- src/uu/chmod/src/chmod.rs | 19 ++++++++++++++++++- tests/by-util/test_chmod.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index eee750f90..61c56dd77 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -182,7 +182,17 @@ impl Chmoder { Ok(meta) => meta.mode() & 0o7777, Err(err) => { if !self.quiet { - show_error!("{}", err); + if is_symlink(file) { + if self.verbose { + show_info!( + "neither symbolic link '{}' nor referent has been changed", + file.display() + ); + } + return Ok(()); + } else { + show_error!("{}: '{}'", err, file.display()); + } } return Err(1); } @@ -260,3 +270,10 @@ impl Chmoder { } } } + +pub fn is_symlink>(path: P) -> bool { + match fs::symlink_metadata(path) { + Ok(m) => m.file_type().is_symlink(), + Err(_) => false, + } +} diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index 1b1a50e0c..e1fff99cf 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -346,3 +346,31 @@ fn test_chmod_preserve_root() { .stderr .contains("chmod: error: it is dangerous to operate recursively on '/'")); } + +#[test] +fn test_chmod_symlink_non_existing_file() { + let (at, mut ucmd) = at_and_ucmd!(); + at.symlink_file("/non-existing", "test-long.link"); + + let result = ucmd + .arg("-R") + .arg("755") + .arg("-v") + .arg("test-long.link") + .fails(); +} + +#[test] +fn test_chmod_symlink_non_existing_recursive() { + let (at, mut ucmd) = at_and_ucmd!(); + at.mkdir("tmp"); + at.symlink_file("/non-existing", "tmp/test-long.link"); + + let result = ucmd.arg("-R").arg("755").arg("-v").arg("tmp").succeeds(); + // it should be a success + println!("stderr {}", result.stderr); + println!("stdout {}", result.stdout); + assert!(result + .stderr + .contains("neither symbolic link 'tmp/test-long.link' nor referent has been changed")); +} From e331186fee470ac8f8c08d9c719814ade51e5340 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 19 Jan 2021 08:15:53 +0100 Subject: [PATCH 285/606] unbreak build with rustc 1.32: force tempfile 3.1.0 (#1695) --- Cargo.lock | 98 +++++-------------------------- Cargo.toml | 4 +- src/uu/csplit/src/csplit_error.rs | 5 +- src/uu/mktemp/Cargo.toml | 2 +- tests/by-util/test_cat.rs | 1 - tests/by-util/test_env.rs | 5 +- tests/by-util/test_mktemp.rs | 3 +- tests/by-util/test_sync.rs | 5 +- tests/common/util.rs | 5 +- 9 files changed, 27 insertions(+), 101 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 70f39ae3f..495b2b303 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -44,7 +44,7 @@ name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hermit-abi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -210,7 +210,7 @@ dependencies = [ "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -580,16 +580,6 @@ dependencies = [ "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "getrandom" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "wasi 0.10.1+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "glob" version = "0.2.11" @@ -602,12 +592,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "half" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hermit-abi" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -775,7 +765,7 @@ name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hermit-abi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -928,17 +918,6 @@ dependencies = [ "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand_chacha" version = "0.2.2" @@ -948,15 +927,6 @@ dependencies = [ "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand_chacha" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand_core" version = "0.3.1" @@ -978,14 +948,6 @@ dependencies = [ "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand_core" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "getrandom 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand_hc" version = "0.2.0" @@ -994,14 +956,6 @@ dependencies = [ "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand_hc" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand_pcg" version = "0.2.1" @@ -1038,14 +992,6 @@ name = "redox_syscall" version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "redox_syscall" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "redox_termios" version = "0.1.1" @@ -1145,7 +1091,7 @@ name = "serde_cbor" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "half 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1222,13 +1168,13 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.2.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1812,7 +1758,7 @@ version = "0.0.2" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", "uucore_procs 0.0.5", ] @@ -1899,7 +1845,7 @@ version = "0.0.2" dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "half 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", "uucore_procs 0.0.5", @@ -2097,7 +2043,7 @@ name = "uu_stdbuf" version = "0.0.2" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "uu_stdbuf_libstdbuf 0.0.2", "uucore 0.0.5", "uucore_procs 0.0.5", @@ -2391,11 +2337,6 @@ name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "wasi" -version = "0.10.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "wasm-bindgen" version = "0.2.69" @@ -2564,11 +2505,10 @@ dependencies = [ "checksum generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fceb69994e330afed50c93524be68c42fa898c2d9fd4ee8da03bd7363acd26f2" "checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" "checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -"checksum getrandom 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4060f4657be78b8e766215b02b18a2e862d83745545de804638e2b545e81aee6" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -"checksum half 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d36fab90f82edc3c747f9d438e06cf0a491055896f2a279638bb5beed6c40177" -"checksum hermit-abi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" +"checksum half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" +"checksum hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" "checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" "checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" "checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" @@ -2611,20 +2551,15 @@ dependencies = [ "checksum quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" "checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" "checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -"checksum rand 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c24fcd450d3fa2b592732565aa4f17a27a61c65ece4726353e000939b0edee34" "checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -"checksum rand_chacha 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" "checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -"checksum rand_core 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5" "checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -"checksum rand_hc 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" "checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" "checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" "checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -"checksum redox_syscall 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" @@ -2648,7 +2583,7 @@ dependencies = [ "checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)" = "cc60a3d73ea6594cd712d830cc1f0390fd71542d8c8cd24e70cc54cdfd5e05d5" -"checksum tempfile 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" "checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" "checksum termion 1.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c22cec9d8978d906be5ac94bceb5a010d885c626c4c8855721a4dbd20e3ac905" @@ -2669,7 +2604,6 @@ dependencies = [ "checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" -"checksum wasi 0.10.1+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "93c6c3420963c5c64bca373b25e77acb562081b9bb4dd5bb864187742186cea9" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" "checksum wasm-bindgen 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" "checksum wasm-bindgen-backend 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" diff --git a/Cargo.toml b/Cargo.toml index 4206db26b..1c28700f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -340,7 +340,9 @@ libc = "0.2" rand = "0.7" regex = "1.0" sha1 = { version="0.6", features=["std"] } -tempfile = "3.1" +## tempfile 3.2 depends on recent version of rand which depends on getrandom v0.2 which has compiler errors for MinRustV v1.32.0 +## min dep for tempfile = Rustc 1.40 +tempfile = "= 3.1.0" time = "0.1" unindent = "0.1" uucore = { version=">=0.0.5", package="uucore", path="src/uucore", features=["entries"] } diff --git a/src/uu/csplit/src/csplit_error.rs b/src/uu/csplit/src/csplit_error.rs index b7059f6e0..637cf8890 100644 --- a/src/uu/csplit/src/csplit_error.rs +++ b/src/uu/csplit/src/csplit_error.rs @@ -16,10 +16,7 @@ pub enum CsplitError { MatchNotFoundOnRepetition(String, usize), #[error("line number must be greater than zero")] LineNumberIsZero, - #[error( - "line number '{}' is smaller than preceding line number, {}", - _0, _1 - )] + #[error("line number '{}' is smaller than preceding line number, {}", _0, _1)] LineNumberSmallerThanPrevious(usize, usize), #[error("invalid pattern: {}", _0)] InvalidPattern(String), diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index 0d21a398d..4fddb181a 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -17,7 +17,7 @@ path = "src/mktemp.rs" [dependencies] clap = "2.33" rand = "0.5" -tempfile = "3.0" +tempfile = "3.1" uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index 20dfb479b..a3e321139 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -1,4 +1,3 @@ -extern crate tempfile; #[cfg(unix)] extern crate unix_socket; diff --git a/tests/by-util/test_env.rs b/tests/by-util/test_env.rs index f747f041e..2ffb2bc48 100644 --- a/tests/by-util/test_env.rs +++ b/tests/by-util/test_env.rs @@ -1,11 +1,10 @@ #[cfg(not(windows))] use std::fs; -use std::path::Path; -extern crate tempfile; -use self::tempfile::tempdir; use crate::common::util::*; use std::env; +use std::path::Path; +use tempfile::tempdir; #[test] fn test_env_help() { diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index 747a38d0d..17193a7c1 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -1,7 +1,6 @@ use crate::common::util::*; -extern crate tempfile; -use self::tempfile::tempdir; +use tempfile::tempdir; static TEST_TEMPLATE1: &'static str = "tempXXXXXX"; static TEST_TEMPLATE2: &'static str = "temp"; diff --git a/tests/by-util/test_sync.rs b/tests/by-util/test_sync.rs index 138992ee4..ddd6969a3 100644 --- a/tests/by-util/test_sync.rs +++ b/tests/by-util/test_sync.rs @@ -1,8 +1,7 @@ use crate::common::util::*; - -use std::fs; extern crate tempfile; -use self::tempfile::tempdir; +use std::fs; +use tempfile::tempdir; #[test] fn test_sync_default() { diff --git a/tests/common/util.rs b/tests/common/util.rs index b01f5014d..3891c7692 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -1,7 +1,3 @@ -#![allow(dead_code)] -extern crate tempfile; - -use self::tempfile::TempDir; use std::env; use std::ffi::OsStr; use std::fs::{self, File, OpenOptions}; @@ -16,6 +12,7 @@ use std::rc::Rc; use std::str::from_utf8; use std::thread::sleep; use std::time::Duration; +use tempfile::TempDir; #[cfg(windows)] static PROGNAME: &str = concat!(env!("CARGO_PKG_NAME"), ".exe"); From 9f7259b986ddeda9246dcc68137b5e309bdb08fc Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 19 Jan 2021 12:38:02 +0100 Subject: [PATCH 286/606] refactor(realpath): move to clap --- Cargo.lock | 2 +- src/uu/realpath/Cargo.toml | 2 +- src/uu/realpath/src/realpath.rs | 129 +++++++++++++++----------------- 3 files changed, 61 insertions(+), 72 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 495b2b303..68d039469 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1933,7 +1933,7 @@ dependencies = [ name = "uu_realpath" version = "0.0.2" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", "uucore_procs 0.0.5", ] diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index cd055eda3..c72b302aa 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/realpath.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/realpath/src/realpath.rs b/src/uu/realpath/src/realpath.rs index 20aaa2fcb..cdcb8e794 100644 --- a/src/uu/realpath/src/realpath.rs +++ b/src/uu/realpath/src/realpath.rs @@ -10,61 +10,71 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs; -use std::path::{Path, PathBuf}; +use std::path::PathBuf; use uucore::fs::{canonicalize, CanonicalizeMode}; -static NAME: &str = "realpath"; +static ABOUT: &str = "print the resolved path"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static OPT_QUIET: &str = "quiet"; +static OPT_STRIP: &str = "strip"; +static OPT_ZERO: &str = "zero"; + +static ARG_FILES: &str = "files"; + +fn get_usage() -> String { + format!("{0} [OPTION]... FILE...", executable!()) +} + pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_QUIET) + .short("q") + .long(OPT_QUIET) + .help("Do not print warnings for invalid paths"), + ) + .arg( + Arg::with_name(OPT_STRIP) + .short("s") + .long(OPT_STRIP) + .help("Only strip '.' and '..' components, but don't resolve symbolic links"), + ) + .arg( + Arg::with_name(OPT_ZERO) + .short("z") + .long(OPT_ZERO) + .help("Separate output filenames with \\0 rather than newline"), + ) + .arg( + Arg::with_name(ARG_FILES) + .multiple(true) + .takes_value(true) + .required(true) + .min_values(1), + ) + .get_matches_from(args); - opts.optflag("h", "help", "Show help and exit"); - opts.optflag("V", "version", "Show version and exit"); - opts.optflag( - "s", - "strip", - "Only strip '.' and '..' components, but don't resolve symbolic links", - ); - opts.optflag( - "z", - "zero", - "Separate output filenames with \\0 rather than newline", - ); - opts.optflag("q", "quiet", "Do not print warnings for invalid paths"); + /* the list of files */ - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - show_usage(&opts); - return 1; - } - }; + let paths: Vec = matches + .values_of(ARG_FILES) + .unwrap() + .map(|path| PathBuf::from(path)) + .collect(); - if matches.opt_present("V") { - version(); - return 0; - } - if matches.opt_present("h") { - show_usage(&opts); - return 0; - } - - if matches.free.is_empty() { - show_error!("Missing operand: FILENAME, at least one is required"); - println!("Try `{} --help` for more information.", NAME); - return 1; - } - - let strip = matches.opt_present("s"); - let zero = matches.opt_present("z"); - let quiet = matches.opt_present("q"); + let strip = matches.is_present(OPT_STRIP); + let zero = matches.is_present(OPT_ZERO); + let quiet = matches.is_present(OPT_QUIET); let mut retcode = 0; - for path in &matches.free { + for path in &paths { if !resolve_path(path, strip, zero, quiet) { retcode = 1 }; @@ -72,15 +82,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { retcode } -fn resolve_path(path: &str, strip: bool, zero: bool, quiet: bool) -> bool { - let p = Path::new(path).to_path_buf(); +fn resolve_path(p: &PathBuf, strip: bool, zero: bool, quiet: bool) -> bool { let abs = canonicalize(p, CanonicalizeMode::Normal).unwrap(); if strip { if zero { - print!("{}\0", abs.display()); + print!("{}\0", p.display()); } else { - println!("{}", abs.display()) + println!("{}", p.display()) } return true; } @@ -93,7 +102,7 @@ fn resolve_path(path: &str, strip: bool, zero: bool, quiet: bool) -> bool { loop { if links_left == 0 { if !quiet { - show_error!("Too many symbolic links: {}", path) + show_error!("Too many symbolic links: {}", p.display()) }; return false; } @@ -109,7 +118,7 @@ fn resolve_path(path: &str, strip: bool, zero: bool, quiet: bool) -> bool { } _ => { if !quiet { - show_error!("Invalid path: {}", path) + show_error!("Invalid path: {}", p.display()) }; return false; } @@ -127,23 +136,3 @@ fn resolve_path(path: &str, strip: bool, zero: bool, quiet: bool) -> bool { true } - -fn version() { - println!("{} {}", NAME, VERSION) -} - -fn show_usage(opts: &getopts::Options) { - version(); - println!(); - println!("Usage:"); - println!(" {} [-s|--strip] [-z|--zero] FILENAME...", NAME); - println!(" {} -V|--version", NAME); - println!(" {} -h|--help", NAME); - println!(); - print!("{}", opts.usage( - "Convert each FILENAME to the absolute path.\n\ - All the symbolic links will be resolved, resulting path will contain no special components like '.' or '..'.\n\ - Each path component must exist or resolution will fail and non-zero exit status returned.\n\ - Each resolved FILENAME will be written to the standard output, one per line.") - ); -} From b8d0467da8117ea008bd14eb474af72afd709e95 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 19 Jan 2021 12:38:36 +0100 Subject: [PATCH 287/606] test(realpath): improve the coverage --- tests/by-util/test_realpath.rs | 76 ++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/tests/by-util/test_realpath.rs b/tests/by-util/test_realpath.rs index 1d5b67e68..fe06e5afb 100644 --- a/tests/by-util/test_realpath.rs +++ b/tests/by-util/test_realpath.rs @@ -32,3 +32,79 @@ fn test_long_redirection_to_root() { println!("expect: {:?}", expect); assert_eq!(actual, expect); } + +#[test] +fn test_file_and_links() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let result = scene.ucmd().run(); + + at.touch("foo"); + at.symlink_file("foo", "bar"); + + let actual = scene.ucmd().arg("foo").run().stdout; + println!("actual: {:?}", actual); + assert!(actual.contains("foo\n")); + + let actual = scene.ucmd().arg("bar").run().stdout; + println!("actual: {:?}", actual); + assert!(actual.contains("foo\n")); +} + +#[test] +fn test_file_and_links_zero() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let result = scene.ucmd().run(); + + at.touch("foo"); + at.symlink_file("foo", "bar"); + + let actual = scene.ucmd().arg("foo").arg("-z").run().stdout; + println!("actual: {:?}", actual); + assert!(actual.contains("foo")); + assert!(!actual.contains("\n")); + + let actual = scene.ucmd().arg("bar").arg("-z").run().stdout; + println!("actual: {:?}", actual); + assert!(actual.contains("foo")); + assert!(!actual.contains("\n")); +} + +#[test] +fn test_file_and_links_strip() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let result = scene.ucmd().run(); + + at.touch("foo"); + at.symlink_file("foo", "bar"); + + let actual = scene.ucmd().arg("foo").arg("-s").run().stdout; + println!("actual: {:?}", actual); + assert!(actual.contains("foo\n")); + + let actual = scene.ucmd().arg("bar").arg("-s").run().stdout; + println!("actual: {:?}", actual); + assert!(actual.contains("bar\n")); +} + +#[test] +fn test_file_and_links_strip_zero() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let result = scene.ucmd().run(); + + at.touch("foo"); + at.symlink_file("foo", "bar"); + + let actual = scene.ucmd().arg("foo").arg("-s").arg("-z").run().stdout; + println!("actual: {:?}", actual); + assert!(actual.contains("foo")); + assert!(!actual.contains("\n")); + + let actual = scene.ucmd().arg("bar").arg("-s").arg("-z").run().stdout; + println!("actual: {:?}", actual); + assert!(actual.contains("bar")); + assert!(!actual.contains("\n")); +} From 4eb6edaf52dd873e605f29be19c8bdcd965a0b2b Mon Sep 17 00:00:00 2001 From: jaggededgedjustice Date: Thu, 21 Jan 2021 07:19:08 +0000 Subject: [PATCH 288/606] Add gnu tests (#1699) --- .github/workflows/GNU.yml | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/GNU.yml diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml new file mode 100644 index 000000000..1a635ea15 --- /dev/null +++ b/.github/workflows/GNU.yml @@ -0,0 +1,52 @@ +name: GNU + +on: [push, pull_request] + +jobs: + gnu: + name: Run GNU tests + runs-on: ubuntu-latest + steps: + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code uutil + uses: actions/checkout@v2 + with: + path: 'uutils' + - name: Chechout GNU coreutils + uses: actions/checkout@v2 + with: + repository: 'coreutils/coreutils' + path: 'gnu' + - name: Chechout GNU corelib + uses: actions/checkout@v2 + with: + repository: 'coreutils/gnulib' + path: 'gnulib' + fetch-depth: 0 # gnu gets upset if gnulib is a shallow checkout + - name: Install `rust` toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + profile: minimal # minimal component installation (ie, no documentation) + components: rustfmt + - name: Run gnu tests + shell: bash + run: | + pushd uutils + cargo build --release + BUILDDIR="$PWD/target/release/" + popd + GNULIB_SRCDIR="$PWD/gnulib" + pushd gnu/ + sudo apt-get update + sudo apt-get install autoconf autopoint bison texinfo gperf gcc gdb python-pyinotify + ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" + ./configure --quiet --disable-gcc-warnings + # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils + sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile + sed -i 's| tr | /usr/bin/tr |' tests/init.sh + make + test -f $BUILDDIR/getlimits || cp src/getlimits $BUILDDIR + ulimit -t 60 + make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : From 42b048d3160e403e64628653eaebbe86a331a9ae Mon Sep 17 00:00:00 2001 From: nicoo Date: Thu, 21 Jan 2021 15:27:22 +0100 Subject: [PATCH 289/606] 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. --- src/uu/factor/Cargo.toml | 4 ++-- src/uu/factor/build.rs | 1 + src/uu/factor/src/numeric/montgomery.rs | 7 +++---- src/uu/factor/src/numeric/traits.rs | 23 ++++------------------- 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index da38f2797..2ecdc5a6a 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -12,11 +12,11 @@ categories = ["command-line-utilities"] edition = "2018" [build-dependencies] -num-traits = "0.2" # used in src/numerics.rs, which is included by build.rs +num-traits = "0.2.13" # used in src/numerics.rs, which is included by build.rs [dependencies] -num-traits = "0.2" +num-traits = "0.2.13" # Needs at least version 0.2.13 for "OverflowingAdd" rand = { version="0.7", features=["small_rng"] } smallvec = { version="0.6.13, < 1.0" } uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } diff --git a/src/uu/factor/build.rs b/src/uu/factor/build.rs index 4c3125472..eff21ae2f 100644 --- a/src/uu/factor/build.rs +++ b/src/uu/factor/build.rs @@ -29,6 +29,7 @@ use miller_rabin::is_prime; #[path = "src/numeric/modular_inverse.rs"] mod modular_inverse; +#[allow(unused_imports)] // imports there are used, but invisible from build.rs #[path = "src/numeric/traits.rs"] mod traits; use modular_inverse::modular_inverse; diff --git a/src/uu/factor/src/numeric/montgomery.rs b/src/uu/factor/src/numeric/montgomery.rs index e39b1dba1..8c38464bc 100644 --- a/src/uu/factor/src/numeric/montgomery.rs +++ b/src/uu/factor/src/numeric/montgomery.rs @@ -8,8 +8,7 @@ use super::*; -use num_traits::identities::{One, Zero}; -use traits::{DoubleInt, Int, OverflowingAdd}; +use traits::{DoubleInt, Int, One, OverflowingAdd, Zero}; pub(crate) trait Arithmetic: Copy + Sized { // The type of integers mod m, in some opaque representation @@ -74,7 +73,7 @@ impl Montgomery { let Montgomery { a, n } = self; let m = T::from_double_width(x).wrapping_mul(a); let nm = (n.as_double_width()) * (m.as_double_width()); - let (xnm, overflow) = x.overflowing_add_(nm); // x + n*m + let (xnm, overflow) = x.overflowing_add(&nm); // x + n*m debug_assert_eq!( xnm % (T::DoubleWidth::one() << T::zero().count_zeros() as usize), T::DoubleWidth::zero() @@ -130,7 +129,7 @@ impl Arithmetic for Montgomery { } fn add(&self, a: Self::ModInt, b: Self::ModInt) -> Self::ModInt { - let (r, overflow) = a.overflowing_add_(b); + let (r, overflow) = a.overflowing_add(&b); // In case of overflow, a+b = 2⁶⁴ + r = (2⁶⁴ - n) + r (working mod n) let r = if !overflow { diff --git a/src/uu/factor/src/numeric/traits.rs b/src/uu/factor/src/numeric/traits.rs index 50f5ab5c1..2e9167e0b 100644 --- a/src/uu/factor/src/numeric/traits.rs +++ b/src/uu/factor/src/numeric/traits.rs @@ -6,31 +6,16 @@ // * For the full copyright and license information, please view the LICENSE file // * that was distributed with this source code. +pub(crate) use num_traits::{ + identities::{One, Zero}, + ops::overflowing::OverflowingAdd, +}; use num_traits::{ int::PrimInt, ops::wrapping::{WrappingMul, WrappingNeg, WrappingSub}, }; use std::fmt::{Debug, Display}; -// NOTE: Trait can be removed once num-traits adds a similar one; -// see https://github.com/rust-num/num-traits/issues/168 -pub(crate) trait OverflowingAdd: Sized { - fn overflowing_add_(self, n: Self) -> (Self, bool); -} - -macro_rules! overflowing { - ($x:ty) => { - impl OverflowingAdd for $x { - fn overflowing_add_(self, n: Self) -> (Self, bool) { - self.overflowing_add(n) - } - } - }; -} -overflowing!(u32); -overflowing!(u64); -overflowing!(u128); - pub(crate) trait Int: Display + Debug + PrimInt + OverflowingAdd + WrappingNeg + WrappingSub + WrappingMul { From ea20b22d1289eaecb6acaa1a09b453e5c262b634 Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 20 Jan 2021 19:10:07 +0100 Subject: [PATCH 290/606] 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. --- src/uu/factor/src/numeric/gcd.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/uu/factor/src/numeric/gcd.rs b/src/uu/factor/src/numeric/gcd.rs index 96a0366a2..36ad833a6 100644 --- a/src/uu/factor/src/numeric/gcd.rs +++ b/src/uu/factor/src/numeric/gcd.rs @@ -76,14 +76,13 @@ mod tests { gcd(0, a) == a } - fn divisor(a: u64, b: u64) -> bool { - // Test that gcd(a, b) divides a and b + fn divisor(a: u64, b: u64) -> () { + // Test that gcd(a, b) divides a and b, unless a == b == 0 + if a == 0 && b == 0 { return; } + let g = gcd(a, b); - if g != 0 { - a % g == 0 && b % g == 0 - } else { - a == 0 && b == 0 // for g == 0 - } + assert_eq!(a % g, 0); + assert_eq!(b % g, 0); } fn commutative(a: u64, b: u64) -> bool { From 20046013fbd6c00ea0b4f9317167a60e4a7254e1 Mon Sep 17 00:00:00 2001 From: jaggededgedjustice Date: Thu, 21 Jan 2021 22:56:02 +0000 Subject: [PATCH 291/606] Cleanup gnu test script (#1701) --- .github/workflows/GNU.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 1a635ea15..9b6b60c08 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -30,7 +30,7 @@ jobs: default: true profile: minimal # minimal component installation (ie, no documentation) components: rustfmt - - name: Run gnu tests + - name: Build binaries shell: bash run: | pushd uutils @@ -40,13 +40,20 @@ jobs: GNULIB_SRCDIR="$PWD/gnulib" pushd gnu/ sudo apt-get update - sudo apt-get install autoconf autopoint bison texinfo gperf gcc gdb python-pyinotify + sudo apt-get install autoconf autopoint bison texinfo gperf gcc gdb python-pyinotify expect ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" ./configure --quiet --disable-gcc-warnings # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile sed -i 's| tr | /usr/bin/tr |' tests/init.sh make - test -f $BUILDDIR/getlimits || cp src/getlimits $BUILDDIR + test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" + - name: Run GNU tests + shell: bash + run: | + BUILDDIR="${PWD}/uutils/target/release" + GNULIB_DIR="${PWD}/gnulib" + pushd gnu ulimit -t 60 - make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : + + unbuffer make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : From f8485b3578409aedbc7bde40e33b92ad41ef6918 Mon Sep 17 00:00:00 2001 From: teor Date: Fri, 22 Jan 2021 15:01:08 +1000 Subject: [PATCH 292/606] Delete duplicate stty from README table --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 17efa01dd..7c9368e13 100644 --- a/README.md +++ b/README.md @@ -291,10 +291,10 @@ Utilities | arch | cp | chcon | | base32 | expr | dd | | base64 | install | numfmt | -| basename | ls | stty | -| cat | more | pr | -| chgrp | od (`--strings` and 128-bit data types missing) | runcon | -| chmod | printf | stty | +| basename | ls | pr | +| cat | more | runcon | +| chgrp | od (`--strings` and 128-bit data types missing) | stty | +| chmod | printf | | | chown | sort | | | chroot | split | | | cksum | tail | | From a807fc623aedb4d88e13c6ce397fbc1b6f62fe70 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 21 Jan 2021 21:09:19 +0100 Subject: [PATCH 293/606] Update to version 0.0.3 --- Cargo.lock | 443 +++++++++++++------------ Cargo.toml | 192 +++++------ src/uu/arch/Cargo.toml | 2 +- src/uu/base32/Cargo.toml | 2 +- src/uu/base64/Cargo.toml | 2 +- src/uu/basename/Cargo.toml | 2 +- src/uu/cat/Cargo.toml | 2 +- src/uu/chgrp/Cargo.toml | 2 +- src/uu/chmod/Cargo.toml | 2 +- src/uu/chown/Cargo.toml | 2 +- src/uu/chroot/Cargo.toml | 2 +- src/uu/cksum/Cargo.toml | 2 +- src/uu/comm/Cargo.toml | 2 +- src/uu/cp/Cargo.toml | 2 +- src/uu/csplit/Cargo.toml | 2 +- src/uu/cut/Cargo.toml | 2 +- src/uu/date/Cargo.toml | 2 +- src/uu/df/Cargo.toml | 2 +- src/uu/dircolors/Cargo.toml | 2 +- src/uu/dirname/Cargo.toml | 2 +- src/uu/du/Cargo.toml | 2 +- src/uu/echo/Cargo.toml | 2 +- src/uu/env/Cargo.toml | 2 +- src/uu/expand/Cargo.toml | 2 +- src/uu/expr/Cargo.toml | 2 +- src/uu/factor/Cargo.toml | 2 +- src/uu/false/Cargo.toml | 2 +- src/uu/fmt/Cargo.toml | 2 +- src/uu/fold/Cargo.toml | 2 +- src/uu/groups/Cargo.toml | 2 +- src/uu/hashsum/Cargo.toml | 2 +- src/uu/head/Cargo.toml | 2 +- src/uu/hostid/Cargo.toml | 2 +- src/uu/hostname/Cargo.toml | 2 +- src/uu/id/Cargo.toml | 2 +- src/uu/install/Cargo.toml | 2 +- src/uu/join/Cargo.toml | 2 +- src/uu/kill/Cargo.toml | 2 +- src/uu/link/Cargo.toml | 2 +- src/uu/ln/Cargo.toml | 2 +- src/uu/logname/Cargo.toml | 2 +- src/uu/ls/Cargo.toml | 2 +- src/uu/mkdir/Cargo.toml | 2 +- src/uu/mkfifo/Cargo.toml | 2 +- src/uu/mknod/Cargo.toml | 2 +- src/uu/mktemp/Cargo.toml | 2 +- src/uu/more/Cargo.toml | 2 +- src/uu/mv/Cargo.toml | 2 +- src/uu/nice/Cargo.toml | 2 +- src/uu/nl/Cargo.toml | 2 +- src/uu/nohup/Cargo.toml | 2 +- src/uu/nproc/Cargo.toml | 2 +- src/uu/numfmt/Cargo.toml | 2 +- src/uu/od/Cargo.toml | 2 +- src/uu/paste/Cargo.toml | 2 +- src/uu/pathchk/Cargo.toml | 2 +- src/uu/pinky/Cargo.toml | 2 +- src/uu/printenv/Cargo.toml | 2 +- src/uu/printf/Cargo.toml | 2 +- src/uu/ptx/Cargo.toml | 2 +- src/uu/pwd/Cargo.toml | 2 +- src/uu/readlink/Cargo.toml | 2 +- src/uu/realpath/Cargo.toml | 2 +- src/uu/relpath/Cargo.toml | 2 +- src/uu/rm/Cargo.toml | 2 +- src/uu/rmdir/Cargo.toml | 2 +- src/uu/seq/Cargo.toml | 2 +- src/uu/shred/Cargo.toml | 2 +- src/uu/shuf/Cargo.toml | 2 +- src/uu/sleep/Cargo.toml | 2 +- src/uu/sort/Cargo.toml | 2 +- src/uu/split/Cargo.toml | 2 +- src/uu/stat/Cargo.toml | 2 +- src/uu/stdbuf/Cargo.toml | 4 +- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 2 +- src/uu/sum/Cargo.toml | 2 +- src/uu/sync/Cargo.toml | 2 +- src/uu/tac/Cargo.toml | 2 +- src/uu/tail/Cargo.toml | 2 +- src/uu/tee/Cargo.toml | 2 +- src/uu/test/Cargo.toml | 2 +- src/uu/timeout/Cargo.toml | 2 +- src/uu/touch/Cargo.toml | 2 +- src/uu/tr/Cargo.toml | 2 +- src/uu/true/Cargo.toml | 2 +- src/uu/truncate/Cargo.toml | 2 +- src/uu/tsort/Cargo.toml | 2 +- src/uu/tty/Cargo.toml | 2 +- src/uu/uname/Cargo.toml | 2 +- src/uu/unexpand/Cargo.toml | 2 +- src/uu/uniq/Cargo.toml | 2 +- src/uu/unlink/Cargo.toml | 2 +- src/uu/uptime/Cargo.toml | 2 +- src/uu/users/Cargo.toml | 2 +- src/uu/wc/Cargo.toml | 2 +- src/uu/who/Cargo.toml | 2 +- src/uu/whoami/Cargo.toml | 2 +- src/uu/yes/Cargo.toml | 2 +- 98 files changed, 419 insertions(+), 410 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 68d039469..29b59fa2a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -103,7 +103,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -196,12 +196,12 @@ dependencies = [ [[package]] name = "coreutils" -version = "0.0.2" +version = "0.0.3" dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -216,101 +216,101 @@ dependencies = [ "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_arch 0.0.2", - "uu_base32 0.0.2", - "uu_base64 0.0.2", - "uu_basename 0.0.2", - "uu_cat 0.0.2", - "uu_chgrp 0.0.2", - "uu_chmod 0.0.2", - "uu_chown 0.0.2", - "uu_chroot 0.0.2", - "uu_cksum 0.0.2", - "uu_comm 0.0.2", - "uu_cp 0.0.2", - "uu_csplit 0.0.2", - "uu_cut 0.0.2", - "uu_date 0.0.2", - "uu_df 0.0.2", - "uu_dircolors 0.0.2", - "uu_dirname 0.0.2", - "uu_du 0.0.2", - "uu_echo 0.0.2", - "uu_env 0.0.2", - "uu_expand 0.0.2", - "uu_expr 0.0.2", - "uu_factor 0.0.2", - "uu_false 0.0.2", - "uu_fmt 0.0.2", - "uu_fold 0.0.2", - "uu_groups 0.0.2", - "uu_hashsum 0.0.2", - "uu_head 0.0.2", - "uu_hostid 0.0.2", - "uu_hostname 0.0.2", - "uu_id 0.0.2", - "uu_install 0.0.2", - "uu_join 0.0.2", - "uu_kill 0.0.2", - "uu_link 0.0.2", - "uu_ln 0.0.2", - "uu_logname 0.0.2", - "uu_ls 0.0.2", - "uu_mkdir 0.0.2", - "uu_mkfifo 0.0.2", - "uu_mknod 0.0.2", - "uu_mktemp 0.0.2", - "uu_more 0.0.2", - "uu_mv 0.0.2", - "uu_nice 0.0.2", - "uu_nl 0.0.2", - "uu_nohup 0.0.2", - "uu_nproc 0.0.2", - "uu_numfmt 0.0.2", - "uu_od 0.0.2", - "uu_paste 0.0.2", - "uu_pathchk 0.0.2", - "uu_pinky 0.0.2", - "uu_printenv 0.0.2", - "uu_printf 0.0.2", - "uu_ptx 0.0.2", - "uu_pwd 0.0.2", - "uu_readlink 0.0.2", - "uu_realpath 0.0.2", - "uu_relpath 0.0.2", - "uu_rm 0.0.2", - "uu_rmdir 0.0.2", - "uu_seq 0.0.2", - "uu_shred 0.0.2", - "uu_shuf 0.0.2", - "uu_sleep 0.0.2", - "uu_sort 0.0.2", - "uu_split 0.0.2", - "uu_stat 0.0.2", - "uu_stdbuf 0.0.2", - "uu_sum 0.0.2", - "uu_sync 0.0.2", - "uu_tac 0.0.2", - "uu_tail 0.0.2", - "uu_tee 0.0.2", - "uu_test 0.0.2", - "uu_timeout 0.0.2", - "uu_touch 0.0.2", - "uu_tr 0.0.2", - "uu_true 0.0.2", - "uu_truncate 0.0.2", - "uu_tsort 0.0.2", - "uu_tty 0.0.2", - "uu_uname 0.0.2", - "uu_unexpand 0.0.2", - "uu_uniq 0.0.2", - "uu_unlink 0.0.2", - "uu_uptime 0.0.2", - "uu_users 0.0.2", - "uu_wc 0.0.2", - "uu_who 0.0.2", - "uu_whoami 0.0.2", - "uu_yes 0.0.2", + "uu_arch 0.0.3", + "uu_base32 0.0.3", + "uu_base64 0.0.3", + "uu_basename 0.0.3", + "uu_cat 0.0.3", + "uu_chgrp 0.0.3", + "uu_chmod 0.0.3", + "uu_chown 0.0.3", + "uu_chroot 0.0.3", + "uu_cksum 0.0.3", + "uu_comm 0.0.3", + "uu_cp 0.0.3", + "uu_csplit 0.0.3", + "uu_cut 0.0.3", + "uu_date 0.0.3", + "uu_df 0.0.3", + "uu_dircolors 0.0.3", + "uu_dirname 0.0.3", + "uu_du 0.0.3", + "uu_echo 0.0.3", + "uu_env 0.0.3", + "uu_expand 0.0.3", + "uu_expr 0.0.3", + "uu_factor 0.0.3", + "uu_false 0.0.3", + "uu_fmt 0.0.3", + "uu_fold 0.0.3", + "uu_groups 0.0.3", + "uu_hashsum 0.0.3", + "uu_head 0.0.3", + "uu_hostid 0.0.3", + "uu_hostname 0.0.3", + "uu_id 0.0.3", + "uu_install 0.0.3", + "uu_join 0.0.3", + "uu_kill 0.0.3", + "uu_link 0.0.3", + "uu_ln 0.0.3", + "uu_logname 0.0.3", + "uu_ls 0.0.3", + "uu_mkdir 0.0.3", + "uu_mkfifo 0.0.3", + "uu_mknod 0.0.3", + "uu_mktemp 0.0.3", + "uu_more 0.0.3", + "uu_mv 0.0.3", + "uu_nice 0.0.3", + "uu_nl 0.0.3", + "uu_nohup 0.0.3", + "uu_nproc 0.0.3", + "uu_numfmt 0.0.3", + "uu_od 0.0.3", + "uu_paste 0.0.3", + "uu_pathchk 0.0.3", + "uu_pinky 0.0.3", + "uu_printenv 0.0.3", + "uu_printf 0.0.3", + "uu_ptx 0.0.3", + "uu_pwd 0.0.3", + "uu_readlink 0.0.3", + "uu_realpath 0.0.3", + "uu_relpath 0.0.3", + "uu_rm 0.0.3", + "uu_rmdir 0.0.3", + "uu_seq 0.0.3", + "uu_shred 0.0.3", + "uu_shuf 0.0.3", + "uu_sleep 0.0.3", + "uu_sort 0.0.3", + "uu_split 0.0.3", + "uu_stat 0.0.3", + "uu_stdbuf 0.0.3", + "uu_sum 0.0.3", + "uu_sync 0.0.3", + "uu_tac 0.0.3", + "uu_tail 0.0.3", + "uu_tee 0.0.3", + "uu_test 0.0.3", + "uu_timeout 0.0.3", + "uu_touch 0.0.3", + "uu_tr 0.0.3", + "uu_true 0.0.3", + "uu_truncate 0.0.3", + "uu_tsort 0.0.3", + "uu_tty 0.0.3", + "uu_uname 0.0.3", + "uu_unexpand 0.0.3", + "uu_uniq 0.0.3", + "uu_unlink 0.0.3", + "uu_uptime 0.0.3", + "uu_users 0.0.3", + "uu_wc 0.0.3", + "uu_who 0.0.3", + "uu_whoami 0.0.3", + "uu_yes 0.0.3", "uucore 0.0.5", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -406,9 +406,9 @@ dependencies = [ "plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -474,7 +474,7 @@ dependencies = [ "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -529,12 +529,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "filetime" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -993,11 +993,19 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "redox_termios" -version = "0.1.1" +name = "redox_syscall" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_termios" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "redox_syscall 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1083,7 +1091,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.119" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1092,12 +1100,12 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.119" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1112,7 +1120,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1204,7 +1212,7 @@ dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1269,7 +1277,7 @@ name = "tinytemplate" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1318,7 +1326,7 @@ dependencies = [ [[package]] name = "uu_arch" -version = "0.0.2" +version = "0.0.3" dependencies = [ "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1327,7 +1335,7 @@ dependencies = [ [[package]] name = "uu_base32" -version = "0.0.2" +version = "0.0.3" dependencies = [ "uucore 0.0.5", "uucore_procs 0.0.5", @@ -1335,7 +1343,7 @@ dependencies = [ [[package]] name = "uu_base64" -version = "0.0.2" +version = "0.0.3" dependencies = [ "uucore 0.0.5", "uucore_procs 0.0.5", @@ -1343,7 +1351,7 @@ dependencies = [ [[package]] name = "uu_basename" -version = "0.0.2" +version = "0.0.3" dependencies = [ "uucore 0.0.5", "uucore_procs 0.0.5", @@ -1351,7 +1359,7 @@ dependencies = [ [[package]] name = "uu_cat" -version = "0.0.2" +version = "0.0.3" dependencies = [ "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1361,7 +1369,7 @@ dependencies = [ [[package]] name = "uu_chgrp" -version = "0.0.2" +version = "0.0.3" dependencies = [ "uucore 0.0.5", "uucore_procs 0.0.5", @@ -1370,7 +1378,7 @@ dependencies = [ [[package]] name = "uu_chmod" -version = "0.0.2" +version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1380,7 +1388,7 @@ dependencies = [ [[package]] name = "uu_chown" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1391,7 +1399,7 @@ dependencies = [ [[package]] name = "uu_chroot" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1400,7 +1408,7 @@ dependencies = [ [[package]] name = "uu_cksum" -version = "0.0.2" +version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1409,7 +1417,7 @@ dependencies = [ [[package]] name = "uu_comm" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1419,10 +1427,10 @@ dependencies = [ [[package]] name = "uu_cp" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1435,7 +1443,7 @@ dependencies = [ [[package]] name = "uu_csplit" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1447,7 +1455,7 @@ dependencies = [ [[package]] name = "uu_cut" -version = "0.0.2" +version = "0.0.3" dependencies = [ "uucore 0.0.5", "uucore_procs 0.0.5", @@ -1455,7 +1463,7 @@ dependencies = [ [[package]] name = "uu_date" -version = "0.0.2" +version = "0.0.3" dependencies = [ "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1465,7 +1473,7 @@ dependencies = [ [[package]] name = "uu_df" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1477,7 +1485,7 @@ dependencies = [ [[package]] name = "uu_dircolors" -version = "0.0.2" +version = "0.0.3" dependencies = [ "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1486,7 +1494,7 @@ dependencies = [ [[package]] name = "uu_dirname" -version = "0.0.2" +version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1495,7 +1503,7 @@ dependencies = [ [[package]] name = "uu_du" -version = "0.0.2" +version = "0.0.3" dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1504,7 +1512,7 @@ dependencies = [ [[package]] name = "uu_echo" -version = "0.0.2" +version = "0.0.3" dependencies = [ "uucore 0.0.5", "uucore_procs 0.0.5", @@ -1512,7 +1520,7 @@ dependencies = [ [[package]] name = "uu_env" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1523,7 +1531,7 @@ dependencies = [ [[package]] name = "uu_expand" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1533,7 +1541,7 @@ dependencies = [ [[package]] name = "uu_expr" -version = "0.0.2" +version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1543,7 +1551,7 @@ dependencies = [ [[package]] name = "uu_factor" -version = "0.0.2" +version = "0.0.3" dependencies = [ "criterion 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1558,7 +1566,7 @@ dependencies = [ [[package]] name = "uu_false" -version = "0.0.2" +version = "0.0.3" dependencies = [ "uucore 0.0.5", "uucore_procs 0.0.5", @@ -1566,7 +1574,7 @@ dependencies = [ [[package]] name = "uu_fmt" -version = "0.0.2" +version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1576,7 +1584,7 @@ dependencies = [ [[package]] name = "uu_fold" -version = "0.0.2" +version = "0.0.3" dependencies = [ "uucore 0.0.5", "uucore_procs 0.0.5", @@ -1584,7 +1592,7 @@ dependencies = [ [[package]] name = "uu_groups" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1593,7 +1601,7 @@ dependencies = [ [[package]] name = "uu_hashsum" -version = "0.0.2" +version = "0.0.3" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1612,7 +1620,7 @@ dependencies = [ [[package]] name = "uu_head" -version = "0.0.2" +version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1621,7 +1629,7 @@ dependencies = [ [[package]] name = "uu_hostid" -version = "0.0.2" +version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1630,7 +1638,7 @@ dependencies = [ [[package]] name = "uu_hostname" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1642,7 +1650,7 @@ dependencies = [ [[package]] name = "uu_id" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1651,7 +1659,7 @@ dependencies = [ [[package]] name = "uu_install" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1662,7 +1670,7 @@ dependencies = [ [[package]] name = "uu_join" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1671,7 +1679,7 @@ dependencies = [ [[package]] name = "uu_kill" -version = "0.0.2" +version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1680,7 +1688,7 @@ dependencies = [ [[package]] name = "uu_link" -version = "0.0.2" +version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1689,7 +1697,7 @@ dependencies = [ [[package]] name = "uu_ln" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1699,7 +1707,7 @@ dependencies = [ [[package]] name = "uu_logname" -version = "0.0.2" +version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1708,7 +1716,7 @@ dependencies = [ [[package]] name = "uu_ls" -version = "0.0.2" +version = "0.0.3" dependencies = [ "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1724,7 +1732,7 @@ dependencies = [ [[package]] name = "uu_mkdir" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1734,7 +1742,7 @@ dependencies = [ [[package]] name = "uu_mkfifo" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1744,7 +1752,7 @@ dependencies = [ [[package]] name = "uu_mknod" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1754,7 +1762,7 @@ dependencies = [ [[package]] name = "uu_mktemp" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1765,19 +1773,19 @@ dependencies = [ [[package]] name = "uu_more" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", "uucore_procs 0.0.5", ] [[package]] name = "uu_mv" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1787,7 +1795,7 @@ dependencies = [ [[package]] name = "uu_nice" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1797,7 +1805,7 @@ dependencies = [ [[package]] name = "uu_nl" -version = "0.0.2" +version = "0.0.3" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1811,7 +1819,7 @@ dependencies = [ [[package]] name = "uu_nohup" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1821,7 +1829,7 @@ dependencies = [ [[package]] name = "uu_nproc" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1832,7 +1840,7 @@ dependencies = [ [[package]] name = "uu_numfmt" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1841,7 +1849,7 @@ dependencies = [ [[package]] name = "uu_od" -version = "0.0.2" +version = "0.0.3" dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1853,7 +1861,7 @@ dependencies = [ [[package]] name = "uu_paste" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1862,7 +1870,7 @@ dependencies = [ [[package]] name = "uu_pathchk" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1872,7 +1880,7 @@ dependencies = [ [[package]] name = "uu_pinky" -version = "0.0.2" +version = "0.0.3" dependencies = [ "uucore 0.0.5", "uucore_procs 0.0.5", @@ -1880,7 +1888,7 @@ dependencies = [ [[package]] name = "uu_printenv" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1889,7 +1897,7 @@ dependencies = [ [[package]] name = "uu_printf" -version = "0.0.2" +version = "0.0.3" dependencies = [ "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1898,7 +1906,7 @@ dependencies = [ [[package]] name = "uu_ptx" -version = "0.0.2" +version = "0.0.3" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1912,7 +1920,7 @@ dependencies = [ [[package]] name = "uu_pwd" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1921,7 +1929,7 @@ dependencies = [ [[package]] name = "uu_readlink" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1931,7 +1939,7 @@ dependencies = [ [[package]] name = "uu_realpath" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1940,7 +1948,7 @@ dependencies = [ [[package]] name = "uu_relpath" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1949,7 +1957,7 @@ dependencies = [ [[package]] name = "uu_rm" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1960,7 +1968,7 @@ dependencies = [ [[package]] name = "uu_rmdir" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1969,7 +1977,7 @@ dependencies = [ [[package]] name = "uu_seq" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -1978,9 +1986,9 @@ dependencies = [ [[package]] name = "uu_shred" -version = "0.0.2" +version = "0.0.3" dependencies = [ - "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1991,7 +1999,7 @@ dependencies = [ [[package]] name = "uu_shuf" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2001,7 +2009,7 @@ dependencies = [ [[package]] name = "uu_sleep" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -2010,7 +2018,7 @@ dependencies = [ [[package]] name = "uu_sort" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2021,7 +2029,7 @@ dependencies = [ [[package]] name = "uu_split" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -2030,7 +2038,7 @@ dependencies = [ [[package]] name = "uu_stat" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2040,18 +2048,18 @@ dependencies = [ [[package]] name = "uu_stdbuf" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_stdbuf_libstdbuf 0.0.2", + "uu_stdbuf_libstdbuf 0.0.3", "uucore 0.0.5", "uucore_procs 0.0.5", ] [[package]] name = "uu_stdbuf_libstdbuf" -version = "0.0.2" +version = "0.0.3" dependencies = [ "cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2062,7 +2070,7 @@ dependencies = [ [[package]] name = "uu_sum" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -2071,7 +2079,7 @@ dependencies = [ [[package]] name = "uu_sync" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2082,7 +2090,7 @@ dependencies = [ [[package]] name = "uu_tac" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -2091,7 +2099,7 @@ dependencies = [ [[package]] name = "uu_tail" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2103,7 +2111,7 @@ dependencies = [ [[package]] name = "uu_tee" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2113,7 +2121,7 @@ dependencies = [ [[package]] name = "uu_test" -version = "0.0.2" +version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2123,7 +2131,7 @@ dependencies = [ [[package]] name = "uu_timeout" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2134,10 +2142,10 @@ dependencies = [ [[package]] name = "uu_touch" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", "uucore_procs 0.0.5", @@ -2145,7 +2153,7 @@ dependencies = [ [[package]] name = "uu_tr" -version = "0.0.2" +version = "0.0.3" dependencies = [ "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2156,7 +2164,7 @@ dependencies = [ [[package]] name = "uu_true" -version = "0.0.2" +version = "0.0.3" dependencies = [ "uucore 0.0.5", "uucore_procs 0.0.5", @@ -2164,7 +2172,7 @@ dependencies = [ [[package]] name = "uu_truncate" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -2173,7 +2181,7 @@ dependencies = [ [[package]] name = "uu_tsort" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -2182,7 +2190,7 @@ dependencies = [ [[package]] name = "uu_tty" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2192,7 +2200,7 @@ dependencies = [ [[package]] name = "uu_uname" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2202,7 +2210,7 @@ dependencies = [ [[package]] name = "uu_unexpand" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2212,7 +2220,7 @@ dependencies = [ [[package]] name = "uu_uniq" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -2221,7 +2229,7 @@ dependencies = [ [[package]] name = "uu_unlink" -version = "0.0.2" +version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2231,7 +2239,7 @@ dependencies = [ [[package]] name = "uu_uptime" -version = "0.0.2" +version = "0.0.3" dependencies = [ "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2242,7 +2250,7 @@ dependencies = [ [[package]] name = "uu_users" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -2251,7 +2259,7 @@ dependencies = [ [[package]] name = "uu_wc" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -2260,7 +2268,7 @@ dependencies = [ [[package]] name = "uu_who" -version = "0.0.2" +version = "0.0.3" dependencies = [ "uucore 0.0.5", "uucore_procs 0.0.5", @@ -2268,7 +2276,7 @@ dependencies = [ [[package]] name = "uu_whoami" -version = "0.0.2" +version = "0.0.3" dependencies = [ "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2279,7 +2287,7 @@ dependencies = [ [[package]] name = "uu_yes" -version = "0.0.2" +version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", @@ -2498,7 +2506,7 @@ dependencies = [ "checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum filetime 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "0c122a393ea57648015bf06fbd3d372378992e86b9ff5a7a497b076a28c79efe" +"checksum filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" "checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" "checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" @@ -2560,7 +2568,8 @@ dependencies = [ "checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" "checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum redox_syscall 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" +"checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" "checksum regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" "checksum regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)" = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" @@ -2573,9 +2582,9 @@ dependencies = [ "checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)" = "9bdd36f49e35b61d49efd8aa7fc068fd295961fd2286d0b2ee9a4c7a14e99cc3" +"checksum serde 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)" = "166b2349061381baf54a58e4b13c89369feb0ef2eaa57198899e2312aac30aab" "checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.119 (registry+https://github.com/rust-lang/crates.io-index)" = "552954ce79a059ddd5fd68c271592374bd15cab2274970380c000118aeffe1cd" +"checksum serde_derive 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)" = "0ca2a8cb5805ce9e3b95435e3765b7b553cecc762d938d409434338386cb5775" "checksum serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)" = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" diff --git a/Cargo.toml b/Cargo.toml index 1c28700f7..1710752a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "coreutils" -version = "0.0.2" # "0.0.2.1" +version = "0.0.3" # "0.0.3.1" authors = ["uutils developers"] license = "MIT" description = "coreutils ~ GNU coreutils (updated); implemented as universal (cross-platform) utils, written in Rust" @@ -228,102 +228,102 @@ lazy_static = { version="1.3" } textwrap = { version="=0.11.0", features=["term_size"] } # !maint: [2020-05-10; rivy] unstable crate using undocumented features; pinned currently, will review uucore = { version=">=0.0.5", package="uucore", path="src/uucore" } # * uutils -uu_test = { optional=true, version="0.0.2", package="uu_test", path="src/uu/test" } +uu_test = { optional=true, version="0.0.3", package="uu_test", path="src/uu/test" } # -arch = { optional=true, version="0.0.2", package="uu_arch", path="src/uu/arch" } -base32 = { optional=true, version="0.0.2", package="uu_base32", path="src/uu/base32" } -base64 = { optional=true, version="0.0.2", package="uu_base64", path="src/uu/base64" } -basename = { optional=true, version="0.0.2", package="uu_basename", path="src/uu/basename" } -cat = { optional=true, version="0.0.2", package="uu_cat", path="src/uu/cat" } -chgrp = { optional=true, version="0.0.2", package="uu_chgrp", path="src/uu/chgrp" } -chmod = { optional=true, version="0.0.2", package="uu_chmod", path="src/uu/chmod" } -chown = { optional=true, version="0.0.2", package="uu_chown", path="src/uu/chown" } -chroot = { optional=true, version="0.0.2", package="uu_chroot", path="src/uu/chroot" } -cksum = { optional=true, version="0.0.2", package="uu_cksum", path="src/uu/cksum" } -comm = { optional=true, version="0.0.2", package="uu_comm", path="src/uu/comm" } -cp = { optional=true, version="0.0.2", package="uu_cp", path="src/uu/cp" } -csplit = { optional=true, version="0.0.2", package="uu_csplit", path="src/uu/csplit" } -cut = { optional=true, version="0.0.2", package="uu_cut", path="src/uu/cut" } -date = { optional=true, version="0.0.2", package="uu_date", path="src/uu/date" } -df = { optional=true, version="0.0.2", package="uu_df", path="src/uu/df" } -dircolors= { optional=true, version="0.0.2", package="uu_dircolors", path="src/uu/dircolors" } -dirname = { optional=true, version="0.0.2", package="uu_dirname", path="src/uu/dirname" } -du = { optional=true, version="0.0.2", package="uu_du", path="src/uu/du" } -echo = { optional=true, version="0.0.2", package="uu_echo", path="src/uu/echo" } -env = { optional=true, version="0.0.2", package="uu_env", path="src/uu/env" } -expand = { optional=true, version="0.0.2", package="uu_expand", path="src/uu/expand" } -expr = { optional=true, version="0.0.2", package="uu_expr", path="src/uu/expr" } -factor = { optional=true, version="0.0.2", package="uu_factor", path="src/uu/factor" } -false = { optional=true, version="0.0.2", package="uu_false", path="src/uu/false" } -fmt = { optional=true, version="0.0.2", package="uu_fmt", path="src/uu/fmt" } -fold = { optional=true, version="0.0.2", package="uu_fold", path="src/uu/fold" } -groups = { optional=true, version="0.0.2", package="uu_groups", path="src/uu/groups" } -hashsum = { optional=true, version="0.0.2", package="uu_hashsum", path="src/uu/hashsum" } -head = { optional=true, version="0.0.2", package="uu_head", path="src/uu/head" } -hostid = { optional=true, version="0.0.2", package="uu_hostid", path="src/uu/hostid" } -hostname = { optional=true, version="0.0.2", package="uu_hostname", path="src/uu/hostname" } -id = { optional=true, version="0.0.2", package="uu_id", path="src/uu/id" } -install = { optional=true, version="0.0.2", package="uu_install", path="src/uu/install" } -join = { optional=true, version="0.0.2", package="uu_join", path="src/uu/join" } -kill = { optional=true, version="0.0.2", package="uu_kill", path="src/uu/kill" } -link = { optional=true, version="0.0.2", package="uu_link", path="src/uu/link" } -ln = { optional=true, version="0.0.2", package="uu_ln", path="src/uu/ln" } -ls = { optional=true, version="0.0.2", package="uu_ls", path="src/uu/ls" } -logname = { optional=true, version="0.0.2", package="uu_logname", path="src/uu/logname" } -mkdir = { optional=true, version="0.0.2", package="uu_mkdir", path="src/uu/mkdir" } -mkfifo = { optional=true, version="0.0.2", package="uu_mkfifo", path="src/uu/mkfifo" } -mknod = { optional=true, version="0.0.2", package="uu_mknod", path="src/uu/mknod" } -mktemp = { optional=true, version="0.0.2", package="uu_mktemp", path="src/uu/mktemp" } -more = { optional=true, version="0.0.2", package="uu_more", path="src/uu/more" } -mv = { optional=true, version="0.0.2", package="uu_mv", path="src/uu/mv" } -nice = { optional=true, version="0.0.2", package="uu_nice", path="src/uu/nice" } -nl = { optional=true, version="0.0.2", package="uu_nl", path="src/uu/nl" } -nohup = { optional=true, version="0.0.2", package="uu_nohup", path="src/uu/nohup" } -nproc = { optional=true, version="0.0.2", package="uu_nproc", path="src/uu/nproc" } -numfmt = { optional=true, version="0.0.2", package="uu_numfmt", path="src/uu/numfmt" } -od = { optional=true, version="0.0.2", package="uu_od", path="src/uu/od" } -paste = { optional=true, version="0.0.2", package="uu_paste", path="src/uu/paste" } -pathchk = { optional=true, version="0.0.2", package="uu_pathchk", path="src/uu/pathchk" } -pinky = { optional=true, version="0.0.2", package="uu_pinky", path="src/uu/pinky" } -printenv = { optional=true, version="0.0.2", package="uu_printenv", path="src/uu/printenv" } -printf = { optional=true, version="0.0.2", package="uu_printf", path="src/uu/printf" } -ptx = { optional=true, version="0.0.2", package="uu_ptx", path="src/uu/ptx" } -pwd = { optional=true, version="0.0.2", package="uu_pwd", path="src/uu/pwd" } -readlink = { optional=true, version="0.0.2", package="uu_readlink", path="src/uu/readlink" } -realpath = { optional=true, version="0.0.2", package="uu_realpath", path="src/uu/realpath" } -relpath = { optional=true, version="0.0.2", package="uu_relpath", path="src/uu/relpath" } -rm = { optional=true, version="0.0.2", package="uu_rm", path="src/uu/rm" } -rmdir = { optional=true, version="0.0.2", package="uu_rmdir", path="src/uu/rmdir" } -seq = { optional=true, version="0.0.2", package="uu_seq", path="src/uu/seq" } -shred = { optional=true, version="0.0.2", package="uu_shred", path="src/uu/shred" } -shuf = { optional=true, version="0.0.2", package="uu_shuf", path="src/uu/shuf" } -sleep = { optional=true, version="0.0.2", package="uu_sleep", path="src/uu/sleep" } -sort = { optional=true, version="0.0.2", package="uu_sort", path="src/uu/sort" } -split = { optional=true, version="0.0.2", package="uu_split", path="src/uu/split" } -stat = { optional=true, version="0.0.2", package="uu_stat", path="src/uu/stat" } -stdbuf = { optional=true, version="0.0.2", package="uu_stdbuf", path="src/uu/stdbuf" } -sum = { optional=true, version="0.0.2", package="uu_sum", path="src/uu/sum" } -sync = { optional=true, version="0.0.2", package="uu_sync", path="src/uu/sync" } -tac = { optional=true, version="0.0.2", package="uu_tac", path="src/uu/tac" } -tail = { optional=true, version="0.0.2", package="uu_tail", path="src/uu/tail" } -tee = { optional=true, version="0.0.2", package="uu_tee", path="src/uu/tee" } -timeout = { optional=true, version="0.0.2", package="uu_timeout", path="src/uu/timeout" } -touch = { optional=true, version="0.0.2", package="uu_touch", path="src/uu/touch" } -tr = { optional=true, version="0.0.2", package="uu_tr", path="src/uu/tr" } -true = { optional=true, version="0.0.2", package="uu_true", path="src/uu/true" } -truncate = { optional=true, version="0.0.2", package="uu_truncate", path="src/uu/truncate" } -tsort = { optional=true, version="0.0.2", package="uu_tsort", path="src/uu/tsort" } -tty = { optional=true, version="0.0.2", package="uu_tty", path="src/uu/tty" } -uname = { optional=true, version="0.0.2", package="uu_uname", path="src/uu/uname" } -unexpand = { optional=true, version="0.0.2", package="uu_unexpand", path="src/uu/unexpand" } -uniq = { optional=true, version="0.0.2", package="uu_uniq", path="src/uu/uniq" } -unlink = { optional=true, version="0.0.2", package="uu_unlink", path="src/uu/unlink" } -uptime = { optional=true, version="0.0.2", package="uu_uptime", path="src/uu/uptime" } -users = { optional=true, version="0.0.2", package="uu_users", path="src/uu/users" } -wc = { optional=true, version="0.0.2", package="uu_wc", path="src/uu/wc" } -who = { optional=true, version="0.0.2", package="uu_who", path="src/uu/who" } -whoami = { optional=true, version="0.0.2", package="uu_whoami", path="src/uu/whoami" } -yes = { optional=true, version="0.0.2", package="uu_yes", path="src/uu/yes" } +arch = { optional=true, version="0.0.3", package="uu_arch", path="src/uu/arch" } +base32 = { optional=true, version="0.0.3", package="uu_base32", path="src/uu/base32" } +base64 = { optional=true, version="0.0.3", package="uu_base64", path="src/uu/base64" } +basename = { optional=true, version="0.0.3", package="uu_basename", path="src/uu/basename" } +cat = { optional=true, version="0.0.3", package="uu_cat", path="src/uu/cat" } +chgrp = { optional=true, version="0.0.3", package="uu_chgrp", path="src/uu/chgrp" } +chmod = { optional=true, version="0.0.3", package="uu_chmod", path="src/uu/chmod" } +chown = { optional=true, version="0.0.3", package="uu_chown", path="src/uu/chown" } +chroot = { optional=true, version="0.0.3", package="uu_chroot", path="src/uu/chroot" } +cksum = { optional=true, version="0.0.3", package="uu_cksum", path="src/uu/cksum" } +comm = { optional=true, version="0.0.3", package="uu_comm", path="src/uu/comm" } +cp = { optional=true, version="0.0.3", package="uu_cp", path="src/uu/cp" } +csplit = { optional=true, version="0.0.3", package="uu_csplit", path="src/uu/csplit" } +cut = { optional=true, version="0.0.3", package="uu_cut", path="src/uu/cut" } +date = { optional=true, version="0.0.3", package="uu_date", path="src/uu/date" } +df = { optional=true, version="0.0.3", package="uu_df", path="src/uu/df" } +dircolors= { optional=true, version="0.0.3", package="uu_dircolors", path="src/uu/dircolors" } +dirname = { optional=true, version="0.0.3", package="uu_dirname", path="src/uu/dirname" } +du = { optional=true, version="0.0.3", package="uu_du", path="src/uu/du" } +echo = { optional=true, version="0.0.3", package="uu_echo", path="src/uu/echo" } +env = { optional=true, version="0.0.3", package="uu_env", path="src/uu/env" } +expand = { optional=true, version="0.0.3", package="uu_expand", path="src/uu/expand" } +expr = { optional=true, version="0.0.3", package="uu_expr", path="src/uu/expr" } +factor = { optional=true, version="0.0.3", package="uu_factor", path="src/uu/factor" } +false = { optional=true, version="0.0.3", package="uu_false", path="src/uu/false" } +fmt = { optional=true, version="0.0.3", package="uu_fmt", path="src/uu/fmt" } +fold = { optional=true, version="0.0.3", package="uu_fold", path="src/uu/fold" } +groups = { optional=true, version="0.0.3", package="uu_groups", path="src/uu/groups" } +hashsum = { optional=true, version="0.0.3", package="uu_hashsum", path="src/uu/hashsum" } +head = { optional=true, version="0.0.3", package="uu_head", path="src/uu/head" } +hostid = { optional=true, version="0.0.3", package="uu_hostid", path="src/uu/hostid" } +hostname = { optional=true, version="0.0.3", package="uu_hostname", path="src/uu/hostname" } +id = { optional=true, version="0.0.3", package="uu_id", path="src/uu/id" } +install = { optional=true, version="0.0.3", package="uu_install", path="src/uu/install" } +join = { optional=true, version="0.0.3", package="uu_join", path="src/uu/join" } +kill = { optional=true, version="0.0.3", package="uu_kill", path="src/uu/kill" } +link = { optional=true, version="0.0.3", package="uu_link", path="src/uu/link" } +ln = { optional=true, version="0.0.3", package="uu_ln", path="src/uu/ln" } +ls = { optional=true, version="0.0.3", package="uu_ls", path="src/uu/ls" } +logname = { optional=true, version="0.0.3", package="uu_logname", path="src/uu/logname" } +mkdir = { optional=true, version="0.0.3", package="uu_mkdir", path="src/uu/mkdir" } +mkfifo = { optional=true, version="0.0.3", package="uu_mkfifo", path="src/uu/mkfifo" } +mknod = { optional=true, version="0.0.3", package="uu_mknod", path="src/uu/mknod" } +mktemp = { optional=true, version="0.0.3", package="uu_mktemp", path="src/uu/mktemp" } +more = { optional=true, version="0.0.3", package="uu_more", path="src/uu/more" } +mv = { optional=true, version="0.0.3", package="uu_mv", path="src/uu/mv" } +nice = { optional=true, version="0.0.3", package="uu_nice", path="src/uu/nice" } +nl = { optional=true, version="0.0.3", package="uu_nl", path="src/uu/nl" } +nohup = { optional=true, version="0.0.3", package="uu_nohup", path="src/uu/nohup" } +nproc = { optional=true, version="0.0.3", package="uu_nproc", path="src/uu/nproc" } +numfmt = { optional=true, version="0.0.3", package="uu_numfmt", path="src/uu/numfmt" } +od = { optional=true, version="0.0.3", package="uu_od", path="src/uu/od" } +paste = { optional=true, version="0.0.3", package="uu_paste", path="src/uu/paste" } +pathchk = { optional=true, version="0.0.3", package="uu_pathchk", path="src/uu/pathchk" } +pinky = { optional=true, version="0.0.3", package="uu_pinky", path="src/uu/pinky" } +printenv = { optional=true, version="0.0.3", package="uu_printenv", path="src/uu/printenv" } +printf = { optional=true, version="0.0.3", package="uu_printf", path="src/uu/printf" } +ptx = { optional=true, version="0.0.3", package="uu_ptx", path="src/uu/ptx" } +pwd = { optional=true, version="0.0.3", package="uu_pwd", path="src/uu/pwd" } +readlink = { optional=true, version="0.0.3", package="uu_readlink", path="src/uu/readlink" } +realpath = { optional=true, version="0.0.3", package="uu_realpath", path="src/uu/realpath" } +relpath = { optional=true, version="0.0.3", package="uu_relpath", path="src/uu/relpath" } +rm = { optional=true, version="0.0.3", package="uu_rm", path="src/uu/rm" } +rmdir = { optional=true, version="0.0.3", package="uu_rmdir", path="src/uu/rmdir" } +seq = { optional=true, version="0.0.3", package="uu_seq", path="src/uu/seq" } +shred = { optional=true, version="0.0.3", package="uu_shred", path="src/uu/shred" } +shuf = { optional=true, version="0.0.3", package="uu_shuf", path="src/uu/shuf" } +sleep = { optional=true, version="0.0.3", package="uu_sleep", path="src/uu/sleep" } +sort = { optional=true, version="0.0.3", package="uu_sort", path="src/uu/sort" } +split = { optional=true, version="0.0.3", package="uu_split", path="src/uu/split" } +stat = { optional=true, version="0.0.3", package="uu_stat", path="src/uu/stat" } +stdbuf = { optional=true, version="0.0.3", package="uu_stdbuf", path="src/uu/stdbuf" } +sum = { optional=true, version="0.0.3", package="uu_sum", path="src/uu/sum" } +sync = { optional=true, version="0.0.3", package="uu_sync", path="src/uu/sync" } +tac = { optional=true, version="0.0.3", package="uu_tac", path="src/uu/tac" } +tail = { optional=true, version="0.0.3", package="uu_tail", path="src/uu/tail" } +tee = { optional=true, version="0.0.3", package="uu_tee", path="src/uu/tee" } +timeout = { optional=true, version="0.0.3", package="uu_timeout", path="src/uu/timeout" } +touch = { optional=true, version="0.0.3", package="uu_touch", path="src/uu/touch" } +tr = { optional=true, version="0.0.3", package="uu_tr", path="src/uu/tr" } +true = { optional=true, version="0.0.3", package="uu_true", path="src/uu/true" } +truncate = { optional=true, version="0.0.3", package="uu_truncate", path="src/uu/truncate" } +tsort = { optional=true, version="0.0.3", package="uu_tsort", path="src/uu/tsort" } +tty = { optional=true, version="0.0.3", package="uu_tty", path="src/uu/tty" } +uname = { optional=true, version="0.0.3", package="uu_uname", path="src/uu/uname" } +unexpand = { optional=true, version="0.0.3", package="uu_unexpand", path="src/uu/unexpand" } +uniq = { optional=true, version="0.0.3", package="uu_uniq", path="src/uu/uniq" } +unlink = { optional=true, version="0.0.3", package="uu_unlink", path="src/uu/unlink" } +uptime = { optional=true, version="0.0.3", package="uu_uptime", path="src/uu/uptime" } +users = { optional=true, version="0.0.3", package="uu_users", path="src/uu/users" } +wc = { optional=true, version="0.0.3", package="uu_wc", path="src/uu/wc" } +who = { optional=true, version="0.0.3", package="uu_who", path="src/uu/who" } +whoami = { optional=true, version="0.0.3", package="uu_whoami", path="src/uu/whoami" } +yes = { optional=true, version="0.0.3", package="uu_yes", path="src/uu/yes" } # # * pinned transitive dependencies pin_cc = { version="1.0.61, < 1.0.62", package="cc" } ## cc v1.0.62 has compiler errors for MinRustV v1.32.0, requires 1.34 (for `std::str::split_ascii_whitespace()`) diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index 7ec7ff78c..67d5ad4a8 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_arch" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "arch ~ (uutils) display machine architecture" diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index 0886364ab..a53c576cc 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base32" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "base32 ~ (uutils) decode/encode input (base32-encoding)" diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index f08c36a9d..553a8f66b 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base64" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "base64 ~ (uutils) decode/encode input (base64-encoding)" diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index c89b7e056..19f7eb0f4 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_basename" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "basename ~ (uutils) display PATHNAME with leading directory components removed" diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index e6bcd32fb..0df50aceb 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cat" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "cat ~ (uutils) concatenate and display input" diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index 39260a18c..5040d361c 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chgrp" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "chgrp ~ (uutils) change the group ownership of FILE" diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index 9a417117e..7f94cd4c8 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chmod" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "chmod ~ (uutils) change mode of FILE" diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index 569699790..15622548a 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chown" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "chown ~ (uutils) change the ownership of FILE" diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index 27db348d3..62f3da813 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chroot" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "chroot ~ (uutils) run COMMAND under a new root directory" diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index 91259c74f..41f407468 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cksum" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "cksum ~ (uutils) display CRC and size of input" diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index eadfdc832..cc1855189 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_comm" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "comm ~ (uutils) compare sorted inputs" diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index 64369c3c7..28af78a06 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cp" -version = "0.0.2" +version = "0.0.3" authors = [ "Jordy Dickinson ", "Joshua S. Miller ", diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index d03bcb0a6..fdd70de9f 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_csplit" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "csplit ~ (uutils) Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output" diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index 64f49efa5..548c5f5b2 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cut" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "cut ~ (uutils) display byte/field columns of input lines" diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index f6966038a..b51363b27 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_date" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "date ~ (uutils) display or set the current time" diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index d4851335a..b4f7ea865 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_df" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "df ~ (uutils) display file system information" diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index 1698328b3..e9f6c6be0 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dircolors" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "dircolors ~ (uutils) display commands to set LS_COLORS" diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index ece0189d5..f261f8198 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dirname" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "dirname ~ (uutils) display parent directory of PATHNAME" diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index dfb64b5e3..4246fb120 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_du" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "du ~ (uutils) display disk usage" diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index 36e8ea8e6..8efa44351 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_echo" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "echo ~ (uutils) display TEXT" diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index 159cf91aa..56059abf8 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_env" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "env ~ (uutils) set each NAME to VALUE in the environment and run COMMAND" diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index b854b1bb3..102c95fb9 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expand" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "expand ~ (uutils) convert input tabs to spaces" diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index bdba32dc3..3a0c7716d 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expr" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "expr ~ (uutils) display the value of EXPRESSION" diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index 2ecdc5a6a..8ae61e73c 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_factor" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "factor ~ (uutils) display the prime factors of each NUMBER" diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index 9c3ec6882..b15640e46 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_false" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "false ~ (uutils) do nothing and fail" diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index 6ab94a81e..fb6cba5d4 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fmt" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "fmt ~ (uutils) reformat each paragraph of input" diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index 57d8c569d..ec255958d 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fold" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "fold ~ (uutils) wrap each line of input" diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index 4a39f3276..1b25becbc 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_groups" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "groups ~ (uutils) display group memberships for USERNAME" diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index 92a34c518..d072e3687 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hashsum" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "hashsum ~ (uutils) display or check input digests" diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index 096a1c54b..8c8aa98ca 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_head" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "head ~ (uutils) display the first lines of input" diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index 2a58bad83..981a1929e 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostid" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "hostid ~ (uutils) display the numeric identifier of the current host" diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index eadf102b0..64f84828c 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostname" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "hostname ~ (uutils) display or set the host name of the current host" diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index 43e51e464..97e4a05e7 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_id" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "id ~ (uutils) display user and group information for USER" diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index eee0e1c65..537f954bd 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_install" -version = "0.0.2" +version = "0.0.3" authors = [ "Ben Eills ", "uutils developers", diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index 493f68b84..ea6df04ab 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_join" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "join ~ (uutils) merge lines from inputs with matching join fields" diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index 56609e163..07c81588a 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_kill" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "kill ~ (uutils) send a signal to a process" diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index a1b35566b..733b3b8f3 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_link" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "link ~ (uutils) create a hard (file system) link to FILE" diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index 3c700bb43..528145963 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ln" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "ln ~ (uutils) create a (file system) link to TARGET" diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index 75b95ebc6..ca44085e7 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_logname" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "logname ~ (uutils) display the login name of the current user" diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index db4d12bb0..3fe3f62d7 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ls" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "ls ~ (uutils) display directory contents" diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index 7fa1517fa..e31211a69 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkdir" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "mkdir ~ (uutils) create DIRECTORY" diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index 8c079748b..776d4abeb 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkfifo" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "mkfifo ~ (uutils) create FIFOs (named pipes)" diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index eba24bf7d..95aee7999 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mknod" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "mknod ~ (uutils) create special file NAME of TYPE" diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index 4fddb181a..0e1b00e6d 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mktemp" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "mktemp ~ (uutils) create and display a temporary file or directory from TEMPLATE" diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index c2466df53..e3a109211 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_more" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "more ~ (uutils) input perusal filter" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index 775f486f2..485d494a7 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mv" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "mv ~ (uutils) move (rename) SOURCE to DESTINATION" diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index 22ed128b0..dd775fac9 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nice" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "nice ~ (uutils) run PROGRAM with modified scheduling priority" diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index dc21dfcc2..372bd44f5 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nl" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "nl ~ (uutils) display input with added line numbers" diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index 8a7808757..995e9103a 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nohup" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "nohup ~ (uutils) run COMMAND, ignoring hangup signals" diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index dafe0af9b..bfc14b59d 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nproc" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "nproc ~ (uutils) display the number of processing units available" diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index 7ef4125a3..491953cc0 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_numfmt" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "numfmt ~ (uutils) reformat NUMBER" diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index f538d11f7..a4dacf8e6 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_od" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "od ~ (uutils) display formatted representation of input" diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index b06a919e1..7e7d32f65 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_paste" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "paste ~ (uutils) merge lines from inputs" diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index 6ad0a7e81..f9deaf7e1 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pathchk" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "pathchk ~ (uutils) diagnose invalid or non-portable PATHNAME" diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index 3d48c0bf1..5bf7c2a22 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pinky" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "pinky ~ (uutils) display user information" diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index 630416979..8bb0354a9 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printenv" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "printenv ~ (uutils) display value of environment VAR" diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index 635c7e9e5..8f8a1c196 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printf" -version = "0.0.2" +version = "0.0.3" authors = [ "Nathan Ross", "uutils developers", diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index 1338d752d..bb3ded05b 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ptx" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "ptx ~ (uutils) display a permuted index of input" diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index b97af4d3c..511f9efc1 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pwd" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "pwd ~ (uutils) display current working directory" diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index 3f568e8e0..0646420bc 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_readlink" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "readlink ~ (uutils) display resolved path of PATHNAME" diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index c72b302aa..2b70b8d97 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_realpath" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "realpath ~ (uutils) display resolved absolute path of PATHNAME" diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index 07dd7be56..9622d973e 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_relpath" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "relpath ~ (uutils) display relative path of PATHNAME_TO from PATHNAME_FROM" diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index 534d34e04..ccce16209 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rm" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "rm ~ (uutils) remove PATHNAME" diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index 265591f1d..742aa7868 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rmdir" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "rmdir ~ (uutils) remove empty DIRECTORY" diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index 9d75fd444..32096e1db 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_seq" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "seq ~ (uutils) display a sequence of numbers" diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index cfe426eb4..a90034a6c 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shred" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "shred ~ (uutils) hide former FILE contents with repeated overwrites" diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index 7ae131d8a..6b6460280 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shuf" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "shuf ~ (uutils) display random permutations of input lines" diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index d5d91c0bb..1e42b069c 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sleep" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "sleep ~ (uutils) pause for DURATION" diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index fd08d2afd..b28a3579d 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sort" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "sort ~ (uutils) sort input lines" diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index d81494d43..ccb7c6fd3 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_split" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "split ~ (uutils) split input into output files" diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index dd1043448..3f5a47fdf 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stat" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "stat ~ (uutils) display FILE status" diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index 3c17715fb..137146913 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "stdbuf ~ (uutils) run COMMAND with modified standard stream buffering" @@ -21,7 +21,7 @@ uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [build-dependencies] -libstdbuf = { version="0.0.2", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } +libstdbuf = { version="0.0.3", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } [[bin]] name = "stdbuf" diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index e3465dc9b..1261fbc25 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf_libstdbuf" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "stdbuf/libstdbuf ~ (uutils); dynamic library required for stdbuf" diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index 72ca4e98e..2526bae3d 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sum" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "sum ~ (uutils) display checksum and block counts for input" diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index 42c5eee00..e1176dea1 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sync" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "sync ~ (uutils) synchronize cache writes to storage" diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index 5cd3424fd..17b2e0ec4 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tac" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "tac ~ (uutils) concatenate and display input lines in reverse order" diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index 74afa4ae8..225bf460c 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tail" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "tail ~ (uutils) display the last lines of input" diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index 14f221840..301ef145e 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tee" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "tee ~ (uutils) display input and copy to FILE" diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index a3c204488..ac7e33845 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_test" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "test ~ (uutils) evaluate comparison and file type expressions" diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index 006f80631..666a748a3 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_timeout" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "timeout ~ (uutils) run COMMAND with a DURATION time limit" diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index e5f693207..5f4b29084 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_touch" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "touch ~ (uutils) change FILE timestamps" diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index a1d375457..4b0d01877 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tr" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "tr ~ (uutils) translate characters within input and display" diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index 1da4a8420..01970015f 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_true" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "true ~ (uutils) do nothing and succeed" diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index 9f51be240..f953eb376 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_truncate" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "truncate ~ (uutils) truncate (or extend) FILE to SIZE" diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index 2e9ddaa96..64a383ab8 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tsort" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "tsort ~ (uutils) topologically sort input (partially ordered) pairs" diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index 25f14e273..5f552b283 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tty" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "tty ~ (uutils) display the name of the terminal connected to standard input" diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index e0a69b996..bb0b6510e 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uname" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "uname ~ (uutils) display system information" diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index 3033702b7..07cd5dd5a 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unexpand" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "unexpand ~ (uutils) convert input spaces to tabs" diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index fb5dc0368..2bde2fd75 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uniq" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "uniq ~ (uutils) filter identical adjacent lines from input" diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index a937d0df0..7fd2e1fbc 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unlink" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "unlink ~ (uutils) remove a (file system) link to FILE" diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index b93b2ad7b..e96ec56c0 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uptime" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "uptime ~ (uutils) display dynamic system information" diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index 2c1fbf5c3..3cf587678 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_users" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "users ~ (uutils) display names of currently logged-in users" diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index 4a6d27bea..b612c6b71 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_wc" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "wc ~ (uutils) display newline, word, and byte counts for input" diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index 20438d5f1..da3aa3bac 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_who" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "who ~ (uutils) display information about currently logged-in users" diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index f4d992871..2401deeab 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_whoami" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "whoami ~ (uutils) display user name of current effective user ID" diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index 5d20280d3..a48d4f7b8 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_yes" -version = "0.0.2" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "yes ~ (uutils) repeatedly display a line with STRING (or 'y')" From 18370f39b80ad76bd9951fe49a984133eeb7fefc Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 21 Jan 2021 21:14:50 +0100 Subject: [PATCH 294/606] Remove some warnings --- tests/by-util/test_chmod.rs | 2 +- tests/by-util/test_realpath.rs | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index e1fff99cf..e7bc72677 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -352,7 +352,7 @@ fn test_chmod_symlink_non_existing_file() { let (at, mut ucmd) = at_and_ucmd!(); at.symlink_file("/non-existing", "test-long.link"); - let result = ucmd + let _result = ucmd .arg("-R") .arg("755") .arg("-v") diff --git a/tests/by-util/test_realpath.rs b/tests/by-util/test_realpath.rs index fe06e5afb..b4c78cbaa 100644 --- a/tests/by-util/test_realpath.rs +++ b/tests/by-util/test_realpath.rs @@ -37,7 +37,6 @@ fn test_long_redirection_to_root() { fn test_file_and_links() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; - let result = scene.ucmd().run(); at.touch("foo"); at.symlink_file("foo", "bar"); @@ -55,7 +54,6 @@ fn test_file_and_links() { fn test_file_and_links_zero() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; - let result = scene.ucmd().run(); at.touch("foo"); at.symlink_file("foo", "bar"); @@ -75,7 +73,6 @@ fn test_file_and_links_zero() { fn test_file_and_links_strip() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; - let result = scene.ucmd().run(); at.touch("foo"); at.symlink_file("foo", "bar"); From 992c113f09665aa64f62616cd9aedbeeecc788e5 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 21 Jan 2021 21:19:04 +0100 Subject: [PATCH 295/606] Remove some old code --- src/uu/cut/src/buffer.rs | 2 +- tests/by-util/test_realpath.rs | 1 - tests/common/util.rs | 34 ---------------------------------- 3 files changed, 1 insertion(+), 36 deletions(-) diff --git a/src/uu/cut/src/buffer.rs b/src/uu/cut/src/buffer.rs index 7ee26612e..6c3238be1 100644 --- a/src/uu/cut/src/buffer.rs +++ b/src/uu/cut/src/buffer.rs @@ -107,7 +107,7 @@ impl self::Bytes::Select for ByteReader { Comp, Part, Newl, - }; + } use self::Bytes::Selected::*; diff --git a/tests/by-util/test_realpath.rs b/tests/by-util/test_realpath.rs index b4c78cbaa..750a8db01 100644 --- a/tests/by-util/test_realpath.rs +++ b/tests/by-util/test_realpath.rs @@ -90,7 +90,6 @@ fn test_file_and_links_strip() { fn test_file_and_links_strip_zero() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; - let result = scene.ucmd().run(); at.touch("foo"); at.symlink_file("foo", "bar"); diff --git a/tests/common/util.rs b/tests/common/util.rs index 3891c7692..117bce0e6 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -137,12 +137,6 @@ impl CmdResult { Box::new(self) } - /// like stderr_is(...), but expects the contents of the file at the provided relative path - pub fn stderr_is_fixture>(&self, file_rel_path: T) -> Box<&CmdResult> { - let contents = read_scenario_fixture(&self.tmpd, file_rel_path); - self.stderr_is(contents) - } - /// asserts that /// 1. the command resulted in stdout stream output that equals the /// passed in value, when both are trimmed of trailing whitespace @@ -165,12 +159,6 @@ impl CmdResult { self.no_stdout().stderr_is(msg) } - /// like stderr_only(...), but expects the contents of the file at the provided relative path - pub fn stderr_only_fixture>(&self, file_rel_path: T) -> Box<&CmdResult> { - let contents = read_scenario_fixture(&self.tmpd, file_rel_path); - self.stderr_only(contents) - } - pub fn fails_silently(&self) -> Box<&CmdResult> { assert!(!self.success); assert_eq!(self.stderr, ""); @@ -360,22 +348,6 @@ impl AtPath { } } - pub fn cleanup(&self, path: &'static str) { - let p = &self.plus(path); - if let Ok(m) = fs::metadata(p) { - if m.is_file() { - fs::remove_file(&p).unwrap(); - } else { - fs::remove_dir(&p).unwrap(); - } - } - } - - pub fn root_dir(&self) -> String { - log_info("current_directory", ""); - self.subdir.to_str().unwrap().to_owned() - } - pub fn root_dir_resolved(&self) -> String { log_info("current_directory_resolved", ""); let s = self @@ -525,12 +497,6 @@ impl UCommand { Box::new(self) } - /// like arg(...), but uses the contents of the file at the provided relative path as the argument - pub fn arg_fixture>(&mut self, file_rel_path: S) -> Box<&mut UCommand> { - let contents = read_scenario_fixture(&self.tmpd, file_rel_path); - self.arg(contents) - } - pub fn args>(&mut self, args: &[S]) -> Box<&mut UCommand> { if self.has_run { panic!(MULTIPLE_STDIN_MEANINGLESS); From cacaf0cde8a56e7044f1a2c3cbbb6333d0c1875d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 24 Jan 2021 22:41:05 +0100 Subject: [PATCH 296/606] bug(fmt): just like the GNU version, fails when -W is bigger than 2500 Closes: #1704 --- src/uu/fmt/src/fmt.rs | 8 ++++++++ tests/by-util/test_fmt.rs | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/uu/fmt/src/fmt.rs b/src/uu/fmt/src/fmt.rs index 960b20185..6f104c458 100644 --- a/src/uu/fmt/src/fmt.rs +++ b/src/uu/fmt/src/fmt.rs @@ -34,6 +34,7 @@ mod parasplit; static SYNTAX: &str = "[OPTION]... [FILE]..."; static SUMMARY: &str = "Reformat paragraphs from input files (or stdin) to stdout."; static LONG_HELP: &str = ""; +static MAX_WIDTH: usize = 2500; pub type FileOrStdReader = BufReader>; pub struct FmtOptions { @@ -137,6 +138,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { crash!(1, "Invalid WIDTH specification: `{}': {}", s, e); } }; + if fmt_opts.width > MAX_WIDTH { + crash!( + 1, + "invalid width: '{}': Numerical result out of range", + fmt_opts.width + ); + } fmt_opts.goal = cmp::min(fmt_opts.width * 94 / 100, fmt_opts.width - 3); }; diff --git a/tests/by-util/test_fmt.rs b/tests/by-util/test_fmt.rs index e7990a760..4533cdf24 100644 --- a/tests/by-util/test_fmt.rs +++ b/tests/by-util/test_fmt.rs @@ -20,6 +20,19 @@ fn test_fmt_q() { ); } +#[test] +fn test_fmt_w_too_big() { + let result = new_ucmd!() + .arg("-w") + .arg("2501") + .arg("one-word-per-line.txt") + .run(); + //.stdout_is_fixture("call_graph.expected"); + assert_eq!( + result.stderr.trim(), + "fmt: error: invalid width: '2501': Numerical result out of range" + ); +} /* #[test] Fails for now, see https://github.com/uutils/coreutils/issues/1501 fn test_fmt_w() { From f0b302d71625188df45b58b405baff1179bf314f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 25 Jan 2021 10:55:13 +0100 Subject: [PATCH 297/606] refactor(fmt) move to clap --- Cargo.lock | 1 + src/uu/fmt/Cargo.toml | 1 + src/uu/fmt/src/fmt.rs | 213 ++++++++++++++++++++++++++++++++---------- 3 files changed, 168 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 29b59fa2a..ebd5aab5e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1576,6 +1576,7 @@ dependencies = [ name = "uu_fmt" version = "0.0.3" dependencies = [ + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.5", diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index fb6cba5d4..1b86c80ec 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/fmt.rs" [dependencies] +clap = "2.33" libc = "0.2.42" unicode-width = "0.1.5" uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } diff --git a/src/uu/fmt/src/fmt.rs b/src/uu/fmt/src/fmt.rs index 6f104c458..f10f4cf7f 100644 --- a/src/uu/fmt/src/fmt.rs +++ b/src/uu/fmt/src/fmt.rs @@ -10,6 +10,7 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::cmp; use std::fs::File; use std::io::{stdin, stdout, Write}; @@ -30,12 +31,30 @@ macro_rules! silent_unwrap( mod linebreak; mod parasplit; -// program's NAME and VERSION are used for -V and -h -static SYNTAX: &str = "[OPTION]... [FILE]..."; -static SUMMARY: &str = "Reformat paragraphs from input files (or stdin) to stdout."; -static LONG_HELP: &str = ""; +static ABOUT: &str = "Reformat paragraphs from input files (or stdin) to stdout."; +static VERSION: &str = env!("CARGO_PKG_VERSION"); static MAX_WIDTH: usize = 2500; +static OPT_CROWN_MARGIN: &str = "crown-margin"; +static OPT_TAGGED_PARAGRAPH: &str = "tagged-paragraph"; +static OPT_PRESERVE_HEADERS: &str = "preserve-headers"; +static OPT_SPLIT_ONLY: &str = "split-only"; +static OPT_UNIFORM_SPACING: &str = "uniform-spacing"; +static OPT_PREFIX: &str = "prefix"; +static OPT_SKIP_PREFIX: &str = "skip-prefix"; +static OPT_EXACT_PREFIX: &str = "exact-prefix"; +static OPT_EXACT_SKIP_PREFIX: &str = "exact-skip-prefix"; +static OPT_WIDTH: &str = "width"; +static OPT_GOAL: &str = "goal"; +static OPT_QUICK: &str = "quick"; +static OPT_TAB_WIDTH: &str = "tab-width"; + +static ARG_FILES: &str = "files"; + +fn get_usage() -> String { + format!("{} [OPTION]... [FILE]...", executable!()) +} + pub type FileOrStdReader = BufReader>; pub struct FmtOptions { crown: bool, @@ -57,23 +76,136 @@ pub struct FmtOptions { #[allow(clippy::cognitive_complexity)] pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optflag("c", "crown-margin", "First and second line of paragraph may have different indentations, in which case the first line's indentation is preserved, and each subsequent line's indentation matches the second line.") - .optflag("t", "tagged-paragraph", "Like -c, except that the first and second line of a paragraph *must* have different indentation or they are treated as separate paragraphs.") - .optflag("m", "preserve-headers", "Attempt to detect and preserve mail headers in the input. Be careful when combining this flag with -p.") - .optflag("s", "split-only", "Split lines only, do not reflow.") - .optflag("u", "uniform-spacing", "Insert exactly one space between words, and two between sentences. Sentence breaks in the input are detected as [?!.] followed by two spaces or a newline; other punctuation is not interpreted as a sentence break.") - .optopt("p", "prefix", "Reformat only lines beginning with PREFIX, reattaching PREFIX to reformatted lines. Unless -x is specified, leading whitespace will be ignored when matching PREFIX.", "PREFIX") - .optopt("P", "skip-prefix", "Do not reformat lines beginning with PSKIP. Unless -X is specified, leading whitespace will be ignored when matching PSKIP", "PSKIP") - .optflag("x", "exact-prefix", "PREFIX must match at the beginning of the line with no preceding whitespace.") - .optflag("X", "exact-skip-prefix", "PSKIP must match at the beginning of the line with no preceding whitespace.") - .optopt("w", "width", "Fill output lines up to a maximum of WIDTH columns, default 79.", "WIDTH") - .optopt("g", "goal", "Goal width, default ~0.94*WIDTH. Must be less than WIDTH.", "GOAL") - .optflag("q", "quick", "Break lines more quickly at the expense of a potentially more ragged appearance.") - .optopt("T", "tab-width", "Treat tabs as TABWIDTH spaces for determining line length, default 8. Note that this is used only for calculating line lengths; tabs are preserved in the output.", "TABWIDTH") - .parse(args); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(OPT_CROWN_MARGIN) + .short("c") + .long(OPT_CROWN_MARGIN) + .help( + "First and second line of paragraph + may have different indentations, in which + case the first line's indentation is preserved, + and each subsequent line's indentation matches the second line.", + ), + ) + .arg( + Arg::with_name(OPT_TAGGED_PARAGRAPH) + .short("t") + .long("tagged-paragraph") + .help( + "Like -c, except that the first and second line of a paragraph *must* + have different indentation or they are treated as separate paragraphs.", + ), + ) + .arg( + Arg::with_name(OPT_PRESERVE_HEADERS) + .short("m") + .long("preserve-headers") + .help( + "Attempt to detect and preserve mail headers in the input. + Be careful when combining this flag with -p.", + ), + ) + .arg( + Arg::with_name(OPT_SPLIT_ONLY) + .short("s") + .long("split-only") + .help("Split lines only, do not reflow."), + ) + .arg( + Arg::with_name(OPT_UNIFORM_SPACING) + .short("u") + .long("uniform-spacing") + .help( + "Insert exactly one + space between words, and two between sentences. + Sentence breaks in the input are detected as [?!.] + followed by two spaces or a newline; other punctuation + is not interpreted as a sentence break.", + ), + ) + .arg( + Arg::with_name(OPT_PREFIX) + .short("p") + .long("prefix") + .help( + "Reformat only lines + beginning with PREFIX, reattaching PREFIX to reformatted lines. + Unless -x is specified, leading whitespace will be ignored + when matching PREFIX.", + ) + .value_name("PREFIX"), + ) + .arg( + Arg::with_name(OPT_SKIP_PREFIX) + .short("P") + .long("skip-prefix") + .help( + "Do not reformat lines + beginning with PSKIP. Unless -X is specified, leading whitespace + will be ignored when matching PSKIP", + ) + .value_name("PSKIP"), + ) + .arg( + Arg::with_name(OPT_EXACT_PREFIX) + .short("x") + .long("exact-prefix") + .help( + "PREFIX must match at the + beginning of the line with no preceding whitespace.", + ), + ) + .arg( + Arg::with_name(OPT_EXACT_SKIP_PREFIX) + .short("X") + .long("exact-skip-prefix") + .help( + "PSKIP must match at the + beginning of the line with no preceding whitespace.", + ), + ) + .arg( + Arg::with_name(OPT_WIDTH) + .short("w") + .long("width") + .help("Fill output lines up to a maximum of WIDTH columns, default 79.") + .value_name("WIDTH"), + ) + .arg( + Arg::with_name(OPT_GOAL) + .short("g") + .long("goal") + .help("Goal width, default ~0.94*WIDTH. Must be less than WIDTH.") + .value_name("GOAL"), + ) + .arg(Arg::with_name(OPT_QUICK).short("q").long("quick").help( + "Break lines more quickly at the + expense of a potentially more ragged appearance.", + )) + .arg( + Arg::with_name(OPT_TAB_WIDTH) + .short("T") + .long("tab-width") + .help( + "Treat tabs as TABWIDTH spaces for + determining line length, default 8. Note that this is used only for + calculating line lengths; tabs are preserved in the output.", + ) + .value_name("TABWIDTH"), + ) + .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) + .get_matches_from(args); + + let mut files: Vec = matches + .values_of(ARG_FILES) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); let mut fmt_opts = FmtOptions { crown: false, @@ -93,45 +225,33 @@ pub fn uumain(args: impl uucore::Args) -> i32 { tabwidth: 8, }; - if matches.opt_present("t") { - fmt_opts.tagged = true; - } - if matches.opt_present("c") { + fmt_opts.tagged = matches.is_present(OPT_TAGGED_PARAGRAPH); + if matches.is_present(OPT_CROWN_MARGIN) { fmt_opts.crown = true; fmt_opts.tagged = false; } - if matches.opt_present("m") { - fmt_opts.mail = true; - } - if matches.opt_present("u") { - fmt_opts.uniform = true; - } - if matches.opt_present("q") { - fmt_opts.quick = true; - } - if matches.opt_present("s") { + fmt_opts.mail = matches.is_present(OPT_PRESERVE_HEADERS); + fmt_opts.uniform = matches.is_present(OPT_UNIFORM_SPACING); + fmt_opts.quick = matches.is_present(OPT_QUICK); + if matches.is_present(OPT_SPLIT_ONLY) { fmt_opts.split_only = true; fmt_opts.crown = false; fmt_opts.tagged = false; } - if matches.opt_present("x") { - fmt_opts.xprefix = true; - } - if matches.opt_present("X") { - fmt_opts.xanti_prefix = true; - } + fmt_opts.xprefix = matches.is_present(OPT_EXACT_PREFIX); + fmt_opts.xanti_prefix = matches.is_present(OPT_SKIP_PREFIX); - if let Some(s) = matches.opt_str("p") { + if let Some(s) = matches.value_of(OPT_PREFIX).map(String::from) { fmt_opts.prefix = s; fmt_opts.use_prefix = true; }; - if let Some(s) = matches.opt_str("P") { + if let Some(s) = matches.value_of(OPT_SKIP_PREFIX).map(String::from) { fmt_opts.anti_prefix = s; fmt_opts.use_anti_prefix = true; }; - if let Some(s) = matches.opt_str("w") { + if let Some(s) = matches.value_of(OPT_WIDTH) { fmt_opts.width = match s.parse::() { Ok(t) => t, Err(e) => { @@ -148,21 +268,21 @@ pub fn uumain(args: impl uucore::Args) -> i32 { fmt_opts.goal = cmp::min(fmt_opts.width * 94 / 100, fmt_opts.width - 3); }; - if let Some(s) = matches.opt_str("g") { + if let Some(s) = matches.value_of(OPT_GOAL) { fmt_opts.goal = match s.parse::() { Ok(t) => t, Err(e) => { crash!(1, "Invalid GOAL specification: `{}': {}", s, e); } }; - if !matches.opt_present("w") { + if !matches.is_present(OPT_WIDTH) { fmt_opts.width = cmp::max(fmt_opts.goal * 100 / 94, fmt_opts.goal + 3); } else if fmt_opts.goal > fmt_opts.width { crash!(1, "GOAL cannot be greater than WIDTH."); } }; - if let Some(s) = matches.opt_str("T") { + if let Some(s) = matches.value_of(OPT_TAB_WIDTH) { fmt_opts.tabwidth = match s.parse::() { Ok(t) => t, Err(e) => { @@ -178,7 +298,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // immutable now let fmt_opts = fmt_opts; - let mut files = matches.free; if files.is_empty() { files.push("-".to_owned()); } From dc53b9bbf3be628942527709472469dc2d578151 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 1 Feb 2021 23:32:38 +0100 Subject: [PATCH 298/606] Also pin thread_local to version 1.1.0 --- Cargo.lock | 156 +++++++++++++++++++++++++++++++---------------------- Cargo.toml | 1 + 2 files changed, 92 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ebd5aab5e..e493a5b0c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -103,12 +103,12 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bumpalo" -version = "3.4.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -212,6 +212,7 @@ dependencies = [ "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -391,7 +392,7 @@ dependencies = [ [[package]] name = "criterion" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -399,16 +400,16 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "csv 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -474,7 +475,7 @@ dependencies = [ "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -518,7 +519,7 @@ name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -639,6 +640,14 @@ dependencies = [ "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "itertools" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "itoa" version = "0.4.7" @@ -646,10 +655,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "js-sys" -version = "0.3.46" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wasm-bindgen 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -673,10 +682,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -837,13 +846,27 @@ dependencies = [ [[package]] name = "plotters" -version = "0.2.15" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "js-sys 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "plotters-backend" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "plotters-svg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -875,7 +898,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1091,7 +1114,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.120" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1100,17 +1123,17 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.120" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1120,7 +1143,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1166,7 +1189,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "1.0.58" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1206,12 +1229,12 @@ dependencies = [ [[package]] name = "termion" -version = "1.5.5" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1223,7 +1246,7 @@ dependencies = [ "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1251,7 +1274,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1277,7 +1300,7 @@ name = "tinytemplate" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1321,7 +1344,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1553,7 +1576,7 @@ dependencies = [ name = "uu_factor" version = "0.0.3" dependencies = [ - "criterion 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2306,7 +2329,7 @@ dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2318,7 +2341,7 @@ version = "0.0.5" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2348,60 +2371,60 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wasm-bindgen" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bumpalo 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo 3.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "web-sys" -version = "0.3.46" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "js-sys 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.47 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2472,7 +2495,7 @@ dependencies = [ "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" "checksum bstr 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "473fc6b38233f9af7baa94fb5852dca389e3d95b8e21c8e3719301462c5d9faf" -"checksum bumpalo 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" +"checksum bumpalo 3.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "099e596ef14349721d9016f6b80dd3419ea1bf289ab9b44df8e4dfd3a005d5d9" "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" "checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" @@ -2492,7 +2515,7 @@ dependencies = [ "checksum cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" "checksum cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" "checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" -"checksum criterion 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "70daa7ceec6cf143990669a04c7df13391d55fb27bd4079d252fca774ba244d8" +"checksum criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" "checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" "checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" "checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" @@ -2521,14 +2544,15 @@ dependencies = [ "checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" "checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" "checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" +"checksum itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" "checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" "checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" "checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" -"checksum js-sys 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" +"checksum js-sys 0.3.47 (registry+https://github.com/rust-lang/crates.io-index)" = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" -"checksum log 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "fcf3805d4480bb5b86070dcfeb9e2cb2ebc148adb753c5cca5f884d1d65a42b2" +"checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" "checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" "checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" "checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" @@ -2550,7 +2574,9 @@ dependencies = [ "checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" "checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" "checksum platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f2fd076acdc7a98374de6e300bf3af675997225bef21aecac2219553f04dd7e8" -"checksum plotters 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0d1685fbe7beba33de0330629da9d955ac75bd54f33d7b79f9a895590124f6bb" +"checksum plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" +"checksum plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" +"checksum plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" "checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" "checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" "checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" @@ -2583,20 +2609,20 @@ dependencies = [ "checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)" = "166b2349061381baf54a58e4b13c89369feb0ef2eaa57198899e2312aac30aab" +"checksum serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)" = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" "checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.120 (registry+https://github.com/rust-lang/crates.io-index)" = "0ca2a8cb5805ce9e3b95435e3765b7b553cecc762d938d409434338386cb5775" +"checksum serde_derive 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)" = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" "checksum serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)" = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" "checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)" = "cc60a3d73ea6594cd712d830cc1f0390fd71542d8c8cd24e70cc54cdfd5e05d5" +"checksum syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)" = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" "checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" -"checksum termion 1.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c22cec9d8978d906be5ac94bceb5a010d885c626c4c8855721a4dbd20e3ac905" +"checksum termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" "checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thiserror 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)" = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146" @@ -2615,12 +2641,12 @@ dependencies = [ "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum wasm-bindgen 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" -"checksum wasm-bindgen-backend 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" -"checksum wasm-bindgen-macro 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084" -"checksum wasm-bindgen-macro-support 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" -"checksum wasm-bindgen-shared 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" -"checksum web-sys 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)" = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3" +"checksum wasm-bindgen 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)" = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be" +"checksum wasm-bindgen-backend 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)" = "7bc45447f0d4573f3d65720f636bbcc3dd6ce920ed704670118650bcd47764c7" +"checksum wasm-bindgen-macro 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)" = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c" +"checksum wasm-bindgen-macro-support 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)" = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385" +"checksum wasm-bindgen-shared 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4945e4943ae02d15c13962b38a5b1e81eadd4b71214eee75af64a4d6a4fd64" +"checksum web-sys 0.3.47 (registry+https://github.com/rust-lang/crates.io-index)" = "c40dc691fc48003eba817c38da7113c15698142da971298003cac3ef175680b3" "checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" diff --git a/Cargo.toml b/Cargo.toml index 1710752a1..f83c5ef28 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -331,6 +331,7 @@ pin_rustc-demangle = { version="0.1.16, < 0.1.17", package="rustc-demangle" } ## pin_same-file = { version="1.0.4, < 1.0.6", package="same-file" } ## same-file v1.0.6 has compiler errors for MinRustV v1.32.0, expects 1.34 pin_winapi-util = { version="0.1.2, < 0.1.3", package="winapi-util" } ## winapi-util v0.1.3 has compiler errors for MinRustV v1.32.0, expects 1.34 pin_byteorder = { version="1.3.4, < 1.4.0", package="byteorder" } ## byteorder v1.4 has compiler errors for MinRustV v1.32.0, requires 1.3 (for `use of unstable library feature 'try_from' (see issue #33417)`) +pin_thread_local = { version="1.1.0, < 1.1.1", package="thread_local" } ## thread_local v1.1.2 has compiler errors for MinRustV v1.32.0, requires 1.36 (for `use of unstable library feature 'maybe_uninit'`) [dev-dependencies] conv = "0.3" From 87428b9c32bc99491fe3226a00170580e1cd9479 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 1 Feb 2021 23:53:17 +0100 Subject: [PATCH 299/606] update uucore to 0.0.6 --- src/uucore/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 2fc8b7b6e..a6f442b8c 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uucore" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "uutils ~ 'core' uutils code library (cross-platform)" From 262b508b891d7869bd51be2f2ce88545ae872de0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 1 Feb 2021 23:55:33 +0100 Subject: [PATCH 300/606] update the dep to uucore 0.0.6 --- Cargo.lock | 196 ++++++++++++------------- Cargo.toml | 4 +- src/uu/arch/Cargo.toml | 2 +- src/uu/base32/Cargo.toml | 2 +- src/uu/base64/Cargo.toml | 2 +- src/uu/basename/Cargo.toml | 2 +- src/uu/cat/Cargo.toml | 2 +- src/uu/chgrp/Cargo.toml | 2 +- src/uu/chmod/Cargo.toml | 2 +- src/uu/chown/Cargo.toml | 2 +- src/uu/chroot/Cargo.toml | 2 +- src/uu/cksum/Cargo.toml | 2 +- src/uu/comm/Cargo.toml | 2 +- src/uu/cp/Cargo.toml | 2 +- src/uu/csplit/Cargo.toml | 2 +- src/uu/cut/Cargo.toml | 2 +- src/uu/date/Cargo.toml | 2 +- src/uu/df/Cargo.toml | 2 +- src/uu/dircolors/Cargo.toml | 2 +- src/uu/dirname/Cargo.toml | 2 +- src/uu/du/Cargo.toml | 2 +- src/uu/echo/Cargo.toml | 2 +- src/uu/env/Cargo.toml | 2 +- src/uu/expand/Cargo.toml | 2 +- src/uu/expr/Cargo.toml | 2 +- src/uu/factor/Cargo.toml | 2 +- src/uu/false/Cargo.toml | 2 +- src/uu/fmt/Cargo.toml | 2 +- src/uu/fold/Cargo.toml | 2 +- src/uu/groups/Cargo.toml | 2 +- src/uu/hashsum/Cargo.toml | 2 +- src/uu/head/Cargo.toml | 2 +- src/uu/hostid/Cargo.toml | 2 +- src/uu/hostname/Cargo.toml | 2 +- src/uu/id/Cargo.toml | 2 +- src/uu/install/Cargo.toml | 2 +- src/uu/join/Cargo.toml | 2 +- src/uu/kill/Cargo.toml | 2 +- src/uu/link/Cargo.toml | 2 +- src/uu/ln/Cargo.toml | 2 +- src/uu/logname/Cargo.toml | 2 +- src/uu/ls/Cargo.toml | 2 +- src/uu/mkdir/Cargo.toml | 2 +- src/uu/mkfifo/Cargo.toml | 2 +- src/uu/mknod/Cargo.toml | 2 +- src/uu/mktemp/Cargo.toml | 2 +- src/uu/more/Cargo.toml | 2 +- src/uu/mv/Cargo.toml | 2 +- src/uu/nice/Cargo.toml | 2 +- src/uu/nl/Cargo.toml | 2 +- src/uu/nohup/Cargo.toml | 2 +- src/uu/nproc/Cargo.toml | 2 +- src/uu/numfmt/Cargo.toml | 2 +- src/uu/od/Cargo.toml | 2 +- src/uu/paste/Cargo.toml | 2 +- src/uu/pathchk/Cargo.toml | 2 +- src/uu/pinky/Cargo.toml | 2 +- src/uu/printenv/Cargo.toml | 2 +- src/uu/printf/Cargo.toml | 2 +- src/uu/ptx/Cargo.toml | 2 +- src/uu/pwd/Cargo.toml | 2 +- src/uu/readlink/Cargo.toml | 2 +- src/uu/realpath/Cargo.toml | 2 +- src/uu/relpath/Cargo.toml | 2 +- src/uu/rm/Cargo.toml | 2 +- src/uu/rmdir/Cargo.toml | 2 +- src/uu/seq/Cargo.toml | 2 +- src/uu/shred/Cargo.toml | 2 +- src/uu/shuf/Cargo.toml | 2 +- src/uu/sleep/Cargo.toml | 2 +- src/uu/sort/Cargo.toml | 2 +- src/uu/split/Cargo.toml | 2 +- src/uu/stat/Cargo.toml | 2 +- src/uu/stdbuf/Cargo.toml | 2 +- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 2 +- src/uu/sum/Cargo.toml | 2 +- src/uu/sync/Cargo.toml | 2 +- src/uu/tac/Cargo.toml | 2 +- src/uu/tail/Cargo.toml | 2 +- src/uu/tee/Cargo.toml | 2 +- src/uu/test/Cargo.toml | 2 +- src/uu/timeout/Cargo.toml | 2 +- src/uu/touch/Cargo.toml | 2 +- src/uu/tr/Cargo.toml | 2 +- src/uu/true/Cargo.toml | 2 +- src/uu/truncate/Cargo.toml | 2 +- src/uu/tsort/Cargo.toml | 2 +- src/uu/tty/Cargo.toml | 2 +- src/uu/uname/Cargo.toml | 2 +- src/uu/unexpand/Cargo.toml | 2 +- src/uu/uniq/Cargo.toml | 2 +- src/uu/unlink/Cargo.toml | 2 +- src/uu/uptime/Cargo.toml | 2 +- src/uu/users/Cargo.toml | 2 +- src/uu/wc/Cargo.toml | 2 +- src/uu/who/Cargo.toml | 2 +- src/uu/whoami/Cargo.toml | 2 +- src/uu/yes/Cargo.toml | 2 +- 98 files changed, 196 insertions(+), 196 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e493a5b0c..10c5d787b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -312,7 +312,7 @@ dependencies = [ "uu_who 0.0.3", "uu_whoami 0.0.3", "uu_yes 0.0.3", - "uucore 0.0.5", + "uucore 0.0.6", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1352,7 +1352,7 @@ name = "uu_arch" version = "0.0.3" dependencies = [ "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1360,7 +1360,7 @@ dependencies = [ name = "uu_base32" version = "0.0.3" dependencies = [ - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1368,7 +1368,7 @@ dependencies = [ name = "uu_base64" version = "0.0.3" dependencies = [ - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1376,7 +1376,7 @@ dependencies = [ name = "uu_basename" version = "0.0.3" dependencies = [ - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1386,7 +1386,7 @@ version = "0.0.3" dependencies = [ "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1394,7 +1394,7 @@ dependencies = [ name = "uu_chgrp" version = "0.0.3" dependencies = [ - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1404,7 +1404,7 @@ name = "uu_chmod" version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1415,7 +1415,7 @@ version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1425,7 +1425,7 @@ name = "uu_chroot" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1434,7 +1434,7 @@ name = "uu_cksum" version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1444,7 +1444,7 @@ version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1457,7 +1457,7 @@ dependencies = [ "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1472,7 +1472,7 @@ dependencies = [ "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1480,7 +1480,7 @@ dependencies = [ name = "uu_cut" version = "0.0.3" dependencies = [ - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1490,7 +1490,7 @@ version = "0.0.3" dependencies = [ "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1501,7 +1501,7 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1511,7 +1511,7 @@ name = "uu_dircolors" version = "0.0.3" dependencies = [ "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1520,7 +1520,7 @@ name = "uu_dirname" version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1529,7 +1529,7 @@ name = "uu_du" version = "0.0.3" dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1537,7 +1537,7 @@ dependencies = [ name = "uu_echo" version = "0.0.3" dependencies = [ - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1548,7 +1548,7 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1558,7 +1558,7 @@ version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1568,7 +1568,7 @@ version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1583,7 +1583,7 @@ dependencies = [ "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1591,7 +1591,7 @@ dependencies = [ name = "uu_false" version = "0.0.3" dependencies = [ - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1602,7 +1602,7 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1610,7 +1610,7 @@ dependencies = [ name = "uu_fold" version = "0.0.3" dependencies = [ - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1619,7 +1619,7 @@ name = "uu_groups" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1638,7 +1638,7 @@ dependencies = [ "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1647,7 +1647,7 @@ name = "uu_head" version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1656,7 +1656,7 @@ name = "uu_hostid" version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1667,7 +1667,7 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1677,7 +1677,7 @@ name = "uu_id" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1688,7 +1688,7 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1697,7 +1697,7 @@ name = "uu_join" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1706,7 +1706,7 @@ name = "uu_kill" version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1715,7 +1715,7 @@ name = "uu_link" version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1725,7 +1725,7 @@ version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1734,7 +1734,7 @@ name = "uu_logname" version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1750,7 +1750,7 @@ dependencies = [ "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1760,7 +1760,7 @@ version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1770,7 +1770,7 @@ version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1780,7 +1780,7 @@ version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1791,7 +1791,7 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1803,7 +1803,7 @@ dependencies = [ "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1813,7 +1813,7 @@ version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1823,7 +1823,7 @@ version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1837,7 +1837,7 @@ dependencies = [ "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1847,7 +1847,7 @@ version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1858,7 +1858,7 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1867,7 +1867,7 @@ name = "uu_numfmt" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1879,7 +1879,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1888,7 +1888,7 @@ name = "uu_paste" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1898,7 +1898,7 @@ version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1906,7 +1906,7 @@ dependencies = [ name = "uu_pinky" version = "0.0.3" dependencies = [ - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1915,7 +1915,7 @@ name = "uu_printenv" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1924,7 +1924,7 @@ name = "uu_printf" version = "0.0.3" dependencies = [ "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1938,7 +1938,7 @@ dependencies = [ "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1947,7 +1947,7 @@ name = "uu_pwd" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1957,7 +1957,7 @@ version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1966,7 +1966,7 @@ name = "uu_realpath" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1975,7 +1975,7 @@ name = "uu_relpath" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1985,7 +1985,7 @@ version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1995,7 +1995,7 @@ name = "uu_rmdir" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2004,7 +2004,7 @@ name = "uu_seq" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2017,7 +2017,7 @@ dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2027,7 +2027,7 @@ version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2036,7 +2036,7 @@ name = "uu_sleep" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2047,7 +2047,7 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2056,7 +2056,7 @@ name = "uu_split" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2066,7 +2066,7 @@ version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2077,7 +2077,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "uu_stdbuf_libstdbuf 0.0.3", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2088,7 +2088,7 @@ dependencies = [ "cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2097,7 +2097,7 @@ name = "uu_sum" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2107,7 +2107,7 @@ version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2117,7 +2117,7 @@ name = "uu_tac" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2128,7 +2128,7 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2139,7 +2139,7 @@ version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2149,7 +2149,7 @@ version = "0.0.3" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2160,7 +2160,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2171,7 +2171,7 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2182,7 +2182,7 @@ dependencies = [ "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2190,7 +2190,7 @@ dependencies = [ name = "uu_true" version = "0.0.3" dependencies = [ - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2199,7 +2199,7 @@ name = "uu_truncate" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2208,7 +2208,7 @@ name = "uu_tsort" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2218,7 +2218,7 @@ version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2228,7 +2228,7 @@ version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2238,7 +2238,7 @@ version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2247,7 +2247,7 @@ name = "uu_uniq" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2257,7 +2257,7 @@ version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2268,7 +2268,7 @@ dependencies = [ "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2277,7 +2277,7 @@ name = "uu_users" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2286,7 +2286,7 @@ name = "uu_wc" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2294,7 +2294,7 @@ dependencies = [ name = "uu_who" version = "0.0.3" dependencies = [ - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2304,7 +2304,7 @@ version = "0.0.3" dependencies = [ "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2314,13 +2314,13 @@ name = "uu_yes" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.5", + "uucore 0.0.6", "uucore_procs 0.0.5", ] [[package]] name = "uucore" -version = "0.0.5" +version = "0.0.6" dependencies = [ "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index f83c5ef28..219f571e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -226,7 +226,7 @@ test = [ "uu_test" ] [dependencies] lazy_static = { version="1.3" } textwrap = { version="=0.11.0", features=["term_size"] } # !maint: [2020-05-10; rivy] unstable crate using undocumented features; pinned currently, will review -uucore = { version=">=0.0.5", package="uucore", path="src/uucore" } +uucore = { version=">=0.0.6", package="uucore", path="src/uucore" } # * uutils uu_test = { optional=true, version="0.0.3", package="uu_test", path="src/uu/test" } # @@ -346,7 +346,7 @@ sha1 = { version="0.6", features=["std"] } tempfile = "= 3.1.0" time = "0.1" unindent = "0.1" -uucore = { version=">=0.0.5", package="uucore", path="src/uucore", features=["entries"] } +uucore = { version=">=0.0.6", package="uucore", path="src/uucore", features=["entries"] } [target.'cfg(unix)'.dev-dependencies] rust-users = { version="0.10", package="users" } diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index 67d5ad4a8..664392ba4 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -16,7 +16,7 @@ path = "src/arch.rs" [dependencies] platform-info = "0.0.1" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index a53c576cc..57ce64759 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/base32.rs" [dependencies] -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features = ["encoding"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features = ["encoding"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index 553a8f66b..da3ed16e6 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/base64.rs" [dependencies] -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features = ["encoding"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features = ["encoding"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index 19f7eb0f4..9a06d4acd 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/basename.rs" [dependencies] -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 0df50aceb..49f8b6761 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -16,7 +16,7 @@ path = "src/cat.rs" [dependencies] quick-error = "1.2.3" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index 5040d361c..bcae7b436 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/chgrp.rs" [dependencies] -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index 7f94cd4c8..6829dab62 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -16,7 +16,7 @@ path = "src/chmod.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs", "mode"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs", "mode"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index 15622548a..e0bbf759c 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -17,7 +17,7 @@ path = "src/chown.rs" [dependencies] clap = "2.33" glob = "0.3.0" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index 62f3da813..774a18f2a 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -16,7 +16,7 @@ path = "src/chroot.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index 41f407468..3a3cd6b14 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -16,7 +16,7 @@ path = "src/cksum.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index cc1855189..a596fa6b1 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -17,7 +17,7 @@ path = "src/comm.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index 28af78a06..f92165f6b 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -23,7 +23,7 @@ clap = "2.33" filetime = "0.2" libc = "0.2.42" quick-error = "1.2.3" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index fdd70de9f..540e508c7 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -19,7 +19,7 @@ getopts = "0.2.17" thiserror = "1.0" regex = "1.0.0" glob = "0.2.11" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index 548c5f5b2..407c79b41 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/cut.rs" [dependencies] -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index b51363b27..d2e703991 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -17,7 +17,7 @@ path = "src/date.rs" [dependencies] chrono = "0.4.4" clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index b4f7ea865..4977f84d3 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -18,7 +18,7 @@ path = "src/df.rs" clap = "2.33" libc = "0.2" number_prefix = "0.4" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index e9f6c6be0..7f0b83570 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -16,7 +16,7 @@ path = "src/dircolors.rs" [dependencies] glob = "0.3.0" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index f261f8198..539c78924 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -16,7 +16,7 @@ path = "src/dirname.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index 4246fb120..beabb5794 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -16,7 +16,7 @@ path = "src/du.rs" [dependencies] time = "0.1.40" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index 8efa44351..0aa661860 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/echo.rs" [dependencies] -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index 56059abf8..6b3b5440d 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -18,7 +18,7 @@ path = "src/env.rs" clap = "2.33" libc = "0.2.42" rust-ini = "0.13.0" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index 102c95fb9..83acbdef4 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -17,7 +17,7 @@ path = "src/expand.rs" [dependencies] getopts = "0.2.18" unicode-width = "0.1.5" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index 3a0c7716d..f3ff65bb2 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -17,7 +17,7 @@ path = "src/expr.rs" [dependencies] libc = "0.2.42" onig = "~4.3.2" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index 8ae61e73c..0b335cddf 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -19,7 +19,7 @@ num-traits = "0.2.13" # used in src/numerics.rs, which is included by build.rs num-traits = "0.2.13" # Needs at least version 0.2.13 for "OverflowingAdd" rand = { version="0.7", features=["small_rng"] } smallvec = { version="0.6.13, < 1.0" } -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index b15640e46..6c6c64b53 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/false.rs" [dependencies] -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index 1b86c80ec..dc3f7fba5 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -18,7 +18,7 @@ path = "src/fmt.rs" clap = "2.33" libc = "0.2.42" unicode-width = "0.1.5" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index ec255958d..8299e58b5 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/fold.rs" [dependencies] -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index 1b25becbc..178f305c1 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/groups.rs" [dependencies] -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } clap = "2.33" diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index d072e3687..0e120e13a 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -26,7 +26,7 @@ sha1 = "0.6.0" sha2 = "0.6.0" sha3 = "0.6.0" blake2-rfc = "0.2.18" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index 8c8aa98ca..f8b03b15b 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -16,7 +16,7 @@ path = "src/head.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index 981a1929e..75686e93a 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -16,7 +16,7 @@ path = "src/hostid.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index 64f84828c..34af5600c 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -18,7 +18,7 @@ path = "src/hostname.rs" clap = "2.33" libc = "0.2.42" hostname = { version = "0.3", features = ["set"] } -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["wide"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["wide"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=["sysinfoapi", "winsock2"] } diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index 97e4a05e7..0643816db 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -16,7 +16,7 @@ path = "src/id.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries", "process"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries", "process"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 537f954bd..1eb8538c3 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -20,7 +20,7 @@ path = "src/install.rs" [dependencies] clap = "2.33" libc = ">= 0.2" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["mode", "perms"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["mode", "perms"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index ea6df04ab..bfe81c098 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -16,7 +16,7 @@ path = "src/join.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index 07c81588a..8bb70a164 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -16,7 +16,7 @@ path = "src/kill.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["signals"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["signals"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index 733b3b8f3..fce502a29 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -16,7 +16,7 @@ path = "src/link.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index 528145963..a9f3df2da 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -17,7 +17,7 @@ path = "src/ln.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index ca44085e7..310dc1207 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -16,7 +16,7 @@ path = "src/logname.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index 3fe3f62d7..f65f9aa2e 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -22,7 +22,7 @@ term_grid = "0.1.5" termsize = "0.1.6" time = "0.1.40" unicode-width = "0.1.5" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index e31211a69..494e221e1 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -17,7 +17,7 @@ path = "src/mkdir.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs", "mode"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs", "mode"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index 776d4abeb..905cf5bbe 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -17,7 +17,7 @@ path = "src/mkfifo.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index 95aee7999..b6d6887b7 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -18,7 +18,7 @@ path = "src/mknod.rs" [dependencies] getopts = "0.2.18" libc = "^0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["mode"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["mode"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index 0e1b00e6d..4ba45dd92 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -18,7 +18,7 @@ path = "src/mktemp.rs" clap = "2.33" rand = "0.5" tempfile = "3.1" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index e3a109211..a54b8b2d6 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -16,7 +16,7 @@ path = "src/more.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "redox")'.dependencies] diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index 485d494a7..eed89e1f4 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -17,7 +17,7 @@ path = "src/mv.rs" [dependencies] clap = "2.33" fs_extra = "1.1.0" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index dd775fac9..200c0f5df 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -17,7 +17,7 @@ path = "src/nice.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index 372bd44f5..80733f424 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -21,7 +21,7 @@ libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" regex-syntax = "0.6.7" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index 995e9103a..349cde7aa 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -17,7 +17,7 @@ path = "src/nohup.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index bfc14b59d..7194f99e2 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -18,7 +18,7 @@ path = "src/nproc.rs" libc = "0.2.42" num_cpus = "1.10" clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index 491953cc0..22cf5acc9 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -16,7 +16,7 @@ path = "src/numfmt.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index a4dacf8e6..1c4f970e4 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -19,7 +19,7 @@ byteorder = "1.3.2" getopts = "0.2.18" half = "1.6" libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index 7e7d32f65..63e357cb2 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -16,7 +16,7 @@ path = "src/paste.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index f9deaf7e1..9ff514fcc 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -17,7 +17,7 @@ path = "src/pathchk.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index 5bf7c2a22..e52b0cdca 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/pinky.rs" [dependencies] -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["utmpx", "entries"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["utmpx", "entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index 8bb0354a9..6a330cc03 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -16,7 +16,7 @@ path = "src/printenv.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index 8f8a1c196..d7166ae00 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -19,7 +19,7 @@ path = "src/printf.rs" [dependencies] itertools = "0.8.0" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index bb3ded05b..26dea7b75 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -21,7 +21,7 @@ libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" regex-syntax = "0.6.7" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index 511f9efc1..49cf18686 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -16,7 +16,7 @@ path = "src/pwd.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index 0646420bc..bd89eb7a4 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -17,7 +17,7 @@ path = "src/readlink.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index 2b70b8d97..46678dd86 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -16,7 +16,7 @@ path = "src/realpath.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index 9622d973e..9d87d5e23 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -16,7 +16,7 @@ path = "src/relpath.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index ccce16209..095764f72 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -18,7 +18,7 @@ path = "src/rm.rs" clap = "2.33" walkdir = "2.2" remove_dir_all = "0.5.1" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index 742aa7868..639e3f1cb 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -16,7 +16,7 @@ path = "src/rmdir.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index 32096e1db..df9abe4d2 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -16,7 +16,7 @@ path = "src/seq.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index a90034a6c..bf23cc6ee 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -20,7 +20,7 @@ getopts = "0.2.18" libc = "0.2.42" rand = "0.5" time = "0.1.40" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index 6b6460280..6e777eab5 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -17,7 +17,7 @@ path = "src/shuf.rs" [dependencies] getopts = "0.2.18" rand = "0.5" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index 1e42b069c..396f6424d 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -16,7 +16,7 @@ path = "src/sleep.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["parse_time"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["parse_time"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index b28a3579d..b95ece92f 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -18,7 +18,7 @@ path = "src/sort.rs" clap = "2.33" itertools = "0.8.0" semver = "0.9.0" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index ccb7c6fd3..618803d30 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -16,7 +16,7 @@ path = "src/split.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index 3f5a47fdf..e24a8ac9d 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -17,7 +17,7 @@ path = "src/stat.rs" [dependencies] clap = "2.33" time = "0.1.40" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries", "libc"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries", "libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index 137146913..1a317e6ed 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -17,7 +17,7 @@ path = "src/stdbuf.rs" [dependencies] getopts = "0.2.18" tempfile = "3.1" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [build-dependencies] diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index 1261fbc25..7b540edf4 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -19,7 +19,7 @@ crate-type = ["cdylib", "rlib"] # XXX: note: the rlib is just to prevent Cargo f [dependencies] cpp = "0.4" libc = "0.2" -uucore = { version=">=0.0.5", package="uucore", path="../../../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../../../uucore_procs" } [build-dependencies] diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index 2526bae3d..4bc82ab5b 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -16,7 +16,7 @@ path = "src/sum.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index e1176dea1..7a7a83a43 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -17,7 +17,7 @@ path = "src/sync.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["wide"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["wide"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi", "std", "winbase", "winerror"] } diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index 17b2e0ec4..b62875372 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -16,7 +16,7 @@ path = "src/tac.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index 225bf460c..f94283089 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -17,7 +17,7 @@ path = "src/tail.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=["fileapi", "handleapi", "processthreadsapi", "synchapi", "winbase"] } diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index 301ef145e..f869fb702 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -17,7 +17,7 @@ path = "src/tee.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index ac7e33845..f076f242c 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -16,7 +16,7 @@ path = "src/test.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "redox")'.dependencies] diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index 666a748a3..f6528b052 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -18,7 +18,7 @@ path = "src/timeout.rs" getopts = "0.2.18" libc = "0.2.42" time = "0.1.40" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index 5f4b29084..c88808224 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -18,7 +18,7 @@ path = "src/touch.rs" filetime = "0.2.1" clap = "2.33" time = "0.1.40" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["libc"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index 4b0d01877..cdf519dfe 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -18,7 +18,7 @@ path = "src/tr.rs" bit-set = "0.5.0" fnv = "1.0.5" getopts = "0.2.18" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index 01970015f..26dd321aa 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/true.rs" [dependencies] -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index f953eb376..b0e5dc32b 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -16,7 +16,7 @@ path = "src/truncate.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index 64a383ab8..65e30b6c2 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -16,7 +16,7 @@ path = "src/tsort.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index 5f552b283..2302c02cb 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -17,7 +17,7 @@ path = "src/tty.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index bb0b6510e..6bb156a4b 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -17,7 +17,7 @@ path = "src/uname.rs" [dependencies] clap = "2.33" platform-info = "0.0.1" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index 07cd5dd5a..218b100b7 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -17,7 +17,7 @@ path = "src/unexpand.rs" [dependencies] getopts = "0.2.18" unicode-width = "0.1.5" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index 2bde2fd75..924e2f93c 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -16,7 +16,7 @@ path = "src/uniq.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index 7fd2e1fbc..1326dcc96 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -17,7 +17,7 @@ path = "src/unlink.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index e96ec56c0..36f8b7ded 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -18,7 +18,7 @@ path = "src/uptime.rs" time = "0.1.40" chrono = "0.4" clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["libc", "utmpx"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["libc", "utmpx"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index 3cf587678..d5f331755 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -16,7 +16,7 @@ path = "src/users.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["utmpx"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["utmpx"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index b612c6b71..c50989d32 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -16,7 +16,7 @@ path = "src/wc.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index da3aa3bac..2fdc64255 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/who.rs" [dependencies] -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["utmpx"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["utmpx"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index 2401deeab..ee2ac9031 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -16,7 +16,7 @@ path = "src/whoami.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["entries", "wide"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries", "wide"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index a48d4f7b8..c4fc09acf 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -16,7 +16,7 @@ path = "src/yes.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.5", package="uucore", path="../../uucore", features=["zero-copy"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["zero-copy"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [features] From d7a6bfa76c2a9a4523c6ad7a0594a905f7995db1 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 2 Feb 2021 00:09:25 +0100 Subject: [PATCH 301/606] bug(install) - needs entries from uucore too --- src/uu/install/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 1eb8538c3..ebea997a0 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -20,7 +20,7 @@ path = "src/install.rs" [dependencies] clap = "2.33" libc = ">= 0.2" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["mode", "perms"] } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["mode", "perms", "entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] From 858ea108ce71f167860f2fc0428f94a88ed28fea Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 2 Feb 2021 00:18:46 +0100 Subject: [PATCH 302/606] bug(ln) - needs fs from uucore too --- src/uu/ln/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index a9f3df2da..c2e7f3cf7 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -17,7 +17,7 @@ path = "src/ln.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] From 2bb9a85ddedc7b8aa1bd866bd70e41364c8783f7 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 2 Feb 2021 08:59:11 +0100 Subject: [PATCH 303/606] bug(tee) - needs libc from uucore --- src/uu/tee/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index f869fb702..931a010e5 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -17,7 +17,7 @@ path = "src/tee.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] From 84965ad8c3b357e6dadf288fc6ed629a8e5a1e71 Mon Sep 17 00:00:00 2001 From: James Robson Date: Wed, 3 Feb 2021 21:27:30 +0000 Subject: [PATCH 304/606] Use make to build all binaries --- .github/workflows/GNU.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 9b6b60c08..b6bb24bdd 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -33,14 +33,14 @@ jobs: - name: Build binaries shell: bash run: | + sudo apt-get update + sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify expect python3-sphinx pushd uutils - cargo build --release + make PROFILE=release BUILDDIR="$PWD/target/release/" popd GNULIB_SRCDIR="$PWD/gnulib" pushd gnu/ - sudo apt-get update - sudo apt-get install autoconf autopoint bison texinfo gperf gcc gdb python-pyinotify expect ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" ./configure --quiet --disable-gcc-warnings # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils From 84b0573f7d19b9979da716654e9cbcde7b3b0496 Mon Sep 17 00:00:00 2001 From: James Robson Date: Wed, 3 Feb 2021 21:30:20 +0000 Subject: [PATCH 305/606] Fix $PATH in tests --- .github/workflows/GNU.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index b6bb24bdd..16d8f1b78 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -47,6 +47,12 @@ jobs: sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile sed -i 's| tr | /usr/bin/tr |' tests/init.sh make + # Generate the factor tests, so they can be fixed + for i in $(seq -w 1 36) + do + make tests/factor/t${i}.sh + done + grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||' test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests shell: bash From 5808d56f12c0a991103b537f73101b9add392cb4 Mon Sep 17 00:00:00 2001 From: James Robson Date: Wed, 3 Feb 2021 21:33:14 +0000 Subject: [PATCH 306/606] Skip tests that hang --- .github/workflows/GNU.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 16d8f1b78..1ce6376b7 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -53,6 +53,21 @@ jobs: make tests/factor/t${i}.sh done grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||' + sed -i -e 's|^seq |/usr/bin/seq |' tests/factor/t*sh + sed -i -e '/tests\/misc\/cat-self.sh/ D' Makefile # issue #1707 + sed -i -e '/tests\/misc\/numfmt.pl/ D' Makefile # issue #1708 + sed -i -e '/tests\/chown\/preserve-root.sh/ D' Makefile # issue #1709 + sed -i -e '/tests\/cp\/file-perm-race.sh/ D' Makefile # issue #1710 + sed -i -e '/tests\/cp\/special-f.sh/ D' Makefile # issue #1710 + sed -i -e '/tests\/mv\/mv-special-1.sh/ D' Makefile # issue #1710 + sed -i -e '/tests\/dd\/stats.sh/ D' Makefile # issue #1710 + sed -i -e '/tests\/cp\/existing-perm-race.sh/ D' Makefile # hangs, cp doesn't implement --copy-contents + # Remove tests that rely on seq with large numbers. See issue #1703 + sed -i -e '/tests\/misc\/seq.pl/ D' \ + -e '/tests\/misc\/seq-precision.sh/D' \ + Makefile + sed -i -e '/tests\/tail-2\/pid.sh/ D' Makefile # hangs on github, tail doesn't support -f + test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests shell: bash From 7fe5a08b23696f73ce15b7bf0966b28053ed1dc5 Mon Sep 17 00:00:00 2001 From: James Robson Date: Wed, 3 Feb 2021 21:37:39 +0000 Subject: [PATCH 307/606] Use timeout to protect against hangs --- .github/workflows/GNU.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 1ce6376b7..9d996fe64 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -75,6 +75,5 @@ jobs: BUILDDIR="${PWD}/uutils/target/release" GNULIB_DIR="${PWD}/gnulib" pushd gnu - ulimit -t 60 - unbuffer make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : + unbuffer timeout 3600 make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : From 96219692a4c5b502db976775f7b21e4ef03007e3 Mon Sep 17 00:00:00 2001 From: James Robson Date: Wed, 3 Feb 2021 21:38:24 +0000 Subject: [PATCH 308/606] Archive logs --- .github/workflows/GNU.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 9d996fe64..ad100d8b1 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -77,3 +77,7 @@ jobs: pushd gnu unbuffer timeout 3600 make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : + - uses: actions/upload-artifact@v2 + with: + name: test-report + path: gnu/tests/**/*.log From 4573ce44e1a4d31e203fa2f16e1a56fcba9198f2 Mon Sep 17 00:00:00 2001 From: James Robson Date: Thu, 4 Feb 2021 18:08:00 +0000 Subject: [PATCH 309/606] Kill make on timeout so it can't delete the running log --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index ad100d8b1..0ca34db1d 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -76,7 +76,7 @@ jobs: GNULIB_DIR="${PWD}/gnulib" pushd gnu - unbuffer timeout 3600 make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : + unbuffer timeout -sKILL 3600 make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : - uses: actions/upload-artifact@v2 with: name: test-report From d4a30fdff0b5f22db1cb364ad903ece47a979e5d Mon Sep 17 00:00:00 2001 From: James Robson Date: Thu, 4 Feb 2021 18:42:43 +0000 Subject: [PATCH 310/606] Skip sort test that will hang --- .github/workflows/GNU.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 0ca34db1d..605603bf9 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -67,6 +67,7 @@ jobs: -e '/tests\/misc\/seq-precision.sh/D' \ Makefile sed -i -e '/tests\/tail-2\/pid.sh/ D' Makefile # hangs on github, tail doesn't support -f + sed -i -e'/incompat4/ D' -e"/options '-co' are incompatible/ d" tests/misc/sort.pl # Sort doesn't correctly check for incompatible options, waits for input test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests From beda329a21ea2808edf317485dce2ec991f27cf0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 7 Feb 2021 15:12:15 +0100 Subject: [PATCH 311/606] Fix some clippy warnings --- src/uu/install/src/install.rs | 8 ++++---- src/uu/ln/src/ln.rs | 5 ++--- src/uu/split/src/platform/unix.rs | 4 +--- src/uu/tail/src/tail.rs | 4 ++-- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index b0c6f1930..3f3502cb6 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -495,7 +495,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { return Err(()); } - if b.owner != "" { + if !b.owner.is_empty() { let meta = match fs::metadata(to) { Ok(meta) => meta, Err(f) => crash!(1, "{}", f.to_string()), @@ -515,7 +515,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { Verbosity::Normal, ) { Ok(n) => { - if n != "" { + if !n.is_empty() { show_info!("{}", n); } } @@ -523,7 +523,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { } } - if b.group != "" { + if !b.group.is_empty() { let meta = match fs::metadata(to) { Ok(meta) => meta, Err(f) => crash!(1, "{}", f.to_string()), @@ -535,7 +535,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { }; match wrap_chgrp(to.as_path(), &meta, group_id, false, Verbosity::Normal) { Ok(n) => { - if n != "" { + if !n.is_empty() { show_info!("{}", n); } } diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index d257feb70..e06468367 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -325,9 +325,8 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &PathBuf, settings: &Setting // Not sure why but on Windows, the symlink can be // considered as a dir // See test_ln::test_symlink_no_deref_dir - match fs::remove_dir(target_dir) { - Err(e) => show_error!("Could not update {}: {}", target_dir.display(), e), - _ => (), + if let Err(e) = fs::remove_dir(target_dir) { + show_error!("Could not update {}: {}", target_dir.display(), e) }; } } diff --git a/src/uu/split/src/platform/unix.rs b/src/uu/split/src/platform/unix.rs index 45333ceb2..331b31115 100644 --- a/src/uu/split/src/platform/unix.rs +++ b/src/uu/split/src/platform/unix.rs @@ -75,9 +75,7 @@ impl FilterWriter { .spawn() .expect("Couldn't spawn filter command"); - FilterWriter { - shell_process: shell_process, - } + FilterWriter { shell_process } } } diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 6d80172cc..2276885e0 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -163,7 +163,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { match matches.value_of(OPT_LINES) { Some(n) => { - let mut slice: &str = n.as_ref(); + let mut slice: &str = n; if slice.chars().next().unwrap_or('_') == '+' { settings.beginning = true; slice = &slice[1..]; @@ -178,7 +178,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } None => { if let Some(n) = matches.value_of(OPT_BYTES) { - let mut slice: &str = n.as_ref(); + let mut slice: &str = n; if slice.chars().next().unwrap_or('_') == '+' { settings.beginning = true; slice = &slice[1..]; From 6c2bca110d7a4f94078a8b97fa52f706ad8b2e1b Mon Sep 17 00:00:00 2001 From: Chad Brewbaker Date: Mon, 8 Feb 2021 14:54:48 -0600 Subject: [PATCH 312/606] Fixed wc -L no end of line LF bug (#1714) --- src/uu/wc/src/wc.rs | 13 +++++-------- tests/by-util/test_wc.rs | 9 +++++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index c6d5d72d8..68e955f81 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -177,7 +177,7 @@ fn wc(files: Vec, settings: &Settings) -> StdResult<(), i32> { let mut char_count: usize = 0; let mut longest_line_length: usize = 0; let mut raw_line = Vec::new(); - + let mut ends_lf: bool; // reading from a TTY seems to raise a condition on, rather than return Some(0) like a file. // hence the option wrapped in a result here while match reader.read_until(LF, &mut raw_line) { @@ -189,9 +189,8 @@ fn wc(files: Vec, settings: &Settings) -> StdResult<(), i32> { _ => false, } { // GNU 'wc' only counts lines that end in LF as lines - if *raw_line.last().unwrap() == LF { - line_count += 1; - } + ends_lf = *raw_line.last().unwrap() == LF; + line_count += ends_lf as usize; byte_count += raw_line.len(); @@ -209,11 +208,9 @@ fn wc(files: Vec, settings: &Settings) -> StdResult<(), i32> { } } char_count += current_char_count; - if current_char_count > longest_line_length { - // we subtract one here because `line.len()` includes the LF - // matches GNU 'wc' behavior - longest_line_length = current_char_count - 1; + // -L is a GNU 'wc' extension so same behavior on LF + longest_line_length = current_char_count - (ends_lf as usize); } } diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index 43dbbdb15..a0fe8889b 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -8,6 +8,15 @@ fn test_stdin_default() { .stdout_is(" 13 109 772\n"); } +#[test] +fn test_stdin_line_len_regression() { + new_ucmd!() + .args(&["-L"]) + .pipe_in("\n123456") + .run() + .stdout_is(" 6\n"); +} + #[test] fn test_stdin_only_bytes() { new_ucmd!() From b8987f3d5f9152864b3ec9a91ba3bcdd29fb7533 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 11 Feb 2021 00:03:23 +0100 Subject: [PATCH 313/606] fix(mktemp) - Make mktemp --tempdir foo.XXXXXX works (#1716) Used by apt-key --- src/uu/mktemp/src/mktemp.rs | 50 ++++++++++++++++++++++++++---------- tests/by-util/test_mktemp.rs | 32 +++++++++++++++++++++++ 2 files changed, 68 insertions(+), 14 deletions(-) diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index a0edf3df4..8969dc51c 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -100,6 +100,33 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .get_matches_from(args); let template = matches.value_of(ARG_TEMPLATE).unwrap(); + let tmpdir = matches.value_of(OPT_TMPDIR).unwrap_or_default(); + + let (template, mut tmpdir) = if matches.is_present(OPT_TMPDIR) + && !PathBuf::from(tmpdir).is_dir() // if a temp dir is provided, it must be an actual path + && tmpdir.contains("XXX") + // If this is a template, it has to contain at least 3 X + && template == DEFAULT_TEMPLATE + // That means that clap does not think we provided a template + { + // Special case to workaround a limitation of clap when doing + // mktemp --tmpdir apt-key-gpghome.XXX + // The behavior should be + // mktemp --tmpdir $TMPDIR apt-key-gpghome.XX + // As --tmpdir is empty + // + // Fixed in clap 3 + // See https://github.com/clap-rs/clap/pull/1587 + let tmp = env::temp_dir(); + (tmpdir, tmp) + } else { + if !matches.is_present(OPT_TMPDIR) { + let tmp = env::temp_dir(); + (template, tmp) + } else { + (template, PathBuf::from(tmpdir)) + } + }; let make_dir = matches.is_present(OPT_DIRECTORY); let dry_run = matches.is_present(OPT_DRY_RUN); @@ -130,18 +157,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { crash!(1, "suffix cannot contain any path separators"); } - let mut tmpdir = match matches.value_of(OPT_TMPDIR) { - Some(s) => { - if PathBuf::from(prefix).is_absolute() { - show_info!( - "invalid template, ‘{}’; with --tmpdir, it may not be absolute", - template - ); - return 1; - } - PathBuf::from(s) + if matches.is_present(OPT_TMPDIR) { + if PathBuf::from(prefix).is_absolute() { + show_info!( + "invalid template, ‘{}’; with --tmpdir, it may not be absolute", + template + ); + return 1; } - None => env::temp_dir(), }; if matches.is_present(OPT_T) { @@ -209,18 +232,17 @@ fn exec( } Err(e) => { if !quiet { - show_info!("{}", e); + show_info!("{}: {}", e, tmpdir.display()); } return 1; } } } - let tmpfile = Builder::new() + .prefix(prefix) .rand_bytes(rand) .suffix(suffix) .tempfile_in(tmpdir); - let tmpfile = match tmpfile { Ok(f) => f, Err(e) => { diff --git a/tests/by-util/test_mktemp.rs b/tests/by-util/test_mktemp.rs index 17193a7c1..2639a2c2f 100644 --- a/tests/by-util/test_mktemp.rs +++ b/tests/by-util/test_mktemp.rs @@ -1,5 +1,6 @@ use crate::common::util::*; +use std::path::PathBuf; use tempfile::tempdir; static TEST_TEMPLATE1: &'static str = "tempXXXXXX"; @@ -380,3 +381,34 @@ fn test_mktemp_tmpdir() { .arg(TEST_TEMPLATE8) .fails(); } + +#[test] +fn test_mktemp_tmpdir_one_arg() { + let scene = TestScenario::new(util_name!()); + + let result = scene + .ucmd() + .arg("--tmpdir") + .arg("apt-key-gpghome.XXXXXXXXXX") + .succeeds(); + println!("stdout {}", result.stdout); + println!("stderr {}", result.stderr); + assert!(result.stdout.contains("apt-key-gpghome.")); + assert!(PathBuf::from(result.stdout.trim()).is_file()); +} + +#[test] +fn test_mktemp_directory_tmpdir() { + let scene = TestScenario::new(util_name!()); + + let result = scene + .ucmd() + .arg("--directory") + .arg("--tmpdir") + .arg("apt-key-gpghome.XXXXXXXXXX") + .succeeds(); + println!("stdout {}", result.stdout); + println!("stderr {}", result.stderr); + assert!(result.stdout.contains("apt-key-gpghome.")); + assert!(PathBuf::from(result.stdout.trim()).is_dir()); +} From 091cdd6a8d7988733340f0b900c4c3b2e0f69882 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 11 Feb 2021 15:42:41 +0100 Subject: [PATCH 314/606] Extract the result of the GNU testsuite executions as a warning (#1718) --- .github/workflows/GNU.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 605603bf9..e3f34317e 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -76,8 +76,19 @@ jobs: BUILDDIR="${PWD}/uutils/target/release" GNULIB_DIR="${PWD}/gnulib" pushd gnu - + unbuffer timeout -sKILL 3600 make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : + - name: Extract tests info + shell: bash + run: | + TOTAL=$( grep "# TOTAL:" gnu/tests/test-suite.log|cut -d' ' -f2-) + PASS=$( grep "# PASS:" gnu/tests/test-suite.log|cut -d' ' -f2-) + SKIP=$( grep "# SKIP:" gnu/tests/test-suite.log|cut -d' ' -f2-) + FAIL=$( grep "# FAIL:" gnu/tests/test-suite.log|cut -d' ' -f2-) + XPASS=$( grep "# XPASS:" gnu/tests/test-suite.log|cut -d' ' -f2-) + ERROR=$( grep "# ERROR:" gnu/tests/test-suite.log|cut -d' ' -f2-) + echo "::warning ::GNU testsuite = $TOTAL / $PASS / $FAIL / $ERROR" + - uses: actions/upload-artifact@v2 with: name: test-report From 6c8af26e7fcf6032c03205caa89f44a699862227 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 11 Feb 2021 15:59:20 +0100 Subject: [PATCH 315/606] fix(cp) - make "cp /dev/null target" work (#1674) --- src/uu/cp/src/cp.rs | 10 ++++++++-- tests/by-util/test_cp.rs | 6 ------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 868c35f2d..d18edbc10 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -35,7 +35,6 @@ use std::ffi::CString; #[cfg(windows)] use std::ffi::OsStr; use std::fs; -#[cfg(target_os = "linux")] use std::fs::File; use std::fs::OpenOptions; use std::io; @@ -1233,7 +1232,14 @@ fn copy_helper(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> }; symlink_file(&link, &dest, &*context_for(&link, &dest))?; } else { - fs::copy(source, dest).context(&*context_for(source, dest))?; + if source.to_string_lossy() == "/dev/null" { + /* workaround a limitation of fs::copy + * https://github.com/rust-lang/rust/issues/79390 + */ + File::create(dest)?; + } else { + fs::copy(source, dest).context(&*context_for(source, dest))?; + } } Ok(()) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 9210e7d17..ccab0134b 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -911,14 +911,8 @@ fn test_cp_target_file_dev_null() { let file1 = "/dev/null"; let file2 = "test_cp_target_file_file_i2"; - at.touch(file1); at.touch(file2); - ucmd.arg(file1).arg(file2).fails(); - - /* Uncomment when fixed ucmd.arg(file1).arg(file2).succeeds().no_stderr(); - assert!(at.file_exists(file1)); assert!(at.file_exists(file2)); - */ } From 51383e10e65aa77c83c5789267977824e0ef9aee Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 11 Feb 2021 15:59:58 +0100 Subject: [PATCH 316/606] 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 --- src/uu/install/src/install.rs | 24 ++++++++++++++++++------ tests/by-util/test_install.rs | 8 -------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 3f3502cb6..b41b16ef6 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -17,6 +17,7 @@ use uucore::entries::{grp2gid, usr2uid}; use uucore::perms::{wrap_chgrp, wrap_chown, Verbosity}; use std::fs; +use std::fs::File; use std::os::unix::fs::MetadataExt; use std::path::{Path, PathBuf}; use std::result::Result; @@ -419,7 +420,7 @@ fn standard(paths: Vec, b: Behavior) -> i32 { /// fn copy_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behavior) -> i32 { if !target_dir.is_dir() { - show_error!("target ‘{}’ is not a directory", target_dir.display()); + show_error!("target '{}' is not a directory", target_dir.display()); return 1; } @@ -429,7 +430,7 @@ fn copy_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behavior) -> Some(name) => target_dir.join(name), None => { show_error!( - "cannot stat ‘{}’: No such file or directory", + "cannot stat '{}': No such file or directory", sourcepath.display() ); @@ -479,11 +480,22 @@ fn copy_file_to_file(file: &PathBuf, target: &PathBuf, b: &Behavior) -> i32 { /// If the copy system call fails, we print a verbose error and return an empty error value. /// fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { - let io_result = fs::copy(from, to); - - if let Err(err) = io_result { + if from.to_string_lossy() == "/dev/null" { + /* workaround a limitation of fs::copy + * https://github.com/rust-lang/rust/issues/79390 + */ + if let Err(err) = File::create(to) { + show_error!( + "install: cannot install '{}' to '{}': {}", + from.display(), + to.display(), + err + ); + return Err(()); + } + } else if let Err(err) = fs::copy(from, to) { show_error!( - "cannot install ‘{}’ to ‘{}’: {}", + "cannot install '{}' to '{}': {}", from.display(), to.display(), err diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 99e2abfd4..a04c0ddfc 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -330,14 +330,6 @@ fn test_install_target_file_dev_null() { let file1 = "/dev/null"; let file2 = "test_install_target_file_file_i2"; - at.touch(file1); - at.touch(file2); - ucmd.arg(file1).arg(file2).fails(); - - /* Uncomment when fixed ucmd.arg(file1).arg(file2).succeeds().no_stderr(); - - assert!(at.file_exists(file1)); assert!(at.file_exists(file2)); - */ } From 35a7f01d15b1cbe34ec52269e505a365bdbd0948 Mon Sep 17 00:00:00 2001 From: Felipe Lema <1232306+FelipeLema@users.noreply.github.com> Date: Thu, 11 Feb 2021 16:45:23 -0300 Subject: [PATCH 317/606] Refactor(split) - migrate from getopts to clap (#1712) --- src/uu/split/Cargo.toml | 2 +- src/uu/split/src/split.rs | 257 +++++++++++++++++++++--------------- tests/by-util/test_split.rs | 9 +- 3 files changed, 157 insertions(+), 111 deletions(-) diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index 618803d30..ad0fb3906 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/split.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 3f51d9447..851edc4b5 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -12,6 +12,7 @@ extern crate uucore; mod platform; +use clap::{App, Arg}; use std::char; use std::env; use std::fs::File; @@ -21,79 +22,117 @@ use std::path::Path; static NAME: &str = "split"; static VERSION: &str = env!("CARGO_PKG_VERSION"); -pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); +static OPT_BYTES: &str = "bytes"; +static OPT_LINE_BYTES: &str = "line-bytes"; +static OPT_LINES: &str = "lines"; +static OPT_ADDITIONAL_SUFFIX: &str = "additional-suffix"; +static OPT_FILTER: &str = "filter"; +static OPT_NUMERIC_SUFFIXES: &str = "numeric-suffixes"; +static OPT_SUFFIX_LENGTH: &str = "suffix-length"; +static OPT_DEFAULT_SUFFIX_LENGTH: usize = 2; +static OPT_VERBOSE: &str = "verbose"; - let mut opts = getopts::Options::new(); +static ARG_INPUT: &str = "input"; +static ARG_PREFIX: &str = "prefix"; - opts.optopt( - "a", - "suffix-length", - "use suffixes of length N (default 2)", - "N", - ); - opts.optopt("b", "bytes", "put SIZE bytes per output file", "SIZE"); - opts.optopt( - "C", - "line-bytes", - "put at most SIZE bytes of lines per output file", - "SIZE", - ); - opts.optflag( - "d", - "numeric-suffixes", - "use numeric suffixes instead of alphabetic", - ); - opts.optopt( - "", - "additional-suffix", - "additional suffix to append to output file names", - "SUFFIX", - ); - opts.optopt( - "", - "filter", - "write to shell COMMAND file name is $FILE (Currently not implemented for Windows)", - "COMMAND", - ); - opts.optopt("l", "lines", "put NUMBER lines per output file", "NUMBER"); - opts.optflag( - "", - "verbose", - "print a diagnostic just before each output file is opened", - ); - opts.optflag("h", "help", "display help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f), - }; - - if matches.opt_present("h") { - let msg = format!( - "{0} {1} - -Usage: - {0} [OPTION]... [INPUT [PREFIX]] +fn get_usage() -> String { + format!("{0} [OPTION]... [INPUT [PREFIX]]", NAME) +} +fn get_long_usage() -> String { + format!( + "Usage: + {0} Output fixed-size pieces of INPUT to PREFIXaa, PREFIX ab, ...; default size is 1000, and default PREFIX is 'x'. With no INPUT, or when INPUT is -, read standard input.", - NAME, VERSION - ); + get_usage() + ) +} - println!( - "{}\nSIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.", - opts.usage(&msg) - ); - return 0; - } +pub fn uumain(args: impl uucore::Args) -> i32 { + let usage = get_usage(); + let long_usage = get_long_usage(); + let default_suffix_length_str = OPT_DEFAULT_SUFFIX_LENGTH.to_string(); - if matches.opt_present("V") { - println!("{} {}", NAME, VERSION); - return 0; - } + let matches = App::new(executable!()) + .version(VERSION) + .about("Create output files containing consecutive or interleaved sections of input") + .usage(&usage[..]) + .after_help(&long_usage[..]) + // strategy (mutually exclusive) + .arg( + Arg::with_name(OPT_BYTES) + .short("b") + .long(OPT_BYTES) + .takes_value(true) + .default_value("2") + .help("use suffixes of length N (default 2)"), + ) + .arg( + Arg::with_name(OPT_LINE_BYTES) + .short("C") + .long(OPT_LINE_BYTES) + .takes_value(true) + .default_value("2") + .help("put at most SIZE bytes of lines per output file"), + ) + .arg( + Arg::with_name(OPT_LINES) + .short("l") + .long(OPT_LINES) + .takes_value(true) + .default_value("1000") + .help("write to shell COMMAND file name is $FILE (Currently not implemented for Windows)"), + ) + // rest of the arguments + .arg( + Arg::with_name(OPT_ADDITIONAL_SUFFIX) + .long(OPT_ADDITIONAL_SUFFIX) + .takes_value(true) + .default_value("") + .help("additional suffix to append to output file names"), + ) + .arg( + Arg::with_name(OPT_FILTER) + .long(OPT_FILTER) + .takes_value(true) + .help("write to shell COMMAND file name is $FILE (Currently not implemented for Windows)"), + ) + .arg( + Arg::with_name(OPT_NUMERIC_SUFFIXES) + .short("d") + .long(OPT_NUMERIC_SUFFIXES) + .takes_value(true) + .default_value("0") + .help("use numeric suffixes instead of alphabetic"), + ) + .arg( + Arg::with_name(OPT_SUFFIX_LENGTH) + .short("a") + .long(OPT_SUFFIX_LENGTH) + .takes_value(true) + .default_value(default_suffix_length_str.as_str()) + .help("use suffixes of length N (default 2)"), + ) + .arg( + Arg::with_name(OPT_VERBOSE) + .long(OPT_VERBOSE) + .help("print a diagnostic just before each output file is opened"), + ) + .arg( + Arg::with_name(ARG_INPUT) + .takes_value(true) + .default_value("-") + .index(1) + ) + .arg( + Arg::with_name(ARG_PREFIX) + .takes_value(true) + .default_value("x") + .index(2) + ) + .get_matches_from(args); let mut settings = Settings { prefix: "".to_owned(), @@ -107,53 +146,55 @@ size is 1000, and default PREFIX is 'x'. With no INPUT, or when INPUT is verbose: false, }; - settings.numeric_suffix = matches.opt_present("d"); + settings.suffix_length = matches + .value_of(OPT_SUFFIX_LENGTH) + .unwrap() + .parse() + .expect(format!("Invalid number for {}", OPT_SUFFIX_LENGTH).as_str()); - settings.suffix_length = match matches.opt_str("a") { - Some(n) => match n.parse() { - Ok(m) => m, - Err(e) => crash!(1, "cannot parse num: {}", e), - }, - None => 2, - }; + settings.numeric_suffix = matches.occurrences_of(OPT_NUMERIC_SUFFIXES) > 0; + settings.additional_suffix = matches.value_of(OPT_ADDITIONAL_SUFFIX).unwrap().to_owned(); - settings.additional_suffix = if matches.opt_present("additional-suffix") { - matches.opt_str("additional-suffix").unwrap() - } else { - "".to_owned() - }; + settings.verbose = matches.occurrences_of("verbose") > 0; + // check that the user is not specifying more than one strategy + // note: right now, this exact behaviour cannot be handled by ArgGroup since ArgGroup + // considers a default value Arg as "defined" + let explicit_strategies = + vec![OPT_LINE_BYTES, OPT_LINES, OPT_BYTES] + .into_iter() + .fold(0, |count, strat| { + if matches.occurrences_of(strat) > 0 { + count + 1 + } else { + count + } + }); + if explicit_strategies > 1 { + crash!(1, "cannot split in more than one way"); + } - settings.verbose = matches.opt_present("verbose"); - - settings.strategy = "l".to_owned(); - settings.strategy_param = "1000".to_owned(); - let strategies = vec!["b", "C", "l"]; - for e in &strategies { - if let Some(a) = matches.opt_str(*e) { - if settings.strategy == "l" { - settings.strategy = (*e).to_owned(); - settings.strategy_param = a; - } else { - crash!(1, "{}: cannot split in more than one way", NAME) - } + // default strategy (if no strategy is passed, use this one) + settings.strategy = String::from(OPT_LINES); + settings.strategy_param = matches.value_of(OPT_LINES).unwrap().to_owned(); + // take any (other) defined strategy + for strat in vec![OPT_LINE_BYTES, OPT_BYTES].into_iter() { + if matches.occurrences_of(strat) > 0 { + settings.strategy = String::from(strat); + settings.strategy_param = matches.value_of(strat).unwrap().to_owned(); } } - let mut v = matches.free.iter(); - let (input, prefix) = match (v.next(), v.next()) { - (Some(a), None) => (a.to_owned(), "x".to_owned()), - (Some(a), Some(b)) => (a.clone(), b.clone()), - (None, _) => ("-".to_owned(), "x".to_owned()), - }; - settings.input = input; - settings.prefix = prefix; + settings.input = matches.value_of(ARG_INPUT).unwrap().to_owned(); + settings.prefix = matches.value_of(ARG_PREFIX).unwrap().to_owned(); - settings.filter = matches.opt_str("filter"); - - if settings.filter.is_some() && cfg!(windows) { - // see https://github.com/rust-lang/rust/issues/29494 - show_error!("--filter is currently not supported in this platform"); - exit!(-1); + if matches.occurrences_of(OPT_FILTER) > 0 { + if cfg!(windows) { + // see https://github.com/rust-lang/rust/issues/29494 + show_error!("{} is currently not supported in this platform", OPT_FILTER); + exit!(-1); + } else { + settings.filter = Some(matches.value_of(OPT_FILTER).unwrap().to_owned()); + } } split(&settings) @@ -323,9 +364,9 @@ fn split(settings: &Settings) -> i32 { Box::new(r) as Box }); - let mut splitter: Box = match settings.strategy.as_ref() { - "l" => Box::new(LineSplitter::new(settings)), - "b" | "C" => Box::new(ByteSplitter::new(settings)), + let mut splitter: Box = match settings.strategy.as_str() { + s if s == OPT_LINES => Box::new(LineSplitter::new(settings)), + s if (s == OPT_BYTES || s == OPT_LINE_BYTES) => Box::new(ByteSplitter::new(settings)), a => crash!(1, "strategy {} not supported", a), }; diff --git a/tests/by-util/test_split.rs b/tests/by-util/test_split.rs index 88e97803c..521cbbe9a 100644 --- a/tests/by-util/test_split.rs +++ b/tests/by-util/test_split.rs @@ -112,12 +112,17 @@ fn test_split_default() { } #[test] -fn test_split_num_prefixed_chunks_by_bytes() { +fn test_split_numeric_prefixed_chunks_by_bytes() { let (at, mut ucmd) = at_and_ucmd!(); let name = "split_num_prefixed_chunks_by_bytes"; let glob = Glob::new(&at, ".", r"a\d\d$"); RandomFile::new(&at, name).add_bytes(10000); - ucmd.args(&["-d", "-b", "1000", name, "a"]).succeeds(); + ucmd.args(&[ + "-d", // --numeric-suffixes + "-b", // --bytes + "1000", name, "a", + ]) + .succeeds(); assert_eq!(glob.count(), 10); assert_eq!(glob.collate(), at.read(name).into_bytes()); } From 9081e120d6b866c94679d9e29c7bdb17ccccb4d0 Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Thu, 11 Feb 2021 17:58:26 -0500 Subject: [PATCH 318/606] numfmt: replace getopts with clap (#1717) --- src/uu/numfmt/Cargo.toml | 2 +- src/uu/numfmt/src/numfmt.rs | 209 +++++++++++++++++++----------------- 2 files changed, 110 insertions(+), 101 deletions(-) diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index 22cf5acc9..65f3570e9 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/numfmt.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index 2099391b0..35584849b 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -5,12 +5,50 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -use getopts::{Matches, Options}; use std::fmt; use std::io::BufRead; -static NAME: &str = "numfmt"; +#[macro_use] +extern crate uucore; + +use clap::{App, Arg, ArgMatches}; + static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Convert numbers from/to human-readable strings"; +static LONG_HELP: &str = "UNIT options: + none no auto-scaling is done; suffixes will trigger an error + + auto accept optional single/two letter suffix: + + 1K = 1000, 1Ki = 1024, 1M = 1000000, 1Mi = 1048576, + + si accept optional single letter suffix: + + 1K = 1000, 1M = 1000000, ... + + iec accept optional single letter suffix: + + 1K = 1024, 1M = 1048576, ... + + iec-i accept optional two-letter suffix: + + 1Ki = 1024, 1Mi = 1048576, ... +"; + +mod options { + pub const FROM: &str = "from"; + pub const FROM_DEFAULT: &str = "none"; + pub const HEADER: &str = "header"; + pub const HEADER_DEFAULT: &str = "1"; + pub const NUMBER: &str = "NUMBER"; + pub const PADDING: &str = "padding"; + pub const TO: &str = "to"; + pub const TO_DEFAULT: &str = "none"; +} + +fn get_usage() -> String { + format!("{0} [OPTION]... [NUMBER]...", executable!()) +} const IEC_BASES: [f64; 10] = [ //premature optimization @@ -72,7 +110,7 @@ impl fmt::Display for DisplayableSuffix { } } -fn parse_suffix(s: String) -> Result<(f64, Option)> { +fn parse_suffix(s: &str) -> Result<(f64, Option)> { let with_i = s.ends_with('i'); let mut iter = s.chars(); if with_i { @@ -104,8 +142,8 @@ fn parse_suffix(s: String) -> Result<(f64, Option)> { Ok((number, suffix)) } -fn parse_unit(s: String) -> Result { - match &s[..] { +fn parse_unit(s: &str) -> Result { + match s { "auto" => Ok(Unit::Auto), "si" => Ok(Unit::Si), "iec" => Ok(Unit::Iec(false)), @@ -161,7 +199,7 @@ fn remove_suffix(i: f64, s: Option, u: &Unit) -> Result { } } -fn transform_from(s: String, opts: &Transform) -> Result { +fn transform_from(s: &str, opts: &Transform) -> Result { let (i, suffix) = parse_suffix(s)?; remove_suffix(i, suffix, &opts.unit).map(|n| n.round()) } @@ -206,7 +244,7 @@ fn transform_to(s: f64, opts: &Transform) -> Result { }) } -fn format_string(source: String, options: &NumfmtOptions) -> Result { +fn format_string(source: &str, options: &NumfmtOptions) -> Result { let number = transform_to( transform_from(source, &options.transform.from)?, &options.transform.to, @@ -219,30 +257,27 @@ fn format_string(source: String, options: &NumfmtOptions) -> Result { }) } -fn parse_options(args: &Matches) -> Result { +fn parse_options(args: &ArgMatches) -> Result { + let from = parse_unit(args.value_of(options::FROM).unwrap())?; + let to = parse_unit(args.value_of(options::TO).unwrap())?; + let transform = TransformOptions { - from: Transform { - unit: args - .opt_str("from") - .map(parse_unit) - .unwrap_or(Ok(Unit::None))?, - }, - to: Transform { - unit: args - .opt_str("to") - .map(parse_unit) - .unwrap_or(Ok(Unit::None))?, - }, + from: Transform { unit: from }, + to: Transform { unit: to }, }; - let padding = match args.opt_str("padding") { + let padding = match args.value_of(options::PADDING) { Some(s) => s.parse::().map_err(|err| err.to_string()), None => Ok(0), }?; - let header = match args.opt_default("header", "1") { - Some(s) => s.parse::().map_err(|err| err.to_string()), - None => Ok(0), + let header = match args.occurrences_of(options::HEADER) { + 0 => Ok(0), + _ => args + .value_of(options::HEADER) + .unwrap() + .parse::() + .map_err(|err| err.to_string()), }?; Ok(NumfmtOptions { @@ -252,9 +287,9 @@ fn parse_options(args: &Matches) -> Result { }) } -fn handle_args(args: &[String], options: NumfmtOptions) -> Result<()> { +fn handle_args<'a>(args: impl Iterator, options: NumfmtOptions) -> Result<()> { for l in args { - println!("{}", format_string(l.clone(), &options)?) + println!("{}", format_string(l, &options)?) } Ok(()) } @@ -270,7 +305,7 @@ fn handle_stdin(options: NumfmtOptions) -> Result<()> { for l in lines { l.map_err(|e| e.to_string()).and_then(|l| { - let l = format_string(l, &options)?; + let l = format_string(l.as_ref(), &options)?; println!("{}", l); Ok(()) })? @@ -279,83 +314,57 @@ fn handle_stdin(options: NumfmtOptions) -> Result<()> { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = Options::new(); - - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - opts.optopt( - "", - "from", - "auto-scale input numbers to UNITs; default is 'none'; see UNIT above", - "UNIT", - ); - opts.optopt( - "", - "to", - "auto-scale output numbers to UNITs; see Unit above", - "UNIT", - ); - opts.optopt( - "", - "padding", - "pad the output to N characters; positive N will right-align; negative N will left-align; padding is ignored if the output is wider than N", - "N" - ); - opts.optflagopt( - "", - "header", - "print (without converting) the first N header lines; N defaults to 1 if not specified", - "N", - ); - - let matches = opts.parse(&args[1..]).unwrap(); - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage:"); - println!(" {0} [STRING]... [OPTION]...", NAME); - println!(); - print!( - "{}", - opts.usage("Convert numbers from/to human-readable strings") - ); - println!( - "UNIT options: - none no auto-scaling is done; suffixes will trigger an error - - auto accept optional single/two letter suffix: - - 1K = 1000, 1Ki = 1024, 1M = 1000000, 1Mi = 1048576, - - si accept optional single letter suffix: - - 1K = 1000, 1M = 1000000, ... - - iec accept optional single letter suffix: - - 1K = 1024, 1M = 1048576, ... - - iec-i accept optional two-letter suffix: - - 1Ki = 1024, 1Mi = 1048576, ..." - ); - - return 0; - } - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::FROM) + .long(options::FROM) + .help("auto-scale input numbers to UNITs; see UNIT below") + .value_name("UNIT") + .default_value(options::FROM_DEFAULT) + ) + .arg( + Arg::with_name(options::TO) + .long(options::TO) + .help("auto-scale output numbers to UNITs; see UNIT below") + .value_name("UNIT") + .default_value(options::TO_DEFAULT) + ) + .arg( + Arg::with_name(options::PADDING) + .long(options::PADDING) + .help("pad the output to N characters; positive N will right-align; negative N will left-align; padding is ignored if the output is wider than N") + .value_name("N") + ) + .arg( + Arg::with_name(options::HEADER) + .long(options::HEADER) + .help("print (without converting) the first N header lines; N defaults to 1 if not specified") + .value_name("N") + .default_value(options::HEADER_DEFAULT) + .hide_default_value(true) + ) + .arg( + Arg::with_name(options::NUMBER) + .hidden(true) + .multiple(true) + ) + .get_matches_from(args); let options = parse_options(&matches).unwrap(); - if matches.free.is_empty() { - handle_stdin(options).unwrap() - } else { - handle_args(&matches.free, options).unwrap() + let result = match matches.values_of(options::NUMBER) { + Some(values) => handle_args(values, options), + None => handle_stdin(options), }; - 0 + match result { + Err(e) => crash!(1, "{}", e), + _ => 0, + } } From 158754f4ab4b2607eed8ac835fc911fa139bee45 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 12 Feb 2021 11:36:50 +0100 Subject: [PATCH 319/606] Fix the min rust version (#1720) --- Cargo.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 10c5d787b..398cdce26 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -97,7 +97,7 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -410,7 +410,7 @@ dependencies = [ "serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -471,7 +471,7 @@ name = "csv" version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bstr 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -910,7 +910,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "quote" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1132,13 +1132,13 @@ version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.61" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1193,7 +1193,7 @@ version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1273,7 +1273,7 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1301,7 +1301,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1866,7 +1866,7 @@ dependencies = [ name = "uu_numfmt" version = "0.0.3" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2055,7 +2055,7 @@ dependencies = [ name = "uu_split" version = "0.0.3" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2340,7 +2340,7 @@ name = "uucore_procs" version = "0.0.5" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2387,7 +2387,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2397,7 +2397,7 @@ name = "wasm-bindgen-macro" version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-macro-support 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2407,7 +2407,7 @@ version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2494,7 +2494,7 @@ dependencies = [ "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" -"checksum bstr 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "473fc6b38233f9af7baa94fb5852dca389e3d95b8e21c8e3719301462c5d9faf" +"checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" "checksum bumpalo 3.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "099e596ef14349721d9016f6b80dd3419ea1bf289ab9b44df8e4dfd3a005d5d9" "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" @@ -2583,7 +2583,7 @@ dependencies = [ "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" "checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum quote 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" +"checksum quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" "checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" "checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" "checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" @@ -2612,7 +2612,7 @@ dependencies = [ "checksum serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)" = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" "checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" "checksum serde_derive 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)" = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" -"checksum serde_json 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)" = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" +"checksum serde_json 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" From 26aa1f346e3fe1d366496007dc935abd4d661462 Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Sat, 19 Dec 2020 17:08:37 -0800 Subject: [PATCH 320/606] 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. --- src/uu/ls/src/ls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 6c4ba38b1..9ce7ee818 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -622,7 +622,7 @@ fn display_file_name( let mut width = UnicodeWidthStr::width(&*name); let color = match options.opt_str("color") { - None => true, + None => stdout_isatty(), Some(val) => match val.as_ref() { "always" | "yes" | "force" => true, "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout), From bd6b958655c8ee5381f14dd2be7c8b3acd86fd15 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 11 Feb 2021 16:00:26 +0100 Subject: [PATCH 321/606] Moved to atty --- src/uu/ls/src/ls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 9ce7ee818..b8defa397 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -622,7 +622,7 @@ fn display_file_name( let mut width = UnicodeWidthStr::width(&*name); let color = match options.opt_str("color") { - None => stdout_isatty(), + None => atty::is(atty::Stream::Stdout), Some(val) => match val.as_ref() { "always" | "yes" | "force" => true, "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout), From 842b6dd75f26a8daada0972257a87d87f5db9224 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 11 Feb 2021 22:21:34 +0100 Subject: [PATCH 322/606] Remove tests checking for --version & --help Not really interesting for us and logs are too big --- .github/workflows/GNU.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index e3f34317e..b1cbc1502 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -43,7 +43,7 @@ jobs: pushd gnu/ ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" ./configure --quiet --disable-gcc-warnings - # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils + # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile sed -i 's| tr | /usr/bin/tr |' tests/init.sh make @@ -66,6 +66,12 @@ jobs: sed -i -e '/tests\/misc\/seq.pl/ D' \ -e '/tests\/misc\/seq-precision.sh/D' \ Makefile + # Remove tests checking for --version & --help + # Not really interesting for us and logs are too big + sed -i -e '/tests\/misc\/invalid-opt.pl/ D' \ + -e '/tests\/misc\/help-version.sh/ D' \ + -e '/tests\/misc\/help-version-getopt.sh/ D' \ + Makefile sed -i -e '/tests\/tail-2\/pid.sh/ D' Makefile # hangs on github, tail doesn't support -f sed -i -e'/incompat4/ D' -e"/options '-co' are incompatible/ d" tests/misc/sort.pl # Sort doesn't correctly check for incompatible options, waits for input From f8006f47df1b8acf75364d3260d95361e192af01 Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Sun, 14 Feb 2021 03:04:29 -0500 Subject: [PATCH 323/606] numfmt: handle leading whitespace & implied padding (#1721) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/uu/numfmt/src/numfmt.rs | 116 ++++++++++++++++++++++++++++------- tests/by-util/test_numfmt.rs | 111 +++++++++++++++++++++++++++++++++ 2 files changed, 204 insertions(+), 23 deletions(-) diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index 35584849b..3865619ea 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -126,7 +126,7 @@ fn parse_suffix(s: &str) -> Result<(f64, Option)> { Some('Z') => Ok(Some((RawSuffix::Z, with_i))), Some('Y') => Ok(Some((RawSuffix::Y, with_i))), Some('0'..='9') => Ok(None), - _ => Err("Failed to parse suffix"), + _ => Err(format!("invalid suffix in input: ‘{}’", s)), }?; let suffix_len = match suffix { @@ -137,7 +137,7 @@ fn parse_suffix(s: &str) -> Result<(f64, Option)> { let number = s[..s.len() - suffix_len] .parse::() - .map_err(|err| err.to_string())?; + .map_err(|_| format!("invalid number: ‘{}’", s))?; Ok((number, suffix)) } @@ -244,19 +244,37 @@ fn transform_to(s: f64, opts: &Transform) -> Result { }) } -fn format_string(source: &str, options: &NumfmtOptions) -> Result { +fn format_string( + source: &str, + options: &NumfmtOptions, + implicit_padding: Option, +) -> Result { let number = transform_to( transform_from(source, &options.transform.from)?, &options.transform.to, )?; - Ok(match options.padding { + Ok(match implicit_padding.unwrap_or(options.padding) { p if p == 0 => number, p if p > 0 => format!("{:>padding$}", number, padding = p as usize), p => format!("{: Result<()> { + let (prefix, field, suffix) = extract_field(&s)?; + + let implicit_padding = match !prefix.is_empty() && options.padding == 0 { + true => Some((prefix.len() + field.len()) as isize), + false => None, + }; + + let field = format_string(field, options, implicit_padding)?; + println!("{}{}", field, suffix); + + Ok(()) +} + fn parse_options(args: &ArgMatches) -> Result { let from = parse_unit(args.value_of(options::FROM).unwrap())?; let to = parse_unit(args.value_of(options::TO).unwrap())?; @@ -287,10 +305,57 @@ fn parse_options(args: &ArgMatches) -> Result { }) } +/// Extract the field to convert from `line`. +/// +/// The field is the first sequence of non-whitespace characters in `line`. +/// +/// Returns a [`Result`] of `(prefix: &str, field: &str, suffix: &str)`, where +/// `prefix` contains any leading whitespace, `field` is the field to convert, +/// and `suffix` is everything after the field. `prefix` and `suffix` may be +/// empty. +/// +/// Returns an [`Err`] if `line` is empty or consists only of whitespace. +/// +/// Examples: +/// +/// ``` +/// use uu_numfmt::extract_field; +/// +/// assert_eq!("1K", extract_field("1K").unwrap().1); +/// +/// let (prefix, field, suffix) = extract_field(" 1K qux").unwrap(); +/// assert_eq!(" ", prefix); +/// assert_eq!("1K", field); +/// assert_eq!(" qux", suffix); +/// +/// assert!(extract_field("").is_err()); +/// ``` +pub fn extract_field(line: &str) -> Result<(&str, &str, &str)> { + let start = line + .find(|c: char| !c.is_whitespace()) + .ok_or("invalid number: ‘’")?; + + let prefix = &line[..start]; + + let mut field = &line[start..]; + + let suffix = match field.find(|c: char| c.is_whitespace()) { + Some(i) => { + let suffix = &field[i..]; + field = &field[..i]; + suffix + } + None => "", + }; + + Ok((prefix, field, suffix)) +} + fn handle_args<'a>(args: impl Iterator, options: NumfmtOptions) -> Result<()> { for l in args { - println!("{}", format_string(l, &options)?) + format_and_print(l, &options)?; } + Ok(()) } @@ -300,16 +365,14 @@ fn handle_stdin(options: NumfmtOptions) -> Result<()> { let mut lines = locked_stdin.lines(); for l in lines.by_ref().take(options.header) { - l.map(|s| println!("{}", s)).map_err(|e| e.to_string())? + l.map(|s| println!("{}", s)).map_err(|e| e.to_string())?; } for l in lines { - l.map_err(|e| e.to_string()).and_then(|l| { - let l = format_string(l.as_ref(), &options)?; - println!("{}", l); - Ok(()) - })? + l.map_err(|e| e.to_string()) + .and_then(|l| format_and_print(&l, &options))?; } + Ok(()) } @@ -326,34 +389,38 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::FROM) .help("auto-scale input numbers to UNITs; see UNIT below") .value_name("UNIT") - .default_value(options::FROM_DEFAULT) + .default_value(options::FROM_DEFAULT), ) .arg( Arg::with_name(options::TO) .long(options::TO) .help("auto-scale output numbers to UNITs; see UNIT below") .value_name("UNIT") - .default_value(options::TO_DEFAULT) + .default_value(options::TO_DEFAULT), ) .arg( Arg::with_name(options::PADDING) .long(options::PADDING) - .help("pad the output to N characters; positive N will right-align; negative N will left-align; padding is ignored if the output is wider than N") - .value_name("N") + .help( + "pad the output to N characters; positive N will \ + right-align; negative N will left-align; padding is \ + ignored if the output is wider than N; the default is \ + to automatically pad if a whitespace is found", + ) + .value_name("N"), ) .arg( Arg::with_name(options::HEADER) .long(options::HEADER) - .help("print (without converting) the first N header lines; N defaults to 1 if not specified") + .help( + "print (without converting) the first N header lines; \ + N defaults to 1 if not specified", + ) .value_name("N") .default_value(options::HEADER_DEFAULT) - .hide_default_value(true) - ) - .arg( - Arg::with_name(options::NUMBER) - .hidden(true) - .multiple(true) + .hide_default_value(true), ) + .arg(Arg::with_name(options::NUMBER).hidden(true).multiple(true)) .get_matches_from(args); let options = parse_options(&matches).unwrap(); @@ -364,7 +431,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; match result { - Err(e) => crash!(1, "{}", e), + Err(e) => { + show_info!("{}", e); + exit!(1); + } _ => 0, } } diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index 3aa7ab53b..625da766b 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -145,3 +145,114 @@ fn test_si_to_iec() { .run() .stdout_is("13.9T\n"); } + +#[test] +fn test_should_report_invalid_empty_number_on_empty_stdin() { + new_ucmd!() + .args(&["--from=auto"]) + .pipe_in("\n") + .run() + .stderr_is("numfmt: invalid number: ‘’\n"); +} + +#[test] +fn test_should_report_invalid_empty_number_on_blank_stdin() { + new_ucmd!() + .args(&["--from=auto"]) + .pipe_in(" \t \n") + .run() + .stderr_is("numfmt: invalid number: ‘’\n"); +} + +#[test] +fn test_should_report_invalid_suffix_on_stdin() { + new_ucmd!() + .args(&["--from=auto"]) + .pipe_in("1k") + .run() + .stderr_is("numfmt: invalid suffix in input: ‘1k’\n"); + + // GNU numfmt reports this one as “invalid number” + new_ucmd!() + .args(&["--from=auto"]) + .pipe_in("NaN") + .run() + .stderr_is("numfmt: invalid suffix in input: ‘NaN’\n"); +} + +#[test] +fn test_should_report_invalid_number_with_interior_junk() { + // GNU numfmt reports this as “invalid suffix” + new_ucmd!() + .args(&["--from=auto"]) + .pipe_in("1x0K") + .run() + .stderr_is("numfmt: invalid number: ‘1x0K’\n"); +} + +#[test] +fn test_should_skip_leading_space_from_stdin() { + new_ucmd!() + .args(&["--from=auto"]) + .pipe_in(" 2Ki") + .run() + .stdout_is("2048\n"); + + // multiline + new_ucmd!() + .args(&["--from=auto"]) + .pipe_in("\t1Ki\n 2K") + .run() + .stdout_is("1024\n2000\n"); +} + +#[test] +fn test_should_convert_only_first_number_in_line() { + new_ucmd!() + .args(&["--from=auto"]) + .pipe_in("1Ki 2M 3G") + .run() + .stdout_is("1024 2M 3G\n"); +} + +#[test] +fn test_leading_whitespace_should_imply_padding() { + new_ucmd!() + .args(&["--from=auto"]) + .pipe_in(" 1K") + .run() + .stdout_is(" 1000\n"); + + + new_ucmd!() + .args(&["--from=auto"]) + .pipe_in(" 202Ki") + .run() + .stdout_is(" 206848\n"); +} + +#[test] +fn test_should_calculate_implicit_padding_per_line() { + new_ucmd!() + .args(&["--from=auto"]) + .pipe_in(" 1Ki\n 2K") + .run() + .stdout_is(" 1024\n 2000\n"); +} + +#[test] +fn test_leading_whitespace_in_free_argument_should_imply_padding() { + new_ucmd!() + .args(&["--from=auto", " 1Ki"]) + .run() + .stdout_is(" 1024\n"); +} + +#[test] +fn test_should_calculate_implicit_padding_per_free_argument() { + new_ucmd!() + .args(&["--from=auto", " 1Ki", " 2K"]) + .pipe_in(" 1Ki\n 2K") + .run() + .stdout_is(" 1024\n 2000\n"); +} From f595164063f161ae75c844bc6fd876f1f4174a35 Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Sun, 14 Feb 2021 18:25:28 -0500 Subject: [PATCH 324/606] 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 --- src/uu/numfmt/src/numfmt.rs | 30 ++++++++++++++++++------------ tests/by-util/test_numfmt.rs | 24 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index 3865619ea..4d3b7387a 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -291,11 +291,18 @@ fn parse_options(args: &ArgMatches) -> Result { let header = match args.occurrences_of(options::HEADER) { 0 => Ok(0), - _ => args - .value_of(options::HEADER) - .unwrap() - .parse::() - .map_err(|err| err.to_string()), + _ => { + let value = args.value_of(options::HEADER).unwrap(); + + value + .parse::() + .map_err(|_| value) + .and_then(|n| match n { + 0 => Err(value), + _ => Ok(n), + }) + .map_err(|value| format!("invalid header value ‘{}’", value)) + } }?; Ok(NumfmtOptions { @@ -423,17 +430,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg(Arg::with_name(options::NUMBER).hidden(true).multiple(true)) .get_matches_from(args); - let options = parse_options(&matches).unwrap(); - - let result = match matches.values_of(options::NUMBER) { - Some(values) => handle_args(values, options), - None => handle_stdin(options), - }; + let result = + parse_options(&matches).and_then(|options| match matches.values_of(options::NUMBER) { + Some(values) => handle_args(values, options), + None => handle_stdin(options), + }); match result { Err(e) => { show_info!("{}", e); - exit!(1); + 1 } _ => 0, } diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index 625da766b..61667f310 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -107,6 +107,30 @@ fn test_header_default() { .stdout_is("header\n1000\n1100000\n100000000\n"); } +#[test] +fn test_header_error_if_non_numeric() { + new_ucmd!() + .args(&["--header=two"]) + .run() + .stderr_is("numfmt: invalid header value ‘two’"); +} + +#[test] +fn test_header_error_if_0() { + new_ucmd!() + .args(&["--header=0"]) + .run() + .stderr_is("numfmt: invalid header value ‘0’"); +} + +#[test] +fn test_header_error_if_negative() { + new_ucmd!() + .args(&["--header=-3"]) + .run() + .stderr_is("numfmt: invalid header value ‘-3’"); +} + #[test] fn test_negative() { new_ucmd!() From 05d8cc59c4dfdb724d84317e8539ca6b1285ae04 Mon Sep 17 00:00:00 2001 From: Chad Brewbaker Date: Tue, 16 Feb 2021 06:36:49 -0600 Subject: [PATCH 325/606] bug(wc): Add a test for unexpected behavior (#1723) --- tests/by-util/test_wc.rs | 11 +++++++++++ tests/fixtures/wc/UTF_8_test.txt | Bin 0 -> 22781 bytes 2 files changed, 11 insertions(+) create mode 100644 tests/fixtures/wc/UTF_8_test.txt diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index a0fe8889b..fc9c00ecc 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -8,6 +8,17 @@ fn test_stdin_default() { .stdout_is(" 13 109 772\n"); } +#[test] +fn test_utf8() { + new_ucmd!() + .args(&["-lwmcL"]) + .pipe_in_fixture("UTF_8_test.txt") + .run() + .stdout_is(" 0 0 0 0 0\n"); + // GNU returns " 300 2086 22219 22781 79" + // TODO: we should fix that to match GNU's behavior +} + #[test] fn test_stdin_line_len_regression() { new_ucmd!() diff --git a/tests/fixtures/wc/UTF_8_test.txt b/tests/fixtures/wc/UTF_8_test.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5b5d50e6b61eb9a3b751b3954f83e61bb59db9b GIT binary patch literal 22781 zcmWFyanrR>NJ&l3Pf0CONKPzBOv=p3EU8pT%u7)yE-6YaE>EiU2GB@%FP`6d=+ zmli8{muBQC*kqKH6j(}L`XB(O7+bQTO7#SFv>Ka(+ z8d)glDmXhUI7KR$=oxTvg=Azx>{dw2%t=*9PRvutNX;owsLU@_NUccB&CE;HQOL+I z2MH7@pn4=DF)t-2wV10cu_!aYv{<2}vLLlsAwNwaIlrhVHMvAbAvZB6Ex#x?HAP1u zzepj!BqOz`JhM1eAv3QewJ5c?Br`7^VkTE{YGG+=UUF)&o&wlOVAo_8E9B*uDCDLl z=9MUvtqKspMkWvO`zB^mjp=@}sX3MHu(5bG6+OViU+i%S#|xeAI>(^88PlX6nwk)D*A zkyw_QUs|M)SfWszpPQ;skdp}Zu4hTHLSkmFLT0g!LS|lZNorz>4#*|&Xei0Z%*$3t zOv*1U(E+CzP*MRqUIAfhej2tI%Fk0sTF!EGjP1Ey>JH zRY)u?$;dAP$2dyDC{{?z%u4}zG$%E&xI`g8FO{n}6_Q2@it>|kQganDL4lZ>Sp*ND z(qd3z0Eadx?)5-P6B5A+IhlE>#R^HOIr-%Z$@yieMG8szrFkidMU|k$kdg`VPcc$r zLr+pV3W>!E<*7M2AR3xBb1D^5^FaAA1)^F3o&Z516PlL^l2ZT?Tm|`=c_qaP;2iHTwb7d>-uyc+2lC+jFADx{>AWhSR`6{RMpW|o1pLqfMWBQXaQStY4O1x2YP z3W*9z@cadLKFB#G8L0}ziMgquG!2Ql%o0eJ1L-RU<)MtkqQvBq)FOzlGK)dkqc}4q z6`Z6KQ}PQ+Qd1O)OOuLIOO!xv<5Eh7X@Q1BVo@qMbCzd<(kB*u3J~`ufpU9FW^!Ul zY6@3LK3HLCacYs0LQL`?FWF}`QsfnO$U6u*Tb2*g?DVgB%uQanbLm?5j zv(t+5b3ri%DN=JPx!}nbmPTO_1CPtB(&7?u+$5GIX6As4AxL&pNG>fZO3f?bO3TkH zQAjE+K`N5dN^^256>?J36LU}tIi!ROE@t!8OSp0q^HLH^K&d6OSWm$-4;=EziN&cp z3Si4K)ARC+Kq(h9ffg&|7jc#5A)E$}hGMYsV24A?cu<)Sw_Zn~JToUpAvZBQl`ADR zsWd$uY(aieszOR;S{kUBhnA0^N-QTeF$JU@l+-|_L|SQaW`3R?7gqqNOiEQq&PYwp z2E}(Os1m>z0hz@L8itynG**;aoSFy97>OlZi8(ns3K~YJ;z^aDIy1Q>rxH}=DS%3} zoK%obP*IPb=JJcUQVUBn%Mx=yiLp2{Jufjw6H>ry7;A#_Nm_nRPJTJan}wzMC5fPN z4xH)~64O9=H!+VZGY1@F=xIH(7*+>E5?Vn{VkM{&&eTiQQz$6PFGwxoDoQP`%uCKF z%FoNJf*4(rn4MY-sh1Qob8}NuG80Qub1LDsA!ROjeGRHlGeHG@4yeqjELKno@o-ge z^>a~zl|(t9Dgac3>ws#NOmID=kdhBdM#ZV1B$Qa91F5^9xmqE)D6u#LRQ}}Wrh=Lt zNzm#Vk~yJ8aAHn*VkM|n;7U#`ElyQP%P#`Ob8>1CD3%>_a-h`)IOW4!2r9HvD-yvm zWNwKl0g4rJ^7GOaGzxM+&6tc-uwJgT)YKGBNb*jB)G|5>pduLLnPP?1yc7jc;isTf zqokvdT9KSuPy%)ZsQ4`@&j&Y7xFBkc^bGY3LFK4|k)DyBAt>E}%9-T+ypqJsJcYdc zJl%q#%)AnCUUdw1_Vfh#rKBi7ru{B1q!y=wT#D>xct}FRN};p>6lcl#IiJ57Jgl1SQF0P=tZ97pN(sP*|FooSjn%@)aaERf5_%C?z$xMF6TfQn{cN zutHvGZc=IysJ2Ba0W$MI4XmO{a0GzbIEf{oGQKx5ZpbaHV8^IM5S4JwR6$z?bixm=c zit`l`6$(;|(o(_cD=`_ABET`K0cz)G=0Vzh#hE3g;QUq$@@gJZV^LF~I6tQpoXa7V z8l=Ec0Qp)WGcP5xEHeevUQ4PhNd<))Qmp~ckFX?wwW5Qk97w?eNjSwNMTsS;>6HqZ zd0gO#gJwfe=%?l>6hO*LaET7etbSaskRq`vzi^Gg+=84*$(rYg7>rKV;pl;;H+~5*U0aWc5<8})+85+1x&rm_Z4b(MJ zD9A4^&IEP6;4Q!WG*AO7wFq3+=A`DOmt3Z_N!HU=ecNTKaw?&hXotB{(aV40?nl%`;-p!9Y=(SZl{ z2-wG<1P(FL71X}BRY*-$urL52TLq}?AJkUPJSP$Phh z1Ur^$L=Bg*f`Tt>)EYjjMq>L0;T-CxMMz4_ORXqKO$LocfclV`d5|6jv<^d9Pmo1@ z_ql=w>Pqpr57ydEN>wOMEl31)K5{A*Ambl7pwT|i$Q#VzHCTFkpsr75NwGqHd7d6j z9kDd^{c8;F+C$r(7?Gi1P+?(UrJzJ?Bd3N7WFD-t2M+?EM6QBCMN*oTf)cUi4Q>2u z3~G5|__Y}1PhuSgjWCFRO+XD#9Oe-lau5R{=9z+;ow&>+$%PQ}%s_2UoaT|@LWp_h zp!Ozi^GI+Z#5@ZH1#`@_0*Q}?{SEtxcOh-ki=~1>Fl-ne)EUdkQ7|(>bks0ILO}zR zZ*)P49npXU#W3~Vr=Xyq)X><}+|t_C-qG3B-P7CG53-3o3~}FtiIXNznL2IyjG41$ z&zU=KK6z$=bV1BpuyE1hB}NRWEtp~}Fhau)|*tlu)maW^i@7TF(_ny7` zNJww!wnEH97bTw$O3$FuFFy}7@LXJyScEiBLq;u36Ze7If}jCrVLM!ZU^E3NI91D!fv7t?)+St-?En_X8du#tI6c_^?2a z4ihZVkp_y6G;{3P4KegFsPo$gg^voK6h13_QTVFxP2oEU;g6oYX_G%pAn{>>9v`OI z;=@AMpdu}4NXN$yg`Wz)6n;|>53qQlO?;R_;sc{PGQ$=h$)Na18Pf6bN8v9O;sO*W zw1^L5L~FMgG93q=0>^0OD&%GsgO&(@+<^;I-+iEh6x2v526dys>spfYa|?1(OF-Rm z$QnH49y)kg0=!!ea&As4l4G&;&vg_)%M8GC`Y@9~Gh5*GJfNjAdFg12B2dhOPX>eL zqQRwfej0c&L>_3NouL7E(y3TaLBkog?xh&CtP3=|3RzF3V5EsKkow_gtOp)}L2KzD z#WN^y;ZdsrnzDyaB`6(0Z`pv_8^)ma23pI4Nb??G^z0x88Y?KE)r~|N_yKd=5n`f= zf&yCUPNa!HuuPmlj5JkHKr5h#H1ZF&$ry;4W(w$SaNK4>rr;oR3QG5}$Bemx0?{!8 zHV-sTs%fR5^d6&A1#zGS2{EH0E3fcTiv zMVe1g0#77hnu*Ad)L?$~Ed+#xRSkS`2WYtyXf+sou#~7iAbnm${UKZkT0#j*fQU75iO9>`LB(E9Y6)n0YJM8Rtu>$(hzhV}^+tLI z3dJR$HN-_JdI}!-<)G#C;Pqye3Lx`AfdXEeo|>nSmztbfTnt+44_ZVAGqHvXea$^& zS#%L-wIIlO;AM)b;3dEXMfoYEpv@u~skwRzjtWY}iD{|O6|)HQpsU`LU`^Jd)U4Fx z5>U%C7qX@qybv7WYea~ER-S_LC(JAmUBgwBnpm8lS8N4dJnUHl-c?f!T3QHRy9`>> zo&#DGpP8RmtdNx0@`?oB$*WOT2lqkVqXOfA2&^faTxAGn#=lTm_j0sUSo26x<*?2#QmaON&68 z&cORwK)t`R%+zun1!(By=N2TEWJ33)<)>lf4@7zgZO4MFcZEhJ)C73=gY&Q!D0;L& z>!tI{A^8y5)1dqTO(T%uZipF>Dh}$QqQt!PR0V?y1JH<`d77R=NWMa9UU6v=XsKx? zJSl^MPoah@u^2QV4)PYnC{SAv?jaq}dR<6@LC*cqa4ZJx@=7cL8w4dl?gQt4c)ofD;s`x=yXgEC%hUf|^E)bqXe++Sj!r5!81F=di>)L?HqV z0$7Z|oq>}<{rV$3vjnuS1vAw`*3d&c^^h44P>`j8R$jwH8{MIx_<*JtL{SH-YtVgK zoRe6bp`f9pucQfz7SLv`B+wQNP-Ld2z>NjvU(miDq~vcAy( zx(3q#x&{-j8dOFQw-^&*BJzq!kP|^=1Z;gH#86NfLF6h&h>@@*lc146u#pxD7Um$2 zCxH!yl#D;xiCo1CF%z<85;}GVS~HofU}20f6S4~RPcvv4FEJ%9EutH=f*01Gh36A+ zT@7lJfij9;sE-0XMMDA?2T6VRq4s9MnG2S&i(z>Syn_o*zCt**2D%LyVFaje3LVFT zb{t@RHE`wxc^}eJ0R;lWASkPb3mz`SJNq`J2-K&S#`Wz5+Kgghz>Vj?IzL$*uWDuA*w*p+ZYL0K8g zYy_%72p+^pPQ7Yu@nL(Iaz`OaN zxg}H^5!s30$Oetrff=9>UC{8BaKwYsB6vq1!b~?<(#4Jc=$geN$uqquV&@!<){H&8PX z?u45Ocjr3d!xNHoK;;FBJHbYwxN|-6;b{TRjZiZY?u45OW`NStdg8(pUv4E`4wR0J z75wt^;B9d5u}@^Td8l7rptg3D@{pWbtOOoxR|3rf6_ur?fCm-8r>o^9=70vh!N)A2 z1WFB8VnG3X?g?_>49XNLrtv`2 zIA8}PXMo1%CdJ29Zvr95kb5e`JGf1GL!yp5~$)E$K6u^r=K;y`u_J@T+N@7VO)P*%%$%%Oi zMX9--(Nl!MMY105@qS*(zo zm;yd-18yGVFcnb4xEOLq7HHXANlqo`1U1BXd~qrG#47NyBH*aNu~>up=|w>oa^wa0 zNEpWePv|N{Lo;2_fmZNj4)PiJge}k{C-{7@^wc6y6Sp)~LDvxKTj&q=+KnZycFI1G+nSg8m|6snxJ#@Qj3ZpNAW<8%)w}s(!{@>(8Et#WX!h?q%D7`?=#mh-e&n(Hzg&ZN32|7S6IX@RQhe8S;$V@OSKA;nw2m?W5ov^bL zL90ALhth#F9BAqqG-aBZmyQzP2(4II)Q^t<_$iY)l^{of4mboKw}=uQps<8yLF57$ zqg0^2`%GbjH*Riju83{n;FUY?_wOTS#1JJU!8InN_X8T_M3@L(yF`|Zo#Z(sg?`-=D5SH9oA>izcB@3*gczkTid?d#reU#~vhfEv_1y=xPwB(_{rf)5-@pIE`u+Pptlz)?!~XsIKJ4GW z|6~9DeINVx@BcV||Gtm&_wWC>e*eCY>-X>fxPSk?kNfxU|J1*K->3fl`=RFGr4X+F zG=KlTPxJTh|FnMpzEA7-@Bg%a|GrQA_wWDQzklE7{{8zu&)>iA^Zfn$Kd;}v@ALZo p`#)``F%v|z^|}|3jiI7NE-kE literal 0 HcmV?d00001 From e2b58051e6c414ae813f3c0834a51e85e43403be Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Tue, 16 Feb 2021 17:40:23 -0500 Subject: [PATCH 326/606] yes: correct a typo (#1727) Improve readability by fixing an inadvertent rename during a performance enhancement (b46e228). --- src/uu/yes/src/yes.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/yes/src/yes.rs b/src/uu/yes/src/yes.rs index 7932a1486..1fc2d92bc 100644 --- a/src/uu/yes/src/yes.rs +++ b/src/uu/yes/src/yes.rs @@ -77,8 +77,8 @@ fn prepare_buffer<'a>(input: &'a str, _buffer: &'a mut [u8; BUF_SIZE]) -> &'a [u } pub fn exec(bytes: &[u8]) { - let mut stdin_raw = io::stdout(); - let mut writer = ZeroCopyWriter::with_default(&mut stdin_raw, |stdin| stdin.lock()); + let mut stdout_raw = io::stdout(); + let mut writer = ZeroCopyWriter::with_default(&mut stdout_raw, |stdout| stdout.lock()); loop { // TODO: needs to check if pipe fails writer.write_all(bytes).unwrap(); From 39d62c6c1f809022c903180471c10fde6ecd12d1 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Wed, 17 Feb 2021 23:23:13 -0800 Subject: [PATCH 327/606] od: remove potential unsoundness and an allocation in PartialReader (#1730) --- src/uu/od/src/partialreader.rs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/uu/od/src/partialreader.rs b/src/uu/od/src/partialreader.rs index 7e906f515..ee3588830 100644 --- a/src/uu/od/src/partialreader.rs +++ b/src/uu/od/src/partialreader.rs @@ -8,7 +8,7 @@ use crate::multifilereader::HasError; /// When a large number of bytes must be skipped, it will be read into a /// dynamically allocated buffer. The buffer will be limited to this size. -const MAX_SKIP_BUFFER: usize = 64 * 1024; +const MAX_SKIP_BUFFER: usize = 16 * 1024; /// Wrapper for `std::io::Read` which can skip bytes at the beginning /// of the input, and it can limit the returned bytes to a particular @@ -31,21 +31,25 @@ impl PartialReader { impl Read for PartialReader { fn read(&mut self, out: &mut [u8]) -> io::Result { if self.skip > 0 { - let buf_size = cmp::min(self.skip, MAX_SKIP_BUFFER); - let mut bytes: Vec = Vec::with_capacity(buf_size); - unsafe { - bytes.set_len(buf_size); - } + let mut bytes = [0; MAX_SKIP_BUFFER]; while self.skip > 0 { - let skip_count = cmp::min(self.skip, buf_size); + let skip_count = cmp::min(self.skip, MAX_SKIP_BUFFER); - match self.inner.read_exact(&mut bytes[..skip_count]) { + match self.inner.read(&mut bytes[..skip_count]) { + Ok(0) => { + // this is an error as we still have more to skip + return Err(io::Error::new( + io::ErrorKind::UnexpectedEof, + "tried to skip past end of input", + )); + } + Ok(n) => self.skip -= n, Err(e) => return Err(e), - Ok(()) => self.skip -= skip_count, } } } + match self.limit { None => self.inner.read(out), Some(0) => Ok(0), From 4bdd7a5e42415dcf4d8796024d3a05f3a35ebb76 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 18 Feb 2021 22:05:11 +0100 Subject: [PATCH 328/606] trivial(truncate): remove old comments --- src/uu/truncate/src/truncate.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 58bd55bcf..da44235c8 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -63,10 +63,6 @@ fn get_long_usage() -> String { } pub fn uumain(args: impl uucore::Args) -> i32 { - /* - let args = args.collect_str(); - - let mut opts = getopts::Options::new();*/ let usage = get_usage(); let long_usage = get_long_usage(); From 0dbed0fd5908266fc66147619f9338e6ed7e7849 Mon Sep 17 00:00:00 2001 From: James Robson Date: Thu, 18 Feb 2021 21:10:53 +0000 Subject: [PATCH 329/606] Do not allow seq to run with an increment of zero --- src/uu/seq/src/seq.rs | 4 ++++ tests/by-util/test_seq.rs | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index 6a8a57a01..671dd7e1c 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -133,6 +133,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } else { 1.0 }; + if increment == 0.0 { + show_error!("increment value: '{}'", &numbers[1][..]); + return 1; + } let last = { let slice = &numbers[numbers.len() - 1][..]; padding = cmp::max(padding, slice.find('.').unwrap_or_else(|| slice.len())); diff --git a/tests/by-util/test_seq.rs b/tests/by-util/test_seq.rs index b1265121b..d4cff9aaa 100644 --- a/tests/by-util/test_seq.rs +++ b/tests/by-util/test_seq.rs @@ -40,3 +40,9 @@ fn test_equalize_widths() { fn test_seq_wrong_arg() { new_ucmd!().args(&["-w", "5", "10", "33", "32"]).fails(); } + +#[test] +fn test_zero_step() { + new_ucmd!().args(&["10", "0", "32"]).fails(); +} + From c8977a78a417bbb26afb54982c2cc20ef298c3e6 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Thu, 18 Feb 2021 23:38:57 -0800 Subject: [PATCH 330/606] uucore: fix potential use-after-free in utmpx iterator (#1737) --- src/uucore/src/lib/features/utmpx.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/uucore/src/lib/features/utmpx.rs b/src/uucore/src/lib/features/utmpx.rs index ab3de65fa..31cd3b72c 100644 --- a/src/uucore/src/lib/features/utmpx.rs +++ b/src/uucore/src/lib/features/utmpx.rs @@ -242,9 +242,10 @@ impl UtmpxIter { /// /// If not set, default record file will be used(file path depends on the target OS) pub fn read_from(self, f: &str) -> Self { - // FixME: discuss and revise a rewrite which is correct and satisfies clippy/rustc - #[allow(clippy::temporary_cstring_as_ptr)] - let res = unsafe { utmpxname(CString::new(f).unwrap().as_ptr()) }; + let res = unsafe { + let cstr = CString::new(f).unwrap(); + utmpxname(cstr.as_ptr()) + }; if res != 0 { println!("Warning: {}", IOError::last_os_error()); } From eb8cdcf44aa4bc452493465e09b4de2dbd994ba0 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sat, 20 Feb 2021 15:07:47 +0000 Subject: [PATCH 331/606] Re-add fixed test --- .github/workflows/GNU.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index b1cbc1502..c599a454c 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -55,7 +55,6 @@ jobs: grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||' sed -i -e 's|^seq |/usr/bin/seq |' tests/factor/t*sh sed -i -e '/tests\/misc\/cat-self.sh/ D' Makefile # issue #1707 - sed -i -e '/tests\/misc\/numfmt.pl/ D' Makefile # issue #1708 sed -i -e '/tests\/chown\/preserve-root.sh/ D' Makefile # issue #1709 sed -i -e '/tests\/cp\/file-perm-race.sh/ D' Makefile # issue #1710 sed -i -e '/tests\/cp\/special-f.sh/ D' Makefile # issue #1710 From a73c34c7355a198e48c86fa1308ed9a2fad87f65 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sat, 20 Feb 2021 17:17:03 +0000 Subject: [PATCH 332/606] Stop tests failing on utils that aren't the focu of the test --- .github/workflows/GNU.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index c599a454c..6ec44cf22 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -74,6 +74,16 @@ jobs: sed -i -e '/tests\/tail-2\/pid.sh/ D' Makefile # hangs on github, tail doesn't support -f sed -i -e'/incompat4/ D' -e"/options '-co' are incompatible/ d" tests/misc/sort.pl # Sort doesn't correctly check for incompatible options, waits for input + # Use the system coreutils where the test fails due to error in a util that is not the one being tested + sed -i -e 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/chgrp/basic.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh + sed -i -e 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh + sed -i -e 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh + sed -i -e 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh misc/sort-NaN-infloop.log tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh + sed -i -e 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh + sed -i -e 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh + sed -i -e 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh + sed -i -e 's|truncate |/usr/bin/truncate |' tests/split/fail.sh + test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests shell: bash From b3dea739f4d4ff1433ccf05f769cfaa1371184f6 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Feb 2021 09:36:03 +0000 Subject: [PATCH 333/606] Fix script name --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 6ec44cf22..f9390a3f0 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -78,7 +78,7 @@ jobs: sed -i -e 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/chgrp/basic.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh sed -i -e 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh sed -i -e 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i -e 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh misc/sort-NaN-infloop.log tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh + sed -i -e 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.log tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh sed -i -e 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh sed -i -e 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh sed -i -e 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh From 910f6d102f529b10c75fb3fa5696da0b9c15cc21 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Feb 2021 09:53:11 +0000 Subject: [PATCH 334/606] Fix script name --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index f9390a3f0..9e0d66eee 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -78,7 +78,7 @@ jobs: sed -i -e 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/chgrp/basic.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh sed -i -e 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh sed -i -e 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i -e 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.log tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh + sed -i -e 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh sed -i -e 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh sed -i -e 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh sed -i -e 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh From f2013e47b3789fc22fd8bed0383154d5d1235c8d Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Feb 2021 11:14:14 +0000 Subject: [PATCH 335/606] Use which to find system utils --- .github/workflows/GNU.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 9e0d66eee..15bab8b3f 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -75,14 +75,14 @@ jobs: sed -i -e'/incompat4/ D' -e"/options '-co' are incompatible/ d" tests/misc/sort.pl # Sort doesn't correctly check for incompatible options, waits for input # Use the system coreutils where the test fails due to error in a util that is not the one being tested - sed -i -e 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/chgrp/basic.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh - sed -i -e 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh - sed -i -e 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i -e 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh - sed -i -e 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh - sed -i -e 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh - sed -i -e 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh - sed -i -e 's|truncate |/usr/bin/truncate |' tests/split/fail.sh + sed -i -e "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh + sed -i -e "s|ls -|$(which ls) -|" tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh + sed -i -e "s|mkdir |$(which mkdir) |" tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh + sed -i -e "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh + sed -i -e "s|chmod |$(which chmod) |" tests/du/inacc-dir.sh tests/mkdir/p-3.sh + sed -i -e "s|sort |$(which sort) |" tests/ls/hyperlink.sh + sed -i -e "s|split |$(which split) |" tests/misc/factor-parallel.sh + sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests From cebb58c5b486853a7dedaba0e68a8b022f83dc64 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Feb 2021 13:36:16 +0000 Subject: [PATCH 336/606] Rename install for testing --- .github/workflows/GNU.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 15bab8b3f..c92d90076 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -37,6 +37,7 @@ jobs: sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify expect python3-sphinx pushd uutils make PROFILE=release + cp target/release/install target/release/ginstall # The GNU tests rename this script before running, to avoid confusion with the make target BUILDDIR="$PWD/target/release/" popd GNULIB_SRCDIR="$PWD/gnulib" From 4e90de44cc0e8f28b8d86b9218985b71da472017 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Feb 2021 15:51:03 +0000 Subject: [PATCH 337/606] Move timeout to per-test script Move to a timeout applied to each script and re add the tests that are hanging so they show as failing --- .github/workflows/GNU.yml | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index c92d90076..82494bdd7 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -44,6 +44,8 @@ jobs: pushd gnu/ ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" ./configure --quiet --disable-gcc-warnings + #Add timeout to tests to protest against hangs + sed -i -e 's|"\$@|timeout 600 "\$@|' build-aux/test-driver # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile sed -i 's| tr | /usr/bin/tr |' tests/init.sh @@ -55,25 +57,13 @@ jobs: done grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||' sed -i -e 's|^seq |/usr/bin/seq |' tests/factor/t*sh - sed -i -e '/tests\/misc\/cat-self.sh/ D' Makefile # issue #1707 - sed -i -e '/tests\/chown\/preserve-root.sh/ D' Makefile # issue #1709 - sed -i -e '/tests\/cp\/file-perm-race.sh/ D' Makefile # issue #1710 - sed -i -e '/tests\/cp\/special-f.sh/ D' Makefile # issue #1710 - sed -i -e '/tests\/mv\/mv-special-1.sh/ D' Makefile # issue #1710 - sed -i -e '/tests\/dd\/stats.sh/ D' Makefile # issue #1710 - sed -i -e '/tests\/cp\/existing-perm-race.sh/ D' Makefile # hangs, cp doesn't implement --copy-contents - # Remove tests that rely on seq with large numbers. See issue #1703 - sed -i -e '/tests\/misc\/seq.pl/ D' \ - -e '/tests\/misc\/seq-precision.sh/D' \ - Makefile + # Remove tests checking for --version & --help # Not really interesting for us and logs are too big sed -i -e '/tests\/misc\/invalid-opt.pl/ D' \ -e '/tests\/misc\/help-version.sh/ D' \ -e '/tests\/misc\/help-version-getopt.sh/ D' \ Makefile - sed -i -e '/tests\/tail-2\/pid.sh/ D' Makefile # hangs on github, tail doesn't support -f - sed -i -e'/incompat4/ D' -e"/options '-co' are incompatible/ d" tests/misc/sort.pl # Sort doesn't correctly check for incompatible options, waits for input # Use the system coreutils where the test fails due to error in a util that is not the one being tested sed -i -e "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh @@ -93,7 +83,7 @@ jobs: GNULIB_DIR="${PWD}/gnulib" pushd gnu - unbuffer timeout -sKILL 3600 make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : + unbuffer make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : - name: Extract tests info shell: bash run: | From 89f74948e0db872bd9b4722ec8dd822bef7e34db Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Feb 2021 15:52:18 +0000 Subject: [PATCH 338/606] Typo --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 82494bdd7..1541be1a4 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -44,7 +44,7 @@ jobs: pushd gnu/ ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" ./configure --quiet --disable-gcc-warnings - #Add timeout to tests to protest against hangs + #Add timeout to to protect against hangs sed -i -e 's|"\$@|timeout 600 "\$@|' build-aux/test-driver # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile From 16c8b3cbba351898335c0e6b21857b3fe57920b3 Mon Sep 17 00:00:00 2001 From: James Robson Date: Mon, 22 Feb 2021 09:19:43 +0000 Subject: [PATCH 339/606] Use system timeout command --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 1541be1a4..2ce9e44a5 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -45,7 +45,7 @@ jobs: ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" ./configure --quiet --disable-gcc-warnings #Add timeout to to protect against hangs - sed -i -e 's|"\$@|timeout 600 "\$@|' build-aux/test-driver + sed -i -e "s|\"\$@|$(which timeout) 600 \"\$@|" build-aux/test-driver # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile sed -i 's| tr | /usr/bin/tr |' tests/init.sh From 7e5d9ee32d9694a045b7f5c6ccdc2cd806dd30dd Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Mon, 22 Feb 2021 06:07:51 -0800 Subject: [PATCH 340/606] factor, stdbuf, timeout, uname, uptime: update dependencies (#1746) --- Cargo.lock | 160 ++++++++++++++++--------- src/uu/factor/Cargo.toml | 2 +- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 2 +- src/uu/timeout/Cargo.toml | 1 - src/uu/uname/Cargo.toml | 2 +- src/uu/uptime/Cargo.toml | 1 - src/uu/uptime/src/uptime.rs | 29 ++--- 7 files changed, 120 insertions(+), 77 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 398cdce26..e9988ce95 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7,14 +7,6 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "aho-corasick" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "aho-corasick" version = "0.7.15" @@ -108,7 +100,7 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.6.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -176,11 +168,6 @@ dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "const_fn" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "constant_time_eq" version = "0.1.5" @@ -318,10 +305,10 @@ dependencies = [ [[package]] name = "cpp" -version = "0.4.0" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cpp_macros 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -349,17 +336,28 @@ dependencies = [ ] [[package]] -name = "cpp_macros" -version = "0.4.0" +name = "cpp_common" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cpp_macros" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -430,7 +428,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -439,31 +437,32 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-epoch 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "const_fn 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "loom 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-utils" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "loom 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -535,7 +534,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -554,6 +553,18 @@ name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "generator" +version = "0.6.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rustversion 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "generic-array" version = "0.8.3" @@ -619,6 +630,11 @@ dependencies = [ "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "if_rust_version" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ioctl-sys" version = "0.5.2" @@ -688,6 +704,16 @@ dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "loom" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "generator 0.6.24 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "match_cfg" version = "0.1.0" @@ -844,6 +870,15 @@ dependencies = [ "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "platform-info" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "plotters" version = "0.3.0" @@ -1005,7 +1040,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1017,7 +1052,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "redox_syscall" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1028,7 +1063,7 @@ name = "redox_termios" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1081,6 +1116,11 @@ dependencies = [ "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rustversion" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ryu" version = "1.0.5" @@ -1094,6 +1134,11 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "scopeguard" version = "1.1.0" @@ -1234,7 +1279,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1261,15 +1306,15 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "thiserror-impl 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thiserror-impl" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1471,7 +1516,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2085,7 +2130,7 @@ dependencies = [ name = "uu_stdbuf_libstdbuf" version = "0.0.3" dependencies = [ - "cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", @@ -2159,7 +2204,6 @@ version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2227,7 +2271,7 @@ name = "uu_uname" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2267,7 +2311,6 @@ version = "0.0.3" dependencies = [ "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2330,7 +2373,7 @@ dependencies = [ "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2383,7 +2426,7 @@ name = "wasm-bindgen-backend" version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bumpalo 3.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2482,7 +2525,6 @@ dependencies = [ [metadata] "checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" -"checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5" "checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" @@ -2495,7 +2537,7 @@ dependencies = [ "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" "checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" -"checksum bumpalo 3.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "099e596ef14349721d9016f6b80dd3419ea1bf289ab9b44df8e4dfd3a005d5d9" +"checksum bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" "checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" @@ -2505,13 +2547,13 @@ dependencies = [ "checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" "checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum const_fn 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6" "checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" "checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" -"checksum cpp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d1cd8699ffa1b18fd388183f7762e0545eddbd5c6ec95e9e3b42a4a71a507ff" +"checksum cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" "checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" "checksum cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" -"checksum cpp_macros 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6bba562eb4d65561efb6cef4e5f0de5936edfee7c6af7a4dfc323f6f2c997e40" +"checksum cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" +"checksum cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" "checksum cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" "checksum cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" "checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" @@ -2519,8 +2561,8 @@ dependencies = [ "checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" "checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" "checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" -"checksum crossbeam-epoch 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d" -"checksum crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d" +"checksum crossbeam-epoch 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d60ab4a8dba064f2fbb5aa270c28da5cf4bbd0e72dae1140a6b0353a779dbe00" +"checksum crossbeam-utils 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bae8f328835f8f5a6ceb6a7842a7f2d0c03692adb5c889347235d59194731fe3" "checksum csv 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f9d58633299b24b515ac72a3f869f8b91306a3cec616a602843a383acd6f9e97" "checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" "checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" @@ -2534,6 +2576,7 @@ dependencies = [ "checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" "checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum generator 0.6.24 (registry+https://github.com/rust-lang/crates.io-index)" = "a9fed24fd1e18827652b4d55652899a1e9da8e54d91624dc3437a5bc3a9f9a9c" "checksum generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fceb69994e330afed50c93524be68c42fa898c2d9fd4ee8da03bd7363acd26f2" "checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" "checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" @@ -2543,6 +2586,7 @@ dependencies = [ "checksum hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" "checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" "checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +"checksum if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" "checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" "checksum itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" "checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" @@ -2553,6 +2597,7 @@ dependencies = [ "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" "checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +"checksum loom 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d44c73b4636e497b4917eb21c33539efa3816741a2d3ff26c6316f1b529481a4" "checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" "checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" "checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" @@ -2574,6 +2619,7 @@ dependencies = [ "checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" "checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" "checksum platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f2fd076acdc7a98374de6e300bf3af675997225bef21aecac2219553f04dd7e8" +"checksum platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" "checksum plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" "checksum plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" "checksum plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" @@ -2595,7 +2641,7 @@ dependencies = [ "checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" "checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -"checksum redox_syscall 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" +"checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" "checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" "checksum regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" @@ -2604,8 +2650,10 @@ dependencies = [ "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum rustversion 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cb5d2a036dc6d2d8fd16fde3498b04306e29bd193bf306a57427019b823d5acd" "checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" "checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" +"checksum scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" "checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" @@ -2625,8 +2673,8 @@ dependencies = [ "checksum termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" "checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thiserror 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)" = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146" -"checksum thiserror-impl 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1" +"checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" +"checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" "checksum thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tinytemplate 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2ada8616fad06a2d0c455adc530de4ef57605a8120cc65da9653e0e9623ca74" diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index 0b335cddf..9724d6fb0 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -18,7 +18,7 @@ num-traits = "0.2.13" # used in src/numerics.rs, which is included by build.rs [dependencies] num-traits = "0.2.13" # Needs at least version 0.2.13 for "OverflowingAdd" rand = { version="0.7", features=["small_rng"] } -smallvec = { version="0.6.13, < 1.0" } +smallvec = { version="0.6.14, < 1.0" } uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index 7b540edf4..7bd34012d 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -17,7 +17,7 @@ path = "src/libstdbuf.rs" crate-type = ["cdylib", "rlib"] # XXX: note: the rlib is just to prevent Cargo from spitting out a warning [dependencies] -cpp = "0.4" +cpp = "0.5" libc = "0.2" uucore = { version=">=0.0.6", package="uucore", path="../../../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../../../uucore_procs" } diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index f6528b052..0a920d988 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -17,7 +17,6 @@ path = "src/timeout.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -time = "0.1.40" uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index 6bb156a4b..5e54aff43 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -16,7 +16,7 @@ path = "src/uname.rs" [dependencies] clap = "2.33" -platform-info = "0.0.1" +platform-info = "0.1" uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index 36f8b7ded..ac32da353 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -15,7 +15,6 @@ edition = "2018" path = "src/uptime.rs" [dependencies] -time = "0.1.40" chrono = "0.4" clap = "2.33" uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["libc", "utmpx"] } diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index 83d258818..44360f515 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -6,8 +6,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -/* last synced with: cat (GNU coreutils) 8.13 */ - // spell-checker:ignore (ToDO) getloadavg upsecs updays nusers loadavg boottime uphours upmins use chrono::{Local, TimeZone, Utc}; @@ -137,11 +135,11 @@ fn print_nusers(nusers: usize) { } fn print_time() { - let local_time = time::now(); + let local_time = Local::now().time(); print!( - " {:02}:{:02}:{:02} ", - local_time.tm_hour, local_time.tm_min, local_time.tm_sec + " {} ", + local_time.format("%H:%M:%S") ); } @@ -150,25 +148,24 @@ fn get_uptime(boot_time: Option) -> i64 { use std::fs::File; use std::io::Read; - let mut proc_uptime = String::new(); + let mut proc_uptime_s = String::new(); - if let Some(n) = File::open("/proc/uptime") + let proc_uptime = File::open("/proc/uptime") .ok() - .and_then(|mut f| f.read_to_string(&mut proc_uptime).ok()) - .and_then(|_| proc_uptime.split_whitespace().next()) - .and_then(|s| s.split('.').next().unwrap_or("0").parse().ok()) - { - n - } else { + .and_then(|mut f| f.read_to_string(&mut proc_uptime_s).ok()) + .and_then(|_| proc_uptime_s.split_whitespace().next()) + .and_then(|s| s.split('.').next().unwrap_or("0").parse().ok()); + + proc_uptime.unwrap_or_else(|| { match boot_time { Some(t) => { - let now = time::get_time().sec; + let now = Local::now().timestamp(); let boottime = t as i64; now - boottime } - _ => -1, + None => -1, } - } + }) } #[cfg(windows)] From b92b88a8229e1d80455d6a3a97fdf7ead2b25f1e Mon Sep 17 00:00:00 2001 From: James Robson Date: Mon, 22 Feb 2021 19:29:00 +0000 Subject: [PATCH 341/606] Add 4 hour global timeout for protection --- .github/workflows/GNU.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 2ce9e44a5..0af969220 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -6,6 +6,7 @@ jobs: gnu: name: Run GNU tests runs-on: ubuntu-latest + timeout-minutes: 240 # Kill after 4 hours in case something gets stuck steps: # Checks out a copy of your repository on the ubuntu-latest machine - name: Checkout code uutil From dc49415829ba8eddd0486bd2503b29df3cca65ff Mon Sep 17 00:00:00 2001 From: James Robson Date: Mon, 22 Feb 2021 19:29:45 +0000 Subject: [PATCH 342/606] Stop seq-precision.sh causing jams in make --- .github/workflows/GNU.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 0af969220..024112f8a 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -76,6 +76,9 @@ jobs: sed -i -e "s|split |$(which split) |" tests/misc/factor-parallel.sh sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh + #Add specific timeout to seq-precision.sh because otherwise seq will fill logs and cause something to jam in make + sed -i -e "s| seq |$(which timeout) 1 seq |" tests/misc/seq-precision.sh + test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests shell: bash From 5431e947bc54242d6d6fb3b1b1c55f73dd1eade0 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Tue, 23 Feb 2021 01:21:01 -0800 Subject: [PATCH 343/606] uucore: process: fix exit status processing (#1743) * uucore: process: fix exit status processing * tests: timeout: check whether subcommand exit codes are returned --- src/uucore/src/lib/features/process.rs | 69 ++++++++++---------------- tests/by-util/test_timeout.rs | 19 ++++++- tests/common/util.rs | 9 ++++ 3 files changed, 53 insertions(+), 44 deletions(-) diff --git a/src/uucore/src/lib/features/process.rs b/src/uucore/src/lib/features/process.rs index f3f9680e8..078b782f5 100644 --- a/src/uucore/src/lib/features/process.rs +++ b/src/uucore/src/lib/features/process.rs @@ -9,11 +9,11 @@ // spell-checker:ignore (vars) cvar exitstatus // spell-checker:ignore (sys/unix) WIFSIGNALED -use libc::{c_int, gid_t, pid_t, uid_t}; +use libc::{gid_t, pid_t, uid_t}; use std::fmt; use std::io; use std::process::Child; -use std::sync::{Arc, Condvar, Mutex}; +use std::process::ExitStatus as StdExitStatus; use std::thread; use std::time::{Duration, Instant}; @@ -41,13 +41,18 @@ pub enum ExitStatus { } impl ExitStatus { - fn from_status(status: c_int) -> ExitStatus { - if status & 0x7F != 0 { - // WIFSIGNALED(status) == terminating by/with unhandled signal - ExitStatus::Signal(status & 0x7F) - } else { - ExitStatus::Code(status & 0xFF00 >> 8) + fn from_std_status(status: StdExitStatus) -> Self { + #[cfg(unix)] + { + use std::os::unix::process::ExitStatusExt; + + if let Some(signal) = status.signal() { + return ExitStatus::Signal(signal); + } } + + // NOTE: this should never fail as we check if the program exited through a signal above + ExitStatus::Code(status.code().unwrap()) } pub fn success(&self) -> bool { @@ -100,47 +105,25 @@ impl ChildExt for Child { } fn wait_or_timeout(&mut self, timeout: Duration) -> io::Result> { - // The result will be written to that Option, protected by a Mutex - // Then the Condvar will be signaled - let state = Arc::new(( - Mutex::new(Option::None::>), - Condvar::new(), - )); + // .try_wait() doesn't drop stdin, so we do it manually + drop(self.stdin.take()); - // Start the waiting thread - let state_th = state.clone(); - let pid_th = self.id(); - thread::spawn(move || { - let &(ref lock_th, ref cvar_th) = &*state_th; - // Child::wait() would need a &mut to self, can't use that... - // use waitpid() directly, with our own ExitStatus - let mut status: c_int = 0; - let r = unsafe { libc::waitpid(pid_th as i32, &mut status, 0) }; - // Fill the Option and notify on the Condvar - let mut exitstatus_th = lock_th.lock().unwrap(); - if r != pid_th as c_int { - *exitstatus_th = Some(Err(io::Error::last_os_error())); - } else { - let s = ExitStatus::from_status(status); - *exitstatus_th = Some(Ok(s)); - } - cvar_th.notify_one(); - }); - - // Main thread waits - let &(ref lock, ref cvar) = &*state; - let mut exitstatus = lock.lock().unwrap(); - // Condvar::wait_timeout_ms() can wake too soon, in this case wait again let start = Instant::now(); loop { - if let Some(exitstatus) = exitstatus.take() { - return exitstatus.map(Some); + if let Some(status) = self.try_wait()? { + return Ok(Some(ExitStatus::from_std_status(status))); } + if start.elapsed() >= timeout { - return Ok(None); + break; } - let cvar_timeout = timeout - start.elapsed(); - exitstatus = cvar.wait_timeout(exitstatus, cvar_timeout).unwrap().0; + + // XXX: this is kinda gross, but it's cleaner than starting a thread just to wait + // (which was the previous solution). We might want to use a different duration + // here as well + thread::sleep(Duration::from_millis(100)); } + + Ok(None) } } diff --git a/tests/by-util/test_timeout.rs b/tests/by-util/test_timeout.rs index 651491045..edea760c2 100644 --- a/tests/by-util/test_timeout.rs +++ b/tests/by-util/test_timeout.rs @@ -1 +1,18 @@ -// ToDO: add tests +use crate::common::util::*; + +// FIXME: this depends on the system having true and false in PATH +// the best solution is probably to generate some test binaries that we can call for any +// utility that requires executing another program (kill, for instance) +#[test] +fn test_subcommand_retcode() { + new_ucmd!() + .arg("1") + .arg("true") + .succeeds(); + + new_ucmd!() + .arg("1") + .arg("false") + .run() + .status_code(1); +} diff --git a/tests/common/util.rs b/tests/common/util.rs index 117bce0e6..6b85c8561 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -69,6 +69,8 @@ pub fn repeat_str(s: &str, n: u32) -> String { pub struct CmdResult { //tmpd is used for convenience functions for asserts against fixtures tmpd: Option>, + /// exit status for command (if there is one) + pub code: Option, /// zero-exit from running the Command? /// see [`success`] pub success: bool, @@ -91,6 +93,12 @@ impl CmdResult { Box::new(self) } + /// asserts that the command's exit code is the same as the given one + pub fn status_code(&self, code: i32) -> Box<&CmdResult> { + assert!(self.code == Some(code)); + Box::new(self) + } + /// asserts that the command resulted in empty (zero-length) stderr stream output /// generally, it's better to use stdout_only() instead, /// but you might find yourself using this function if @@ -573,6 +581,7 @@ impl UCommand { CmdResult { tmpd: self.tmpd.clone(), + code: prog.status.code(), success: prog.status.success(), stdout: from_utf8(&prog.stdout).unwrap().to_string(), stderr: from_utf8(&prog.stderr).unwrap().to_string(), From bb54669a5daf1d6bb0ec58d2a4ab9438da4d929f Mon Sep 17 00:00:00 2001 From: Chad Brewbaker Date: Tue, 23 Feb 2021 03:25:06 -0600 Subject: [PATCH 344/606] Fix macOS aarch64 compile errors (#1724) --- .github/workflows/CICD.yml | 2 +- Cargo.lock | 132 +++++++++++++++++++------------------ README.md | 2 +- src/uu/cp/Cargo.toml | 2 +- src/uu/df/src/df.rs | 10 +-- src/uucore/Cargo.toml | 2 +- tests/by-util/test_tail.rs | 4 +- 7 files changed, 78 insertions(+), 76 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 49eb61fa7..bdc964c42 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -11,7 +11,7 @@ env: PROJECT_NAME: coreutils PROJECT_DESC: "Core universal (cross-platform) utilities" PROJECT_AUTH: "uutils" - RUST_MIN_SRV: "1.32.0" ## v1.32.0 - minimum version for half, tempfile, etc + RUST_MIN_SRV: "1.33.0" ## v1.33.0 - minimum version for tempfile 3.1.0 and libc needed for aarch64 RUST_COV_SRV: "2020-08-01" ## (~v1.47.0) supported rust version for code coverage; (date required/used by 'coverage') ## !maint: refactor when code coverage support is included in the stable channel on: [push, pull_request] diff --git a/Cargo.lock b/Cargo.lock index e9988ce95..89279dc18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" @@ -37,7 +39,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -191,7 +193,7 @@ dependencies = [ "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", @@ -533,7 +535,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -559,7 +561,7 @@ version = "0.6.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", "rustversion 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -588,7 +590,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -612,7 +614,7 @@ name = "hermit-abi" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -625,7 +627,7 @@ name = "hostname" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -693,7 +695,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.66" +version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -734,7 +736,7 @@ name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -757,7 +759,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -769,7 +771,7 @@ dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -801,7 +803,7 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -821,7 +823,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -866,7 +868,7 @@ name = "platform-info" version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -875,7 +877,7 @@ name = "platform-info" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -958,7 +960,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -969,7 +971,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1248,7 +1250,7 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1268,7 +1270,7 @@ name = "term_size" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1277,7 +1279,7 @@ name = "termion" version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1290,7 +1292,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1335,7 +1337,7 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1380,7 +1382,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1388,7 +1390,7 @@ name = "users" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1448,7 +1450,7 @@ dependencies = [ name = "uu_chmod" version = "0.0.3" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1478,7 +1480,7 @@ dependencies = [ name = "uu_cksum" version = "0.0.3" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1488,7 +1490,7 @@ name = "uu_comm" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1500,7 +1502,7 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", @@ -1544,7 +1546,7 @@ name = "uu_df" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", @@ -1564,7 +1566,7 @@ dependencies = [ name = "uu_dirname" version = "0.0.3" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1591,7 +1593,7 @@ name = "uu_env" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", @@ -1611,7 +1613,7 @@ dependencies = [ name = "uu_expr" version = "0.0.3" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", @@ -1645,7 +1647,7 @@ name = "uu_fmt" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", @@ -1676,7 +1678,7 @@ dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1691,7 +1693,7 @@ dependencies = [ name = "uu_head" version = "0.0.3" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1700,7 +1702,7 @@ dependencies = [ name = "uu_hostid" version = "0.0.3" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1711,7 +1713,7 @@ version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1731,7 +1733,7 @@ name = "uu_install" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", @@ -1750,7 +1752,7 @@ dependencies = [ name = "uu_kill" version = "0.0.3" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1759,7 +1761,7 @@ dependencies = [ name = "uu_link" version = "0.0.3" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1769,7 +1771,7 @@ name = "uu_ln" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1778,7 +1780,7 @@ dependencies = [ name = "uu_logname" version = "0.0.3" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1804,7 +1806,7 @@ name = "uu_mkdir" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1814,7 +1816,7 @@ name = "uu_mkfifo" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1824,7 +1826,7 @@ name = "uu_mknod" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1867,7 +1869,7 @@ name = "uu_nice" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1878,7 +1880,7 @@ version = "0.0.3" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1891,7 +1893,7 @@ name = "uu_nohup" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1901,7 +1903,7 @@ name = "uu_nproc" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", @@ -1923,7 +1925,7 @@ dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1942,7 +1944,7 @@ name = "uu_pathchk" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -1979,7 +1981,7 @@ version = "0.0.3" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2001,7 +2003,7 @@ name = "uu_readlink" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2059,7 +2061,7 @@ version = "0.0.3" dependencies = [ "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", @@ -2132,7 +2134,7 @@ version = "0.0.3" dependencies = [ "cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2151,7 +2153,7 @@ name = "uu_sync" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2171,7 +2173,7 @@ name = "uu_tail" version = "0.0.3" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", @@ -2183,7 +2185,7 @@ name = "uu_tee" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2192,7 +2194,7 @@ dependencies = [ name = "uu_test" version = "0.0.3" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", @@ -2203,7 +2205,7 @@ name = "uu_timeout" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2261,7 +2263,7 @@ name = "uu_tty" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2300,7 +2302,7 @@ name = "uu_unlink" version = "0.0.3" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.6", "uucore_procs 0.0.5", ] @@ -2369,7 +2371,7 @@ dependencies = [ "dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2520,7 +2522,7 @@ name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [metadata] @@ -2595,7 +2597,7 @@ dependencies = [ "checksum js-sys 0.3.47 (registry+https://github.com/rust-lang/crates.io-index)" = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" +"checksum libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)" = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" "checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" "checksum loom 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d44c73b4636e497b4917eb21c33539efa3816741a2d3ff26c6316f1b529481a4" "checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" diff --git a/README.md b/README.md index 7c9368e13..694141702 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Requirements ### Rust Version ### uutils follows Rust's release channels and is tested against stable, beta and nightly. -The current oldest supported version of the Rust compiler is `1.32.0`. +The current oldest supported version of the Rust compiler is `1.33.0`. On both Windows and Redox, only the nightly version is tested currently. diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index f92165f6b..4f0c3dccb 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -21,7 +21,7 @@ path = "src/cp.rs" [dependencies] clap = "2.33" filetime = "0.2" -libc = "0.2.42" +libc = "0.2.85" quick-error = "1.2.3" uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index e8bb641ec..ed2865728 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -215,9 +215,9 @@ extern "C" { #[link_name = "getmntinfo$INODE64"] fn getmntinfo(mntbufp: *mut *mut statfs, flags: c_int) -> c_int; - #[cfg(all( - target_os = "freebsd", - not(all(target_os = "macos", target_arch = "x86_64")) + #[cfg(any( + all(target_os = "freebsd"), + all(target_os = "macos", target_arch = "aarch64") ))] fn getmntinfo(mntbufp: *mut *mut statfs, flags: c_int) -> c_int; } @@ -753,7 +753,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .help( "scale sizes by SIZE before printing them; e.g.\ - '-BM' prints sizes in units of 1,048,576 bytes", + '-BM' prints sizes in units of 1,048,576 bytes", ), ) .arg( @@ -810,7 +810,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .use_delimiter(true) .help( "use the output format defined by FIELD_LIST,\ - or print all fields if FIELD_LIST is omitted.", + or print all fields if FIELD_LIST is omitted.", ), ) .arg( diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index a6f442b8c..dd7d9e69d 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -27,7 +27,7 @@ platform-info = { version="<= 0.0.1", optional=true } time = { version="<= 0.1.42", optional=true } # * "problem" dependencies (pinned) data-encoding = { version="~2.1", optional=true } ## data-encoding: require v2.1; but v2.2.0 breaks the build for MinSRV v1.31.0 -libc = { version="0.2.15, <= 0.2.66", optional=true } ## libc: initial utmp support added in v0.2.15; but v0.2.68 breaks the build for MinSRV v1.31.0 +libc = { version="0.2.15, <= 0.2.85", optional=true } ## libc: initial utmp support added in v0.2.15; but v0.2.68 breaks the build for MinSRV v1.31.0 [target.'cfg(target_os = "redox")'.dependencies] termion = "1.5" diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 422ea1986..458fc6aa7 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -95,8 +95,8 @@ fn test_follow_stdin() { .stdout_is_fixture("follow_stdin.expected"); } -// FixME: test PASSES for usual windows builds, but fails for coverage testing builds (likely related to the specific RUSTFLAGS '-Zpanic_abort_tests -Cpanic=abort') -#[cfg(not(windows))] +// FixME: test PASSES for usual windows builds, but fails for coverage testing builds (likely related to the specific RUSTFLAGS '-Zpanic_abort_tests -Cpanic=abort') This test also breaks tty settings under bash requiring a 'stty sane' or reset. +#[cfg(disable_until_fixed)] #[test] fn test_follow_with_pid() { use std::process::{Command, Stdio}; From b19afebad8a62037aff0e1ea3c05b25808885b8c Mon Sep 17 00:00:00 2001 From: James Robson Date: Tue, 23 Feb 2021 09:58:06 +0000 Subject: [PATCH 345/606] Shorten the timeout on seq-precision --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 024112f8a..b9b014dbf 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -77,7 +77,7 @@ jobs: sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh #Add specific timeout to seq-precision.sh because otherwise seq will fill logs and cause something to jam in make - sed -i -e "s| seq |$(which timeout) 1 seq |" tests/misc/seq-precision.sh + sed -i -e "s| seq |$(which timeout) 0.1 seq |" tests/misc/seq-precision.sh test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests From 7341a1a033aa5980ac59bc9d4df978b396de4fad Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Tue, 23 Feb 2021 03:34:49 -0800 Subject: [PATCH 346/606] shred: remove usage of Vec::set_len() (#1738) * shred: use a fixed-size array for BytesGenerator --- src/uu/shred/src/shred.rs | 70 +++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 25 deletions(-) diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 9d945ea03..4946ed35d 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -119,6 +119,7 @@ struct BytesGenerator<'a> { exact: bool, // if false, every block's size is block_size gen_type: PassType<'a>, rng: Option>, + bytes: [u8; BLOCK_SIZE], } impl<'a> BytesGenerator<'a> { @@ -128,6 +129,8 @@ impl<'a> BytesGenerator<'a> { _ => None, }; + let bytes = [0; BLOCK_SIZE]; + BytesGenerator { total_bytes, bytes_generated: Cell::new(0u64), @@ -135,25 +138,35 @@ impl<'a> BytesGenerator<'a> { exact, gen_type, rng, + bytes, } } -} -impl<'a> Iterator for BytesGenerator<'a> { - type Item = Box<[u8]>; + pub fn reset(&mut self, total_bytes: u64, gen_type: PassType<'a>) { + if let PassType::Random = gen_type { + if self.rng.is_none() { + self.rng = Some(RefCell::new(rand::thread_rng())); + } + } - fn next(&mut self) -> Option> { + self.total_bytes = total_bytes; + self.gen_type = gen_type; + + self.bytes_generated.set(0); + } + + pub fn next(&mut self) -> Option<&[u8]> { // We go over the total_bytes limit when !self.exact and total_bytes isn't a multiple // of self.block_size if self.bytes_generated.get() >= self.total_bytes { return None; } - let this_block_size: usize = { + let this_block_size = { if !self.exact { self.block_size } else { - let bytes_left: u64 = self.total_bytes - self.bytes_generated.get(); + let bytes_left = self.total_bytes - self.bytes_generated.get(); if bytes_left >= self.block_size as u64 { self.block_size } else { @@ -162,17 +175,12 @@ impl<'a> Iterator for BytesGenerator<'a> { } }; - let mut bytes: Vec = Vec::with_capacity(this_block_size); + let bytes = &mut self.bytes[..this_block_size]; match self.gen_type { PassType::Random => { - // This is ok because the vector was - // allocated with the same capacity - unsafe { - bytes.set_len(this_block_size); - } let mut rng = self.rng.as_ref().unwrap().borrow_mut(); - rng.fill(&mut bytes[..]); + rng.fill(bytes); } PassType::Pattern(pattern) => { let skip = { @@ -182,10 +190,17 @@ impl<'a> Iterator for BytesGenerator<'a> { (pattern.len() as u64 % self.bytes_generated.get()) as usize } }; - // Same range as 0..this_block_size but we start with the right index - for i in skip..this_block_size + skip { - let index = i % pattern.len(); - bytes.push(pattern[index]); + + // Copy the pattern in chunks rather than simply one byte at a time + let mut i = 0; + while i < this_block_size { + let start = (i + skip) % pattern.len(); + let end = (this_block_size - i).min(pattern.len()); + let len = end - start; + + bytes[i..i + len].copy_from_slice(&pattern[start..end]); + + i += len; } } }; @@ -193,7 +208,7 @@ impl<'a> Iterator for BytesGenerator<'a> { let new_bytes_generated = self.bytes_generated.get() + this_block_size as u64; self.bytes_generated.set(new_bytes_generated); - Some(bytes.into_boxed_slice()) + Some(bytes) } } @@ -443,6 +458,10 @@ fn wipe_file( .open(path) .expect("Failed to open file for writing"); + // NOTE: it does not really matter what we set for total_bytes and gen_type here, so just + // use bogus values + let mut generator = BytesGenerator::new(0, PassType::Pattern(&[]), exact); + for (i, pass_type) in pass_sequence.iter().enumerate() { if verbose { let pass_name: String = pass_name(*pass_type); @@ -467,7 +486,8 @@ fn wipe_file( } } // size is an optional argument for exactly how many bytes we want to shred - do_pass(&mut file, path, *pass_type, size, exact).expect("File write pass failed"); + do_pass(&mut file, path, &mut generator, *pass_type, size) + .expect("File write pass failed"); // Ignore failed writes; just keep trying } } @@ -477,22 +497,22 @@ fn wipe_file( } } -fn do_pass( +fn do_pass<'a>( file: &mut File, path: &Path, - generator_type: PassType, + generator: &mut BytesGenerator<'a>, + generator_type: PassType<'a>, given_file_size: Option, - exact: bool, ) -> Result<(), io::Error> { file.seek(SeekFrom::Start(0))?; // Use the given size or the whole file if not specified let size: u64 = given_file_size.unwrap_or(get_file_size(path)?); - let generator = BytesGenerator::new(size, generator_type, exact); + generator.reset(size, generator_type); - for block in generator { - file.write_all(&*block)?; + while let Some(block) = generator.next() { + file.write_all(block)?; } file.sync_data()?; From 5935876f38498b0c1f657d031171eb17028def6f Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Tue, 23 Feb 2021 03:35:17 -0800 Subject: [PATCH 347/606] od: remove Vec::set_len() usage in InputDecoder (#1739) --- src/uu/od/src/inputdecoder.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/uu/od/src/inputdecoder.rs b/src/uu/od/src/inputdecoder.rs index 377f0c4ef..3b36c28fb 100644 --- a/src/uu/od/src/inputdecoder.rs +++ b/src/uu/od/src/inputdecoder.rs @@ -38,10 +38,7 @@ impl<'a, I> InputDecoder<'a, I> { peek_length: usize, byte_order: ByteOrder, ) -> InputDecoder { - let mut bytes: Vec = Vec::with_capacity(normal_length + peek_length); - unsafe { - bytes.set_len(normal_length + peek_length); - } // fast but uninitialized + let bytes = vec![0; normal_length + peek_length]; InputDecoder { input, From e89387c089344a6763f94239673437909aa66c44 Mon Sep 17 00:00:00 2001 From: James Robson Date: Tue, 23 Feb 2021 19:49:11 +0000 Subject: [PATCH 348/606] Try removing seq-precision --- .github/workflows/GNU.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index b9b014dbf..30c109cda 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -76,9 +76,8 @@ jobs: sed -i -e "s|split |$(which split) |" tests/misc/factor-parallel.sh sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh - #Add specific timeout to seq-precision.sh because otherwise seq will fill logs and cause something to jam in make - sed -i -e "s| seq |$(which timeout) 0.1 seq |" tests/misc/seq-precision.sh - + # take seq-precision out + sed -i '/seq-precision.sh/ D' Makefile test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests shell: bash From c06967a45a9562f93cdb71a97d43811272e1ee26 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 23 Feb 2021 20:56:36 +0100 Subject: [PATCH 349/606] rustfmt two files --- src/uu/uptime/src/uptime.rs | 19 +++++++------------ tests/by-util/test_numfmt.rs | 1 - 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index 44360f515..4ea90e242 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -137,10 +137,7 @@ fn print_nusers(nusers: usize) { fn print_time() { let local_time = Local::now().time(); - print!( - " {} ", - local_time.format("%H:%M:%S") - ); + print!(" {} ", local_time.format("%H:%M:%S")); } #[cfg(unix)] @@ -156,15 +153,13 @@ fn get_uptime(boot_time: Option) -> i64 { .and_then(|_| proc_uptime_s.split_whitespace().next()) .and_then(|s| s.split('.').next().unwrap_or("0").parse().ok()); - proc_uptime.unwrap_or_else(|| { - match boot_time { - Some(t) => { - let now = Local::now().timestamp(); - let boottime = t as i64; - now - boottime - } - None => -1, + proc_uptime.unwrap_or_else(|| match boot_time { + Some(t) => { + let now = Local::now().timestamp(); + let boottime = t as i64; + now - boottime } + None => -1, }) } diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index 61667f310..f15371aed 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -247,7 +247,6 @@ fn test_leading_whitespace_should_imply_padding() { .run() .stdout_is(" 1000\n"); - new_ucmd!() .args(&["--from=auto"]) .pipe_in(" 202Ki") From 4cca2b651ad72a9683d9def7f8b2168e9bfab8f0 Mon Sep 17 00:00:00 2001 From: James Robson Date: Wed, 24 Feb 2021 17:28:20 +0000 Subject: [PATCH 350/606] Keep producing logs even if make hangs --- .github/workflows/GNU.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 30c109cda..a6e740319 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -6,7 +6,6 @@ jobs: gnu: name: Run GNU tests runs-on: ubuntu-latest - timeout-minutes: 240 # Kill after 4 hours in case something gets stuck steps: # Checks out a copy of your repository on the ubuntu-latest machine - name: Checkout code uutil @@ -86,7 +85,7 @@ jobs: GNULIB_DIR="${PWD}/gnulib" pushd gnu - unbuffer make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : + unbuffer timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make - name: Extract tests info shell: bash run: | From 1cef9aa0462e5e9c8517965d983262493785487b Mon Sep 17 00:00:00 2001 From: James Robson Date: Wed, 24 Feb 2021 17:47:30 +0000 Subject: [PATCH 351/606] Add timeouts to other tests that hang --- .github/workflows/GNU.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index a6e740319..cebd5550e 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -69,14 +69,17 @@ jobs: sed -i -e "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh sed -i -e "s|ls -|$(which ls) -|" tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh sed -i -e "s|mkdir |$(which mkdir) |" tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i -e "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh + sed -i -e "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh sed -i -e "s|chmod |$(which chmod) |" tests/du/inacc-dir.sh tests/mkdir/p-3.sh sed -i -e "s|sort |$(which sort) |" tests/ls/hyperlink.sh sed -i -e "s|split |$(which split) |" tests/misc/factor-parallel.sh sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh - # take seq-precision out - sed -i '/seq-precision.sh/ D' Makefile + #Add specific timeout to tests that currently hang to limit time spent waiting + sed -i -e "s| seq |$(which timeout) 0.1 seq |" tests/misc/seq-precision.sh + sed -i -e "s|cat |$(which timeout) 0.1 cat |" tests/misc/cat-self.sh + + test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" - name: Run GNU tests shell: bash From 03619d867ebd00ff87addf05b4e66cd4a1ee070e Mon Sep 17 00:00:00 2001 From: James Robson Date: Thu, 25 Feb 2021 18:18:30 +0000 Subject: [PATCH 352/606] More tight timeouts --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index cebd5550e..6739a12b5 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -76,7 +76,7 @@ jobs: sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh #Add specific timeout to tests that currently hang to limit time spent waiting - sed -i -e "s| seq |$(which timeout) 0.1 seq |" tests/misc/seq-precision.sh + sed -i -e "s|seq \\$|$(which timeout) 0.1 seq \$|" tests/misc/seq-precision.sh tests/misc/seq-long-double.sh sed -i -e "s|cat |$(which timeout) 0.1 cat |" tests/misc/cat-self.sh From bbce17911596c54891154988b86e32241e9351e6 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sat, 27 Feb 2021 13:25:13 +0000 Subject: [PATCH 353/606] Remove unbuffer This causes the make process to hang for some reason, and it itsn't providing any real advantage so it's taken out --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 6739a12b5..fb2e231d4 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -88,7 +88,7 @@ jobs: GNULIB_DIR="${PWD}/gnulib" pushd gnu - unbuffer timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make + timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make - name: Extract tests info shell: bash run: | From a395af7ee761aef1041567edecebe46bf6382fcd Mon Sep 17 00:00:00 2001 From: James Robson Date: Sat, 27 Feb 2021 14:35:31 +0000 Subject: [PATCH 354/606] Create *sum binaries for tests --- .github/workflows/GNU.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index fb2e231d4..528d62863 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -38,6 +38,12 @@ jobs: pushd uutils make PROFILE=release cp target/release/install target/release/ginstall # The GNU tests rename this script before running, to avoid confusion with the make target + # Create *sum binaries + for sum in b2sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum + do + sum_path="target/release/${sum}" + fest -f "${sum_path}" || cp target/release/hashsum "${sum_path}" + done BUILDDIR="$PWD/target/release/" popd GNULIB_SRCDIR="$PWD/gnulib" From 20082971be5d47fd13ad2ae928de8574cedfc8fb Mon Sep 17 00:00:00 2001 From: James Robson Date: Thu, 4 Mar 2021 17:33:31 +0000 Subject: [PATCH 355/606] Use system sha1sum in factor tests --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 528d62863..3a9864ae1 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -62,7 +62,7 @@ jobs: make tests/factor/t${i}.sh done grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||' - sed -i -e 's|^seq |/usr/bin/seq |' tests/factor/t*sh + sed -i -e 's|^seq |/usr/bin/seq |' -e "s|sha1sum |$(which sha1sum) |" tests/factor/t*sh # Remove tests checking for --version & --help # Not really interesting for us and logs are too big From 975e9ea565c4007ba04ab496f719cf7bd5eae1dc Mon Sep 17 00:00:00 2001 From: Felipe Lema <1232306+FelipeLema@users.noreply.github.com> Date: Thu, 4 Mar 2021 15:37:27 -0300 Subject: [PATCH 356/606] separate options into modules for chown --- src/uu/chown/src/chown.rs | 118 +++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 53 deletions(-) diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index 5ad82872b..b6109b0b5 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -27,20 +27,30 @@ use std::path::Path; static ABOUT: &str = "change file owner and group"; static VERSION: &str = env!("CARGO_PKG_VERSION"); -static OPT_CHANGES: &str = "changes"; -static OPT_DEREFERENCE: &str = "dereference"; -static OPT_NO_DEREFERENCE: &str = "no-dereference"; -static OPT_FROM: &str = "from"; -static OPT_PRESERVE_ROOT: &str = "preserve-root"; -static OPT_NO_PRESERVE_ROOT: &str = "no-preserve-root"; -static OPT_QUIET: &str = "quiet"; -static OPT_RECURSIVE: &str = "recursive"; -static OPT_REFERENCE: &str = "reference"; -static OPT_SILENT: &str = "silent"; -static OPT_TRAVERSE: &str = "H"; -static OPT_NO_TRAVERSE: &str = "P"; -static OPT_TRAVERSE_EVERY: &str = "L"; -static OPT_VERBOSE: &str = "verbose"; +pub mod options { + pub mod verbosity { + pub static CHANGES: &str = "changes"; + pub static QUIET: &str = "quiet"; + pub static SILENT: &str = "silent"; + pub static VERBOSE: &str = "verbose"; + } + pub mod preserve_root { + pub static PRESERVE: &str = "preserve-root"; + pub static NO_PRESERVE: &str = "no-preserve-root"; + } + pub mod dereference { + pub static DEREFERENCE: &str = "dereference"; + pub static NO_DEREFERENCE: &str = "no-dereference"; // not actually read? + } + pub static FROM: &str = "from"; + pub static RECURSIVE: &str = "recursive"; // TODO(felipel) recursive, reference, traverse related? + pub mod traverse { + pub static TRAVERSE: &str = "H"; + pub static NO_TRAVERSE: &str = "P"; + pub static EVERY: &str = "L"; + } + pub static REFERENCE: &str = "reference"; +} static ARG_OWNER: &str = "owner"; static ARG_FILES: &str = "files"; @@ -66,80 +76,80 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .arg( - Arg::with_name(OPT_CHANGES) + Arg::with_name(options::verbosity::CHANGES) .short("c") - .long(OPT_CHANGES) + .long(options::verbosity::CHANGES) .help("like verbose but report only when a change is made"), ) - .arg(Arg::with_name(OPT_DEREFERENCE).long(OPT_DEREFERENCE).help( + .arg(Arg::with_name(options::dereference::DEREFERENCE).long(options::dereference::DEREFERENCE).help( "affect the referent of each symbolic link (this is the default), rather than the symbolic link itself", )) .arg( - Arg::with_name(OPT_NO_DEREFERENCE) + Arg::with_name(options::dereference::NO_DEREFERENCE) .short("h") - .long(OPT_NO_DEREFERENCE) + .long(options::dereference::NO_DEREFERENCE) .help( "affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)", ), ) .arg( - Arg::with_name(OPT_FROM) - .long(OPT_FROM) + Arg::with_name(options::FROM) + .long(options::FROM) .help( "change the owner and/or group of each file only if its current owner and/or group match those specified here. Either may be omitted, in which case a match is not required for the omitted attribute", ) .value_name("CURRENT_OWNER:CURRENT_GROUP"), ) .arg( - Arg::with_name(OPT_PRESERVE_ROOT) - .long(OPT_PRESERVE_ROOT) + Arg::with_name(options::preserve_root::PRESERVE) + .long(options::preserve_root::PRESERVE) .help("fail to operate recursively on '/'"), ) .arg( - Arg::with_name(OPT_NO_PRESERVE_ROOT) - .long(OPT_NO_PRESERVE_ROOT) + Arg::with_name(options::preserve_root::NO_PRESERVE) + .long(options::preserve_root::NO_PRESERVE) .help("do not treat '/' specially (the default)"), ) .arg( - Arg::with_name(OPT_QUIET) - .long(OPT_QUIET) + Arg::with_name(options::verbosity::QUIET) + .long(options::verbosity::QUIET) .help("suppress most error messages"), ) .arg( - Arg::with_name(OPT_RECURSIVE) + Arg::with_name(options::RECURSIVE) .short("R") - .long(OPT_RECURSIVE) + .long(options::RECURSIVE) .help("operate on files and directories recursively"), ) .arg( - Arg::with_name(OPT_REFERENCE) - .long(OPT_REFERENCE) + Arg::with_name(options::REFERENCE) + .long(options::REFERENCE) .help("use RFILE's owner and group rather than specifying OWNER:GROUP values") .value_name("RFILE") .min_values(1), ) - .arg(Arg::with_name(OPT_SILENT).short("f").long(OPT_SILENT)) + .arg(Arg::with_name(options::verbosity::SILENT).short("f").long(options::verbosity::SILENT)) .arg( - Arg::with_name(OPT_TRAVERSE) - .short(OPT_TRAVERSE) + Arg::with_name(options::traverse::TRAVERSE) + .short(options::traverse::TRAVERSE) .help("if a command line argument is a symbolic link to a directory, traverse it") - .overrides_with_all(&[OPT_TRAVERSE_EVERY, OPT_NO_TRAVERSE]), + .overrides_with_all(&[options::traverse::EVERY, options::traverse::NO_TRAVERSE]), ) .arg( - Arg::with_name(OPT_TRAVERSE_EVERY) - .short(OPT_TRAVERSE_EVERY) + Arg::with_name(options::traverse::EVERY) + .short(options::traverse::EVERY) .help("traverse every symbolic link to a directory encountered") - .overrides_with_all(&[OPT_TRAVERSE, OPT_NO_TRAVERSE]), + .overrides_with_all(&[options::traverse::TRAVERSE, options::traverse::NO_TRAVERSE]), ) .arg( - Arg::with_name(OPT_NO_TRAVERSE) - .short(OPT_NO_TRAVERSE) + Arg::with_name(options::traverse::NO_TRAVERSE) + .short(options::traverse::NO_TRAVERSE) .help("do not traverse any symbolic links (default)") - .overrides_with_all(&[OPT_TRAVERSE, OPT_TRAVERSE_EVERY]), + .overrides_with_all(&[options::traverse::TRAVERSE, options::traverse::EVERY]), ) .arg( - Arg::with_name(OPT_VERBOSE) - .long(OPT_VERBOSE) + Arg::with_name(options::verbosity::VERBOSE) + .long(options::verbosity::VERBOSE) .help("output a diagnostic for every file processed"), ) .arg( @@ -166,23 +176,23 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); - let preserve_root = matches.is_present(OPT_PRESERVE_ROOT); + let preserve_root = matches.is_present(options::preserve_root::PRESERVE); - let mut derefer = if matches.is_present(OPT_NO_DEREFERENCE) { + let mut derefer = if matches.is_present(options::dereference::NO_DEREFERENCE) { 1 } else { 0 }; - let mut bit_flag = if matches.is_present(OPT_TRAVERSE) { + let mut bit_flag = if matches.is_present(options::traverse::TRAVERSE) { FTS_COMFOLLOW | FTS_PHYSICAL - } else if matches.is_present(OPT_TRAVERSE_EVERY) { + } else if matches.is_present(options::traverse::EVERY) { FTS_LOGICAL } else { FTS_PHYSICAL }; - let recursive = matches.is_present(OPT_RECURSIVE); + let recursive = matches.is_present(options::RECURSIVE); if recursive { if bit_flag == FTS_PHYSICAL { if derefer == 1 { @@ -195,17 +205,19 @@ pub fn uumain(args: impl uucore::Args) -> i32 { bit_flag = FTS_PHYSICAL; } - let verbosity = if matches.is_present(OPT_CHANGES) { + let verbosity = if matches.is_present(options::verbosity::CHANGES) { Verbosity::Changes - } else if matches.is_present(OPT_SILENT) || matches.is_present(OPT_QUIET) { + } else if matches.is_present(options::verbosity::SILENT) + || matches.is_present(options::verbosity::QUIET) + { Verbosity::Silent - } else if matches.is_present(OPT_VERBOSE) { + } else if matches.is_present(options::verbosity::VERBOSE) { Verbosity::Verbose } else { Verbosity::Normal }; - let filter = if let Some(spec) = matches.value_of(OPT_FROM) { + let filter = if let Some(spec) = matches.value_of(options::FROM) { match parse_spec(&spec) { Ok((Some(uid), None)) => IfFrom::User(uid), Ok((None, Some(gid))) => IfFrom::Group(gid), @@ -222,7 +234,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let dest_uid: Option; let dest_gid: Option; - if let Some(file) = matches.value_of(OPT_REFERENCE) { + if let Some(file) = matches.value_of(options::REFERENCE) { match fs::metadata(&file) { Ok(meta) => { dest_gid = Some(meta.gid()); From e4d9d1868af127a40c5652260f5cbde065f1e214 Mon Sep 17 00:00:00 2001 From: Felipe Lema <1232306+FelipeLema@users.noreply.github.com> Date: Thu, 4 Mar 2021 15:38:01 -0300 Subject: [PATCH 357/606] remove markers this can be improved in the future. this branch is just the kick-off --- src/uu/chown/src/chown.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index b6109b0b5..42010de03 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -40,10 +40,10 @@ pub mod options { } pub mod dereference { pub static DEREFERENCE: &str = "dereference"; - pub static NO_DEREFERENCE: &str = "no-dereference"; // not actually read? + pub static NO_DEREFERENCE: &str = "no-dereference"; } pub static FROM: &str = "from"; - pub static RECURSIVE: &str = "recursive"; // TODO(felipel) recursive, reference, traverse related? + pub static RECURSIVE: &str = "recursive"; pub mod traverse { pub static TRAVERSE: &str = "H"; pub static NO_TRAVERSE: &str = "P"; From 3b9399513293f9225b8050326507ac9cc44487b8 Mon Sep 17 00:00:00 2001 From: James Robson Date: Thu, 4 Mar 2021 19:11:38 +0000 Subject: [PATCH 358/606] generate all factor scripts --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 3a9864ae1..91796214c 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -57,7 +57,7 @@ jobs: sed -i 's| tr | /usr/bin/tr |' tests/init.sh make # Generate the factor tests, so they can be fixed - for i in $(seq -w 1 36) + for i in $(seq -w 0 36) do make tests/factor/t${i}.sh done From e42479b79b5ba63a87ef902da684ec3ed28f2f1e Mon Sep 17 00:00:00 2001 From: James Robson Date: Thu, 4 Mar 2021 20:50:57 +0000 Subject: [PATCH 359/606] fail tests for any binary not built --- .github/workflows/GNU.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 91796214c..f6729d0d1 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -37,17 +37,26 @@ jobs: sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify expect python3-sphinx pushd uutils make PROFILE=release - cp target/release/install target/release/ginstall # The GNU tests rename this script before running, to avoid confusion with the make target + BUILDDIR="$PWD/target/release/" + cp ${BUILDDIR}/install ${BUILDDIR}/ginstall # The GNU tests rename this script before running, to avoid confusion with the make target # Create *sum binaries for sum in b2sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum do - sum_path="target/release/${sum}" - fest -f "${sum_path}" || cp target/release/hashsum "${sum_path}" + sum_path="${BUILDDIR}/${sum}" + test -f "${sum_path}" || cp "${BUILDDIR}/hashsum" "${sum_path}" done - BUILDDIR="$PWD/target/release/" + test -f "${BUILDDIR}/[" || cp "${BUILDDIR}/test" "${BUILDDIR}/[" popd GNULIB_SRCDIR="$PWD/gnulib" pushd gnu/ + + # Any binaries that aren't built become `false` so their tests fail + for binary in $(./build-aux/gen-lists-of-programs.sh --list-progs) + do + bin_path="${BUILDDIR}/${binary}" + test -f "${bin_path}" || cp "${BUILDDIR}/false" "${bin_path}" + done + ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" ./configure --quiet --disable-gcc-warnings #Add timeout to to protect against hangs From b098bd5ec2e7523c7eb659bee927edf32c8680bc Mon Sep 17 00:00:00 2001 From: James Robson Date: Fri, 5 Mar 2021 21:40:16 +0000 Subject: [PATCH 360/606] Fix tests still failing for the wrong reason --- .github/workflows/GNU.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index f6729d0d1..4d3e39613 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -84,9 +84,10 @@ jobs: sed -i -e "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh sed -i -e "s|ls -|$(which ls) -|" tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh sed -i -e "s|mkdir |$(which mkdir) |" tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i -e "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/inotify-rotate.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh + sed -i -e "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh + sed -i -e "s| timeout | $(which timeout) |" tests/tail-2/inotify-rotate.sh # Don't break the function called 'grep_timeout' sed -i -e "s|chmod |$(which chmod) |" tests/du/inacc-dir.sh tests/mkdir/p-3.sh - sed -i -e "s|sort |$(which sort) |" tests/ls/hyperlink.sh + sed -i -e "s|sort |$(which sort) |" tests/ls/hyperlink.sh tests/misc/test-N.sh sed -i -e "s|split |$(which split) |" tests/misc/factor-parallel.sh sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh From 8dae8b798a1de60689271df83676bfe60ab8ebb5 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sat, 6 Mar 2021 16:35:22 +0000 Subject: [PATCH 361/606] Revert "Remove unbuffer" This reverts commit bbce17911596c54891154988b86e32241e9351e6. --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 4d3e39613..2cfc535ce 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -104,7 +104,7 @@ jobs: GNULIB_DIR="${PWD}/gnulib" pushd gnu - timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make + unbuffer timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make - name: Extract tests info shell: bash run: | From d06f91fbe264efccb206632e6fbc75d5f0902f86 Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Sat, 6 Mar 2021 12:26:05 -0500 Subject: [PATCH 362/606] 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 --- src/uu/numfmt/src/numfmt.rs | 103 ++++++++++++------ tests/by-util/test_numfmt.rs | 54 +++++++-- .../fixtures/numfmt/gnutest_iec-i_result.txt | 49 +++++++++ tests/fixtures/numfmt/gnutest_iec_input.txt | 49 +++++++++ tests/fixtures/numfmt/gnutest_iec_result.txt | 49 +++++++++ tests/fixtures/numfmt/gnutest_si_input.txt | 39 +++++++ tests/fixtures/numfmt/gnutest_si_result.txt | 39 +++++++ 7 files changed, 341 insertions(+), 41 deletions(-) create mode 100644 tests/fixtures/numfmt/gnutest_iec-i_result.txt create mode 100644 tests/fixtures/numfmt/gnutest_iec_input.txt create mode 100644 tests/fixtures/numfmt/gnutest_iec_result.txt create mode 100644 tests/fixtures/numfmt/gnutest_si_input.txt create mode 100644 tests/fixtures/numfmt/gnutest_si_result.txt diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index 4d3b7387a..0ee25e96a 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -50,8 +50,9 @@ fn get_usage() -> String { format!("{0} [OPTION]... [NUMBER]...", executable!()) } +const SI_BASES: [f64; 10] = [1., 1e3, 1e6, 1e9, 1e12, 1e15, 1e18, 1e21, 1e24, 1e27]; + const IEC_BASES: [f64; 10] = [ - //premature optimization 1., 1_024., 1_048_576., @@ -75,6 +76,7 @@ enum Unit { None, } +#[derive(Clone, Copy, Debug)] enum RawSuffix { K, M, @@ -201,38 +203,74 @@ fn remove_suffix(i: f64, s: Option, u: &Unit) -> Result { fn transform_from(s: &str, opts: &Transform) -> Result { let (i, suffix) = parse_suffix(s)?; - remove_suffix(i, suffix, &opts.unit).map(|n| n.round()) + + remove_suffix(i, suffix, &opts.unit).map(|n| if n < 0.0 { -n.abs().ceil() } else { n.ceil() }) } -fn consider_suffix(i: f64, u: &Unit) -> Result<(f64, Option)> { - let j = i.abs(); - match *u { - Unit::Si => match j { - _ if j < 1e3 => Ok((i, None)), - _ if j < 1e6 => Ok((i / 1e3, Some((RawSuffix::K, false)))), - _ if j < 1e9 => Ok((i / 1e6, Some((RawSuffix::M, false)))), - _ if j < 1e12 => Ok((i / 1e9, Some((RawSuffix::G, false)))), - _ if j < 1e15 => Ok((i / 1e12, Some((RawSuffix::T, false)))), - _ if j < 1e18 => Ok((i / 1e15, Some((RawSuffix::P, false)))), - _ if j < 1e21 => Ok((i / 1e18, Some((RawSuffix::E, false)))), - _ if j < 1e24 => Ok((i / 1e21, Some((RawSuffix::Z, false)))), - _ if j < 1e27 => Ok((i / 1e24, Some((RawSuffix::Y, false)))), - _ => Err("Number is too big and unsupported".to_owned()), - }, - Unit::Iec(with_i) => match j { - _ if j < IEC_BASES[1] => Ok((i, None)), - _ if j < IEC_BASES[2] => Ok((i / IEC_BASES[1], Some((RawSuffix::K, with_i)))), - _ if j < IEC_BASES[3] => Ok((i / IEC_BASES[2], Some((RawSuffix::M, with_i)))), - _ if j < IEC_BASES[4] => Ok((i / IEC_BASES[3], Some((RawSuffix::G, with_i)))), - _ if j < IEC_BASES[5] => Ok((i / IEC_BASES[4], Some((RawSuffix::T, with_i)))), - _ if j < IEC_BASES[6] => Ok((i / IEC_BASES[5], Some((RawSuffix::P, with_i)))), - _ if j < IEC_BASES[7] => Ok((i / IEC_BASES[6], Some((RawSuffix::E, with_i)))), - _ if j < IEC_BASES[8] => Ok((i / IEC_BASES[7], Some((RawSuffix::Z, with_i)))), - _ if j < IEC_BASES[9] => Ok((i / IEC_BASES[8], Some((RawSuffix::Y, with_i)))), - _ => Err("Number is too big and unsupported".to_owned()), - }, - Unit::Auto => Err("Unit 'auto' isn't supported with --to options".to_owned()), - Unit::None => Ok((i, None)), +/// Divide numerator by denominator, with ceiling. +/// +/// If the result of the division is less than 10.0, truncate the result +/// to the next highest tenth. +/// +/// Otherwise, truncate the result to the next highest whole number. +/// +/// Examples: +/// +/// ``` +/// use uu_numfmt::div_ceil; +/// +/// assert_eq!(div_ceil(1.01, 1.0), 1.1); +/// assert_eq!(div_ceil(999.1, 1000.), 1.0); +/// assert_eq!(div_ceil(1001., 10.), 101.); +/// assert_eq!(div_ceil(9991., 10.), 1000.); +/// assert_eq!(div_ceil(-12.34, 1.0), -13.0); +/// assert_eq!(div_ceil(1000.0, -3.14), -319.0); +/// assert_eq!(div_ceil(-271828.0, -271.0), 1004.0); +/// ``` +pub fn div_ceil(n: f64, d: f64) -> f64 { + let v = n / (d / 10.0); + let (v, sign) = if v < 0.0 { (v.abs(), -1.0) } else { (v, 1.0) }; + + if v < 100.0 { + v.ceil() / 10.0 * sign + } else { + (v / 10.0).ceil() * sign + } +} + +fn consider_suffix(n: f64, u: &Unit) -> Result<(f64, Option)> { + use RawSuffix::*; + + let abs_n = n.abs(); + let suffixes = [K, M, G, T, P, E, Z, Y]; + + let (bases, with_i) = match *u { + Unit::Si => (&SI_BASES, false), + Unit::Iec(with_i) => (&IEC_BASES, with_i), + Unit::Auto => return Err("Unit 'auto' isn't supported with --to options".to_owned()), + Unit::None => return Ok((n, None)), + }; + + let i = match abs_n { + _ if abs_n <= bases[1] - 1.0 => return Ok((n, None)), + _ if abs_n < bases[2] => 1, + _ if abs_n < bases[3] => 2, + _ if abs_n < bases[4] => 3, + _ if abs_n < bases[5] => 4, + _ if abs_n < bases[6] => 5, + _ if abs_n < bases[7] => 6, + _ if abs_n < bases[8] => 7, + _ if abs_n < bases[9] => 8, + _ => return Err("Number is too big and unsupported".to_string()), + }; + + let v = div_ceil(n, bases[i]); + + // check if rounding pushed us into the next base + if v.abs() >= bases[1] { + Ok((v / bases[1], Some((suffixes[i], with_i)))) + } else { + Ok((v, Some((suffixes[i - 1], with_i)))) } } @@ -240,7 +278,8 @@ fn transform_to(s: f64, opts: &Transform) -> Result { let (i2, s) = consider_suffix(s, &opts.unit)?; Ok(match s { None => format!("{}", i2), - Some(s) => format!("{:.1}{}", i2, DisplayableSuffix(s)), + Some(s) if i2.abs() < 10.0 => format!("{:.1}{}", i2, DisplayableSuffix(s)), + Some(s) => format!("{:.0}{}", i2, DisplayableSuffix(s)), }) } diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index f15371aed..787ec6832 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -15,16 +15,25 @@ fn test_from_iec() { .args(&["--from=iec"]) .pipe_in("1024\n1.1M\n0.1G") .run() - .stdout_is("1024\n1153434\n107374182\n"); + .stdout_is("1024\n1153434\n107374183\n"); } #[test] fn test_from_iec_i() { new_ucmd!() .args(&["--from=iec-i"]) - .pipe_in("1024\n1.1Mi\n0.1Gi") + .pipe_in("1.1Mi\n0.1Gi") .run() - .stdout_is("1024\n1153434\n107374182\n"); + .stdout_is("1153434\n107374183\n"); +} + +#[test] +#[ignore] // FIXME: GNU from iec-i requires suffix +fn test_from_iec_i_requires_suffix() { + new_ucmd!() + .args(&["--from=iec-i", "1024"]) + .fails() + .stderr_is("numfmt: missing 'i' suffix in input: ‘1024’ (e.g Ki/Mi/Gi)"); } #[test] @@ -42,7 +51,7 @@ fn test_to_si() { .args(&["--to=si"]) .pipe_in("1000\n1100000\n100000000") .run() - .stdout_is("1.0K\n1.1M\n100.0M\n"); + .stdout_is("1.0K\n1.1M\n100M\n"); } #[test] @@ -51,7 +60,7 @@ fn test_to_iec() { .args(&["--to=iec"]) .pipe_in("1024\n1153434\n107374182") .run() - .stdout_is("1.0K\n1.1M\n102.4M\n"); + .stdout_is("1.0K\n1.2M\n103M\n"); } #[test] @@ -60,7 +69,7 @@ fn test_to_iec_i() { .args(&["--to=iec-i"]) .pipe_in("1024\n1153434\n107374182") .run() - .stdout_is("1.0Ki\n1.1Mi\n102.4Mi\n"); + .stdout_is("1.0Ki\n1.2Mi\n103Mi\n"); } #[test] @@ -142,7 +151,7 @@ fn test_negative() { .args(&["--to=iec-i"]) .pipe_in("-1024\n-1153434\n-107374182") .run() - .stdout_is("-1.0Ki\n-1.1Mi\n-102.4Mi\n"); + .stdout_is("-1.0Ki\n-1.2Mi\n-103Mi\n"); } #[test] @@ -159,7 +168,7 @@ fn test_normalize() { .args(&["--from=si", "--to=si"]) .pipe_in("10000000K\n0.001K") .run() - .stdout_is("10.0G\n1\n"); + .stdout_is("10G\n1\n"); } #[test] @@ -167,7 +176,7 @@ fn test_si_to_iec() { new_ucmd!() .args(&["--from=si", "--to=iec", "15334263563K"]) .run() - .stdout_is("13.9T\n"); + .stdout_is("14T\n"); } #[test] @@ -279,3 +288,30 @@ fn test_should_calculate_implicit_padding_per_free_argument() { .run() .stdout_is(" 1024\n 2000\n"); } + +#[test] +fn test_to_si_should_truncate_output() { + new_ucmd!() + .args(&["--to=si"]) + .pipe_in_fixture("gnutest_si_input.txt") + .succeeds() + .stdout_is_fixture("gnutest_si_result.txt"); +} + +#[test] +fn test_to_iec_should_truncate_output() { + new_ucmd!() + .args(&["--to=iec"]) + .pipe_in_fixture("gnutest_iec_input.txt") + .succeeds() + .stdout_is_fixture("gnutest_iec_result.txt"); +} + +#[test] +fn test_to_iec_i_should_truncate_output() { + new_ucmd!() + .args(&["--to=iec-i"]) + .pipe_in_fixture("gnutest_iec_input.txt") + .succeeds() + .stdout_is_fixture("gnutest_iec-i_result.txt"); +} diff --git a/tests/fixtures/numfmt/gnutest_iec-i_result.txt b/tests/fixtures/numfmt/gnutest_iec-i_result.txt new file mode 100644 index 000000000..b4c286fc6 --- /dev/null +++ b/tests/fixtures/numfmt/gnutest_iec-i_result.txt @@ -0,0 +1,49 @@ +-1.1Ki +-1.1Ki +-1.0Ki +-1.0Ki +-1023 +0 +1 +1023 +1.0Ki +1.1Ki +1.1Ki +1.2Ki +1.5Ki +1.6Ki +1.9Ki +2.0Ki +2.0Ki +2.0Ki +2.0Ki +2.1Ki +10Ki +10Ki +10Ki +100Ki +100Ki +100Ki +949Ki +950Ki +950Ki +951Ki +951Ki +952Ki +990Ki +991Ki +995Ki +995Ki +996Ki +996Ki +997Ki +999Ki +1000Ki +1023Ki +1.0Mi +1.0Mi +1.0Mi +1.1Mi +1.0Gi +1.0Gi +1.1Gi diff --git a/tests/fixtures/numfmt/gnutest_iec_input.txt b/tests/fixtures/numfmt/gnutest_iec_input.txt new file mode 100644 index 000000000..bd7e867d5 --- /dev/null +++ b/tests/fixtures/numfmt/gnutest_iec_input.txt @@ -0,0 +1,49 @@ +-1025 +-1024.1 +-1024 +-1023.1 +-1023 +0 +1 +1023 +1024 +1025 +1126 +1127 +1536 +1537 +1945 +1946 +1996 +1997 +2048 +2049 +10188 +10189 +10240 +102348 +102349 +102400 +971776 +972288 +972800 +972801 +973824 +973825 +1013760 +1013761 +1018879 +1018880 +1018881 +1019904 +1019905 +1022976 +1022977 +1047552 +1047553 +1048575 +1048576 +1048577 +1073741823 +1073741824 +1073741825 diff --git a/tests/fixtures/numfmt/gnutest_iec_result.txt b/tests/fixtures/numfmt/gnutest_iec_result.txt new file mode 100644 index 000000000..61c5515b8 --- /dev/null +++ b/tests/fixtures/numfmt/gnutest_iec_result.txt @@ -0,0 +1,49 @@ +-1.1K +-1.1K +-1.0K +-1.0K +-1023 +0 +1 +1023 +1.0K +1.1K +1.1K +1.2K +1.5K +1.6K +1.9K +2.0K +2.0K +2.0K +2.0K +2.1K +10K +10K +10K +100K +100K +100K +949K +950K +950K +951K +951K +952K +990K +991K +995K +995K +996K +996K +997K +999K +1000K +1023K +1.0M +1.0M +1.0M +1.1M +1.0G +1.0G +1.1G diff --git a/tests/fixtures/numfmt/gnutest_si_input.txt b/tests/fixtures/numfmt/gnutest_si_input.txt new file mode 100644 index 000000000..3fcf4f9ff --- /dev/null +++ b/tests/fixtures/numfmt/gnutest_si_input.txt @@ -0,0 +1,39 @@ +-1001 +-999.1 +-999 +1 +500 +999 +999.1 +1000 +1000.1 +1001 +9900 +9901 +9949 +9950 +9951 +10000 +10001 +10500 +10999 +50000 +99000 +99001 +99900 +99949 +99950 +100000 +100001 +100999 +101000 +101001 +999000 +999001 +999949 +999950 +999999 +1000000 +1000001 +999000000.1 +999000001 diff --git a/tests/fixtures/numfmt/gnutest_si_result.txt b/tests/fixtures/numfmt/gnutest_si_result.txt new file mode 100644 index 000000000..7238ba40c --- /dev/null +++ b/tests/fixtures/numfmt/gnutest_si_result.txt @@ -0,0 +1,39 @@ +-1.1K +-1.0K +-999 +1 +500 +999 +1.0K +1.0K +1.1K +1.1K +9.9K +10K +10K +10K +10K +10K +11K +11K +11K +50K +99K +100K +100K +100K +100K +100K +101K +101K +101K +102K +999K +1.0M +1.0M +1.0M +1.0M +1.0M +1.1M +1.0G +1.0G From c820329efd3f02ea416e2d073bf30d4f4b92b708 Mon Sep 17 00:00:00 2001 From: Chad Brewbaker Date: Sat, 6 Mar 2021 11:26:55 -0600 Subject: [PATCH 363/606] 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 --- src/uu/mktemp/src/mktemp.rs | 1 + tests/by-util/test_ls.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index 8969dc51c..663f7d4ad 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -25,6 +25,7 @@ mod tempdir; static ABOUT: &str = "create a temporary file or directory."; static VERSION: &str = env!("CARGO_PKG_VERSION"); + static DEFAULT_TEMPLATE: &str = "tmp.XXXXXXXXXX"; static OPT_DIRECTORY: &str = "directory"; diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 4dc4168de..422db8df9 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -285,7 +285,7 @@ fn test_ls_ls_color() { scene.ucmd().arg("--color=never").arg("z").succeeds(); } -#[cfg(not(target_os = "macos"))] // Truncate not available on mac +#[cfg(not(any(target_os = "macos", target_os = "windows")))] // Truncate not available on mac or win #[test] fn test_ls_human() { let scene = TestScenario::new(util_name!()); From 78ec6d1e5a20e697e7e79afead4ec34c5eba07d1 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sat, 6 Mar 2021 21:24:28 +0000 Subject: [PATCH 364/606] Revert "Revert "Remove unbuffer"" This reverts commit 8dae8b798a1de60689271df83676bfe60ab8ebb5. --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 2cfc535ce..4d3e39613 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -104,7 +104,7 @@ jobs: GNULIB_DIR="${PWD}/gnulib" pushd gnu - unbuffer timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make + timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make - name: Extract tests info shell: bash run: | From 72e090cd8330196d5d944642866b66822c6b66c7 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 7 Mar 2021 11:02:46 +0100 Subject: [PATCH 365/606] cargo: remove an old comment --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 219f571e8..44ca4ab95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "coreutils" -version = "0.0.3" # "0.0.3.1" +version = "0.0.3" authors = ["uutils developers"] license = "MIT" description = "coreutils ~ GNU coreutils (updated); implemented as universal (cross-platform) utils, written in Rust" From 933ac05dc7952694376fbc7115f87e73ac7cdebb Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 7 Mar 2021 11:04:43 +0100 Subject: [PATCH 366/606] add an ugly script to update the version --- util/update-version.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 util/update-version.sh diff --git a/util/update-version.sh b/util/update-version.sh new file mode 100644 index 000000000..584d13608 --- /dev/null +++ b/util/update-version.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# This is a stupid helper. I will mass replace all versions (including other crates) +# So, it should be triple-checked + + +FROM="0.0.3" +TO="0.0.4" + +UUCORE_FROM="0.0.6" +UUCORE_TO="0.0.7" + +PROGS=$(ls -1d src/uu/*/Cargo.toml src/uu/stdbuf/src/libstdbuf/Cargo.toml Cargo.toml) + +# update the version of all programs +sed -i -e "s|version = \"$FROM\"|version = \"$TO\"|" $PROGS + +# Update the stbuff stuff +sed -i -e "s|libstdbuf = { version=\"$FROM\"|libstdbuf = { version=\"$TO\"|" src/uu/stdbuf/Cargo.toml +sed -i -e "s|= { optional=true, version=\"$FROM\", package=\"uu_|= { optional=true, version=\"$TO\", package=\"uu_|g" Cargo.toml + +# Update uucore itself +sed -i -e "s|version = \"$UUCORE_FROM\"|version = \"$UUCORE_TO\"|" src/uucore/Cargo.toml +# Update crates using uucore +sed -i -e "s|uucore = { version=\">=$UUCORE_FROM\",|uucore = { version=\">=$UUCORE_TO\",|" $PROGS + + From 6481c5a247e2057f98b14ce78d19365a559c9f8a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 7 Mar 2021 11:08:27 +0100 Subject: [PATCH 367/606] Prepare version 0.0.4 --- Cargo.toml | 192 ++++++++++++------------- src/uu/arch/Cargo.toml | 2 +- src/uu/base32/Cargo.toml | 2 +- src/uu/base64/Cargo.toml | 2 +- src/uu/basename/Cargo.toml | 2 +- src/uu/cat/Cargo.toml | 2 +- src/uu/chgrp/Cargo.toml | 2 +- src/uu/chmod/Cargo.toml | 2 +- src/uu/chown/Cargo.toml | 2 +- src/uu/chroot/Cargo.toml | 2 +- src/uu/cksum/Cargo.toml | 2 +- src/uu/comm/Cargo.toml | 2 +- src/uu/cp/Cargo.toml | 2 +- src/uu/csplit/Cargo.toml | 2 +- src/uu/cut/Cargo.toml | 2 +- src/uu/date/Cargo.toml | 2 +- src/uu/df/Cargo.toml | 2 +- src/uu/dircolors/Cargo.toml | 2 +- src/uu/dirname/Cargo.toml | 2 +- src/uu/du/Cargo.toml | 2 +- src/uu/echo/Cargo.toml | 2 +- src/uu/env/Cargo.toml | 2 +- src/uu/expand/Cargo.toml | 2 +- src/uu/expr/Cargo.toml | 2 +- src/uu/factor/Cargo.toml | 2 +- src/uu/false/Cargo.toml | 2 +- src/uu/fmt/Cargo.toml | 2 +- src/uu/fold/Cargo.toml | 2 +- src/uu/groups/Cargo.toml | 2 +- src/uu/hashsum/Cargo.toml | 2 +- src/uu/head/Cargo.toml | 2 +- src/uu/hostid/Cargo.toml | 2 +- src/uu/hostname/Cargo.toml | 2 +- src/uu/id/Cargo.toml | 2 +- src/uu/install/Cargo.toml | 2 +- src/uu/join/Cargo.toml | 2 +- src/uu/kill/Cargo.toml | 2 +- src/uu/link/Cargo.toml | 2 +- src/uu/ln/Cargo.toml | 2 +- src/uu/logname/Cargo.toml | 2 +- src/uu/ls/Cargo.toml | 2 +- src/uu/mkdir/Cargo.toml | 2 +- src/uu/mkfifo/Cargo.toml | 2 +- src/uu/mknod/Cargo.toml | 2 +- src/uu/mktemp/Cargo.toml | 2 +- src/uu/more/Cargo.toml | 2 +- src/uu/mv/Cargo.toml | 2 +- src/uu/nice/Cargo.toml | 2 +- src/uu/nl/Cargo.toml | 2 +- src/uu/nohup/Cargo.toml | 2 +- src/uu/nproc/Cargo.toml | 2 +- src/uu/numfmt/Cargo.toml | 2 +- src/uu/od/Cargo.toml | 2 +- src/uu/paste/Cargo.toml | 2 +- src/uu/pathchk/Cargo.toml | 2 +- src/uu/pinky/Cargo.toml | 2 +- src/uu/printenv/Cargo.toml | 2 +- src/uu/printf/Cargo.toml | 2 +- src/uu/ptx/Cargo.toml | 2 +- src/uu/pwd/Cargo.toml | 2 +- src/uu/readlink/Cargo.toml | 2 +- src/uu/realpath/Cargo.toml | 2 +- src/uu/relpath/Cargo.toml | 2 +- src/uu/rm/Cargo.toml | 2 +- src/uu/rmdir/Cargo.toml | 2 +- src/uu/seq/Cargo.toml | 2 +- src/uu/shred/Cargo.toml | 2 +- src/uu/shuf/Cargo.toml | 2 +- src/uu/sleep/Cargo.toml | 2 +- src/uu/sort/Cargo.toml | 2 +- src/uu/split/Cargo.toml | 2 +- src/uu/stat/Cargo.toml | 2 +- src/uu/stdbuf/Cargo.toml | 4 +- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 2 +- src/uu/sum/Cargo.toml | 2 +- src/uu/sync/Cargo.toml | 2 +- src/uu/tac/Cargo.toml | 2 +- src/uu/tail/Cargo.toml | 2 +- src/uu/tee/Cargo.toml | 2 +- src/uu/test/Cargo.toml | 2 +- src/uu/timeout/Cargo.toml | 2 +- src/uu/touch/Cargo.toml | 2 +- src/uu/tr/Cargo.toml | 2 +- src/uu/true/Cargo.toml | 2 +- src/uu/truncate/Cargo.toml | 2 +- src/uu/tsort/Cargo.toml | 2 +- src/uu/tty/Cargo.toml | 2 +- src/uu/uname/Cargo.toml | 2 +- src/uu/unexpand/Cargo.toml | 2 +- src/uu/uniq/Cargo.toml | 2 +- src/uu/unlink/Cargo.toml | 2 +- src/uu/uptime/Cargo.toml | 2 +- src/uu/users/Cargo.toml | 2 +- src/uu/wc/Cargo.toml | 2 +- src/uu/who/Cargo.toml | 2 +- src/uu/whoami/Cargo.toml | 2 +- src/uu/yes/Cargo.toml | 2 +- src/uucore/Cargo.toml | 2 +- 98 files changed, 194 insertions(+), 194 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 44ca4ab95..7146a015b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "coreutils" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "coreutils ~ GNU coreutils (updated); implemented as universal (cross-platform) utils, written in Rust" @@ -228,102 +228,102 @@ lazy_static = { version="1.3" } textwrap = { version="=0.11.0", features=["term_size"] } # !maint: [2020-05-10; rivy] unstable crate using undocumented features; pinned currently, will review uucore = { version=">=0.0.6", package="uucore", path="src/uucore" } # * uutils -uu_test = { optional=true, version="0.0.3", package="uu_test", path="src/uu/test" } +uu_test = { optional=true, version="0.0.4", package="uu_test", path="src/uu/test" } # -arch = { optional=true, version="0.0.3", package="uu_arch", path="src/uu/arch" } -base32 = { optional=true, version="0.0.3", package="uu_base32", path="src/uu/base32" } -base64 = { optional=true, version="0.0.3", package="uu_base64", path="src/uu/base64" } -basename = { optional=true, version="0.0.3", package="uu_basename", path="src/uu/basename" } -cat = { optional=true, version="0.0.3", package="uu_cat", path="src/uu/cat" } -chgrp = { optional=true, version="0.0.3", package="uu_chgrp", path="src/uu/chgrp" } -chmod = { optional=true, version="0.0.3", package="uu_chmod", path="src/uu/chmod" } -chown = { optional=true, version="0.0.3", package="uu_chown", path="src/uu/chown" } -chroot = { optional=true, version="0.0.3", package="uu_chroot", path="src/uu/chroot" } -cksum = { optional=true, version="0.0.3", package="uu_cksum", path="src/uu/cksum" } -comm = { optional=true, version="0.0.3", package="uu_comm", path="src/uu/comm" } -cp = { optional=true, version="0.0.3", package="uu_cp", path="src/uu/cp" } -csplit = { optional=true, version="0.0.3", package="uu_csplit", path="src/uu/csplit" } -cut = { optional=true, version="0.0.3", package="uu_cut", path="src/uu/cut" } -date = { optional=true, version="0.0.3", package="uu_date", path="src/uu/date" } -df = { optional=true, version="0.0.3", package="uu_df", path="src/uu/df" } -dircolors= { optional=true, version="0.0.3", package="uu_dircolors", path="src/uu/dircolors" } -dirname = { optional=true, version="0.0.3", package="uu_dirname", path="src/uu/dirname" } -du = { optional=true, version="0.0.3", package="uu_du", path="src/uu/du" } -echo = { optional=true, version="0.0.3", package="uu_echo", path="src/uu/echo" } -env = { optional=true, version="0.0.3", package="uu_env", path="src/uu/env" } -expand = { optional=true, version="0.0.3", package="uu_expand", path="src/uu/expand" } -expr = { optional=true, version="0.0.3", package="uu_expr", path="src/uu/expr" } -factor = { optional=true, version="0.0.3", package="uu_factor", path="src/uu/factor" } -false = { optional=true, version="0.0.3", package="uu_false", path="src/uu/false" } -fmt = { optional=true, version="0.0.3", package="uu_fmt", path="src/uu/fmt" } -fold = { optional=true, version="0.0.3", package="uu_fold", path="src/uu/fold" } -groups = { optional=true, version="0.0.3", package="uu_groups", path="src/uu/groups" } -hashsum = { optional=true, version="0.0.3", package="uu_hashsum", path="src/uu/hashsum" } -head = { optional=true, version="0.0.3", package="uu_head", path="src/uu/head" } -hostid = { optional=true, version="0.0.3", package="uu_hostid", path="src/uu/hostid" } -hostname = { optional=true, version="0.0.3", package="uu_hostname", path="src/uu/hostname" } -id = { optional=true, version="0.0.3", package="uu_id", path="src/uu/id" } -install = { optional=true, version="0.0.3", package="uu_install", path="src/uu/install" } -join = { optional=true, version="0.0.3", package="uu_join", path="src/uu/join" } -kill = { optional=true, version="0.0.3", package="uu_kill", path="src/uu/kill" } -link = { optional=true, version="0.0.3", package="uu_link", path="src/uu/link" } -ln = { optional=true, version="0.0.3", package="uu_ln", path="src/uu/ln" } -ls = { optional=true, version="0.0.3", package="uu_ls", path="src/uu/ls" } -logname = { optional=true, version="0.0.3", package="uu_logname", path="src/uu/logname" } -mkdir = { optional=true, version="0.0.3", package="uu_mkdir", path="src/uu/mkdir" } -mkfifo = { optional=true, version="0.0.3", package="uu_mkfifo", path="src/uu/mkfifo" } -mknod = { optional=true, version="0.0.3", package="uu_mknod", path="src/uu/mknod" } -mktemp = { optional=true, version="0.0.3", package="uu_mktemp", path="src/uu/mktemp" } -more = { optional=true, version="0.0.3", package="uu_more", path="src/uu/more" } -mv = { optional=true, version="0.0.3", package="uu_mv", path="src/uu/mv" } -nice = { optional=true, version="0.0.3", package="uu_nice", path="src/uu/nice" } -nl = { optional=true, version="0.0.3", package="uu_nl", path="src/uu/nl" } -nohup = { optional=true, version="0.0.3", package="uu_nohup", path="src/uu/nohup" } -nproc = { optional=true, version="0.0.3", package="uu_nproc", path="src/uu/nproc" } -numfmt = { optional=true, version="0.0.3", package="uu_numfmt", path="src/uu/numfmt" } -od = { optional=true, version="0.0.3", package="uu_od", path="src/uu/od" } -paste = { optional=true, version="0.0.3", package="uu_paste", path="src/uu/paste" } -pathchk = { optional=true, version="0.0.3", package="uu_pathchk", path="src/uu/pathchk" } -pinky = { optional=true, version="0.0.3", package="uu_pinky", path="src/uu/pinky" } -printenv = { optional=true, version="0.0.3", package="uu_printenv", path="src/uu/printenv" } -printf = { optional=true, version="0.0.3", package="uu_printf", path="src/uu/printf" } -ptx = { optional=true, version="0.0.3", package="uu_ptx", path="src/uu/ptx" } -pwd = { optional=true, version="0.0.3", package="uu_pwd", path="src/uu/pwd" } -readlink = { optional=true, version="0.0.3", package="uu_readlink", path="src/uu/readlink" } -realpath = { optional=true, version="0.0.3", package="uu_realpath", path="src/uu/realpath" } -relpath = { optional=true, version="0.0.3", package="uu_relpath", path="src/uu/relpath" } -rm = { optional=true, version="0.0.3", package="uu_rm", path="src/uu/rm" } -rmdir = { optional=true, version="0.0.3", package="uu_rmdir", path="src/uu/rmdir" } -seq = { optional=true, version="0.0.3", package="uu_seq", path="src/uu/seq" } -shred = { optional=true, version="0.0.3", package="uu_shred", path="src/uu/shred" } -shuf = { optional=true, version="0.0.3", package="uu_shuf", path="src/uu/shuf" } -sleep = { optional=true, version="0.0.3", package="uu_sleep", path="src/uu/sleep" } -sort = { optional=true, version="0.0.3", package="uu_sort", path="src/uu/sort" } -split = { optional=true, version="0.0.3", package="uu_split", path="src/uu/split" } -stat = { optional=true, version="0.0.3", package="uu_stat", path="src/uu/stat" } -stdbuf = { optional=true, version="0.0.3", package="uu_stdbuf", path="src/uu/stdbuf" } -sum = { optional=true, version="0.0.3", package="uu_sum", path="src/uu/sum" } -sync = { optional=true, version="0.0.3", package="uu_sync", path="src/uu/sync" } -tac = { optional=true, version="0.0.3", package="uu_tac", path="src/uu/tac" } -tail = { optional=true, version="0.0.3", package="uu_tail", path="src/uu/tail" } -tee = { optional=true, version="0.0.3", package="uu_tee", path="src/uu/tee" } -timeout = { optional=true, version="0.0.3", package="uu_timeout", path="src/uu/timeout" } -touch = { optional=true, version="0.0.3", package="uu_touch", path="src/uu/touch" } -tr = { optional=true, version="0.0.3", package="uu_tr", path="src/uu/tr" } -true = { optional=true, version="0.0.3", package="uu_true", path="src/uu/true" } -truncate = { optional=true, version="0.0.3", package="uu_truncate", path="src/uu/truncate" } -tsort = { optional=true, version="0.0.3", package="uu_tsort", path="src/uu/tsort" } -tty = { optional=true, version="0.0.3", package="uu_tty", path="src/uu/tty" } -uname = { optional=true, version="0.0.3", package="uu_uname", path="src/uu/uname" } -unexpand = { optional=true, version="0.0.3", package="uu_unexpand", path="src/uu/unexpand" } -uniq = { optional=true, version="0.0.3", package="uu_uniq", path="src/uu/uniq" } -unlink = { optional=true, version="0.0.3", package="uu_unlink", path="src/uu/unlink" } -uptime = { optional=true, version="0.0.3", package="uu_uptime", path="src/uu/uptime" } -users = { optional=true, version="0.0.3", package="uu_users", path="src/uu/users" } -wc = { optional=true, version="0.0.3", package="uu_wc", path="src/uu/wc" } -who = { optional=true, version="0.0.3", package="uu_who", path="src/uu/who" } -whoami = { optional=true, version="0.0.3", package="uu_whoami", path="src/uu/whoami" } -yes = { optional=true, version="0.0.3", package="uu_yes", path="src/uu/yes" } +arch = { optional=true, version="0.0.4", package="uu_arch", path="src/uu/arch" } +base32 = { optional=true, version="0.0.4", package="uu_base32", path="src/uu/base32" } +base64 = { optional=true, version="0.0.4", package="uu_base64", path="src/uu/base64" } +basename = { optional=true, version="0.0.4", package="uu_basename", path="src/uu/basename" } +cat = { optional=true, version="0.0.4", package="uu_cat", path="src/uu/cat" } +chgrp = { optional=true, version="0.0.4", package="uu_chgrp", path="src/uu/chgrp" } +chmod = { optional=true, version="0.0.4", package="uu_chmod", path="src/uu/chmod" } +chown = { optional=true, version="0.0.4", package="uu_chown", path="src/uu/chown" } +chroot = { optional=true, version="0.0.4", package="uu_chroot", path="src/uu/chroot" } +cksum = { optional=true, version="0.0.4", package="uu_cksum", path="src/uu/cksum" } +comm = { optional=true, version="0.0.4", package="uu_comm", path="src/uu/comm" } +cp = { optional=true, version="0.0.4", package="uu_cp", path="src/uu/cp" } +csplit = { optional=true, version="0.0.4", package="uu_csplit", path="src/uu/csplit" } +cut = { optional=true, version="0.0.4", package="uu_cut", path="src/uu/cut" } +date = { optional=true, version="0.0.4", package="uu_date", path="src/uu/date" } +df = { optional=true, version="0.0.4", package="uu_df", path="src/uu/df" } +dircolors= { optional=true, version="0.0.4", package="uu_dircolors", path="src/uu/dircolors" } +dirname = { optional=true, version="0.0.4", package="uu_dirname", path="src/uu/dirname" } +du = { optional=true, version="0.0.4", package="uu_du", path="src/uu/du" } +echo = { optional=true, version="0.0.4", package="uu_echo", path="src/uu/echo" } +env = { optional=true, version="0.0.4", package="uu_env", path="src/uu/env" } +expand = { optional=true, version="0.0.4", package="uu_expand", path="src/uu/expand" } +expr = { optional=true, version="0.0.4", package="uu_expr", path="src/uu/expr" } +factor = { optional=true, version="0.0.4", package="uu_factor", path="src/uu/factor" } +false = { optional=true, version="0.0.4", package="uu_false", path="src/uu/false" } +fmt = { optional=true, version="0.0.4", package="uu_fmt", path="src/uu/fmt" } +fold = { optional=true, version="0.0.4", package="uu_fold", path="src/uu/fold" } +groups = { optional=true, version="0.0.4", package="uu_groups", path="src/uu/groups" } +hashsum = { optional=true, version="0.0.4", package="uu_hashsum", path="src/uu/hashsum" } +head = { optional=true, version="0.0.4", package="uu_head", path="src/uu/head" } +hostid = { optional=true, version="0.0.4", package="uu_hostid", path="src/uu/hostid" } +hostname = { optional=true, version="0.0.4", package="uu_hostname", path="src/uu/hostname" } +id = { optional=true, version="0.0.4", package="uu_id", path="src/uu/id" } +install = { optional=true, version="0.0.4", package="uu_install", path="src/uu/install" } +join = { optional=true, version="0.0.4", package="uu_join", path="src/uu/join" } +kill = { optional=true, version="0.0.4", package="uu_kill", path="src/uu/kill" } +link = { optional=true, version="0.0.4", package="uu_link", path="src/uu/link" } +ln = { optional=true, version="0.0.4", package="uu_ln", path="src/uu/ln" } +ls = { optional=true, version="0.0.4", package="uu_ls", path="src/uu/ls" } +logname = { optional=true, version="0.0.4", package="uu_logname", path="src/uu/logname" } +mkdir = { optional=true, version="0.0.4", package="uu_mkdir", path="src/uu/mkdir" } +mkfifo = { optional=true, version="0.0.4", package="uu_mkfifo", path="src/uu/mkfifo" } +mknod = { optional=true, version="0.0.4", package="uu_mknod", path="src/uu/mknod" } +mktemp = { optional=true, version="0.0.4", package="uu_mktemp", path="src/uu/mktemp" } +more = { optional=true, version="0.0.4", package="uu_more", path="src/uu/more" } +mv = { optional=true, version="0.0.4", package="uu_mv", path="src/uu/mv" } +nice = { optional=true, version="0.0.4", package="uu_nice", path="src/uu/nice" } +nl = { optional=true, version="0.0.4", package="uu_nl", path="src/uu/nl" } +nohup = { optional=true, version="0.0.4", package="uu_nohup", path="src/uu/nohup" } +nproc = { optional=true, version="0.0.4", package="uu_nproc", path="src/uu/nproc" } +numfmt = { optional=true, version="0.0.4", package="uu_numfmt", path="src/uu/numfmt" } +od = { optional=true, version="0.0.4", package="uu_od", path="src/uu/od" } +paste = { optional=true, version="0.0.4", package="uu_paste", path="src/uu/paste" } +pathchk = { optional=true, version="0.0.4", package="uu_pathchk", path="src/uu/pathchk" } +pinky = { optional=true, version="0.0.4", package="uu_pinky", path="src/uu/pinky" } +printenv = { optional=true, version="0.0.4", package="uu_printenv", path="src/uu/printenv" } +printf = { optional=true, version="0.0.4", package="uu_printf", path="src/uu/printf" } +ptx = { optional=true, version="0.0.4", package="uu_ptx", path="src/uu/ptx" } +pwd = { optional=true, version="0.0.4", package="uu_pwd", path="src/uu/pwd" } +readlink = { optional=true, version="0.0.4", package="uu_readlink", path="src/uu/readlink" } +realpath = { optional=true, version="0.0.4", package="uu_realpath", path="src/uu/realpath" } +relpath = { optional=true, version="0.0.4", package="uu_relpath", path="src/uu/relpath" } +rm = { optional=true, version="0.0.4", package="uu_rm", path="src/uu/rm" } +rmdir = { optional=true, version="0.0.4", package="uu_rmdir", path="src/uu/rmdir" } +seq = { optional=true, version="0.0.4", package="uu_seq", path="src/uu/seq" } +shred = { optional=true, version="0.0.4", package="uu_shred", path="src/uu/shred" } +shuf = { optional=true, version="0.0.4", package="uu_shuf", path="src/uu/shuf" } +sleep = { optional=true, version="0.0.4", package="uu_sleep", path="src/uu/sleep" } +sort = { optional=true, version="0.0.4", package="uu_sort", path="src/uu/sort" } +split = { optional=true, version="0.0.4", package="uu_split", path="src/uu/split" } +stat = { optional=true, version="0.0.4", package="uu_stat", path="src/uu/stat" } +stdbuf = { optional=true, version="0.0.4", package="uu_stdbuf", path="src/uu/stdbuf" } +sum = { optional=true, version="0.0.4", package="uu_sum", path="src/uu/sum" } +sync = { optional=true, version="0.0.4", package="uu_sync", path="src/uu/sync" } +tac = { optional=true, version="0.0.4", package="uu_tac", path="src/uu/tac" } +tail = { optional=true, version="0.0.4", package="uu_tail", path="src/uu/tail" } +tee = { optional=true, version="0.0.4", package="uu_tee", path="src/uu/tee" } +timeout = { optional=true, version="0.0.4", package="uu_timeout", path="src/uu/timeout" } +touch = { optional=true, version="0.0.4", package="uu_touch", path="src/uu/touch" } +tr = { optional=true, version="0.0.4", package="uu_tr", path="src/uu/tr" } +true = { optional=true, version="0.0.4", package="uu_true", path="src/uu/true" } +truncate = { optional=true, version="0.0.4", package="uu_truncate", path="src/uu/truncate" } +tsort = { optional=true, version="0.0.4", package="uu_tsort", path="src/uu/tsort" } +tty = { optional=true, version="0.0.4", package="uu_tty", path="src/uu/tty" } +uname = { optional=true, version="0.0.4", package="uu_uname", path="src/uu/uname" } +unexpand = { optional=true, version="0.0.4", package="uu_unexpand", path="src/uu/unexpand" } +uniq = { optional=true, version="0.0.4", package="uu_uniq", path="src/uu/uniq" } +unlink = { optional=true, version="0.0.4", package="uu_unlink", path="src/uu/unlink" } +uptime = { optional=true, version="0.0.4", package="uu_uptime", path="src/uu/uptime" } +users = { optional=true, version="0.0.4", package="uu_users", path="src/uu/users" } +wc = { optional=true, version="0.0.4", package="uu_wc", path="src/uu/wc" } +who = { optional=true, version="0.0.4", package="uu_who", path="src/uu/who" } +whoami = { optional=true, version="0.0.4", package="uu_whoami", path="src/uu/whoami" } +yes = { optional=true, version="0.0.4", package="uu_yes", path="src/uu/yes" } # # * pinned transitive dependencies pin_cc = { version="1.0.61, < 1.0.62", package="cc" } ## cc v1.0.62 has compiler errors for MinRustV v1.32.0, requires 1.34 (for `std::str::split_ascii_whitespace()`) diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index 664392ba4..10871eacd 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_arch" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "arch ~ (uutils) display machine architecture" diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index 57ce64759..90747f167 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base32" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "base32 ~ (uutils) decode/encode input (base32-encoding)" diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index da3ed16e6..af76a2ffa 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base64" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "base64 ~ (uutils) decode/encode input (base64-encoding)" diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index 9a06d4acd..51193f882 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_basename" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "basename ~ (uutils) display PATHNAME with leading directory components removed" diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 49f8b6761..343cea31d 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cat" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "cat ~ (uutils) concatenate and display input" diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index bcae7b436..ccbf5128e 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chgrp" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "chgrp ~ (uutils) change the group ownership of FILE" diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index 6829dab62..1073b702f 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chmod" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "chmod ~ (uutils) change mode of FILE" diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index e0bbf759c..0c87268ce 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chown" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "chown ~ (uutils) change the ownership of FILE" diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index 774a18f2a..246196019 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chroot" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "chroot ~ (uutils) run COMMAND under a new root directory" diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index 3a3cd6b14..8b11813a1 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cksum" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "cksum ~ (uutils) display CRC and size of input" diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index a596fa6b1..b1f52ecd0 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_comm" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "comm ~ (uutils) compare sorted inputs" diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index 4f0c3dccb..97191c3b6 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cp" -version = "0.0.3" +version = "0.0.4" authors = [ "Jordy Dickinson ", "Joshua S. Miller ", diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index 540e508c7..b838cca16 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_csplit" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "csplit ~ (uutils) Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output" diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index 407c79b41..19b0955ac 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cut" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "cut ~ (uutils) display byte/field columns of input lines" diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index d2e703991..c755a5609 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_date" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "date ~ (uutils) display or set the current time" diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 4977f84d3..414d59c4f 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_df" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "df ~ (uutils) display file system information" diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index 7f0b83570..6b8ed9480 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dircolors" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "dircolors ~ (uutils) display commands to set LS_COLORS" diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index 539c78924..73c5b2c6b 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dirname" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "dirname ~ (uutils) display parent directory of PATHNAME" diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index beabb5794..b060f1955 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_du" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "du ~ (uutils) display disk usage" diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index 0aa661860..016c9212b 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_echo" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "echo ~ (uutils) display TEXT" diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index 6b3b5440d..1f9c7738f 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_env" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "env ~ (uutils) set each NAME to VALUE in the environment and run COMMAND" diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index 83acbdef4..955443e95 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expand" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "expand ~ (uutils) convert input tabs to spaces" diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index f3ff65bb2..4423cb4d3 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expr" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "expr ~ (uutils) display the value of EXPRESSION" diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index 9724d6fb0..0961a5522 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_factor" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "factor ~ (uutils) display the prime factors of each NUMBER" diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index 6c6c64b53..2e867a916 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_false" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "false ~ (uutils) do nothing and fail" diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index dc3f7fba5..2c60e31ec 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fmt" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "fmt ~ (uutils) reformat each paragraph of input" diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index 8299e58b5..306a424c0 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fold" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "fold ~ (uutils) wrap each line of input" diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index 178f305c1..595328f08 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_groups" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "groups ~ (uutils) display group memberships for USERNAME" diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index 0e120e13a..0b8a7b93d 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hashsum" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "hashsum ~ (uutils) display or check input digests" diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index f8b03b15b..2f81fc670 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_head" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "head ~ (uutils) display the first lines of input" diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index 75686e93a..0319fb640 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostid" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "hostid ~ (uutils) display the numeric identifier of the current host" diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index 34af5600c..6884a0a1b 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostname" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "hostname ~ (uutils) display or set the host name of the current host" diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index 0643816db..3c651474f 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_id" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "id ~ (uutils) display user and group information for USER" diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index ebea997a0..49315bc1f 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_install" -version = "0.0.3" +version = "0.0.4" authors = [ "Ben Eills ", "uutils developers", diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index bfe81c098..69f5817e1 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_join" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "join ~ (uutils) merge lines from inputs with matching join fields" diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index 8bb70a164..038597b2a 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_kill" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "kill ~ (uutils) send a signal to a process" diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index fce502a29..13b93176e 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_link" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "link ~ (uutils) create a hard (file system) link to FILE" diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index c2e7f3cf7..d60e59503 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ln" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "ln ~ (uutils) create a (file system) link to TARGET" diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index 310dc1207..668a839e3 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_logname" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "logname ~ (uutils) display the login name of the current user" diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index f65f9aa2e..442dfbdd2 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ls" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "ls ~ (uutils) display directory contents" diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index 494e221e1..29e07efcf 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkdir" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "mkdir ~ (uutils) create DIRECTORY" diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index 905cf5bbe..7a0f70c0b 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkfifo" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "mkfifo ~ (uutils) create FIFOs (named pipes)" diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index b6d6887b7..c9249091e 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mknod" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "mknod ~ (uutils) create special file NAME of TYPE" diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index 4ba45dd92..902c618a7 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mktemp" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "mktemp ~ (uutils) create and display a temporary file or directory from TEMPLATE" diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index a54b8b2d6..14653b103 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_more" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "more ~ (uutils) input perusal filter" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index eed89e1f4..a6035db12 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mv" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "mv ~ (uutils) move (rename) SOURCE to DESTINATION" diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index 200c0f5df..1e8e7044d 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nice" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "nice ~ (uutils) run PROGRAM with modified scheduling priority" diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index 80733f424..d9f84d803 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nl" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "nl ~ (uutils) display input with added line numbers" diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index 349cde7aa..447a7ab58 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nohup" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "nohup ~ (uutils) run COMMAND, ignoring hangup signals" diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index 7194f99e2..afbdbdfe2 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nproc" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "nproc ~ (uutils) display the number of processing units available" diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index 65f3570e9..bd438f975 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_numfmt" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "numfmt ~ (uutils) reformat NUMBER" diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index 1c4f970e4..57bca4d5a 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_od" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "od ~ (uutils) display formatted representation of input" diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index 63e357cb2..4853e1abe 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_paste" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "paste ~ (uutils) merge lines from inputs" diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index 9ff514fcc..2c0cd85d1 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pathchk" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "pathchk ~ (uutils) diagnose invalid or non-portable PATHNAME" diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index e52b0cdca..55f8de7a3 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pinky" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "pinky ~ (uutils) display user information" diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index 6a330cc03..72324be0e 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printenv" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "printenv ~ (uutils) display value of environment VAR" diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index d7166ae00..4c5b41889 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printf" -version = "0.0.3" +version = "0.0.4" authors = [ "Nathan Ross", "uutils developers", diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index 26dea7b75..02af73b7b 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ptx" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "ptx ~ (uutils) display a permuted index of input" diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index 49cf18686..b8f3f11a5 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pwd" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "pwd ~ (uutils) display current working directory" diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index bd89eb7a4..2cac92114 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_readlink" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "readlink ~ (uutils) display resolved path of PATHNAME" diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index 46678dd86..5d7b82dfc 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_realpath" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "realpath ~ (uutils) display resolved absolute path of PATHNAME" diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index 9d87d5e23..792f65851 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_relpath" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "relpath ~ (uutils) display relative path of PATHNAME_TO from PATHNAME_FROM" diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index 095764f72..9b5b4099b 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rm" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "rm ~ (uutils) remove PATHNAME" diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index 639e3f1cb..8afe4a169 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rmdir" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "rmdir ~ (uutils) remove empty DIRECTORY" diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index df9abe4d2..876cb2f1a 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_seq" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "seq ~ (uutils) display a sequence of numbers" diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index bf23cc6ee..a51092946 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shred" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "shred ~ (uutils) hide former FILE contents with repeated overwrites" diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index 6e777eab5..0354d3cb5 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shuf" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "shuf ~ (uutils) display random permutations of input lines" diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index 396f6424d..9bdbc7325 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sleep" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "sleep ~ (uutils) pause for DURATION" diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index b95ece92f..8705b07d5 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sort" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "sort ~ (uutils) sort input lines" diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index ad0fb3906..baee224cd 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_split" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "split ~ (uutils) split input into output files" diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index e24a8ac9d..6fabd7c25 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stat" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "stat ~ (uutils) display FILE status" diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index 1a317e6ed..c3f8d9c36 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "stdbuf ~ (uutils) run COMMAND with modified standard stream buffering" @@ -21,7 +21,7 @@ uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [build-dependencies] -libstdbuf = { version="0.0.3", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } +libstdbuf = { version="0.0.4", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } [[bin]] name = "stdbuf" diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index 7bd34012d..167ec7d3f 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf_libstdbuf" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "stdbuf/libstdbuf ~ (uutils); dynamic library required for stdbuf" diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index 4bc82ab5b..fcd7774b2 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sum" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "sum ~ (uutils) display checksum and block counts for input" diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index 7a7a83a43..811b503b0 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sync" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "sync ~ (uutils) synchronize cache writes to storage" diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index b62875372..df78cd53d 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tac" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "tac ~ (uutils) concatenate and display input lines in reverse order" diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index f94283089..64d98622c 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tail" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "tail ~ (uutils) display the last lines of input" diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index 931a010e5..f037e63e2 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tee" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "tee ~ (uutils) display input and copy to FILE" diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index f076f242c..97c0e97d0 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_test" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "test ~ (uutils) evaluate comparison and file type expressions" diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index 0a920d988..be50520a3 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_timeout" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "timeout ~ (uutils) run COMMAND with a DURATION time limit" diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index c88808224..1b232d391 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_touch" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "touch ~ (uutils) change FILE timestamps" diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index cdf519dfe..b20adb156 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tr" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "tr ~ (uutils) translate characters within input and display" diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index 26dd321aa..2266517ef 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_true" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "true ~ (uutils) do nothing and succeed" diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index b0e5dc32b..75e29a68b 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_truncate" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "truncate ~ (uutils) truncate (or extend) FILE to SIZE" diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index 65e30b6c2..64b5c99e5 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tsort" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "tsort ~ (uutils) topologically sort input (partially ordered) pairs" diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index 2302c02cb..db7714e88 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tty" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "tty ~ (uutils) display the name of the terminal connected to standard input" diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index 5e54aff43..f7905c415 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uname" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "uname ~ (uutils) display system information" diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index 218b100b7..12b8fe5ca 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unexpand" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "unexpand ~ (uutils) convert input spaces to tabs" diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index 924e2f93c..ce137843c 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uniq" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "uniq ~ (uutils) filter identical adjacent lines from input" diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index 1326dcc96..013d56876 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unlink" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "unlink ~ (uutils) remove a (file system) link to FILE" diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index ac32da353..86b636774 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uptime" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "uptime ~ (uutils) display dynamic system information" diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index d5f331755..cf09d5703 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_users" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "users ~ (uutils) display names of currently logged-in users" diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index c50989d32..91260b1d4 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_wc" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "wc ~ (uutils) display newline, word, and byte counts for input" diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index 2fdc64255..0af8d5215 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_who" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "who ~ (uutils) display information about currently logged-in users" diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index ee2ac9031..c8c89685c 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_whoami" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "whoami ~ (uutils) display user name of current effective user ID" diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index c4fc09acf..03556d997 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_yes" -version = "0.0.3" +version = "0.0.4" authors = ["uutils developers"] license = "MIT" description = "yes ~ (uutils) repeatedly display a line with STRING (or 'y')" diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index dd7d9e69d..78b3aec3f 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uucore" -version = "0.0.6" +version = "0.0.7" authors = ["uutils developers"] license = "MIT" description = "uutils ~ 'core' uutils code library (cross-platform)" From 8772d812362e7ed031fdf920c05fc997c2a762fc Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 7 Mar 2021 11:11:52 +0100 Subject: [PATCH 368/606] Update to platform-info 0.1 --- src/uu/arch/Cargo.toml | 2 +- src/uucore/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index 10871eacd..8b832c33b 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/arch.rs" [dependencies] -platform-info = "0.0.1" +platform-info = "0.1" uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 78b3aec3f..a5fbe4c79 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -23,7 +23,7 @@ wild = "2.0.4" thiserror = { version="1.0", optional=true } lazy_static = { version="1.3", optional=true } nix = { version="<= 0.13", optional=true } -platform-info = { version="<= 0.0.1", optional=true } +platform-info = { version="<= 0.1", optional=true } time = { version="<= 0.1.42", optional=true } # * "problem" dependencies (pinned) data-encoding = { version="~2.1", optional=true } ## data-encoding: require v2.1; but v2.2.0 breaks the build for MinSRV v1.31.0 From 6ad8528b999417e84e1b04fb2b525ff5ad6d3e56 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 7 Mar 2021 11:20:45 +0100 Subject: [PATCH 369/606] update of the uucore dep to 0.0.7 --- Cargo.toml | 4 ++-- src/uu/arch/Cargo.toml | 2 +- src/uu/base32/Cargo.toml | 2 +- src/uu/base64/Cargo.toml | 2 +- src/uu/basename/Cargo.toml | 2 +- src/uu/cat/Cargo.toml | 2 +- src/uu/chgrp/Cargo.toml | 2 +- src/uu/chmod/Cargo.toml | 2 +- src/uu/chown/Cargo.toml | 2 +- src/uu/chroot/Cargo.toml | 2 +- src/uu/cksum/Cargo.toml | 2 +- src/uu/comm/Cargo.toml | 2 +- src/uu/cp/Cargo.toml | 2 +- src/uu/csplit/Cargo.toml | 2 +- src/uu/cut/Cargo.toml | 2 +- src/uu/date/Cargo.toml | 2 +- src/uu/df/Cargo.toml | 2 +- src/uu/dircolors/Cargo.toml | 2 +- src/uu/dirname/Cargo.toml | 2 +- src/uu/du/Cargo.toml | 2 +- src/uu/echo/Cargo.toml | 2 +- src/uu/env/Cargo.toml | 2 +- src/uu/expand/Cargo.toml | 2 +- src/uu/expr/Cargo.toml | 2 +- src/uu/factor/Cargo.toml | 2 +- src/uu/false/Cargo.toml | 2 +- src/uu/fmt/Cargo.toml | 2 +- src/uu/fold/Cargo.toml | 2 +- src/uu/groups/Cargo.toml | 2 +- src/uu/hashsum/Cargo.toml | 2 +- src/uu/head/Cargo.toml | 2 +- src/uu/hostid/Cargo.toml | 2 +- src/uu/hostname/Cargo.toml | 2 +- src/uu/id/Cargo.toml | 2 +- src/uu/install/Cargo.toml | 2 +- src/uu/join/Cargo.toml | 2 +- src/uu/kill/Cargo.toml | 2 +- src/uu/link/Cargo.toml | 2 +- src/uu/ln/Cargo.toml | 2 +- src/uu/logname/Cargo.toml | 2 +- src/uu/ls/Cargo.toml | 2 +- src/uu/mkdir/Cargo.toml | 2 +- src/uu/mkfifo/Cargo.toml | 2 +- src/uu/mknod/Cargo.toml | 2 +- src/uu/mktemp/Cargo.toml | 2 +- src/uu/more/Cargo.toml | 2 +- src/uu/mv/Cargo.toml | 2 +- src/uu/nice/Cargo.toml | 2 +- src/uu/nl/Cargo.toml | 2 +- src/uu/nohup/Cargo.toml | 2 +- src/uu/nproc/Cargo.toml | 2 +- src/uu/numfmt/Cargo.toml | 2 +- src/uu/od/Cargo.toml | 2 +- src/uu/paste/Cargo.toml | 2 +- src/uu/pathchk/Cargo.toml | 2 +- src/uu/pinky/Cargo.toml | 2 +- src/uu/printenv/Cargo.toml | 2 +- src/uu/printf/Cargo.toml | 2 +- src/uu/ptx/Cargo.toml | 2 +- src/uu/pwd/Cargo.toml | 2 +- src/uu/readlink/Cargo.toml | 2 +- src/uu/realpath/Cargo.toml | 2 +- src/uu/relpath/Cargo.toml | 2 +- src/uu/rm/Cargo.toml | 2 +- src/uu/rmdir/Cargo.toml | 2 +- src/uu/seq/Cargo.toml | 2 +- src/uu/shred/Cargo.toml | 2 +- src/uu/shuf/Cargo.toml | 2 +- src/uu/sleep/Cargo.toml | 2 +- src/uu/sort/Cargo.toml | 2 +- src/uu/split/Cargo.toml | 2 +- src/uu/stat/Cargo.toml | 2 +- src/uu/stdbuf/Cargo.toml | 2 +- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 2 +- src/uu/sum/Cargo.toml | 2 +- src/uu/sync/Cargo.toml | 2 +- src/uu/tac/Cargo.toml | 2 +- src/uu/tail/Cargo.toml | 2 +- src/uu/tee/Cargo.toml | 2 +- src/uu/test/Cargo.toml | 2 +- src/uu/timeout/Cargo.toml | 2 +- src/uu/touch/Cargo.toml | 2 +- src/uu/tr/Cargo.toml | 2 +- src/uu/true/Cargo.toml | 2 +- src/uu/truncate/Cargo.toml | 2 +- src/uu/tsort/Cargo.toml | 2 +- src/uu/tty/Cargo.toml | 2 +- src/uu/uname/Cargo.toml | 2 +- src/uu/unexpand/Cargo.toml | 2 +- src/uu/uniq/Cargo.toml | 2 +- src/uu/unlink/Cargo.toml | 2 +- src/uu/uptime/Cargo.toml | 2 +- src/uu/users/Cargo.toml | 2 +- src/uu/wc/Cargo.toml | 2 +- src/uu/who/Cargo.toml | 2 +- src/uu/whoami/Cargo.toml | 2 +- src/uu/yes/Cargo.toml | 2 +- 97 files changed, 98 insertions(+), 98 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7146a015b..9b55abe5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -226,7 +226,7 @@ test = [ "uu_test" ] [dependencies] lazy_static = { version="1.3" } textwrap = { version="=0.11.0", features=["term_size"] } # !maint: [2020-05-10; rivy] unstable crate using undocumented features; pinned currently, will review -uucore = { version=">=0.0.6", package="uucore", path="src/uucore" } +uucore = { version=">=0.0.7", package="uucore", path="src/uucore" } # * uutils uu_test = { optional=true, version="0.0.4", package="uu_test", path="src/uu/test" } # @@ -346,7 +346,7 @@ sha1 = { version="0.6", features=["std"] } tempfile = "= 3.1.0" time = "0.1" unindent = "0.1" -uucore = { version=">=0.0.6", package="uucore", path="src/uucore", features=["entries"] } +uucore = { version=">=0.0.7", package="uucore", path="src/uucore", features=["entries"] } [target.'cfg(unix)'.dev-dependencies] rust-users = { version="0.10", package="users" } diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index 8b832c33b..4ca0fbda7 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -16,7 +16,7 @@ path = "src/arch.rs" [dependencies] platform-info = "0.1" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index 90747f167..0abb718c8 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/base32.rs" [dependencies] -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features = ["encoding"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features = ["encoding"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index af76a2ffa..eef9b1ec3 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/base64.rs" [dependencies] -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features = ["encoding"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features = ["encoding"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index 51193f882..218d9eb08 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/basename.rs" [dependencies] -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 343cea31d..415477588 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -16,7 +16,7 @@ path = "src/cat.rs" [dependencies] quick-error = "1.2.3" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index ccbf5128e..60f9d6370 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/chgrp.rs" [dependencies] -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index 1073b702f..41b73d8a6 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -16,7 +16,7 @@ path = "src/chmod.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs", "mode"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs", "mode"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index 0c87268ce..f2d21ef88 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -17,7 +17,7 @@ path = "src/chown.rs" [dependencies] clap = "2.33" glob = "0.3.0" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index 246196019..7ad2f0908 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -16,7 +16,7 @@ path = "src/chroot.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index 8b11813a1..ef3ec8b46 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -16,7 +16,7 @@ path = "src/cksum.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index b1f52ecd0..ddfbb6a47 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -17,7 +17,7 @@ path = "src/comm.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index 97191c3b6..a0253433f 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -23,7 +23,7 @@ clap = "2.33" filetime = "0.2" libc = "0.2.85" quick-error = "1.2.3" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index b838cca16..68c6e2322 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -19,7 +19,7 @@ getopts = "0.2.17" thiserror = "1.0" regex = "1.0.0" glob = "0.2.11" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index 19b0955ac..71f7c3f6a 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/cut.rs" [dependencies] -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index c755a5609..4e3227f02 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -17,7 +17,7 @@ path = "src/date.rs" [dependencies] chrono = "0.4.4" clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 414d59c4f..24fce763b 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -18,7 +18,7 @@ path = "src/df.rs" clap = "2.33" libc = "0.2" number_prefix = "0.4" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index 6b8ed9480..667fc3b70 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -16,7 +16,7 @@ path = "src/dircolors.rs" [dependencies] glob = "0.3.0" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index 73c5b2c6b..9c565a3e6 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -16,7 +16,7 @@ path = "src/dirname.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index b060f1955..912eef17e 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -16,7 +16,7 @@ path = "src/du.rs" [dependencies] time = "0.1.40" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index 016c9212b..a8742b68f 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/echo.rs" [dependencies] -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index 1f9c7738f..864ecd1b2 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -18,7 +18,7 @@ path = "src/env.rs" clap = "2.33" libc = "0.2.42" rust-ini = "0.13.0" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index 955443e95..d9861a0c7 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -17,7 +17,7 @@ path = "src/expand.rs" [dependencies] getopts = "0.2.18" unicode-width = "0.1.5" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index 4423cb4d3..1246ff873 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -17,7 +17,7 @@ path = "src/expr.rs" [dependencies] libc = "0.2.42" onig = "~4.3.2" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index 0961a5522..d1160c493 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -19,7 +19,7 @@ num-traits = "0.2.13" # used in src/numerics.rs, which is included by build.rs num-traits = "0.2.13" # Needs at least version 0.2.13 for "OverflowingAdd" rand = { version="0.7", features=["small_rng"] } smallvec = { version="0.6.14, < 1.0" } -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index 2e867a916..413cbc990 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/false.rs" [dependencies] -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index 2c60e31ec..e150b2962 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -18,7 +18,7 @@ path = "src/fmt.rs" clap = "2.33" libc = "0.2.42" unicode-width = "0.1.5" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index 306a424c0..23dadc8eb 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/fold.rs" [dependencies] -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index 595328f08..455e2d224 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/groups.rs" [dependencies] -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } clap = "2.33" diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index 0b8a7b93d..c9bb4da9f 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -26,7 +26,7 @@ sha1 = "0.6.0" sha2 = "0.6.0" sha3 = "0.6.0" blake2-rfc = "0.2.18" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index 2f81fc670..adcce2726 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -16,7 +16,7 @@ path = "src/head.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index 0319fb640..b3870652e 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -16,7 +16,7 @@ path = "src/hostid.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index 6884a0a1b..75b9b5f9a 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -18,7 +18,7 @@ path = "src/hostname.rs" clap = "2.33" libc = "0.2.42" hostname = { version = "0.3", features = ["set"] } -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["wide"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["wide"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=["sysinfoapi", "winsock2"] } diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index 3c651474f..46e5cb578 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -16,7 +16,7 @@ path = "src/id.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries", "process"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "process"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 49315bc1f..5280184fe 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -20,7 +20,7 @@ path = "src/install.rs" [dependencies] clap = "2.33" libc = ">= 0.2" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["mode", "perms", "entries"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["mode", "perms", "entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index 69f5817e1..d02703a62 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -16,7 +16,7 @@ path = "src/join.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index 038597b2a..dd69cd35d 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -16,7 +16,7 @@ path = "src/kill.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["signals"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["signals"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index 13b93176e..aaa183981 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -16,7 +16,7 @@ path = "src/link.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index d60e59503..2b97f025a 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -17,7 +17,7 @@ path = "src/ln.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index 668a839e3..d58576c77 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -16,7 +16,7 @@ path = "src/logname.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index 442dfbdd2..10d7cc2da 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -22,7 +22,7 @@ term_grid = "0.1.5" termsize = "0.1.6" time = "0.1.40" unicode-width = "0.1.5" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index 29e07efcf..9cedb5c03 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -17,7 +17,7 @@ path = "src/mkdir.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs", "mode"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs", "mode"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index 7a0f70c0b..627d4a721 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -17,7 +17,7 @@ path = "src/mkfifo.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index c9249091e..426534e75 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -18,7 +18,7 @@ path = "src/mknod.rs" [dependencies] getopts = "0.2.18" libc = "^0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["mode"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["mode"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index 902c618a7..c48306a40 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -18,7 +18,7 @@ path = "src/mktemp.rs" clap = "2.33" rand = "0.5" tempfile = "3.1" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index 14653b103..3c1746bd4 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -16,7 +16,7 @@ path = "src/more.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "redox")'.dependencies] diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index a6035db12..1a4f90801 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -17,7 +17,7 @@ path = "src/mv.rs" [dependencies] clap = "2.33" fs_extra = "1.1.0" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index 1e8e7044d..e7d184c96 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -17,7 +17,7 @@ path = "src/nice.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index d9f84d803..d5cddbde2 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -21,7 +21,7 @@ libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" regex-syntax = "0.6.7" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index 447a7ab58..0c5709a65 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -17,7 +17,7 @@ path = "src/nohup.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index afbdbdfe2..98f9a4afa 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -18,7 +18,7 @@ path = "src/nproc.rs" libc = "0.2.42" num_cpus = "1.10" clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index bd438f975..b8e54656c 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -16,7 +16,7 @@ path = "src/numfmt.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index 57bca4d5a..14aea59a7 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -19,7 +19,7 @@ byteorder = "1.3.2" getopts = "0.2.18" half = "1.6" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index 4853e1abe..f25654738 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -16,7 +16,7 @@ path = "src/paste.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index 2c0cd85d1..452199f4f 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -17,7 +17,7 @@ path = "src/pathchk.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index 55f8de7a3..1618eab57 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/pinky.rs" [dependencies] -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["utmpx", "entries"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["utmpx", "entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index 72324be0e..5266c1e03 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -16,7 +16,7 @@ path = "src/printenv.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index 4c5b41889..c6737d178 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -19,7 +19,7 @@ path = "src/printf.rs" [dependencies] itertools = "0.8.0" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index 02af73b7b..3a91feeb0 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -21,7 +21,7 @@ libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" regex-syntax = "0.6.7" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index b8f3f11a5..e074dc618 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -16,7 +16,7 @@ path = "src/pwd.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index 2cac92114..8e31f66f1 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -17,7 +17,7 @@ path = "src/readlink.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index 5d7b82dfc..6f03086ba 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -16,7 +16,7 @@ path = "src/realpath.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index 792f65851..1dc296ec6 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -16,7 +16,7 @@ path = "src/relpath.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index 9b5b4099b..b916412d8 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -18,7 +18,7 @@ path = "src/rm.rs" clap = "2.33" walkdir = "2.2" remove_dir_all = "0.5.1" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index 8afe4a169..9d6bb03cc 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -16,7 +16,7 @@ path = "src/rmdir.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index 876cb2f1a..d7ee72b68 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -16,7 +16,7 @@ path = "src/seq.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index a51092946..72e6119a8 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -20,7 +20,7 @@ getopts = "0.2.18" libc = "0.2.42" rand = "0.5" time = "0.1.40" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index 0354d3cb5..b78d4fc04 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -17,7 +17,7 @@ path = "src/shuf.rs" [dependencies] getopts = "0.2.18" rand = "0.5" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index 9bdbc7325..7bcbd1f4e 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -16,7 +16,7 @@ path = "src/sleep.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["parse_time"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["parse_time"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 8705b07d5..5158f6e52 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -18,7 +18,7 @@ path = "src/sort.rs" clap = "2.33" itertools = "0.8.0" semver = "0.9.0" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index baee224cd..7c3f1a56e 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -16,7 +16,7 @@ path = "src/split.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index 6fabd7c25..52ea88110 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -17,7 +17,7 @@ path = "src/stat.rs" [dependencies] clap = "2.33" time = "0.1.40" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries", "libc"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index c3f8d9c36..7a80e99ae 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -17,7 +17,7 @@ path = "src/stdbuf.rs" [dependencies] getopts = "0.2.18" tempfile = "3.1" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [build-dependencies] diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index 167ec7d3f..ac9c7230f 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -19,7 +19,7 @@ crate-type = ["cdylib", "rlib"] # XXX: note: the rlib is just to prevent Cargo f [dependencies] cpp = "0.5" libc = "0.2" -uucore = { version=">=0.0.6", package="uucore", path="../../../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../../../uucore_procs" } [build-dependencies] diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index fcd7774b2..a880ba1f7 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -16,7 +16,7 @@ path = "src/sum.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index 811b503b0..4cbf69a41 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -17,7 +17,7 @@ path = "src/sync.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["wide"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["wide"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi", "std", "winbase", "winerror"] } diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index df78cd53d..15e743006 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -16,7 +16,7 @@ path = "src/tac.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index 64d98622c..6e51e3e35 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -17,7 +17,7 @@ path = "src/tail.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=["fileapi", "handleapi", "processthreadsapi", "synchapi", "winbase"] } diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index f037e63e2..ee18e888f 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -17,7 +17,7 @@ path = "src/tee.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["libc"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index 97c0e97d0..6471c9e62 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -16,7 +16,7 @@ path = "src/test.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "redox")'.dependencies] diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index be50520a3..c13a98d19 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -17,7 +17,7 @@ path = "src/timeout.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index 1b232d391..fc021c096 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -18,7 +18,7 @@ path = "src/touch.rs" filetime = "0.2.1" clap = "2.33" time = "0.1.40" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["libc"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index b20adb156..918698e24 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -18,7 +18,7 @@ path = "src/tr.rs" bit-set = "0.5.0" fnv = "1.0.5" getopts = "0.2.18" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index 2266517ef..a73bfddd5 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/true.rs" [dependencies] -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index 75e29a68b..4f770e666 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -16,7 +16,7 @@ path = "src/truncate.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index 64b5c99e5..10672a9e0 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -16,7 +16,7 @@ path = "src/tsort.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index db7714e88..9912a3b9a 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -17,7 +17,7 @@ path = "src/tty.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index f7905c415..87754f45a 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -17,7 +17,7 @@ path = "src/uname.rs" [dependencies] clap = "2.33" platform-info = "0.1" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index 12b8fe5ca..ec6967e21 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -17,7 +17,7 @@ path = "src/unexpand.rs" [dependencies] getopts = "0.2.18" unicode-width = "0.1.5" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index ce137843c..d3cf4309d 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -16,7 +16,7 @@ path = "src/uniq.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index 013d56876..68edec54d 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -17,7 +17,7 @@ path = "src/unlink.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index 86b636774..d66acc77f 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -17,7 +17,7 @@ path = "src/uptime.rs" [dependencies] chrono = "0.4" clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["libc", "utmpx"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["libc", "utmpx"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index cf09d5703..ed6f110b6 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -16,7 +16,7 @@ path = "src/users.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["utmpx"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["utmpx"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index 91260b1d4..894ac44dd 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -16,7 +16,7 @@ path = "src/wc.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index 0af8d5215..fce0178aa 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/who.rs" [dependencies] -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["utmpx"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["utmpx"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index c8c89685c..a3158f62a 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -16,7 +16,7 @@ path = "src/whoami.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["entries", "wide"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "wide"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index 03556d997..729ce693a 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -16,7 +16,7 @@ path = "src/yes.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.6", package="uucore", path="../../uucore", features=["zero-copy"] } +uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["zero-copy"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [features] From 4f5e9ecb39484404b90310f28211b5ab870fcf27 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 7 Mar 2021 11:12:54 +0100 Subject: [PATCH 370/606] refresh Cargo.lock after the version --- Cargo.lock | 2230 +++++++++++++++++++++++++--------------------------- 1 file changed, 1091 insertions(+), 1139 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 89279dc18..429ff44c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,2707 +1,2659 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "advapi32-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "aho-corasick" version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4", ] [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "arrayvec" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" dependencies = [ - "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", + "winapi 0.3.9", ] [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bit-set" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" dependencies = [ - "bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-vec", ] [[package]] name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ - "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec", + "constant_time_eq", ] [[package]] name = "block-buffer" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" dependencies = [ - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools", + "generic-array", ] [[package]] name = "bstr" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "memchr 2.3.4", + "regex-automata", + "serde", ] [[package]] name = "bumpalo" version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "byte-tools" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" [[package]] name = "byteorder" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" [[package]] name = "cast" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version", ] [[package]] name = "cc" version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" dependencies = [ - "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer", + "num-traits", + "time", ] [[package]] name = "clap" version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term", + "atty", + "bitflags 1.2.1", + "strsim", + "textwrap", + "unicode-width", + "vec_map", ] [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1", ] [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "conv" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" dependencies = [ - "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "custom_derive", ] [[package]] name = "coreutils" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_arch 0.0.3", - "uu_base32 0.0.3", - "uu_base64 0.0.3", - "uu_basename 0.0.3", - "uu_cat 0.0.3", - "uu_chgrp 0.0.3", - "uu_chmod 0.0.3", - "uu_chown 0.0.3", - "uu_chroot 0.0.3", - "uu_cksum 0.0.3", - "uu_comm 0.0.3", - "uu_cp 0.0.3", - "uu_csplit 0.0.3", - "uu_cut 0.0.3", - "uu_date 0.0.3", - "uu_df 0.0.3", - "uu_dircolors 0.0.3", - "uu_dirname 0.0.3", - "uu_du 0.0.3", - "uu_echo 0.0.3", - "uu_env 0.0.3", - "uu_expand 0.0.3", - "uu_expr 0.0.3", - "uu_factor 0.0.3", - "uu_false 0.0.3", - "uu_fmt 0.0.3", - "uu_fold 0.0.3", - "uu_groups 0.0.3", - "uu_hashsum 0.0.3", - "uu_head 0.0.3", - "uu_hostid 0.0.3", - "uu_hostname 0.0.3", - "uu_id 0.0.3", - "uu_install 0.0.3", - "uu_join 0.0.3", - "uu_kill 0.0.3", - "uu_link 0.0.3", - "uu_ln 0.0.3", - "uu_logname 0.0.3", - "uu_ls 0.0.3", - "uu_mkdir 0.0.3", - "uu_mkfifo 0.0.3", - "uu_mknod 0.0.3", - "uu_mktemp 0.0.3", - "uu_more 0.0.3", - "uu_mv 0.0.3", - "uu_nice 0.0.3", - "uu_nl 0.0.3", - "uu_nohup 0.0.3", - "uu_nproc 0.0.3", - "uu_numfmt 0.0.3", - "uu_od 0.0.3", - "uu_paste 0.0.3", - "uu_pathchk 0.0.3", - "uu_pinky 0.0.3", - "uu_printenv 0.0.3", - "uu_printf 0.0.3", - "uu_ptx 0.0.3", - "uu_pwd 0.0.3", - "uu_readlink 0.0.3", - "uu_realpath 0.0.3", - "uu_relpath 0.0.3", - "uu_rm 0.0.3", - "uu_rmdir 0.0.3", - "uu_seq 0.0.3", - "uu_shred 0.0.3", - "uu_shuf 0.0.3", - "uu_sleep 0.0.3", - "uu_sort 0.0.3", - "uu_split 0.0.3", - "uu_stat 0.0.3", - "uu_stdbuf 0.0.3", - "uu_sum 0.0.3", - "uu_sync 0.0.3", - "uu_tac 0.0.3", - "uu_tail 0.0.3", - "uu_tee 0.0.3", - "uu_test 0.0.3", - "uu_timeout 0.0.3", - "uu_touch 0.0.3", - "uu_tr 0.0.3", - "uu_true 0.0.3", - "uu_truncate 0.0.3", - "uu_tsort 0.0.3", - "uu_tty 0.0.3", - "uu_uname 0.0.3", - "uu_unexpand 0.0.3", - "uu_uniq 0.0.3", - "uu_unlink 0.0.3", - "uu_uptime 0.0.3", - "uu_users 0.0.3", - "uu_wc 0.0.3", - "uu_who 0.0.3", - "uu_whoami 0.0.3", - "uu_yes 0.0.3", - "uucore 0.0.6", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder", + "cc", + "conv", + "filetime", + "glob 0.3.0", + "lazy_static", + "libc", + "rand 0.7.3", + "regex", + "rustc-demangle", + "same-file", + "sha1", + "tempfile", + "textwrap", + "thread_local", + "time", + "unindent", + "unix_socket", + "users", + "uu_arch", + "uu_base32", + "uu_base64", + "uu_basename", + "uu_cat", + "uu_chgrp", + "uu_chmod", + "uu_chown", + "uu_chroot", + "uu_cksum", + "uu_comm", + "uu_cp", + "uu_csplit", + "uu_cut", + "uu_date", + "uu_df", + "uu_dircolors", + "uu_dirname", + "uu_du", + "uu_echo", + "uu_env", + "uu_expand", + "uu_expr", + "uu_factor", + "uu_false", + "uu_fmt", + "uu_fold", + "uu_groups", + "uu_hashsum", + "uu_head", + "uu_hostid", + "uu_hostname", + "uu_id", + "uu_install", + "uu_join", + "uu_kill", + "uu_link", + "uu_ln", + "uu_logname", + "uu_ls", + "uu_mkdir", + "uu_mkfifo", + "uu_mknod", + "uu_mktemp", + "uu_more", + "uu_mv", + "uu_nice", + "uu_nl", + "uu_nohup", + "uu_nproc", + "uu_numfmt", + "uu_od", + "uu_paste", + "uu_pathchk", + "uu_pinky", + "uu_printenv", + "uu_printf", + "uu_ptx", + "uu_pwd", + "uu_readlink", + "uu_realpath", + "uu_relpath", + "uu_rm", + "uu_rmdir", + "uu_seq", + "uu_shred", + "uu_shuf", + "uu_sleep", + "uu_sort", + "uu_split", + "uu_stat", + "uu_stdbuf", + "uu_sum", + "uu_sync", + "uu_tac", + "uu_tail", + "uu_tee", + "uu_test", + "uu_timeout", + "uu_touch", + "uu_tr", + "uu_true", + "uu_truncate", + "uu_tsort", + "uu_tty", + "uu_uname", + "uu_unexpand", + "uu_uniq", + "uu_unlink", + "uu_uptime", + "uu_users", + "uu_wc", + "uu_who", + "uu_whoami", + "uu_yes", + "uucore", + "winapi-util", ] [[package]] name = "cpp" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" dependencies = [ - "cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_macros", ] [[package]] name = "cpp_build" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" dependencies = [ - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "cpp_common 0.4.0", + "cpp_syn", + "cpp_synmap", + "cpp_synom", + "lazy_static", ] [[package]] name = "cpp_common" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" dependencies = [ - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn", + "cpp_synom", + "lazy_static", + "quote 0.3.15", ] [[package]] name = "cpp_common" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "proc-macro2", + "syn", ] [[package]] name = "cpp_macros" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "byteorder", + "cpp_common 0.5.6", + "if_rust_version", + "lazy_static", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "cpp_syn" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" dependencies = [ - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom", + "quote 0.3.15", + "unicode-xid 0.0.4", ] [[package]] name = "cpp_synmap" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" dependencies = [ - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn", + "cpp_synom", + "memchr 1.0.2", ] [[package]] name = "cpp_synom" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" dependencies = [ - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4", ] [[package]] name = "criterion" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", - "tinytemplate 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "cast", + "clap", + "criterion-plot", + "csv", + "itertools 0.10.0", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", ] [[package]] name = "criterion-plot" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" dependencies = [ - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cast", + "itertools 0.9.0", ] [[package]] name = "crossbeam-channel" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-utils", ] [[package]] name = "crossbeam-deque" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-epoch 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "loom 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "loom 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "cfg-if 1.0.0", + "lazy_static", ] [[package]] name = "csv" version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d58633299b24b515ac72a3f869f8b91306a3cec616a602843a383acd6f9e97" dependencies = [ - "bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr", + "csv-core", + "itoa", + "ryu", + "serde", ] [[package]] name = "csv-core" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" dependencies = [ - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4", ] [[package]] name = "custom_derive" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" [[package]] name = "data-encoding" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" [[package]] name = "digest" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" dependencies = [ - "generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array", ] [[package]] name = "dunce" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "regex", ] [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "filetime" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.2.5", + "winapi 0.3.9", ] [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fs_extra" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "generator" -version = "0.6.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rustversion 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "generic-array" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" dependencies = [ - "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", + "typenum", ] [[package]] name = "getopts" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" dependencies = [ - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "getrandom" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "libc", + "wasi", ] [[package]] name = "glob" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "half" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "hermit-abi" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "hex" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" [[package]] name = "hostname" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "match_cfg", + "winapi 0.3.9", ] [[package]] name = "if_rust_version" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" [[package]] name = "ioctl-sys" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" [[package]] name = "itertools" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itertools" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itertools" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itoa" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" -version = "0.3.47" +version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" dependencies = [ - "wasm-bindgen 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen", ] [[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" [[package]] name = "log" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "loom" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "generator 0.6.24 (registry+https://github.com/rust-lang/crates.io-index)", - "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", ] [[package]] name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "maybe-uninit" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "md5" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" [[package]] name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "memchr" version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memoffset" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "nix" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" dependencies = [ - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.7.0", + "cfg-if 0.1.10", + "libc", + "void", ] [[package]] name = "nix" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1", + "cc", + "cfg-if 0.1.10", + "libc", + "void", ] [[package]] name = "nodrop" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "num-integer" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "num-traits", ] [[package]] name = "num-traits" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", ] [[package]] name = "number_prefix" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "numtoa" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "onig" version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1", + "lazy_static", + "libc", + "onig_sys", ] [[package]] name = "onig_sys" version = "69.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" dependencies = [ - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "pkg-config", ] [[package]] name = "oorandom" version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "paste" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" dependencies = [ - "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", + "paste-impl", + "proc-macro-hack", ] [[package]] name = "paste-impl" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" dependencies = [ - "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack", ] [[package]] name = "pkg-config" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "platform-info" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "platform-info" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi 0.3.9", ] [[package]] name = "plotters" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" dependencies = [ - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.47 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", ] [[package]] name = "plotters-backend" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" [[package]] name = "plotters-svg" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" dependencies = [ - "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-backend", ] [[package]] name = "ppv-lite86" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro-hack" version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1", ] [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quickcheck" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" dependencies = [ - "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger", + "log", + "rand 0.7.3", + "rand_core 0.5.1", ] [[package]] name = "quote" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "rand" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "winapi 0.3.9", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", + "libc", + "rand_chacha", + "rand_core 0.5.1", + "rand_hc", + "rand_pcg", ] [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2", ] [[package]] name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", ] [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1", ] [[package]] name = "rand_pcg" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1", ] [[package]] name = "rayon" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", ] [[package]] name = "rayon-core" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ - "crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", ] [[package]] name = "redox_syscall" version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1", ] [[package]] name = "redox_termios" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5", ] [[package]] name = "regex" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "memchr 2.3.4", + "regex-syntax", + "thread_local", ] [[package]] name = "regex-automata" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder", ] [[package]] name = "regex-syntax" version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "rust-ini" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" [[package]] name = "rustc-demangle" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver", ] -[[package]] -name = "rustversion" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "same-file" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" dependencies = [ - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util", ] -[[package]] -name = "scoped-tls" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver-parser", ] [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.123" +version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" [[package]] name = "serde_cbor" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" dependencies = [ - "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", + "half", + "serde", ] [[package]] name = "serde_derive" -version = "1.0.123" +version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "serde_json" -version = "1.0.62" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ - "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa", + "ryu", + "serde", ] [[package]] name = "sha1" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" dependencies = [ - "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "byte-tools", + "digest", + "fake-simd", + "generic-array", ] [[package]] name = "sha3" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" dependencies = [ - "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "byte-tools", + "digest", + "generic-array", ] [[package]] name = "smallvec" version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit", ] [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.60" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "123a78a3596b24fee53a6464ce52d8ecbf62241e6294c7e7fe12086cd161f512" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "unicode-xid 0.2.1", ] [[package]] name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", + "rand 0.7.3", + "redox_syscall 0.1.57", + "remove_dir_all", + "winapi 0.3.9", ] [[package]] name = "term_grid" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" dependencies = [ - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "term_size" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi 0.3.9", ] [[package]] name = "termion" version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "numtoa", + "redox_syscall 0.2.5", + "redox_termios", ] [[package]] name = "termsize" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "kernel32-sys", + "libc", + "termion", + "winapi 0.2.8", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "term_size", + "unicode-width", ] [[package]] name = "thiserror" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ - "thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "thread_local" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", ] [[package]] name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "redox_syscall 0.1.57", + "winapi 0.3.9", ] [[package]] name = "tinytemplate" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", + "serde", + "serde_json", ] [[package]] name = "typenum" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "unicode-width" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unindent" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" [[package]] name = "unix_socket" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", ] [[package]] name = "users" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "log", ] [[package]] name = "uu_arch" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "platform-info", + "uucore", + "uucore_procs", ] [[package]] name = "uu_base32" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "uucore 0.0.6", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_base64" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "uucore 0.0.6", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_basename" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "uucore 0.0.6", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cat" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "quick-error", + "unix_socket", + "uucore", + "uucore_procs", ] [[package]] name = "uu_chgrp" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "uucore 0.0.6", - "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chmod" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chown" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "glob 0.3.0", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chroot" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cksum" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_comm" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cp" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "filetime", + "ioctl-sys", + "libc", + "quick-error", + "uucore", + "uucore_procs", + "walkdir", + "winapi 0.3.9", + "xattr", ] [[package]] name = "uu_csplit" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "glob 0.2.11", + "regex", + "thiserror", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cut" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "uucore 0.0.6", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_date" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "chrono", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_df" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "number_prefix", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_dircolors" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "glob 0.3.0", + "uucore", + "uucore_procs", ] [[package]] name = "uu_dirname" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_du" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_echo" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "uucore 0.0.6", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_env" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "libc", + "rust-ini", + "uucore", + "uucore_procs", ] [[package]] name = "uu_expand" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_expr" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "libc", + "onig", + "uucore", + "uucore_procs", ] [[package]] name = "uu_factor" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "criterion", + "num-traits", + "paste", + "quickcheck", + "rand 0.7.3", + "rand_chacha", + "smallvec", + "uucore", + "uucore_procs", ] [[package]] name = "uu_false" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "uucore 0.0.6", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_fmt" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "libc", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_fold" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "uucore 0.0.6", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_groups" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hashsum" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "blake2-rfc", + "clap", + "digest", + "hex", + "libc", + "md5", + "regex", + "regex-syntax", + "sha1", + "sha2", + "sha3", + "uucore", + "uucore_procs", ] [[package]] name = "uu_head" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hostid" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hostname" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "hostname", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_id" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_install" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "libc", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_join" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_kill" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_link" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ln" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_logname" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ls" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "atty", + "getopts", + "lazy_static", + "number_prefix", + "term_grid", + "termsize", + "time", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mkdir" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mkfifo" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mknod" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mktemp" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "rand 0.5.6", + "tempfile", + "uucore", + "uucore_procs", ] [[package]] name = "uu_more" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "nix 0.8.1", + "redox_syscall 0.1.57", + "redox_termios", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mv" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "fs_extra", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nice" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nl" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "aho-corasick", + "getopts", + "libc", + "memchr 2.3.4", + "regex", + "regex-syntax", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nohup" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nproc" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "libc", + "num_cpus", + "uucore", + "uucore_procs", ] [[package]] name = "uu_numfmt" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_od" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "byteorder", + "getopts", + "half", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_paste" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pathchk" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pinky" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "uucore 0.0.6", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_printenv" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_printf" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "itertools 0.8.2", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ptx" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "aho-corasick", + "getopts", + "libc", + "memchr 2.3.4", + "regex", + "regex-syntax", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pwd" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_readlink" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_realpath" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_relpath" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_rm" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "remove_dir_all", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_rmdir" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_seq" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_shred" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "filetime", + "getopts", + "libc", + "rand 0.5.6", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_shuf" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "rand 0.5.6", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sleep" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sort" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "itertools 0.8.2", + "semver", + "uucore", + "uucore_procs", ] [[package]] name = "uu_split" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stat" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stdbuf" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_stdbuf_libstdbuf 0.0.3", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "tempfile", + "uu_stdbuf_libstdbuf", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stdbuf_libstdbuf" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "cpp", + "cpp_build", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sum" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sync" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_tac" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tail" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "redox_syscall 0.1.57", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_tee" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_test" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "libc", + "redox_syscall 0.1.57", + "uucore", + "uucore_procs", ] [[package]] name = "uu_timeout" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_touch" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "filetime", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tr" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "bit-set", + "fnv", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_true" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "uucore 0.0.6", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_truncate" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tsort" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tty" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uname" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "platform-info", + "uucore", + "uucore_procs", ] [[package]] name = "uu_unexpand" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uniq" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_unlink" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uptime" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "chrono", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_users" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_wc" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_who" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "uucore 0.0.6", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_whoami" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "advapi32-sys", + "clap", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_yes" -version = "0.0.3" +version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.6", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uucore" -version = "0.0.6" +version = "0.0.7" dependencies = [ - "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "data-encoding", + "dunce", + "getopts", + "lazy_static", + "libc", + "nix 0.13.1", + "platform-info", + "termion", + "thiserror", + "time", + "wild", ] [[package]] name = "uucore_procs" version = "0.0.5" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "walkdir" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" dependencies = [ - "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file", + "winapi 0.3.9", + "winapi-util", ] [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" -version = "0.2.70" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.70" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" dependencies = [ - "bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote 1.0.9", + "syn", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.70" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" dependencies = [ - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9", + "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.70" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.70" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" [[package]] name = "web-sys" -version = "0.3.47" +version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b" dependencies = [ - "js-sys 0.3.47 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys", + "wasm-bindgen", ] [[package]] name = "wild" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0", ] [[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] - -[metadata] -"checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" -"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -"checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" -"checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" -"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" -"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -"checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" -"checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" -"checksum bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" -"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" -"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" -"checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" -"checksum cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)" = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" -"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" -"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" -"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" -"checksum cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" -"checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" -"checksum cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" -"checksum cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" -"checksum cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" -"checksum cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" -"checksum cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" -"checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" -"checksum criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" -"checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" -"checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" -"checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" -"checksum crossbeam-epoch 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d60ab4a8dba064f2fbb5aa270c28da5cf4bbd0e72dae1140a6b0353a779dbe00" -"checksum crossbeam-utils 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bae8f328835f8f5a6ceb6a7842a7f2d0c03692adb5c889347235d59194731fe3" -"checksum csv 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f9d58633299b24b515ac72a3f869f8b91306a3cec616a602843a383acd6f9e97" -"checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" -"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" -"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" -"checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" -"checksum dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" -"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" -"checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -"checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum generator 0.6.24 (registry+https://github.com/rust-lang/crates.io-index)" = "a9fed24fd1e18827652b4d55652899a1e9da8e54d91624dc3437a5bc3a9f9a9c" -"checksum generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fceb69994e330afed50c93524be68c42fa898c2d9fd4ee8da03bd7363acd26f2" -"checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -"checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -"checksum half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" -"checksum hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" -"checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" -"checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -"checksum if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" -"checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" -"checksum itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" -"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" -"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -"checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" -"checksum js-sys 0.3.47 (registry+https://github.com/rust-lang/crates.io-index)" = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)" = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" -"checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -"checksum loom 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d44c73b4636e497b4917eb21c33539efa3816741a2d3ff26c6316f1b529481a4" -"checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" -"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" -"checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" -"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -"checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" -"checksum memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" -"checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" -"checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" -"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" -"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -"checksum number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" -"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" -"checksum onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" -"checksum onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" -"checksum oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" -"checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" -"checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" -"checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" -"checksum platform-info 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f2fd076acdc7a98374de6e300bf3af675997225bef21aecac2219553f04dd7e8" -"checksum platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" -"checksum plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" -"checksum plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" -"checksum plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" -"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" -"checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" -"checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" -"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -"checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" -"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" -"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" -"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" -"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -"checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -"checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" -"checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" -"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -"checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" -"checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" -"checksum regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" -"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -"checksum regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)" = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" -"checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -"checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" -"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" -"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum rustversion 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cb5d2a036dc6d2d8fd16fde3498b04306e29bd193bf306a57427019b823d5acd" -"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" -"checksum scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" -"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)" = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" -"checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.123 (registry+https://github.com/rust-lang/crates.io-index)" = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" -"checksum serde_json 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486" -"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" -"checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" -"checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" -"checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)" = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" -"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" -"checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" -"checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" -"checksum termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" -"checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" -"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" -"checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" -"checksum thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" -"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tinytemplate 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2ada8616fad06a2d0c455adc530de4ef57605a8120cc65da9653e0e9623ca74" -"checksum typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" -"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" -"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" -"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" -"checksum unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" -"checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" -"checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" -"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" -"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum wasm-bindgen 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)" = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be" -"checksum wasm-bindgen-backend 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)" = "7bc45447f0d4573f3d65720f636bbcc3dd6ce920ed704670118650bcd47764c7" -"checksum wasm-bindgen-macro 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)" = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c" -"checksum wasm-bindgen-macro-support 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)" = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385" -"checksum wasm-bindgen-shared 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4945e4943ae02d15c13962b38a5b1e81eadd4b71214eee75af64a4d6a4fd64" -"checksum web-sys 0.3.47 (registry+https://github.com/rust-lang/crates.io-index)" = "c40dc691fc48003eba817c38da7113c15698142da971298003cac3ef175680b3" -"checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" From d3c6ce0b948a0e4dcd397d89635e10a2bf593b1b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 7 Mar 2021 11:47:17 +0100 Subject: [PATCH 371/606] add an ugly script to publish the crates --- util/publish.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 util/publish.sh diff --git a/util/publish.sh b/util/publish.sh new file mode 100644 index 000000000..0936238a8 --- /dev/null +++ b/util/publish.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -e + +ARG="" +if test "$1" != "--do-it"; then + ARG="--dry-run --allow-dirty" +fi + +cd src/uucore/ +cargo publish $ARG +cd - + +cd src/uu/stdbuf/src/libstdbuf/ +cargo publish $ARG +cd - + +PROGS=$(ls -1d src/uu/*/) +for p in $PROGS; do + cd $p + cargo publish $ARG + cd - +done + +cargo publish $ARG From f711027764f2f1a2863bd6ec66c404361c52abc2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 7 Mar 2021 12:05:16 +0100 Subject: [PATCH 372/606] refresh Cargo.lock after the version --- Cargo.lock | 1958 ++++++++++++++++++++++++++-------------------------- 1 file changed, 978 insertions(+), 980 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 429ff44c5..bd3d09739 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,2659 +1,2657 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - [[package]] name = "advapi32-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "aho-corasick" version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ - "memchr 2.3.4", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "arrayvec" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" dependencies = [ - "nodrop", + "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.9", + "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bit-set" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" dependencies = [ - "bit-vec", + "bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ - "arrayvec", - "constant_time_eq", + "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "block-buffer" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" dependencies = [ - "byte-tools", - "generic-array", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bstr" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ - "lazy_static", - "memchr 2.3.4", - "regex-automata", - "serde", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bumpalo" version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "byte-tools" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" [[package]] name = "byteorder" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" [[package]] name = "cast" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" dependencies = [ - "rustc_version", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cc" version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" dependencies = [ - "num-integer", - "num-traits", - "time", + "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clap" version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "ansi_term", - "atty", - "bitflags 1.2.1", - "strsim", - "textwrap", - "unicode-width", - "vec_map", + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags 1.2.1", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "conv" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" dependencies = [ - "custom_derive", + "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "coreutils" version = "0.0.4" dependencies = [ - "byteorder", - "cc", - "conv", - "filetime", - "glob 0.3.0", - "lazy_static", - "libc", - "rand 0.7.3", - "regex", - "rustc-demangle", - "same-file", - "sha1", - "tempfile", - "textwrap", - "thread_local", - "time", - "unindent", - "unix_socket", - "users", - "uu_arch", - "uu_base32", - "uu_base64", - "uu_basename", - "uu_cat", - "uu_chgrp", - "uu_chmod", - "uu_chown", - "uu_chroot", - "uu_cksum", - "uu_comm", - "uu_cp", - "uu_csplit", - "uu_cut", - "uu_date", - "uu_df", - "uu_dircolors", - "uu_dirname", - "uu_du", - "uu_echo", - "uu_env", - "uu_expand", - "uu_expr", - "uu_factor", - "uu_false", - "uu_fmt", - "uu_fold", - "uu_groups", - "uu_hashsum", - "uu_head", - "uu_hostid", - "uu_hostname", - "uu_id", - "uu_install", - "uu_join", - "uu_kill", - "uu_link", - "uu_ln", - "uu_logname", - "uu_ls", - "uu_mkdir", - "uu_mkfifo", - "uu_mknod", - "uu_mktemp", - "uu_more", - "uu_mv", - "uu_nice", - "uu_nl", - "uu_nohup", - "uu_nproc", - "uu_numfmt", - "uu_od", - "uu_paste", - "uu_pathchk", - "uu_pinky", - "uu_printenv", - "uu_printf", - "uu_ptx", - "uu_pwd", - "uu_readlink", - "uu_realpath", - "uu_relpath", - "uu_rm", - "uu_rmdir", - "uu_seq", - "uu_shred", - "uu_shuf", - "uu_sleep", - "uu_sort", - "uu_split", - "uu_stat", - "uu_stdbuf", - "uu_sum", - "uu_sync", - "uu_tac", - "uu_tail", - "uu_tee", - "uu_test", - "uu_timeout", - "uu_touch", - "uu_tr", - "uu_true", - "uu_truncate", - "uu_tsort", - "uu_tty", - "uu_uname", - "uu_unexpand", - "uu_uniq", - "uu_unlink", - "uu_uptime", - "uu_users", - "uu_wc", - "uu_who", - "uu_whoami", - "uu_yes", - "uucore", - "winapi-util", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uu_arch 0.0.4", + "uu_base32 0.0.4", + "uu_base64 0.0.4", + "uu_basename 0.0.4", + "uu_cat 0.0.4", + "uu_chgrp 0.0.4", + "uu_chmod 0.0.4", + "uu_chown 0.0.4", + "uu_chroot 0.0.4", + "uu_cksum 0.0.4", + "uu_comm 0.0.4", + "uu_cp 0.0.4", + "uu_csplit 0.0.4", + "uu_cut 0.0.4", + "uu_date 0.0.4", + "uu_df 0.0.4", + "uu_dircolors 0.0.4", + "uu_dirname 0.0.4", + "uu_du 0.0.4", + "uu_echo 0.0.4", + "uu_env 0.0.4", + "uu_expand 0.0.4", + "uu_expr 0.0.4", + "uu_factor 0.0.4", + "uu_false 0.0.4", + "uu_fmt 0.0.4", + "uu_fold 0.0.4", + "uu_groups 0.0.4", + "uu_hashsum 0.0.4", + "uu_head 0.0.4", + "uu_hostid 0.0.4", + "uu_hostname 0.0.4", + "uu_id 0.0.4", + "uu_install 0.0.4", + "uu_join 0.0.4", + "uu_kill 0.0.4", + "uu_link 0.0.4", + "uu_ln 0.0.4", + "uu_logname 0.0.4", + "uu_ls 0.0.4", + "uu_mkdir 0.0.4", + "uu_mkfifo 0.0.4", + "uu_mknod 0.0.4", + "uu_mktemp 0.0.4", + "uu_more 0.0.4", + "uu_mv 0.0.4", + "uu_nice 0.0.4", + "uu_nl 0.0.4", + "uu_nohup 0.0.4", + "uu_nproc 0.0.4", + "uu_numfmt 0.0.4", + "uu_od 0.0.4", + "uu_paste 0.0.4", + "uu_pathchk 0.0.4", + "uu_pinky 0.0.4", + "uu_printenv 0.0.4", + "uu_printf 0.0.4", + "uu_ptx 0.0.4", + "uu_pwd 0.0.4", + "uu_readlink 0.0.4", + "uu_realpath 0.0.4", + "uu_relpath 0.0.4", + "uu_rm 0.0.4", + "uu_rmdir 0.0.4", + "uu_seq 0.0.4", + "uu_shred 0.0.4", + "uu_shuf 0.0.4", + "uu_sleep 0.0.4", + "uu_sort 0.0.4", + "uu_split 0.0.4", + "uu_stat 0.0.4", + "uu_stdbuf 0.0.4", + "uu_sum 0.0.4", + "uu_sync 0.0.4", + "uu_tac 0.0.4", + "uu_tail 0.0.4", + "uu_tee 0.0.4", + "uu_test 0.0.4", + "uu_timeout 0.0.4", + "uu_touch 0.0.4", + "uu_tr 0.0.4", + "uu_true 0.0.4", + "uu_truncate 0.0.4", + "uu_tsort 0.0.4", + "uu_tty 0.0.4", + "uu_uname 0.0.4", + "uu_unexpand 0.0.4", + "uu_uniq 0.0.4", + "uu_unlink 0.0.4", + "uu_uptime 0.0.4", + "uu_users 0.0.4", + "uu_wc 0.0.4", + "uu_who 0.0.4", + "uu_whoami 0.0.4", + "uu_yes 0.0.4", + "uucore 0.0.7", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" dependencies = [ - "cpp_macros", + "cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_build" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" dependencies = [ - "cc", - "cpp_common 0.4.0", - "cpp_syn", - "cpp_synmap", - "cpp_synom", - "lazy_static", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_common" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" dependencies = [ - "cpp_syn", - "cpp_synom", - "lazy_static", - "quote 0.3.15", + "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_common" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" dependencies = [ - "lazy_static", - "proc-macro2", - "syn", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_macros" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" dependencies = [ - "aho-corasick", - "byteorder", - "cpp_common 0.5.6", - "if_rust_version", - "lazy_static", - "proc-macro2", - "quote 1.0.9", - "syn", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_syn" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" dependencies = [ - "cpp_synom", - "quote 0.3.15", - "unicode-xid 0.0.4", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_synmap" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" dependencies = [ - "cpp_syn", - "cpp_synom", - "memchr 1.0.2", + "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_synom" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" dependencies = [ - "unicode-xid 0.0.4", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "criterion" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" dependencies = [ - "atty", - "cast", - "clap", - "criterion-plot", - "csv", - "itertools 0.10.0", - "lazy_static", - "num-traits", - "oorandom", - "plotters", - "rayon", - "regex", - "serde", - "serde_cbor", - "serde_derive", - "serde_json", - "tinytemplate", - "walkdir", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "criterion-plot" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" dependencies = [ - "cast", - "itertools 0.9.0", + "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-channel" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-deque" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", - "lazy_static", - "memoffset", - "scopeguard", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-utils" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "lazy_static", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv" version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d58633299b24b515ac72a3f869f8b91306a3cec616a602843a383acd6f9e97" dependencies = [ - "bstr", - "csv-core", - "itoa", - "ryu", - "serde", + "bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", + "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv-core" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" dependencies = [ - "memchr 2.3.4", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "custom_derive" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" [[package]] name = "data-encoding" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" [[package]] name = "digest" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" dependencies = [ - "generic-array", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "dunce" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "log", - "regex", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "filetime" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall 0.2.5", - "winapi 0.3.9", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fs_extra" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "generic-array" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" dependencies = [ - "nodrop", - "typenum", + "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "getopts" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" dependencies = [ - "unicode-width", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "getrandom" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glob" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "half" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "hermit-abi" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ - "libc", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hex" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" [[package]] name = "hostname" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ - "libc", - "match_cfg", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "if_rust_version" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" [[package]] name = "ioctl-sys" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" [[package]] name = "itertools" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ - "either", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itertools" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" dependencies = [ - "either", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itertools" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" dependencies = [ - "either", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itoa" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" dependencies = [ - "wasm-bindgen", + "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" [[package]] name = "log" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "maybe-uninit" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "md5" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" [[package]] name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" dependencies = [ - "libc", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "memchr" version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memoffset" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" dependencies = [ - "autocfg", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nix" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" dependencies = [ - "bitflags 0.7.0", - "cfg-if 0.1.10", - "libc", - "void", + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nix" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" dependencies = [ - "bitflags 1.2.1", - "cc", - "cfg-if 0.1.10", - "libc", - "void", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nodrop" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "num-integer" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg", - "num-traits", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "hermit-abi", - "libc", + "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "number_prefix" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "numtoa" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "onig" version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" dependencies = [ - "bitflags 1.2.1", - "lazy_static", - "libc", - "onig_sys", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "onig_sys" version = "69.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" dependencies = [ - "cc", - "pkg-config", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "oorandom" version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "paste" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" dependencies = [ - "paste-impl", - "proc-macro-hack", + "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "paste-impl" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" dependencies = [ - "proc-macro-hack", + "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pkg-config" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "platform-info" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" dependencies = [ - "libc", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "plotters" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" dependencies = [ - "num-traits", - "plotters-backend", - "plotters-svg", - "wasm-bindgen", - "web-sys", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "plotters-backend" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" [[package]] name = "plotters-svg" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" dependencies = [ - "plotters-backend", + "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ppv-lite86" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro-hack" version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "unicode-xid 0.2.1", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quickcheck" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" dependencies = [ - "env_logger", - "log", - "rand 0.7.3", - "rand_core 0.5.1", + "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "quote" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ - "proc-macro2", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "winapi 0.3.9", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", - "libc", - "rand_chacha", - "rand_core 0.5.1", - "rand_hc", - "rand_pcg", + "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "rand_core 0.4.2", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_pcg" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core 0.5.1", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon-core" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "lazy_static", - "num_cpus", + "crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_syscall" version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" dependencies = [ - "bitflags 1.2.1", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_termios" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall 0.2.5", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" dependencies = [ - "aho-corasick", - "memchr 2.3.4", - "regex-syntax", - "thread_local", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-automata" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" dependencies = [ - "byteorder", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rust-ini" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" [[package]] name = "rustc-demangle" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "same-file" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" dependencies = [ - "winapi-util", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser", + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" [[package]] name = "serde_cbor" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" dependencies = [ - "half", - "serde", + "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ - "itoa", - "ryu", - "serde", + "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sha1" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" dependencies = [ - "block-buffer", - "byte-tools", - "digest", - "fake-simd", - "generic-array", + "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sha3" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" dependencies = [ - "block-buffer", - "byte-tools", - "digest", - "generic-array", + "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "smallvec" version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ - "maybe-uninit", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "123a78a3596b24fee53a6464ce52d8ecbf62241e6294c7e7fe12086cd161f512" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "unicode-xid 0.2.1", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if 0.1.10", - "libc", - "rand 0.7.3", - "redox_syscall 0.1.57", - "remove_dir_all", - "winapi 0.3.9", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "term_grid" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" dependencies = [ - "unicode-width", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "term_size" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" dependencies = [ - "libc", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termion" version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ - "libc", - "numtoa", - "redox_syscall 0.2.5", - "redox_termios", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termsize" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" dependencies = [ - "atty", - "kernel32-sys", - "libc", - "termion", - "winapi 0.2.8", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "term_size", - "unicode-width", + "term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thiserror" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thiserror-impl" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thread_local" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" dependencies = [ - "lazy_static", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" dependencies = [ - "libc", - "redox_syscall 0.1.57", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "serde", - "serde_json", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "typenum" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "unicode-width" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unindent" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" [[package]] name = "unix_socket" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" dependencies = [ - "cfg-if 0.1.10", - "libc", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "users" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" dependencies = [ - "libc", - "log", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_arch" version = "0.0.4" dependencies = [ - "platform-info", - "uucore", - "uucore_procs", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_base32" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_base64" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_basename" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cat" version = "0.0.4" dependencies = [ - "quick-error", - "unix_socket", - "uucore", - "uucore_procs", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_chgrp" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", - "walkdir", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_chmod" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", - "walkdir", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_chown" version = "0.0.4" dependencies = [ - "clap", - "glob 0.3.0", - "uucore", - "uucore_procs", - "walkdir", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_chroot" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cksum" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_comm" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cp" version = "0.0.4" dependencies = [ - "clap", - "filetime", - "ioctl-sys", - "libc", - "quick-error", - "uucore", - "uucore_procs", - "walkdir", - "winapi 0.3.9", - "xattr", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_csplit" version = "0.0.4" dependencies = [ - "getopts", - "glob 0.2.11", - "regex", - "thiserror", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cut" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_date" version = "0.0.4" dependencies = [ - "chrono", - "clap", - "uucore", - "uucore_procs", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_df" version = "0.0.4" dependencies = [ - "clap", - "libc", - "number_prefix", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_dircolors" version = "0.0.4" dependencies = [ - "glob 0.3.0", - "uucore", - "uucore_procs", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_dirname" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_du" version = "0.0.4" dependencies = [ - "time", - "uucore", - "uucore_procs", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_echo" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_env" version = "0.0.4" dependencies = [ - "clap", - "libc", - "rust-ini", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_expand" version = "0.0.4" dependencies = [ - "getopts", - "unicode-width", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_expr" version = "0.0.4" dependencies = [ - "libc", - "onig", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_factor" version = "0.0.4" dependencies = [ - "criterion", - "num-traits", - "paste", - "quickcheck", - "rand 0.7.3", - "rand_chacha", - "smallvec", - "uucore", - "uucore_procs", + "criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_false" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_fmt" version = "0.0.4" dependencies = [ - "clap", - "libc", - "unicode-width", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_fold" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_groups" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_hashsum" version = "0.0.4" dependencies = [ - "blake2-rfc", - "clap", - "digest", - "hex", - "libc", - "md5", - "regex", - "regex-syntax", - "sha1", - "sha2", - "sha3", - "uucore", - "uucore_procs", + "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_head" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_hostid" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_hostname" version = "0.0.4" dependencies = [ - "clap", - "hostname", - "libc", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_id" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_install" version = "0.0.4" dependencies = [ - "clap", - "libc", - "time", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_join" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_kill" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_link" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_ln" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_logname" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_ls" version = "0.0.4" dependencies = [ - "atty", - "getopts", - "lazy_static", - "number_prefix", - "term_grid", - "termsize", - "time", - "unicode-width", - "uucore", - "uucore_procs", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mkdir" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mkfifo" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mknod" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mktemp" version = "0.0.4" dependencies = [ - "clap", - "rand 0.5.6", - "tempfile", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_more" version = "0.0.4" dependencies = [ - "getopts", - "nix 0.8.1", - "redox_syscall 0.1.57", - "redox_termios", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mv" version = "0.0.4" dependencies = [ - "clap", - "fs_extra", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nice" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nl" version = "0.0.4" dependencies = [ - "aho-corasick", - "getopts", - "libc", - "memchr 2.3.4", - "regex", - "regex-syntax", - "uucore", - "uucore_procs", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nohup" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nproc" version = "0.0.4" dependencies = [ - "clap", - "libc", - "num_cpus", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_numfmt" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_od" version = "0.0.4" dependencies = [ - "byteorder", - "getopts", - "half", - "libc", - "uucore", - "uucore_procs", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_paste" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pathchk" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pinky" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_printenv" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_printf" version = "0.0.4" dependencies = [ - "itertools 0.8.2", - "uucore", - "uucore_procs", + "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_ptx" version = "0.0.4" dependencies = [ - "aho-corasick", - "getopts", - "libc", - "memchr 2.3.4", - "regex", - "regex-syntax", - "uucore", - "uucore_procs", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pwd" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_readlink" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_realpath" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_relpath" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_rm" version = "0.0.4" dependencies = [ - "clap", - "remove_dir_all", - "uucore", - "uucore_procs", - "walkdir", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_rmdir" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_seq" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_shred" version = "0.0.4" dependencies = [ - "filetime", - "getopts", - "libc", - "rand 0.5.6", - "time", - "uucore", - "uucore_procs", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_shuf" version = "0.0.4" dependencies = [ - "getopts", - "rand 0.5.6", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sleep" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sort" version = "0.0.4" dependencies = [ - "clap", - "itertools 0.8.2", - "semver", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_split" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_stat" version = "0.0.4" dependencies = [ - "clap", - "time", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_stdbuf" version = "0.0.4" dependencies = [ - "getopts", - "tempfile", - "uu_stdbuf_libstdbuf", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uu_stdbuf_libstdbuf 0.0.4", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_stdbuf_libstdbuf" version = "0.0.4" dependencies = [ - "cpp", - "cpp_build", - "libc", - "uucore", - "uucore_procs", + "cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sum" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sync" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_tac" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tail" version = "0.0.4" dependencies = [ - "clap", - "libc", - "redox_syscall 0.1.57", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_tee" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_test" version = "0.0.4" dependencies = [ - "libc", - "redox_syscall 0.1.57", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_timeout" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_touch" version = "0.0.4" dependencies = [ - "clap", - "filetime", - "time", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tr" version = "0.0.4" dependencies = [ - "bit-set", - "fnv", - "getopts", - "uucore", - "uucore_procs", + "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_true" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_truncate" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tsort" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tty" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_uname" version = "0.0.4" dependencies = [ - "clap", - "platform-info", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_unexpand" version = "0.0.4" dependencies = [ - "getopts", - "unicode-width", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_uniq" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_unlink" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_uptime" version = "0.0.4" dependencies = [ - "chrono", - "clap", - "uucore", - "uucore_procs", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_users" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_wc" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_who" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_whoami" version = "0.0.4" dependencies = [ - "advapi32-sys", - "clap", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_yes" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uucore" version = "0.0.7" dependencies = [ - "data-encoding", - "dunce", - "getopts", - "lazy_static", - "libc", - "nix 0.13.1", - "platform-info", - "termion", - "thiserror", - "time", - "wild", + "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uucore_procs" version = "0.0.5" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "walkdir" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" dependencies = [ - "same-file", - "winapi 0.3.9", - "winapi-util", + "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" dependencies = [ - "cfg-if 1.0.0", - "wasm-bindgen-macro", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote 1.0.9", - "syn", - "wasm-bindgen-shared", + "bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" dependencies = [ - "quote 1.0.9", - "wasm-bindgen-macro-support", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" [[package]] name = "web-sys" version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b" dependencies = [ - "js-sys", - "wasm-bindgen", + "js-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wild" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" dependencies = [ - "glob 0.3.0", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" dependencies = [ - "winapi 0.3.9", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" dependencies = [ - "libc", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] + +[metadata] +"checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" +"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" +"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +"checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" +"checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" +"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +"checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" +"checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" +"checksum bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" +"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" +"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +"checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" +"checksum cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)" = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" +"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +"checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" +"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" +"checksum cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" +"checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" +"checksum cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" +"checksum cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" +"checksum cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" +"checksum cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" +"checksum cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" +"checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" +"checksum criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" +"checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" +"checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" +"checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" +"checksum crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" +"checksum crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" +"checksum csv 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f9d58633299b24b515ac72a3f869f8b91306a3cec616a602843a383acd6f9e97" +"checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" +"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" +"checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" +"checksum dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" +"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +"checksum filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" +"checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +"checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" +"checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +"checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" +"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +"checksum half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" +"checksum hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +"checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" +"checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +"checksum if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" +"checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" +"checksum itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" +"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" +"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +"checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +"checksum js-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)" = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +"checksum libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)" = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" +"checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +"checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" +"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" +"checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" +"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" +"checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +"checksum memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" +"checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" +"checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" +"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +"checksum number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" +"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" +"checksum onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" +"checksum onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" +"checksum oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +"checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" +"checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" +"checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +"checksum platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" +"checksum plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" +"checksum plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" +"checksum plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" +"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +"checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" +"checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +"checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" +"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" +"checksum quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" +"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +"checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +"checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" +"checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" +"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +"checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" +"checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" +"checksum regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" +"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +"checksum regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)" = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" +"checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +"checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" +"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" +"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)" = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" +"checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" +"checksum serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)" = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" +"checksum serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +"checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" +"checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" +"checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +"checksum syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)" = "123a78a3596b24fee53a6464ce52d8ecbf62241e6294c7e7fe12086cd161f512" +"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +"checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" +"checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" +"checksum termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" +"checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" +"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +"checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" +"checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" +"checksum thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +"checksum typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" +"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" +"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +"checksum unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" +"checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" +"checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" +"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" +"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +"checksum wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" +"checksum wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" +"checksum wasm-bindgen-macro 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" +"checksum wasm-bindgen-macro-support 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" +"checksum wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" +"checksum web-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)" = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b" +"checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" From 3e0a10d73280dd2700a8f087392e196108b231f5 Mon Sep 17 00:00:00 2001 From: Felipe Lema <1232306+FelipeLema@users.noreply.github.com> Date: Mon, 8 Mar 2021 11:50:26 -0300 Subject: [PATCH 373/606] update wc --- src/uu/wc/src/wc.rs | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 68e955f81..972802f81 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -29,11 +29,11 @@ struct Settings { impl Settings { fn new(matches: &ArgMatches) -> Settings { let settings = Settings { - show_bytes: matches.is_present(OPT_BYTES), - show_chars: matches.is_present(OPT_CHAR), - show_lines: matches.is_present(OPT_LINES), - show_words: matches.is_present(OPT_WORDS), - show_max_line_length: matches.is_present(OPT_MAX_LINE_LENGTH), + show_bytes: matches.is_present(options::BYTES), + show_chars: matches.is_present(options::CHAR), + show_lines: matches.is_present(options::LINES), + show_words: matches.is_present(options::WORDS), + show_max_line_length: matches.is_present(options::MAX_LINE_LENGTH), }; if settings.show_bytes @@ -68,11 +68,13 @@ static ABOUT: &str = "Display newline, word, and byte counts for each FILE, and more than one FILE is specified."; static VERSION: &str = env!("CARGO_PKG_VERSION"); -static OPT_BYTES: &str = "bytes"; -static OPT_CHAR: &str = "chars"; -static OPT_LINES: &str = "lines"; -static OPT_MAX_LINE_LENGTH: &str = "max-line-length"; -static OPT_WORDS: &str = "words"; +pub mod options { + pub static BYTES: &str = "bytes"; + pub static CHAR: &str = "chars"; + pub static LINES: &str = "lines"; + pub static MAX_LINE_LENGTH: &str = "max-line-length"; + pub static WORDS: &str = "words"; +} static ARG_FILES: &str = "files"; @@ -92,33 +94,33 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .arg( - Arg::with_name(OPT_BYTES) + Arg::with_name(options::BYTES) .short("c") - .long(OPT_BYTES) + .long(options::BYTES) .help("print the byte counts"), ) .arg( - Arg::with_name(OPT_CHAR) + Arg::with_name(options::CHAR) .short("m") - .long(OPT_CHAR) + .long(options::CHAR) .help("print the character counts"), ) .arg( - Arg::with_name(OPT_LINES) + Arg::with_name(options::LINES) .short("l") - .long(OPT_LINES) + .long(options::LINES) .help("print the newline counts"), ) .arg( - Arg::with_name(OPT_MAX_LINE_LENGTH) + Arg::with_name(options::MAX_LINE_LENGTH) .short("L") - .long(OPT_MAX_LINE_LENGTH) + .long(options::MAX_LINE_LENGTH) .help("print the length of the longest line"), ) .arg( - Arg::with_name(OPT_WORDS) + Arg::with_name(options::WORDS) .short("w") - .long(OPT_WORDS) + .long(options::WORDS) .help("print the word counts"), ) .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) From 75b3bc02eb80a5f07c708096e8a2ea4fd03190f2 Mon Sep 17 00:00:00 2001 From: Felipe Lema <1232306+FelipeLema@users.noreply.github.com> Date: Mon, 8 Mar 2021 12:02:46 -0300 Subject: [PATCH 374/606] uniq --- src/uu/uniq/src/uniq.rs | 78 +++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/src/uu/uniq/src/uniq.rs b/src/uu/uniq/src/uniq.rs index 9261dba9b..f636adde7 100644 --- a/src/uu/uniq/src/uniq.rs +++ b/src/uu/uniq/src/uniq.rs @@ -16,15 +16,17 @@ use std::str::FromStr; static ABOUT: &str = "Report or omit repeated lines."; static VERSION: &str = env!("CARGO_PKG_VERSION"); -static OPT_ALL_REPEATED: &str = "all-repeated"; -static OPT_CHECK_CHARS: &str = "check-chars"; -static OPT_COUNT: &str = "count"; -static OPT_IGNORE_CASE: &str = "ignore-case"; -static OPT_REPEATED: &str = "repeated"; -static OPT_SKIP_FIELDS: &str = "skip-fields"; -static OPT_SKIP_CHARS: &str = "skip-chars"; -static OPT_UNIQUE: &str = "unique"; -static OPT_ZERO_TERMINATED: &str = "zero-terminated"; +pub mod options { + pub static ALL_REPEATED: &str = "all-repeated"; + pub static CHECK_CHARS: &str = "check-chars"; + pub static COUNT: &str = "count"; + pub static IGNORE_CASE: &str = "ignore-case"; + pub static REPEATED: &str = "repeated"; + pub static SKIP_FIELDS: &str = "skip-fields"; + pub static SKIP_CHARS: &str = "skip-chars"; + pub static UNIQUE: &str = "unique"; + pub static ZERO_TERMINATED: &str = "zero-terminated"; +} static ARG_FILES: &str = "files"; @@ -233,63 +235,63 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .usage(&usage[..]) .after_help(&long_usage[..]) .arg( - Arg::with_name(OPT_ALL_REPEATED) + Arg::with_name(options::ALL_REPEATED) .short("D") - .long(OPT_ALL_REPEATED) + .long(options::ALL_REPEATED) .possible_values(&["none", "prepend", "separate"]) .help("print all duplicate lines. Delimiting is done with blank lines") .value_name("delimit-method") .default_value("none"), ) .arg( - Arg::with_name(OPT_CHECK_CHARS) + Arg::with_name(options::CHECK_CHARS) .short("w") - .long(OPT_CHECK_CHARS) + .long(options::CHECK_CHARS) .help("compare no more than N characters in lines") .value_name("N"), ) .arg( - Arg::with_name(OPT_COUNT) + Arg::with_name(options::COUNT) .short("c") - .long(OPT_COUNT) + .long(options::COUNT) .help("prefix lines by the number of occurrences"), ) .arg( - Arg::with_name(OPT_IGNORE_CASE) + Arg::with_name(options::IGNORE_CASE) .short("i") - .long(OPT_IGNORE_CASE) + .long(options::IGNORE_CASE) .help("ignore differences in case when comparing"), ) .arg( - Arg::with_name(OPT_REPEATED) + Arg::with_name(options::REPEATED) .short("d") - .long(OPT_REPEATED) + .long(options::REPEATED) .help("only print duplicate lines"), ) .arg( - Arg::with_name(OPT_SKIP_CHARS) + Arg::with_name(options::SKIP_CHARS) .short("s") - .long(OPT_SKIP_CHARS) + .long(options::SKIP_CHARS) .help("avoid comparing the first N characters") .value_name("N"), ) .arg( - Arg::with_name(OPT_SKIP_FIELDS) + Arg::with_name(options::SKIP_FIELDS) .short("f") - .long(OPT_SKIP_FIELDS) + .long(options::SKIP_FIELDS) .help("avoid comparing the first N fields") .value_name("N"), ) .arg( - Arg::with_name(OPT_UNIQUE) + Arg::with_name(options::UNIQUE) .short("u") - .long(OPT_UNIQUE) + .long(options::UNIQUE) .help("only print unique lines"), ) .arg( - Arg::with_name(OPT_ZERO_TERMINATED) + Arg::with_name(options::ZERO_TERMINATED) .short("z") - .long(OPT_ZERO_TERMINATED) + .long(options::ZERO_TERMINATED) .help("end lines with 0 byte, not newline"), ) .arg( @@ -316,11 +318,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; let uniq = Uniq { - repeats_only: matches.is_present(OPT_REPEATED) - || matches.occurrences_of(OPT_ALL_REPEATED) > 0, - uniques_only: matches.is_present(OPT_UNIQUE), - all_repeated: matches.occurrences_of(OPT_ALL_REPEATED) > 0, - delimiters: match matches.value_of(OPT_ALL_REPEATED).map(String::from) { + repeats_only: matches.is_present(options::REPEATED) + || matches.occurrences_of(options::ALL_REPEATED) > 0, + uniques_only: matches.is_present(options::UNIQUE), + all_repeated: matches.occurrences_of(options::ALL_REPEATED) > 0, + delimiters: match matches.value_of(options::ALL_REPEATED).map(String::from) { Some(ref opt_arg) if opt_arg != "none" => match &(*opt_arg.as_str()) { "prepend" => Delimiters::Prepend, "separate" => Delimiters::Separate, @@ -328,12 +330,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }, _ => Delimiters::None, }, - show_counts: matches.is_present(OPT_COUNT), - skip_fields: opt_parsed(OPT_SKIP_FIELDS, &matches), - slice_start: opt_parsed(OPT_SKIP_CHARS, &matches), - slice_stop: opt_parsed(OPT_CHECK_CHARS, &matches), - ignore_case: matches.is_present(OPT_IGNORE_CASE), - zero_terminated: matches.is_present(OPT_ZERO_TERMINATED), + show_counts: matches.is_present(options::COUNT), + skip_fields: opt_parsed(options::SKIP_FIELDS, &matches), + slice_start: opt_parsed(options::SKIP_CHARS, &matches), + slice_stop: opt_parsed(options::CHECK_CHARS, &matches), + ignore_case: matches.is_present(options::IGNORE_CASE), + zero_terminated: matches.is_present(options::ZERO_TERMINATED), }; uniq.print_uniq( &mut open_input_file(in_file_name), From 0e02607dc77c95a6f2dc419b41b5772bec769d5c Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Sun, 28 Feb 2021 13:06:58 -0500 Subject: [PATCH 375/606] numfmt: implement --field --- src/uu/cut/src/cut.rs | 5 +- src/uu/numfmt/src/numfmt.rs | 180 ++++++++++++------ src/uucore/src/lib/lib.rs | 1 + src/uucore/src/lib/mods.rs | 1 + .../cut/src => uucore/src/lib/mods}/ranges.rs | 28 +++ tests/by-util/test_numfmt.rs | 68 +++++++ tests/fixtures/numfmt/df_expected.txt | 8 + tests/fixtures/numfmt/df_input.txt | 8 + 8 files changed, 238 insertions(+), 61 deletions(-) rename src/{uu/cut/src => uucore/src/lib/mods}/ranges.rs (83%) create mode 100644 tests/fixtures/numfmt/df_expected.txt create mode 100644 tests/fixtures/numfmt/df_input.txt diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 33399aba0..95411e3fb 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -14,11 +14,10 @@ use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, Read, Stdout, Write}; use std::path::Path; -use self::ranges::Range; use self::searcher::Searcher; +use uucore::ranges::Range; mod buffer; -mod ranges; mod searcher; static SYNTAX: &str = @@ -125,7 +124,7 @@ enum Mode { fn list_to_ranges(list: &str, complement: bool) -> Result, String> { if complement { - Range::from_list(list).map(|r| ranges::complement(&r)) + Range::from_list(list).map(|r| uucore::ranges::complement(&r)) } else { Range::from_list(list) } diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index 0ee25e96a..ea750c024 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -5,13 +5,13 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -use std::fmt; -use std::io::BufRead; - #[macro_use] extern crate uucore; -use clap::{App, Arg, ArgMatches}; +use clap::{App, AppSettings, Arg, ArgMatches}; +use std::fmt; +use std::io::{BufRead, Write}; +use uucore::ranges::Range; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Convert numbers from/to human-readable strings"; @@ -33,9 +33,19 @@ static LONG_HELP: &str = "UNIT options: iec-i accept optional two-letter suffix: 1Ki = 1024, 1Mi = 1048576, ... + +FIELDS supports cut(1) style field ranges: + N N'th field, counted from 1 + N- from N'th field, to end of line + N-M from N'th to M'th field (inclusive) + -M from first to M'th field (inclusive) + - all fields +Multiple fields/ranges can be separated with commas "; mod options { + pub const FIELD: &str = "field"; + pub const FIELD_DEFAULT: &str = "1"; pub const FROM: &str = "from"; pub const FROM_DEFAULT: &str = "none"; pub const HEADER: &str = "header"; @@ -113,6 +123,10 @@ impl fmt::Display for DisplayableSuffix { } fn parse_suffix(s: &str) -> Result<(f64, Option)> { + if s.is_empty() { + return Err("invalid number: ‘’".to_string()); + } + let with_i = s.ends_with('i'); let mut iter = s.chars(); if with_i { @@ -168,6 +182,64 @@ struct NumfmtOptions { transform: TransformOptions, padding: isize, header: usize, + fields: Vec, +} + +/// Iterate over a line's fields, where each field is a contiguous sequence of +/// non-whitespace, optionally prefixed with one or more characters of leading +/// whitespace. Fields are returned as tuples of `(prefix, field)`. +/// +/// # Examples: +/// +/// ``` +/// let mut fields = uu_numfmt::WhitespaceSplitter { s: Some(" 1234 5") }; +/// +/// assert_eq!(Some((" ", "1234")), fields.next()); +/// assert_eq!(Some((" ", "5")), fields.next()); +/// assert_eq!(None, fields.next()); +/// ``` +/// +/// Delimiters are included in the results; `prefix` will be empty only for +/// the first field of the line (including the case where the input line is +/// empty): +/// +/// ``` +/// let mut fields = uu_numfmt::WhitespaceSplitter { s: Some("first second") }; +/// +/// assert_eq!(Some(("", "first")), fields.next()); +/// assert_eq!(Some((" ", "second")), fields.next()); +/// +/// let mut fields = uu_numfmt::WhitespaceSplitter { s: Some("") }; +/// +/// assert_eq!(Some(("", "")), fields.next()); +/// ``` +pub struct WhitespaceSplitter<'a> { + pub s: Option<&'a str>, +} + +impl<'a> Iterator for WhitespaceSplitter<'a> { + type Item = (&'a str, &'a str); + + /// Yield the next field in the input string as a tuple `(prefix, field)`. + fn next(&mut self) -> Option { + let haystack = self.s?; + + let (prefix, field) = haystack.split_at( + haystack + .find(|c: char| !c.is_whitespace()) + .unwrap_or_else(|| haystack.len()), + ); + + let (field, rest) = field.split_at( + field + .find(|c: char| c.is_whitespace()) + .unwrap_or_else(|| field.len()), + ); + + self.s = if !rest.is_empty() { Some(rest) } else { None }; + + Some((prefix, field)) + } } fn remove_suffix(i: f64, s: Option, u: &Unit) -> Result { @@ -214,7 +286,7 @@ fn transform_from(s: &str, opts: &Transform) -> Result { /// /// Otherwise, truncate the result to the next highest whole number. /// -/// Examples: +/// # Examples: /// /// ``` /// use uu_numfmt::div_ceil; @@ -301,15 +373,34 @@ fn format_string( } fn format_and_print(s: &str, options: &NumfmtOptions) -> Result<()> { - let (prefix, field, suffix) = extract_field(&s)?; + for (n, (prefix, field)) in (1..).zip(WhitespaceSplitter { s: Some(s) }) { + let field_selected = uucore::ranges::contain(&options.fields, n); - let implicit_padding = match !prefix.is_empty() && options.padding == 0 { - true => Some((prefix.len() + field.len()) as isize), - false => None, - }; + if field_selected { + let empty_prefix = prefix.is_empty(); - let field = format_string(field, options, implicit_padding)?; - println!("{}{}", field, suffix); + // print delimiter before second and subsequent fields + let prefix = if n > 1 { + print!(" "); + &prefix[1..] + } else { + &prefix + }; + + let implicit_padding = if !empty_prefix && options.padding == 0 { + Some((prefix.len() + field.len()) as isize) + } else { + None + }; + + print!("{}", format_string(&field, options, implicit_padding)?); + } else { + // print unselected field without conversion + print!("{}{}", prefix, field); + } + } + + println!(); Ok(()) } @@ -344,59 +435,23 @@ fn parse_options(args: &ArgMatches) -> Result { } }?; + let fields = match args.value_of(options::FIELD) { + Some("-") => vec![Range { + low: 1, + high: std::usize::MAX, + }], + Some(v) => Range::from_list(v)?, + None => unreachable!(), + }; + Ok(NumfmtOptions { transform, padding, header, + fields, }) } -/// Extract the field to convert from `line`. -/// -/// The field is the first sequence of non-whitespace characters in `line`. -/// -/// Returns a [`Result`] of `(prefix: &str, field: &str, suffix: &str)`, where -/// `prefix` contains any leading whitespace, `field` is the field to convert, -/// and `suffix` is everything after the field. `prefix` and `suffix` may be -/// empty. -/// -/// Returns an [`Err`] if `line` is empty or consists only of whitespace. -/// -/// Examples: -/// -/// ``` -/// use uu_numfmt::extract_field; -/// -/// assert_eq!("1K", extract_field("1K").unwrap().1); -/// -/// let (prefix, field, suffix) = extract_field(" 1K qux").unwrap(); -/// assert_eq!(" ", prefix); -/// assert_eq!("1K", field); -/// assert_eq!(" qux", suffix); -/// -/// assert!(extract_field("").is_err()); -/// ``` -pub fn extract_field(line: &str) -> Result<(&str, &str, &str)> { - let start = line - .find(|c: char| !c.is_whitespace()) - .ok_or("invalid number: ‘’")?; - - let prefix = &line[..start]; - - let mut field = &line[start..]; - - let suffix = match field.find(|c: char| c.is_whitespace()) { - Some(i) => { - let suffix = &field[i..]; - field = &field[..i]; - suffix - } - None => "", - }; - - Ok((prefix, field, suffix)) -} - fn handle_args<'a>(args: impl Iterator, options: NumfmtOptions) -> Result<()> { for l in args { format_and_print(l, &options)?; @@ -430,6 +485,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .after_help(LONG_HELP) + .setting(AppSettings::AllowNegativeNumbers) + .arg( + Arg::with_name(options::FIELD) + .long(options::FIELD) + .help("replace the numbers in these input fields (default=1) see FIELDS below") + .value_name("FIELDS") + .default_value(options::FIELD_DEFAULT), + ) .arg( Arg::with_name(options::FROM) .long(options::FROM) @@ -477,6 +540,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { match result { Err(e) => { + std::io::stdout().flush().expect("error flushing stdout"); show_info!("{}", e); 1 } diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 768843409..324095b6a 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -27,6 +27,7 @@ mod mods; // core cross-platform modules // * cross-platform modules pub use crate::mods::coreopts; pub use crate::mods::panic; +pub use crate::mods::ranges; // * feature-gated modules #[cfg(feature = "encoding")] diff --git a/src/uucore/src/lib/mods.rs b/src/uucore/src/lib/mods.rs index 0becc71bd..c73909dcc 100644 --- a/src/uucore/src/lib/mods.rs +++ b/src/uucore/src/lib/mods.rs @@ -2,3 +2,4 @@ pub mod coreopts; pub mod panic; +pub mod ranges; diff --git a/src/uu/cut/src/ranges.rs b/src/uucore/src/lib/mods/ranges.rs similarity index 83% rename from src/uu/cut/src/ranges.rs rename to src/uucore/src/lib/mods/ranges.rs index 74fec08e6..d4a6bf601 100644 --- a/src/uu/cut/src/ranges.rs +++ b/src/uucore/src/lib/mods/ranges.rs @@ -144,3 +144,31 @@ pub fn complement(ranges: &[Range]) -> Vec { complements } + +/// Test if at least one of the given Ranges contain the supplied value. +/// +/// Examples: +/// +/// ``` +/// let ranges = uucore::ranges::Range::from_list("11,2,6-8").unwrap(); +/// +/// assert!(!uucore::ranges::contain(&ranges, 0)); +/// assert!(!uucore::ranges::contain(&ranges, 1)); +/// assert!(!uucore::ranges::contain(&ranges, 5)); +/// assert!(!uucore::ranges::contain(&ranges, 10)); +/// +/// assert!(uucore::ranges::contain(&ranges, 2)); +/// assert!(uucore::ranges::contain(&ranges, 6)); +/// assert!(uucore::ranges::contain(&ranges, 7)); +/// assert!(uucore::ranges::contain(&ranges, 8)); +/// assert!(uucore::ranges::contain(&ranges, 11)); +/// ``` +pub fn contain(ranges: &[Range], n: usize) -> bool { + for range in ranges { + if n >= range.low && n <= range.high { + return true; + } + } + + false +} diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index 787ec6832..c22db3bf5 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -315,3 +315,71 @@ fn test_to_iec_i_should_truncate_output() { .succeeds() .stdout_is_fixture("gnutest_iec-i_result.txt"); } + +#[test] +fn test_format_selected_field() { + new_ucmd!() + .args(&["--from=auto", "--field", "3", "1K 2K 3K"]) + .succeeds() + .stdout_only("1K 2K 3000\n"); + new_ucmd!() + .args(&["--from=auto", "--field", "2", "1K 2K 3K"]) + .succeeds() + .stdout_only("1K 2000 3K\n"); +} + +#[test] +fn test_format_selected_fields() { + new_ucmd!() + .args(&["--from=auto", "--field", "1,4,3", "1K 2K 3K 4K 5K 6K"]) + .succeeds() + .stdout_only("1000 2K 3000 4000 5K 6K\n"); +} + +#[test] +fn test_should_succeed_if_selected_field_out_of_range() { + new_ucmd!() + .args(&["--from=auto", "--field", "9", "1K 2K 3K"]) + .succeeds() + .stdout_only("1K 2K 3K\n"); +} + +#[test] +fn test_format_selected_field_range() { + new_ucmd!() + .args(&["--from=auto", "--field", "2-5", "1K 2K 3K 4K 5K 6K"]) + .succeeds() + .stdout_only("1K 2000 3000 4000 5000 6K\n"); +} + +#[test] +fn test_should_succeed_if_range_out_of_bounds() { + new_ucmd!() + .args(&["--from=auto", "--field", "5-10", "1K 2K 3K 4K 5K 6K"]) + .succeeds() + .stdout_only("1K 2K 3K 4K 5000 6000\n"); +} + +#[test] +fn test_implied_initial_field_value() { + new_ucmd!() + .args(&["--from=auto", "--field", "-2", "1K 2K 3K"]) + .succeeds() + .stdout_only("1000 2000 3K\n"); + + // same as above but with the equal sign + new_ucmd!() + .args(&["--from=auto", "--field=-2", "1K 2K 3K"]) + .succeeds() + .stdout_only("1000 2000 3K\n"); +} + +#[test] +fn test_field_df_example() { + // df -B1 | numfmt --header --field 2-4 --to=si + new_ucmd!() + .args(&["--header", "--field", "2-4", "--to=si"]) + .pipe_in_fixture("df_input.txt") + .succeeds() + .stdout_is_fixture("df_expected.txt"); +} diff --git a/tests/fixtures/numfmt/df_expected.txt b/tests/fixtures/numfmt/df_expected.txt new file mode 100644 index 000000000..ea8c3d79f --- /dev/null +++ b/tests/fixtures/numfmt/df_expected.txt @@ -0,0 +1,8 @@ +Filesystem 1B-blocks Used Available Use% Mounted on +udev 8.2G 0 8.2G 0% /dev +tmpfs 1.7G 2.1M 1.7G 1% /run +/dev/nvme0n1p2 1.1T 433G 523G 46% / +tmpfs 8.3G 145M 8.1G 2% /dev/shm +tmpfs 5.3M 4.1K 5.3M 1% /run/lock +tmpfs 8.3G 0 8.3G 0% /sys/fs/cgroup +/dev/nvme0n1p1 536M 8.2M 528M 2% /boot/efi diff --git a/tests/fixtures/numfmt/df_input.txt b/tests/fixtures/numfmt/df_input.txt new file mode 100644 index 000000000..4c094d54f --- /dev/null +++ b/tests/fixtures/numfmt/df_input.txt @@ -0,0 +1,8 @@ +Filesystem 1B-blocks Used Available Use% Mounted on +udev 8192688128 0 8192688128 0% /dev +tmpfs 1643331584 2015232 1641316352 1% /run +/dev/nvme0n1p2 1006530654208 432716689408 522613624832 46% / +tmpfs 8216649728 144437248 8072212480 2% /dev/shm +tmpfs 5242880 4096 5238784 1% /run/lock +tmpfs 8216649728 0 8216649728 0% /sys/fs/cgroup +/dev/nvme0n1p1 535805952 8175616 527630336 2% /boot/efi From 5446ea2abf4ea8e1d931fefca557ad345eb20f1e Mon Sep 17 00:00:00 2001 From: Benjamin Fox Date: Tue, 9 Mar 2021 12:59:26 +0200 Subject: [PATCH 376/606] cp: implement --strip-trailing-slashes --- src/uu/cp/src/cp.rs | 17 ++++++++++++----- tests/by-util/test_cp.rs | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index d18edbc10..ad400c7fd 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -207,6 +207,7 @@ pub struct Options { one_file_system: bool, overwrite: OverwriteMode, parents: bool, + strip_trailing_slashes: bool, reflink: bool, reflink_mode: ReflinkMode, preserve_attributes: Vec, @@ -333,6 +334,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg(Arg::with_name(OPT_RECURSIVE_ALIAS) .short("R") .help("same as -r")) + .arg(Arg::with_name(OPT_STRIP_TRAILING_SLASHES) + .long(OPT_STRIP_TRAILING_SLASHES) + .help("remove any trailing slashes from each SOURCE argument")) .arg(Arg::with_name(OPT_VERBOSE) .short("v") .long(OPT_VERBOSE) @@ -436,9 +440,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .value_name("WHEN") .help("NotImplemented: control creation of sparse files. See below")) - .arg(Arg::with_name(OPT_STRIP_TRAILING_SLASHES) - .long(OPT_STRIP_TRAILING_SLASHES) - .help("NotImplemented: remove any trailing slashes from each SOURCE argument")) .arg(Arg::with_name(OPT_ONE_FILE_SYSTEM) .short("x") .long(OPT_ONE_FILE_SYSTEM) @@ -561,7 +562,6 @@ impl Options { OPT_COPY_CONTENTS, OPT_PARENTS, OPT_SPARSE, - OPT_STRIP_TRAILING_SLASHES, OPT_ONE_FILE_SYSTEM, OPT_CONTEXT, #[cfg(windows)] @@ -629,6 +629,7 @@ impl Options { backup_suffix: matches.value_of(OPT_SUFFIX).unwrap().to_string(), update: matches.is_present(OPT_UPDATE), verbose: matches.is_present(OPT_VERBOSE), + strip_trailing_slashes: matches.is_present(OPT_STRIP_TRAILING_SLASHES), reflink: matches.is_present(OPT_REFLINK), reflink_mode: { if let Some(reflink) = matches.value_of(OPT_REFLINK) { @@ -686,7 +687,7 @@ fn parse_path_args(path_args: &[String], options: &Options) -> CopyResult<(Vec { // All path args are sources, and the target dir was // specified separately @@ -700,6 +701,12 @@ fn parse_path_args(path_args: &[String], options: &Options) -> CopyResult<(Vec Date: Tue, 9 Mar 2021 15:19:35 +0000 Subject: [PATCH 377/606] Correct spelling --- src/uu/cp/src/cp.rs | 2 +- src/uu/csplit/src/csplit.rs | 4 ++-- src/uu/split/src/platform/unix.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index d18edbc10..19763c65c 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -938,7 +938,7 @@ fn copy_directory(root: &Path, target: &Target, options: &Options) -> CopyResult Some(parent) => { #[cfg(windows)] { - // On Windows, some pathes are starting with \\? + // On Windows, some paths are starting with \\? // but not always, so, make sure that we are consistent for strip_prefix // See https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file for more info let parent_can = adjust_canonicalization(parent); diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index 41149a343..0d2fc8121 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -344,7 +344,7 @@ impl<'a> SplitWriter<'a> { /// /// In addition to errors reading/writing from/to a file, the following errors may be returned: /// - if no line matched, an [`::CsplitError::MatchNotFound`]. - /// - if there are not enough lines to accomodate the offset, an + /// - if there are not enough lines to accommodate the offset, an /// [`::CsplitError::LineOutOfRange`]. fn do_to_match( &mut self, @@ -471,7 +471,7 @@ where } } - /// Rewind the iteration by outputing the buffer's content. + /// Rewind the iteration by outputting the buffer's content. fn rewind_buffer(&mut self) { self.rewind = true; } diff --git a/src/uu/split/src/platform/unix.rs b/src/uu/split/src/platform/unix.rs index 331b31115..f26628174 100644 --- a/src/uu/split/src/platform/unix.rs +++ b/src/uu/split/src/platform/unix.rs @@ -4,7 +4,7 @@ use std::io::{BufWriter, Result}; use std::process::{Child, Command, Stdio}; /// A writer that writes to a shell_process' stdin /// -/// We use a shell process (not directy calling a sub-process) so we can forward the name of the +/// We use a shell process (not directly calling a sub-process) so we can forward the name of the /// corresponding output file (xaa, xab, xac… ). This is the way it was implemented in GNU split. struct FilterWriter { /// Running shell process From a6cf251a1775ffb3afe627038170d13288a69d57 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 9 Mar 2021 18:02:51 +0100 Subject: [PATCH 378/606] Add an information about the GNU's version license --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 694141702..d980b9d73 100644 --- a/README.md +++ b/README.md @@ -380,4 +380,6 @@ License uutils is licensed under the MIT License - see the `LICENSE` file for details +GNU Coreutils is licensed under the GPL V3. + [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fuutils%2Fcoreutils.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fuutils%2Fcoreutils?ref=badge_large) From 5996bc340c1164658e5cc1e5dfa63835b46d86aa Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 9 Mar 2021 18:43:59 +0100 Subject: [PATCH 379/606] Be more precise in the GNU license --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d980b9d73..3b473bbae 100644 --- a/README.md +++ b/README.md @@ -380,6 +380,6 @@ License uutils is licensed under the MIT License - see the `LICENSE` file for details -GNU Coreutils is licensed under the GPL V3. +GNU Coreutils is licensed under the GPL 3.0 or later. [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fuutils%2Fcoreutils.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fuutils%2Fcoreutils?ref=badge_large) From 54eebebff82655295d7ac7231f4ca694e94fa509 Mon Sep 17 00:00:00 2001 From: Ali Shariat Date: Tue, 9 Mar 2021 12:46:27 -0800 Subject: [PATCH 380/606] paste: move from getopts to clap closes #1734 --- src/uu/paste/Cargo.toml | 2 +- src/uu/paste/src/paste.rs | 86 +++++++++++++++++++-------------------- 2 files changed, 43 insertions(+), 45 deletions(-) diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index f25654738..3787ed270 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/paste.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33.3" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/paste/src/paste.rs b/src/uu/paste/src/paste.rs index cff96d18e..882ba7137 100644 --- a/src/uu/paste/src/paste.rs +++ b/src/uu/paste/src/paste.rs @@ -10,59 +10,57 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::iter::repeat; use std::path::Path; -static NAME: &str = "paste"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Write lines consisting of the sequentially corresponding lines from each +FILE, separated by TABs, to standard output."; + +mod options { + pub const DELIMITER: &str = "delimiters"; + pub const SERIAL: &str = "serial"; + pub const FILE: &str = "file"; +} pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .arg( + Arg::with_name(options::SERIAL) + .long(options::SERIAL) + .short("s") + .help("paste one file at a time instead of in parallel"), + ) + .arg( + Arg::with_name(options::DELIMITER) + .long(options::DELIMITER) + .short("d") + .help("reuse characters from LIST instead of TABs") + .value_name("LIST") + .default_value("\t") + .hide_default_value(true), + ) + .arg( + Arg::with_name(options::FILE) + .value_name("FILE") + .multiple(true) + .required(true), + ) + .get_matches_from(args); - let mut opts = getopts::Options::new(); - - opts.optflag( - "s", - "serial", - "paste one file at a time instead of in parallel", - ); - opts.optopt( - "d", - "delimiters", - "reuse characters from LIST instead of TABs", - "LIST", - ); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(e) => crash!(1, "{}", e), - }; - - if matches.opt_present("help") { - let msg = format!( - "{0} {1} - -Usage: - {0} [OPTION]... [FILE]... - -Write lines consisting of the sequentially corresponding lines from each -FILE, separated by TABs, to standard output.", - NAME, VERSION - ); - print!("{}", opts.usage(&msg)); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else { - let serial = matches.opt_present("serial"); - let delimiters = matches - .opt_str("delimiters") - .unwrap_or_else(|| "\t".to_owned()); - paste(matches.free, serial, delimiters); - } + let serial = matches.is_present(options::SERIAL); + let delimiters = matches.value_of(options::DELIMITER).unwrap().to_owned(); + let files = matches + .values_of(options::FILE) + .unwrap() + .map(|s| s.to_owned()) + .collect(); + paste(files, serial, delimiters); 0 } From fe56f315e4c824660d4aa6806bc466fedae6d059 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Tue, 9 Mar 2021 20:51:25 +0000 Subject: [PATCH 381/606] Fix install instructions error: Using `cargo install` to install the binaries for the package in current working directory is no longer supported, use `cargo install --path .` instead. Use `cargo build` if you want to simply build the package. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3b473bbae..7dae0b5ef 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ Installation Instructions Likewise, installing can simply be done using: ```bash -$ cargo install +$ cargo install --path . ``` This command will install uutils into Cargo's *bin* folder (*e.g.* `$HOME/.cargo/bin`). From d1addc97ccef2c28aa0a6bac5bb33115cec2f233 Mon Sep 17 00:00:00 2001 From: Felipe Lema <1232306+FelipeLema@users.noreply.github.com> Date: Tue, 9 Mar 2021 18:10:04 -0300 Subject: [PATCH 382/606] missing OPT_ s --- src/uu/stat/src/stat.rs | 48 ++++++++------- src/uu/sync/src/sync.rs | 22 ++++--- src/uu/tail/src/tail.rs | 75 +++++++++++----------- src/uu/touch/src/touch.rs | 106 ++++++++++++++++++-------------- src/uu/truncate/src/truncate.rs | 32 +++++----- src/uu/uname/src/uname.rs | 78 ++++++++++++----------- src/uu/uptime/src/uptime.rs | 10 +-- 7 files changed, 199 insertions(+), 172 deletions(-) diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 322f224b3..5216fb293 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -87,11 +87,13 @@ macro_rules! print_adjusted { static ABOUT: &str = "Display file or file system status."; static VERSION: &str = env!("CARGO_PKG_VERSION"); -static OPT_DEREFERENCE: &str = "dereference"; -static OPT_FILE_SYSTEM: &str = "file-system"; -static OPT_FORMAT: &str = "format"; -static OPT_PRINTF: &str = "printf"; -static OPT_TERSE: &str = "terse"; +pub mod options { + pub static DEREFERENCE: &str = "dereference"; + pub static FILE_SYSTEM: &str = "file-system"; + pub static FORMAT: &str = "format"; + pub static PRINTF: &str = "printf"; + pub static TERSE: &str = "terse"; +} static ARG_FILES: &str = "files"; @@ -464,15 +466,17 @@ impl Stater { .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); - let fmtstr = if matches.is_present(OPT_PRINTF) { - matches.value_of(OPT_PRINTF).expect("Invalid format string") + let fmtstr = if matches.is_present(options::PRINTF) { + matches + .value_of(options::PRINTF) + .expect("Invalid format string") } else { - matches.value_of(OPT_FORMAT).unwrap_or("") + matches.value_of(options::FORMAT).unwrap_or("") }; - let use_printf = matches.is_present(OPT_PRINTF); - let terse = matches.is_present(OPT_TERSE); - let showfs = matches.is_present(OPT_FILE_SYSTEM); + let use_printf = matches.is_present(options::PRINTF); + let terse = matches.is_present(options::TERSE); + let showfs = matches.is_present(options::FILE_SYSTEM); let default_tokens = if fmtstr.is_empty() { Stater::generate_tokens(&Stater::default_fmt(showfs, terse, false), use_printf).unwrap() @@ -501,7 +505,7 @@ impl Stater { }; Ok(Stater { - follow: matches.is_present(OPT_DEREFERENCE), + follow: matches.is_present(options::DEREFERENCE), showfs, from_user: !fmtstr.is_empty(), files, @@ -955,27 +959,27 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .usage(&usage[..]) .after_help(&long_usage[..]) .arg( - Arg::with_name(OPT_DEREFERENCE) + Arg::with_name(options::DEREFERENCE) .short("L") - .long(OPT_DEREFERENCE) + .long(options::DEREFERENCE) .help("follow links"), ) .arg( - Arg::with_name(OPT_FILE_SYSTEM) + Arg::with_name(options::FILE_SYSTEM) .short("f") - .long(OPT_FILE_SYSTEM) + .long(options::FILE_SYSTEM) .help("display file system status instead of file status"), ) .arg( - Arg::with_name(OPT_TERSE) + Arg::with_name(options::TERSE) .short("t") - .long(OPT_TERSE) + .long(options::TERSE) .help("print the information in terse form"), ) .arg( - Arg::with_name(OPT_FORMAT) + Arg::with_name(options::FORMAT) .short("c") - .long(OPT_FORMAT) + .long(options::FORMAT) .help( "use the specified FORMAT instead of the default; output a newline after each use of FORMAT", @@ -983,8 +987,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .value_name("FORMAT"), ) .arg( - Arg::with_name(OPT_PRINTF) - .long(OPT_PRINTF) + Arg::with_name(options::PRINTF) + .long(options::PRINTF) .value_name("FORMAT") .help( "like --format, but interpret backslash escapes, diff --git a/src/uu/sync/src/sync.rs b/src/uu/sync/src/sync.rs index 5d4cb4395..985e7580d 100644 --- a/src/uu/sync/src/sync.rs +++ b/src/uu/sync/src/sync.rs @@ -19,8 +19,10 @@ static EXIT_ERR: i32 = 1; static ABOUT: &str = "Synchronize cached writes to persistent storage"; static VERSION: &str = env!("CARGO_PKG_VERSION"); -static OPT_FILE_SYSTEM: &str = "file-system"; -static OPT_DATA: &str = "data"; +pub mod options { + pub static FILE_SYSTEM: &str = "file-system"; + pub static DATA: &str = "data"; +} static ARG_FILES: &str = "files"; @@ -170,17 +172,17 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .arg( - Arg::with_name(OPT_FILE_SYSTEM) + Arg::with_name(options::FILE_SYSTEM) .short("f") - .long(OPT_FILE_SYSTEM) - .conflicts_with(OPT_DATA) + .long(options::FILE_SYSTEM) + .conflicts_with(options::DATA) .help("sync the file systems that contain the files (Linux and Windows only)"), ) .arg( - Arg::with_name(OPT_DATA) + Arg::with_name(options::DATA) .short("d") - .long(OPT_DATA) - .conflicts_with(OPT_FILE_SYSTEM) + .long(options::DATA) + .conflicts_with(options::FILE_SYSTEM) .help("sync only file data, no unneeded metadata (Linux only)"), ) .arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true)) @@ -197,10 +199,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } - if matches.is_present(OPT_FILE_SYSTEM) { + if matches.is_present(options::FILE_SYSTEM) { #[cfg(any(target_os = "linux", target_os = "windows"))] syncfs(files); - } else if matches.is_present(OPT_DATA) { + } else if matches.is_present(options::DATA) { #[cfg(target_os = "linux")] fdatasync(files); } else { diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 2276885e0..c62d86c26 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -27,15 +27,19 @@ use std::path::Path; use std::thread::sleep; use std::time::Duration; -static OPT_BYTES: &str = "bytes"; -static OPT_FOLLOW: &str = "follow"; -static OPT_LINES: &str = "lines"; -static OPT_PID: &str = "pid"; -static OPT_QUIET: &str = "quiet"; -static OPT_SILENT: &str = "silent"; -static OPT_SLEEP_INT: &str = "sleep-interval"; -static OPT_VERBOSE: &str = "verbose"; -static OPT_ZERO_TERM: &str = "zero-terminated"; +pub mod options { + pub mod verbosity { + pub static QUIET: &str = "quiet"; + pub static SILENT: &str = "silent"; + pub static VERBOSE: &str = "verbose"; + } + pub static BYTES: &str = "bytes"; + pub static FOLLOW: &str = "follow"; + pub static LINES: &str = "lines"; + pub static PID: &str = "pid"; + pub static SLEEP_INT: &str = "sleep-interval"; + pub static ZERO_TERM: &str = "zero-terminated"; +} static ARG_FILES: &str = "files"; @@ -72,58 +76,58 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .version(crate_version!()) .about("output the last part of files") .arg( - Arg::with_name(OPT_BYTES) + Arg::with_name(options::BYTES) .short("c") - .long(OPT_BYTES) + .long(options::BYTES) .takes_value(true) .help("Number of bytes to print"), ) .arg( - Arg::with_name(OPT_FOLLOW) + Arg::with_name(options::FOLLOW) .short("f") - .long(OPT_FOLLOW) + .long(options::FOLLOW) .help("Print the file as it grows"), ) .arg( - Arg::with_name(OPT_LINES) + Arg::with_name(options::LINES) .short("n") - .long(OPT_LINES) + .long(options::LINES) .takes_value(true) .help("Number of lines to print"), ) .arg( - Arg::with_name(OPT_PID) - .long(OPT_PID) + Arg::with_name(options::PID) + .long(options::PID) .takes_value(true) .help("with -f, terminate after process ID, PID dies"), ) .arg( - Arg::with_name(OPT_QUIET) + Arg::with_name(options::verbosity::QUIET) .short("q") - .long(OPT_QUIET) + .long(options::verbosity::QUIET) .help("never output headers giving file names"), ) .arg( - Arg::with_name(OPT_SILENT) - .long(OPT_SILENT) + Arg::with_name(options::verbosity::SILENT) + .long(options::verbosity::SILENT) .help("synonym of --quiet"), ) .arg( - Arg::with_name(OPT_SLEEP_INT) + Arg::with_name(options::SLEEP_INT) .short("s") - .long(OPT_SLEEP_INT) + .long(options::SLEEP_INT) .help("Number or seconds to sleep between polling the file when running with -f"), ) .arg( - Arg::with_name(OPT_VERBOSE) + Arg::with_name(options::verbosity::VERBOSE) .short("v") - .long(OPT_VERBOSE) + .long(options::verbosity::VERBOSE) .help("always output headers giving file names"), ) .arg( - Arg::with_name(OPT_ZERO_TERM) + Arg::with_name(options::ZERO_TERM) .short("z") - .long(OPT_ZERO_TERM) + .long(options::ZERO_TERM) .help("Line delimiter is NUL, not newline"), ) .arg( @@ -135,9 +139,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = app.get_matches_from(args); - settings.follow = matches.is_present(OPT_FOLLOW); + settings.follow = matches.is_present(options::FOLLOW); if settings.follow { - if let Some(n) = matches.value_of(OPT_SLEEP_INT) { + if let Some(n) = matches.value_of(options::SLEEP_INT) { let parsed: Option = n.parse().ok(); if let Some(m) = parsed { settings.sleep_msec = m * 1000 @@ -145,7 +149,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } - if let Some(pid_str) = matches.value_of(OPT_PID) { + if let Some(pid_str) = matches.value_of(options::PID) { if let Ok(pid) = pid_str.parse() { settings.pid = pid; if pid != 0 { @@ -161,7 +165,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } - match matches.value_of(OPT_LINES) { + match matches.value_of(options::LINES) { Some(n) => { let mut slice: &str = n; if slice.chars().next().unwrap_or('_') == '+' { @@ -177,7 +181,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } None => { - if let Some(n) = matches.value_of(OPT_BYTES) { + if let Some(n) = matches.value_of(options::BYTES) { let mut slice: &str = n; if slice.chars().next().unwrap_or('_') == '+' { settings.beginning = true; @@ -194,14 +198,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } }; - if matches.is_present(OPT_ZERO_TERM) { + if matches.is_present(options::ZERO_TERM) { if let FilterMode::Lines(count, _) = settings.mode { settings.mode = FilterMode::Lines(count, 0); } } - let verbose = matches.is_present(OPT_VERBOSE); - let quiet = matches.is_present(OPT_QUIET) || matches.is_present(OPT_SILENT); + let verbose = matches.is_present(options::verbosity::VERBOSE); + let quiet = matches.is_present(options::verbosity::QUIET) + || matches.is_present(options::verbosity::SILENT); let files: Vec = matches .values_of(ARG_FILES) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 913a5be9b..1cd3b2a70 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -21,14 +21,18 @@ use std::path::Path; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Update the access and modification times of each FILE to the current time."; -static OPT_ACCESS: &str = "access"; -static OPT_CURRENT: &str = "current"; -static OPT_DATE: &str = "date"; -static OPT_MODIFICATION: &str = "modification"; -static OPT_NO_CREATE: &str = "no-create"; -static OPT_NO_DEREF: &str = "no-dereference"; -static OPT_REFERENCE: &str = "reference"; -static OPT_TIME: &str = "time"; +pub mod options { + pub mod sources { + pub static DATE: &str = "date"; + pub static REFERENCE: &str = "reference"; + pub static CURRENT: &str = "current"; + } + pub static ACCESS: &str = "access"; + pub static MODIFICATION: &str = "modification"; + pub static NO_CREATE: &str = "no-create"; + pub static NO_DEREF: &str = "no-dereference"; + pub static TIME: &str = "time"; +} static ARG_FILES: &str = "files"; @@ -62,54 +66,54 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .arg( - Arg::with_name(OPT_ACCESS) + Arg::with_name(options::ACCESS) .short("a") .help("change only the access time"), ) .arg( - Arg::with_name(OPT_CURRENT) + Arg::with_name(options::sources::CURRENT) .short("t") .help("use [[CC]YY]MMDDhhmm[.ss] instead of the current time") .value_name("STAMP") .takes_value(true), ) .arg( - Arg::with_name(OPT_DATE) + Arg::with_name(options::sources::DATE) .short("d") - .long(OPT_DATE) + .long(options::sources::DATE) .help("parse argument and use it instead of current time") .value_name("STRING"), ) .arg( - Arg::with_name(OPT_MODIFICATION) + Arg::with_name(options::MODIFICATION) .short("m") .help("change only the modification time"), ) .arg( - Arg::with_name(OPT_NO_CREATE) + Arg::with_name(options::NO_CREATE) .short("c") - .long(OPT_NO_CREATE) + .long(options::NO_CREATE) .help("do not create any files"), ) .arg( - Arg::with_name(OPT_NO_DEREF) + Arg::with_name(options::NO_DEREF) .short("h") - .long(OPT_NO_DEREF) + .long(options::NO_DEREF) .help( "affect each symbolic link instead of any referenced file \ (only for systems that can change the timestamps of a symlink)", ), ) .arg( - Arg::with_name(OPT_REFERENCE) + Arg::with_name(options::sources::REFERENCE) .short("r") - .long(OPT_REFERENCE) + .long(options::sources::REFERENCE) .help("use this file's times instead of the current time") .value_name("FILE"), ) .arg( - Arg::with_name(OPT_TIME) - .long(OPT_TIME) + Arg::with_name(options::TIME) + .long(options::TIME) .help( "change only the specified time: \"access\", \"atime\", or \ \"use\" are equivalent to -a; \"modify\" or \"mtime\" are \ @@ -132,26 +136,36 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); - if matches.is_present(OPT_DATE) - && (matches.is_present(OPT_REFERENCE) || matches.is_present(OPT_CURRENT)) - || matches.is_present(OPT_REFERENCE) - && (matches.is_present(OPT_DATE) || matches.is_present(OPT_CURRENT)) - || matches.is_present(OPT_CURRENT) - && (matches.is_present(OPT_DATE) || matches.is_present(OPT_REFERENCE)) + if matches.is_present(options::sources::DATE) + && (matches.is_present(options::sources::REFERENCE) + || matches.is_present(options::sources::CURRENT)) + || matches.is_present(options::sources::REFERENCE) + && (matches.is_present(options::sources::DATE) + || matches.is_present(options::sources::CURRENT)) + || matches.is_present(options::sources::CURRENT) + && (matches.is_present(options::sources::DATE) + || matches.is_present(options::sources::REFERENCE)) { panic!("Invalid options: cannot specify reference time from more than one source"); } - let (mut atime, mut mtime) = if matches.is_present(OPT_REFERENCE) { + let (mut atime, mut mtime) = if matches.is_present(options::sources::REFERENCE) { stat( - &matches.value_of(OPT_REFERENCE).unwrap()[..], - !matches.is_present(OPT_NO_DEREF), + &matches.value_of(options::sources::REFERENCE).unwrap()[..], + !matches.is_present(options::NO_DEREF), ) - } else if matches.is_present(OPT_DATE) || matches.is_present(OPT_CURRENT) { - let timestamp = if matches.is_present(OPT_DATE) { - parse_date(matches.value_of(OPT_DATE).unwrap().as_ref()) + } else if matches.is_present(options::sources::DATE) + || matches.is_present(options::sources::CURRENT) + { + let timestamp = if matches.is_present(options::sources::DATE) { + parse_date(matches.value_of(options::sources::DATE).unwrap().as_ref()) } else { - parse_timestamp(matches.value_of(OPT_CURRENT).unwrap().as_ref()) + parse_timestamp( + matches + .value_of(options::sources::CURRENT) + .unwrap() + .as_ref(), + ) }; (timestamp, timestamp) } else { @@ -164,7 +178,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if !Path::new(path).exists() { // no-dereference included here for compatibility - if matches.is_present(OPT_NO_CREATE) || matches.is_present(OPT_NO_DEREF) { + if matches.is_present(options::NO_CREATE) || matches.is_present(options::NO_DEREF) { continue; } @@ -174,9 +188,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; // Minor optimization: if no reference time was specified, we're done. - if !(matches.is_present(OPT_DATE) - || matches.is_present(OPT_REFERENCE) - || matches.is_present(OPT_CURRENT)) + if !(matches.is_present(options::sources::DATE) + || matches.is_present(options::sources::REFERENCE) + || matches.is_present(options::sources::CURRENT)) { continue; } @@ -184,14 +198,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // If changing "only" atime or mtime, grab the existing value of the other. // Note that "-a" and "-m" may be passed together; this is not an xor. - if matches.is_present(OPT_ACCESS) - || matches.is_present(OPT_MODIFICATION) - || matches.is_present(OPT_TIME) + if matches.is_present(options::ACCESS) + || matches.is_present(options::MODIFICATION) + || matches.is_present(options::TIME) { - let st = stat(path, !matches.is_present(OPT_NO_DEREF)); - let time = matches.value_of(OPT_TIME).unwrap_or(""); + let st = stat(path, !matches.is_present(options::NO_DEREF)); + let time = matches.value_of(options::TIME).unwrap_or(""); - if !(matches.is_present(OPT_ACCESS) + if !(matches.is_present(options::ACCESS) || time.contains(&"access".to_owned()) || time.contains(&"atime".to_owned()) || time.contains(&"use".to_owned())) @@ -199,7 +213,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { atime = st.0; } - if !(matches.is_present(OPT_MODIFICATION) + if !(matches.is_present(options::MODIFICATION) || time.contains(&"modify".to_owned()) || time.contains(&"mtime".to_owned())) { @@ -207,7 +221,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } - if matches.is_present(OPT_NO_DEREF) { + if matches.is_present(options::NO_DEREF) { if let Err(e) = set_symlink_file_times(path, atime, mtime) { show_warning!("cannot touch '{}': {}", path, e); } diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index da44235c8..a5acd482a 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -29,10 +29,12 @@ enum TruncateMode { static ABOUT: &str = "Shrink or extend the size of each file to the specified size."; static VERSION: &str = env!("CARGO_PKG_VERSION"); -static OPT_IO_BLOCKS: &str = "io-blocks"; -static OPT_NO_CREATE: &str = "no-create"; -static OPT_REFERENCE: &str = "reference"; -static OPT_SIZE: &str = "size"; +pub mod options { + pub static IO_BLOCKS: &str = "io-blocks"; + pub static NO_CREATE: &str = "no-create"; + pub static REFERENCE: &str = "reference"; + pub static SIZE: &str = "size"; +} static ARG_FILES: &str = "files"; @@ -72,26 +74,26 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .usage(&usage[..]) .after_help(&long_usage[..]) .arg( - Arg::with_name(OPT_IO_BLOCKS) + Arg::with_name(options::IO_BLOCKS) .short("o") - .long(OPT_IO_BLOCKS) + .long(options::IO_BLOCKS) .help("treat SIZE as the number of I/O blocks of the file rather than bytes (NOT IMPLEMENTED)") ) .arg( - Arg::with_name(OPT_NO_CREATE) + Arg::with_name(options::NO_CREATE) .short("c") - .long(OPT_NO_CREATE) + .long(options::NO_CREATE) .help("do not create files that do not exist") ) .arg( - Arg::with_name(OPT_REFERENCE) + Arg::with_name(options::REFERENCE) .short("r") - .long(OPT_REFERENCE) + .long(options::REFERENCE) .help("base the size of each file on the size of RFILE") .value_name("RFILE") ) .arg( - Arg::with_name(OPT_SIZE) + Arg::with_name(options::SIZE) .short("s") .long("size") .help("set or adjust the size of each file according to SIZE, which is in bytes unless --io-blocks is specified") @@ -109,10 +111,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { show_error!("Missing an argument"); return 1; } else { - let io_blocks = matches.is_present(OPT_IO_BLOCKS); - let no_create = matches.is_present(OPT_NO_CREATE); - let reference = matches.value_of(OPT_REFERENCE).map(String::from); - let size = matches.value_of(OPT_SIZE).map(String::from); + let io_blocks = matches.is_present(options::IO_BLOCKS); + let no_create = matches.is_present(options::NO_CREATE); + let reference = matches.value_of(options::REFERENCE).map(String::from); + let size = matches.value_of(options::SIZE).map(String::from); if reference.is_none() && size.is_none() { crash!(1, "you must specify either --reference or --size"); } else { diff --git a/src/uu/uname/src/uname.rs b/src/uu/uname/src/uname.rs index b9b75e2a4..6575aa9fd 100644 --- a/src/uu/uname/src/uname.rs +++ b/src/uu/uname/src/uname.rs @@ -19,19 +19,17 @@ use platform_info::*; const VERSION: &str = env!("CARGO_PKG_VERSION"); const ABOUT: &str = "Print certain system information. With no OPTION, same as -s."; -const OPT_ALL: &str = "all"; -const OPT_KERNELNAME: &str = "kernel-name"; -const OPT_NODENAME: &str = "nodename"; -const OPT_KERNELVERSION: &str = "kernel-version"; -const OPT_KERNELRELEASE: &str = "kernel-release"; -const OPT_MACHINE: &str = "machine"; -const OPT_PROCESSOR: &str = "processor"; -const OPT_HWPLATFORM: &str = "hardware-platform"; - -//FIXME: unimplemented options -//const OPT_PROCESSOR: &'static str = "processor"; -//const OPT_HWPLATFORM: &'static str = "hardware-platform"; -const OPT_OS: &str = "operating-system"; +pub mod options { + pub static ALL: &str = "all"; + pub static KERNELNAME: &str = "kernel-name"; + pub static NODENAME: &str = "nodename"; + pub static KERNELVERSION: &str = "kernel-version"; + pub static KERNELRELEASE: &str = "kernel-release"; + pub static MACHINE: &str = "machine"; + pub static PROCESSOR: &str = "processor"; + pub static HWPLATFORM: &str = "hardware-platform"; + pub static OS: &str = "operating-system"; +} #[cfg(target_os = "linux")] const HOST_OS: &str = "GNU/Linux"; @@ -54,58 +52,58 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .version(VERSION) .about(ABOUT) .usage(&usage[..]) - .arg(Arg::with_name(OPT_ALL) + .arg(Arg::with_name(options::ALL) .short("a") - .long(OPT_ALL) + .long(options::ALL) .help("Behave as though all of the options -mnrsv were specified.")) - .arg(Arg::with_name(OPT_KERNELNAME) + .arg(Arg::with_name(options::KERNELNAME) .short("s") - .long(OPT_KERNELNAME) + .long(options::KERNELNAME) .alias("sysname") // Obsolescent option in GNU uname .help("print the kernel name.")) - .arg(Arg::with_name(OPT_NODENAME) + .arg(Arg::with_name(options::NODENAME) .short("n") - .long(OPT_NODENAME) + .long(options::NODENAME) .help("print the nodename (the nodename may be a name that the system is known by to a communications network).")) - .arg(Arg::with_name(OPT_KERNELRELEASE) + .arg(Arg::with_name(options::KERNELRELEASE) .short("r") - .long(OPT_KERNELRELEASE) + .long(options::KERNELRELEASE) .alias("release") // Obsolescent option in GNU uname .help("print the operating system release.")) - .arg(Arg::with_name(OPT_KERNELVERSION) + .arg(Arg::with_name(options::KERNELVERSION) .short("v") - .long(OPT_KERNELVERSION) + .long(options::KERNELVERSION) .help("print the operating system version.")) - .arg(Arg::with_name(OPT_HWPLATFORM) + .arg(Arg::with_name(options::HWPLATFORM) .short("i") - .long(OPT_HWPLATFORM) + .long(options::HWPLATFORM) .help("print the hardware platform (non-portable)")) - .arg(Arg::with_name(OPT_MACHINE) + .arg(Arg::with_name(options::MACHINE) .short("m") - .long(OPT_MACHINE) + .long(options::MACHINE) .help("print the machine hardware name.")) - .arg(Arg::with_name(OPT_PROCESSOR) + .arg(Arg::with_name(options::PROCESSOR) .short("p") - .long(OPT_PROCESSOR) + .long(options::PROCESSOR) .help("print the processor type (non-portable)")) - .arg(Arg::with_name(OPT_OS) + .arg(Arg::with_name(options::OS) .short("o") - .long(OPT_OS) + .long(options::OS) .help("print the operating system name.")) .get_matches_from(args); let uname = return_if_err!(1, PlatformInfo::new()); let mut output = String::new(); - let all = matches.is_present(OPT_ALL); - let kernelname = matches.is_present(OPT_KERNELNAME); - let nodename = matches.is_present(OPT_NODENAME); - let kernelrelease = matches.is_present(OPT_KERNELRELEASE); - let kernelversion = matches.is_present(OPT_KERNELVERSION); - let machine = matches.is_present(OPT_MACHINE); - let processor = matches.is_present(OPT_PROCESSOR); - let hwplatform = matches.is_present(OPT_HWPLATFORM); - let os = matches.is_present(OPT_OS); + let all = matches.is_present(options::ALL); + let kernelname = matches.is_present(options::KERNELNAME); + let nodename = matches.is_present(options::NODENAME); + let kernelrelease = matches.is_present(options::KERNELRELEASE); + let kernelversion = matches.is_present(options::KERNELVERSION); + let machine = matches.is_present(options::MACHINE); + let processor = matches.is_present(options::PROCESSOR); + let hwplatform = matches.is_present(options::HWPLATFORM); + let os = matches.is_present(options::OS); let none = !(all || kernelname diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index 4ea90e242..670d7845b 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -21,7 +21,9 @@ static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Display the current time, the length of time the system has been up,\n\ the number of users on the system, and the average number of jobs\n\ in the run queue over the last 1, 5 and 15 minutes."; -static OPT_SINCE: &str = "since"; +pub mod options { + pub static SINCE: &str = "since"; +} #[cfg(unix)] use uucore::libc::getloadavg; @@ -42,9 +44,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .arg( - Arg::with_name(OPT_SINCE) + Arg::with_name(options::SINCE) .short("s") - .long(OPT_SINCE) + .long(options::SINCE) .help("system up since"), ) .get_matches_from(args); @@ -56,7 +58,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 1 } else { - if matches.is_present(OPT_SINCE) { + if matches.is_present(options::SINCE) { let initial_date = Local.timestamp(Utc::now().timestamp() - uptime, 0); println!("{}", initial_date.format("%Y-%m-%d %H:%M:%S")); return 0; From 62388faab8cb59fa580198bd8dc2e8a8d7cff44b Mon Sep 17 00:00:00 2001 From: Ali Shariat Date: Wed, 10 Mar 2021 02:04:37 -0800 Subject: [PATCH 383/606] paste: update cargo lock file missed from #1785 --- Cargo.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bd3d09739..fe9e11c35 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -342,7 +342,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -357,7 +357,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -397,7 +397,7 @@ dependencies = [ "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -465,7 +465,7 @@ dependencies = [ [[package]] name = "csv" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1135,7 +1135,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1191,7 +1191,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "1.0.62" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1276,7 +1276,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1889,7 +1889,7 @@ dependencies = [ name = "uu_paste" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", ] @@ -2341,7 +2341,7 @@ version = "0.0.5" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2388,7 +2388,7 @@ dependencies = [ "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2408,7 +2408,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2520,7 +2520,7 @@ dependencies = [ "checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" "checksum crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" "checksum crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" -"checksum csv 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f9d58633299b24b515ac72a3f869f8b91306a3cec616a602843a383acd6f9e97" +"checksum csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" "checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" "checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" "checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" @@ -2618,7 +2618,7 @@ dependencies = [ "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" "checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.62 (registry+https://github.com/rust-lang/crates.io-index)" = "123a78a3596b24fee53a6464ce52d8ecbf62241e6294c7e7fe12086cd161f512" +"checksum syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)" = "8fd9bc7ccc2688b3344c2f48b9b546648b25ce0b20fc717ee7fa7981a8ca9717" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" "checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" From 08eb56f12020179b1b4ee6c5b0af88969bf0912c Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Tue, 9 Mar 2021 16:23:48 -0500 Subject: [PATCH 384/606] Fix some clippy warnings --- src/uu/cp/src/cp.rs | 14 +++++------ src/uu/csplit/src/csplit.rs | 4 ++-- src/uu/ln/src/ln.rs | 13 ++++------ src/uu/mktemp/src/mktemp.rs | 24 ++++++++----------- src/uu/nl/src/helper.rs | 4 +++- src/uu/nl/src/nl.rs | 2 +- src/uu/od/src/multifilereader.rs | 2 +- src/uu/od/src/od.rs | 6 ++--- .../formatters/cninetyninehexfloatf.rs | 11 +++++---- .../tokenize/num_format/formatters/intf.rs | 7 +++--- src/uu/realpath/src/realpath.rs | 2 +- src/uu/shuf/src/shuf.rs | 4 ++-- src/uu/split/src/platform/unix.rs | 13 +++++----- src/uu/split/src/split.rs | 2 +- src/uu/tail/src/tail.rs | 6 ++++- src/uu/truncate/src/truncate.rs | 9 ++----- 16 files changed, 60 insertions(+), 63 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 5ae06c298..a43f3337c 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1238,15 +1238,13 @@ fn copy_helper(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> dest.into() }; symlink_file(&link, &dest, &*context_for(&link, &dest))?; + } else if source.to_string_lossy() == "/dev/null" { + /* workaround a limitation of fs::copy + * https://github.com/rust-lang/rust/issues/79390 + */ + File::create(dest)?; } else { - if source.to_string_lossy() == "/dev/null" { - /* workaround a limitation of fs::copy - * https://github.com/rust-lang/rust/issues/79390 - */ - File::create(dest)?; - } else { - fs::copy(source, dest).context(&*context_for(source, dest))?; - } + fs::copy(source, dest).context(&*context_for(source, dest))?; } Ok(()) diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index 0d2fc8121..7eb287522 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -478,7 +478,7 @@ where /// Shrink the buffer so that its length is equal to the set size, returning an iterator for /// the elements that were too much. - fn shrink_buffer_to_size<'a>(&'a mut self) -> impl Iterator + 'a { + fn shrink_buffer_to_size(&mut self) -> impl Iterator + '_ { let mut shrink_offset = 0; if self.buffer.len() > self.size { shrink_offset = self.buffer.len() - self.size; @@ -489,7 +489,7 @@ where } /// Drain the content of the buffer. - fn drain_buffer<'a>(&'a mut self) -> impl Iterator + 'a { + fn drain_buffer(&mut self) -> impl Iterator + '_ { self.buffer.drain(..).map(|(_, line)| line.unwrap()) } diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index e06468367..ab07a2b08 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -207,7 +207,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let paths: Vec = matches .values_of(ARG_FILES) .unwrap() - .map(|path| PathBuf::from(path)) + .map(PathBuf::from) .collect(); let overwrite_mode = if matches.is_present(OPT_FORCE) { @@ -316,9 +316,8 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &PathBuf, settings: &Setting // We need to clean the target if is_symlink(target_dir) { if target_dir.is_file() { - match fs::remove_file(target_dir) { - Err(e) => show_error!("Could not update {}: {}", target_dir.display(), e), - _ => (), + if let Err(e) = fs::remove_file(target_dir) { + show_error!("Could not update {}: {}", target_dir.display(), e) }; } if target_dir.is_dir() { @@ -423,10 +422,8 @@ fn link(src: &PathBuf, dst: &PathBuf, settings: &Settings) -> Result<()> { } } - if settings.no_dereference && settings.force { - if dst.exists() { - fs::remove_file(dst)?; - } + if settings.no_dereference && settings.force && dst.exists() { + fs::remove_file(dst)?; } if settings.symbolic { diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index 663f7d4ad..194b6625f 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -120,13 +120,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // See https://github.com/clap-rs/clap/pull/1587 let tmp = env::temp_dir(); (tmpdir, tmp) + } else if !matches.is_present(OPT_TMPDIR) { + let tmp = env::temp_dir(); + (template, tmp) } else { - if !matches.is_present(OPT_TMPDIR) { - let tmp = env::temp_dir(); - (template, tmp) - } else { - (template, PathBuf::from(tmpdir)) - } + (template, PathBuf::from(tmpdir)) }; let make_dir = matches.is_present(OPT_DIRECTORY); @@ -158,14 +156,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { crash!(1, "suffix cannot contain any path separators"); } - if matches.is_present(OPT_TMPDIR) { - if PathBuf::from(prefix).is_absolute() { - show_info!( - "invalid template, ‘{}’; with --tmpdir, it may not be absolute", - template - ); - return 1; - } + if matches.is_present(OPT_TMPDIR) && PathBuf::from(prefix).is_absolute() { + show_info!( + "invalid template, ‘{}’; with --tmpdir, it may not be absolute", + template + ); + return 1; }; if matches.is_present(OPT_T) { diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index e34cfd2ae..9b98129f1 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -11,7 +11,9 @@ fn parse_style(chars: &[char]) -> Result { } else if chars.len() > 1 && chars[0] == 'p' { let s: String = chars[1..].iter().cloned().collect(); match regex::Regex::new(&s) { - Ok(re) => Ok(crate::NumberingStyle::NumberForRegularExpression(re)), + Ok(re) => Ok(crate::NumberingStyle::NumberForRegularExpression(Box::new( + re, + ))), Err(_) => Err(String::from("Illegal regular expression")), } } else { diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 105bb196b..47b6c3ae9 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -55,7 +55,7 @@ enum NumberingStyle { NumberForAll, NumberForNonEmpty, NumberForNone, - NumberForRegularExpression(regex::Regex), + NumberForRegularExpression(Box), } // NumberFormat specifies how line numbers are output within their allocated diff --git a/src/uu/od/src/multifilereader.rs b/src/uu/od/src/multifilereader.rs index e41c9e39b..1255da66d 100644 --- a/src/uu/od/src/multifilereader.rs +++ b/src/uu/od/src/multifilereader.rs @@ -24,7 +24,7 @@ pub trait HasError { } impl<'b> MultifileReader<'b> { - pub fn new<'a>(fnames: Vec>) -> MultifileReader<'a> { + pub fn new(fnames: Vec) -> MultifileReader { let mut mf = MultifileReader { ni: fnames, curr_file: None, // normally this means done; call next_file() diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index dbf784b76..47d3c29f8 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -472,11 +472,11 @@ fn print_bytes(prefix: &str, input_decoder: &MemoryDecoder, output_info: &Output /// /// `skip_bytes` is the number of bytes skipped from the input /// `read_bytes` is an optional limit to the number of bytes to read -fn open_input_peek_reader<'a>( - input_strings: &'a [String], +fn open_input_peek_reader( + input_strings: &[String], skip_bytes: usize, read_bytes: Option, -) -> PeekReader>> { +) -> PeekReader> { // should return "impl PeekRead + Read + HasError" when supported in (stable) rust let inputs = input_strings .iter() diff --git a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs index 33c3a7af5..bf21bf8f9 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs @@ -52,8 +52,7 @@ fn get_primitive_hex( last_dec_place: usize, capitalized: bool, ) -> FormatPrimitive { - let mut f: FormatPrimitive = Default::default(); - f.prefix = Some(String::from(if inprefix.sign == -1 { "-0x" } else { "0x" })); + let prefix = Some(String::from(if inprefix.sign == -1 { "-0x" } else { "0x" })); // assign the digits before and after the decimal points // to separate slices. If no digits after decimal point, @@ -97,7 +96,7 @@ fn get_primitive_hex( // conversion. The best way to do it is to just convert the floatnum // directly to base 2 and then at the end translate back to hex. let mantissa = 0; - f.suffix = Some({ + let suffix = Some({ let ind = if capitalized { "P" } else { "p" }; if mantissa >= 0 { format!("{}+{}", ind, mantissa) @@ -105,7 +104,11 @@ fn get_primitive_hex( format!("{}{}", ind, mantissa) } }); - f + FormatPrimitive { + prefix, + suffix, + ..Default::default() + } } fn to_hex(src: &str, before_decimal: bool) -> String { diff --git a/src/uu/printf/src/tokenize/num_format/formatters/intf.rs b/src/uu/printf/src/tokenize/num_format/formatters/intf.rs index 489420c41..9231bd027 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/intf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/intf.rs @@ -198,9 +198,10 @@ impl Formatter for Intf { // We always will have a format primitive to return Some(if convert_hints.len_digits == 0 || convert_hints.is_zero { // if non-digit or end is reached before a non-zero digit - let mut fmt_prim: FormatPrimitive = Default::default(); - fmt_prim.pre_decimal = Some(String::from("0")); - fmt_prim + FormatPrimitive { + pre_decimal: Some(String::from("0")), + ..Default::default() + } } else if !convert_hints.past_max { // if the number is or may be below the bounds limit let radix_out = match *field.field_char { diff --git a/src/uu/realpath/src/realpath.rs b/src/uu/realpath/src/realpath.rs index cdcb8e794..5cc8f3d9a 100644 --- a/src/uu/realpath/src/realpath.rs +++ b/src/uu/realpath/src/realpath.rs @@ -67,7 +67,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let paths: Vec = matches .values_of(ARG_FILES) .unwrap() - .map(|path| PathBuf::from(path)) + .map(PathBuf::from) .collect(); let strip = matches.is_present(OPT_STRIP); diff --git a/src/uu/shuf/src/shuf.rs b/src/uu/shuf/src/shuf.rs index 9f4bb01c4..278e872fb 100644 --- a/src/uu/shuf/src/shuf.rs +++ b/src/uu/shuf/src/shuf.rs @@ -97,9 +97,9 @@ With no FILE, or when FILE is -, read standard input.", }; let repeat = matches.opt_present("repeat"); let sep = if matches.opt_present("zero-terminated") { - 0x00 as u8 + 0x00_u8 } else { - 0x0a as u8 + 0x0a_u8 }; let count = match matches.opt_str("head-count") { Some(cnt) => match cnt.parse::() { diff --git a/src/uu/split/src/platform/unix.rs b/src/uu/split/src/platform/unix.rs index f26628174..20d9d637b 100644 --- a/src/uu/split/src/platform/unix.rs +++ b/src/uu/split/src/platform/unix.rs @@ -68,12 +68,13 @@ impl FilterWriter { // set $FILE, save previous value (if there was one) let _with_env_var_set = WithEnvVarSet::new("FILE", &filepath); - let shell_process = Command::new(env::var("SHELL").unwrap_or("/bin/sh".to_owned())) - .arg("-c") - .arg(command) - .stdin(Stdio::piped()) - .spawn() - .expect("Couldn't spawn filter command"); + let shell_process = + Command::new(env::var("SHELL").unwrap_or_else(|_| "/bin/sh".to_owned())) + .arg("-c") + .arg(command) + .stdin(Stdio::piped()) + .spawn() + .expect("Couldn't spawn filter command"); FilterWriter { shell_process } } diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 851edc4b5..4f80e25a3 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -150,7 +150,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .value_of(OPT_SUFFIX_LENGTH) .unwrap() .parse() - .expect(format!("Invalid number for {}", OPT_SUFFIX_LENGTH).as_str()); + .unwrap_or_else(|_| panic!("Invalid number for {}", OPT_SUFFIX_LENGTH)); settings.numeric_suffix = matches.occurrences_of(OPT_NUMERIC_SUFFIXES) > 0; settings.additional_suffix = matches.value_of(OPT_ADDITIONAL_SUFFIX).unwrap().to_owned(); diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index c62d86c26..cd391a53e 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -275,7 +275,11 @@ impl Error for ParseSizeErr { impl fmt::Display for ParseSizeErr { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - write!(f, "{}", self.to_string()) + let s = match self { + ParseSizeErr::ParseFailure(s) => s, + ParseSizeErr::SizeTooBig(s) => s, + }; + write!(f, "{}", s) } } diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index a5acd482a..9cd5865b7 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -12,7 +12,6 @@ extern crate uucore; use clap::{App, Arg}; use std::fs::{metadata, File, OpenOptions}; -use std::io::Result; use std::path::Path; #[derive(Eq, PartialEq)] @@ -118,10 +117,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { if reference.is_none() && size.is_none() { crash!(1, "you must specify either --reference or --size"); } else { - match truncate(no_create, io_blocks, reference, size, files) { - Ok(()) => ( /* pass */ ), - Err(_) => return 1, - } + truncate(no_create, io_blocks, reference, size, files); } } @@ -134,7 +130,7 @@ fn truncate( reference: Option, size: Option, filenames: Vec, -) -> Result<()> { +) { let (refsize, mode) = match reference { Some(rfilename) => { let _ = match File::open(Path::new(&rfilename)) { @@ -193,7 +189,6 @@ fn truncate( Err(f) => crash!(1, "{}", f.to_string()), } } - Ok(()) } fn parse_size(size: &str) -> (u64, TruncateMode) { From 734ef0a8a1a27f4014b3e485bcba57d8301ae9a5 Mon Sep 17 00:00:00 2001 From: Mikadore Date: Wed, 10 Mar 2021 21:54:31 +0100 Subject: [PATCH 385/606] uniq: fixed #550 (#1790) --- src/uu/uniq/src/uniq.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/uu/uniq/src/uniq.rs b/src/uu/uniq/src/uniq.rs index f636adde7..afbda2829 100644 --- a/src/uu/uniq/src/uniq.rs +++ b/src/uu/uniq/src/uniq.rs @@ -131,10 +131,7 @@ impl Uniq { // fast path: avoid skipping if self.ignore_case && slice_start == 0 && slice_stop == len { - return closure(&mut fields_to_check.chars().map(|c| match c { - 'a'..='z' => ((c as u8) - 32) as char, - _ => c, - })); + return closure(&mut fields_to_check.chars().flat_map(|c| c.to_uppercase())); } // fast path: we can avoid mapping chars to upper-case, if we don't want to ignore the case @@ -147,10 +144,7 @@ impl Uniq { .chars() .skip(slice_start) .take(slice_stop) - .map(|c| match c { - 'a'..='z' => ((c as u8) - 32) as char, - _ => c, - }), + .flat_map(|c| c.to_uppercase()), ) } else { closure(&mut fields_to_check.chars()) From 9ab8bb5db5301f733bbbcfed213fde435d7409d7 Mon Sep 17 00:00:00 2001 From: Theophile Trunck Date: Wed, 10 Mar 2021 23:13:57 +0100 Subject: [PATCH 386/606] Fix make busytest The binary was rename from uutils to coreutils in that commit 52ae491fcdd2cd9bd56fb56fae8270c399654dcd but the makefile to run the busybox test wasn't updated This commit update the makefile to use the correct binary name. It also update the busybox to the 1.32.1 version and fix the makefile to run all the busybox tests instead of stopping after the failed exe --- GNUmakefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 28044f5f6..8b8a4cf36 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -41,7 +41,7 @@ PKG_BUILDDIR := $(BUILDDIR)/deps DOCSDIR := $(BASEDIR)/docs BUSYBOX_ROOT := $(BASEDIR)/tmp -BUSYBOX_VER := 1.24.1 +BUSYBOX_VER := 1.32.1 BUSYBOX_SRC := $(BUSYBOX_ROOT)/busybox-$(BUSYBOX_VER) # Possible programs @@ -228,7 +228,7 @@ endif define TEST_BUSYBOX test_busybox_$(1): - (cd $(BUSYBOX_SRC)/testsuite && bindir=$(BUILDDIR) ./runtest $(RUNTEST_ARGS) $(1) ) + -(cd $(BUSYBOX_SRC)/testsuite && bindir=$(BUILDDIR) ./runtest $(RUNTEST_ARGS) $(1)) endef # Output names @@ -276,7 +276,7 @@ $(BUILDDIR)/.config: $(BASEDIR)/.busybox-config # Test under the busybox testsuite $(BUILDDIR)/busybox: busybox-src build-uutils $(BUILDDIR)/.config - cp $(BUILDDIR)/uutils $(BUILDDIR)/busybox; \ + cp $(BUILDDIR)/coreutils $(BUILDDIR)/busybox; \ chmod +x $@; ifeq ($(EXES),) From 374a4fde8699ae5ac1b36ccab0b29db0855f4b00 Mon Sep 17 00:00:00 2001 From: Ali <320322+ali5h@users.noreply.github.com> Date: Wed, 10 Mar 2021 14:19:12 -0800 Subject: [PATCH 387/606] 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 --- src/uu/paste/src/paste.rs | 37 ++++++++++++++++++++++++++++++------- tests/by-util/test_paste.rs | 23 +++++++++++++++++++---- 2 files changed, 49 insertions(+), 11 deletions(-) diff --git a/src/uu/paste/src/paste.rs b/src/uu/paste/src/paste.rs index 882ba7137..e78dc7e64 100644 --- a/src/uu/paste/src/paste.rs +++ b/src/uu/paste/src/paste.rs @@ -12,7 +12,7 @@ extern crate uucore; use clap::{App, Arg}; use std::fs::File; -use std::io::{stdin, BufRead, BufReader, Read}; +use std::io::{stdin, BufRead, BufReader, Stdin}; use std::iter::repeat; use std::path::Path; @@ -26,6 +26,29 @@ mod options { pub const FILE: &str = "file"; } +// We need this trait to wrap both BufReader and Stdin. We need +// `read_line` function only, but Stdin does not provide BufRead +// unless lock function is called, which prevents us from using stdin +// multiple times +trait ReadLine { + fn read_line(&mut self, buf: &mut String) -> std::io::Result; +} + +struct StdinReadLine(Stdin); +struct BufReadReadLine(R); + +impl ReadLine for StdinReadLine { + fn read_line(&mut self, buf: &mut String) -> std::io::Result { + return self.0.read_line(buf); + } +} + +impl ReadLine for BufReadReadLine { + fn read_line(&mut self, buf: &mut String) -> std::io::Result { + return self.0.read_line(buf); + } +} + pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .version(VERSION) @@ -49,7 +72,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::FILE) .value_name("FILE") .multiple(true) - .required(true), + .default_value("-"), ) .get_matches_from(args); @@ -66,15 +89,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } fn paste(filenames: Vec, serial: bool, delimiters: String) { - let mut files: Vec>> = filenames + let mut files: Vec> = filenames .into_iter() .map(|name| { - BufReader::new(if name == "-" { - Box::new(stdin()) as Box + if name == "-" { + Box::new(StdinReadLine(stdin())) as Box } else { let r = crash_if_err!(1, File::open(Path::new(&name))); - Box::new(r) as Box - }) + Box::new(BufReadReadLine(BufReader::new(r))) as Box + } }) .collect(); diff --git a/tests/by-util/test_paste.rs b/tests/by-util/test_paste.rs index 27de0b445..ef83fe9da 100644 --- a/tests/by-util/test_paste.rs +++ b/tests/by-util/test_paste.rs @@ -2,8 +2,23 @@ use crate::common::util::*; #[test] fn test_combine_pairs_of_lines() { - new_ucmd!() - .args(&["-s", "-d", "\t\n", "html_colors.txt"]) - .run() - .stdout_is_fixture("html_colors.expected"); + for s in vec!["-s", "--serial"] { + for d in vec!["-d", "--delimiters"] { + new_ucmd!() + .args(&[s, d, "\t\n", "html_colors.txt"]) + .run() + .stdout_is_fixture("html_colors.expected"); + } + } +} + +#[test] +fn test_multi_stdin() { + for d in vec!["-d", "--delimiters"] { + new_ucmd!() + .args(&[d, "\t\n", "-", "-"]) + .pipe_in_fixture("html_colors.txt") + .succeeds() + .stdout_is_fixture("html_colors.expected"); + } } From 8bafcbab7ae3c99a5bedbacaf83ff3cbe2b93c05 Mon Sep 17 00:00:00 2001 From: Theophile Trunck Date: Wed, 10 Mar 2021 23:52:33 +0100 Subject: [PATCH 388/606] 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 --- src/bin/coreutils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/coreutils.rs b/src/bin/coreutils.rs index b172edbd3..7fc494020 100644 --- a/src/bin/coreutils.rs +++ b/src/bin/coreutils.rs @@ -19,7 +19,7 @@ include!(concat!(env!("OUT_DIR"), "/uutils_map.rs")); fn usage(utils: &UtilityMap, name: &str) { println!("{} {} (multi-call binary)\n", name, VERSION); println!("Usage: {} [function [arguments...]]\n", name); - println!("Currently defined functions/utilities:\n"); + println!("Currently defined functions:\n"); #[allow(clippy::map_clone)] let mut utils: Vec<&str> = utils.keys().map(|&s| s).collect(); utils.sort_unstable(); From 3ab114f283eb65d3f6511434b215908da90debdb Mon Sep 17 00:00:00 2001 From: Craig Pastro Date: Fri, 12 Mar 2021 21:25:15 +0900 Subject: [PATCH 389/606] cp: Implement --parents & --parent (#1797) --- src/uu/cp/src/cp.rs | 23 +++++++++++--- tests/by-util/test_cp.rs | 67 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 5 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index a43f3337c..0922af241 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -249,6 +249,7 @@ static OPT_NO_DEREFERENCE_PRESERVE_LINKS: &str = "no-dereference-preserve-linkgs static OPT_NO_PRESERVE: &str = "no-preserve"; static OPT_NO_TARGET_DIRECTORY: &str = "no-target-directory"; static OPT_ONE_FILE_SYSTEM: &str = "one-file-system"; +static OPT_PARENT: &str = "parent"; static OPT_PARENTS: &str = "parents"; static OPT_PATHS: &str = "paths"; static OPT_PRESERVE: &str = "preserve"; @@ -407,6 +408,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .value_name("ATTR_LIST") .conflicts_with_all(&[OPT_PRESERVE_DEFAULT_ATTRIBUTES, OPT_PRESERVE, OPT_ARCHIVE]) .help("don't preserve the specified attributes")) + .arg(Arg::with_name(OPT_PARENTS) + .long(OPT_PARENTS) + .alias(OPT_PARENT) + .help("use full source file name under DIRECTORY")) .arg(Arg::with_name(OPT_NO_DEREFERENCE) .short("-P") .long(OPT_NO_DEREFERENCE) @@ -432,9 +437,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_COPY_CONTENTS) .conflicts_with(OPT_ATTRIBUTES_ONLY) .help("NotImplemented: copy contents of special files when recursive")) - .arg(Arg::with_name(OPT_PARENTS) - .long(OPT_PARENTS) - .help("NotImplemented: use full source file name under DIRECTORY")) .arg(Arg::with_name(OPT_SPARSE) .long(OPT_SPARSE) .takes_value(true) @@ -560,7 +562,6 @@ impl Options { fn from_matches(matches: &ArgMatches) -> CopyResult { let not_implemented_opts = vec![ OPT_COPY_CONTENTS, - OPT_PARENTS, OPT_SPARSE, OPT_ONE_FILE_SYSTEM, OPT_CONTEXT, @@ -850,9 +851,17 @@ fn construct_dest_path( .into()); } + if options.parents && !target.is_dir() { + return Err("with --parents, the destination must be a directory".into()); + } + Ok(match *target_type { TargetType::Directory => { - let root = source_path.parent().unwrap_or(source_path); + let root = if options.parents { + Path::new("") + } else { + source_path.parent().unwrap_or(source_path) + }; localize_to_target(root, source_path, target)? } TargetType::File => target.to_path_buf(), @@ -1244,6 +1253,10 @@ fn copy_helper(source: &Path, dest: &Path, options: &Options) -> CopyResult<()> */ File::create(dest)?; } else { + if options.parents { + let parent = dest.parent().unwrap_or(dest); + fs::create_dir_all(parent)?; + } fs::copy(source, dest).context(&*context_for(source, dest))?; } diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index ca2a51582..b96bd4e29 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -497,6 +497,73 @@ fn test_cp_strip_trailing_slashes() { assert_eq!(at.read(TEST_HELLO_WORLD_DEST), "Hello, World!\n"); } +#[test] +fn test_cp_parents() { + let (at, mut ucmd) = at_and_ucmd!(); + + let result = ucmd + .arg("--parents") + .arg(TEST_COPY_FROM_FOLDER_FILE) + .arg(TEST_COPY_TO_FOLDER) + .run(); + + assert!(result.success); + // Check the content of the destination file that was copied. + assert_eq!( + at.read(&format!( + "{}/{}", + TEST_COPY_TO_FOLDER, TEST_COPY_FROM_FOLDER_FILE + )), + "Hello, World!\n" + ); +} + +#[test] +fn test_cp_parents_multiple_files() { + let (at, mut ucmd) = at_and_ucmd!(); + + let result = ucmd + .arg("--parents") + .arg(TEST_COPY_FROM_FOLDER_FILE) + .arg(TEST_HOW_ARE_YOU_SOURCE) + .arg(TEST_COPY_TO_FOLDER) + .run(); + + assert!(result.success); + assert_eq!( + at.read(&format!( + "{}/{}", + TEST_COPY_TO_FOLDER, TEST_COPY_FROM_FOLDER_FILE + )), + "Hello, World!\n" + ); + assert_eq!( + at.read(&format!( + "{}/{}", + TEST_COPY_TO_FOLDER, TEST_HOW_ARE_YOU_SOURCE + )), + "How are you?\n" + ); +} + +#[test] +fn test_cp_parents_dest_not_directory() { + let (_, mut ucmd) = at_and_ucmd!(); + + let result = ucmd + .arg("--parents") + .arg(TEST_COPY_FROM_FOLDER_FILE) + .arg(TEST_HELLO_WORLD_DEST) + .run(); + println!("{:?}", result); + + // Check that we did not succeed in copying. + assert!(!result.success); + assert!(result + .stderr + .contains("with --parents, the destination must be a directory")); +} + #[test] // For now, disable the test on Windows. Symlinks aren't well support on Windows. // It works on Unix for now and it works locally when run from a powershell From 5ced3a670b02f296d51ef60dd790ad7e0686fa24 Mon Sep 17 00:00:00 2001 From: Ali <320322+ali5h@users.noreply.github.com> Date: Fri, 12 Mar 2021 04:26:09 -0800 Subject: [PATCH 390/606] paste: cleanup multi-stdin support (#1803) cleaner impl for multi-stdin support --- src/uu/paste/src/paste.rs | 40 +++++++------------ tests/by-util/test_paste.rs | 80 +++++++++++++++++++++++++++++++++++++ tests/common/util.rs | 3 +- 3 files changed, 95 insertions(+), 28 deletions(-) diff --git a/src/uu/paste/src/paste.rs b/src/uu/paste/src/paste.rs index e78dc7e64..751cc0a04 100644 --- a/src/uu/paste/src/paste.rs +++ b/src/uu/paste/src/paste.rs @@ -12,7 +12,7 @@ extern crate uucore; use clap::{App, Arg}; use std::fs::File; -use std::io::{stdin, BufRead, BufReader, Stdin}; +use std::io::{stdin, BufRead, BufReader, Read}; use std::iter::repeat; use std::path::Path; @@ -26,26 +26,14 @@ mod options { pub const FILE: &str = "file"; } -// We need this trait to wrap both BufReader and Stdin. We need -// `read_line` function only, but Stdin does not provide BufRead -// unless lock function is called, which prevents us from using stdin -// multiple times -trait ReadLine { - fn read_line(&mut self, buf: &mut String) -> std::io::Result; -} - -struct StdinReadLine(Stdin); -struct BufReadReadLine(R); - -impl ReadLine for StdinReadLine { - fn read_line(&mut self, buf: &mut String) -> std::io::Result { - return self.0.read_line(buf); - } -} - -impl ReadLine for BufReadReadLine { - fn read_line(&mut self, buf: &mut String) -> std::io::Result { - return self.0.read_line(buf); +// Wraps BufReader and stdin +fn read_line( + reader: Option<&mut BufReader>, + buf: &mut String, +) -> std::io::Result { + match reader { + Some(reader) => reader.read_line(buf), + None => stdin().read_line(buf), } } @@ -89,14 +77,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } fn paste(filenames: Vec, serial: bool, delimiters: String) { - let mut files: Vec> = filenames + let mut files: Vec<_> = filenames .into_iter() .map(|name| { if name == "-" { - Box::new(StdinReadLine(stdin())) as Box + None } else { let r = crash_if_err!(1, File::open(Path::new(&name))); - Box::new(BufReadReadLine(BufReader::new(r))) as Box + Some(BufReader::new(r)) } }) .collect(); @@ -112,7 +100,7 @@ fn paste(filenames: Vec, serial: bool, delimiters: String) { let mut output = String::new(); loop { let mut line = String::new(); - match file.read_line(&mut line) { + match read_line(file.as_mut(), &mut line) { Ok(0) => break, Ok(_) => { output.push_str(line.trim_end()); @@ -134,7 +122,7 @@ fn paste(filenames: Vec, serial: bool, delimiters: String) { eof_count += 1; } else { let mut line = String::new(); - match file.read_line(&mut line) { + match read_line(file.as_mut(), &mut line) { Ok(0) => { eof[i] = true; eof_count += 1; diff --git a/tests/by-util/test_paste.rs b/tests/by-util/test_paste.rs index ef83fe9da..4604c5cf5 100644 --- a/tests/by-util/test_paste.rs +++ b/tests/by-util/test_paste.rs @@ -1,5 +1,67 @@ use crate::common::util::*; +struct TestData<'b> { + name: &'b str, + args: &'b [&'b str], + ins: &'b [&'b str], + out: &'b str, +} + +static EXAMPLE_DATA: &'static [TestData<'static>] = &[ + // Ensure that paste properly handles files lacking a final newline. + TestData { + name: "no-nl-1", + args: &[], + ins: &["a", "b"], + out: "a\tb\n", + }, + TestData { + name: "no-nl-2", + args: &[], + ins: &["a\n", "b"], + out: "a\tb\n", + }, + TestData { + name: "no-nl-3", + args: &[], + ins: &["a", "b\n"], + out: "a\tb\n", + }, + TestData { + name: "no-nl-4", + args: &[], + ins: &["a\n", "b\n"], + out: "a\tb\n", + }, + // Same as above, but with a two lines in each input file and the + // addition of the -d option to make SPACE be the output + // delimiter. + TestData { + name: "no-nla-1", + args: &["-d", " "], + ins: &["1\na", "2\nb"], + out: "1 2\na b\n", + }, + TestData { + name: "no-nla-2", + args: &["-d", " "], + ins: &["1\na\n", "2\nb"], + out: "1 2\na b\n", + }, + TestData { + name: "no-nla-3", + args: &["-d", " "], + ins: &["1\na", "2\nb\n"], + out: "1 2\na b\n", + }, + TestData { + name: "no-nla-4", + args: &["-d", " "], + ins: &["1\na\n", "2\nb\n"], + out: "1 2\na b\n", + }, +]; + #[test] fn test_combine_pairs_of_lines() { for s in vec!["-s", "--serial"] { @@ -22,3 +84,21 @@ fn test_multi_stdin() { .stdout_is_fixture("html_colors.expected"); } } + +#[test] +fn test_data() { + for example in EXAMPLE_DATA { + let (at, mut ucmd) = at_and_ucmd!(); + let mut ins = vec![]; + for (i, _in) in example.ins.iter().enumerate() { + let file = format!("in{}", i); + at.write(&file, _in); + ins.push(file); + } + println!("{}", example.name); + ucmd.args(example.args) + .args(&ins) + .succeeds() + .stdout_is(example.out); + } +} diff --git a/tests/common/util.rs b/tests/common/util.rs index 6b85c8561..92e5b9128 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -261,8 +261,7 @@ impl AtPath { } pub fn write(&self, name: &str, contents: &str) { - let mut f = self.open(name); - let _ = f.write(contents.as_bytes()); + let _ = std::fs::write(self.plus(name), contents); } pub fn append(&self, name: &str, contents: &str) { From e1626b8c64202d70f8269aafce885a952007671f Mon Sep 17 00:00:00 2001 From: Michael Kefeder Date: Fri, 12 Mar 2021 21:52:37 +0100 Subject: [PATCH 391/606] 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 --- src/uu/ptx/src/ptx.rs | 19 ++++++++++++++----- tests/by-util/test_ptx.rs | 16 ++++++++++++++++ ...roff_no_ref_word_regexp_exc_space.expected | 7 +++++++ 3 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 tests/fixtures/ptx/gnu_ext_disabled_roff_no_ref_word_regexp_exc_space.expected diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index 8421e52bc..bfcd6699f 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -95,12 +95,21 @@ impl WordFilter { if matches.opt_present("b") { crash!(1, "-b not implemented yet"); } - let reg = if matches.opt_present("W") { - matches.opt_str("W").expect("parsing options failed!") - } else if config.gnu_ext { - "\\w+".to_owned() + // Ignore empty string regex from cmd-line-args + let arg_reg: Option = if matches.opt_present("W") { + matches.opt_str("W").filter(|reg| !reg.is_empty()) } else { - "[^ \t\n]+".to_owned() + None + }; + let reg = match arg_reg { + Some(arg_reg) => arg_reg, + None => { + if config.gnu_ext { + "\\w+".to_owned() + } else { + "[^ \t\n]+".to_owned() + } + } }; WordFilter { only_specified: o, diff --git a/tests/by-util/test_ptx.rs b/tests/by-util/test_ptx.rs index 77117c5c0..e44943bfa 100644 --- a/tests/by-util/test_ptx.rs +++ b/tests/by-util/test_ptx.rs @@ -8,6 +8,22 @@ fn gnu_ext_disabled_roff_no_ref() { .stdout_only_fixture("gnu_ext_disabled_roff_no_ref.expected"); } +#[test] +fn gnu_ext_disabled_roff_no_ref_empty_word_regexp() { + new_ucmd!() + .args(&["-G", "-R", "-W", "", "input"]) + .succeeds() + .stdout_only_fixture("gnu_ext_disabled_roff_no_ref.expected"); +} + +#[test] +fn gnu_ext_disabled_roff_no_ref_word_regexp_exc_space() { + new_ucmd!() + .args(&["-G", "-R", "-W", "[^\t\n]+", "input"]) + .succeeds() + .stdout_only_fixture("gnu_ext_disabled_roff_no_ref_word_regexp_exc_space.expected"); +} + #[test] fn gnu_ext_disabled_roff_input_ref() { new_ucmd!() diff --git a/tests/fixtures/ptx/gnu_ext_disabled_roff_no_ref_word_regexp_exc_space.expected b/tests/fixtures/ptx/gnu_ext_disabled_roff_no_ref_word_regexp_exc_space.expected new file mode 100644 index 000000000..141e6c9f8 --- /dev/null +++ b/tests/fixtures/ptx/gnu_ext_disabled_roff_no_ref_word_regexp_exc_space.expected @@ -0,0 +1,7 @@ +.xx "" "" """quotes"", for roff" "" +.xx "" "" "and some other like %a, b#, c$c" "" +.xx "" "" "hello world!" "" +.xx "" "" "let's check special characters:" "" +.xx "" "" "maybe also~or^" "" +.xx "" "" "oh, and back\slash" "" +.xx "" "" "{brackets} for tex" "" From 47f50a0f5f244eb48c642d3ea9731eac20312731 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 12 Mar 2021 22:26:27 +0100 Subject: [PATCH 392/606] tests/utils: fixed mode for write (#1802) added `log_info` --- tests/common/util.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/common/util.rs b/tests/common/util.rs index 92e5b9128..0f1acd49a 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -261,6 +261,7 @@ impl AtPath { } pub fn write(&self, name: &str, contents: &str) { + log_info("open(write)", self.plus_as_string(name)); let _ = std::fs::write(self.plus(name), contents); } From 68ec2ed0f3892e45f386d6d32f3efbd1a06ca6a3 Mon Sep 17 00:00:00 2001 From: Hari <-l> Date: Fri, 12 Mar 2021 16:51:47 -0500 Subject: [PATCH 393/606] 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. --- Cargo.lock | 1957 +++++++++++++++++---------------- src/uu/install/Cargo.toml | 1 + src/uu/install/src/install.rs | 24 +- tests/by-util/test_install.rs | 19 + 4 files changed, 1019 insertions(+), 982 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe9e11c35..7a5c2bc02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,2657 +1,2658 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "aho-corasick" version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4", ] [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "arrayvec" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" dependencies = [ - "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", + "winapi 0.3.9", ] [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bit-set" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" dependencies = [ - "bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-vec", ] [[package]] name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ - "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec", + "constant_time_eq", ] [[package]] name = "block-buffer" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" dependencies = [ - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools", + "generic-array", ] [[package]] name = "bstr" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "memchr 2.3.4", + "regex-automata", + "serde", ] [[package]] name = "bumpalo" version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "byte-tools" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" [[package]] name = "byteorder" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" [[package]] name = "cast" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version", ] [[package]] name = "cc" version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" dependencies = [ - "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer", + "num-traits", + "time", ] [[package]] name = "clap" version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term", + "atty", + "bitflags 1.2.1", + "strsim", + "textwrap", + "unicode-width", + "vec_map", ] [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1", ] [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "conv" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" dependencies = [ - "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "custom_derive", ] [[package]] name = "coreutils" version = "0.0.4" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_arch 0.0.4", - "uu_base32 0.0.4", - "uu_base64 0.0.4", - "uu_basename 0.0.4", - "uu_cat 0.0.4", - "uu_chgrp 0.0.4", - "uu_chmod 0.0.4", - "uu_chown 0.0.4", - "uu_chroot 0.0.4", - "uu_cksum 0.0.4", - "uu_comm 0.0.4", - "uu_cp 0.0.4", - "uu_csplit 0.0.4", - "uu_cut 0.0.4", - "uu_date 0.0.4", - "uu_df 0.0.4", - "uu_dircolors 0.0.4", - "uu_dirname 0.0.4", - "uu_du 0.0.4", - "uu_echo 0.0.4", - "uu_env 0.0.4", - "uu_expand 0.0.4", - "uu_expr 0.0.4", - "uu_factor 0.0.4", - "uu_false 0.0.4", - "uu_fmt 0.0.4", - "uu_fold 0.0.4", - "uu_groups 0.0.4", - "uu_hashsum 0.0.4", - "uu_head 0.0.4", - "uu_hostid 0.0.4", - "uu_hostname 0.0.4", - "uu_id 0.0.4", - "uu_install 0.0.4", - "uu_join 0.0.4", - "uu_kill 0.0.4", - "uu_link 0.0.4", - "uu_ln 0.0.4", - "uu_logname 0.0.4", - "uu_ls 0.0.4", - "uu_mkdir 0.0.4", - "uu_mkfifo 0.0.4", - "uu_mknod 0.0.4", - "uu_mktemp 0.0.4", - "uu_more 0.0.4", - "uu_mv 0.0.4", - "uu_nice 0.0.4", - "uu_nl 0.0.4", - "uu_nohup 0.0.4", - "uu_nproc 0.0.4", - "uu_numfmt 0.0.4", - "uu_od 0.0.4", - "uu_paste 0.0.4", - "uu_pathchk 0.0.4", - "uu_pinky 0.0.4", - "uu_printenv 0.0.4", - "uu_printf 0.0.4", - "uu_ptx 0.0.4", - "uu_pwd 0.0.4", - "uu_readlink 0.0.4", - "uu_realpath 0.0.4", - "uu_relpath 0.0.4", - "uu_rm 0.0.4", - "uu_rmdir 0.0.4", - "uu_seq 0.0.4", - "uu_shred 0.0.4", - "uu_shuf 0.0.4", - "uu_sleep 0.0.4", - "uu_sort 0.0.4", - "uu_split 0.0.4", - "uu_stat 0.0.4", - "uu_stdbuf 0.0.4", - "uu_sum 0.0.4", - "uu_sync 0.0.4", - "uu_tac 0.0.4", - "uu_tail 0.0.4", - "uu_tee 0.0.4", - "uu_test 0.0.4", - "uu_timeout 0.0.4", - "uu_touch 0.0.4", - "uu_tr 0.0.4", - "uu_true 0.0.4", - "uu_truncate 0.0.4", - "uu_tsort 0.0.4", - "uu_tty 0.0.4", - "uu_uname 0.0.4", - "uu_unexpand 0.0.4", - "uu_uniq 0.0.4", - "uu_unlink 0.0.4", - "uu_uptime 0.0.4", - "uu_users 0.0.4", - "uu_wc 0.0.4", - "uu_who 0.0.4", - "uu_whoami 0.0.4", - "uu_yes 0.0.4", - "uucore 0.0.7", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder", + "cc", + "conv", + "filetime", + "glob 0.3.0", + "lazy_static", + "libc", + "rand 0.7.3", + "regex", + "rustc-demangle", + "same-file", + "sha1", + "tempfile", + "textwrap", + "thread_local", + "time", + "unindent", + "unix_socket", + "users", + "uu_arch", + "uu_base32", + "uu_base64", + "uu_basename", + "uu_cat", + "uu_chgrp", + "uu_chmod", + "uu_chown", + "uu_chroot", + "uu_cksum", + "uu_comm", + "uu_cp", + "uu_csplit", + "uu_cut", + "uu_date", + "uu_df", + "uu_dircolors", + "uu_dirname", + "uu_du", + "uu_echo", + "uu_env", + "uu_expand", + "uu_expr", + "uu_factor", + "uu_false", + "uu_fmt", + "uu_fold", + "uu_groups", + "uu_hashsum", + "uu_head", + "uu_hostid", + "uu_hostname", + "uu_id", + "uu_install", + "uu_join", + "uu_kill", + "uu_link", + "uu_ln", + "uu_logname", + "uu_ls", + "uu_mkdir", + "uu_mkfifo", + "uu_mknod", + "uu_mktemp", + "uu_more", + "uu_mv", + "uu_nice", + "uu_nl", + "uu_nohup", + "uu_nproc", + "uu_numfmt", + "uu_od", + "uu_paste", + "uu_pathchk", + "uu_pinky", + "uu_printenv", + "uu_printf", + "uu_ptx", + "uu_pwd", + "uu_readlink", + "uu_realpath", + "uu_relpath", + "uu_rm", + "uu_rmdir", + "uu_seq", + "uu_shred", + "uu_shuf", + "uu_sleep", + "uu_sort", + "uu_split", + "uu_stat", + "uu_stdbuf", + "uu_sum", + "uu_sync", + "uu_tac", + "uu_tail", + "uu_tee", + "uu_test", + "uu_timeout", + "uu_touch", + "uu_tr", + "uu_true", + "uu_truncate", + "uu_tsort", + "uu_tty", + "uu_uname", + "uu_unexpand", + "uu_uniq", + "uu_unlink", + "uu_uptime", + "uu_users", + "uu_wc", + "uu_who", + "uu_whoami", + "uu_yes", + "uucore", + "winapi-util", ] [[package]] name = "cpp" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" dependencies = [ - "cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_macros", ] [[package]] name = "cpp_build" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" dependencies = [ - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "cpp_common 0.4.0", + "cpp_syn", + "cpp_synmap", + "cpp_synom", + "lazy_static", ] [[package]] name = "cpp_common" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" dependencies = [ - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn", + "cpp_synom", + "lazy_static", + "quote 0.3.15", ] [[package]] name = "cpp_common" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "proc-macro2", + "syn", ] [[package]] name = "cpp_macros" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "byteorder", + "cpp_common 0.5.6", + "if_rust_version", + "lazy_static", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "cpp_syn" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" dependencies = [ - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom", + "quote 0.3.15", + "unicode-xid 0.0.4", ] [[package]] name = "cpp_synmap" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" dependencies = [ - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn", + "cpp_synom", + "memchr 1.0.2", ] [[package]] name = "cpp_synom" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" dependencies = [ - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4", ] [[package]] name = "criterion" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", - "tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "cast", + "clap", + "criterion-plot", + "csv", + "itertools 0.10.0", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", ] [[package]] name = "criterion-plot" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" dependencies = [ - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cast", + "itertools 0.9.0", ] [[package]] name = "crossbeam-channel" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-utils", ] [[package]] name = "crossbeam-deque" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", ] [[package]] name = "crossbeam-utils" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "cfg-if 1.0.0", + "lazy_static", ] [[package]] name = "csv" version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" dependencies = [ - "bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr", + "csv-core", + "itoa", + "ryu", + "serde", ] [[package]] name = "csv-core" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" dependencies = [ - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4", ] [[package]] name = "custom_derive" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" [[package]] name = "data-encoding" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" [[package]] name = "digest" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" dependencies = [ - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array", ] [[package]] name = "dunce" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "regex", ] [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "filetime" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.2.5", + "winapi 0.3.9", ] [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fs_extra" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "generic-array" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" dependencies = [ - "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", + "typenum", ] [[package]] name = "getopts" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" dependencies = [ - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "getrandom" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "libc", + "wasi", ] [[package]] name = "glob" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "half" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "hermit-abi" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "hex" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" [[package]] name = "hostname" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "match_cfg", + "winapi 0.3.9", ] [[package]] name = "if_rust_version" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" [[package]] name = "ioctl-sys" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" [[package]] name = "itertools" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itertools" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itertools" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itoa" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" dependencies = [ - "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen", ] [[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" [[package]] name = "log" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", ] [[package]] name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "maybe-uninit" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "md5" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" [[package]] name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "memchr" version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memoffset" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "nix" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" dependencies = [ - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.7.0", + "cfg-if 0.1.10", + "libc", + "void", ] [[package]] name = "nix" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1", + "cc", + "cfg-if 0.1.10", + "libc", + "void", ] [[package]] name = "nodrop" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "num-integer" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "num-traits", ] [[package]] name = "num-traits" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", ] [[package]] name = "number_prefix" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "numtoa" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "onig" version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1", + "lazy_static", + "libc", + "onig_sys", ] [[package]] name = "onig_sys" version = "69.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" dependencies = [ - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "pkg-config", ] [[package]] name = "oorandom" version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "paste" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" dependencies = [ - "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", + "paste-impl", + "proc-macro-hack", ] [[package]] name = "paste-impl" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" dependencies = [ - "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack", ] [[package]] name = "pkg-config" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "platform-info" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi 0.3.9", ] [[package]] name = "plotters" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" dependencies = [ - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", ] [[package]] name = "plotters-backend" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" [[package]] name = "plotters-svg" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" dependencies = [ - "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-backend", ] [[package]] name = "ppv-lite86" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro-hack" version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1", ] [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quickcheck" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" dependencies = [ - "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger", + "log", + "rand 0.7.3", + "rand_core 0.5.1", ] [[package]] name = "quote" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "rand" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "winapi 0.3.9", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", + "libc", + "rand_chacha", + "rand_core 0.5.1", + "rand_hc", + "rand_pcg", ] [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2", ] [[package]] name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", ] [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1", ] [[package]] name = "rand_pcg" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1", ] [[package]] name = "rayon" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", ] [[package]] name = "rayon-core" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ - "crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", ] [[package]] name = "redox_syscall" version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1", ] [[package]] name = "redox_termios" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5", ] [[package]] name = "regex" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "memchr 2.3.4", + "regex-syntax", + "thread_local", ] [[package]] name = "regex-automata" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder", ] [[package]] name = "regex-syntax" version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "rust-ini" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" [[package]] name = "rustc-demangle" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver", ] [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "same-file" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" dependencies = [ - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util", ] [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver-parser", ] [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" [[package]] name = "serde_cbor" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" dependencies = [ - "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "half", + "serde", ] [[package]] name = "serde_derive" version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "serde_json" version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ - "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa", + "ryu", + "serde", ] [[package]] name = "sha1" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" dependencies = [ - "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "byte-tools", + "digest", + "fake-simd", + "generic-array", ] [[package]] name = "sha3" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" dependencies = [ - "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "byte-tools", + "digest", + "generic-array", ] [[package]] name = "smallvec" version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit", ] [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd9bc7ccc2688b3344c2f48b9b546648b25ce0b20fc717ee7fa7981a8ca9717" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "unicode-xid 0.2.1", ] [[package]] name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", + "rand 0.7.3", + "redox_syscall 0.1.57", + "remove_dir_all", + "winapi 0.3.9", ] [[package]] name = "term_grid" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" dependencies = [ - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "term_size" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi 0.3.9", ] [[package]] name = "termion" version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "numtoa", + "redox_syscall 0.2.5", + "redox_termios", ] [[package]] name = "termsize" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "kernel32-sys", + "libc", + "termion", + "winapi 0.2.8", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "term_size", + "unicode-width", ] [[package]] name = "thiserror" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ - "thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "thread_local" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", ] [[package]] name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "redox_syscall 0.1.57", + "winapi 0.3.9", ] [[package]] name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "serde", + "serde_json", ] [[package]] name = "typenum" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "unicode-width" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unindent" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" [[package]] name = "unix_socket" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", ] [[package]] name = "users" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "log", ] [[package]] name = "uu_arch" version = "0.0.4" dependencies = [ - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "platform-info", + "uucore", + "uucore_procs", ] [[package]] name = "uu_base32" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_base64" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_basename" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cat" version = "0.0.4" dependencies = [ - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "quick-error", + "unix_socket", + "uucore", + "uucore_procs", ] [[package]] name = "uu_chgrp" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chmod" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chown" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "glob 0.3.0", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chroot" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cksum" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_comm" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cp" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "filetime", + "ioctl-sys", + "libc", + "quick-error", + "uucore", + "uucore_procs", + "walkdir", + "winapi 0.3.9", + "xattr", ] [[package]] name = "uu_csplit" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "glob 0.2.11", + "regex", + "thiserror", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cut" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_date" version = "0.0.4" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "chrono", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_df" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "number_prefix", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_dircolors" version = "0.0.4" dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "glob 0.3.0", + "uucore", + "uucore_procs", ] [[package]] name = "uu_dirname" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_du" version = "0.0.4" dependencies = [ - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_echo" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_env" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "rust-ini", + "uucore", + "uucore_procs", ] [[package]] name = "uu_expand" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_expr" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "onig", + "uucore", + "uucore_procs", ] [[package]] name = "uu_factor" version = "0.0.4" dependencies = [ - "criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "criterion", + "num-traits", + "paste", + "quickcheck", + "rand 0.7.3", + "rand_chacha", + "smallvec", + "uucore", + "uucore_procs", ] [[package]] name = "uu_false" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_fmt" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_fold" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_groups" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hashsum" version = "0.0.4" dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "blake2-rfc", + "clap", + "digest", + "hex", + "libc", + "md5", + "regex", + "regex-syntax", + "sha1", + "sha2", + "sha3", + "uucore", + "uucore_procs", ] [[package]] name = "uu_head" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hostid" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hostname" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "hostname", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_id" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_install" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "filetime", + "libc", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_join" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_kill" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_link" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ln" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_logname" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ls" version = "0.0.4" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "atty", + "getopts", + "lazy_static", + "number_prefix", + "term_grid", + "termsize", + "time", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mkdir" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mkfifo" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mknod" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mktemp" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "rand 0.5.6", + "tempfile", + "uucore", + "uucore_procs", ] [[package]] name = "uu_more" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "nix 0.8.1", + "redox_syscall 0.1.57", + "redox_termios", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mv" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "fs_extra", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nice" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nl" version = "0.0.4" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "aho-corasick", + "getopts", + "libc", + "memchr 2.3.4", + "regex", + "regex-syntax", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nohup" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nproc" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "num_cpus", + "uucore", + "uucore_procs", ] [[package]] name = "uu_numfmt" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_od" version = "0.0.4" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "byteorder", + "getopts", + "half", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_paste" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pathchk" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pinky" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_printenv" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_printf" version = "0.0.4" dependencies = [ - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "itertools 0.8.2", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ptx" version = "0.0.4" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "aho-corasick", + "getopts", + "libc", + "memchr 2.3.4", + "regex", + "regex-syntax", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pwd" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_readlink" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_realpath" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_relpath" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_rm" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "remove_dir_all", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_rmdir" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_seq" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_shred" version = "0.0.4" dependencies = [ - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "filetime", + "getopts", + "libc", + "rand 0.5.6", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_shuf" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "rand 0.5.6", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sleep" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sort" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "itertools 0.8.2", + "semver", + "uucore", + "uucore_procs", ] [[package]] name = "uu_split" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stat" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stdbuf" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_stdbuf_libstdbuf 0.0.4", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "tempfile", + "uu_stdbuf_libstdbuf", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stdbuf_libstdbuf" version = "0.0.4" dependencies = [ - "cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "cpp", + "cpp_build", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sum" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sync" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_tac" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tail" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "redox_syscall 0.1.57", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_tee" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_test" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "redox_syscall 0.1.57", + "uucore", + "uucore_procs", ] [[package]] name = "uu_timeout" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_touch" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "filetime", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tr" version = "0.0.4" dependencies = [ - "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "bit-set", + "fnv", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_true" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_truncate" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tsort" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tty" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uname" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "platform-info", + "uucore", + "uucore_procs", ] [[package]] name = "uu_unexpand" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uniq" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_unlink" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uptime" version = "0.0.4" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "chrono", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_users" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_wc" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_who" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_whoami" version = "0.0.4" dependencies = [ - "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "advapi32-sys", + "clap", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_yes" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uucore" version = "0.0.7" dependencies = [ - "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "data-encoding", + "dunce", + "getopts", + "lazy_static", + "libc", + "nix 0.13.1", + "platform-info", + "termion", + "thiserror", + "time", + "wild", ] [[package]] name = "uucore_procs" version = "0.0.5" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "walkdir" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" dependencies = [ - "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file", + "winapi 0.3.9", + "winapi-util", ] [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" dependencies = [ - "bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote 1.0.9", + "syn", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" dependencies = [ - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9", + "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" [[package]] name = "web-sys" version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b" dependencies = [ - "js-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys", + "wasm-bindgen", ] [[package]] name = "wild" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0", ] [[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] - -[metadata] -"checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" -"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -"checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" -"checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" -"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" -"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -"checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" -"checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" -"checksum bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" -"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" -"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" -"checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" -"checksum cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)" = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" -"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" -"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" -"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" -"checksum cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" -"checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" -"checksum cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" -"checksum cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" -"checksum cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" -"checksum cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" -"checksum cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" -"checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" -"checksum criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" -"checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" -"checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" -"checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" -"checksum crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" -"checksum crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" -"checksum csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" -"checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" -"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" -"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" -"checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" -"checksum dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" -"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" -"checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -"checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" -"checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -"checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -"checksum half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" -"checksum hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" -"checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" -"checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -"checksum if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" -"checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" -"checksum itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" -"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" -"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -"checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" -"checksum js-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)" = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)" = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" -"checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -"checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" -"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" -"checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" -"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -"checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" -"checksum memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" -"checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" -"checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" -"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" -"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -"checksum number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" -"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" -"checksum onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" -"checksum onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" -"checksum oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" -"checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" -"checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" -"checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" -"checksum platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" -"checksum plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" -"checksum plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" -"checksum plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" -"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" -"checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" -"checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" -"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -"checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" -"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" -"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" -"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" -"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -"checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -"checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" -"checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" -"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -"checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" -"checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" -"checksum regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" -"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -"checksum regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)" = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" -"checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -"checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" -"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" -"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" -"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)" = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" -"checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)" = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" -"checksum serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" -"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" -"checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" -"checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" -"checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)" = "8fd9bc7ccc2688b3344c2f48b9b546648b25ce0b20fc717ee7fa7981a8ca9717" -"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" -"checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" -"checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" -"checksum termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" -"checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" -"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" -"checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" -"checksum thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" -"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -"checksum typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" -"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" -"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" -"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" -"checksum unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" -"checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" -"checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" -"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" -"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" -"checksum wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" -"checksum wasm-bindgen-macro 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" -"checksum wasm-bindgen-macro-support 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" -"checksum wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" -"checksum web-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)" = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b" -"checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 5280184fe..9841ac64a 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -19,6 +19,7 @@ path = "src/install.rs" [dependencies] clap = "2.33" +filetime = "0.2" libc = ">= 0.2" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["mode", "perms", "entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index b41b16ef6..c9d2c77ca 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -13,6 +13,7 @@ mod mode; extern crate uucore; use clap::{App, Arg, ArgMatches}; +use filetime::{FileTime, set_file_times}; use uucore::entries::{grp2gid, usr2uid}; use uucore::perms::{wrap_chgrp, wrap_chown, Verbosity}; @@ -32,6 +33,7 @@ pub struct Behavior { owner: String, group: String, verbose: bool, + preserve_timestamps: bool, } #[derive(Clone, Eq, PartialEq)] @@ -154,11 +156,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) ) .arg( - // TODO implement flag Arg::with_name(OPT_PRESERVE_TIMESTAMPS) .short("p") .long(OPT_PRESERVE_TIMESTAMPS) - .help("(unimplemented) apply access/modification times of SOURCE files to corresponding destination files") + .help("apply access/modification times of SOURCE files to corresponding destination files") ) .arg( // TODO implement flag @@ -265,8 +266,6 @@ fn check_unimplemented<'a>(matches: &ArgMatches) -> Result<(), &'a str> { Err("--compare, -C") } else if matches.is_present(OPT_CREATED) { Err("-D") - } else if matches.is_present(OPT_PRESERVE_TIMESTAMPS) { - Err("--preserve-timestamps, -p") } else if matches.is_present(OPT_STRIP) { Err("--strip, -s") } else if matches.is_present(OPT_STRIP_PROGRAM) { @@ -338,6 +337,7 @@ fn behavior(matches: &ArgMatches) -> Result { owner: matches.value_of(OPT_OWNER).unwrap_or("").to_string(), group: matches.value_of(OPT_GROUP).unwrap_or("").to_string(), verbose: matches.is_present(OPT_VERBOSE), + preserve_timestamps: matches.is_present(OPT_PRESERVE_TIMESTAMPS) }) } @@ -555,6 +555,22 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { } } + if b.preserve_timestamps { + let meta = match fs::metadata(from) { + Ok(meta) => meta, + Err(f) => crash!(1, "{}", f.to_string()), + }; + + let modified_time = FileTime::from_last_modification_time(&meta); + let accessed_time = FileTime::from_last_access_time(&meta); + + match set_file_times(to.as_path(), accessed_time, modified_time) { + Ok(_) => {}, + Err(e) => show_info!("{}", e) + } + + } + if b.verbose { show_info!("'{}' -> '{}'", from.display(), to.display()); } diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index a04c0ddfc..ee79a8271 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -309,6 +309,25 @@ fn test_install_target_new_file_failing_nonexistent_parent() { assert!(err.contains("not a directory")) } +#[test] +fn test_install_preserve_timestamps() { + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "test_install_target_dir_file_a1"; + let file2 = "test_install_target_dir_file_a2"; + at.touch(file1); + + ucmd.arg(file1).arg(file2).arg("-p").succeeds().no_stderr(); + + assert!(at.file_exists(file1)); + assert!(at.file_exists(file2)); + + let file1_metadata = at.metadata(file1); + let file2_metadata = at.metadata(file2); + + assert_eq!(file1_metadata.accessed().ok(), file2_metadata.accessed().ok()); + assert_eq!(file1_metadata.modified().ok(), file2_metadata.modified().ok()); +} + // These two tests are failing but should work #[test] fn test_install_copy_file() { From cd4003007f447a6cb61a41cb799e30fbc3c092ac Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 12 Mar 2021 23:10:12 +0100 Subject: [PATCH 394/606] refresh cargo.lock with updates --- Cargo.lock | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe9e11c35..edddc56e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -193,7 +193,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -404,7 +404,7 @@ dependencies = [ "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", @@ -517,7 +517,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1035,13 +1035,12 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.3" +version = "1.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1054,7 +1053,7 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.22" +version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1472,7 +1471,7 @@ version = "0.0.4" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1635,8 +1634,8 @@ dependencies = [ "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1837,8 +1836,8 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", ] @@ -1938,8 +1937,8 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", ] @@ -2597,9 +2596,9 @@ dependencies = [ "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" "checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" -"checksum regex 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" +"checksum regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "54fd1046a3107eb58f42de31d656fee6853e5d276c455fd943742dce89fc3dd3" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -"checksum regex-syntax 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)" = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" +"checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" From 2462575d4b9015268177f93895e5aeae0ad8b719 Mon Sep 17 00:00:00 2001 From: Hari Date: Fri, 12 Mar 2021 17:46:58 -0500 Subject: [PATCH 395/606] Run cargo +1.33.0 update to fix Cargo.lock --- Cargo.lock | 1961 ++++++++++++++++++++++++++-------------------------- 1 file changed, 980 insertions(+), 981 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7a5c2bc02..92103835d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,2658 +1,2657 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "aho-corasick" version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ - "memchr 2.3.4", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "arrayvec" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" dependencies = [ - "nodrop", + "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.9", + "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bit-set" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" dependencies = [ - "bit-vec", + "bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ - "arrayvec", - "constant_time_eq", + "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "block-buffer" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" dependencies = [ - "byte-tools", - "generic-array", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bstr" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ - "lazy_static", - "memchr 2.3.4", - "regex-automata", - "serde", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bumpalo" version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "byte-tools" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" [[package]] name = "byteorder" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" [[package]] name = "cast" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" dependencies = [ - "rustc_version", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cc" version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" dependencies = [ - "num-integer", - "num-traits", - "time", + "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clap" version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "ansi_term", - "atty", - "bitflags 1.2.1", - "strsim", - "textwrap", - "unicode-width", - "vec_map", + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags 1.2.1", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "conv" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" dependencies = [ - "custom_derive", + "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "coreutils" version = "0.0.4" dependencies = [ - "byteorder", - "cc", - "conv", - "filetime", - "glob 0.3.0", - "lazy_static", - "libc", - "rand 0.7.3", - "regex", - "rustc-demangle", - "same-file", - "sha1", - "tempfile", - "textwrap", - "thread_local", - "time", - "unindent", - "unix_socket", - "users", - "uu_arch", - "uu_base32", - "uu_base64", - "uu_basename", - "uu_cat", - "uu_chgrp", - "uu_chmod", - "uu_chown", - "uu_chroot", - "uu_cksum", - "uu_comm", - "uu_cp", - "uu_csplit", - "uu_cut", - "uu_date", - "uu_df", - "uu_dircolors", - "uu_dirname", - "uu_du", - "uu_echo", - "uu_env", - "uu_expand", - "uu_expr", - "uu_factor", - "uu_false", - "uu_fmt", - "uu_fold", - "uu_groups", - "uu_hashsum", - "uu_head", - "uu_hostid", - "uu_hostname", - "uu_id", - "uu_install", - "uu_join", - "uu_kill", - "uu_link", - "uu_ln", - "uu_logname", - "uu_ls", - "uu_mkdir", - "uu_mkfifo", - "uu_mknod", - "uu_mktemp", - "uu_more", - "uu_mv", - "uu_nice", - "uu_nl", - "uu_nohup", - "uu_nproc", - "uu_numfmt", - "uu_od", - "uu_paste", - "uu_pathchk", - "uu_pinky", - "uu_printenv", - "uu_printf", - "uu_ptx", - "uu_pwd", - "uu_readlink", - "uu_realpath", - "uu_relpath", - "uu_rm", - "uu_rmdir", - "uu_seq", - "uu_shred", - "uu_shuf", - "uu_sleep", - "uu_sort", - "uu_split", - "uu_stat", - "uu_stdbuf", - "uu_sum", - "uu_sync", - "uu_tac", - "uu_tail", - "uu_tee", - "uu_test", - "uu_timeout", - "uu_touch", - "uu_tr", - "uu_true", - "uu_truncate", - "uu_tsort", - "uu_tty", - "uu_uname", - "uu_unexpand", - "uu_uniq", - "uu_unlink", - "uu_uptime", - "uu_users", - "uu_wc", - "uu_who", - "uu_whoami", - "uu_yes", - "uucore", - "winapi-util", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uu_arch 0.0.4", + "uu_base32 0.0.4", + "uu_base64 0.0.4", + "uu_basename 0.0.4", + "uu_cat 0.0.4", + "uu_chgrp 0.0.4", + "uu_chmod 0.0.4", + "uu_chown 0.0.4", + "uu_chroot 0.0.4", + "uu_cksum 0.0.4", + "uu_comm 0.0.4", + "uu_cp 0.0.4", + "uu_csplit 0.0.4", + "uu_cut 0.0.4", + "uu_date 0.0.4", + "uu_df 0.0.4", + "uu_dircolors 0.0.4", + "uu_dirname 0.0.4", + "uu_du 0.0.4", + "uu_echo 0.0.4", + "uu_env 0.0.4", + "uu_expand 0.0.4", + "uu_expr 0.0.4", + "uu_factor 0.0.4", + "uu_false 0.0.4", + "uu_fmt 0.0.4", + "uu_fold 0.0.4", + "uu_groups 0.0.4", + "uu_hashsum 0.0.4", + "uu_head 0.0.4", + "uu_hostid 0.0.4", + "uu_hostname 0.0.4", + "uu_id 0.0.4", + "uu_install 0.0.4", + "uu_join 0.0.4", + "uu_kill 0.0.4", + "uu_link 0.0.4", + "uu_ln 0.0.4", + "uu_logname 0.0.4", + "uu_ls 0.0.4", + "uu_mkdir 0.0.4", + "uu_mkfifo 0.0.4", + "uu_mknod 0.0.4", + "uu_mktemp 0.0.4", + "uu_more 0.0.4", + "uu_mv 0.0.4", + "uu_nice 0.0.4", + "uu_nl 0.0.4", + "uu_nohup 0.0.4", + "uu_nproc 0.0.4", + "uu_numfmt 0.0.4", + "uu_od 0.0.4", + "uu_paste 0.0.4", + "uu_pathchk 0.0.4", + "uu_pinky 0.0.4", + "uu_printenv 0.0.4", + "uu_printf 0.0.4", + "uu_ptx 0.0.4", + "uu_pwd 0.0.4", + "uu_readlink 0.0.4", + "uu_realpath 0.0.4", + "uu_relpath 0.0.4", + "uu_rm 0.0.4", + "uu_rmdir 0.0.4", + "uu_seq 0.0.4", + "uu_shred 0.0.4", + "uu_shuf 0.0.4", + "uu_sleep 0.0.4", + "uu_sort 0.0.4", + "uu_split 0.0.4", + "uu_stat 0.0.4", + "uu_stdbuf 0.0.4", + "uu_sum 0.0.4", + "uu_sync 0.0.4", + "uu_tac 0.0.4", + "uu_tail 0.0.4", + "uu_tee 0.0.4", + "uu_test 0.0.4", + "uu_timeout 0.0.4", + "uu_touch 0.0.4", + "uu_tr 0.0.4", + "uu_true 0.0.4", + "uu_truncate 0.0.4", + "uu_tsort 0.0.4", + "uu_tty 0.0.4", + "uu_uname 0.0.4", + "uu_unexpand 0.0.4", + "uu_uniq 0.0.4", + "uu_unlink 0.0.4", + "uu_uptime 0.0.4", + "uu_users 0.0.4", + "uu_wc 0.0.4", + "uu_who 0.0.4", + "uu_whoami 0.0.4", + "uu_yes 0.0.4", + "uucore 0.0.7", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" dependencies = [ - "cpp_macros", + "cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_build" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" dependencies = [ - "cc", - "cpp_common 0.4.0", - "cpp_syn", - "cpp_synmap", - "cpp_synom", - "lazy_static", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_common" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" dependencies = [ - "cpp_syn", - "cpp_synom", - "lazy_static", - "quote 0.3.15", + "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_common" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" dependencies = [ - "lazy_static", - "proc-macro2", - "syn", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_macros" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" dependencies = [ - "aho-corasick", - "byteorder", - "cpp_common 0.5.6", - "if_rust_version", - "lazy_static", - "proc-macro2", - "quote 1.0.9", - "syn", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_syn" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" dependencies = [ - "cpp_synom", - "quote 0.3.15", - "unicode-xid 0.0.4", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_synmap" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" dependencies = [ - "cpp_syn", - "cpp_synom", - "memchr 1.0.2", + "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_synom" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" dependencies = [ - "unicode-xid 0.0.4", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "criterion" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" dependencies = [ - "atty", - "cast", - "clap", - "criterion-plot", - "csv", - "itertools 0.10.0", - "lazy_static", - "num-traits", - "oorandom", - "plotters", - "rayon", - "regex", - "serde", - "serde_cbor", - "serde_derive", - "serde_json", - "tinytemplate", - "walkdir", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "criterion-plot" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" dependencies = [ - "cast", - "itertools 0.9.0", + "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-channel" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-deque" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", - "lazy_static", - "memoffset", - "scopeguard", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-utils" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "lazy_static", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv" version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" dependencies = [ - "bstr", - "csv-core", - "itoa", - "ryu", - "serde", + "bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", + "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv-core" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" dependencies = [ - "memchr 2.3.4", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "custom_derive" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" [[package]] name = "data-encoding" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" [[package]] name = "digest" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" dependencies = [ - "generic-array", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "dunce" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "log", - "regex", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "filetime" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall 0.2.5", - "winapi 0.3.9", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fs_extra" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "generic-array" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" dependencies = [ - "nodrop", - "typenum", + "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "getopts" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" dependencies = [ - "unicode-width", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "getrandom" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glob" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "half" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "hermit-abi" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ - "libc", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hex" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" [[package]] name = "hostname" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ - "libc", - "match_cfg", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "if_rust_version" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" [[package]] name = "ioctl-sys" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" [[package]] name = "itertools" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ - "either", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itertools" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" dependencies = [ - "either", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itertools" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" dependencies = [ - "either", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itoa" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" dependencies = [ - "wasm-bindgen", + "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" [[package]] name = "log" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "maybe-uninit" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "md5" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" [[package]] name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" dependencies = [ - "libc", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "memchr" version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memoffset" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" dependencies = [ - "autocfg", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nix" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" dependencies = [ - "bitflags 0.7.0", - "cfg-if 0.1.10", - "libc", - "void", + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nix" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" dependencies = [ - "bitflags 1.2.1", - "cc", - "cfg-if 0.1.10", - "libc", - "void", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nodrop" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "num-integer" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg", - "num-traits", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "hermit-abi", - "libc", + "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "number_prefix" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "numtoa" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "onig" version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" dependencies = [ - "bitflags 1.2.1", - "lazy_static", - "libc", - "onig_sys", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "onig_sys" version = "69.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" dependencies = [ - "cc", - "pkg-config", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "oorandom" version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "paste" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" dependencies = [ - "paste-impl", - "proc-macro-hack", + "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "paste-impl" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" dependencies = [ - "proc-macro-hack", + "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pkg-config" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "platform-info" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" dependencies = [ - "libc", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "plotters" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" dependencies = [ - "num-traits", - "plotters-backend", - "plotters-svg", - "wasm-bindgen", - "web-sys", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "plotters-backend" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" [[package]] name = "plotters-svg" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" dependencies = [ - "plotters-backend", + "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ppv-lite86" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro-hack" version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "unicode-xid 0.2.1", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quickcheck" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" dependencies = [ - "env_logger", - "log", - "rand 0.7.3", - "rand_core 0.5.1", + "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "quote" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ - "proc-macro2", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "winapi 0.3.9", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", - "libc", - "rand_chacha", - "rand_core 0.5.1", - "rand_hc", - "rand_pcg", + "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "rand_core 0.4.2", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_pcg" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core 0.5.1", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon-core" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "lazy_static", - "num_cpus", + "crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_syscall" version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" dependencies = [ - "bitflags 1.2.1", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_termios" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall 0.2.5", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "1.4.3" +version = "1.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" dependencies = [ - "aho-corasick", - "memchr 2.3.4", - "regex-syntax", - "thread_local", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-automata" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" dependencies = [ - "byteorder", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.22" +version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rust-ini" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" [[package]] name = "rustc-demangle" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "same-file" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" dependencies = [ - "winapi-util", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser", + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" [[package]] name = "serde_cbor" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" dependencies = [ - "half", - "serde", + "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ - "itoa", - "ryu", - "serde", + "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sha1" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" dependencies = [ - "block-buffer", - "byte-tools", - "digest", - "fake-simd", - "generic-array", + "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sha3" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" dependencies = [ - "block-buffer", - "byte-tools", - "digest", - "generic-array", + "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "smallvec" version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ - "maybe-uninit", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd9bc7ccc2688b3344c2f48b9b546648b25ce0b20fc717ee7fa7981a8ca9717" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "unicode-xid 0.2.1", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if 0.1.10", - "libc", - "rand 0.7.3", - "redox_syscall 0.1.57", - "remove_dir_all", - "winapi 0.3.9", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "term_grid" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" dependencies = [ - "unicode-width", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "term_size" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" dependencies = [ - "libc", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termion" version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ - "libc", - "numtoa", - "redox_syscall 0.2.5", - "redox_termios", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termsize" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" dependencies = [ - "atty", - "kernel32-sys", - "libc", - "termion", - "winapi 0.2.8", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "term_size", - "unicode-width", + "term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thiserror" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thiserror-impl" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thread_local" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" dependencies = [ - "lazy_static", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" dependencies = [ - "libc", - "redox_syscall 0.1.57", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "serde", - "serde_json", + "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "typenum" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "unicode-width" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unindent" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" [[package]] name = "unix_socket" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" dependencies = [ - "cfg-if 0.1.10", - "libc", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "users" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" dependencies = [ - "libc", - "log", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_arch" version = "0.0.4" dependencies = [ - "platform-info", - "uucore", - "uucore_procs", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_base32" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_base64" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_basename" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cat" version = "0.0.4" dependencies = [ - "quick-error", - "unix_socket", - "uucore", - "uucore_procs", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_chgrp" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", - "walkdir", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_chmod" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", - "walkdir", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_chown" version = "0.0.4" dependencies = [ - "clap", - "glob 0.3.0", - "uucore", - "uucore_procs", - "walkdir", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_chroot" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cksum" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_comm" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cp" version = "0.0.4" dependencies = [ - "clap", - "filetime", - "ioctl-sys", - "libc", - "quick-error", - "uucore", - "uucore_procs", - "walkdir", - "winapi 0.3.9", - "xattr", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_csplit" version = "0.0.4" dependencies = [ - "getopts", - "glob 0.2.11", - "regex", - "thiserror", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cut" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_date" version = "0.0.4" dependencies = [ - "chrono", - "clap", - "uucore", - "uucore_procs", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_df" version = "0.0.4" dependencies = [ - "clap", - "libc", - "number_prefix", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_dircolors" version = "0.0.4" dependencies = [ - "glob 0.3.0", - "uucore", - "uucore_procs", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_dirname" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_du" version = "0.0.4" dependencies = [ - "time", - "uucore", - "uucore_procs", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_echo" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_env" version = "0.0.4" dependencies = [ - "clap", - "libc", - "rust-ini", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_expand" version = "0.0.4" dependencies = [ - "getopts", - "unicode-width", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_expr" version = "0.0.4" dependencies = [ - "libc", - "onig", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_factor" version = "0.0.4" dependencies = [ - "criterion", - "num-traits", - "paste", - "quickcheck", - "rand 0.7.3", - "rand_chacha", - "smallvec", - "uucore", - "uucore_procs", + "criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_false" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_fmt" version = "0.0.4" dependencies = [ - "clap", - "libc", - "unicode-width", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_fold" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_groups" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_hashsum" version = "0.0.4" dependencies = [ - "blake2-rfc", - "clap", - "digest", - "hex", - "libc", - "md5", - "regex", - "regex-syntax", - "sha1", - "sha2", - "sha3", - "uucore", - "uucore_procs", + "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_head" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_hostid" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_hostname" version = "0.0.4" dependencies = [ - "clap", - "hostname", - "libc", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_id" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_install" version = "0.0.4" dependencies = [ - "clap", - "filetime", - "libc", - "time", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_join" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_kill" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_link" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_ln" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_logname" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_ls" version = "0.0.4" dependencies = [ - "atty", - "getopts", - "lazy_static", - "number_prefix", - "term_grid", - "termsize", - "time", - "unicode-width", - "uucore", - "uucore_procs", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mkdir" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mkfifo" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mknod" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mktemp" version = "0.0.4" dependencies = [ - "clap", - "rand 0.5.6", - "tempfile", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_more" version = "0.0.4" dependencies = [ - "getopts", - "nix 0.8.1", - "redox_syscall 0.1.57", - "redox_termios", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mv" version = "0.0.4" dependencies = [ - "clap", - "fs_extra", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nice" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nl" version = "0.0.4" dependencies = [ - "aho-corasick", - "getopts", - "libc", - "memchr 2.3.4", - "regex", - "regex-syntax", - "uucore", - "uucore_procs", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nohup" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nproc" version = "0.0.4" dependencies = [ - "clap", - "libc", - "num_cpus", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_numfmt" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_od" version = "0.0.4" dependencies = [ - "byteorder", - "getopts", - "half", - "libc", - "uucore", - "uucore_procs", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_paste" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pathchk" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pinky" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_printenv" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_printf" version = "0.0.4" dependencies = [ - "itertools 0.8.2", - "uucore", - "uucore_procs", + "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_ptx" version = "0.0.4" dependencies = [ - "aho-corasick", - "getopts", - "libc", - "memchr 2.3.4", - "regex", - "regex-syntax", - "uucore", - "uucore_procs", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pwd" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_readlink" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_realpath" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_relpath" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_rm" version = "0.0.4" dependencies = [ - "clap", - "remove_dir_all", - "uucore", - "uucore_procs", - "walkdir", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_rmdir" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_seq" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_shred" version = "0.0.4" dependencies = [ - "filetime", - "getopts", - "libc", - "rand 0.5.6", - "time", - "uucore", - "uucore_procs", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_shuf" version = "0.0.4" dependencies = [ - "getopts", - "rand 0.5.6", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sleep" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sort" version = "0.0.4" dependencies = [ - "clap", - "itertools 0.8.2", - "semver", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_split" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_stat" version = "0.0.4" dependencies = [ - "clap", - "time", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_stdbuf" version = "0.0.4" dependencies = [ - "getopts", - "tempfile", - "uu_stdbuf_libstdbuf", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uu_stdbuf_libstdbuf 0.0.4", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_stdbuf_libstdbuf" version = "0.0.4" dependencies = [ - "cpp", - "cpp_build", - "libc", - "uucore", - "uucore_procs", + "cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sum" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sync" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_tac" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tail" version = "0.0.4" dependencies = [ - "clap", - "libc", - "redox_syscall 0.1.57", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_tee" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_test" version = "0.0.4" dependencies = [ - "libc", - "redox_syscall 0.1.57", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_timeout" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_touch" version = "0.0.4" dependencies = [ - "clap", - "filetime", - "time", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tr" version = "0.0.4" dependencies = [ - "bit-set", - "fnv", - "getopts", - "uucore", - "uucore_procs", + "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_true" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_truncate" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tsort" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tty" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_uname" version = "0.0.4" dependencies = [ - "clap", - "platform-info", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_unexpand" version = "0.0.4" dependencies = [ - "getopts", - "unicode-width", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_uniq" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_unlink" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_uptime" version = "0.0.4" dependencies = [ - "chrono", - "clap", - "uucore", - "uucore_procs", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_users" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_wc" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_who" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_whoami" version = "0.0.4" dependencies = [ - "advapi32-sys", - "clap", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_yes" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uucore" version = "0.0.7" dependencies = [ - "data-encoding", - "dunce", - "getopts", - "lazy_static", - "libc", - "nix 0.13.1", - "platform-info", - "termion", - "thiserror", - "time", - "wild", + "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uucore_procs" version = "0.0.5" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "walkdir" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" dependencies = [ - "same-file", - "winapi 0.3.9", - "winapi-util", + "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" dependencies = [ - "cfg-if 1.0.0", - "wasm-bindgen-macro", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote 1.0.9", - "syn", - "wasm-bindgen-shared", + "bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" dependencies = [ - "quote 1.0.9", - "wasm-bindgen-macro-support", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" [[package]] name = "web-sys" version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b" dependencies = [ - "js-sys", - "wasm-bindgen", + "js-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wild" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" dependencies = [ - "glob 0.3.0", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" dependencies = [ - "winapi 0.3.9", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" dependencies = [ - "libc", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] + +[metadata] +"checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" +"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" +"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +"checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" +"checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" +"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +"checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" +"checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" +"checksum bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" +"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" +"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +"checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" +"checksum cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)" = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" +"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +"checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" +"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" +"checksum cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" +"checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" +"checksum cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" +"checksum cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" +"checksum cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" +"checksum cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" +"checksum cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" +"checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" +"checksum criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" +"checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" +"checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" +"checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" +"checksum crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" +"checksum crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" +"checksum csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" +"checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" +"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" +"checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" +"checksum dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" +"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +"checksum filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" +"checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +"checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" +"checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +"checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" +"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +"checksum half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" +"checksum hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +"checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" +"checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +"checksum if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" +"checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" +"checksum itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" +"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" +"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +"checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +"checksum js-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)" = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +"checksum libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)" = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" +"checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +"checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" +"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" +"checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" +"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" +"checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +"checksum memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" +"checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" +"checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" +"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +"checksum number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" +"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" +"checksum onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" +"checksum onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" +"checksum oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +"checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" +"checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" +"checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +"checksum platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" +"checksum plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" +"checksum plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" +"checksum plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" +"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +"checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" +"checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +"checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" +"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" +"checksum quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" +"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +"checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +"checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" +"checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" +"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +"checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" +"checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" +"checksum regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "54fd1046a3107eb58f42de31d656fee6853e5d276c455fd943742dce89fc3dd3" +"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +"checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" +"checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +"checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" +"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" +"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)" = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" +"checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" +"checksum serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)" = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" +"checksum serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +"checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" +"checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" +"checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +"checksum syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)" = "8fd9bc7ccc2688b3344c2f48b9b546648b25ce0b20fc717ee7fa7981a8ca9717" +"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +"checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" +"checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" +"checksum termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" +"checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" +"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +"checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" +"checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" +"checksum thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +"checksum typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" +"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" +"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +"checksum unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" +"checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" +"checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" +"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" +"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +"checksum wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" +"checksum wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" +"checksum wasm-bindgen-macro 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" +"checksum wasm-bindgen-macro-support 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" +"checksum wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" +"checksum web-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)" = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b" +"checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" From 5ec1bba5e8095f49f904cdd74f3db3c32bd0e058 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 13 Mar 2021 12:42:52 +0100 Subject: [PATCH 396/606] touch: use arggroup for sources --- src/uu/touch/src/touch.rs | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 1cd3b2a70..1cb551fd2 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -13,7 +13,7 @@ pub extern crate filetime; #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{App, Arg, ArgGroup}; use filetime::*; use std::fs::{self, File}; use std::io::Error; @@ -129,6 +129,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .min_values(1), ) + .group(ArgGroup::with_name("sources").args(&[ + options::sources::CURRENT, + options::sources::DATE, + options::sources::REFERENCE, + ])) .get_matches_from(args); let files: Vec = matches @@ -136,19 +141,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); - if matches.is_present(options::sources::DATE) - && (matches.is_present(options::sources::REFERENCE) - || matches.is_present(options::sources::CURRENT)) - || matches.is_present(options::sources::REFERENCE) - && (matches.is_present(options::sources::DATE) - || matches.is_present(options::sources::CURRENT)) - || matches.is_present(options::sources::CURRENT) - && (matches.is_present(options::sources::DATE) - || matches.is_present(options::sources::REFERENCE)) - { - panic!("Invalid options: cannot specify reference time from more than one source"); - } - let (mut atime, mut mtime) = if matches.is_present(options::sources::REFERENCE) { stat( &matches.value_of(options::sources::REFERENCE).unwrap()[..], @@ -188,10 +180,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; // Minor optimization: if no reference time was specified, we're done. - if !(matches.is_present(options::sources::DATE) - || matches.is_present(options::sources::REFERENCE) - || matches.is_present(options::sources::CURRENT)) - { + if !matches.is_present("sources") { continue; } } From dfc7a9505424539ee02aa0c051f16ddb98539ef4 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 13 Mar 2021 12:46:54 +0100 Subject: [PATCH 397/606] tests/touch: add tests for multiple sources --- tests/by-util/test_touch.rs | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 7e04beced..52b0c1f51 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -203,6 +203,44 @@ fn test_touch_set_only_mtime_failed() { ucmd.args(&["-t", "2015010112342", "-m", file]).fails(); } +#[test] +fn test_touch_set_both_time_and_reference() { + let (at, mut ucmd) = at_and_ucmd!(); + let ref_file = "test_touch_reference"; + let file = "test_touch_set_both_time_and_reference"; + + let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); + + at.touch(ref_file); + set_file_times(&at, ref_file, start_of_year, start_of_year); + assert!(at.file_exists(ref_file)); + + ucmd.args(&["-t", "2015010112342", "-r", ref_file]).fails(); +} + +#[test] +fn test_touch_set_both_date_and_reference() { + let (at, mut ucmd) = at_and_ucmd!(); + let ref_file = "test_touch_reference"; + let file = "test_touch_set_both_date_and_reference"; + + let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); + + at.touch(ref_file); + set_file_times(&at, ref_file, start_of_year, start_of_year); + assert!(at.file_exists(ref_file)); + + ucmd.args(&["-d", "Thu Jan 01 12:34:00 2015", "-r", ref_file]).fails(); +} + +#[test] +fn test_touch_set_both_time_and_date() { + let (at, mut ucmd) = at_and_ucmd!(); + let file = "test_touch_set_both_time_and_date"; + + ucmd.args(&["-t", "2015010112342", "-d", "Thu Jan 01 12:34:00 2015", file]).fails(); +} + #[test] fn test_touch_set_only_mtime() { let (at, mut ucmd) = at_and_ucmd!(); From 86422a70d2b1c3b737175ddec4189d5568b81536 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 13 Mar 2021 12:47:20 +0100 Subject: [PATCH 398/606] touch: turn macros into functions --- src/uu/touch/src/touch.rs | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 1cb551fd2..e362329b3 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -36,23 +36,15 @@ pub mod options { static ARG_FILES: &str = "files"; -// Since touch's date/timestamp parsing doesn't account for timezone, the -// returned value from time::strptime() is UTC. We get system's timezone to -// localize the time. -macro_rules! to_local( - ($exp:expr) => ({ - let mut tm = $exp; - tm.tm_utcoff = time::now().tm_utcoff; - tm - }) -); +fn to_local(mut tm: time::Tm) -> time::Tm { + tm.tm_utcoff = time::now().tm_utcoff; + tm +} -macro_rules! local_tm_to_filetime( - ($exp:expr) => ({ - let ts = $exp.to_timespec(); - FileTime::from_unix_time(ts.sec as i64, ts.nsec as u32) - }) -); +fn local_tm_to_filetime(tm: time::Tm) -> FileTime { + let ts = tm.to_timespec(); + FileTime::from_unix_time(ts.sec as i64, ts.nsec as u32) +} fn get_usage() -> String { format!("{0} [OPTION]... [USER]", executable!()) @@ -161,7 +153,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; (timestamp, timestamp) } else { - let now = local_tm_to_filetime!(time::now()); + let now = local_tm_to_filetime(time::now()); (now, now) }; @@ -249,7 +241,7 @@ fn parse_date(str: &str) -> FileTime { // not about to implement GNU parse_datetime. // http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=lib/parse-datetime.y match time::strptime(str, "%c") { - Ok(tm) => local_tm_to_filetime!(to_local!(tm)), + Ok(tm) => local_tm_to_filetime(to_local(tm)), Err(e) => panic!("Unable to parse date\n{}", e), } } @@ -267,7 +259,7 @@ fn parse_timestamp(s: &str) -> FileTime { }; match time::strptime(&ts, format) { - Ok(tm) => local_tm_to_filetime!(to_local!(tm)), + Ok(tm) => local_tm_to_filetime(to_local(tm)), Err(e) => panic!("Unable to parse timestamp\n{}", e), } } From ed2787a6dfee224a2e9f8df03f6d8101f0afece7 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 13 Mar 2021 13:25:36 +0100 Subject: [PATCH 399/606] test/touch: fmt --- tests/by-util/test_touch.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 52b0c1f51..9921c16b5 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -215,7 +215,8 @@ fn test_touch_set_both_time_and_reference() { set_file_times(&at, ref_file, start_of_year, start_of_year); assert!(at.file_exists(ref_file)); - ucmd.args(&["-t", "2015010112342", "-r", ref_file]).fails(); + ucmd.args(&["-t", "2015010112342", "-r", ref_file, file]) + .fails(); } #[test] @@ -230,15 +231,23 @@ fn test_touch_set_both_date_and_reference() { set_file_times(&at, ref_file, start_of_year, start_of_year); assert!(at.file_exists(ref_file)); - ucmd.args(&["-d", "Thu Jan 01 12:34:00 2015", "-r", ref_file]).fails(); + ucmd.args(&["-d", "Thu Jan 01 12:34:00 2015", "-r", ref_file, file]) + .fails(); } #[test] fn test_touch_set_both_time_and_date() { - let (at, mut ucmd) = at_and_ucmd!(); + let (_at, mut ucmd) = at_and_ucmd!(); let file = "test_touch_set_both_time_and_date"; - ucmd.args(&["-t", "2015010112342", "-d", "Thu Jan 01 12:34:00 2015", file]).fails(); + ucmd.args(&[ + "-t", + "2015010112342", + "-d", + "Thu Jan 01 12:34:00 2015", + file, + ]) + .fails(); } #[test] From 44c390c29095b6f1498402877608556e5c7d1e13 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 13 Mar 2021 13:52:08 +0100 Subject: [PATCH 400/606] touch: constant for the sources ArgGroup --- src/uu/touch/src/touch.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index e362329b3..39405900e 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -22,6 +22,8 @@ use std::path::Path; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Update the access and modification times of each FILE to the current time."; pub mod options { + // Both SOURCES and sources are needed as we need to be able to refer to the ArgGroup. + pub static SOURCES: &str = "sources"; pub mod sources { pub static DATE: &str = "date"; pub static REFERENCE: &str = "reference"; @@ -121,7 +123,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .min_values(1), ) - .group(ArgGroup::with_name("sources").args(&[ + .group(ArgGroup::with_name(options::SOURCES).args(&[ options::sources::CURRENT, options::sources::DATE, options::sources::REFERENCE, @@ -172,7 +174,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; // Minor optimization: if no reference time was specified, we're done. - if !matches.is_present("sources") { + if !matches.is_present(options::SOURCES) { continue; } } From fd5ec099d0529ad3cad12723fa573d34ec2eb994 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 13 Mar 2021 17:20:39 +0100 Subject: [PATCH 401/606] 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 --- src/uu/touch/src/touch.rs | 57 +++++++++++++------------------------ tests/by-util/test_touch.rs | 47 ++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 37 deletions(-) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 1cd3b2a70..39405900e 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -13,7 +13,7 @@ pub extern crate filetime; #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{App, Arg, ArgGroup}; use filetime::*; use std::fs::{self, File}; use std::io::Error; @@ -22,6 +22,8 @@ use std::path::Path; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Update the access and modification times of each FILE to the current time."; pub mod options { + // Both SOURCES and sources are needed as we need to be able to refer to the ArgGroup. + pub static SOURCES: &str = "sources"; pub mod sources { pub static DATE: &str = "date"; pub static REFERENCE: &str = "reference"; @@ -36,23 +38,15 @@ pub mod options { static ARG_FILES: &str = "files"; -// Since touch's date/timestamp parsing doesn't account for timezone, the -// returned value from time::strptime() is UTC. We get system's timezone to -// localize the time. -macro_rules! to_local( - ($exp:expr) => ({ - let mut tm = $exp; - tm.tm_utcoff = time::now().tm_utcoff; - tm - }) -); +fn to_local(mut tm: time::Tm) -> time::Tm { + tm.tm_utcoff = time::now().tm_utcoff; + tm +} -macro_rules! local_tm_to_filetime( - ($exp:expr) => ({ - let ts = $exp.to_timespec(); - FileTime::from_unix_time(ts.sec as i64, ts.nsec as u32) - }) -); +fn local_tm_to_filetime(tm: time::Tm) -> FileTime { + let ts = tm.to_timespec(); + FileTime::from_unix_time(ts.sec as i64, ts.nsec as u32) +} fn get_usage() -> String { format!("{0} [OPTION]... [USER]", executable!()) @@ -129,6 +123,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .min_values(1), ) + .group(ArgGroup::with_name(options::SOURCES).args(&[ + options::sources::CURRENT, + options::sources::DATE, + options::sources::REFERENCE, + ])) .get_matches_from(args); let files: Vec = matches @@ -136,19 +135,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); - if matches.is_present(options::sources::DATE) - && (matches.is_present(options::sources::REFERENCE) - || matches.is_present(options::sources::CURRENT)) - || matches.is_present(options::sources::REFERENCE) - && (matches.is_present(options::sources::DATE) - || matches.is_present(options::sources::CURRENT)) - || matches.is_present(options::sources::CURRENT) - && (matches.is_present(options::sources::DATE) - || matches.is_present(options::sources::REFERENCE)) - { - panic!("Invalid options: cannot specify reference time from more than one source"); - } - let (mut atime, mut mtime) = if matches.is_present(options::sources::REFERENCE) { stat( &matches.value_of(options::sources::REFERENCE).unwrap()[..], @@ -169,7 +155,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; (timestamp, timestamp) } else { - let now = local_tm_to_filetime!(time::now()); + let now = local_tm_to_filetime(time::now()); (now, now) }; @@ -188,10 +174,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; // Minor optimization: if no reference time was specified, we're done. - if !(matches.is_present(options::sources::DATE) - || matches.is_present(options::sources::REFERENCE) - || matches.is_present(options::sources::CURRENT)) - { + if !matches.is_present(options::SOURCES) { continue; } } @@ -260,7 +243,7 @@ fn parse_date(str: &str) -> FileTime { // not about to implement GNU parse_datetime. // http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=lib/parse-datetime.y match time::strptime(str, "%c") { - Ok(tm) => local_tm_to_filetime!(to_local!(tm)), + Ok(tm) => local_tm_to_filetime(to_local(tm)), Err(e) => panic!("Unable to parse date\n{}", e), } } @@ -278,7 +261,7 @@ fn parse_timestamp(s: &str) -> FileTime { }; match time::strptime(&ts, format) { - Ok(tm) => local_tm_to_filetime!(to_local!(tm)), + Ok(tm) => local_tm_to_filetime(to_local(tm)), Err(e) => panic!("Unable to parse timestamp\n{}", e), } } diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 7e04beced..9921c16b5 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -203,6 +203,53 @@ fn test_touch_set_only_mtime_failed() { ucmd.args(&["-t", "2015010112342", "-m", file]).fails(); } +#[test] +fn test_touch_set_both_time_and_reference() { + let (at, mut ucmd) = at_and_ucmd!(); + let ref_file = "test_touch_reference"; + let file = "test_touch_set_both_time_and_reference"; + + let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); + + at.touch(ref_file); + set_file_times(&at, ref_file, start_of_year, start_of_year); + assert!(at.file_exists(ref_file)); + + ucmd.args(&["-t", "2015010112342", "-r", ref_file, file]) + .fails(); +} + +#[test] +fn test_touch_set_both_date_and_reference() { + let (at, mut ucmd) = at_and_ucmd!(); + let ref_file = "test_touch_reference"; + let file = "test_touch_set_both_date_and_reference"; + + let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000"); + + at.touch(ref_file); + set_file_times(&at, ref_file, start_of_year, start_of_year); + assert!(at.file_exists(ref_file)); + + ucmd.args(&["-d", "Thu Jan 01 12:34:00 2015", "-r", ref_file, file]) + .fails(); +} + +#[test] +fn test_touch_set_both_time_and_date() { + let (_at, mut ucmd) = at_and_ucmd!(); + let file = "test_touch_set_both_time_and_date"; + + ucmd.args(&[ + "-t", + "2015010112342", + "-d", + "Thu Jan 01 12:34:00 2015", + file, + ]) + .fails(); +} + #[test] fn test_touch_set_only_mtime() { let (at, mut ucmd) = at_and_ucmd!(); From 2158b2c5b43c501b66e1db0fc8715878c78c0f73 Mon Sep 17 00:00:00 2001 From: Andre Julius Date: Sat, 13 Mar 2021 23:11:11 +0100 Subject: [PATCH 402/606] sleep: move from getopts to clap #1735 (#1777) and Add some sleep test cases #1735 --- src/uu/sleep/Cargo.toml | 2 +- src/uu/sleep/src/sleep.rs | 81 +++++++++++++++++++------------------ tests/by-util/test_sleep.rs | 48 +++++++++++++++++++++- 3 files changed, 89 insertions(+), 42 deletions(-) diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index 7bcbd1f4e..0ac5d6519 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/sleep.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["parse_time"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/sleep/src/sleep.rs b/src/uu/sleep/src/sleep.rs index f08a6d3a4..5c1f06e5e 100644 --- a/src/uu/sleep/src/sleep.rs +++ b/src/uu/sleep/src/sleep.rs @@ -11,55 +11,56 @@ extern crate uucore; use std::thread; use std::time::Duration; -static NAME: &str = "sleep"; +use clap::{App, Arg}; + static VERSION: &str = env!("CARGO_PKG_VERSION"); - -pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); - - let mut opts = getopts::Options::new(); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - return 1; - } - }; - - if matches.opt_present("help") { - let msg = format!( - "{0} {1} - -Usage: - {0} NUMBER[SUFFIX] -or - {0} OPTION - -Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default), +static ABOUT: &str = "Pause for NUMBER seconds."; +static LONG_HELP: &str = "Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default), 'm' for minutes, 'h' for hours or 'd' for days. Unlike most implementations that require NUMBER be an integer, here NUMBER may be an arbitrary floating point number. Given two or more arguments, pause for the amount of time -specified by the sum of their values.", - NAME, VERSION - ); - print!("{}", opts.usage(&msg)); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else if matches.free.is_empty() { - show_error!("missing an argument"); - show_error!("for help, try '{0} --help'", NAME); - return 1; - } else { - sleep(matches.free); +specified by the sum of their values."; + +mod options { + pub const NUMBER: &str = "NUMBER"; +} + +fn get_usage() -> String { + format!( + "{0} {1}[SUFFIX]... \n {0} OPTION", + executable!(), + options::NUMBER + ) +} + +pub fn uumain(args: impl uucore::Args) -> i32 { + let usage = get_usage(); + + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::NUMBER) + .long(options::NUMBER) + .help("pause for NUMBER seconds") + .value_name(options::NUMBER) + .index(1) + .multiple(true) + .required(true), + ) + .get_matches_from(args); + + if let Some(values) = matches.values_of(options::NUMBER) { + let numbers = values.collect(); + sleep(numbers); } 0 } -fn sleep(args: Vec) { +fn sleep(args: Vec<&str>) { let sleep_dur = args.iter().fold( Duration::new(0, 0), diff --git a/tests/by-util/test_sleep.rs b/tests/by-util/test_sleep.rs index 651491045..389befd0a 100644 --- a/tests/by-util/test_sleep.rs +++ b/tests/by-util/test_sleep.rs @@ -1 +1,47 @@ -// ToDO: add tests +use crate::common::util::*; + +use std::time::{Duration, Instant}; + +#[test] +fn test_sleep_no_suffix() { + let millis_100 = Duration::from_millis(100); + let before_test = Instant::now(); + + new_ucmd!().args(&["0.1"]).succeeds().stdout_only(""); + + let duration = before_test.elapsed(); + assert!(duration >= millis_100); +} + +#[test] +fn test_sleep_s_suffix() { + let millis_100 = Duration::from_millis(100); + let before_test = Instant::now(); + + new_ucmd!().args(&["0.1s"]).succeeds().stdout_only(""); + + let duration = before_test.elapsed(); + assert!(duration >= millis_100); +} + +#[test] +fn test_sleep_m_suffix() { + let millis_600 = Duration::from_millis(600); + let before_test = Instant::now(); + + new_ucmd!().args(&["0.01m"]).succeeds().stdout_only(""); + + let duration = before_test.elapsed(); + assert!(duration >= millis_600); +} + +#[test] +fn test_sleep_h_suffix() { + let millis_360 = Duration::from_millis(360); + let before_test = Instant::now(); + + new_ucmd!().args(&["0.0001h"]).succeeds().stdout_only(""); + + let duration = before_test.elapsed(); + assert!(duration >= millis_360); +} From 2c09556964de74f685de382d92d41e1e4072c1bb Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 13 Mar 2021 23:30:32 +0100 Subject: [PATCH 403/606] rustfmt some tests --- tests/by-util/test_seq.rs | 1 - tests/by-util/test_timeout.rs | 11 ++--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/tests/by-util/test_seq.rs b/tests/by-util/test_seq.rs index d4cff9aaa..a74938377 100644 --- a/tests/by-util/test_seq.rs +++ b/tests/by-util/test_seq.rs @@ -45,4 +45,3 @@ fn test_seq_wrong_arg() { fn test_zero_step() { new_ucmd!().args(&["10", "0", "32"]).fails(); } - diff --git a/tests/by-util/test_timeout.rs b/tests/by-util/test_timeout.rs index edea760c2..592516cca 100644 --- a/tests/by-util/test_timeout.rs +++ b/tests/by-util/test_timeout.rs @@ -5,14 +5,7 @@ use crate::common::util::*; // utility that requires executing another program (kill, for instance) #[test] fn test_subcommand_retcode() { - new_ucmd!() - .arg("1") - .arg("true") - .succeeds(); + new_ucmd!().arg("1").arg("true").succeeds(); - new_ucmd!() - .arg("1") - .arg("false") - .run() - .status_code(1); + new_ucmd!().arg("1").arg("false").run().status_code(1); } From 9e98d24f5f370d28ad83e243e221edeb650e14bb Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 13 Mar 2021 23:43:36 +0100 Subject: [PATCH 404/606] ls: move from getopts to clap --- src/uu/ls/Cargo.toml | 2 +- src/uu/ls/src/ls.rs | 376 ++++++++++++++++++++++++++----------------- 2 files changed, 228 insertions(+), 150 deletions(-) diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index 10d7cc2da..59901f807 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/ls.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" lazy_static = "1.0.1" number_prefix = "0.4" term_grid = "0.1.5" diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index b8defa397..ec17ec2b3 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -13,6 +13,7 @@ extern crate lazy_static; #[macro_use] extern crate uucore; +use clap::{App, Arg}; use number_prefix::NumberPrefix; use std::cmp::Reverse; #[cfg(unix)] @@ -33,14 +34,20 @@ use unicode_width::UnicodeWidthStr; #[cfg(unix)] use uucore::libc::{mode_t, S_ISGID, S_ISUID, S_ISVTX, S_IWOTH, S_IXGRP, S_IXOTH, S_IXUSR}; -static NAME: &str = "ls"; -static SUMMARY: &str = ""; -static LONG_HELP: &str = " +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = " By default, ls will list the files and contents of any directories on the command line, expect that it will ignore files and directories whose names start with '.' "; +fn get_usage() -> String { + format!( + "{0} [OPTION]... [FILE]...", + executable!() + ) +} + #[cfg(unix)] static DEFAULT_COLORS: &str = "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:"; @@ -52,7 +59,7 @@ lazy_static! { let codes = LS_COLORS.split(':'); let mut map = HashMap::new(); for c in codes { - let p: Vec<_> = c.split('=').collect(); + let p: Vec<_> = c.splitn(1, '=').collect(); if p.len() == 2 { map.insert(p[0], p[1]); } @@ -65,107 +72,175 @@ lazy_static! { static ref END_CODE: &'static str = COLOR_MAP.get("ec").unwrap_or(&""); } +pub mod options { + pub static ONE: &str = "1"; + pub static ALL: &str = "all"; + pub static ALMOST_ALL: &str = "almost-all"; + pub static IGNORE_BACKUPS: &str = "ignore-backups"; + pub static COLUMNS: &str = "c"; + pub static DIRECTORY: &str = "directory"; + pub static CLASSIFY: &str = "classify"; + pub static HUMAN_READABLE: &str = "human-readable"; + pub static INODE: &str = "inode"; + pub static DEREFERENCE: &str = "dereference"; + pub static LONG: &str = "long"; + pub static NUMERIC_UID_GID: &str = "numeric-uid-gid"; + pub static REVERSE: &str = "reverse"; + pub static RECURSIVE: &str = "recursive"; + pub static SORT_SIZE: &str = "S"; + pub static SORT_TIME: &str = "t"; + pub static SORT_NONE: &str = "U"; + pub static COLOR: &str = "color"; + pub static PATHS: &str = "paths"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let syntax = format!( - "[OPTION]... DIRECTORY - {0} [OPTION]... [FILE]...", - NAME - ); - let matches = app!(&syntax, SUMMARY, LONG_HELP) - .optflag("1", "", "list one file per line.") - .optflag( - "a", - "all", - "Do not ignore hidden files (files with names that start with '.').", + let usage = get_usage(); + + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(options::ONE) + .short(options::ONE) + .help("list one file per line."), ) - .optflag( - "A", - "almost-all", - "In a directory, do not ignore all file names that start with '.', only ignore \ - '.' and '..'.", + .arg( + Arg::with_name(options::ALL) + .short("a") + .long(options::ALL) + .help("Do not ignore hidden files (files with names that start with '.')."), ) - .optflag("B", "ignore-backups", "Ignore entries which end with ~.") - .optflag( - "c", - "", - "If the long listing format (e.g., -l, -o) is being used, print the status \ - change time (the ‘ctime’ in the inode) instead of the modification time. When \ - explicitly sorting by time (--sort=time or -t) or when not using a long listing \ - format, sort according to the status change time.", + .arg( + Arg::with_name(options::ALMOST_ALL) + .short("A") + .long(options::ALMOST_ALL) + .help( + "In a directory, do not ignore all file names that start with '.', only ignore \ + '.' and '..'.", + ), ) - .optflag( - "d", - "directory", - "Only list the names of directories, rather than listing directory contents. \ - This will not follow symbolic links unless one of `--dereference-command-line \ - (-H)`, `--dereference (-L)`, or `--dereference-command-line-symlink-to-dir` is \ - specified.", + .arg( + Arg::with_name(options::IGNORE_BACKUPS) + .short("B") + .long(options::IGNORE_BACKUPS) + .help("Ignore entries which end with ~."), ) - .optflag( - "F", - "classify", - "Append a character to each file name indicating the file type. Also, for \ - regular files that are executable, append '*'. The file type indicators are \ - '/' for directories, '@' for symbolic links, '|' for FIFOs, '=' for sockets, \ - '>' for doors, and nothing for regular files.", + .arg( + Arg::with_name(options::COLUMNS) + .short(options::COLUMNS) + .help("If the long listing format (e.g., -l, -o) is being used, print the status \ + change time (the ‘ctime’ in the inode) instead of the modification time. When \ + explicitly sorting by time (--sort=time or -t) or when not using a long listing \ + format, sort according to the status change time.", + )) + .arg( + Arg::with_name(options::DIRECTORY) + .short("d") + .long(options::DIRECTORY) + .help( + "Only list the names of directories, rather than listing directory contents. \ + This will not follow symbolic links unless one of `--dereference-command-line \ + (-H)`, `--dereference (-L)`, or `--dereference-command-line-symlink-to-dir` is \ + specified.", + ), ) - .optflag( - "h", - "human-readable", - "Print human readable file sizes (e.g. 1K 234M 56G).", + .arg( + Arg::with_name(options::CLASSIFY) + .short("F") + .long(options::CLASSIFY) + .help("Append a character to each file name indicating the file type. Also, for \ + regular files that are executable, append '*'. The file type indicators are \ + '/' for directories, '@' for symbolic links, '|' for FIFOs, '=' for sockets, \ + '>' for doors, and nothing for regular files.", + )) + .arg( + Arg::with_name(options::HUMAN_READABLE) + .short("h") + .long(options::HUMAN_READABLE) + .help("Print human readable file sizes (e.g. 1K 234M 56G)."), ) - .optflag("i", "inode", "print the index number of each file") - .optflag( - "L", - "dereference", - "When showing file information for a symbolic link, show information for the \ - file the link references rather than the link itself.", + .arg( + Arg::with_name(options::INODE) + .short("i") + .long(options::INODE) + .help("print the index number of each file"), ) - .optflag("l", "long", "Display detailed information.") - .optflag("n", "numeric-uid-gid", "-l with numeric UIDs and GIDs.") - .optflag( - "r", - "reverse", - "Reverse whatever the sorting method is--e.g., list files in reverse \ - alphabetical order, youngest first, smallest first, or whatever.", + .arg( + Arg::with_name(options::DEREFERENCE) + .short("L") + .long(options::DEREFERENCE) + .help( + "When showing file information for a symbolic link, show information for the \ + file the link references rather than the link itself.", + ), ) - .optflag( - "R", - "recursive", - "List the contents of all directories recursively.", + .arg( + Arg::with_name(options::LONG) + .short("l") + .long(options::LONG) + .help("Display detailed information."), ) - .optflag("S", "", "Sort by file size, largest first.") - .optflag( - "t", - "", - "Sort by modification time (the 'mtime' in the inode), newest first.", + .arg( + Arg::with_name(options::NUMERIC_UID_GID) + .short("n") + .long(options::NUMERIC_UID_GID) + .help("-l with numeric UIDs and GIDs."), ) - .optflag( - "U", - "", - "Do not sort; list the files in whatever order they are stored in the \ - directory. This is especially useful when listing very large directories, \ - since not doing any sorting can be noticeably faster.", + .arg( + Arg::with_name(options::REVERSE) + .short("r") + .long(options::REVERSE) + .help("Reverse whatever the sorting method is--e.g., list files in reverse \ + alphabetical order, youngest first, smallest first, or whatever.", + )) + .arg( + Arg::with_name(options::RECURSIVE) + .short("R") + .long(options::RECURSIVE) + .help("List the contents of all directories recursively."), ) - .optflagopt( - "", - "color", - "Color output based on file type.", - "always|auto|never", + .arg( + Arg::with_name(options::SORT_SIZE) + .short(options::SORT_SIZE) + .help("Sort by file size, largest first."), ) - .parse(args); + .arg( + Arg::with_name(options::SORT_TIME) + .short(options::SORT_TIME) + .help("Sort by modification time (the 'mtime' in the inode), newest first."), + ) + .arg( + Arg::with_name(options::SORT_NONE) + .short(options::SORT_NONE) + .help("Do not sort; list the files in whatever order they are stored in the \ + directory. This is especially useful when listing very large directories, \ + since not doing any sorting can be noticeably faster.", + )) + .arg( + Arg::with_name(options::COLOR) + .long(options::COLOR) + .help("Color output based on file type.") + .possible_values(&["always", "yes", "force", "tty", "if-tty", "auto", "never", "no", "none"]) + .require_equals(true) + .empty_values(true), + ) + .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)) + .get_matches_from(args); list(matches) } -fn list(options: getopts::Matches) -> i32 { - let locs: Vec = if options.free.is_empty() { - vec![String::from(".")] - } else { - options.free.to_vec() - }; +fn list(options: clap::ArgMatches) -> i32 { + let locs: Vec = options + .values_of(options::PATHS) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_else(|| vec![String::from(".")]); + + let number_of_locs = locs.len(); let mut files = Vec::::new(); let mut dirs = Vec::::new(); @@ -181,9 +256,9 @@ fn list(options: getopts::Matches) -> i32 { } let mut dir = false; - if p.is_dir() && !options.opt_present("d") { + if p.is_dir() && !options.is_present(options::DIRECTORY) { dir = true; - if options.opt_present("l") && !(options.opt_present("L")) { + if options.is_present(options::LONG) && !options.is_present(options::DEREFERENCE) { if let Ok(md) = p.symlink_metadata() { if md.file_type().is_symlink() && !p.ends_with("/") { dir = false; @@ -202,7 +277,7 @@ fn list(options: getopts::Matches) -> i32 { sort_entries(&mut dirs, &options); for dir in dirs { - if options.free.len() > 1 { + if number_of_locs > 1 { println!("\n{}:", dir.to_string_lossy()); } enter_directory(&dir, &options); @@ -215,10 +290,10 @@ fn list(options: getopts::Matches) -> i32 { } #[cfg(any(unix, target_os = "redox"))] -fn sort_entries(entries: &mut Vec, options: &getopts::Matches) { - let mut reverse = options.opt_present("r"); - if options.opt_present("t") { - if options.opt_present("c") { +fn sort_entries(entries: &mut Vec, options: &clap::ArgMatches) { + let mut reverse = options.is_present(options::REVERSE); + if options.is_present(options::SORT_TIME) { + if options.is_present(options::COLUMNS) { entries.sort_by_key(|k| { Reverse(get_metadata(k, options).map(|md| md.ctime()).unwrap_or(0)) }); @@ -232,10 +307,10 @@ fn sort_entries(entries: &mut Vec, options: &getopts::Matches) { ) }); } - } else if options.opt_present("S") { + } else if options.is_present(options::SORT_SIZE) { entries.sort_by_key(|k| get_metadata(k, options).map(|md| md.size()).unwrap_or(0)); reverse = !reverse; - } else if !options.opt_present("U") { + } else if !options.is_present(options::SORT_NONE) { entries.sort(); } @@ -257,9 +332,9 @@ fn is_hidden(file_path: &DirEntry) -> std::io::Result { } #[cfg(windows)] -fn sort_entries(entries: &mut Vec, options: &getopts::Matches) { - let mut reverse = options.opt_present("r"); - if options.opt_present("t") { +fn sort_entries(entries: &mut Vec, options: &clap::ArgMatches) { + let mut reverse = options.is_present(options::REVERSE); + if options.is_present(options::SORT_TIME) { entries.sort_by_key(|k| { // Newest first Reverse( @@ -268,14 +343,14 @@ fn sort_entries(entries: &mut Vec, options: &getopts::Matches) { .unwrap_or(std::time::UNIX_EPOCH), ) }); - } else if options.opt_present("S") { + } else if options.is_present(options::SORT_SIZE) { entries.sort_by_key(|k| { get_metadata(k, options) .map(|md| md.file_size()) .unwrap_or(0) }); reverse = !reverse; - } else if !options.opt_present("U") { + } else if !options.is_present(options::SORT_NONE) { entries.sort(); } @@ -284,19 +359,22 @@ fn sort_entries(entries: &mut Vec, options: &getopts::Matches) { } } -fn should_display(entry: &DirEntry, options: &getopts::Matches) -> bool { +fn should_display(entry: &DirEntry, options: &clap::ArgMatches) -> bool { let ffi_name = entry.file_name(); let name = ffi_name.to_string_lossy(); - if !options.opt_present("a") && !options.opt_present("A") && is_hidden(entry).unwrap() { + if !options.is_present(options::ALL) + && !options.is_present(options::ALMOST_ALL) + && is_hidden(entry).unwrap() + { return false; } - if options.opt_present("B") && name.ends_with('~') { + if options.is_present(options::IGNORE_BACKUPS) && name.ends_with('~') { return false; } true } -fn enter_directory(dir: &PathBuf, options: &getopts::Matches) { +fn enter_directory(dir: &PathBuf, options: &clap::ArgMatches) { let mut entries: Vec<_> = safe_unwrap!(fs::read_dir(dir).and_then(Iterator::collect)); entries.retain(|e| should_display(e, options)); @@ -304,7 +382,7 @@ fn enter_directory(dir: &PathBuf, options: &getopts::Matches) { let mut entries: Vec<_> = entries.iter().map(DirEntry::path).collect(); sort_entries(&mut entries, options); - if options.opt_present("a") { + if options.is_present(options::ALL) { let mut display_entries = entries.clone(); display_entries.insert(0, dir.join("..")); display_entries.insert(0, dir.join(".")); @@ -313,7 +391,7 @@ fn enter_directory(dir: &PathBuf, options: &getopts::Matches) { display_items(&entries, Some(dir), options); } - if options.opt_present("R") { + if options.is_present(options::RECURSIVE) { for e in entries.iter().filter(|p| p.is_dir()) { println!("\n{}:", e.to_string_lossy()); enter_directory(&e, options); @@ -321,15 +399,15 @@ fn enter_directory(dir: &PathBuf, options: &getopts::Matches) { } } -fn get_metadata(entry: &PathBuf, options: &getopts::Matches) -> std::io::Result { - if options.opt_present("L") { +fn get_metadata(entry: &PathBuf, options: &clap::ArgMatches) -> std::io::Result { + if options.is_present(options::DEREFERENCE) { entry.metadata().or_else(|_| entry.symlink_metadata()) } else { entry.symlink_metadata() } } -fn display_dir_entry_size(entry: &PathBuf, options: &getopts::Matches) -> (usize, usize) { +fn display_dir_entry_size(entry: &PathBuf, options: &clap::ArgMatches) -> (usize, usize) { if let Ok(md) = get_metadata(entry, options) { ( display_symlink_count(&md).len(), @@ -341,17 +419,11 @@ fn display_dir_entry_size(entry: &PathBuf, options: &getopts::Matches) -> (usize } fn pad_left(string: String, count: usize) -> String { - if count > string.len() { - let pad = count - string.len(); - let pad = String::from_utf8(vec![b' '; pad]).unwrap(); - format!("{}{}", pad, string) - } else { - string - } + format!("{:>width$}", string, width = count) } -fn display_items(items: &[PathBuf], strip: Option<&Path>, options: &getopts::Matches) { - if options.opt_present("long") || options.opt_present("numeric-uid-gid") { +fn display_items(items: &[PathBuf], strip: Option<&Path>, options: &clap::ArgMatches) { + if options.is_present(options::LONG) || options.is_present(options::NUMERIC_UID_GID) { let (mut max_links, mut max_size) = (1, 1); for item in items { let (links, size) = display_dir_entry_size(item, options); @@ -362,7 +434,7 @@ fn display_items(items: &[PathBuf], strip: Option<&Path>, options: &getopts::Mat display_item_long(item, strip, max_links, max_size, options); } } else { - if !options.opt_present("1") { + if !options.is_present(options::ONE) { let names = items.iter().filter_map(|i| { let md = get_metadata(i, options); match md { @@ -410,7 +482,7 @@ fn display_item_long( strip: Option<&Path>, max_links: usize, max_size: usize, - options: &getopts::Matches, + options: &clap::ArgMatches, ) { let md = match get_metadata(item, options) { Err(e) => { @@ -436,8 +508,8 @@ fn display_item_long( } #[cfg(unix)] -fn get_inode(metadata: &Metadata, options: &getopts::Matches) -> String { - if options.opt_present("inode") { +fn get_inode(metadata: &Metadata, options: &clap::ArgMatches) -> String { + if options.is_present(options::INODE) { format!("{:8} ", metadata.ino()) } else { "".to_string() @@ -445,7 +517,7 @@ fn get_inode(metadata: &Metadata, options: &getopts::Matches) -> String { } #[cfg(not(unix))] -fn get_inode(_metadata: &Metadata, _options: &getopts::Matches) -> String { +fn get_inode(_metadata: &Metadata, _options: &clap::ArgMatches) -> String { "".to_string() } @@ -455,8 +527,8 @@ fn get_inode(_metadata: &Metadata, _options: &getopts::Matches) -> String { use uucore::entries; #[cfg(unix)] -fn display_uname(metadata: &Metadata, options: &getopts::Matches) -> String { - if options.opt_present("numeric-uid-gid") { +fn display_uname(metadata: &Metadata, options: &clap::ArgMatches) -> String { + if options.is_present(options::NUMERIC_UID_GID) { metadata.uid().to_string() } else { entries::uid2usr(metadata.uid()).unwrap_or_else(|_| metadata.uid().to_string()) @@ -464,8 +536,8 @@ fn display_uname(metadata: &Metadata, options: &getopts::Matches) -> String { } #[cfg(unix)] -fn display_group(metadata: &Metadata, options: &getopts::Matches) -> String { - if options.opt_present("numeric-uid-gid") { +fn display_group(metadata: &Metadata, options: &clap::ArgMatches) -> String { + if options.is_present(options::NUMERIC_UID_GID) { metadata.gid().to_string() } else { entries::gid2grp(metadata.gid()).unwrap_or_else(|_| metadata.gid().to_string()) @@ -474,19 +546,19 @@ fn display_group(metadata: &Metadata, options: &getopts::Matches) -> String { #[cfg(not(unix))] #[allow(unused_variables)] -fn display_uname(metadata: &Metadata, _options: &getopts::Matches) -> String { +fn display_uname(metadata: &Metadata, _options: &clap::ArgMatches) -> String { "somebody".to_string() } #[cfg(not(unix))] #[allow(unused_variables)] -fn display_group(metadata: &Metadata, _options: &getopts::Matches) -> String { +fn display_group(metadata: &Metadata, _options: &clap::ArgMatches) -> String { "somegroup".to_string() } #[cfg(unix)] -fn display_date(metadata: &Metadata, options: &getopts::Matches) -> String { - let secs = if options.opt_present("c") { +fn display_date(metadata: &Metadata, options: &clap::ArgMatches) -> String { + let secs = if options.is_present(options::COLUMNS) { metadata.ctime() } else { metadata.mtime() @@ -497,7 +569,7 @@ fn display_date(metadata: &Metadata, options: &getopts::Matches) -> String { #[cfg(not(unix))] #[allow(unused_variables)] -fn display_date(metadata: &Metadata, options: &getopts::Matches) -> String { +fn display_date(metadata: &Metadata, options: &clap::ArgMatches) -> String { if let Ok(mtime) = metadata.modified() { let time = time::at(Timespec::new( mtime @@ -512,8 +584,10 @@ fn display_date(metadata: &Metadata, options: &getopts::Matches) -> String { } } -fn display_file_size(metadata: &Metadata, options: &getopts::Matches) -> String { - if options.opt_present("human-readable") { +fn display_file_size(metadata: &Metadata, options: &clap::ArgMatches) -> String { + // NOTE: The human-readable behaviour deviates from the GNU ls. + // The GNU ls uses binary prefixes by default. + if options.is_present(options::HUMAN_READABLE) { match NumberPrefix::decimal(metadata.len() as f64) { NumberPrefix::Standalone(bytes) => bytes.to_string(), NumberPrefix::Prefixed(prefix, bytes) => { @@ -551,15 +625,15 @@ fn display_file_name( path: &Path, strip: Option<&Path>, metadata: &Metadata, - options: &getopts::Matches, + options: &clap::ArgMatches, ) -> Cell { let mut name = get_file_name(path, strip); - if !options.opt_present("long") { + if !options.is_present(options::LONG) { name = get_inode(metadata, options) + &name; } - if options.opt_present("classify") { + if options.is_present(options::CLASSIFY) { let file_type = metadata.file_type(); if file_type.is_dir() { name.push('/'); @@ -568,7 +642,7 @@ fn display_file_name( } } - if options.opt_present("long") && metadata.file_type().is_symlink() { + if options.is_present(options::LONG) && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { // We don't bother updating width here because it's not used for long listings let target_name = target.to_string_lossy().to_string(); @@ -613,23 +687,27 @@ fn display_file_name( path: &Path, strip: Option<&Path>, metadata: &Metadata, - options: &getopts::Matches, + options: &clap::ArgMatches, ) -> Cell { let mut name = get_file_name(path, strip); - if !options.opt_present("long") { + if !options.is_present(options::LONG) { name = get_inode(metadata, options) + &name; } let mut width = UnicodeWidthStr::width(&*name); - let color = match options.opt_str("color") { - None => atty::is(atty::Stream::Stdout), - Some(val) => match val.as_ref() { - "always" | "yes" | "force" => true, - "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout), - /* "never" | "no" | "none" | */ _ => false, - }, + let color = if options.is_present(options::COLOR) { + match options.value_of(options::COLOR) { + None => atty::is(atty::Stream::Stdout), + Some(val) => match val { + "" | "always" | "yes" | "force" => true, + "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout), + /* "never" | "no" | "none" | */ _ => false, + }, + } + } else { + false }; - let classify = options.opt_present("classify"); + let classify = options.is_present(options::CLASSIFY); let ext; if color || classify { @@ -693,7 +771,7 @@ fn display_file_name( } } - if options.opt_present("long") && metadata.file_type().is_symlink() { + if options.is_present(options::LONG) && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { // We don't bother updating width here because it's not used for long listings let code = if target.exists() { "fi" } else { "mi" }; From 19b7b09bd7d7f8d9462746746f3fc93661d9b4a3 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 14 Mar 2021 11:09:11 +0100 Subject: [PATCH 405/606] Update cargo.lock (#1819) --- Cargo.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index edddc56e5..ebb288d3d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -342,7 +342,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -357,7 +357,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -557,7 +557,7 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1134,7 +1134,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1190,7 +1190,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1275,7 +1275,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1307,7 +1307,7 @@ dependencies = [ [[package]] name = "typenum" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2036,7 +2036,7 @@ dependencies = [ name = "uu_sleep" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", ] @@ -2340,7 +2340,7 @@ version = "0.0.5" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2387,7 +2387,7 @@ dependencies = [ "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2407,7 +2407,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2617,7 +2617,7 @@ dependencies = [ "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" "checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.63 (registry+https://github.com/rust-lang/crates.io-index)" = "8fd9bc7ccc2688b3344c2f48b9b546648b25ce0b20fc717ee7fa7981a8ca9717" +"checksum syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" "checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" @@ -2629,7 +2629,7 @@ dependencies = [ "checksum thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -"checksum typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" +"checksum typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" "checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" From 7c8e8b2d4cce76b7c3bdddd11a1dcc4b683d6e4e Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 14 Mar 2021 12:22:32 +0100 Subject: [PATCH 406/606] ls: refactor arguments into a config struct --- src/uu/ls/src/ls.rs | 419 ++++++++++++++++++++++++++------------------ 1 file changed, 253 insertions(+), 166 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index ec17ec2b3..d61a45702 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -42,10 +42,7 @@ static ABOUT: &str = " "; fn get_usage() -> String { - format!( - "{0} [OPTION]... [FILE]...", - executable!() - ) + format!("{0} [OPTION]... [FILE]...", executable!()) } #[cfg(unix)] @@ -73,11 +70,10 @@ lazy_static! { } pub mod options { - pub static ONE: &str = "1"; + pub static ONELINE: &str = "1"; pub static ALL: &str = "all"; pub static ALMOST_ALL: &str = "almost-all"; pub static IGNORE_BACKUPS: &str = "ignore-backups"; - pub static COLUMNS: &str = "c"; pub static DIRECTORY: &str = "directory"; pub static CLASSIFY: &str = "classify"; pub static HUMAN_READABLE: &str = "human-readable"; @@ -90,10 +86,128 @@ pub mod options { pub static SORT_SIZE: &str = "S"; pub static SORT_TIME: &str = "t"; pub static SORT_NONE: &str = "U"; + pub static SORT_CTIME: &str = "c"; pub static COLOR: &str = "color"; pub static PATHS: &str = "paths"; } +#[derive(PartialEq, Eq)] +enum DisplayOptions { + Columns, + Long, + OneLine, +} + +enum Sort { + None, + Name, + Size, + Time, + CTime, +} + +enum SizeFormats { + Bytes, + Binary, // Powers of 1024, --human-readable +} + +#[derive(PartialEq, Eq)] +enum Files { + All, + AlmostAll, + Normal, +} + +struct Config { + display: DisplayOptions, + files: Files, + sort: Sort, + + recursive: bool, + reverse: bool, + dereference: bool, + classify: bool, + ignore_backups: bool, + size_format: SizeFormats, + numeric_uid_gid: bool, + directory: bool, + #[cfg(unix)] + inode: bool, + #[cfg(unix)] + color: bool, +} + +impl Config { + fn from(options: clap::ArgMatches) -> Config { + let display = if options.is_present(options::LONG) { + DisplayOptions::Long + } else if options.is_present(options::ONELINE) { + DisplayOptions::OneLine + } else { + DisplayOptions::Columns + }; + + let files = if options.is_present(options::ALL) { + Files::All + } else if options.is_present(options::ALMOST_ALL) { + Files::AlmostAll + } else { + Files::Normal + }; + + let sort = if options.is_present(options::SORT_TIME) { + Sort::Time + } else if options.is_present(options::SORT_CTIME) { + Sort::CTime + } else if options.is_present(options::SORT_SIZE) { + Sort::Size + } else if options.is_present(options::SORT_NONE) { + Sort::None + } else { + Sort::Name + }; + + #[cfg(unix)] + let color = if options.is_present(options::COLOR) { + match options.value_of(options::COLOR) { + None => atty::is(atty::Stream::Stdout), + Some(val) => match val { + "" | "always" | "yes" | "force" => true, + "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout), + /* "never" | "no" | "none" | */ _ => false, + }, + } + } else { + false + }; + + let size_format = if options.is_present(options::HUMAN_READABLE) { + SizeFormats::Binary + } else { + SizeFormats::Bytes + }; + + Config { + display, + files, + sort, + + recursive: options.is_present(options::RECURSIVE), + reverse: options.is_present(options::REVERSE), + dereference: options.is_present(options::DEREFERENCE), + classify: options.is_present(options::CLASSIFY), + ignore_backups: options.is_present(options::IGNORE_BACKUPS), + size_format, + numeric_uid_gid: options.is_present(options::NUMERIC_UID_GID), + directory: options.is_present(options::DIRECTORY), + #[cfg(unix)] + color, + #[cfg(unix)] + inode: options.is_present(options::INODE), + } + } +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); @@ -104,8 +218,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .arg( - Arg::with_name(options::ONE) - .short(options::ONE) + Arg::with_name(options ::ONELINE) + .short(options ::ONELINE) .help("list one file per line."), ) .arg( @@ -130,8 +244,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("Ignore entries which end with ~."), ) .arg( - Arg::with_name(options::COLUMNS) - .short(options::COLUMNS) + Arg::with_name(options::SORT_CTIME) + .short(options::SORT_CTIME) .help("If the long listing format (e.g., -l, -o) is being used, print the status \ change time (the ‘ctime’ in the inode) instead of the modification time. When \ explicitly sorting by time (--sort=time or -t) or when not using a long listing \ @@ -231,15 +345,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)) .get_matches_from(args); - list(matches) -} - -fn list(options: clap::ArgMatches) -> i32 { - let locs: Vec = options + let locs = matches .values_of(options::PATHS) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_else(|| vec![String::from(".")]); + list(locs, Config::from(matches)) +} + +fn list(locs: Vec, config: Config) -> i32 { let number_of_locs = locs.len(); let mut files = Vec::::new(); @@ -256,9 +370,9 @@ fn list(options: clap::ArgMatches) -> i32 { } let mut dir = false; - if p.is_dir() && !options.is_present(options::DIRECTORY) { + if p.is_dir() && !config.directory { dir = true; - if options.is_present(options::LONG) && !options.is_present(options::DEREFERENCE) { + if config.display == DisplayOptions::Long && !config.dereference { if let Ok(md) = p.symlink_metadata() { if md.file_type().is_symlink() && !p.ends_with("/") { dir = false; @@ -272,15 +386,15 @@ fn list(options: clap::ArgMatches) -> i32 { files.push(p); } } - sort_entries(&mut files, &options); - display_items(&files, None, &options); + sort_entries(&mut files, &config); + display_items(&files, None, &config); - sort_entries(&mut dirs, &options); + sort_entries(&mut dirs, &config); for dir in dirs { if number_of_locs > 1 { println!("\n{}:", dir.to_string_lossy()); } - enter_directory(&dir, &options); + enter_directory(&dir, &config); } if has_failed { 1 @@ -290,128 +404,118 @@ fn list(options: clap::ArgMatches) -> i32 { } #[cfg(any(unix, target_os = "redox"))] -fn sort_entries(entries: &mut Vec, options: &clap::ArgMatches) { - let mut reverse = options.is_present(options::REVERSE); - if options.is_present(options::SORT_TIME) { - if options.is_present(options::COLUMNS) { - entries.sort_by_key(|k| { - Reverse(get_metadata(k, options).map(|md| md.ctime()).unwrap_or(0)) - }); - } else { - entries.sort_by_key(|k| { - // Newest first - Reverse( - get_metadata(k, options) - .and_then(|md| md.modified()) - .unwrap_or(std::time::UNIX_EPOCH), - ) - }); - } - } else if options.is_present(options::SORT_SIZE) { - entries.sort_by_key(|k| get_metadata(k, options).map(|md| md.size()).unwrap_or(0)); - reverse = !reverse; - } else if !options.is_present(options::SORT_NONE) { - entries.sort(); - } - - if reverse { - entries.reverse(); - } -} - -#[cfg(windows)] -fn is_hidden(file_path: &DirEntry) -> std::io::Result { - let metadata = fs::metadata(file_path.path())?; - let attr = metadata.file_attributes(); - Ok(((attr & 0x2) > 0) || file_path.file_name().to_string_lossy().starts_with('.')) -} - -#[cfg(unix)] -fn is_hidden(file_path: &DirEntry) -> std::io::Result { - Ok(file_path.file_name().to_string_lossy().starts_with('.')) -} - -#[cfg(windows)] -fn sort_entries(entries: &mut Vec, options: &clap::ArgMatches) { - let mut reverse = options.is_present(options::REVERSE); - if options.is_present(options::SORT_TIME) { - entries.sort_by_key(|k| { - // Newest first +fn sort_entries(entries: &mut Vec, config: &Config) { + match config.sort { + Sort::CTime => entries + .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.ctime()).unwrap_or(0))), + Sort::Time => entries.sort_by_key(|k| { Reverse( - get_metadata(k, options) + get_metadata(k, config) .and_then(|md| md.modified()) .unwrap_or(std::time::UNIX_EPOCH), ) - }); - } else if options.is_present(options::SORT_SIZE) { - entries.sort_by_key(|k| { - get_metadata(k, options) - .map(|md| md.file_size()) - .unwrap_or(0) - }); - reverse = !reverse; - } else if !options.is_present(options::SORT_NONE) { - entries.sort(); + }), + Sort::Size => entries + .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.size()).unwrap_or(0))), + Sort::Name => entries.sort(), + Sort::None => {} } - if reverse { + if config.reverse { entries.reverse(); } } -fn should_display(entry: &DirEntry, options: &clap::ArgMatches) -> bool { +#[cfg(windows)] +fn is_hidden(file_path: &DirEntry) -> bool { + let metadata = fs::metadata(file_path.path()).unwrap(); + let attr = metadata.file_attributes(); + ((attr & 0x2) > 0) || file_path.file_name().to_string_lossy().starts_with('.') +} + +#[cfg(unix)] +fn is_hidden(file_path: &DirEntry) -> bool { + file_path.file_name().to_string_lossy().starts_with('.') +} + +#[cfg(windows)] +fn sort_entries(entries: &mut Vec, config: &Config) { + match config.sort { + Sort::CTime | Sort::Time => entries.sort_by_key(|k| { + // Newest first + Reverse( + get_metadata(k, config) + .and_then(|md| md.modified()) + .unwrap_or(std::time::UNIX_EPOCH), + ) + }), + Sort::Size => entries.sort_by_key(|k| { + // Largest first + Reverse( + get_metadata(k, config) + .map(|md| md.file_size()) + .unwrap_or(0), + ) + }), + Sort::Name => entries.sort(), + Sort::None => {}, + } + + if config.reverse { + entries.reverse(); + } +} + +fn should_display(entry: &DirEntry, config: &Config) -> bool { let ffi_name = entry.file_name(); let name = ffi_name.to_string_lossy(); - if !options.is_present(options::ALL) - && !options.is_present(options::ALMOST_ALL) - && is_hidden(entry).unwrap() - { + if config.files == Files::Normal && is_hidden(entry) { return false; } - if options.is_present(options::IGNORE_BACKUPS) && name.ends_with('~') { + if config.ignore_backups && name.ends_with('~') { return false; } true } -fn enter_directory(dir: &PathBuf, options: &clap::ArgMatches) { +fn enter_directory(dir: &PathBuf, config: &Config) { let mut entries: Vec<_> = safe_unwrap!(fs::read_dir(dir).and_then(Iterator::collect)); - entries.retain(|e| should_display(e, options)); + entries.retain(|e| should_display(e, config)); let mut entries: Vec<_> = entries.iter().map(DirEntry::path).collect(); - sort_entries(&mut entries, options); + sort_entries(&mut entries, config); - if options.is_present(options::ALL) { + if config.files == Files::All { let mut display_entries = entries.clone(); display_entries.insert(0, dir.join("..")); display_entries.insert(0, dir.join(".")); - display_items(&display_entries, Some(dir), options); + display_items(&display_entries, Some(dir), config); } else { - display_items(&entries, Some(dir), options); + display_items(&entries, Some(dir), config); } - if options.is_present(options::RECURSIVE) { + if config.recursive { for e in entries.iter().filter(|p| p.is_dir()) { println!("\n{}:", e.to_string_lossy()); - enter_directory(&e, options); + enter_directory(&e, config); } } } -fn get_metadata(entry: &PathBuf, options: &clap::ArgMatches) -> std::io::Result { - if options.is_present(options::DEREFERENCE) { +fn get_metadata(entry: &PathBuf, config: &Config) -> std::io::Result { + if config.dereference { entry.metadata().or_else(|_| entry.symlink_metadata()) } else { entry.symlink_metadata() } } -fn display_dir_entry_size(entry: &PathBuf, options: &clap::ArgMatches) -> (usize, usize) { - if let Ok(md) = get_metadata(entry, options) { +fn display_dir_entry_size(entry: &PathBuf, config: &Config) -> (usize, usize) { + if let Ok(md) = get_metadata(entry, config) { ( display_symlink_count(&md).len(), - display_file_size(&md, options).len(), + display_file_size(&md, config).len(), ) } else { (0, 0) @@ -422,28 +526,28 @@ fn pad_left(string: String, count: usize) -> String { format!("{:>width$}", string, width = count) } -fn display_items(items: &[PathBuf], strip: Option<&Path>, options: &clap::ArgMatches) { - if options.is_present(options::LONG) || options.is_present(options::NUMERIC_UID_GID) { +fn display_items(items: &[PathBuf], strip: Option<&Path>, config: &Config) { + if config.display == DisplayOptions::Long || config.numeric_uid_gid { let (mut max_links, mut max_size) = (1, 1); for item in items { - let (links, size) = display_dir_entry_size(item, options); + let (links, size) = display_dir_entry_size(item, config); max_links = links.max(max_links); max_size = size.max(max_size); } for item in items { - display_item_long(item, strip, max_links, max_size, options); + display_item_long(item, strip, max_links, max_size, config); } } else { - if !options.is_present(options::ONE) { + if config.display != DisplayOptions::OneLine { let names = items.iter().filter_map(|i| { - let md = get_metadata(i, options); + let md = get_metadata(i, config); match md { Err(e) => { let filename = get_file_name(i, strip); show_error!("'{}': {}", filename, e); None } - Ok(md) => Some(display_file_name(&i, strip, &md, options)), + Ok(md) => Some(display_file_name(&i, strip, &md, config)), } }); @@ -467,9 +571,9 @@ fn display_items(items: &[PathBuf], strip: Option<&Path>, options: &clap::ArgMat // Couldn't display a grid, either because we don't know // the terminal width or because fit_into_width failed for i in items { - let md = get_metadata(i, options); + let md = get_metadata(i, config); if let Ok(md) = md { - println!("{}", display_file_name(&i, strip, &md, options).contents); + println!("{}", display_file_name(&i, strip, &md, config).contents); } } } @@ -482,9 +586,9 @@ fn display_item_long( strip: Option<&Path>, max_links: usize, max_size: usize, - options: &clap::ArgMatches, + config: &Config, ) { - let md = match get_metadata(item, options) { + let md = match get_metadata(item, config) { Err(e) => { let filename = get_file_name(&item, strip); show_error!("{}: {}", filename, e); @@ -495,21 +599,21 @@ fn display_item_long( println!( "{}{}{} {} {} {} {} {} {}", - get_inode(&md, options), + get_inode(&md, config), display_file_type(md.file_type()), display_permissions(&md), pad_left(display_symlink_count(&md), max_links), - display_uname(&md, options), - display_group(&md, options), - pad_left(display_file_size(&md, options), max_size), - display_date(&md, options), - display_file_name(&item, strip, &md, options).contents + display_uname(&md, config), + display_group(&md, config), + pad_left(display_file_size(&md, config), max_size), + display_date(&md, config), + display_file_name(&item, strip, &md, config).contents ); } #[cfg(unix)] -fn get_inode(metadata: &Metadata, options: &clap::ArgMatches) -> String { - if options.is_present(options::INODE) { +fn get_inode(metadata: &Metadata, config: &Config) -> String { + if config.inode { format!("{:8} ", metadata.ino()) } else { "".to_string() @@ -517,7 +621,7 @@ fn get_inode(metadata: &Metadata, options: &clap::ArgMatches) -> String { } #[cfg(not(unix))] -fn get_inode(_metadata: &Metadata, _options: &clap::ArgMatches) -> String { +fn get_inode(_metadata: &Metadata, _config: &Config) -> String { "".to_string() } @@ -527,8 +631,8 @@ fn get_inode(_metadata: &Metadata, _options: &clap::ArgMatches) -> String { use uucore::entries; #[cfg(unix)] -fn display_uname(metadata: &Metadata, options: &clap::ArgMatches) -> String { - if options.is_present(options::NUMERIC_UID_GID) { +fn display_uname(metadata: &Metadata, config: &Config) -> String { + if config.numeric_uid_gid { metadata.uid().to_string() } else { entries::uid2usr(metadata.uid()).unwrap_or_else(|_| metadata.uid().to_string()) @@ -536,8 +640,8 @@ fn display_uname(metadata: &Metadata, options: &clap::ArgMatches) -> String { } #[cfg(unix)] -fn display_group(metadata: &Metadata, options: &clap::ArgMatches) -> String { - if options.is_present(options::NUMERIC_UID_GID) { +fn display_group(metadata: &Metadata, config: &Config) -> String { + if config.numeric_uid_gid { metadata.gid().to_string() } else { entries::gid2grp(metadata.gid()).unwrap_or_else(|_| metadata.gid().to_string()) @@ -545,31 +649,29 @@ fn display_group(metadata: &Metadata, options: &clap::ArgMatches) -> String { } #[cfg(not(unix))] -#[allow(unused_variables)] -fn display_uname(metadata: &Metadata, _options: &clap::ArgMatches) -> String { +fn display_uname(_metadata: &Metadata, _config: &Config) -> String { "somebody".to_string() } #[cfg(not(unix))] #[allow(unused_variables)] -fn display_group(metadata: &Metadata, _options: &clap::ArgMatches) -> String { +fn display_group(_metadata: &Metadata, _config: &Config) -> String { "somegroup".to_string() } #[cfg(unix)] -fn display_date(metadata: &Metadata, options: &clap::ArgMatches) -> String { - let secs = if options.is_present(options::COLUMNS) { - metadata.ctime() - } else { - metadata.mtime() +fn display_date(metadata: &Metadata, config: &Config) -> String { + let secs = match config.sort { + Sort::CTime => metadata.ctime(), + Sort::Time => metadata.mtime(), + _ => 0, }; let time = time::at(Timespec::new(secs, 0)); strftime("%F %R", &time).unwrap() } #[cfg(not(unix))] -#[allow(unused_variables)] -fn display_date(metadata: &Metadata, options: &clap::ArgMatches) -> String { +fn display_date(metadata: &Metadata, _config: &Config) -> String { if let Ok(mtime) = metadata.modified() { let time = time::at(Timespec::new( mtime @@ -584,18 +686,17 @@ fn display_date(metadata: &Metadata, options: &clap::ArgMatches) -> String { } } -fn display_file_size(metadata: &Metadata, options: &clap::ArgMatches) -> String { +fn display_file_size(metadata: &Metadata, config: &Config) -> String { // NOTE: The human-readable behaviour deviates from the GNU ls. // The GNU ls uses binary prefixes by default. - if options.is_present(options::HUMAN_READABLE) { - match NumberPrefix::decimal(metadata.len() as f64) { + match config.size_format { + SizeFormats::Binary => match NumberPrefix::decimal(metadata.len() as f64) { NumberPrefix::Standalone(bytes) => bytes.to_string(), NumberPrefix::Prefixed(prefix, bytes) => { format!("{:.2}{}", bytes, prefix).to_uppercase() } - } - } else { - metadata.len().to_string() + }, + SizeFormats::Bytes => metadata.len().to_string(), } } @@ -625,15 +726,15 @@ fn display_file_name( path: &Path, strip: Option<&Path>, metadata: &Metadata, - options: &clap::ArgMatches, + config: &Config, ) -> Cell { let mut name = get_file_name(path, strip); - if !options.is_present(options::LONG) { - name = get_inode(metadata, options) + &name; + if config.display == DisplayOptions::Long { + name = get_inode(metadata, config) + &name; } - if options.is_present(options::CLASSIFY) { + if config.classify { let file_type = metadata.file_type(); if file_type.is_dir() { name.push('/'); @@ -642,7 +743,7 @@ fn display_file_name( } } - if options.is_present(options::LONG) && metadata.file_type().is_symlink() { + if config.display == DisplayOptions::Long && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { // We don't bother updating width here because it's not used for long listings let target_name = target.to_string_lossy().to_string(); @@ -687,30 +788,17 @@ fn display_file_name( path: &Path, strip: Option<&Path>, metadata: &Metadata, - options: &clap::ArgMatches, + config: &Config, ) -> Cell { let mut name = get_file_name(path, strip); - if !options.is_present(options::LONG) { - name = get_inode(metadata, options) + &name; + if config.display != DisplayOptions::Long { + name = get_inode(metadata, config) + &name; } let mut width = UnicodeWidthStr::width(&*name); - let color = if options.is_present(options::COLOR) { - match options.value_of(options::COLOR) { - None => atty::is(atty::Stream::Stdout), - Some(val) => match val { - "" | "always" | "yes" | "force" => true, - "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout), - /* "never" | "no" | "none" | */ _ => false, - }, - } - } else { - false - }; - let classify = options.is_present(options::CLASSIFY); let ext; - if color || classify { + if config.color || config.classify { let file_type = metadata.file_type(); let (code, sym) = if file_type.is_dir() { @@ -760,10 +848,10 @@ fn display_file_name( ("", None) }; - if color { + if config.color { name = color_name(name, code); } - if classify { + if config.classify { if let Some(s) = sym { name.push(s); width += 1; @@ -771,7 +859,7 @@ fn display_file_name( } } - if options.is_present(options::LONG) && metadata.file_type().is_symlink() { + if config.display == DisplayOptions::Long && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { // We don't bother updating width here because it's not used for long listings let code = if target.exists() { "fi" } else { "mi" }; @@ -788,8 +876,7 @@ fn display_file_name( } #[cfg(not(unix))] -#[allow(unused_variables)] -fn display_symlink_count(metadata: &Metadata) -> String { +fn display_symlink_count(_metadata: &Metadata) -> String { // Currently not sure of how to get this on Windows, so I'm punting. // Git Bash looks like it may do the same thing. String::from("1") From 0717a5f3014b52b862c177222afcd257cbe633f3 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 14 Mar 2021 13:32:15 +0100 Subject: [PATCH 407/606] ls: formatting --- src/uu/ls/src/ls.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index d61a45702..d9bbd0f88 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -122,7 +122,6 @@ struct Config { display: DisplayOptions, files: Files, sort: Sort, - recursive: bool, reverse: bool, dereference: bool, @@ -191,7 +190,7 @@ impl Config { display, files, sort, - + recursive: options.is_present(options::RECURSIVE), reverse: options.is_present(options::REVERSE), dereference: options.is_present(options::DEREFERENCE), @@ -458,7 +457,7 @@ fn sort_entries(entries: &mut Vec, config: &Config) { ) }), Sort::Name => entries.sort(), - Sort::None => {}, + Sort::None => {} } if config.reverse { From 6829e7f359ba93cc5f1d06a0fd164d87a1af0e57 Mon Sep 17 00:00:00 2001 From: Dean Li Date: Sun, 14 Mar 2021 20:39:41 +0800 Subject: [PATCH 408/606] 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 --- src/uu/expand/Cargo.toml | 2 +- src/uu/expand/src/expand.rs | 72 ++++++++++++++++++++----------------- 2 files changed, 41 insertions(+), 33 deletions(-) diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index d9861a0c7..b5c0343e7 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/expand.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" unicode-width = "0.1.5" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index 353c3e6bc..52537dcc2 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -12,19 +12,25 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg, ArgMatches}; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; use std::iter::repeat; use std::str::from_utf8; use unicode_width::UnicodeWidthChar; -static SYNTAX: &str = "[OPTION]... [FILE]..."; -static SUMMARY: &str = "Convert tabs in each FILE to spaces, writing to standard output. +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Convert tabs in each FILE to spaces, writing to standard output. With no FILE, or when FILE is -, read standard input."; + static LONG_HELP: &str = ""; static DEFAULT_TABSTOP: usize = 8; +fn get_usage() -> String { + format!("{0} [OPTION]... [FILE]...", executable!()) +} + fn tabstops_parse(s: String) -> Vec { let words = s.split(','); @@ -58,14 +64,14 @@ struct Options { } impl Options { - fn new(matches: getopts::Matches) -> Options { - let tabstops = match matches.opt_str("t") { + fn new(matches: &ArgMatches) -> Options { + let tabstops = match matches.value_of("tabstops") { + Some(s) => tabstops_parse(s.to_string()), None => vec![DEFAULT_TABSTOP], - Some(s) => tabstops_parse(s), }; - let iflag = matches.opt_present("i"); - let uflag = !matches.opt_present("U"); + let iflag = matches.is_present("iflag"); + let uflag = !matches.is_present("uflag"); // avoid allocations when dumping out long sequences of spaces // by precomputing the longest string of spaces we will ever need @@ -80,10 +86,9 @@ impl Options { .unwrap(); // length of tabstops is guaranteed >= 1 let tspaces = repeat(' ').take(nspaces).collect(); - let files = if matches.free.is_empty() { - vec!["-".to_owned()] - } else { - matches.free + let files: Vec = match matches.values_of("files") { + Some(s) => s.map(|v| v.to_string()).collect(), + None => vec!["-".to_owned()], }; Options { @@ -97,31 +102,34 @@ impl Options { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); - - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optflag("i", "initial", "do not convert tabs after non blanks") - .optopt( - "t", - "tabs", - "have tabs NUMBER characters apart, not 8", - "NUMBER", + let usage = get_usage(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(LONG_HELP) + .arg( + Arg::with_name("iflag") + .long("initial") + .short("i") + .help("do not convert tabs after non blanks"), ) - .optopt( - "t", - "tabs", - "use comma separated list of explicit tab positions", - "LIST", + .arg( + Arg::with_name("tabstops") + .long("tabs") + .short("t") + .value_name("N, LIST") + .takes_value(true) + .help("have tabs N characters apart, not 8 or use comma separated list of explicit tab positions"), ) - .optflag( - "U", - "no-utf8", - "interpret input file as 8-bit ASCII rather than UTF-8", + .arg( + Arg::with_name("uflags").long("no-utf8").short("U").help("interpret input file as 8-bit ASCII rather than UTF-8"), + ).arg( + Arg::with_name("files").multiple(true).hidden(true).takes_value(true) ) - .parse(args); - - expand(Options::new(matches)); + .get_matches_from(args); + expand(Options::new(&matches)); 0 } From d8c3d1d51dd7de9d237364ef931c5a957d4a3974 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 14 Mar 2021 15:32:30 +0000 Subject: [PATCH 409/606] Use system utils --- .github/workflows/GNU.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 4d3e39613..ff88fb5a3 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -90,6 +90,8 @@ jobs: sed -i -e "s|sort |$(which sort) |" tests/ls/hyperlink.sh tests/misc/test-N.sh sed -i -e "s|split |$(which split) |" tests/misc/factor-parallel.sh sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh + sed -i -e "s|dd |$(which dd) |" tests/du/8gb.sh tests/tail-2/big-4gb.sh + sed -i -e "s|id -|$(which id) -|" tests/misc/runcon-no-reorder.sh #Add specific timeout to tests that currently hang to limit time spent waiting sed -i -e "s|seq \\$|$(which timeout) 0.1 seq \$|" tests/misc/seq-precision.sh tests/misc/seq-long-double.sh From 7c219fd128968f786c9806408b5f3bb21c711b48 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 14 Mar 2021 15:34:22 +0000 Subject: [PATCH 410/606] clean up sed commands --- .github/workflows/GNU.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index ff88fb5a3..374160c42 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -60,7 +60,7 @@ jobs: ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" ./configure --quiet --disable-gcc-warnings #Add timeout to to protect against hangs - sed -i -e "s|\"\$@|$(which timeout) 600 \"\$@|" build-aux/test-driver + sed -i "s|\"\$@|$(which timeout) 600 \"\$@|" build-aux/test-driver # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile sed -i 's| tr | /usr/bin/tr |' tests/init.sh @@ -81,21 +81,21 @@ jobs: Makefile # Use the system coreutils where the test fails due to error in a util that is not the one being tested - sed -i -e "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh - sed -i -e "s|ls -|$(which ls) -|" tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh - sed -i -e "s|mkdir |$(which mkdir) |" tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i -e "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh - sed -i -e "s| timeout | $(which timeout) |" tests/tail-2/inotify-rotate.sh # Don't break the function called 'grep_timeout' - sed -i -e "s|chmod |$(which chmod) |" tests/du/inacc-dir.sh tests/mkdir/p-3.sh - sed -i -e "s|sort |$(which sort) |" tests/ls/hyperlink.sh tests/misc/test-N.sh - sed -i -e "s|split |$(which split) |" tests/misc/factor-parallel.sh - sed -i -e "s|truncate |$(which truncate) |" tests/split/fail.sh - sed -i -e "s|dd |$(which dd) |" tests/du/8gb.sh tests/tail-2/big-4gb.sh - sed -i -e "s|id -|$(which id) -|" tests/misc/runcon-no-reorder.sh + sed -i "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh + sed -i "s|ls -|$(which ls) -|" tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh + sed -i "s|mkdir |$(which mkdir) |" tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh + sed -i "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh + sed -i "s| timeout | $(which timeout) |" tests/tail-2/inotify-rotate.sh # Don't break the function called 'grep_timeout' + sed -i "s|chmod |$(which chmod) |" tests/du/inacc-dir.sh tests/mkdir/p-3.sh + sed -i "s|sort |$(which sort) |" tests/ls/hyperlink.sh tests/misc/test-N.sh + sed -i "s|split |$(which split) |" tests/misc/factor-parallel.sh + sed -i "s|truncate |$(which truncate) |" tests/split/fail.sh + sed -i "s|dd |$(which dd) |" tests/du/8gb.sh tests/tail-2/big-4gb.sh + sed -i "s|id -|$(which id) -|" tests/misc/runcon-no-reorder.sh #Add specific timeout to tests that currently hang to limit time spent waiting - sed -i -e "s|seq \\$|$(which timeout) 0.1 seq \$|" tests/misc/seq-precision.sh tests/misc/seq-long-double.sh - sed -i -e "s|cat |$(which timeout) 0.1 cat |" tests/misc/cat-self.sh + sed -i "s|seq \\$|$(which timeout) 0.1 seq \$|" tests/misc/seq-precision.sh tests/misc/seq-long-double.sh + sed -i "s|cat |$(which timeout) 0.1 cat |" tests/misc/cat-self.sh test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" From 570e45649613f0515db32213acf004c7214bd7f9 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 14 Mar 2021 15:59:17 +0000 Subject: [PATCH 411/606] clean up workflow script --- .github/workflows/GNU.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 374160c42..299f333e1 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -34,11 +34,11 @@ jobs: shell: bash run: | sudo apt-get update - sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify expect python3-sphinx + sudo apt-get install autoconf autopoint bison texinfo gperf gcc g++ gdb python-pyinotify python3-sphinx pushd uutils make PROFILE=release BUILDDIR="$PWD/target/release/" - cp ${BUILDDIR}/install ${BUILDDIR}/ginstall # The GNU tests rename this script before running, to avoid confusion with the make target + cp "${BUILDDIR}/install" "${BUILDDIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target # Create *sum binaries for sum in b2sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum do @@ -54,7 +54,7 @@ jobs: for binary in $(./build-aux/gen-lists-of-programs.sh --list-progs) do bin_path="${BUILDDIR}/${binary}" - test -f "${bin_path}" || cp "${BUILDDIR}/false" "${bin_path}" + test -f "${bin_path}" || { echo "'${binary}' was not built with uutils, using the 'false' program"; cp "${BUILDDIR}/false" "${bin_path}"; } done ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" @@ -66,7 +66,7 @@ jobs: sed -i 's| tr | /usr/bin/tr |' tests/init.sh make # Generate the factor tests, so they can be fixed - for i in $(seq -w 0 36) + for i in {00..36} do make tests/factor/t${i}.sh done @@ -106,7 +106,7 @@ jobs: GNULIB_DIR="${PWD}/gnulib" pushd gnu - timeout -sKILL 4h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make + timeout -sKILL 2h make -j "$(nproc)" check SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no || : # Kill after 4 hours in case something gets stuck in make - name: Extract tests info shell: bash run: | From 0ac5dbe44d8d18f274e7a4b365af312e7b02cf27 Mon Sep 17 00:00:00 2001 From: Theophile Trunck Date: Sun, 14 Mar 2021 20:30:53 +0100 Subject: [PATCH 412/606] Add CICD for busytest --- .github/workflows/CICD.yml | 27 +++++++++++++++++++++++++++ GNUmakefile | 2 ++ 2 files changed, 29 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index bdc964c42..97369a8e7 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -154,6 +154,33 @@ jobs: env: RUSTFLAGS: '-Awarnings' + busybox_test: + name: Busybox test suite + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + - { os: ubuntu-latest } + steps: + - uses: actions/checkout@v1 + - name: Install `rust` toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + profile: minimal # minimal component installation (ie, no documentation) + - name: "prepare busytest" + shell: bash + run: | + make prepare-busytest + - name: "run busybox testsuite" + shell: bash + run: | + bindir=$(pwd)/target/debug + cd tmp/busybox-*/testsuite + S=$(bindir=$bindir ./runtest) && printf "%s\n" "$S" || { printf "%s\n" "$S" | grep "FAIL:" | sed -e "s/FAIL: /::warning ::Test failure:/g" ; } + build: name: Build runs-on: ${{ matrix.job.os }} diff --git a/GNUmakefile b/GNUmakefile index 8b8a4cf36..c4c9cbe8b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -279,6 +279,8 @@ $(BUILDDIR)/busybox: busybox-src build-uutils $(BUILDDIR)/.config cp $(BUILDDIR)/coreutils $(BUILDDIR)/busybox; \ chmod +x $@; +prepare-busytest: $(BUILDDIR)/busybox + ifeq ($(EXES),) busytest: else From 5d7a8514715ecc815a777834c37c9a9e81a80b5c Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 14 Mar 2021 21:30:21 +0100 Subject: [PATCH 413/606] ls: fix --color behaviour --- src/uu/ls/src/ls.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index d9bbd0f88..20fffdedc 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -56,7 +56,7 @@ lazy_static! { let codes = LS_COLORS.split(':'); let mut map = HashMap::new(); for c in codes { - let p: Vec<_> = c.splitn(1, '=').collect(); + let p: Vec<_> = c.splitn(2, '=').collect(); if p.len() == 2 { map.insert(p[0], p[1]); } @@ -337,9 +337,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::COLOR) .long(options::COLOR) .help("Color output based on file type.") - .possible_values(&["always", "yes", "force", "tty", "if-tty", "auto", "never", "no", "none"]) + .takes_value(true) .require_equals(true) - .empty_values(true), + .min_values(0), ) .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)) .get_matches_from(args); From c454d2640cfdee55337f0cb128184873e33ff2c3 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 14 Mar 2021 21:32:21 +0100 Subject: [PATCH 414/606] ls: structure options some more --- src/uu/ls/src/ls.rs | 110 +++++++++++++++++++++++++++++++------------- 1 file changed, 77 insertions(+), 33 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 20fffdedc..0d8d9e3c3 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -7,6 +7,45 @@ // spell-checker:ignore (ToDO) cpio svgz webm somegroup nlink rmvb xspf +// Missing features from GNU Coreutils: +// --author +// -b, --escape +// --block-size=SIZE +// -c +// -D, --Dired +// -f +// --file-type +// --format=WORD +// --full-time +// -g +// --group-directories-first +// -G, --no-group +// --si +// -H, --dereference-command-line +// --dereference-command-line-symlink-to-dir +// --hide=PATTERN +// --hyperlink[=WHEN] +// --indicator-style=WORD +// -I, --ignore +// -k, --kibibytes +// -m +// -N, --literal +// -o +// -p, --indicator-style=slash +// -q, --hide-control-chars +// --show-control-chars +// -Q, --quote-name +// --quoting-style=WORD +// --time=WORD +// --time-style=TIME_STYLE +// -T, --tabsize=COLS +// -u +// -v +// -w, --width=COLS +// -x +// -X +// -Z, --context + #[cfg(unix)] #[macro_use] extern crate lazy_static; @@ -70,23 +109,29 @@ lazy_static! { } pub mod options { - pub static ONELINE: &str = "1"; - pub static ALL: &str = "all"; - pub static ALMOST_ALL: &str = "almost-all"; + pub mod display { + pub static ONELINE: &str = "1"; + pub static LONG: &str = "long"; + } + pub mod files { + pub static ALL: &str = "all"; + pub static ALMOST_ALL: &str = "almost-all"; + } + pub mod sort { + pub static SIZE: &str = "S"; + pub static TIME: &str = "t"; + pub static NONE: &str = "U"; + pub static CTIME: &str = "c"; + } pub static IGNORE_BACKUPS: &str = "ignore-backups"; pub static DIRECTORY: &str = "directory"; pub static CLASSIFY: &str = "classify"; pub static HUMAN_READABLE: &str = "human-readable"; pub static INODE: &str = "inode"; pub static DEREFERENCE: &str = "dereference"; - pub static LONG: &str = "long"; pub static NUMERIC_UID_GID: &str = "numeric-uid-gid"; pub static REVERSE: &str = "reverse"; pub static RECURSIVE: &str = "recursive"; - pub static SORT_SIZE: &str = "S"; - pub static SORT_TIME: &str = "t"; - pub static SORT_NONE: &str = "U"; - pub static SORT_CTIME: &str = "c"; pub static COLOR: &str = "color"; pub static PATHS: &str = "paths"; } @@ -138,29 +183,29 @@ struct Config { impl Config { fn from(options: clap::ArgMatches) -> Config { - let display = if options.is_present(options::LONG) { + let display = if options.is_present(options::display::LONG) { DisplayOptions::Long - } else if options.is_present(options::ONELINE) { + } else if options.is_present(options::display::ONELINE) { DisplayOptions::OneLine } else { DisplayOptions::Columns }; - let files = if options.is_present(options::ALL) { + let files = if options.is_present(options::files::ALL) { Files::All - } else if options.is_present(options::ALMOST_ALL) { + } else if options.is_present(options::files::ALMOST_ALL) { Files::AlmostAll } else { Files::Normal }; - let sort = if options.is_present(options::SORT_TIME) { + let sort = if options.is_present(options::sort::TIME) { Sort::Time - } else if options.is_present(options::SORT_CTIME) { + } else if options.is_present(options::sort::CTIME) { Sort::CTime - } else if options.is_present(options::SORT_SIZE) { + } else if options.is_present(options::sort::SIZE) { Sort::Size - } else if options.is_present(options::SORT_NONE) { + } else if options.is_present(options::sort::NONE) { Sort::None } else { Sort::Name @@ -190,7 +235,6 @@ impl Config { display, files, sort, - recursive: options.is_present(options::RECURSIVE), reverse: options.is_present(options::REVERSE), dereference: options.is_present(options::DEREFERENCE), @@ -217,20 +261,20 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .arg( - Arg::with_name(options ::ONELINE) - .short(options ::ONELINE) + Arg::with_name(options::display::ONELINE) + .short(options::display::ONELINE) .help("list one file per line."), ) .arg( - Arg::with_name(options::ALL) + Arg::with_name(options::files::ALL) .short("a") - .long(options::ALL) + .long(options::files::ALL) .help("Do not ignore hidden files (files with names that start with '.')."), ) .arg( - Arg::with_name(options::ALMOST_ALL) + Arg::with_name(options::files::ALMOST_ALL) .short("A") - .long(options::ALMOST_ALL) + .long(options::files::ALMOST_ALL) .help( "In a directory, do not ignore all file names that start with '.', only ignore \ '.' and '..'.", @@ -243,8 +287,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("Ignore entries which end with ~."), ) .arg( - Arg::with_name(options::SORT_CTIME) - .short(options::SORT_CTIME) + Arg::with_name(options::sort::CTIME) + .short(options::sort::CTIME) .help("If the long listing format (e.g., -l, -o) is being used, print the status \ change time (the ‘ctime’ in the inode) instead of the modification time. When \ explicitly sorting by time (--sort=time or -t) or when not using a long listing \ @@ -292,9 +336,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ), ) .arg( - Arg::with_name(options::LONG) + Arg::with_name(options::display::LONG) .short("l") - .long(options::LONG) + .long(options::display::LONG) .help("Display detailed information."), ) .arg( @@ -317,18 +361,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("List the contents of all directories recursively."), ) .arg( - Arg::with_name(options::SORT_SIZE) - .short(options::SORT_SIZE) + Arg::with_name(options::sort::SIZE) + .short(options::sort::SIZE) .help("Sort by file size, largest first."), ) .arg( - Arg::with_name(options::SORT_TIME) - .short(options::SORT_TIME) + Arg::with_name(options::sort::TIME) + .short(options::sort::TIME) .help("Sort by modification time (the 'mtime' in the inode), newest first."), ) .arg( - Arg::with_name(options::SORT_NONE) - .short(options::SORT_NONE) + Arg::with_name(options::sort::NONE) + .short(options::sort::NONE) .help("Do not sort; list the files in whatever order they are stored in the \ directory. This is especially useful when listing very large directories, \ since not doing any sorting can be noticeably faster.", From c86c18cbb54ba33b175729cd362584d9df3b82a9 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 14 Mar 2021 23:11:11 +0100 Subject: [PATCH 415/606] ls: implement -c and -u --- src/uu/ls/src/ls.rs | 90 +++++++++++++++++++++++++++++++-------------- 1 file changed, 63 insertions(+), 27 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 0d8d9e3c3..1719579fc 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -54,7 +54,6 @@ extern crate uucore; use clap::{App, Arg}; use number_prefix::NumberPrefix; -use std::cmp::Reverse; #[cfg(unix)] use std::collections::HashMap; use std::fs; @@ -66,6 +65,10 @@ use std::os::unix::fs::MetadataExt; #[cfg(windows)] use std::os::windows::fs::MetadataExt; use std::path::{Path, PathBuf}; +use std::cmp::Reverse; +#[cfg(not(unix))] +use std::time::{SystemTime, UNIX_EPOCH}; + use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use time::{strftime, Timespec}; #[cfg(unix)] @@ -121,7 +124,10 @@ pub mod options { pub static SIZE: &str = "S"; pub static TIME: &str = "t"; pub static NONE: &str = "U"; - pub static CTIME: &str = "c"; + } + pub mod time { + pub static ACCESS: &str = "u"; + pub static CHANGE: &str = "c"; } pub static IGNORE_BACKUPS: &str = "ignore-backups"; pub static DIRECTORY: &str = "directory"; @@ -148,7 +154,6 @@ enum Sort { Name, Size, Time, - CTime, } enum SizeFormats { @@ -163,6 +168,12 @@ enum Files { Normal, } +enum Time { + Modification, + Access, + Change, +} + struct Config { display: DisplayOptions, files: Files, @@ -175,6 +186,7 @@ struct Config { size_format: SizeFormats, numeric_uid_gid: bool, directory: bool, + time: Time, #[cfg(unix)] inode: bool, #[cfg(unix)] @@ -201,8 +213,6 @@ impl Config { let sort = if options.is_present(options::sort::TIME) { Sort::Time - } else if options.is_present(options::sort::CTIME) { - Sort::CTime } else if options.is_present(options::sort::SIZE) { Sort::Size } else if options.is_present(options::sort::NONE) { @@ -211,6 +221,14 @@ impl Config { Sort::Name }; + let time = if options.is_present(options::time::ACCESS) { + Time::Access + } else if options.is_present(options::time::CHANGE) { + Time::Change + } else { + Time::Modification + }; + #[cfg(unix)] let color = if options.is_present(options::COLOR) { match options.value_of(options::COLOR) { @@ -243,6 +261,7 @@ impl Config { size_format, numeric_uid_gid: options.is_present(options::NUMERIC_UID_GID), directory: options.is_present(options::DIRECTORY), + time, #[cfg(unix)] color, #[cfg(unix)] @@ -287,13 +306,21 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("Ignore entries which end with ~."), ) .arg( - Arg::with_name(options::sort::CTIME) - .short(options::sort::CTIME) - .help("If the long listing format (e.g., -l, -o) is being used, print the status \ + Arg::with_name(options::time::CHANGE) + .short(options::time::CHANGE) + .help("If the long listing format (e.g., -l, -o) is being used, print the status \ change time (the ‘ctime’ in the inode) instead of the modification time. When \ explicitly sorting by time (--sort=time or -t) or when not using a long listing \ format, sort according to the status change time.", )) + .arg( + Arg::with_name(options::time::ACCESS) + .short(options::time::ACCESS) + .help("If the long listing format (e.g., -l, -o) is being used, print the status \ + access time instead of the modification time. When explicitly sorting by time \ + (--sort=time or -t) or when not using a long listing format, sort according to the \ + status change time.") + ) .arg( Arg::with_name(options::DIRECTORY) .short("d") @@ -449,13 +476,11 @@ fn list(locs: Vec, config: Config) -> i32 { #[cfg(any(unix, target_os = "redox"))] fn sort_entries(entries: &mut Vec, config: &Config) { match config.sort { - Sort::CTime => entries - .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.ctime()).unwrap_or(0))), Sort::Time => entries.sort_by_key(|k| { Reverse( get_metadata(k, config) - .and_then(|md| md.modified()) - .unwrap_or(std::time::UNIX_EPOCH), + .map(|md| get_time(&md, config)) + .unwrap_or(0), ) }), Sort::Size => entries @@ -484,13 +509,9 @@ fn is_hidden(file_path: &DirEntry) -> bool { #[cfg(windows)] fn sort_entries(entries: &mut Vec, config: &Config) { match config.sort { - Sort::CTime | Sort::Time => entries.sort_by_key(|k| { + Sort::Time => entries.sort_by_key(|k| { // Newest first - Reverse( - get_metadata(k, config) - .and_then(|md| md.modified()) - .unwrap_or(std::time::UNIX_EPOCH), - ) + Reverse(get_time(get_metadata(k, config), config).unwrap_or(std::time::UNIX_EPOCH)) }), Sort::Size => entries.sort_by_key(|k| { // Largest first @@ -702,23 +723,38 @@ fn display_group(_metadata: &Metadata, _config: &Config) -> String { "somegroup".to_string() } +// The implementations for get_time are separated because some options, such +// as ctime will not be available +#[cfg(unix)] +fn get_time(md: &Metadata, config: &Config) -> i64 { + match config.time { + Time::Change => md.ctime(), + Time::Modification => md.mtime(), + Time::Access => md.atime(), + } +} + +#[cfg(not(unix))] +fn get_time(md: &Metadata, config: &Config) -> Option { + match config.time { + Time::Modification => md.modification().ok(), + Time::Access => md.access().ok(), + _ => None, + } +} + #[cfg(unix)] fn display_date(metadata: &Metadata, config: &Config) -> String { - let secs = match config.sort { - Sort::CTime => metadata.ctime(), - Sort::Time => metadata.mtime(), - _ => 0, - }; + let secs = get_time(metadata, config); let time = time::at(Timespec::new(secs, 0)); strftime("%F %R", &time).unwrap() } #[cfg(not(unix))] -fn display_date(metadata: &Metadata, _config: &Config) -> String { - if let Ok(mtime) = metadata.modified() { +fn display_date(metadata: &Metadata, config: &Config) -> String { + if let Some(time) = get_time(metadata, config) { let time = time::at(Timespec::new( - mtime - .duration_since(std::time::UNIX_EPOCH) + time.duration_since(std::time::UNIX_EPOCH) .unwrap() .as_secs() as i64, 0, From 7bde2e78a97ddc8d390c8391457db8a015b92c08 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 14 Mar 2021 23:34:52 +0100 Subject: [PATCH 416/606] ls: simplify --color and remove it on windows --- src/uu/ls/src/ls.rs | 46 +++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 1719579fc..6f74d459b 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -138,6 +138,7 @@ pub mod options { pub static NUMERIC_UID_GID: &str = "numeric-uid-gid"; pub static REVERSE: &str = "reverse"; pub static RECURSIVE: &str = "recursive"; + #[cfg(unix)] pub static COLOR: &str = "color"; pub static PATHS: &str = "paths"; } @@ -230,17 +231,13 @@ impl Config { }; #[cfg(unix)] - let color = if options.is_present(options::COLOR) { - match options.value_of(options::COLOR) { - None => atty::is(atty::Stream::Stdout), - Some(val) => match val { - "" | "always" | "yes" | "force" => true, - "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout), - /* "never" | "no" | "none" | */ _ => false, - }, - } - } else { - false + let color = match options.value_of(options::COLOR) { + None => options.is_present(options::COLOR), + Some(val) => match val { + "" | "always" | "yes" | "force" => true, + "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout), + /* "never" | "no" | "none" | */ _ => false, + }, }; let size_format = if options.is_present(options::HUMAN_READABLE) { @@ -275,7 +272,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let matches = App::new(executable!()) + let mut app = App::new(executable!()) .version(VERSION) .about(ABOUT) .usage(&usage[..]) @@ -319,7 +316,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("If the long listing format (e.g., -l, -o) is being used, print the status \ access time instead of the modification time. When explicitly sorting by time \ (--sort=time or -t) or when not using a long listing format, sort according to the \ - status change time.") + access time.") ) .arg( Arg::with_name(options::DIRECTORY) @@ -404,16 +401,21 @@ pub fn uumain(args: impl uucore::Args) -> i32 { directory. This is especially useful when listing very large directories, \ since not doing any sorting can be noticeably faster.", )) - .arg( + .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)); + + #[cfg(unix)] + { + app = app.arg( Arg::with_name(options::COLOR) - .long(options::COLOR) - .help("Color output based on file type.") - .takes_value(true) - .require_equals(true) - .min_values(0), - ) - .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)) - .get_matches_from(args); + .long(options::COLOR) + .help("Color output based on file type.") + .takes_value(true) + .require_equals(true) + .min_values(0), + ); + } + + let matches = app.get_matches_from(args); let locs = matches .values_of(options::PATHS) From 61a95239cee641da0dbb9993378d458588bc4296 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 09:30:50 +0100 Subject: [PATCH 417/606] ls: rename display to format, set arg overrides --- src/uu/ls/src/ls.rs | 212 +++++++++++++++++++++++++++++++------------- 1 file changed, 152 insertions(+), 60 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 6f74d459b..69d1e251d 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -112,9 +112,10 @@ lazy_static! { } pub mod options { - pub mod display { + pub mod format { pub static ONELINE: &str = "1"; pub static LONG: &str = "long"; + pub static COLUMNS: &str = "C"; } pub mod files { pub static ALL: &str = "all"; @@ -129,6 +130,9 @@ pub mod options { pub static ACCESS: &str = "u"; pub static CHANGE: &str = "c"; } + pub static FORMAT: &str = "format"; + pub static SORT: &str = "sort"; + pub static TIME: &str = "time"; pub static IGNORE_BACKUPS: &str = "ignore-backups"; pub static DIRECTORY: &str = "directory"; pub static CLASSIFY: &str = "classify"; @@ -144,7 +148,7 @@ pub mod options { } #[derive(PartialEq, Eq)] -enum DisplayOptions { +enum Format { Columns, Long, OneLine, @@ -176,7 +180,7 @@ enum Time { } struct Config { - display: DisplayOptions, + format: Format, files: Files, sort: Sort, recursive: bool, @@ -196,12 +200,22 @@ struct Config { impl Config { fn from(options: clap::ArgMatches) -> Config { - let display = if options.is_present(options::display::LONG) { - DisplayOptions::Long - } else if options.is_present(options::display::ONELINE) { - DisplayOptions::OneLine + let format = if let Some(format_) = options.value_of(options::FORMAT) { + match format_ { + "long" | "verbose" => Format::Long, + "single-column" => Format::OneLine, + "columns" => Format::Columns, + // below should never happen as clap already restricts the values. + _ => panic!("Invalid field for --format") + } + } else if options.is_present(options::format::LONG) { + Format::Long + } else if options.is_present(options::format::ONELINE) { + Format::OneLine + } else if options.is_present(options::format::COLUMNS) { + Format::Columns } else { - DisplayOptions::Columns + Format::Columns }; let files = if options.is_present(options::files::ALL) { @@ -212,7 +226,16 @@ impl Config { Files::Normal }; - let sort = if options.is_present(options::sort::TIME) { + let sort = if let Some(field) = options.value_of(options::SORT) { + match field { + "none" => Sort::None, + "name" => Sort::Name, + "time" => Sort::Time, + "size" => Sort::Size, + // below should never happen as clap already restricts the values. + _ => panic!("Invalid field for --sort") + } + } else if options.is_present(options::sort::TIME) { Sort::Time } else if options.is_present(options::sort::SIZE) { Sort::Size @@ -222,7 +245,14 @@ impl Config { Sort::Name }; - let time = if options.is_present(options::time::ACCESS) { + let time = if let Some(field) = options.value_of(options::TIME) { + match field { + "ctime" | "status" => Time::Change, + "access" | "atime" | "use" => Time::Access, + // below should never happen as clap already restricts the values. + _ => panic!("Invalid field for --time") + } + } else if options.is_present(options::time::ACCESS) { Time::Access } else if options.is_present(options::time::CHANGE) { Time::Change @@ -247,7 +277,7 @@ impl Config { }; Config { - display, + format, files, sort, recursive: options.is_present(options::RECURSIVE), @@ -276,11 +306,110 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .version(VERSION) .about(ABOUT) .usage(&usage[..]) + + // Format arguments .arg( - Arg::with_name(options::display::ONELINE) - .short(options::display::ONELINE) - .help("list one file per line."), + Arg::with_name(options::FORMAT) + .long(options::FORMAT) + .help("Set the display format.") + .takes_value(true) + .possible_values(&["long", "verbose", "single-column", "columns"]) + .hide_possible_values(true) + .require_equals(true) + .overrides_with_all(&[ + options::FORMAT, + options::format::COLUMNS, + options::format::ONELINE, + options::format::LONG, + ]), ) + .arg( + Arg::with_name(options::format::COLUMNS) + .short(options::format::COLUMNS) + .help("Display the files in columns.") + ) + .arg( + Arg::with_name(options::format::ONELINE) + .short(options::format::ONELINE) + .help("List one file per line.") + ) + .arg( + Arg::with_name(options::format::LONG) + .short("l") + .long(options::format::LONG) + .help("Display detailed information.") + ) + + // Time arguments + .arg( + Arg::with_name(options::TIME) + .long(options::TIME) + .help("Show time in :\n\ + \taccess time (-u): atime, access, use;\n\ + \tchange time (-t): ctime, status.") + .value_name("field") + .takes_value(true) + .possible_values(&["atime", "access", "use", "ctime", "status"]) + .hide_possible_values(true) + .require_equals(true) + .overrides_with_all(&[ + options::TIME, + options::time::ACCESS, + options::time::CHANGE, + ]) + ) + .arg( + Arg::with_name(options::time::CHANGE) + .short(options::time::CHANGE) + .help("If the long listing format (e.g., -l, -o) is being used, print the status \ + change time (the ‘ctime’ in the inode) instead of the modification time. When \ + explicitly sorting by time (--sort=time or -t) or when not using a long listing \ + format, sort according to the status change time.", + )) + .arg( + Arg::with_name(options::time::ACCESS) + .short(options::time::ACCESS) + .help("If the long listing format (e.g., -l, -o) is being used, print the status \ + access time instead of the modification time. When explicitly sorting by time \ + (--sort=time or -t) or when not using a long listing format, sort according to the \ + access time.") + ) + + // Sort arguments + .arg( + Arg::with_name(options::SORT) + .long(options::SORT) + .help("Sort by : name, none (-U), time (-t) or size (-S)") + .value_name("field") + .takes_value(true) + .possible_values(&["name", "none", "time", "size"]) + .require_equals(true) + .overrides_with_all(&[ + options::SORT, + options::sort::SIZE, + options::sort::TIME, + options::sort::NONE, + ]) + ) + .arg( + Arg::with_name(options::sort::SIZE) + .short(options::sort::SIZE) + .help("Sort by file size, largest first."), + ) + .arg( + Arg::with_name(options::sort::TIME) + .short(options::sort::TIME) + .help("Sort by modification time (the 'mtime' in the inode), newest first."), + ) + .arg( + Arg::with_name(options::sort::NONE) + .short(options::sort::NONE) + .help("Do not sort; list the files in whatever order they are stored in the \ + directory. This is especially useful when listing very large directories, \ + since not doing any sorting can be noticeably faster.") + ) + + // Other Flags .arg( Arg::with_name(options::files::ALL) .short("a") @@ -302,22 +431,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::IGNORE_BACKUPS) .help("Ignore entries which end with ~."), ) - .arg( - Arg::with_name(options::time::CHANGE) - .short(options::time::CHANGE) - .help("If the long listing format (e.g., -l, -o) is being used, print the status \ - change time (the ‘ctime’ in the inode) instead of the modification time. When \ - explicitly sorting by time (--sort=time or -t) or when not using a long listing \ - format, sort according to the status change time.", - )) - .arg( - Arg::with_name(options::time::ACCESS) - .short(options::time::ACCESS) - .help("If the long listing format (e.g., -l, -o) is being used, print the status \ - access time instead of the modification time. When explicitly sorting by time \ - (--sort=time or -t) or when not using a long listing format, sort according to the \ - access time.") - ) .arg( Arg::with_name(options::DIRECTORY) .short("d") @@ -359,12 +472,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { file the link references rather than the link itself.", ), ) - .arg( - Arg::with_name(options::display::LONG) - .short("l") - .long(options::display::LONG) - .help("Display detailed information."), - ) .arg( Arg::with_name(options::NUMERIC_UID_GID) .short("n") @@ -384,23 +491,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::RECURSIVE) .help("List the contents of all directories recursively."), ) - .arg( - Arg::with_name(options::sort::SIZE) - .short(options::sort::SIZE) - .help("Sort by file size, largest first."), - ) - .arg( - Arg::with_name(options::sort::TIME) - .short(options::sort::TIME) - .help("Sort by modification time (the 'mtime' in the inode), newest first."), - ) - .arg( - Arg::with_name(options::sort::NONE) - .short(options::sort::NONE) - .help("Do not sort; list the files in whatever order they are stored in the \ - directory. This is especially useful when listing very large directories, \ - since not doing any sorting can be noticeably faster.", - )) + + // Positional arguments .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)); #[cfg(unix)] @@ -444,7 +536,7 @@ fn list(locs: Vec, config: Config) -> i32 { if p.is_dir() && !config.directory { dir = true; - if config.display == DisplayOptions::Long && !config.dereference { + if config.format == Format::Long && !config.dereference { if let Ok(md) = p.symlink_metadata() { if md.file_type().is_symlink() && !p.ends_with("/") { dir = false; @@ -593,7 +685,7 @@ fn pad_left(string: String, count: usize) -> String { } fn display_items(items: &[PathBuf], strip: Option<&Path>, config: &Config) { - if config.display == DisplayOptions::Long || config.numeric_uid_gid { + if config.format == Format::Long || config.numeric_uid_gid { let (mut max_links, mut max_size) = (1, 1); for item in items { let (links, size) = display_dir_entry_size(item, config); @@ -604,7 +696,7 @@ fn display_items(items: &[PathBuf], strip: Option<&Path>, config: &Config) { display_item_long(item, strip, max_links, max_size, config); } } else { - if config.display != DisplayOptions::OneLine { + if config.format != Format::OneLine { let names = items.iter().filter_map(|i| { let md = get_metadata(i, config); match md { @@ -811,7 +903,7 @@ fn display_file_name( ) -> Cell { let mut name = get_file_name(path, strip); - if config.display == DisplayOptions::Long { + if config.format == Format::Long { name = get_inode(metadata, config) + &name; } @@ -824,7 +916,7 @@ fn display_file_name( } } - if config.display == DisplayOptions::Long && metadata.file_type().is_symlink() { + if config.format == Format::Long && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { // We don't bother updating width here because it's not used for long listings let target_name = target.to_string_lossy().to_string(); @@ -872,7 +964,7 @@ fn display_file_name( config: &Config, ) -> Cell { let mut name = get_file_name(path, strip); - if config.display != DisplayOptions::Long { + if config.format != Format::Long { name = get_inode(metadata, config) + &name; } let mut width = UnicodeWidthStr::width(&*name); @@ -940,7 +1032,7 @@ fn display_file_name( } } - if config.display == DisplayOptions::Long && metadata.file_type().is_symlink() { + if config.format == Format::Long && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { // We don't bother updating width here because it's not used for long listings let code = if target.exists() { "fi" } else { "mi" }; From 5656a717c9f7445ea9b2695255e47e449aa2d183 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 09:31:13 +0100 Subject: [PATCH 418/606] ls: make name sort case insensitive --- src/uu/ls/src/ls.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 69d1e251d..7e98a7fd3 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -579,7 +579,8 @@ fn sort_entries(entries: &mut Vec, config: &Config) { }), Sort::Size => entries .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.size()).unwrap_or(0))), - Sort::Name => entries.sort(), + // The default sort in GNU ls is case insensitive + Sort::Name => entries.sort_by_key(|k| k.to_string_lossy().to_lowercase()), Sort::None => {} } From 01fd207c81dc09b7efc7cff411b345c5441b98d4 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 09:53:19 +0100 Subject: [PATCH 419/606] ls: remove list of missing features --- src/uu/ls/src/ls.rs | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 7e98a7fd3..c2d544a2c 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -7,45 +7,6 @@ // spell-checker:ignore (ToDO) cpio svgz webm somegroup nlink rmvb xspf -// Missing features from GNU Coreutils: -// --author -// -b, --escape -// --block-size=SIZE -// -c -// -D, --Dired -// -f -// --file-type -// --format=WORD -// --full-time -// -g -// --group-directories-first -// -G, --no-group -// --si -// -H, --dereference-command-line -// --dereference-command-line-symlink-to-dir -// --hide=PATTERN -// --hyperlink[=WHEN] -// --indicator-style=WORD -// -I, --ignore -// -k, --kibibytes -// -m -// -N, --literal -// -o -// -p, --indicator-style=slash -// -q, --hide-control-chars -// --show-control-chars -// -Q, --quote-name -// --quoting-style=WORD -// --time=WORD -// --time-style=TIME_STYLE -// -T, --tabsize=COLS -// -u -// -v -// -w, --width=COLS -// -x -// -X -// -Z, --context - #[cfg(unix)] #[macro_use] extern crate lazy_static; From 15db3c99c4b5f8e805fc6f4619df7e8324890326 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 15 Mar 2021 10:03:34 +0100 Subject: [PATCH 420/606] README.md: add the crates.io badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7dae0b5ef..3bd6693c0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ uutils coreutils ================ +[![Crates.io](https://img.shields.io/crates/v/coreutils.svg)](https://crates.io/crates/coreutils) [![Discord](https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat)](https://discord.gg/wQVJbvJ) [![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/uutils/coreutils/blob/master/LICENSE) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fuutils%2Fcoreutils.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fuutils%2Fcoreutils?ref=badge_shield) From 4574b2b58dbac74a4e817e07c3d85a6876998eed Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 15 Mar 2021 10:24:16 +0100 Subject: [PATCH 421/606] README.md: remove broken information --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 3bd6693c0..9d25a1120 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,10 @@ uutils coreutils [![Crates.io](https://img.shields.io/crates/v/coreutils.svg)](https://crates.io/crates/coreutils) [![Discord](https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat)](https://discord.gg/wQVJbvJ) [![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/uutils/coreutils/blob/master/LICENSE) -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fuutils%2Fcoreutils.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fuutils%2Fcoreutils?ref=badge_shield) [![LOC](https://tokei.rs/b1/github/uutils/coreutils?category=code)](https://github.com/Aaronepower/tokei) [![dependency status](https://deps.rs/repo/github/uutils/coreutils/status.svg)](https://deps.rs/repo/github/uutils/coreutils) [![Build Status](https://api.travis-ci.org/uutils/coreutils.svg?branch=master)](https://travis-ci.org/uutils/coreutils) -[![Build Status (Windows)](https://ci.appveyor.com/api/projects/status/787ltcxgy86r20le?svg=true)](https://ci.appveyor.com/project/Arcterus/coreutils) [![Build Status (FreeBSD)](https://api.cirrus-ci.com/github/uutils/coreutils.svg)](https://cirrus-ci.com/github/uutils/coreutils/master) [![codecov](https://codecov.io/gh/uutils/coreutils/branch/master/graph/badge.svg)](https://codecov.io/gh/uutils/coreutils) @@ -382,5 +380,3 @@ License uutils is licensed under the MIT License - see the `LICENSE` file for details GNU Coreutils is licensed under the GPL 3.0 or later. - -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fuutils%2Fcoreutils.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fuutils%2Fcoreutils?ref=badge_large) From a4c79c92ae3172164a5adb8a1badaedf82a7f3de Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 10:24:24 +0100 Subject: [PATCH 422/606] ls: fix windows issues --- src/uu/ls/src/ls.rs | 109 +++++++++++++++----------------------------- 1 file changed, 38 insertions(+), 71 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index c2d544a2c..187b39006 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -15,6 +15,7 @@ extern crate uucore; use clap::{App, Arg}; use number_prefix::NumberPrefix; +use std::cmp::Reverse; #[cfg(unix)] use std::collections::HashMap; use std::fs; @@ -26,9 +27,6 @@ use std::os::unix::fs::MetadataExt; #[cfg(windows)] use std::os::windows::fs::MetadataExt; use std::path::{Path, PathBuf}; -use std::cmp::Reverse; -#[cfg(not(unix))] -use std::time::{SystemTime, UNIX_EPOCH}; use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use time::{strftime, Timespec}; @@ -167,7 +165,7 @@ impl Config { "single-column" => Format::OneLine, "columns" => Format::Columns, // below should never happen as clap already restricts the values. - _ => panic!("Invalid field for --format") + _ => panic!("Invalid field for --format"), } } else if options.is_present(options::format::LONG) { Format::Long @@ -194,7 +192,7 @@ impl Config { "time" => Sort::Time, "size" => Sort::Size, // below should never happen as clap already restricts the values. - _ => panic!("Invalid field for --sort") + _ => panic!("Invalid field for --sort"), } } else if options.is_present(options::sort::TIME) { Sort::Time @@ -211,7 +209,7 @@ impl Config { "ctime" | "status" => Time::Change, "access" | "atime" | "use" => Time::Access, // below should never happen as clap already restricts the values. - _ => panic!("Invalid field for --time") + _ => panic!("Invalid field for --time"), } } else if options.is_present(options::time::ACCESS) { Time::Access @@ -263,7 +261,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); - let mut app = App::new(executable!()) + let app = App::new(executable!()) .version(VERSION) .about(ABOUT) .usage(&usage[..]) @@ -455,18 +453,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // Positional arguments .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)); - + #[cfg(unix)] - { - app = app.arg( + let app = { + app.arg( Arg::with_name(options::COLOR) - .long(options::COLOR) - .help("Color output based on file type.") - .takes_value(true) - .require_equals(true) - .min_values(0), - ); - } + .long(options::COLOR) + .help("Color output based on file type.") + .takes_value(true) + .require_equals(true) + .min_values(0), + ) + }; let matches = app.get_matches_from(args); @@ -528,18 +526,18 @@ fn list(locs: Vec, config: Config) -> i32 { } } -#[cfg(any(unix, target_os = "redox"))] fn sort_entries(entries: &mut Vec, config: &Config) { match config.sort { Sort::Time => entries.sort_by_key(|k| { Reverse( get_metadata(k, config) - .map(|md| get_time(&md, config)) + .ok() + .and_then(|md| get_time(&md, config)) .unwrap_or(0), ) }), Sort::Size => entries - .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.size()).unwrap_or(0))), + .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.len()).unwrap_or(0))), // The default sort in GNU ls is case insensitive Sort::Name => entries.sort_by_key(|k| k.to_string_lossy().to_lowercase()), Sort::None => {} @@ -562,30 +560,6 @@ fn is_hidden(file_path: &DirEntry) -> bool { file_path.file_name().to_string_lossy().starts_with('.') } -#[cfg(windows)] -fn sort_entries(entries: &mut Vec, config: &Config) { - match config.sort { - Sort::Time => entries.sort_by_key(|k| { - // Newest first - Reverse(get_time(get_metadata(k, config), config).unwrap_or(std::time::UNIX_EPOCH)) - }), - Sort::Size => entries.sort_by_key(|k| { - // Largest first - Reverse( - get_metadata(k, config) - .map(|md| md.file_size()) - .unwrap_or(0), - ) - }), - Sort::Name => entries.sort(), - Sort::None => {} - } - - if config.reverse { - entries.reverse(); - } -} - fn should_display(entry: &DirEntry, config: &Config) -> bool { let ffi_name = entry.file_name(); let name = ffi_name.to_string_lossy(); @@ -782,42 +756,35 @@ fn display_group(_metadata: &Metadata, _config: &Config) -> String { // The implementations for get_time are separated because some options, such // as ctime will not be available #[cfg(unix)] -fn get_time(md: &Metadata, config: &Config) -> i64 { - match config.time { +fn get_time(md: &Metadata, config: &Config) -> Option { + Some(match config.time { Time::Change => md.ctime(), Time::Modification => md.mtime(), Time::Access => md.atime(), - } + }) } #[cfg(not(unix))] -fn get_time(md: &Metadata, config: &Config) -> Option { - match config.time { - Time::Modification => md.modification().ok(), - Time::Access => md.access().ok(), - _ => None, - } +fn get_time(md: &Metadata, config: &Config) -> Option { + let time = match config.time { + Time::Modification => md.modified().ok()?, + Time::Access => md.accessed().ok()?, + _ => return None, + }; + Some( + time.duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_secs() as i64, + ) } -#[cfg(unix)] fn display_date(metadata: &Metadata, config: &Config) -> String { - let secs = get_time(metadata, config); - let time = time::at(Timespec::new(secs, 0)); - strftime("%F %R", &time).unwrap() -} - -#[cfg(not(unix))] -fn display_date(metadata: &Metadata, config: &Config) -> String { - if let Some(time) = get_time(metadata, config) { - let time = time::at(Timespec::new( - time.duration_since(std::time::UNIX_EPOCH) - .unwrap() - .as_secs() as i64, - 0, - )); - strftime("%F %R", &time).unwrap() - } else { - "???".to_string() + match get_time(metadata, config) { + Some(secs) => { + let time = time::at(Timespec::new(secs, 0)); + strftime("%F %R", &time).unwrap() + } + None => "???".into(), } } From f28d5f4a73c19775c3892d09c808aa4a98f473c7 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 12:07:10 +0100 Subject: [PATCH 423/606] ls: attempt to fix windows sorting issues --- src/uu/ls/src/ls.rs | 48 +++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 187b39006..90e4e2b22 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -27,6 +27,7 @@ use std::os::unix::fs::MetadataExt; #[cfg(windows)] use std::os::windows::fs::MetadataExt; use std::path::{Path, PathBuf}; +use std::time::{Duration, SystemTime, UNIX_EPOCH}; use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use time::{strftime, Timespec}; @@ -532,8 +533,8 @@ fn sort_entries(entries: &mut Vec, config: &Config) { Reverse( get_metadata(k, config) .ok() - .and_then(|md| get_time(&md, config)) - .unwrap_or(0), + .and_then(|md| get_system_time(&md, config)) + .unwrap_or(UNIX_EPOCH), ) }), Sort::Size => entries @@ -756,34 +757,35 @@ fn display_group(_metadata: &Metadata, _config: &Config) -> String { // The implementations for get_time are separated because some options, such // as ctime will not be available #[cfg(unix)] -fn get_time(md: &Metadata, config: &Config) -> Option { - Some(match config.time { - Time::Change => md.ctime(), - Time::Modification => md.mtime(), - Time::Access => md.atime(), - }) +fn get_system_time(md: &Metadata, config: &Config) -> Option { + match config.time { + Time::Change => Some(UNIX_EPOCH + Duration::new(md.ctime() as u64, md.ctime_nsec() as u32)), + Time::Modification => md.modified().ok(), + Time::Access => md.accessed().ok(), + } } #[cfg(not(unix))] -fn get_time(md: &Metadata, config: &Config) -> Option { - let time = match config.time { - Time::Modification => md.modified().ok()?, - Time::Access => md.accessed().ok()?, - _ => return None, - }; - Some( - time.duration_since(std::time::UNIX_EPOCH) - .unwrap() - .as_secs() as i64, - ) +fn get_system_time(md: &Metadata, config: &Config) -> Option { + match config.time { + Time::Modification => md.modified().ok(), + Time::Access => md.accessed().ok(), + _ => None, + } +} + +fn get_time(md: &Metadata, config: &Config) -> Option { + let duration = get_system_time(md, config)? + .duration_since(UNIX_EPOCH) + .ok()?; + let secs = duration.as_secs() as i64; + let nsec = duration.subsec_nanos() as i32; + Some(time::at(Timespec::new(secs, nsec))) } fn display_date(metadata: &Metadata, config: &Config) -> String { match get_time(metadata, config) { - Some(secs) => { - let time = time::at(Timespec::new(secs, 0)); - strftime("%F %R", &time).unwrap() - } + Some(time) => strftime("%F %R", &time).unwrap(), None => "???".into(), } } From 20094127c3cbe6e74dc77ed75c81944716a5c761 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 12:21:08 +0100 Subject: [PATCH 424/606] ls: --color back on windows as noop --- src/uu/ls/src/ls.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 90e4e2b22..24adaa649 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -102,7 +102,6 @@ pub mod options { pub static NUMERIC_UID_GID: &str = "numeric-uid-gid"; pub static REVERSE: &str = "reverse"; pub static RECURSIVE: &str = "recursive"; - #[cfg(unix)] pub static COLOR: &str = "color"; pub static PATHS: &str = "paths"; } @@ -451,13 +450,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::RECURSIVE) .help("List the contents of all directories recursively."), ) - - // Positional arguments - .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)); - - #[cfg(unix)] - let app = { - app.arg( + .arg( Arg::with_name(options::COLOR) .long(options::COLOR) .help("Color output based on file type.") @@ -465,7 +458,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .require_equals(true) .min_values(0), ) - }; + + // Positional arguments + .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)); let matches = app.get_matches_from(args); From 10135dccef1d3c0844963831acadf1127dbdfb17 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 13:46:21 +0100 Subject: [PATCH 425/606] ls: fix unused import and improve coverage --- src/uu/ls/src/ls.rs | 10 +-- tests/by-util/test_ls.rs | 127 +++++++++++++++++++++++++++++++++++---- 2 files changed, 120 insertions(+), 17 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 24adaa649..5c4cdaa80 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -27,7 +27,9 @@ use std::os::unix::fs::MetadataExt; #[cfg(windows)] use std::os::windows::fs::MetadataExt; use std::path::{Path, PathBuf}; -use std::time::{Duration, SystemTime, UNIX_EPOCH}; +#[cfg(unix)] +use std::time::Duration; +use std::time::{SystemTime, UNIX_EPOCH}; use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use time::{strftime, Timespec}; @@ -165,7 +167,7 @@ impl Config { "single-column" => Format::OneLine, "columns" => Format::Columns, // below should never happen as clap already restricts the values. - _ => panic!("Invalid field for --format"), + _ => unreachable!("Invalid field for --format"), } } else if options.is_present(options::format::LONG) { Format::Long @@ -192,7 +194,7 @@ impl Config { "time" => Sort::Time, "size" => Sort::Size, // below should never happen as clap already restricts the values. - _ => panic!("Invalid field for --sort"), + _ => unreachable!("Invalid field for --sort"), } } else if options.is_present(options::sort::TIME) { Sort::Time @@ -209,7 +211,7 @@ impl Config { "ctime" | "status" => Time::Change, "access" | "atime" | "use" => Time::Access, // below should never happen as clap already restricts the values. - _ => panic!("Invalid field for --time"), + _ => unreachable!("Invalid field for --time"), } } else if options.is_present(options::time::ACCESS) { Time::Access diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 422db8df9..e8ef18966 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -57,6 +57,36 @@ fn test_ls_a() { assert!(!result.stdout.contains("..")); } +#[test] +fn test_ls_columns() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch(&at.plus_as_string("test-columns-1")); + at.touch(&at.plus_as_string("test-columns-2")); + + // Columns is the default + let result = scene.ucmd().run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + + #[cfg(not(windows))] + assert_eq!(result.stdout, "test-columns-1\ntest-columns-2\n"); + #[cfg(windows)] + assert_eq!(result.stdout, "test-columns-1 test-columns-2\n"); + + for option in &["-C", "--format=columns"] { + let result = scene.ucmd().arg(option).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + #[cfg(not(windows))] + assert_eq!(result.stdout, "test-columns-1\ntest-columns-2\n"); + #[cfg(windows)] + assert_eq!(result.stdout, "test-columns-1 test-columns-2\n"); + } +} + #[test] fn test_ls_long() { #[cfg(not(windows))] @@ -71,16 +101,20 @@ fn test_ls_long() { } } - let (at, mut ucmd) = at_and_ucmd!(); + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; at.touch(&at.plus_as_string("test-long")); - let result = ucmd.arg("-l").arg("test-long").succeeds(); - println!("stderr = {:?}", result.stderr); - println!("stdout = {:?}", result.stdout); - #[cfg(not(windows))] - assert!(result.stdout.contains("-rw-rw-r--")); - #[cfg(windows)] - assert!(result.stdout.contains("---------- 1 somebody somegroup")); + for arg in &["-l", "--long", "--format=long", "--format=verbose"] { + let result = scene.ucmd().arg(arg).arg("test-long").succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + #[cfg(not(windows))] + assert!(result.stdout.contains("-rw-rw-r--")); + + #[cfg(windows)] + assert!(result.stdout.contains("---------- 1 somebody somegroup")); + } #[cfg(not(windows))] { @@ -90,6 +124,24 @@ fn test_ls_long() { } } +#[test] +fn test_ls_oneline() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch(&at.plus_as_string("test-oneline-1")); + at.touch(&at.plus_as_string("test-oneline-2")); + + // Bit of a weird situation: in the tests oneline and columns have the same output, + // except on Windows. + for option in &["-1", "--format=single-column"] { + let result = scene.ucmd().arg(option).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert_eq!(result.stdout, "test-oneline-1\ntest-oneline-2\n"); + } +} + #[test] fn test_ls_deref() { let scene = TestScenario::new(util_name!()); @@ -166,27 +218,54 @@ fn test_ls_order_size() { } #[test] -fn test_ls_order_creation() { +fn test_ls_long_ctime() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("test-long-ctime-1"); + let result = scene.ucmd().arg("-lc").succeeds(); + + // Should show the time on Unix, but question marks on windows. + #[cfg(unix)] + assert!(result.stdout.contains(":")); + #[cfg(not(unix))] + assert!(result.stdout.contains("???")); +} + +#[test] +fn test_ls_order_time() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.touch("test-1"); at.append("test-1", "1"); - sleep(Duration::from_millis(500)); + sleep(Duration::from_millis(100)); at.touch("test-2"); at.append("test-2", "22"); - sleep(Duration::from_millis(500)); + sleep(Duration::from_millis(100)); at.touch("test-3"); at.append("test-3", "333"); - sleep(Duration::from_millis(500)); + sleep(Duration::from_millis(100)); at.touch("test-4"); at.append("test-4", "4444"); + sleep(Duration::from_millis(100)); + + // Read test-3, only changing access time + at.read("test-3"); + + // Set permissions of test-2, only changing ctime + std::fs::set_permissions( + at.plus_as_string("test-2"), + at.metadata("test-2").permissions(), + ) + .unwrap(); let result = scene.ucmd().arg("-al").run(); println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(result.success); + // ctime was changed at write, so the order is 4 3 2 1 let result = scene.ucmd().arg("-t").run(); println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); @@ -196,7 +275,7 @@ fn test_ls_order_creation() { #[cfg(windows)] assert_eq!(result.stdout, "test-4 test-3 test-2 test-1\n"); - let result = scene.ucmd().arg("-t").arg("-r").run(); + let result = scene.ucmd().arg("-tr").run(); println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(result.success); @@ -204,6 +283,28 @@ fn test_ls_order_creation() { assert_eq!(result.stdout, "test-1\ntest-2\ntest-3\ntest-4\n"); #[cfg(windows)] assert_eq!(result.stdout, "test-1 test-2 test-3 test-4\n"); + + // 3 was accessed last in the read + // So the order should be 2 3 4 1 + let result = scene.ucmd().arg("-tu").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + #[cfg(not(windows))] + assert_eq!(result.stdout, "test-3\ntest-4\ntest-2\ntest-1\n"); + #[cfg(windows)] + assert_eq!(result.stdout, "test-3 test-4 test-2 test-1\n"); + + // test-2 had the last ctime change when the permissions were set + // So the order should be 2 4 3 1 + #[cfg(unix)] + { + let result = scene.ucmd().arg("-tc").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert_eq!(result.stdout, "test-2\ntest-4\ntest-3\ntest-1\n"); + } } #[test] From fd957dd1487c1d25d733ae655cc945c339337145 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 15 Mar 2021 14:09:29 +0100 Subject: [PATCH 426/606] ls: fix access time on windows --- tests/by-util/test_ls.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index e8ef18966..fea912695 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -292,8 +292,11 @@ fn test_ls_order_time() { assert!(result.success); #[cfg(not(windows))] assert_eq!(result.stdout, "test-3\ntest-4\ntest-2\ntest-1\n"); + + // Access time does not seem to be set on Windows on read call + // so the order is 4 3 2 1 #[cfg(windows)] - assert_eq!(result.stdout, "test-3 test-4 test-2 test-1\n"); + assert_eq!(result.stdout, "test-4 test-3 test-2 test-1\n"); // test-2 had the last ctime change when the permissions were set // So the order should be 2 4 3 1 From ce4342d12e630c08c5a0db7da05a1b84f862882f Mon Sep 17 00:00:00 2001 From: Chirag Jadwani Date: Mon, 15 Mar 2021 14:08:14 +0530 Subject: [PATCH 427/606] uniq: Fix panic on invalid utf-8 input --- src/uu/uniq/src/uniq.rs | 10 +++++++--- tests/by-util/test_uniq.rs | 9 +++++++++ tests/fixtures/uniq/not-utf8-sequence.txt | 2 ++ 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 tests/fixtures/uniq/not-utf8-sequence.txt diff --git a/src/uu/uniq/src/uniq.rs b/src/uu/uniq/src/uniq.rs index afbda2829..98260bb8f 100644 --- a/src/uu/uniq/src/uniq.rs +++ b/src/uu/uniq/src/uniq.rs @@ -10,7 +10,7 @@ extern crate uucore; use clap::{App, Arg, ArgMatches}; use std::fs::File; -use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; +use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Result, Write}; use std::path::Path; use std::str::FromStr; @@ -61,8 +61,7 @@ impl Uniq { let delimiters = &self.delimiters; let line_terminator = self.get_line_terminator(); - for io_line in reader.split(line_terminator) { - let line = String::from_utf8(crash_if_err!(1, io_line)).unwrap(); + for line in reader.split(line_terminator).map(get_line_string) { if !lines.is_empty() && self.cmp_keys(&lines[0], &line) { let print_delimiter = delimiters == &Delimiters::Prepend || (delimiters == &Delimiters::Separate && first_line_printed); @@ -199,6 +198,11 @@ impl Uniq { } } +fn get_line_string(io_line: Result>) -> String { + let line_bytes = crash_if_err!(1, io_line); + crash_if_err!(1, String::from_utf8(line_bytes)) +} + fn opt_parsed(opt_name: &str, matches: &ArgMatches) -> Option { matches.value_of(opt_name).map(|arg_str| { let opt_val: Option = arg_str.parse().ok(); diff --git a/tests/by-util/test_uniq.rs b/tests/by-util/test_uniq.rs index 53d57b49c..22e67540e 100644 --- a/tests/by-util/test_uniq.rs +++ b/tests/by-util/test_uniq.rs @@ -138,3 +138,12 @@ fn test_stdin_zero_terminated() { .run() .stdout_is_fixture("sorted-zero-terminated.expected"); } + +#[test] +fn test_invalid_utf8() { + new_ucmd!() + .arg("not-utf8-sequence.txt") + .run() + .failure() + .stderr_only("uniq: error: invalid utf-8 sequence of 1 bytes from index 0"); +} diff --git a/tests/fixtures/uniq/not-utf8-sequence.txt b/tests/fixtures/uniq/not-utf8-sequence.txt new file mode 100644 index 000000000..78c146ffd --- /dev/null +++ b/tests/fixtures/uniq/not-utf8-sequence.txt @@ -0,0 +1,2 @@ +Next line contains two bytes - 0xCC and 0xCD - which are not a valid utf-8 sequence + \ No newline at end of file From 116e253cc0391e18e145170dcff222f07d2b00a2 Mon Sep 17 00:00:00 2001 From: Chirag Jadwani Date: Mon, 15 Mar 2021 18:11:33 +0530 Subject: [PATCH 428/606] 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). --- src/uu/uniq/src/uniq.rs | 25 ++++++++++------------ tests/fixtures/uniq/skip-2-fields.expected | 2 +- tests/fixtures/uniq/skip-fields.txt | 2 +- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/uu/uniq/src/uniq.rs b/src/uu/uniq/src/uniq.rs index 98260bb8f..a1809f0f0 100644 --- a/src/uu/uniq/src/uniq.rs +++ b/src/uu/uniq/src/uniq.rs @@ -79,22 +79,19 @@ impl Uniq { fn skip_fields<'a>(&self, line: &'a str) -> &'a str { if let Some(skip_fields) = self.skip_fields { - if line.split_whitespace().count() > skip_fields { - let mut field = 0; - let mut i = 0; - while field < skip_fields && i < line.len() { - while i < line.len() && line.chars().nth(i).unwrap().is_whitespace() { - i += 1; - } - while i < line.len() && !line.chars().nth(i).unwrap().is_whitespace() { - i += 1; - } - field += 1; + let mut i = 0; + let mut char_indices = line.char_indices(); + for _ in 0..skip_fields { + if char_indices.find(|(_, c)| !c.is_whitespace()) == None { + return ""; + } + match char_indices.find(|(_, c)| c.is_whitespace()) { + None => return "", + + Some((next_field_i, _)) => i = next_field_i, } - &line[i..] - } else { - "" } + &line[i..] } else { line } diff --git a/tests/fixtures/uniq/skip-2-fields.expected b/tests/fixtures/uniq/skip-2-fields.expected index 8cffc2ebc..b971c2b2b 100644 --- a/tests/fixtures/uniq/skip-2-fields.expected +++ b/tests/fixtures/uniq/skip-2-fields.expected @@ -1,2 +1,2 @@ - aaa aa a + aaa ⟪⟫ a aa a diff --git a/tests/fixtures/uniq/skip-fields.txt b/tests/fixtures/uniq/skip-fields.txt index f84e377a0..4ec2744c6 100644 --- a/tests/fixtures/uniq/skip-fields.txt +++ b/tests/fixtures/uniq/skip-fields.txt @@ -1,4 +1,4 @@ - aaa aa a + aaa ⟪⟫ a ZZZ aa a ZZZ aa a ZZZ bb a From cd775ed704d897e06395134ab1922f7a58725031 Mon Sep 17 00:00:00 2001 From: Dean Li Date: Mon, 15 Mar 2021 21:28:47 +0800 Subject: [PATCH 429/606] Expand: use mod::options --- src/uu/expand/src/expand.rs | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index 52537dcc2..67d24086c 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -23,6 +23,13 @@ static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Convert tabs in each FILE to spaces, writing to standard output. With no FILE, or when FILE is -, read standard input."; +pub mod options { + pub static TABS: &str = "tabs"; + pub static INITIAL: &str = "initial"; + pub static NO_UTF8: &str = "no-utf8"; + pub static FILES: &str = "FILES"; +} + static LONG_HELP: &str = ""; static DEFAULT_TABSTOP: usize = 8; @@ -65,13 +72,13 @@ struct Options { impl Options { fn new(matches: &ArgMatches) -> Options { - let tabstops = match matches.value_of("tabstops") { + let tabstops = match matches.value_of(options::TABS) { Some(s) => tabstops_parse(s.to_string()), None => vec![DEFAULT_TABSTOP], }; - let iflag = matches.is_present("iflag"); - let uflag = !matches.is_present("uflag"); + let iflag = matches.is_present(options::INITIAL); + let uflag = !matches.is_present(options::NO_UTF8); // avoid allocations when dumping out long sequences of spaces // by precomputing the longest string of spaces we will ever need @@ -86,7 +93,7 @@ impl Options { .unwrap(); // length of tabstops is guaranteed >= 1 let tspaces = repeat(' ').take(nspaces).collect(); - let files: Vec = match matches.values_of("files") { + let files: Vec = match matches.values_of(options::FILES) { Some(s) => s.map(|v| v.to_string()).collect(), None => vec!["-".to_owned()], }; @@ -109,23 +116,29 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .usage(&usage[..]) .after_help(LONG_HELP) .arg( - Arg::with_name("iflag") - .long("initial") + Arg::with_name(options::INITIAL) + .long(options::INITIAL) .short("i") .help("do not convert tabs after non blanks"), ) .arg( - Arg::with_name("tabstops") - .long("tabs") + Arg::with_name(options::TABS) + .long(options::TABS) .short("t") .value_name("N, LIST") .takes_value(true) .help("have tabs N characters apart, not 8 or use comma separated list of explicit tab positions"), ) .arg( - Arg::with_name("uflags").long("no-utf8").short("U").help("interpret input file as 8-bit ASCII rather than UTF-8"), + Arg::with_name(options::NO_UTF8) + .long(options::NO_UTF8) + .short("U") + .help("interpret input file as 8-bit ASCII rather than UTF-8"), ).arg( - Arg::with_name("files").multiple(true).hidden(true).takes_value(true) + Arg::with_name(options::FILES) + .multiple(true) + .hidden(true) + .takes_value(true) ) .get_matches_from(args); From f60808471051187eeaf03fc74b936a45d18c26c0 Mon Sep 17 00:00:00 2001 From: Dean Li Date: Mon, 15 Mar 2021 21:29:28 +0800 Subject: [PATCH 430/606] Expand: add test for multiple files --- tests/by-util/test_expand.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/by-util/test_expand.rs b/tests/by-util/test_expand.rs index 121ccccec..801bf9d98 100644 --- a/tests/by-util/test_expand.rs +++ b/tests/by-util/test_expand.rs @@ -46,3 +46,13 @@ fn test_with_space() { assert!(result.success); assert!(result.stdout.contains(" return")); } + +#[test] +fn test_with_multiple_files() { + let (_, mut ucmd) = at_and_ucmd!(); + + let result = ucmd.arg("with-spaces.txt").arg("with-tab.txt").run(); + assert!(result.success); + assert!(result.stdout.contains(" return")); + assert!(result.stdout.contains(" ")); +} From 53c3fedf33b4d8ee491dc665d715f5675ec84d31 Mon Sep 17 00:00:00 2001 From: Andre Julius Date: Mon, 15 Mar 2021 14:36:38 +0100 Subject: [PATCH 431/606] sleep: Add more test cases As mentioned here: https://github.com/uutils/coreutils/pull/1777#discussion_r593807712 --- tests/by-util/test_sleep.rs | 65 +++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/tests/by-util/test_sleep.rs b/tests/by-util/test_sleep.rs index 389befd0a..a17beddf6 100644 --- a/tests/by-util/test_sleep.rs +++ b/tests/by-util/test_sleep.rs @@ -45,3 +45,68 @@ fn test_sleep_h_suffix() { let duration = before_test.elapsed(); assert!(duration >= millis_360); } + +#[test] +fn test_sleep_negative_duration() { + new_ucmd!().args(&["-1"]).fails(); + new_ucmd!().args(&["-1s"]).fails(); + new_ucmd!().args(&["-1m"]).fails(); + new_ucmd!().args(&["-1h"]).fails(); + new_ucmd!().args(&["-1d"]).fails(); +} + +#[test] +fn test_sleep_zero_duration() { + new_ucmd!().args(&["0"]).succeeds().stdout_only(""); + new_ucmd!().args(&["0s"]).succeeds().stdout_only(""); + new_ucmd!().args(&["0m"]).succeeds().stdout_only(""); + new_ucmd!().args(&["0h"]).succeeds().stdout_only(""); + new_ucmd!().args(&["0d"]).succeeds().stdout_only(""); +} + +#[test] +fn test_sleep_no_argument() { + new_ucmd!().fails(); +} + +#[test] +fn test_sleep_sum_duration_same_suffix() { + let millis_200 = Duration::from_millis(100 + 100); + let before_test = Instant::now(); + + new_ucmd!() + .args(&["0.1s", "0.1s"]) + .succeeds() + .stdout_only(""); + + let duration = before_test.elapsed(); + assert!(duration >= millis_200); +} + +#[test] +fn test_sleep_sum_duration_different_suffix() { + let millis_700 = Duration::from_millis(100 + 600); + let before_test = Instant::now(); + + new_ucmd!() + .args(&["0.1s", "0.01m"]) + .succeeds() + .stdout_only(""); + + let duration = before_test.elapsed(); + assert!(duration >= millis_700); +} + +#[test] +fn test_sleep_sum_duration_many() { + let millis_900 = Duration::from_millis(100 + 100 + 300 + 400); + let before_test = Instant::now(); + + new_ucmd!() + .args(&["0.1s", "0.1s", "0.3s", "0.4s"]) + .succeeds() + .stdout_only(""); + + let duration = before_test.elapsed(); + assert!(duration >= millis_900); +} From 406cd865ebeeae49f8c192909b7e8d624d070483 Mon Sep 17 00:00:00 2001 From: Hari Date: Mon, 15 Mar 2021 11:00:30 -0400 Subject: [PATCH 432/606] install: run rustfmt Fix formatting issues based on PR review comments --- src/uu/install/src/install.rs | 9 ++++----- tests/by-util/test_install.rs | 10 ++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index c9d2c77ca..9d1acdc7e 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -13,7 +13,7 @@ mod mode; extern crate uucore; use clap::{App, Arg, ArgMatches}; -use filetime::{FileTime, set_file_times}; +use filetime::{set_file_times, FileTime}; use uucore::entries::{grp2gid, usr2uid}; use uucore::perms::{wrap_chgrp, wrap_chown, Verbosity}; @@ -337,7 +337,7 @@ fn behavior(matches: &ArgMatches) -> Result { owner: matches.value_of(OPT_OWNER).unwrap_or("").to_string(), group: matches.value_of(OPT_GROUP).unwrap_or("").to_string(), verbose: matches.is_present(OPT_VERBOSE), - preserve_timestamps: matches.is_present(OPT_PRESERVE_TIMESTAMPS) + preserve_timestamps: matches.is_present(OPT_PRESERVE_TIMESTAMPS), }) } @@ -565,10 +565,9 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { let accessed_time = FileTime::from_last_access_time(&meta); match set_file_times(to.as_path(), accessed_time, modified_time) { - Ok(_) => {}, - Err(e) => show_info!("{}", e) + Ok(_) => {} + Err(e) => show_info!("{}", e), } - } if b.verbose { diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index ee79a8271..7b3706f9e 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -324,8 +324,14 @@ fn test_install_preserve_timestamps() { let file1_metadata = at.metadata(file1); let file2_metadata = at.metadata(file2); - assert_eq!(file1_metadata.accessed().ok(), file2_metadata.accessed().ok()); - assert_eq!(file1_metadata.modified().ok(), file2_metadata.modified().ok()); + assert_eq!( + file1_metadata.accessed().ok(), + file2_metadata.accessed().ok() + ); + assert_eq!( + file1_metadata.modified().ok(), + file2_metadata.modified().ok() + ); } // These two tests are failing but should work From 02e9ffecddffa79e63cab71d8adf356c6ef07e40 Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Mon, 15 Mar 2021 11:07:19 -0400 Subject: [PATCH 433/606] numfmt: split implementation into modules --- src/uu/numfmt/src/format.rs | 265 ++++++++++++++++++++++++ src/uu/numfmt/src/numfmt.rs | 391 +++-------------------------------- src/uu/numfmt/src/options.rs | 25 +++ src/uu/numfmt/src/units.rs | 67 ++++++ 4 files changed, 382 insertions(+), 366 deletions(-) create mode 100644 src/uu/numfmt/src/format.rs create mode 100644 src/uu/numfmt/src/options.rs create mode 100644 src/uu/numfmt/src/units.rs diff --git a/src/uu/numfmt/src/format.rs b/src/uu/numfmt/src/format.rs new file mode 100644 index 000000000..e7286c44e --- /dev/null +++ b/src/uu/numfmt/src/format.rs @@ -0,0 +1,265 @@ +use crate::options::NumfmtOptions; +use crate::units::{ + DisplayableSuffix, RawSuffix, Result, Suffix, Transform, Unit, IEC_BASES, SI_BASES, +}; + +/// Iterate over a line's fields, where each field is a contiguous sequence of +/// non-whitespace, optionally prefixed with one or more characters of leading +/// whitespace. Fields are returned as tuples of `(prefix, field)`. +/// +/// # Examples: +/// +/// ``` +/// let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some(" 1234 5") }; +/// +/// assert_eq!(Some((" ", "1234")), fields.next()); +/// assert_eq!(Some((" ", "5")), fields.next()); +/// assert_eq!(None, fields.next()); +/// ``` +/// +/// Delimiters are included in the results; `prefix` will be empty only for +/// the first field of the line (including the case where the input line is +/// empty): +/// +/// ``` +/// let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("first second") }; +/// +/// assert_eq!(Some(("", "first")), fields.next()); +/// assert_eq!(Some((" ", "second")), fields.next()); +/// +/// let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("") }; +/// +/// assert_eq!(Some(("", "")), fields.next()); +/// ``` +pub struct WhitespaceSplitter<'a> { + pub s: Option<&'a str>, +} + +impl<'a> Iterator for WhitespaceSplitter<'a> { + type Item = (&'a str, &'a str); + + /// Yield the next field in the input string as a tuple `(prefix, field)`. + fn next(&mut self) -> Option { + let haystack = self.s?; + + let (prefix, field) = haystack.split_at( + haystack + .find(|c: char| !c.is_whitespace()) + .unwrap_or_else(|| haystack.len()), + ); + + let (field, rest) = field.split_at( + field + .find(|c: char| c.is_whitespace()) + .unwrap_or_else(|| field.len()), + ); + + self.s = if !rest.is_empty() { Some(rest) } else { None }; + + Some((prefix, field)) + } +} + +fn parse_suffix(s: &str) -> Result<(f64, Option)> { + if s.is_empty() { + return Err("invalid number: ‘’".to_string()); + } + + let with_i = s.ends_with('i'); + let mut iter = s.chars(); + if with_i { + iter.next_back(); + } + let suffix: Option = match iter.next_back() { + Some('K') => Ok(Some((RawSuffix::K, with_i))), + Some('M') => Ok(Some((RawSuffix::M, with_i))), + Some('G') => Ok(Some((RawSuffix::G, with_i))), + Some('T') => Ok(Some((RawSuffix::T, with_i))), + Some('P') => Ok(Some((RawSuffix::P, with_i))), + Some('E') => Ok(Some((RawSuffix::E, with_i))), + Some('Z') => Ok(Some((RawSuffix::Z, with_i))), + Some('Y') => Ok(Some((RawSuffix::Y, with_i))), + Some('0'..='9') => Ok(None), + _ => Err(format!("invalid suffix in input: ‘{}’", s)), + }?; + + let suffix_len = match suffix { + None => 0, + Some((_, false)) => 1, + Some((_, true)) => 2, + }; + + let number = s[..s.len() - suffix_len] + .parse::() + .map_err(|_| format!("invalid number: ‘{}’", s))?; + + Ok((number, suffix)) +} + +fn remove_suffix(i: f64, s: Option, u: &Unit) -> Result { + match (s, u) { + (None, _) => Ok(i), + (Some((raw_suffix, false)), &Unit::Auto) | (Some((raw_suffix, false)), &Unit::Si) => { + match raw_suffix { + RawSuffix::K => Ok(i * 1e3), + RawSuffix::M => Ok(i * 1e6), + RawSuffix::G => Ok(i * 1e9), + RawSuffix::T => Ok(i * 1e12), + RawSuffix::P => Ok(i * 1e15), + RawSuffix::E => Ok(i * 1e18), + RawSuffix::Z => Ok(i * 1e21), + RawSuffix::Y => Ok(i * 1e24), + } + } + (Some((raw_suffix, false)), &Unit::Iec(false)) + | (Some((raw_suffix, true)), &Unit::Auto) + | (Some((raw_suffix, true)), &Unit::Iec(true)) => match raw_suffix { + RawSuffix::K => Ok(i * IEC_BASES[1]), + RawSuffix::M => Ok(i * IEC_BASES[2]), + RawSuffix::G => Ok(i * IEC_BASES[3]), + RawSuffix::T => Ok(i * IEC_BASES[4]), + RawSuffix::P => Ok(i * IEC_BASES[5]), + RawSuffix::E => Ok(i * IEC_BASES[6]), + RawSuffix::Z => Ok(i * IEC_BASES[7]), + RawSuffix::Y => Ok(i * IEC_BASES[8]), + }, + (_, _) => Err("This suffix is unsupported for specified unit".to_owned()), + } +} + +fn transform_from(s: &str, opts: &Transform) -> Result { + let (i, suffix) = parse_suffix(s)?; + + remove_suffix(i, suffix, &opts.unit).map(|n| if n < 0.0 { -n.abs().ceil() } else { n.ceil() }) +} + +/// Divide numerator by denominator, with ceiling. +/// +/// If the result of the division is less than 10.0, truncate the result +/// to the next highest tenth. +/// +/// Otherwise, truncate the result to the next highest whole number. +/// +/// # Examples: +/// +/// ``` +/// use uu_numfmt::format::div_ceil; +/// +/// assert_eq!(div_ceil(1.01, 1.0), 1.1); +/// assert_eq!(div_ceil(999.1, 1000.), 1.0); +/// assert_eq!(div_ceil(1001., 10.), 101.); +/// assert_eq!(div_ceil(9991., 10.), 1000.); +/// assert_eq!(div_ceil(-12.34, 1.0), -13.0); +/// assert_eq!(div_ceil(1000.0, -3.14), -319.0); +/// assert_eq!(div_ceil(-271828.0, -271.0), 1004.0); +/// ``` +pub fn div_ceil(n: f64, d: f64) -> f64 { + let v = n / (d / 10.0); + let (v, sign) = if v < 0.0 { (v.abs(), -1.0) } else { (v, 1.0) }; + + if v < 100.0 { + v.ceil() / 10.0 * sign + } else { + (v / 10.0).ceil() * sign + } +} + +fn consider_suffix(n: f64, u: &Unit) -> Result<(f64, Option)> { + use crate::units::RawSuffix::*; + + let abs_n = n.abs(); + let suffixes = [K, M, G, T, P, E, Z, Y]; + + let (bases, with_i) = match *u { + Unit::Si => (&SI_BASES, false), + Unit::Iec(with_i) => (&IEC_BASES, with_i), + Unit::Auto => return Err("Unit 'auto' isn't supported with --to options".to_owned()), + Unit::None => return Ok((n, None)), + }; + + let i = match abs_n { + _ if abs_n <= bases[1] - 1.0 => return Ok((n, None)), + _ if abs_n < bases[2] => 1, + _ if abs_n < bases[3] => 2, + _ if abs_n < bases[4] => 3, + _ if abs_n < bases[5] => 4, + _ if abs_n < bases[6] => 5, + _ if abs_n < bases[7] => 6, + _ if abs_n < bases[8] => 7, + _ if abs_n < bases[9] => 8, + _ => return Err("Number is too big and unsupported".to_string()), + }; + + let v = div_ceil(n, bases[i]); + + // check if rounding pushed us into the next base + if v.abs() >= bases[1] { + Ok((v / bases[1], Some((suffixes[i], with_i)))) + } else { + Ok((v, Some((suffixes[i - 1], with_i)))) + } +} + +fn transform_to(s: f64, opts: &Transform) -> Result { + let (i2, s) = consider_suffix(s, &opts.unit)?; + Ok(match s { + None => format!("{}", i2), + Some(s) if i2.abs() < 10.0 => format!("{:.1}{}", i2, DisplayableSuffix(s)), + Some(s) => format!("{:.0}{}", i2, DisplayableSuffix(s)), + }) +} + +fn format_string( + source: &str, + options: &NumfmtOptions, + implicit_padding: Option, +) -> Result { + let number = transform_to( + transform_from(source, &options.transform.from)?, + &options.transform.to, + )?; + + Ok(match implicit_padding.unwrap_or(options.padding) { + p if p == 0 => number, + p if p > 0 => format!("{:>padding$}", number, padding = p as usize), + p => format!("{: Result<()> { + for (n, (prefix, field)) in (1..).zip(WhitespaceSplitter { s: Some(s) }) { + let field_selected = uucore::ranges::contain(&options.fields, n); + + if field_selected { + let empty_prefix = prefix.is_empty(); + + // print delimiter before second and subsequent fields + let prefix = if n > 1 { + print!(" "); + &prefix[1..] + } else { + &prefix + }; + + let implicit_padding = if !empty_prefix && options.padding == 0 { + Some((prefix.len() + field.len()) as isize) + } else { + None + }; + + print!("{}", format_string(&field, options, implicit_padding)?); + } else { + // print unselected field without conversion + print!("{}{}", prefix, field); + } + } + + println!(); + + Ok(()) +} diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index ea750c024..e37792669 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -8,11 +8,17 @@ #[macro_use] extern crate uucore; +use crate::format::format_and_print; +use crate::options::*; +use crate::units::{Result, Transform, Unit}; use clap::{App, AppSettings, Arg, ArgMatches}; -use std::fmt; use std::io::{BufRead, Write}; use uucore::ranges::Range; +pub mod format; +mod options; +mod units; + static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Convert numbers from/to human-readable strings"; static LONG_HELP: &str = "UNIT options: @@ -43,119 +49,33 @@ FIELDS supports cut(1) style field ranges: Multiple fields/ranges can be separated with commas "; -mod options { - pub const FIELD: &str = "field"; - pub const FIELD_DEFAULT: &str = "1"; - pub const FROM: &str = "from"; - pub const FROM_DEFAULT: &str = "none"; - pub const HEADER: &str = "header"; - pub const HEADER_DEFAULT: &str = "1"; - pub const NUMBER: &str = "NUMBER"; - pub const PADDING: &str = "padding"; - pub const TO: &str = "to"; - pub const TO_DEFAULT: &str = "none"; -} - fn get_usage() -> String { format!("{0} [OPTION]... [NUMBER]...", executable!()) } -const SI_BASES: [f64; 10] = [1., 1e3, 1e6, 1e9, 1e12, 1e15, 1e18, 1e21, 1e24, 1e27]; - -const IEC_BASES: [f64; 10] = [ - 1., - 1_024., - 1_048_576., - 1_073_741_824., - 1_099_511_627_776., - 1_125_899_906_842_624., - 1_152_921_504_606_846_976., - 1_180_591_620_717_411_303_424., - 1_208_925_819_614_629_174_706_176., - 1_237_940_039_285_380_274_899_124_224., -]; - -type Result = std::result::Result; - -type WithI = bool; - -enum Unit { - Auto, - Si, - Iec(WithI), - None, -} - -#[derive(Clone, Copy, Debug)] -enum RawSuffix { - K, - M, - G, - T, - P, - E, - Z, - Y, -} - -type Suffix = (RawSuffix, WithI); - -struct DisplayableSuffix(Suffix); - -impl fmt::Display for DisplayableSuffix { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let DisplayableSuffix((ref raw_suffix, ref with_i)) = *self; - match raw_suffix { - RawSuffix::K => write!(f, "K"), - RawSuffix::M => write!(f, "M"), - RawSuffix::G => write!(f, "G"), - RawSuffix::T => write!(f, "T"), - RawSuffix::P => write!(f, "P"), - RawSuffix::E => write!(f, "E"), - RawSuffix::Z => write!(f, "Z"), - RawSuffix::Y => write!(f, "Y"), - } - .and_then(|()| match with_i { - true => write!(f, "i"), - false => Ok(()), - }) - } -} - -fn parse_suffix(s: &str) -> Result<(f64, Option)> { - if s.is_empty() { - return Err("invalid number: ‘’".to_string()); +fn handle_args<'a>(args: impl Iterator, options: NumfmtOptions) -> Result<()> { + for l in args { + format_and_print(l, &options)?; } - let with_i = s.ends_with('i'); - let mut iter = s.chars(); - if with_i { - iter.next_back(); + Ok(()) +} + +fn handle_stdin(options: NumfmtOptions) -> Result<()> { + let stdin = std::io::stdin(); + let locked_stdin = stdin.lock(); + + let mut lines = locked_stdin.lines(); + for l in lines.by_ref().take(options.header) { + l.map(|s| println!("{}", s)).map_err(|e| e.to_string())?; } - let suffix: Option = match iter.next_back() { - Some('K') => Ok(Some((RawSuffix::K, with_i))), - Some('M') => Ok(Some((RawSuffix::M, with_i))), - Some('G') => Ok(Some((RawSuffix::G, with_i))), - Some('T') => Ok(Some((RawSuffix::T, with_i))), - Some('P') => Ok(Some((RawSuffix::P, with_i))), - Some('E') => Ok(Some((RawSuffix::E, with_i))), - Some('Z') => Ok(Some((RawSuffix::Z, with_i))), - Some('Y') => Ok(Some((RawSuffix::Y, with_i))), - Some('0'..='9') => Ok(None), - _ => Err(format!("invalid suffix in input: ‘{}’", s)), - }?; - let suffix_len = match suffix { - None => 0, - Some((_, false)) => 1, - Some((_, true)) => 2, - }; + for l in lines { + l.map_err(|e| e.to_string()) + .and_then(|l| format_and_print(&l, &options))?; + } - let number = s[..s.len() - suffix_len] - .parse::() - .map_err(|_| format!("invalid number: ‘{}’", s))?; - - Ok((number, suffix)) + Ok(()) } fn parse_unit(s: &str) -> Result { @@ -169,242 +89,6 @@ fn parse_unit(s: &str) -> Result { } } -struct TransformOptions { - from: Transform, - to: Transform, -} - -struct Transform { - unit: Unit, -} - -struct NumfmtOptions { - transform: TransformOptions, - padding: isize, - header: usize, - fields: Vec, -} - -/// Iterate over a line's fields, where each field is a contiguous sequence of -/// non-whitespace, optionally prefixed with one or more characters of leading -/// whitespace. Fields are returned as tuples of `(prefix, field)`. -/// -/// # Examples: -/// -/// ``` -/// let mut fields = uu_numfmt::WhitespaceSplitter { s: Some(" 1234 5") }; -/// -/// assert_eq!(Some((" ", "1234")), fields.next()); -/// assert_eq!(Some((" ", "5")), fields.next()); -/// assert_eq!(None, fields.next()); -/// ``` -/// -/// Delimiters are included in the results; `prefix` will be empty only for -/// the first field of the line (including the case where the input line is -/// empty): -/// -/// ``` -/// let mut fields = uu_numfmt::WhitespaceSplitter { s: Some("first second") }; -/// -/// assert_eq!(Some(("", "first")), fields.next()); -/// assert_eq!(Some((" ", "second")), fields.next()); -/// -/// let mut fields = uu_numfmt::WhitespaceSplitter { s: Some("") }; -/// -/// assert_eq!(Some(("", "")), fields.next()); -/// ``` -pub struct WhitespaceSplitter<'a> { - pub s: Option<&'a str>, -} - -impl<'a> Iterator for WhitespaceSplitter<'a> { - type Item = (&'a str, &'a str); - - /// Yield the next field in the input string as a tuple `(prefix, field)`. - fn next(&mut self) -> Option { - let haystack = self.s?; - - let (prefix, field) = haystack.split_at( - haystack - .find(|c: char| !c.is_whitespace()) - .unwrap_or_else(|| haystack.len()), - ); - - let (field, rest) = field.split_at( - field - .find(|c: char| c.is_whitespace()) - .unwrap_or_else(|| field.len()), - ); - - self.s = if !rest.is_empty() { Some(rest) } else { None }; - - Some((prefix, field)) - } -} - -fn remove_suffix(i: f64, s: Option, u: &Unit) -> Result { - match (s, u) { - (None, _) => Ok(i), - (Some((raw_suffix, false)), &Unit::Auto) | (Some((raw_suffix, false)), &Unit::Si) => { - match raw_suffix { - RawSuffix::K => Ok(i * 1e3), - RawSuffix::M => Ok(i * 1e6), - RawSuffix::G => Ok(i * 1e9), - RawSuffix::T => Ok(i * 1e12), - RawSuffix::P => Ok(i * 1e15), - RawSuffix::E => Ok(i * 1e18), - RawSuffix::Z => Ok(i * 1e21), - RawSuffix::Y => Ok(i * 1e24), - } - } - (Some((raw_suffix, false)), &Unit::Iec(false)) - | (Some((raw_suffix, true)), &Unit::Auto) - | (Some((raw_suffix, true)), &Unit::Iec(true)) => match raw_suffix { - RawSuffix::K => Ok(i * IEC_BASES[1]), - RawSuffix::M => Ok(i * IEC_BASES[2]), - RawSuffix::G => Ok(i * IEC_BASES[3]), - RawSuffix::T => Ok(i * IEC_BASES[4]), - RawSuffix::P => Ok(i * IEC_BASES[5]), - RawSuffix::E => Ok(i * IEC_BASES[6]), - RawSuffix::Z => Ok(i * IEC_BASES[7]), - RawSuffix::Y => Ok(i * IEC_BASES[8]), - }, - (_, _) => Err("This suffix is unsupported for specified unit".to_owned()), - } -} - -fn transform_from(s: &str, opts: &Transform) -> Result { - let (i, suffix) = parse_suffix(s)?; - - remove_suffix(i, suffix, &opts.unit).map(|n| if n < 0.0 { -n.abs().ceil() } else { n.ceil() }) -} - -/// Divide numerator by denominator, with ceiling. -/// -/// If the result of the division is less than 10.0, truncate the result -/// to the next highest tenth. -/// -/// Otherwise, truncate the result to the next highest whole number. -/// -/// # Examples: -/// -/// ``` -/// use uu_numfmt::div_ceil; -/// -/// assert_eq!(div_ceil(1.01, 1.0), 1.1); -/// assert_eq!(div_ceil(999.1, 1000.), 1.0); -/// assert_eq!(div_ceil(1001., 10.), 101.); -/// assert_eq!(div_ceil(9991., 10.), 1000.); -/// assert_eq!(div_ceil(-12.34, 1.0), -13.0); -/// assert_eq!(div_ceil(1000.0, -3.14), -319.0); -/// assert_eq!(div_ceil(-271828.0, -271.0), 1004.0); -/// ``` -pub fn div_ceil(n: f64, d: f64) -> f64 { - let v = n / (d / 10.0); - let (v, sign) = if v < 0.0 { (v.abs(), -1.0) } else { (v, 1.0) }; - - if v < 100.0 { - v.ceil() / 10.0 * sign - } else { - (v / 10.0).ceil() * sign - } -} - -fn consider_suffix(n: f64, u: &Unit) -> Result<(f64, Option)> { - use RawSuffix::*; - - let abs_n = n.abs(); - let suffixes = [K, M, G, T, P, E, Z, Y]; - - let (bases, with_i) = match *u { - Unit::Si => (&SI_BASES, false), - Unit::Iec(with_i) => (&IEC_BASES, with_i), - Unit::Auto => return Err("Unit 'auto' isn't supported with --to options".to_owned()), - Unit::None => return Ok((n, None)), - }; - - let i = match abs_n { - _ if abs_n <= bases[1] - 1.0 => return Ok((n, None)), - _ if abs_n < bases[2] => 1, - _ if abs_n < bases[3] => 2, - _ if abs_n < bases[4] => 3, - _ if abs_n < bases[5] => 4, - _ if abs_n < bases[6] => 5, - _ if abs_n < bases[7] => 6, - _ if abs_n < bases[8] => 7, - _ if abs_n < bases[9] => 8, - _ => return Err("Number is too big and unsupported".to_string()), - }; - - let v = div_ceil(n, bases[i]); - - // check if rounding pushed us into the next base - if v.abs() >= bases[1] { - Ok((v / bases[1], Some((suffixes[i], with_i)))) - } else { - Ok((v, Some((suffixes[i - 1], with_i)))) - } -} - -fn transform_to(s: f64, opts: &Transform) -> Result { - let (i2, s) = consider_suffix(s, &opts.unit)?; - Ok(match s { - None => format!("{}", i2), - Some(s) if i2.abs() < 10.0 => format!("{:.1}{}", i2, DisplayableSuffix(s)), - Some(s) => format!("{:.0}{}", i2, DisplayableSuffix(s)), - }) -} - -fn format_string( - source: &str, - options: &NumfmtOptions, - implicit_padding: Option, -) -> Result { - let number = transform_to( - transform_from(source, &options.transform.from)?, - &options.transform.to, - )?; - - Ok(match implicit_padding.unwrap_or(options.padding) { - p if p == 0 => number, - p if p > 0 => format!("{:>padding$}", number, padding = p as usize), - p => format!("{: Result<()> { - for (n, (prefix, field)) in (1..).zip(WhitespaceSplitter { s: Some(s) }) { - let field_selected = uucore::ranges::contain(&options.fields, n); - - if field_selected { - let empty_prefix = prefix.is_empty(); - - // print delimiter before second and subsequent fields - let prefix = if n > 1 { - print!(" "); - &prefix[1..] - } else { - &prefix - }; - - let implicit_padding = if !empty_prefix && options.padding == 0 { - Some((prefix.len() + field.len()) as isize) - } else { - None - }; - - print!("{}", format_string(&field, options, implicit_padding)?); - } else { - // print unselected field without conversion - print!("{}{}", prefix, field); - } - } - - println!(); - - Ok(()) -} - fn parse_options(args: &ArgMatches) -> Result { let from = parse_unit(args.value_of(options::FROM).unwrap())?; let to = parse_unit(args.value_of(options::TO).unwrap())?; @@ -452,31 +136,6 @@ fn parse_options(args: &ArgMatches) -> Result { }) } -fn handle_args<'a>(args: impl Iterator, options: NumfmtOptions) -> Result<()> { - for l in args { - format_and_print(l, &options)?; - } - - Ok(()) -} - -fn handle_stdin(options: NumfmtOptions) -> Result<()> { - let stdin = std::io::stdin(); - let locked_stdin = stdin.lock(); - - let mut lines = locked_stdin.lines(); - for l in lines.by_ref().take(options.header) { - l.map(|s| println!("{}", s)).map_err(|e| e.to_string())?; - } - - for l in lines { - l.map_err(|e| e.to_string()) - .and_then(|l| format_and_print(&l, &options))?; - } - - Ok(()) -} - pub fn uumain(args: impl uucore::Args) -> i32 { let usage = get_usage(); diff --git a/src/uu/numfmt/src/options.rs b/src/uu/numfmt/src/options.rs new file mode 100644 index 000000000..ab0340d4e --- /dev/null +++ b/src/uu/numfmt/src/options.rs @@ -0,0 +1,25 @@ +use crate::units::Transform; +use uucore::ranges::Range; + +pub const FIELD: &str = "field"; +pub const FIELD_DEFAULT: &str = "1"; +pub const FROM: &str = "from"; +pub const FROM_DEFAULT: &str = "none"; +pub const HEADER: &str = "header"; +pub const HEADER_DEFAULT: &str = "1"; +pub const NUMBER: &str = "NUMBER"; +pub const PADDING: &str = "padding"; +pub const TO: &str = "to"; +pub const TO_DEFAULT: &str = "none"; + +pub struct TransformOptions { + pub from: Transform, + pub to: Transform, +} + +pub struct NumfmtOptions { + pub transform: TransformOptions, + pub padding: isize, + pub header: usize, + pub fields: Vec, +} diff --git a/src/uu/numfmt/src/units.rs b/src/uu/numfmt/src/units.rs new file mode 100644 index 000000000..5f9907bdf --- /dev/null +++ b/src/uu/numfmt/src/units.rs @@ -0,0 +1,67 @@ +use std::fmt; + +pub const SI_BASES: [f64; 10] = [1., 1e3, 1e6, 1e9, 1e12, 1e15, 1e18, 1e21, 1e24, 1e27]; + +pub const IEC_BASES: [f64; 10] = [ + 1., + 1_024., + 1_048_576., + 1_073_741_824., + 1_099_511_627_776., + 1_125_899_906_842_624., + 1_152_921_504_606_846_976., + 1_180_591_620_717_411_303_424., + 1_208_925_819_614_629_174_706_176., + 1_237_940_039_285_380_274_899_124_224., +]; + +pub type WithI = bool; + +pub enum Unit { + Auto, + Si, + Iec(WithI), + None, +} + +pub struct Transform { + pub unit: Unit, +} + +pub type Result = std::result::Result; + +#[derive(Clone, Copy, Debug)] +pub enum RawSuffix { + K, + M, + G, + T, + P, + E, + Z, + Y, +} + +pub type Suffix = (RawSuffix, WithI); + +pub struct DisplayableSuffix(pub Suffix); + +impl fmt::Display for DisplayableSuffix { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let DisplayableSuffix((ref raw_suffix, ref with_i)) = *self; + match raw_suffix { + RawSuffix::K => write!(f, "K"), + RawSuffix::M => write!(f, "M"), + RawSuffix::G => write!(f, "G"), + RawSuffix::T => write!(f, "T"), + RawSuffix::P => write!(f, "P"), + RawSuffix::E => write!(f, "E"), + RawSuffix::Z => write!(f, "Z"), + RawSuffix::Y => write!(f, "Y"), + } + .and_then(|()| match with_i { + true => write!(f, "i"), + false => Ok(()), + }) + } +} From 52f2ab68985cb6f79b63f343835b1c67ff8f030a Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Mon, 15 Mar 2021 11:20:33 -0400 Subject: [PATCH 434/606] numfmt: implement --delimiter closes #1454 --- src/uu/numfmt/src/format.rs | 43 +++++++++++++--- src/uu/numfmt/src/numfmt.rs | 16 ++++++ src/uu/numfmt/src/options.rs | 2 + tests/by-util/test_numfmt.rs | 95 ++++++++++++++++++++++++++++++++++++ 4 files changed, 150 insertions(+), 6 deletions(-) diff --git a/src/uu/numfmt/src/format.rs b/src/uu/numfmt/src/format.rs index e7286c44e..ebe380569 100644 --- a/src/uu/numfmt/src/format.rs +++ b/src/uu/numfmt/src/format.rs @@ -226,12 +226,31 @@ fn format_string( }) } -/// Format a line of text according to the selected options. -/// -/// Given a line of text `s`, split the line into fields, transform and format -/// any selected numeric fields, and print the result to stdout. Fields not -/// selected for conversion are passed through unmodified. -pub fn format_and_print(s: &str, options: &NumfmtOptions) -> Result<()> { +fn format_and_print_delimited(s: &str, options: &NumfmtOptions) -> Result<()> { + let delimiter = options.delimiter.as_ref().unwrap(); + + for (n, field) in (1..).zip(s.split(delimiter)) { + let field_selected = uucore::ranges::contain(&options.fields, n); + + // print delimiter before second and subsequent fields + if n > 1 { + print!("{}", delimiter); + } + + if field_selected { + print!("{}", format_string(&field.trim_start(), options, None)?); + } else { + // print unselected field without conversion + print!("{}", field); + } + } + + println!(); + + Ok(()) +} + +fn format_and_print_whitespace(s: &str, options: &NumfmtOptions) -> Result<()> { for (n, (prefix, field)) in (1..).zip(WhitespaceSplitter { s: Some(s) }) { let field_selected = uucore::ranges::contain(&options.fields, n); @@ -263,3 +282,15 @@ pub fn format_and_print(s: &str, options: &NumfmtOptions) -> Result<()> { Ok(()) } + +/// Format a line of text according to the selected options. +/// +/// Given a line of text `s`, split the line into fields, transform and format +/// any selected numeric fields, and print the result to stdout. Fields not +/// selected for conversion are passed through unmodified. +pub fn format_and_print(s: &str, options: &NumfmtOptions) -> Result<()> { + match &options.delimiter { + Some(_) => format_and_print_delimited(s, options), + None => format_and_print_whitespace(s, options), + } +} diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index e37792669..29c422a89 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -128,11 +128,20 @@ fn parse_options(args: &ArgMatches) -> Result { None => unreachable!(), }; + let delimiter = args.value_of(options::DELIMITER).map_or(Ok(None), |arg| { + if arg.len() == 1 { + Ok(Some(arg.to_string())) + } else { + Err("the delimiter must be a single character".to_string()) + } + })?; + Ok(NumfmtOptions { transform, padding, header, fields, + delimiter, }) } @@ -145,6 +154,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .usage(&usage[..]) .after_help(LONG_HELP) .setting(AppSettings::AllowNegativeNumbers) + .arg( + Arg::with_name(options::DELIMITER) + .short("d") + .long(options::DELIMITER) + .value_name("X") + .help("use X instead of whitespace for field delimiter"), + ) .arg( Arg::with_name(options::FIELD) .long(options::FIELD) diff --git a/src/uu/numfmt/src/options.rs b/src/uu/numfmt/src/options.rs index ab0340d4e..17f0a6fbe 100644 --- a/src/uu/numfmt/src/options.rs +++ b/src/uu/numfmt/src/options.rs @@ -1,6 +1,7 @@ use crate::units::Transform; use uucore::ranges::Range; +pub const DELIMITER: &str = "delimiter"; pub const FIELD: &str = "field"; pub const FIELD_DEFAULT: &str = "1"; pub const FROM: &str = "from"; @@ -22,4 +23,5 @@ pub struct NumfmtOptions { pub padding: isize, pub header: usize, pub fields: Vec, + pub delimiter: Option, } diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index c22db3bf5..64fc5360d 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -383,3 +383,98 @@ fn test_field_df_example() { .succeeds() .stdout_is_fixture("df_expected.txt"); } + +#[test] +fn test_delimiter_must_not_be_empty() { + new_ucmd!().args(&["-d"]).fails(); +} + +#[test] +fn test_delimiter_must_not_be_more_than_one_character() { + new_ucmd!() + .args(&["--delimiter", "sad"]) + .fails() + .stderr_is("numfmt: the delimiter must be a single character"); +} + +#[test] +fn test_delimiter_only() { + new_ucmd!() + .args(&["-d", ","]) + .pipe_in("1234,56") + .succeeds() + .stdout_only("1234,56\n"); +} + +#[test] +fn test_line_is_field_with_no_delimiter() { + new_ucmd!() + .args(&["-d,", "--to=iec"]) + .pipe_in("123456") + .succeeds() + .stdout_only("121K\n"); +} + +#[test] +fn test_delimiter_to_si() { + new_ucmd!() + .args(&["-d=,", "--to=si"]) + .pipe_in("1234,56") + .succeeds() + .stdout_only("1.3K,56\n"); +} + +#[test] +fn test_delimiter_skips_leading_whitespace() { + new_ucmd!() + .args(&["-d=,", "--to=si"]) + .pipe_in(" \t 1234,56") + .succeeds() + .stdout_only("1.3K,56\n"); +} + +#[test] +fn test_delimiter_preserves_leading_whitespace_in_unselected_fields() { + new_ucmd!() + .args(&["-d=|", "--to=si"]) + .pipe_in(" 1000| 2000") + .succeeds() + .stdout_only("1.0K| 2000\n"); +} + +#[test] +fn test_delimiter_from_si() { + new_ucmd!() + .args(&["-d=,", "--from=si"]) + .pipe_in("1.2K,56") + .succeeds() + .stdout_only("1200,56\n"); +} + +#[test] +fn test_delimiter_overrides_whitespace_separator() { + // GNU numfmt reports this as “invalid suffix” + new_ucmd!() + .args(&["-d,"]) + .pipe_in("1 234,56") + .fails() + .stderr_is("numfmt: invalid number: ‘1 234’\n"); +} + +#[test] +fn test_delimiter_with_padding() { + new_ucmd!() + .args(&["-d=|", "--to=si", "--padding=5"]) + .pipe_in("1000|2000") + .succeeds() + .stdout_only(" 1.0K|2000\n"); +} + +#[test] +fn test_delimiter_with_padding_and_fields() { + new_ucmd!() + .args(&["-d=|", "--to=si", "--padding=5", "--field=-"]) + .pipe_in("1000|2000") + .succeeds() + .stdout_only(" 1.0K| 2.0K\n"); +} From 13e61c3234234a2614d172a3236bf0e691548c68 Mon Sep 17 00:00:00 2001 From: Peter Sherman Date: Mon, 15 Mar 2021 15:56:11 +0000 Subject: [PATCH 435/606] head: add support for -z/--zero-terminated --- src/uu/head/src/head.rs | 15 +++++++++++++-- tests/by-util/test_head.rs | 8 ++++++++ tests/fixtures/head/zero_terminated.expected | Bin 0 -> 182 bytes tests/fixtures/head/zero_terminated.txt | Bin 0 -> 7605 bytes 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 tests/fixtures/head/zero_terminated.expected create mode 100644 tests/fixtures/head/zero_terminated.txt diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 56d7e8452..9e92dd8c7 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -29,6 +29,7 @@ enum FilterMode { struct Settings { mode: FilterMode, verbose: bool, + zero_terminated: bool, } impl Default for Settings { @@ -36,6 +37,7 @@ impl Default for Settings { Settings { mode: FilterMode::Lines(10), verbose: false, + zero_terminated: false, } } } @@ -69,6 +71,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .optflag("q", "quiet", "never print headers giving file names") .optflag("v", "verbose", "always print headers giving file names") + .optflag("z", "zero-terminated", "line delimiter is NUL, not newline") .optflag("h", "help", "display this help and exit") .optflag("V", "version", "output version information and exit") .parse(new_args); @@ -113,6 +116,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let quiet = matches.opt_present("q"); let verbose = matches.opt_present("v"); + settings.zero_terminated = matches.opt_present("z"); let files = matches.free; // GNU implementation allows multiple declarations of "-q" and "-v" with the @@ -129,6 +133,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.verbose = true; } + if files.is_empty() { let mut buffer = BufReader::new(stdin()); head(&mut buffer, &settings); @@ -203,8 +208,14 @@ fn head(reader: &mut BufReader, settings: &Settings) -> bool { } } FilterMode::Lines(count) => { - for line in reader.lines().take(count) { - println!("{}", line.unwrap()); + if settings.zero_terminated { + for line in reader.split(0).take(count) { + print!("{}\0", String::from_utf8(line.unwrap()).unwrap()) + } + } else { + for line in reader.lines().take(count) { + println!("{}", line.unwrap()); + } } } FilterMode::NLines(count) => { diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index 4324290cb..eec82b51f 100644 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -86,6 +86,14 @@ fn test_verbose() { .stdout_is_fixture("lorem_ipsum_verbose.expected"); } +#[test] +fn test_zero_terminated() { + new_ucmd!() + .args(&["-z", "zero_terminated.txt"]) + .run() + .stdout_is_fixture("zero_terminated.expected"); +} + #[test] #[ignore] fn test_spams_newline() { diff --git a/tests/fixtures/head/zero_terminated.expected b/tests/fixtures/head/zero_terminated.expected new file mode 100644 index 0000000000000000000000000000000000000000..3c4cc058c3e55c81d16ec3ab18981d16fdb67cf1 GIT binary patch literal 182 zcmdPX(`V4r)7MMSEJ-XWDauSLElDi~i6keMKq-AAQ!~Ai3OF}0rywH{Ss*VzFSR@; zGcOe`m|a|&3)T%{=qKi6Ca1<{=Eaxi=cS|;t{nTIN#p9^tVer~RQBG?=-D+xoD zeqxd#HbEn7g2vbc<5N;|GIKLaQj6lt^NUijC`rvND5=C0PlCHEDKRBJzbGZO$k0$P zB{eOvG^ZpvBQ-f2B8WvNT)mMV(F*hOiBlSHi0Q6)Be)of`%3dN^GZrHOESw+F%N}F_{iMp0)cC~o z^rF=C#1gdRgsHHgC^ap!0=M}Pl&@`G+cYLPB-+aoPM2W&Zr#@4Vv z7mqhFh)>SXDb3A`&qze8rSYf**^QE#Fw|PW%*C%PFSR@#-Tlb!j)y6T$8KOoVsQqv zwFPDBCmDenQmIIdC74WRUO{OIEVN;QxhbY7PK1dUXC$JwfRH4Nj7)Ip0ksyf*EkXe$LlUaqTS0CKy%FHWH%`3)i z3xaiGb2mgHGc7H(C^fGn9$cAV+L?l?0JSBCW<*YEUV2Fey!ZjjLK=(ELK7hppPh=@ zBnL}@-B28F2#ZK$L3k;NENF~Pr3s24DCAR78y8>`AmV6tK?PCmf(qh`ncU1`P{ke( zi8)AEVhO6^)Z9!^#heFKfo3~~G^#rg(#5F-iACTfgq&Kz-YPCFC@4xTE{+HB&>Bl1 zA^p<4g2c?C)D&=*z~V+!d8m(2(nT(~R?02I)*jBw0j1=;9DR^oNjZsm*`QJvo+R>e z^ovuIOEUBGU~vQz$;>Utf%j_jN^_wV5QL?lk`@p1C0r9&4M+y1sD)}s&jahrjmF9M&LJ~I1{h_Vs!iS!39@-ioR|dD4_CF^bMeNGL)_W(FKXc zC8=D7lGSfAX*A>bZcHqy#4^}{T?MlCjMCi1 zy!fP?{N(KT;>;?v!6UGKOeM$$K*A#)RD+>J8dxi`B(kR5)S`6INLNX5Jh)eqlbTqD zR@8y@V^@bLbnz*I7rpot!K)v1MMbG)sYS&E+yqmE+d*&@I9&r*f##I_yb^F%4>XpA z8L+u1(kMX-mMJa)6&1MjL1j_2;T}PR1PzKjyne?bhw9V3(%jUd%;fmA%!<^M__Un- zL~O|%t14vY!4(iP03wfDE4b9m#G2Po?La8RV;HE*7N3`hI(7;U6Ewr%3b7ehnnzsd zpsB-d6v%d*#R<$+sHF};gW^l`G7C#l+ruDxK;vKF*hMi9rW)B;P-X(P8DQ-ISTU&& zlYl9PjE5JO=HeR-2T3Otr^MqK_J%0|HR`Ype8c52hQ2{ESO(fb!o`)vWrQpRtHEb0 zL;;4iC5hnnLrG#XeB>}CzMv>G7p+LfssI{#*yQ4qQq%H_P~#4y4s3LML241W8HrL- zV3CGfkO^)cmLz88=%?l9HUBc%PL zi_y43Rs(W0*!iI5Cr*osAzd`&@)y|<5W6&07q1bZ!4F-e!4F(!p{v6Tc37!U4leS_ nlkt`H<;mCvh{}`obMuob<5Mz|vk|80hlaStTf~FLiot>anuxG) literal 0 HcmV?d00001 From 1169b92dd633304c34b156ebf9a1cdbd5e5a6216 Mon Sep 17 00:00:00 2001 From: George Tsiamasiotis Date: Mon, 15 Mar 2021 21:45:09 +0200 Subject: [PATCH 436/606] travis: bump rust to 1.33.0 Follow-up to #1724 where the minimum Rust version was bumped to v1.33.0 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 65658179f..3cd7db130 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ matrix: - rust: nightly fast_finish: true include: - - rust: 1.32.0 + - rust: 1.33.0 env: FEATURES=unix # - rust: stable # os: linux From e3e5bf0178432234c4cc2d8d03ec7df6bee5bc64 Mon Sep 17 00:00:00 2001 From: Peter Sherman Date: Mon, 15 Mar 2021 20:48:49 +0000 Subject: [PATCH 437/606] Format head.rs --- src/uu/head/src/head.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 9e92dd8c7..ae5807c22 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -133,7 +133,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.verbose = true; } - if files.is_empty() { let mut buffer = BufReader::new(stdin()); head(&mut buffer, &settings); From 97f40b0aee9cf4af8724891eba058b1afbf4248d Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 17 Mar 2021 10:16:31 +0100 Subject: [PATCH 438/606] rm: add an additional flag -R for --recursive make clap support -R in addition to -r --- src/uu/rm/src/rm.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 4c81c97cc..190fe9794 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -48,6 +48,7 @@ static OPT_PRESERVE_ROOT: &str = "preserve-root"; static OPT_PROMPT: &str = "prompt"; static OPT_PROMPT_MORE: &str = "prompt-more"; static OPT_RECURSIVE: &str = "recursive"; +static OPT_RECURSIVE_R: &str = "recursive_R"; static OPT_VERBOSE: &str = "verbose"; static ARG_FILES: &str = "files"; @@ -58,7 +59,7 @@ fn get_usage() -> String { fn get_long_usage() -> String { String::from( - "By default, rm does not remove directories. Use the --recursive (-r) + "By default, rm does not remove directories. Use the --recursive (-r or -R) option to remove each listed directory, too, along with all of its contents To remove a file whose name starts with a '-', for example '-foo', @@ -82,7 +83,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .about(ABOUT) .usage(&usage[..]) .after_help(&long_usage[..]) - // TODO: make getopts support -R in addition to -r .arg( Arg::with_name(OPT_FORCE) @@ -128,6 +128,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_RECURSIVE) .help("remove directories and their contents recursively") ) + .arg( + Arg::with_name(OPT_RECURSIVE_R).short("R") + .help("Equivalent to -r") + ) .arg( Arg::with_name(OPT_DIR) .short("d") @@ -182,7 +186,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }, one_fs: matches.is_present(OPT_ONE_FILE_SYSTEM), preserve_root: !matches.is_present(OPT_NO_PRESERVE_ROOT), - recursive: matches.is_present(OPT_RECURSIVE), + recursive: matches.is_present(OPT_RECURSIVE) || matches.is_present(OPT_RECURSIVE_R), dir: matches.is_present(OPT_DIR), verbose: matches.is_present(OPT_VERBOSE), }; @@ -283,7 +287,7 @@ fn handle_dir(path: &Path, options: &Options) -> bool { had_err = true; } else { show_error!( - "could not remove directory '{}' (did you mean to pass '-r'?)", + "could not remove directory '{}' (did you mean to pass '-r' or '-R'?)", path.display() ); had_err = true; From 867e117c99a0b3e7e3ca3c902ab92875f4234d46 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 17 Mar 2021 10:20:08 +0100 Subject: [PATCH 439/606] Update test_rm.rs --- tests/by-util/test_rm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index f9a4dd0d5..27568957a 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -148,7 +148,7 @@ fn test_rm_errors() { // rm: error: could not remove directory 'test_rm_errors_directory' (did you mean to pass '-r'?) ucmd.arg(dir).fails().stderr_is( "rm: error: could not remove directory 'test_rm_errors_directory' (did you mean \ - to pass '-r'?)\n", + to pass '-r' or '-R'?)\n", ); } From fbb9c50050af8f8e0c89327150d8176193873d1e Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Tue, 16 Mar 2021 09:42:06 -0400 Subject: [PATCH 440/606] tr: process octal escape sequences closes #1817 --- src/uu/tr/src/expand.rs | 54 ++++++++++++++++++++++++++-------- tests/by-util/test_tr.rs | 63 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 12 deletions(-) diff --git a/src/uu/tr/src/expand.rs b/src/uu/tr/src/expand.rs index 3291d57ae..e71cf262c 100644 --- a/src/uu/tr/src/expand.rs +++ b/src/uu/tr/src/expand.rs @@ -14,17 +14,46 @@ use std::cmp::min; use std::iter::Peekable; use std::ops::RangeInclusive; +/// Parse a backslash escape sequence to the corresponding character. Assumes +/// the string starts from the character _after_ the `\` and is not empty. +/// +/// Returns a tuple containing the character and the number of characters +/// consumed from the input. The alphabetic escape sequences consume 1 +/// character; octal escape sequences consume 1 to 3 octal digits. #[inline] -fn unescape_char(c: char) -> char { - match c { - 'a' => 0x07u8 as char, - 'b' => 0x08u8 as char, - 'f' => 0x0cu8 as char, - 'v' => 0x0bu8 as char, - 'n' => '\n', - 'r' => '\r', - 't' => '\t', - _ => c, +fn parse_sequence(s: &str) -> (char, usize) { + let c = s.chars().next().expect("invalid escape: empty string"); + + if '0' <= c && c <= '7' { + let mut v = c.to_digit(8).unwrap(); + let mut consumed = 1; + let bits_per_digit = 3; + + for c in s.chars().skip(1).take(2) { + match c.to_digit(8) { + Some(c) => { + v = (v << bits_per_digit) | c; + consumed += 1; + } + None => break, + } + } + + (from_u32(v).expect("invalid octal escape"), consumed) + } else { + ( + match c { + 'a' => 0x07u8 as char, + 'b' => 0x08u8 as char, + 'f' => 0x0cu8 as char, + 'v' => 0x0bu8 as char, + 'n' => '\n', + 'r' => '\r', + 't' => '\t', + c => c, + }, + 1, + ) } } @@ -52,8 +81,9 @@ impl<'a> Iterator for Unescape<'a> { '\\' if self.string.len() > 1 => { // yes---it's \ and it's not the last char in a string // we know that \ is 1 byte long so we can index into the string safely - let c = self.string[1..].chars().next().unwrap(); - (Some(unescape_char(c)), 1 + c.len_utf8()) + let (c, consumed) = parse_sequence(&self.string[1..]); + + (Some(c), 1 + consumed) } c => (Some(c), c.len_utf8()), // not an escape char }; diff --git a/tests/by-util/test_tr.rs b/tests/by-util/test_tr.rs index b32d98d29..a1500bcf6 100644 --- a/tests/by-util/test_tr.rs +++ b/tests/by-util/test_tr.rs @@ -134,3 +134,66 @@ fn missing_required_second_arg_fails() { assert!(!result.success); assert!(result.stderr.contains("missing operand after")); } + +#[test] +fn test_interpret_backslash_escapes() { + new_ucmd!() + .args(&["abfnrtv", r"\a\b\f\n\r\t\v"]) + .pipe_in("abfnrtv") + .succeeds() + .stdout_is("\u{7}\u{8}\u{c}\n\r\t\u{b}"); +} + +#[test] +fn test_interpret_unrecognized_backslash_escape_as_character() { + new_ucmd!() + .args(&["qcz+=~-", r"\q\c\z\+\=\~\-"]) + .pipe_in("qcz+=~-") + .succeeds() + .stdout_is("qcz+=~-"); +} + +#[test] +fn test_interpret_single_octal_escape() { + new_ucmd!() + .args(&["X", r"\015"]) + .pipe_in("X") + .succeeds() + .stdout_is("\r"); +} + +#[test] +fn test_interpret_one_and_two_digit_octal_escape() { + new_ucmd!() + .args(&["XYZ", r"\0\11\77"]) + .pipe_in("XYZ") + .succeeds() + .stdout_is("\0\t?"); +} + +#[test] +fn test_octal_escape_is_at_most_three_digits() { + new_ucmd!() + .args(&["XY", r"\0156"]) + .pipe_in("XY") + .succeeds() + .stdout_is("\r6"); +} + +#[test] +fn test_non_octal_digit_ends_escape() { + new_ucmd!() + .args(&["rust", r"\08\11956"]) + .pipe_in("rust") + .succeeds() + .stdout_is("\08\t9"); +} + +#[test] +fn test_interpret_backslash_at_eol_literally() { + new_ucmd!() + .args(&["X", r"\"]) + .pipe_in("X") + .succeeds() + .stdout_is("\\"); +} From 64b8c8aac79c2a9c992667320a30ca6b39d6c9ca Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Fri, 12 Mar 2021 13:38:02 -0500 Subject: [PATCH 441/606] nice: move from getopts to clap #1794 --- Cargo.lock | 3 +- src/uu/nice/Cargo.toml | 3 +- src/uu/nice/src/nice.rs | 97 +++++++++++++++++--------------------- tests/by-util/test_nice.rs | 57 +++++++++++++++++++++- 4 files changed, 104 insertions(+), 56 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ebb288d3d..be021fea8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1822,8 +1822,9 @@ dependencies = [ name = "uu_nice" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", ] diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index e7d184c96..c851daa5a 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -15,8 +15,9 @@ edition = "2018" path = "src/nice.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" +nix = { version="<=0.13" } uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/nice/src/nice.rs b/src/uu/nice/src/nice.rs index 1f79ea09b..c1d3345af 100644 --- a/src/uu/nice/src/nice.rs +++ b/src/uu/nice/src/nice.rs @@ -15,7 +15,7 @@ use std::ffi::CString; use std::io::Error; use std::ptr; -const NAME: &str = "nice"; +use clap::{App, AppSettings, Arg}; const VERSION: &str = env!("CARGO_PKG_VERSION"); // XXX: PRIO_PROCESS is 0 on at least FreeBSD and Linux. Don't know about Mac OS X. @@ -26,64 +26,57 @@ extern "C" { fn setpriority(which: c_int, who: c_int, prio: c_int) -> c_int; } -pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); +pub mod options { + pub static ADJUSTMENT: &str = "adjustment"; + pub static COMMAND: &str = "COMMAND"; +} - let mut opts = getopts::Options::new(); - - opts.optopt( - "n", - "adjustment", - "add N to the niceness (default is 10)", - "N", - ); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(err) => { - show_error!("{}", err); - return 125; - } - }; - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - if matches.opt_present("help") { - let msg = format!( - "{0} {1} - -Usage: +fn get_usage() -> String { + format!( + " {0} [OPTIONS] [COMMAND [ARGS]] Run COMMAND with an adjusted niceness, which affects process scheduling. With no COMMAND, print the current niceness. Niceness values range from at least -20 (most favorable to the process) to 19 (least favorable to the process).", - NAME, VERSION - ); + executable!() + ) +} - print!("{}", opts.usage(&msg)); - return 0; - } +pub fn uumain(args: impl uucore::Args) -> i32 { + let usage = get_usage(); - let mut niceness = unsafe { getpriority(PRIO_PROCESS, 0) }; + let matches = App::new(executable!()) + .setting(AppSettings::TrailingVarArg) + .version(VERSION) + .usage(&usage[..]) + .arg( + Arg::with_name(options::ADJUSTMENT) + .short("n") + .long(options::ADJUSTMENT) + .help("add N to the niceness (default is 10)") + .takes_value(true) + .allow_hyphen_values(true), + ) + .arg(Arg::with_name(options::COMMAND).multiple(true)) + .get_matches_from(args); + + let mut niceness = unsafe { + nix::errno::Errno::clear(); + getpriority(PRIO_PROCESS, 0) + }; if Error::last_os_error().raw_os_error().unwrap() != 0 { - show_error!("{}", Error::last_os_error()); + show_error!("getpriority: {}", Error::last_os_error()); return 125; } - let adjustment = match matches.opt_str("adjustment") { + let adjustment = match matches.value_of(options::ADJUSTMENT) { Some(nstr) => { - if matches.free.is_empty() { + if !matches.is_present(options::COMMAND) { show_error!( - "A command must be given with an adjustment. - Try \"{} --help\" for more information.", - args[0] + "A command must be given with an adjustment.\nTry \"{} --help\" for more information.", + executable!() ); return 125; } @@ -96,7 +89,7 @@ process).", } } None => { - if matches.free.is_empty() { + if !matches.is_present(options::COMMAND) { println!("{}", niceness); return 0; } @@ -105,25 +98,23 @@ process).", }; niceness += adjustment; - unsafe { - setpriority(PRIO_PROCESS, 0, niceness); - } - if Error::last_os_error().raw_os_error().unwrap() != 0 { - show_warning!("{}", Error::last_os_error()); + if unsafe { setpriority(PRIO_PROCESS, 0, niceness) } == -1 { + show_warning!("setpriority: {}", Error::last_os_error()); } let cstrs: Vec = matches - .free - .iter() + .values_of(options::COMMAND) + .unwrap() .map(|x| CString::new(x.as_bytes()).unwrap()) .collect(); + let mut args: Vec<*const c_char> = cstrs.iter().map(|s| s.as_ptr()).collect(); args.push(ptr::null::()); unsafe { execvp(args[0], args.as_mut_ptr()); } - show_error!("{}", Error::last_os_error()); + show_error!("execvp: {}", Error::last_os_error()); if Error::last_os_error().raw_os_error().unwrap() as c_int == libc::ENOENT { 127 } else { diff --git a/tests/by-util/test_nice.rs b/tests/by-util/test_nice.rs index 651491045..e10314f57 100644 --- a/tests/by-util/test_nice.rs +++ b/tests/by-util/test_nice.rs @@ -1 +1,56 @@ -// ToDO: add tests +use crate::common::util::*; + +#[test] +fn test_get_current_niceness() { + // NOTE: this assumes the test suite is being run with a default niceness + // of 0, which may not necessarily be true + new_ucmd!().run().stdout_is("0\n"); +} + +#[test] +fn test_negative_adjustment() { + // This assumes the test suite is run as a normal (non-root) user, and as + // such attempting to set a negative niceness value will be rejected by + // the OS. If it gets denied, then we know a negative value was parsed + // correctly. + + let res = new_ucmd!().args(&["-n", "-1", "true"]).run(); + assert!(res.stderr.starts_with("nice: warning: setpriority: Permission denied")); +} + +#[test] +fn test_adjustment_with_no_command_should_error() { + new_ucmd!() + .args(&["-n", "19"]) + .run() + .stderr_is("nice: error: A command must be given with an adjustment.\nTry \"nice --help\" for more information.\n"); +} + +#[test] +fn test_command_with_no_adjustment() { + new_ucmd!().args(&["echo", "a"]).run().stdout_is("a\n"); +} + +#[test] +fn test_command_with_no_args() { + new_ucmd!() + .args(&["-n", "19", "echo"]) + .run() + .stdout_is("\n"); +} + +#[test] +fn test_command_with_args() { + new_ucmd!() + .args(&["-n", "19", "echo", "a", "b", "c"]) + .run() + .stdout_is("a b c\n"); +} + +#[test] +fn test_command_where_command_takes_n_flag() { + new_ucmd!() + .args(&["-n", "19", "echo", "-n", "a"]) + .run() + .stdout_is("a"); +} From 955fa74a42c91dea96da691a16930e93a668f988 Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 17 Mar 2021 13:58:53 +0100 Subject: [PATCH 442/606] 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 --- src/uu/factor/src/factor.rs | 56 ++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 7beb6a043..2715bad71 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -225,20 +225,19 @@ pub fn factor(num: u64) -> Factors { #[cfg(test)] mod tests { - use super::{factor, Factors}; + use super::{factor, Decomposition, Exponent, Factors}; use quickcheck::quickcheck; + use smallvec::smallvec; + use std::cell::RefCell; #[test] - fn factor_correctly_recombines_prior_test_failures() { - let prior_failures = [ - // * integers with duplicate factors (ie, N.pow(M)) - 4566769_u64, // == 2137.pow(2) - 2044854919485649_u64, - 18446739546814299361_u64, - 18446738440860217487_u64, - 18446736729316206481_u64, - ]; - assert!(prior_failures.iter().all(|i| factor(*i).product() == *i)); + fn factor_2044854919485649() { + let f = Factors(RefCell::new(Decomposition(smallvec![ + (503, 1), + (2423, 1), + (40961, 2) + ]))); + assert_eq!(factor(f.product()), f); } #[test] @@ -248,15 +247,6 @@ mod tests { .all(|i| factor(i).product() == i)); } - #[test] - fn factor_recombines_small_squares() { - // factor(18446736729316206481) == 4294966441 ** 2 ; causes debug_assert fault for repeated decomposition factor in add() - // ToDO: explain/combine with factor_18446736729316206481 and factor_18446739546814299361 tests - assert!((1..10_000) - .map(|i| (2 * i + 1) * (2 * i + 1)) - .all(|i| factor(i).product() == i)); - } - #[test] fn factor_recombines_overflowing() { assert!((0..250) @@ -282,9 +272,15 @@ mod tests { i == 0 || factor(i).product() == i } - fn recombines_factors(f: Factors) -> bool { + fn recombines_factors(f: Factors) -> () { assert_eq!(factor(f.product()), f); - true + } + + fn exponentiate_factors(f: Factors, e: Exponent) -> () { + if e == 0 { return; } + if let Some(fe) = f.product().checked_pow(e.into()) { + assert_eq!(factor(fe), f ^ e); + } } } } @@ -319,3 +315,19 @@ impl quickcheck::Arbitrary for Factors { } } } + +#[cfg(test)] +impl std::ops::BitXor for Factors { + type Output = Self; + + fn bitxor(self, rhs: Exponent) -> Factors { + debug_assert_ne!(rhs, 0); + let mut r = Factors::one(); + for (p, e) in self.0.borrow().0.iter() { + r.add(*p, rhs * e); + } + + debug_assert_eq!(r.product(), self.product().pow(rhs.into())); + return r; + } +} From d9adec34967f4e641937fcbedeb0aab4784aa287 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Wed, 17 Mar 2021 14:46:25 +0100 Subject: [PATCH 443/606] add comment --- src/uu/rm/src/rm.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 190fe9794..466a8d6c1 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -129,6 +129,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("remove directories and their contents recursively") ) .arg( + // To mimic GNU's behavior we also want the '-R' flag. However, using clap's + // alias method 'visible_alias("R")' would result in a long '--R' flag. Arg::with_name(OPT_RECURSIVE_R).short("R") .help("Equivalent to -r") ) From c5792a4c477fdf80b3932935e452615b225832e1 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 17 Mar 2021 23:15:03 +0100 Subject: [PATCH 444/606] tests/ls: add tests for colors --- tests/by-util/test_ls.rs | 51 ++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index fea912695..52678b2fa 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -374,19 +374,56 @@ fn test_ls_recursive() { assert!(result.stdout.contains("a\\b:\nb")); } +#[cfg(unix)] #[test] fn test_ls_ls_color() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.mkdir("a"); + at.mkdir("a/nested_dir"); at.mkdir("z"); - at.touch(&at.plus_as_string("a/a")); - scene.ucmd().arg("--color").succeeds(); - scene.ucmd().arg("--color=always").succeeds(); - scene.ucmd().arg("--color=never").succeeds(); - scene.ucmd().arg("--color").arg("a").succeeds(); - scene.ucmd().arg("--color=always").arg("a/a").succeeds(); - scene.ucmd().arg("--color=never").arg("z").succeeds(); + at.touch(&at.plus_as_string("a/nested_file")); + at.touch("test-color"); + + let a_with_colors = "\x1b[01;34ma\x1b[0m"; + let z_with_colors = "\x1b[01;34mz\x1b[0m"; + let nested_dir_with_colors = "\x1b[01;34mnested_dir\x1b[0m"; + + // Color is disabled by default + let result = scene.ucmd().succeeds(); + assert!(!result.stdout.contains(a_with_colors)); + assert!(!result.stdout.contains(z_with_colors)); + + // Color should be enabled + let result = scene.ucmd().arg("--color").succeeds(); + assert!(result.stdout.contains(a_with_colors)); + assert!(result.stdout.contains(z_with_colors)); + + // Color should be enabled + let result = scene.ucmd().arg("--color=always").succeeds(); + assert!(result.stdout.contains(a_with_colors)); + assert!(result.stdout.contains(z_with_colors)); + + // Color should be disabled + let result = scene.ucmd().arg("--color=never").succeeds(); + assert!(!result.stdout.contains(a_with_colors)); + assert!(!result.stdout.contains(z_with_colors)); + + // Nested dir should be shown and colored + let result = scene.ucmd().arg("--color").arg("a").succeeds(); + assert!(result.stdout.contains(nested_dir_with_colors)); + + // Color has no effect + let result = scene + .ucmd() + .arg("--color=always") + .arg("a/nested_file") + .succeeds(); + assert!(result.stdout.contains("a/nested_file\n")); + + // No output + let result = scene.ucmd().arg("--color=never").arg("z").succeeds(); + assert_eq!(result.stdout, ""); } #[cfg(not(any(target_os = "macos", target_os = "windows")))] // Truncate not available on mac or win From e5b577fb27c33c8c539dfbaf3b050e71e47fb7e2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 18 Mar 2021 10:13:29 +0100 Subject: [PATCH 445/606] Update cargo.lock --- Cargo.lock | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9dcc23ff2..78aef58bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -193,7 +193,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -404,7 +404,7 @@ dependencies = [ "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", @@ -517,7 +517,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1035,7 +1035,7 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.4" +version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1471,7 +1471,7 @@ version = "0.0.4" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1557,7 +1557,7 @@ dependencies = [ name = "uu_expand" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1634,7 +1634,7 @@ dependencies = [ "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1838,7 +1838,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1939,7 +1939,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -2598,7 +2598,7 @@ dependencies = [ "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" "checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" -"checksum regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "54fd1046a3107eb58f42de31d656fee6853e5d276c455fd943742dce89fc3dd3" +"checksum regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" "checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" From 1d271991af968e0884bfef4e91f9b8d3753915b0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 18 Mar 2021 10:24:30 +0100 Subject: [PATCH 446/606] Rustfmt new tests --- tests/by-util/test_cat.rs | 22 +++++++++++----------- tests/by-util/test_nice.rs | 4 +++- tests/by-util/test_nl.rs | 16 ++++++++-------- tests/by-util/test_rm.rs | 2 +- tests/by-util/test_rmdir.rs | 8 ++++---- tests/by-util/test_unlink.rs | 6 +++--- tests/by-util/test_wc.rs | 2 +- 7 files changed, 31 insertions(+), 29 deletions(-) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index a3e321139..b194eb9b0 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -10,16 +10,16 @@ fn test_output_multi_files_print_all_chars() { .succeeds() .stdout_only( " 1\tabcde$\n 2\tfghij$\n 3\tklmno$\n 4\tpqrst$\n \ - 5\tuvwxyz$\n 6\t^@^A^B^C^D^E^F^G^H^I$\n \ - 7\t^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\\^]^^^_ \ - !\"#$%&\'()*+,-./0123456789:;\ - <=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~^?M-^@M-^AM-^\ - BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^KM-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^V\ - M-^WM-^XM-^YM-^ZM-^[M-^\\M-^]M-^^M-^_M- \ - M-!M-\"M-#M-$M-%M-&M-\'M-(M-)M-*M-+M-,M--M-.M-/M-0M-1M-2M-3M-4M-5M-6M-7M-8M-9M-:\ - M-;M-M-?M-@M-AM-BM-CM-DM-EM-FM-GM-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-U\ - M-VM-WM-XM-YM-ZM-[M-\\M-]M-^M-_M-`M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-\ - pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}M-~M-^?", + 5\tuvwxyz$\n 6\t^@^A^B^C^D^E^F^G^H^I$\n \ + 7\t^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\\^]^^^_ \ + !\"#$%&\'()*+,-./0123456789:;\ + <=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~^?M-^@M-^AM-^\ + BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^KM-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^V\ + M-^WM-^XM-^YM-^ZM-^[M-^\\M-^]M-^^M-^_M- \ + M-!M-\"M-#M-$M-%M-&M-\'M-(M-)M-*M-+M-,M--M-.M-/M-0M-1M-2M-3M-4M-5M-6M-7M-8M-9M-:\ + M-;M-M-?M-@M-AM-BM-CM-DM-EM-FM-GM-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-U\ + M-VM-WM-XM-YM-ZM-[M-\\M-]M-^M-_M-`M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-\ + pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}M-~M-^?", ); } @@ -30,7 +30,7 @@ fn test_numbered_lines_no_trailing_newline() { .succeeds() .stdout_only( " 1\ttext without a trailing newlineabcde\n 2\tfghij\n \ - 3\tklmno\n 4\tpqrst\n 5\tuvwxyz\n", + 3\tklmno\n 4\tpqrst\n 5\tuvwxyz\n", ); } diff --git a/tests/by-util/test_nice.rs b/tests/by-util/test_nice.rs index e10314f57..7e704fc00 100644 --- a/tests/by-util/test_nice.rs +++ b/tests/by-util/test_nice.rs @@ -15,7 +15,9 @@ fn test_negative_adjustment() { // correctly. let res = new_ucmd!().args(&["-n", "-1", "true"]).run(); - assert!(res.stderr.starts_with("nice: warning: setpriority: Permission denied")); + assert!(res + .stderr + .starts_with("nice: warning: setpriority: Permission denied")); } #[test] diff --git a/tests/by-util/test_nl.rs b/tests/by-util/test_nl.rs index fca73c37b..3ca039d19 100644 --- a/tests/by-util/test_nl.rs +++ b/tests/by-util/test_nl.rs @@ -23,8 +23,8 @@ fn test_padding_without_overflow() { .run() .stdout_is( "000001xL1\n001001xL2\n002001xL3\n003001xL4\n004001xL5\n005001xL6\n006001xL7\n0070\ - 01xL8\n008001xL9\n009001xL10\n010001xL11\n011001xL12\n012001xL13\n013001xL14\n014\ - 001xL15\n", + 01xL8\n008001xL9\n009001xL10\n010001xL11\n011001xL12\n012001xL13\n013001xL14\n014\ + 001xL15\n", ); } @@ -35,7 +35,7 @@ fn test_padding_with_overflow() { .run() .stdout_is( "0001xL1\n1001xL2\n2001xL3\n3001xL4\n4001xL5\n5001xL6\n6001xL7\n7001xL8\n8001xL9\n\ - 9001xL10\n10001xL11\n11001xL12\n12001xL13\n13001xL14\n14001xL15\n", + 9001xL10\n10001xL11\n11001xL12\n12001xL13\n13001xL14\n14001xL15\n", ); } @@ -45,15 +45,15 @@ fn test_sections_and_styles() { ( "section.txt", "\nHEADER1\nHEADER2\n\n1 |BODY1\n2 \ - |BODY2\n\nFOOTER1\nFOOTER2\n\nNEXTHEADER1\nNEXTHEADER2\n\n1 \ - |NEXTBODY1\n2 |NEXTBODY2\n\nNEXTFOOTER1\nNEXTFOOTER2\n", + |BODY2\n\nFOOTER1\nFOOTER2\n\nNEXTHEADER1\nNEXTHEADER2\n\n1 \ + |NEXTBODY1\n2 |NEXTBODY2\n\nNEXTFOOTER1\nNEXTFOOTER2\n", ), ( "joinblanklines.txt", "1 |Nonempty\n2 |Nonempty\n3 |Followed by 10x empty\n\n\n\n\n4 \ - |\n\n\n\n\n5 |\n6 |Followed by 5x empty\n\n\n\n\n7 |\n8 \ - |Followed by 4x empty\n\n\n\n\n9 |Nonempty\n10 |Nonempty\n11 \ - |Nonempty.\n", + |\n\n\n\n\n5 |\n6 |Followed by 5x empty\n\n\n\n\n7 |\n8 \ + |Followed by 4x empty\n\n\n\n\n9 |Nonempty\n10 |Nonempty\n11 \ + |Nonempty.\n", ), ] { new_ucmd!() diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 27568957a..c3635d202 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -148,7 +148,7 @@ fn test_rm_errors() { // rm: error: could not remove directory 'test_rm_errors_directory' (did you mean to pass '-r'?) ucmd.arg(dir).fails().stderr_is( "rm: error: could not remove directory 'test_rm_errors_directory' (did you mean \ - to pass '-r' or '-R'?)\n", + to pass '-r' or '-R'?)\n", ); } diff --git a/tests/by-util/test_rmdir.rs b/tests/by-util/test_rmdir.rs index 5f87b5af6..34531cf22 100644 --- a/tests/by-util/test_rmdir.rs +++ b/tests/by-util/test_rmdir.rs @@ -40,7 +40,7 @@ fn test_rmdir_nonempty_directory_no_parents() { ucmd.arg(dir).fails().stderr_is( "rmdir: error: failed to remove 'test_rmdir_nonempty_no_parents': Directory not \ - empty\n", + empty\n", ); assert!(at.dir_exists(dir)); @@ -60,9 +60,9 @@ fn test_rmdir_nonempty_directory_with_parents() { ucmd.arg("-p").arg(dir).fails().stderr_is( "rmdir: error: failed to remove 'test_rmdir_nonempty/with/parents': Directory not \ - empty\nrmdir: error: failed to remove 'test_rmdir_nonempty/with': Directory not \ - empty\nrmdir: error: failed to remove 'test_rmdir_nonempty': Directory not \ - empty\n", + empty\nrmdir: error: failed to remove 'test_rmdir_nonempty/with': Directory not \ + empty\nrmdir: error: failed to remove 'test_rmdir_nonempty': Directory not \ + empty\n", ); assert!(at.dir_exists(dir)); diff --git a/tests/by-util/test_unlink.rs b/tests/by-util/test_unlink.rs index daac6d3b3..fa8f962c4 100644 --- a/tests/by-util/test_unlink.rs +++ b/tests/by-util/test_unlink.rs @@ -23,7 +23,7 @@ fn test_unlink_multiple_files() { ucmd.arg(file_a).arg(file_b).fails().stderr_is( "unlink: error: extra operand: 'test_unlink_multiple_file_b'\nTry 'unlink --help' \ - for more information.\n", + for more information.\n", ); } @@ -36,7 +36,7 @@ fn test_unlink_directory() { ucmd.arg(dir).fails().stderr_is( "unlink: error: cannot unlink 'test_unlink_empty_directory': Not a regular file \ - or symlink\n", + or symlink\n", ); } @@ -46,6 +46,6 @@ fn test_unlink_nonexistent() { new_ucmd!().arg(file).fails().stderr_is( "unlink: error: Cannot stat 'test_unlink_nonexistent': No such file or directory \ - (os error 2)\n", + (os error 2)\n", ); } diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index fc9c00ecc..b064d7e0e 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -81,6 +81,6 @@ fn test_multiple_default() { .run() .stdout_is( " 13 109 772 lorem_ipsum.txt\n 18 204 1115 moby_dick.txt\n 5 57 302 \ - alice_in_wonderland.txt\n 36 370 2189 total\n", + alice_in_wonderland.txt\n 36 370 2189 total\n", ); } From ed7e24c5b03fad4c020af2f67e7f7cba9d9da29e Mon Sep 17 00:00:00 2001 From: aspen Date: Wed, 17 Mar 2021 21:29:32 -0400 Subject: [PATCH 447/606] uu_more: update nix to 0.13 --- Cargo.lock | 40 +++++++++++----------------------------- src/uu/more/Cargo.toml | 6 +++--- src/uu/more/src/more.rs | 22 +++++++++++----------- 3 files changed, 25 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9dcc23ff2..9d9fb6c24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -59,11 +59,6 @@ name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "bitflags" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "bitflags" version = "1.2.1" @@ -193,7 +188,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -404,7 +399,7 @@ dependencies = [ "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", @@ -517,7 +512,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -726,17 +721,6 @@ dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "nix" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "nix" version = "0.13.1" @@ -1035,7 +1019,7 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.4" +version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1471,7 +1455,7 @@ version = "0.0.4" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1557,7 +1541,7 @@ dependencies = [ name = "uu_expand" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1634,7 +1618,7 @@ dependencies = [ "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1802,7 +1786,7 @@ name = "uu_more" version = "0.0.4" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", @@ -1838,7 +1822,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1939,7 +1923,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -2490,7 +2474,6 @@ dependencies = [ "checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" "checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" "checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" -"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" @@ -2561,7 +2544,6 @@ dependencies = [ "checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" "checksum memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" "checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" -"checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" "checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" "checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" @@ -2598,7 +2580,7 @@ dependencies = [ "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" "checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" -"checksum regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "54fd1046a3107eb58f42de31d656fee6853e5d276c455fd943742dce89fc3dd3" +"checksum regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" "checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index 3c1746bd4..acd9378b2 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -16,15 +16,15 @@ path = "src/more.rs" [dependencies] getopts = "0.2.18" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } -uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +uucore = { version = ">=0.0.7", package = "uucore", path = "../../uucore" } +uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" } [target.'cfg(target_os = "redox")'.dependencies] redox_termios = "0.1" redox_syscall = "0.1" [target.'cfg(all(unix, not(target_os = "fuchsia")))'.dependencies] -nix = "0.8.1" +nix = "<=0.13" [[bin]] name = "more" diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index de4e10187..524b0fbc4 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -17,7 +17,7 @@ use std::io::{stdout, Read, Write}; #[cfg(all(unix, not(target_os = "fuchsia")))] extern crate nix; #[cfg(all(unix, not(target_os = "fuchsia")))] -use nix::sys::termios; +use nix::sys::termios::{self, LocalFlags, SetArg}; #[cfg(target_os = "redox")] extern crate redox_termios; @@ -92,10 +92,10 @@ fn help(usage: &str) { fn setup_term() -> termios::Termios { let mut term = termios::tcgetattr(0).unwrap(); // Unset canonical mode, so we get characters immediately - term.c_lflag.remove(termios::ICANON); + term.local_flags.remove(LocalFlags::ICANON); // Disable local echo - term.c_lflag.remove(termios::ECHO); - termios::tcsetattr(0, termios::TCSADRAIN, &term).unwrap(); + term.local_flags.remove(LocalFlags::ECHO); + termios::tcsetattr(0, SetArg::TCSADRAIN, &term).unwrap(); term } @@ -110,8 +110,8 @@ fn setup_term() -> redox_termios::Termios { let mut term = redox_termios::Termios::default(); let fd = syscall::dup(0, b"termios").unwrap(); syscall::read(fd, &mut term).unwrap(); - term.c_lflag &= !redox_termios::ICANON; - term.c_lflag &= !redox_termios::ECHO; + term.local_flags &= !redox_termios::ICANON; + term.local_flags &= !redox_termios::ECHO; syscall::write(fd, &term).unwrap(); let _ = syscall::close(fd); term @@ -119,9 +119,9 @@ fn setup_term() -> redox_termios::Termios { #[cfg(all(unix, not(target_os = "fuchsia")))] fn reset_term(term: &mut termios::Termios) { - term.c_lflag.insert(termios::ICANON); - term.c_lflag.insert(termios::ECHO); - termios::tcsetattr(0, termios::TCSADRAIN, &term).unwrap(); + term.local_flags.insert(LocalFlags::ICANON); + term.local_flags.insert(LocalFlags::ECHO); + termios::tcsetattr(0, SetArg::TCSADRAIN, &term).unwrap(); } #[cfg(any(windows, target_os = "fuchsia"))] @@ -132,8 +132,8 @@ fn reset_term(_: &mut usize) {} fn reset_term(term: &mut redox_termios::Termios) { let fd = syscall::dup(0, b"termios").unwrap(); syscall::read(fd, term).unwrap(); - term.c_lflag |= redox_termios::ICANON; - term.c_lflag |= redox_termios::ECHO; + term.local_flags |= redox_termios::ICANON; + term.local_flags |= redox_termios::ECHO; syscall::write(fd, &term).unwrap(); let _ = syscall::close(fd); } From 4e29b693f89907cc7cf401565dcd6d355a34bf55 Mon Sep 17 00:00:00 2001 From: aspen Date: Wed, 17 Mar 2021 21:32:34 -0400 Subject: [PATCH 448/606] uutils: change every `target_os = "macos"` to `target_vendor = "apple"` --- Cargo.lock | 20 ++++++++++---------- src/uu/chroot/src/chroot.rs | 2 +- src/uu/df/src/df.rs | 22 +++++++++++----------- src/uu/id/src/id.rs | 2 +- src/uu/nohup/src/nohup.rs | 2 +- src/uu/nproc/src/nproc.rs | 6 +++--- src/uu/stat/src/fsext.rs | 20 ++++++++++---------- src/uu/stdbuf/build.rs | 4 ++-- src/uu/stdbuf/src/stdbuf.rs | 4 ++-- src/uu/uname/src/uname.rs | 2 +- src/uu/who/src/who.rs | 14 ++------------ src/uucore/src/lib/features/entries.rs | 8 ++++---- src/uucore/src/lib/features/signals.rs | 2 +- src/uucore/src/lib/features/utmpx.rs | 4 ++-- tests/by-util/test_chgrp.rs | 2 +- tests/by-util/test_du.rs | 20 ++++++++++---------- tests/by-util/test_hostname.rs | 2 +- tests/by-util/test_ls.rs | 2 +- 18 files changed, 64 insertions(+), 74 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9dcc23ff2..78aef58bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -193,7 +193,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -404,7 +404,7 @@ dependencies = [ "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", @@ -517,7 +517,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1035,7 +1035,7 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.4" +version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1471,7 +1471,7 @@ version = "0.0.4" dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1557,7 +1557,7 @@ dependencies = [ name = "uu_expand" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1634,7 +1634,7 @@ dependencies = [ "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1838,7 +1838,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1939,7 +1939,7 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -2598,7 +2598,7 @@ dependencies = [ "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" "checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" -"checksum regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "54fd1046a3107eb58f42de31d656fee6853e5d276c455fd943742dce89fc3dd3" +"checksum regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" "checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index 773207363..ab654abf8 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -164,7 +164,7 @@ fn set_main_group(group: &str) { } } -#[cfg(any(target_os = "macos", target_os = "freebsd"))] +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] fn set_groups(groups: Vec) -> libc::c_int { unsafe { setgroups(groups.len() as libc::c_int, groups.as_ptr()) } } diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index ed2865728..57caf7970 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -32,15 +32,15 @@ use std::ffi::CString; #[cfg(unix)] use std::mem; -#[cfg(any(target_os = "macos", target_os = "freebsd"))] +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] use libc::c_int; -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] use libc::statfs; -#[cfg(any(target_os = "macos", target_os = "freebsd"))] +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] use std::ffi::CStr; -#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "windows"))] +#[cfg(any(target_vendor = "apple", target_os = "freebsd", target_os = "windows"))] use std::ptr; -#[cfg(any(target_os = "macos", target_os = "freebsd"))] +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] use std::slice; #[cfg(target_os = "freebsd")] @@ -137,7 +137,7 @@ struct MountInfo { #[cfg(all( target_os = "freebsd", - not(all(target_os = "macos", target_arch = "x86_64")) + not(all(target_vendor = "apple", target_arch = "x86_64")) ))] #[repr(C)] #[derive(Copy, Clone)] @@ -209,20 +209,20 @@ fn get_usage() -> String { format!("{0} [OPTION]... [FILE]...", executable!()) } -#[cfg(any(target_os = "freebsd", target_os = "macos"))] +#[cfg(any(target_os = "freebsd", target_vendor = "apple"))] extern "C" { - #[cfg(all(target_os = "macos", target_arch = "x86_64"))] + #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] #[link_name = "getmntinfo$INODE64"] fn getmntinfo(mntbufp: *mut *mut statfs, flags: c_int) -> c_int; #[cfg(any( all(target_os = "freebsd"), - all(target_os = "macos", target_arch = "aarch64") + all(target_vendor = "apple", target_arch = "aarch64") ))] fn getmntinfo(mntbufp: *mut *mut statfs, flags: c_int) -> c_int; } -#[cfg(any(target_os = "freebsd", target_os = "macos"))] +#[cfg(any(target_os = "freebsd", target_vendor = "apple"))] impl From for MountInfo { fn from(statfs: statfs) -> Self { let mut info = MountInfo { @@ -585,7 +585,7 @@ fn read_fs_list() -> Vec { }) .collect::>() } - #[cfg(any(target_os = "freebsd", target_os = "macos"))] + #[cfg(any(target_os = "freebsd", target_vendor = "apple"))] { let mut mptr: *mut statfs = ptr::null_mut(); let len = unsafe { getmntinfo(&mut mptr, 1 as c_int) }; diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index f07a850fa..4536622c7 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -291,7 +291,7 @@ fn pretty(possible_pw: Option) { } } -#[cfg(any(target_os = "macos", target_os = "freebsd"))] +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] fn pline(possible_uid: Option) { let uid = possible_uid.unwrap_or_else(getuid); let pw = Passwd::locate(uid).unwrap(); diff --git a/src/uu/nohup/src/nohup.rs b/src/uu/nohup/src/nohup.rs index 67e281e38..5fce208da 100644 --- a/src/uu/nohup/src/nohup.rs +++ b/src/uu/nohup/src/nohup.rs @@ -23,7 +23,7 @@ use uucore::fs::{is_stderr_interactive, is_stdin_interactive, is_stdout_interact static NAME: &str = "nohup"; static VERSION: &str = env!("CARGO_PKG_VERSION"); -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] extern "C" { fn _vprocmgr_detach_from_console(flags: u32) -> *const libc::c_int; } diff --git a/src/uu/nproc/src/nproc.rs b/src/uu/nproc/src/nproc.rs index 4eb538618..285cf764f 100644 --- a/src/uu/nproc/src/nproc.rs +++ b/src/uu/nproc/src/nproc.rs @@ -15,7 +15,7 @@ use std::env; #[cfg(target_os = "linux")] pub const _SC_NPROCESSORS_CONF: libc::c_int = 83; -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] pub const _SC_NPROCESSORS_CONF: libc::c_int = libc::_SC_NPROCESSORS_CONF; #[cfg(target_os = "freebsd")] pub const _SC_NPROCESSORS_CONF: libc::c_int = 57; @@ -89,7 +89,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { #[cfg(any( target_os = "linux", - target_os = "macos", + target_vendor = "apple", target_os = "freebsd", target_os = "netbsd" ))] @@ -109,7 +109,7 @@ fn num_cpus_all() -> usize { // Other platforms (e.g., windows), num_cpus::get() directly. #[cfg(not(any( target_os = "linux", - target_os = "macos", + target_vendor = "apple", target_os = "freebsd", target_os = "netbsd" )))] diff --git a/src/uu/stat/src/fsext.rs b/src/uu/stat/src/fsext.rs index 11c8f8095..d90099892 100644 --- a/src/uu/stat/src/fsext.rs +++ b/src/uu/stat/src/fsext.rs @@ -149,7 +149,7 @@ use std::path::Path; #[cfg(any( target_os = "linux", - target_os = "macos", + target_vendor = "apple", target_os = "android", target_os = "freebsd" ))] @@ -165,7 +165,7 @@ use uucore::libc::statvfs as Sstatfs; #[cfg(any( target_os = "linux", - target_os = "macos", + target_vendor = "apple", target_os = "android", target_os = "freebsd" ))] @@ -211,11 +211,11 @@ impl FsMeta for Sstatfs { fn free_fnodes(&self) -> u64 { self.f_ffree as u64 } - #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))] + #[cfg(any(target_os = "linux", target_vendor = "apple", target_os = "freebsd"))] fn fs_type(&self) -> i64 { self.f_type as i64 } - #[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "freebsd")))] + #[cfg(not(any(target_os = "linux", target_vendor = "apple", target_os = "freebsd")))] fn fs_type(&self) -> i64 { // FIXME: statvfs doesn't have an equivalent, so we need to do something else unimplemented!() @@ -225,12 +225,12 @@ impl FsMeta for Sstatfs { fn iosize(&self) -> u64 { self.f_frsize as u64 } - #[cfg(any(target_os = "macos", target_os = "freebsd"))] + #[cfg(any(target_vendor = "apple", target_os = "freebsd"))] fn iosize(&self) -> u64 { self.f_iosize as u64 } // XXX: dunno if this is right - #[cfg(not(any(target_os = "macos", target_os = "freebsd", target_os = "linux")))] + #[cfg(not(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux")))] fn iosize(&self) -> u64 { self.f_bsize as u64 } @@ -241,13 +241,13 @@ impl FsMeta for Sstatfs { // // Solaris, Irix and POSIX have a system call statvfs(2) that returns a // struct statvfs, containing an unsigned long f_fsid - #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "linux"))] + #[cfg(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux"))] fn fsid(&self) -> u64 { let f_fsid: &[u32; 2] = unsafe { &*(&self.f_fsid as *const uucore::libc::fsid_t as *const [u32; 2]) }; (u64::from(f_fsid[0])) << 32 | u64::from(f_fsid[1]) } - #[cfg(not(any(target_os = "macos", target_os = "freebsd", target_os = "linux")))] + #[cfg(not(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux")))] fn fsid(&self) -> u64 { self.f_fsid as u64 } @@ -256,7 +256,7 @@ impl FsMeta for Sstatfs { fn namelen(&self) -> u64 { self.f_namelen as u64 } - #[cfg(target_os = "macos")] + #[cfg(target_vendor = "apple")] fn namelen(&self) -> u64 { 1024 } @@ -265,7 +265,7 @@ impl FsMeta for Sstatfs { self.f_namemax as u64 } // XXX: should everything just use statvfs? - #[cfg(not(any(target_os = "macos", target_os = "freebsd", target_os = "linux")))] + #[cfg(not(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux")))] fn namelen(&self) -> u64 { self.f_namemax as u64 } diff --git a/src/uu/stdbuf/build.rs b/src/uu/stdbuf/build.rs index c005072d9..b14d503cf 100644 --- a/src/uu/stdbuf/build.rs +++ b/src/uu/stdbuf/build.rs @@ -4,12 +4,12 @@ use std::env; use std::fs; use std::path::Path; -#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "windows")))] +#[cfg(not(any(target_vendor = "apple", target_os = "windows")))] mod platform { pub const DYLIB_EXT: &str = ".so"; } -#[cfg(any(target_os = "macos", target_os = "ios"))] +#[cfg(any(target_vendor = "apple"))] mod platform { pub const DYLIB_EXT: &str = ".dylib"; } diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 86523144c..67ed9a838 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -57,7 +57,7 @@ fn preload_strings() -> (&'static str, &'static str) { ("LD_PRELOAD", "so") } -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] fn preload_strings() -> (&'static str, &'static str) { ("DYLD_LIBRARY_PATH", "dylib") } @@ -67,7 +67,7 @@ fn preload_strings() -> (&'static str, &'static str) { target_os = "freebsd", target_os = "netbsd", target_os = "dragonflybsd", - target_os = "macos" + target_vendor = "apple" )))] fn preload_strings() -> (&'static str, &'static str) { crash!(1, "Command not supported for this operating system!") diff --git a/src/uu/uname/src/uname.rs b/src/uu/uname/src/uname.rs index 6575aa9fd..4586a084f 100644 --- a/src/uu/uname/src/uname.rs +++ b/src/uu/uname/src/uname.rs @@ -39,7 +39,7 @@ const HOST_OS: &str = "Windows NT"; const HOST_OS: &str = "FreeBSD"; #[cfg(target_os = "openbsd")] const HOST_OS: &str = "OpenBSD"; -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] const HOST_OS: &str = "Darwin"; #[cfg(target_os = "fuchsia")] const HOST_OS: &str = "Fuchsia"; diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index b028be0a0..8c7ff3211 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -60,12 +60,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { "count", "all login names and number of users logged on", ); - #[cfg(any( - target_os = "macos", - target_os = "ios", - target_os = "linux", - target_os = "android" - ))] + #[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))] opts.optflag("r", "runlevel", "print current runlevel"); opts.optflag("s", "short", "print only name, line, and time (default)"); opts.optflag("t", "time", "print last system clock change"); @@ -305,12 +300,7 @@ impl Who { #[allow(unused_assignments)] let mut res = false; - #[cfg(any( - target_os = "macos", - target_os = "ios", - target_os = "linux", - target_os = "android" - ))] + #[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))] { res = record == utmpx::RUN_LVL; } diff --git a/src/uucore/src/lib/features/entries.rs b/src/uucore/src/lib/features/entries.rs index a921af2d0..d2dce2461 100644 --- a/src/uucore/src/lib/features/entries.rs +++ b/src/uucore/src/lib/features/entries.rs @@ -34,7 +34,7 @@ //! assert!(entries::Group::locate(root_group).is_ok()); //! ``` -#[cfg(any(target_os = "freebsd", target_os = "macos"))] +#[cfg(any(target_os = "freebsd", target_vendor = "apple"))] use libc::time_t; use libc::{c_char, c_int, gid_t, uid_t}; use libc::{getgrgid, getgrnam, getgroups, getpwnam, getpwuid, group, passwd}; @@ -119,19 +119,19 @@ impl Passwd { } /// AKA passwd.pw_class - #[cfg(any(target_os = "freebsd", target_os = "macos"))] + #[cfg(any(target_os = "freebsd", target_vendor = "apple"))] pub fn user_access_class(&self) -> Cow { cstr2cow!(self.inner.pw_class) } /// AKA passwd.pw_change - #[cfg(any(target_os = "freebsd", target_os = "macos"))] + #[cfg(any(target_os = "freebsd", target_vendor = "apple"))] pub fn passwd_change_time(&self) -> time_t { self.inner.pw_change } /// AKA passwd.pw_expire - #[cfg(any(target_os = "freebsd", target_os = "macos"))] + #[cfg(any(target_os = "freebsd", target_vendor = "apple"))] pub fn expiration(&self) -> time_t { self.inner.pw_expire } diff --git a/src/uucore/src/lib/features/signals.rs b/src/uucore/src/lib/features/signals.rs index 294669eab..d22fa1791 100644 --- a/src/uucore/src/lib/features/signals.rs +++ b/src/uucore/src/lib/features/signals.rs @@ -197,7 +197,7 @@ No Name Default Action Description */ -#[cfg(any(target_os = "macos", target_os = "freebsd"))] +#[cfg(any(target_vendor = "apple", target_os = "freebsd"))] pub static ALL_SIGNALS: [Signal<'static>; 31] = [ Signal { name: "HUP", diff --git a/src/uucore/src/lib/features/utmpx.rs b/src/uucore/src/lib/features/utmpx.rs index 31cd3b72c..0308d8a5e 100644 --- a/src/uucore/src/lib/features/utmpx.rs +++ b/src/uucore/src/lib/features/utmpx.rs @@ -47,7 +47,7 @@ use libc::utmpx; pub use libc::endutxent; pub use libc::getutxent; pub use libc::setutxent; -#[cfg(any(target_os = "macos", target_os = "linux"))] +#[cfg(any(target_vendor = "apple", target_os = "linux"))] pub use libc::utmpxname; #[cfg(target_os = "freebsd")] pub unsafe extern "C" fn utmpxname(_file: *const libc::c_char) -> libc::c_int { @@ -85,7 +85,7 @@ mod ut { pub use libc::USER_PROCESS; } -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] mod ut { pub static DEFAULT_FILE: &str = "/var/run/utmpx"; diff --git a/tests/by-util/test_chgrp.rs b/tests/by-util/test_chgrp.rs index d5afaf3a7..613f52fd2 100644 --- a/tests/by-util/test_chgrp.rs +++ b/tests/by-util/test_chgrp.rs @@ -115,7 +115,7 @@ fn test_reference() { } #[test] -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] fn test_reference() { new_ucmd!() .arg("-v") diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index c9704a658..a79f820fb 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -12,7 +12,7 @@ fn test_du_basics() { assert!(result.success); assert_eq!(result.stderr, ""); } -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] fn _du_basics(s: String) { let answer = "32\t./subdir 8\t./subdir/deeper @@ -21,7 +21,7 @@ fn _du_basics(s: String) { "; assert_eq!(s, answer); } -#[cfg(not(target_os = "macos"))] +#[cfg(not(target_vendor = "apple"))] fn _du_basics(s: String) { let answer = "28\t./subdir 8\t./subdir/deeper @@ -41,11 +41,11 @@ fn test_du_basics_subdir() { _du_basics_subdir(result.stdout); } -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] fn _du_basics_subdir(s: String) { assert_eq!(s, "4\tsubdir/deeper\n"); } -#[cfg(not(target_os = "macos"))] +#[cfg(not(target_vendor = "apple"))] fn _du_basics_subdir(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { @@ -80,12 +80,12 @@ fn test_du_soft_link() { _du_soft_link(result.stdout); } -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] fn _du_soft_link(s: String) { // 'macos' host variants may have `du` output variation for soft links assert!((s == "12\tsubdir/links\n") || (s == "16\tsubdir/links\n")); } -#[cfg(not(target_os = "macos"))] +#[cfg(not(target_vendor = "apple"))] fn _du_soft_link(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { @@ -109,11 +109,11 @@ fn test_du_hard_link() { _du_hard_link(result.stdout); } -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] fn _du_hard_link(s: String) { assert_eq!(s, "12\tsubdir/links\n") } -#[cfg(not(target_os = "macos"))] +#[cfg(not(target_vendor = "apple"))] fn _du_hard_link(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { @@ -133,11 +133,11 @@ fn test_du_d_flag() { _du_d_flag(result.stdout); } -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] fn _du_d_flag(s: String) { assert_eq!(s, "16\t./subdir\n20\t./\n"); } -#[cfg(not(target_os = "macos"))] +#[cfg(not(target_vendor = "apple"))] fn _du_d_flag(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { diff --git a/tests/by-util/test_hostname.rs b/tests/by-util/test_hostname.rs index a526ddd88..804d47642 100644 --- a/tests/by-util/test_hostname.rs +++ b/tests/by-util/test_hostname.rs @@ -11,7 +11,7 @@ fn test_hostname() { } // FixME: fails for "MacOS" -#[cfg(not(target_os = "macos"))] +#[cfg(not(target_vendor = "apple"))] #[test] fn test_hostname_ip() { let result = new_ucmd!().arg("-i").run(); diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 422db8df9..a1c3d7569 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -285,7 +285,7 @@ fn test_ls_ls_color() { scene.ucmd().arg("--color=never").arg("z").succeeds(); } -#[cfg(not(any(target_os = "macos", target_os = "windows")))] // Truncate not available on mac or win +#[cfg(not(any(target_vendor = "apple", target_os = "windows")))] // Truncate not available on mac or win #[test] fn test_ls_human() { let scene = TestScenario::new(util_name!()); From 58b9372dbe21efe87e637d8db9a8f52e20512872 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Thu, 18 Mar 2021 14:46:56 +0100 Subject: [PATCH 449/606] rm: fix for -d to match GNU's output #1769 --- src/uu/rm/src/rm.rs | 26 +++++++++++++++++++------- tests/by-util/test_rm.rs | 17 +++++++++++++++++ 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 466a8d6c1..e858e3b0a 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -305,16 +305,28 @@ fn remove_dir(path: &Path, options: &Options) -> bool { true }; if response { - match fs::remove_dir(path) { - Ok(_) => { - if options.verbose { - println!("removed '{}'", path.display()); + if let Ok(mut read_dir) = fs::read_dir(path) { + if options.dir && read_dir.next().is_none() { + match fs::remove_dir(path) { + Ok(_) => { + if options.verbose { + println!("removed directory '{}'", path.display()); + } + } + Err(e) => { + show_error!("cannot remove '{}': {}", path.display(), e); + return true; + } } - } - Err(e) => { - show_error!("removing '{}': {}", path.display(), e); + } else { + // directory can be read but is not empty + show_error!("cannot remove '{}': Directory not empty", path.display()); return true; } + } else { + // GNU's rm shows this message if directory is empty but not readable + show_error!("cannot remove '{}': Directory not empty", path.display()); + return true; } } diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 27568957a..06d1d435d 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -115,6 +115,23 @@ fn test_rm_empty_directory() { assert!(!at.dir_exists(dir)); } +#[test] +fn test_rm_non_empty_directory() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir = "test_rm_non_empty_dir"; + let file_a = &format!("{}/test_rm_non_empty_file_a", dir); + + at.mkdir(dir); + at.touch(file_a); + + let result = ucmd.arg("-d").arg(dir).fails(); + assert!(result + .stderr + .contains(&format!("cannot remove '{}': Directory not empty", dir))); + assert!(at.file_exists(file_a)); + assert!(at.dir_exists(dir)); +} + #[test] fn test_rm_recursive() { let (at, mut ucmd) = at_and_ucmd!(); From 5ec87dc70a08399e4a029cf1f924d8780a9d613e Mon Sep 17 00:00:00 2001 From: Marco Satti Date: Fri, 19 Mar 2021 16:54:01 +0800 Subject: [PATCH 450/606] 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. --- Cargo.lock | 2 + src/uu/date/Cargo.toml | 6 ++ src/uu/date/src/date.rs | 127 +++++++++++++++++++++++++++++++------ tests/by-util/test_date.rs | 41 ++++++++++++ 4 files changed, 157 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9d9fb6c24..2ba6cf6a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1475,8 +1475,10 @@ version = "0.0.4" dependencies = [ "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index 4e3227f02..c62cfe2b3 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -20,6 +20,12 @@ clap = "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +[target.'cfg(unix)'.dependencies] +libc = "0.2" + +[target.'cfg(windows)'.dependencies] +winapi = { version = "0.3", features = ["minwinbase", "sysinfoapi", "minwindef"] } + [[bin]] name = "date" path = "src/main.rs" diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 5ee4b1610..43573437d 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -12,13 +12,20 @@ #[macro_use] extern crate uucore; +use chrono::{DateTime, FixedOffset, Local, Offset, Utc}; +#[cfg(windows)] +use chrono::{Datelike, Timelike}; use clap::{App, Arg}; - -use chrono::offset::Utc; -use chrono::{DateTime, FixedOffset, Local, Offset}; +#[cfg(all(unix, not(target_os = "macos")))] +use libc::{clock_settime, timespec, CLOCK_REALTIME}; use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::PathBuf; +#[cfg(windows)] +use winapi::{ + shared::minwindef::WORD, + um::{minwinbase::SYSTEMTIME, sysinfoapi::SetSystemTime}, +}; // Options const DATE: &str = "date"; @@ -62,6 +69,11 @@ static RFC_3339_HELP_STRING: &str = "output date/time in RFC 3339 format. for date and time to the indicated precision. Example: 2006-08-14 02:34:56-06:00"; +#[cfg(not(target_os = "macos"))] +static OPT_SET_HELP_STRING: &str = "set time described by STRING"; +#[cfg(target_os = "macos")] +static OPT_SET_HELP_STRING: &str = "set time described by STRING (not available on mac yet)"; + /// Settings for this program, parsed from the command line struct Settings { utc: bool, @@ -186,7 +198,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .short("s") .long(OPT_SET) .takes_value(true) - .help("set time described by STRING"), + .help(OPT_SET_HELP_STRING), ) .arg( Arg::with_name(OPT_UNIVERSAL) @@ -222,18 +234,31 @@ pub fn uumain(args: impl uucore::Args) -> i32 { DateSource::Now }; + let set_to = match matches.value_of(OPT_SET).map(parse_date) { + None => None, + Some(Err((input, _err))) => { + eprintln!("date: invalid date '{}'", input); + return 1; + } + Some(Ok(date)) => Some(date), + }; + let settings = Settings { utc: matches.is_present(OPT_UNIVERSAL), format, date_source, - // TODO: Handle this option: - set_to: None, + set_to, }; - if let Some(_time) = settings.set_to { - unimplemented!(); - // Probably need to use this syscall: - // https://doc.rust-lang.org/libc/i686-unknown-linux-gnu/libc/fn.clock_settime.html + if let Some(date) = settings.set_to { + // All set time functions expect UTC datetimes. + let date: DateTime = if settings.utc { + date.with_timezone(&Utc) + } else { + date.into() + }; + + return set_system_datetime(date); } else { // Declare a file here because it needs to outlive the `dates` iterator. let file: File; @@ -247,15 +272,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { now.with_timezone(now.offset()) }; - /// Parse a `String` into a `DateTime`. - /// If it fails, return a tuple of the `String` along with its `ParseError`. - fn parse_date( - s: String, - ) -> Result, (String, chrono::format::ParseError)> { - // TODO: The GNU date command can parse a wide variety of inputs. - s.parse().map_err(|e| (s, e)) - } - // Iterate over all dates - whether it's a single date or a file. let dates: Box> = match settings.date_source { DateSource::Custom(ref input) => { @@ -314,3 +330,76 @@ fn make_format_string(settings: &Settings) -> &str { Format::Default => "%c", } } + +/// Parse a `String` into a `DateTime`. +/// If it fails, return a tuple of the `String` along with its `ParseError`. +fn parse_date + Clone>( + s: S, +) -> Result, (String, chrono::format::ParseError)> { + // TODO: The GNU date command can parse a wide variety of inputs. + s.as_ref().parse().map_err(|e| (s.as_ref().into(), e)) +} + +#[cfg(not(any(unix, windows)))] +fn set_system_datetime(_date: DateTime) -> i32 { + unimplemented!("setting date not implemented (unsupported target)"); +} + +#[cfg(target_os = "macos")] +fn set_system_datetime(_date: DateTime) -> i32 { + eprintln!("date: setting the date is not supported by macOS"); + return 1; +} + +#[cfg(all(unix, not(target_os = "macos")))] +/// System call to set date (unix). +/// See here for more: +/// https://doc.rust-lang.org/libc/i686-unknown-linux-gnu/libc/fn.clock_settime.html +/// https://linux.die.net/man/3/clock_settime +/// https://www.gnu.org/software/libc/manual/html_node/Time-Types.html +fn set_system_datetime(date: DateTime) -> i32 { + let timespec = timespec { + tv_sec: date.timestamp() as _, + tv_nsec: date.timestamp_subsec_nanos() as _, + }; + + let result = unsafe { clock_settime(CLOCK_REALTIME, ×pec) }; + + if result != 0 { + let error = std::io::Error::last_os_error(); + eprintln!("date: cannot set date: {}", error); + error.raw_os_error().unwrap() + } else { + 0 + } +} + +#[cfg(windows)] +/// System call to set date (Windows). +/// See here for more: +/// https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-setsystemtime +/// https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime +fn set_system_datetime(date: DateTime) -> i32 { + let system_time = SYSTEMTIME { + wYear: date.year() as WORD, + wMonth: date.month() as WORD, + // Ignored + wDayOfWeek: 0, + wDay: date.day() as WORD, + wHour: date.hour() as WORD, + wMinute: date.minute() as WORD, + wSecond: date.second() as WORD, + // TODO: be careful of leap seconds - valid range is [0, 999] - how to handle? + wMilliseconds: ((date.nanosecond() / 1_000_000) % 1000) as WORD, + }; + + let result = unsafe { SetSystemTime(&system_time) }; + + if result == 0 { + let error = std::io::Error::last_os_error(); + eprintln!("date: cannot set date: {}", error); + error.raw_os_error().unwrap() + } else { + 0 + } +} diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 0837878b2..652edfa25 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -2,6 +2,8 @@ extern crate regex; use self::regex::Regex; use crate::common::util::*; +#[cfg(all(unix, not(target_os = "macos")))] +use rust_users::*; #[test] fn test_date_email() { @@ -131,3 +133,42 @@ fn test_date_format_full_day() { let re = Regex::new(r"\S+ \d{4}-\d{2}-\d{2}").unwrap(); assert!(re.is_match(&result.stdout.trim())); } + +#[test] +#[cfg(all(unix, not(target_os = "macos")))] +fn test_date_set_valid() { + if get_effective_uid() == 0 { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd.arg("--set").arg("2020-03-12 13:30:00+08:00").succeeds(); + result.no_stdout().no_stderr(); + } +} + +#[test] +#[cfg(any(windows, all(unix, not(target_os = "macos"))))] +fn test_date_set_invalid() { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd.arg("--set").arg("123abcd").fails(); + let result = result.no_stdout(); + assert!(result.stderr.starts_with("date: invalid date ")); +} + +#[test] +#[cfg(all(unix, not(target_os = "macos")))] +fn test_date_set_permissions_error() { + if !(get_effective_uid() == 0 || is_wsl()) { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd.arg("--set").arg("2020-03-11 21:45:00+08:00").fails(); + let result = result.no_stdout(); + assert!(result.stderr.starts_with("date: cannot set date: ")); + } +} + +#[test] +#[cfg(target_os = "macos")] +fn test_date_set_mac_unavailable() { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd.arg("--set").arg("2020-03-11 21:45:00+08:00").fails(); + let result = result.no_stdout(); + assert!(result.stderr.starts_with("date: setting the date is not supported by macOS")); +} From 621511dcaca907ccc9b6e425dcfafa0ec452b798 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 19 Mar 2021 14:24:25 +0100 Subject: [PATCH 451/606] Update cargo.lock --- Cargo.lock | 52 +++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2ba6cf6a2..1c47c5c5f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" @@ -652,10 +654,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "js-sys" -version = "0.3.48" +version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -838,8 +840,8 @@ dependencies = [ "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1731,7 +1733,7 @@ name = "uu_ls" version = "0.0.4" dependencies = [ "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2358,16 +2360,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wasm-bindgen" -version = "0.2.71" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.71" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2376,42 +2378,42 @@ dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.71" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.71" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.71" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "web-sys" -version = "0.3.48" +version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "js-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2534,7 +2536,7 @@ dependencies = [ "checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" "checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" "checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" -"checksum js-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)" = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" +"checksum js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)" = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" @@ -2626,12 +2628,12 @@ dependencies = [ "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum wasm-bindgen 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" -"checksum wasm-bindgen-backend 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" -"checksum wasm-bindgen-macro 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" -"checksum wasm-bindgen-macro-support 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" -"checksum wasm-bindgen-shared 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)" = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" -"checksum web-sys 0.3.48 (registry+https://github.com/rust-lang/crates.io-index)" = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b" +"checksum wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" +"checksum wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" +"checksum wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" +"checksum wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" +"checksum wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" +"checksum web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" "checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" From 976fa95ce83487a21a6151386f5c8528ca74c0a3 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 19 Mar 2021 14:25:05 +0100 Subject: [PATCH 452/606] fix(ls): fix a clippy warning "this `if` has identical blocks" --- src/uu/ls/src/ls.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 5c4cdaa80..10bba98f7 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -173,8 +173,6 @@ impl Config { Format::Long } else if options.is_present(options::format::ONELINE) { Format::OneLine - } else if options.is_present(options::format::COLUMNS) { - Format::Columns } else { Format::Columns }; From 118b802fe8bcc584be5a3fd65cf8e23396de28dc Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 19 Mar 2021 15:14:25 +0100 Subject: [PATCH 453/606] ls: --si and more compatible size formatting --- src/uu/ls/src/ls.rs | 66 +++++++++++++++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 5c4cdaa80..f7075c4df 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -92,13 +92,16 @@ pub mod options { pub static ACCESS: &str = "u"; pub static CHANGE: &str = "c"; } + pub mod size { + pub static HUMAN_READABLE: &str = "human-readable"; + pub static SI: &str = "si"; + } pub static FORMAT: &str = "format"; pub static SORT: &str = "sort"; pub static TIME: &str = "time"; pub static IGNORE_BACKUPS: &str = "ignore-backups"; pub static DIRECTORY: &str = "directory"; pub static CLASSIFY: &str = "classify"; - pub static HUMAN_READABLE: &str = "human-readable"; pub static INODE: &str = "inode"; pub static DEREFERENCE: &str = "dereference"; pub static NUMERIC_UID_GID: &str = "numeric-uid-gid"; @@ -122,9 +125,10 @@ enum Sort { Time, } -enum SizeFormats { +enum SizeFormat { Bytes, - Binary, // Powers of 1024, --human-readable + Binary, // Powers of 1024, --human-readable, -h + Decimal, // Powers of 1000, --si } #[derive(PartialEq, Eq)] @@ -149,7 +153,7 @@ struct Config { dereference: bool, classify: bool, ignore_backups: bool, - size_format: SizeFormats, + size_format: SizeFormat, numeric_uid_gid: bool, directory: bool, time: Time, @@ -231,10 +235,12 @@ impl Config { }, }; - let size_format = if options.is_present(options::HUMAN_READABLE) { - SizeFormats::Binary + let size_format = if options.is_present(options::size::HUMAN_READABLE) { + SizeFormat::Binary + } else if options.is_present(options::size::SI) { + SizeFormat::Decimal } else { - SizeFormats::Bytes + SizeFormat::Bytes }; Config { @@ -413,10 +419,16 @@ pub fn uumain(args: impl uucore::Args) -> i32 { '>' for doors, and nothing for regular files.", )) .arg( - Arg::with_name(options::HUMAN_READABLE) + Arg::with_name(options::size::HUMAN_READABLE) .short("h") - .long(options::HUMAN_READABLE) - .help("Print human readable file sizes (e.g. 1K 234M 56G)."), + .long(options::size::HUMAN_READABLE) + .help("Print human readable file sizes (e.g. 1K 234M 56G).") + .overrides_with(options::size::SI), + ) + .arg( + Arg::with_name(options::size::SI) + .long(options::size::SI) + .help("Print human readable file sizes using powers of 1000 instead of 1024.") ) .arg( Arg::with_name(options::INODE) @@ -787,17 +799,37 @@ fn display_date(metadata: &Metadata, config: &Config) -> String { } } +// There are a few peculiarities to how GNU formats the sizes: +// 1. One decimal place is given if and only if the size is smaller than 10 +// 2. It rounds sizes up. +// 3. The human-readable format uses powers for 1024, but does not display the "i" +// that is commonly used to denote Kibi, Mebi, etc. +// 4. Kibi and Kilo are denoted differently ("k" and "K", respectively) +fn format_prefixed(prefixed: NumberPrefix) -> String { + match prefixed { + NumberPrefix::Standalone(bytes) => bytes.to_string(), + NumberPrefix::Prefixed(prefix, bytes) => { + // Remove the "i" from "Ki", "Mi", etc. if present + let prefix_str = prefix.symbol().trim_end_matches("i"); + + // Check whether we get more than 10 if we round up to the first decimal + // because we want do display 9.81 as "9.9", not as "10". + if (10.0 * bytes).ceil() >= 100.0 { + format!("{:.0}{}", bytes.ceil(), prefix_str) + } else { + format!("{:.1}{}", (10.0 * bytes).ceil() / 10.0, prefix_str) + } + } + } +} + fn display_file_size(metadata: &Metadata, config: &Config) -> String { // NOTE: The human-readable behaviour deviates from the GNU ls. // The GNU ls uses binary prefixes by default. match config.size_format { - SizeFormats::Binary => match NumberPrefix::decimal(metadata.len() as f64) { - NumberPrefix::Standalone(bytes) => bytes.to_string(), - NumberPrefix::Prefixed(prefix, bytes) => { - format!("{:.2}{}", bytes, prefix).to_uppercase() - } - }, - SizeFormats::Bytes => metadata.len().to_string(), + SizeFormat::Binary => format_prefixed(NumberPrefix::binary(metadata.len() as f64)), + SizeFormat::Decimal => format_prefixed(NumberPrefix::decimal(metadata.len() as f64)), + SizeFormat::Bytes => metadata.len().to_string(), } } From 39b07f670f8b35599c4a62d978715631ae19dea5 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 19 Mar 2021 15:15:24 +0100 Subject: [PATCH 454/606] tests/ls: adapt tests to --si and new size formats --- tests/by-util/test_ls.rs | 82 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 8 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index d01aaffd9..e0063aa1a 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -428,28 +428,94 @@ fn test_ls_ls_color() { #[cfg(not(any(target_vendor = "apple", target_os = "windows")))] // Truncate not available on mac or win #[test] -fn test_ls_human() { +fn test_ls_human_si() { let scene = TestScenario::new(util_name!()); - let file = "test_human"; - let result = scene.cmd("truncate").arg("-s").arg("+1000").arg(file).run(); + let file1 = "test_human-1"; + let result = scene + .cmd("truncate") + .arg("-s") + .arg("+1000") + .arg(file1) + .run(); println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); - let result = scene.ucmd().arg("-hl").arg(file).run(); + + let result = scene.ucmd().arg("-hl").arg(file1).run(); println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(result.success); - assert!(result.stdout.contains("1.00K")); + assert!(result.stdout.contains(" 1000 ")); + + let result = scene.ucmd().arg("-l").arg("--si").arg(file1).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(result.stdout.contains(" 1.0k ")); + scene .cmd("truncate") .arg("-s") .arg("+1000k") - .arg(file) + .arg(file1) .run(); - let result = scene.ucmd().arg("-hl").arg(file).run(); + + let result = scene.ucmd().arg("-hl").arg(file1).run(); println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(result.success); - assert!(result.stdout.contains("1.02M")); + assert!(result.stdout.contains(" 1001K ")); + + let result = scene.ucmd().arg("-l").arg("--si").arg(file1).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(result.stdout.contains(" 1.1M ")); + + let file2 = "test-human-2"; + let result = scene + .cmd("truncate") + .arg("-s") + .arg("+12300k") + .arg(file2) + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + let result = scene.ucmd().arg("-hl").arg(file2).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + // GNU rounds up, so we must too. + assert!(result.stdout.contains(" 13M ")); + + let result = scene.ucmd().arg("-l").arg("--si").arg(file2).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + // GNU rounds up, so we must too. + assert!(result.stdout.contains(" 13M ")); + + let file3 = "test-human-3"; + let result = scene + .cmd("truncate") + .arg("-s") + .arg("+9999") + .arg(file3) + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + + let result = scene.ucmd().arg("-hl").arg(file3).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(result.stdout.contains(" 9.8K ")); + + let result = scene.ucmd().arg("-l").arg("--si").arg(file3).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert!(result.stdout.contains(" 10k ")); } #[cfg(windows)] From 9132d32315fccd8a040cc8da4797a492f3cf228e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 19 Mar 2021 18:01:43 +0100 Subject: [PATCH 455/606] Rustfmt the tests --- tests/by-util/test_date.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 652edfa25..458e62004 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -139,7 +139,10 @@ fn test_date_format_full_day() { fn test_date_set_valid() { if get_effective_uid() == 0 { let (_, mut ucmd) = at_and_ucmd!(); - let result = ucmd.arg("--set").arg("2020-03-12 13:30:00+08:00").succeeds(); + let result = ucmd + .arg("--set") + .arg("2020-03-12 13:30:00+08:00") + .succeeds(); result.no_stdout().no_stderr(); } } @@ -170,5 +173,7 @@ fn test_date_set_mac_unavailable() { let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd.arg("--set").arg("2020-03-11 21:45:00+08:00").fails(); let result = result.no_stdout(); - assert!(result.stderr.starts_with("date: setting the date is not supported by macOS")); + assert!(result + .stderr + .starts_with("date: setting the date is not supported by macOS")); } From c6927d97c8600e9cdcc571aacf377032a6d06e37 Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Fri, 19 Mar 2021 22:15:35 +0200 Subject: [PATCH 456/606] cp: add support for -x/--one-file-system (#1840) --- Cargo.toml | 1 + src/uu/cp/src/cp.rs | 11 +-- tests/by-util/test_cp.rs | 73 +++++++++++++++++++ tests/fixtures/cp/dir_with_mount/copy_me.txt | 0 .../cp/dir_with_mount/copy_me/copy_me.txt | 0 5 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 tests/fixtures/cp/dir_with_mount/copy_me.txt create mode 100644 tests/fixtures/cp/dir_with_mount/copy_me/copy_me.txt diff --git a/Cargo.toml b/Cargo.toml index 9b55abe5c..bf11e66fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -347,6 +347,7 @@ tempfile = "= 3.1.0" time = "0.1" unindent = "0.1" uucore = { version=">=0.0.7", package="uucore", path="src/uucore", features=["entries"] } +walkdir = "2.2" [target.'cfg(unix)'.dev-dependencies] rust-users = { version="0.10", package="users" } diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 0922af241..01ad4a8aa 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -431,6 +431,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg(Arg::with_name(OPT_NO_DEREFERENCE_PRESERVE_LINKS) .short("d") .help("same as --no-dereference --preserve=links")) + .arg(Arg::with_name(OPT_ONE_FILE_SYSTEM) + .short("x") + .long(OPT_ONE_FILE_SYSTEM) + .help("stay on this file system")) // TODO: implement the following args .arg(Arg::with_name(OPT_COPY_CONTENTS) @@ -442,10 +446,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .value_name("WHEN") .help("NotImplemented: control creation of sparse files. See below")) - .arg(Arg::with_name(OPT_ONE_FILE_SYSTEM) - .short("x") - .long(OPT_ONE_FILE_SYSTEM) - .help("NotImplemented: stay on this file system")) .arg(Arg::with_name(OPT_CONTEXT) .long(OPT_CONTEXT) .takes_value(true) @@ -563,6 +563,7 @@ impl Options { let not_implemented_opts = vec![ OPT_COPY_CONTENTS, OPT_SPARSE, + #[cfg(not(any(windows, unix)))] OPT_ONE_FILE_SYSTEM, OPT_CONTEXT, #[cfg(windows)] @@ -937,7 +938,7 @@ fn copy_directory(root: &Path, target: &Target, options: &Options) -> CopyResult #[cfg(any(windows, target_os = "redox"))] let mut hard_links: Vec<(String, u64)> = vec![]; - for path in WalkDir::new(root) { + for path in WalkDir::new(root).same_file_system(options.one_file_system) { let p = or_continue!(path); let is_symlink = fs::symlink_metadata(p.path())?.file_type().is_symlink(); let path = if (options.no_dereference || options.dereference) && is_symlink { diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index b96bd4e29..a00ed2fd2 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -31,6 +31,12 @@ static TEST_COPY_FROM_FOLDER: &str = "hello_dir_with_file/"; static TEST_COPY_FROM_FOLDER_FILE: &str = "hello_dir_with_file/hello_world.txt"; static TEST_COPY_TO_FOLDER_NEW: &str = "hello_dir_new"; static TEST_COPY_TO_FOLDER_NEW_FILE: &str = "hello_dir_new/hello_world.txt"; +#[cfg(any(target_os = "linux", target_os = "freebsd"))] +static TEST_MOUNT_COPY_FROM_FOLDER: &str = "dir_with_mount"; +#[cfg(any(target_os = "linux", target_os = "freebsd"))] +static TEST_MOUNT_MOUNTPOINT: &str = "mount"; +#[cfg(any(target_os = "linux", target_os = "freebsd"))] +static TEST_MOUNT_OTHER_FILESYSTEM_FILE: &str = "mount/DO_NOT_copy_me.txt"; #[test] fn test_cp_cp() { @@ -1001,3 +1007,70 @@ fn test_cp_target_file_dev_null() { assert!(at.file_exists(file2)); } + +#[test] +#[cfg(any(target_os = "linux", target_os = "freebsd"))] +fn test_cp_one_file_system() { + use crate::common::util::AtPath; + use walkdir::WalkDir; + + let scene = TestScenario::new(util_name!()); + + // Test must be run as root (or with `sudo -E`) + if scene.cmd("whoami").run().stdout != "root\n" { + return; + } + + let at = scene.fixtures.clone(); + let at_src = AtPath::new(&at.plus(TEST_MOUNT_COPY_FROM_FOLDER)); + let at_dst = AtPath::new(&at.plus(TEST_COPY_TO_FOLDER_NEW)); + + // Prepare the mount + at_src.mkdir(TEST_MOUNT_MOUNTPOINT); + let mountpoint_path = &at_src.plus_as_string(TEST_MOUNT_MOUNTPOINT); + + let _r = scene + .cmd("mount") + .arg("-t") + .arg("tmpfs") + .arg("-o") + .arg("size=640k") // ought to be enough + .arg("tmpfs") + .arg(mountpoint_path) + .run(); + assert!(_r.code == Some(0), _r.stderr); + + at_src.touch(TEST_MOUNT_OTHER_FILESYSTEM_FILE); + + // Begin testing -x flag + let result = scene + .ucmd() + .arg("-rx") + .arg(TEST_MOUNT_COPY_FROM_FOLDER) + .arg(TEST_COPY_TO_FOLDER_NEW) + .run(); + + // Ditch the mount before the asserts + let _r = scene.cmd("umount").arg(mountpoint_path).run(); + assert!(_r.code == Some(0), _r.stderr); + + assert!(result.success); + assert!(!at_dst.file_exists(TEST_MOUNT_OTHER_FILESYSTEM_FILE)); + // Check if the other files were copied from the source folder hirerarchy + for entry in WalkDir::new(at_src.as_string()) { + let entry = entry.unwrap(); + let relative_src = entry + .path() + .strip_prefix(at_src.as_string()) + .unwrap() + .to_str() + .unwrap(); + + let ft = entry.file_type(); + match (ft.is_dir(), ft.is_file(), ft.is_symlink()) { + (true, _, _) => assert!(at_dst.dir_exists(relative_src)), + (_, true, _) => assert!(at_dst.file_exists(relative_src)), + (_, _, _) => panic!(), + } + } +} diff --git a/tests/fixtures/cp/dir_with_mount/copy_me.txt b/tests/fixtures/cp/dir_with_mount/copy_me.txt new file mode 100644 index 000000000..e69de29bb diff --git a/tests/fixtures/cp/dir_with_mount/copy_me/copy_me.txt b/tests/fixtures/cp/dir_with_mount/copy_me/copy_me.txt new file mode 100644 index 000000000..e69de29bb From 0e217e202a2f23bb73c881c15c083a8e1eb55d7f Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 19 Mar 2021 22:58:50 +0100 Subject: [PATCH 457/606] tee: move from getopts to clap (#1814) --- src/uu/tee/Cargo.toml | 2 +- src/uu/tee/src/tee.rs | 118 ++++++++++++++++++------------------------ 2 files changed, 50 insertions(+), 70 deletions(-) diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index ee18e888f..99a6ec23e 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/tee.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33.3" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index e29945382..c54fa0d16 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -5,6 +5,10 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. +#[macro_use] +extern crate uucore; + +use clap::{App, Arg}; use std::fs::OpenOptions; use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write}; use std::path::{Path, PathBuf}; @@ -12,80 +16,61 @@ use std::path::{Path, PathBuf}; #[cfg(unix)] use uucore::libc; -static NAME: &str = "tee"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Copy standard input to each FILE, and also to standard output."; -pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); - - match options(&args).and_then(exec) { - Ok(_) => 0, - Err(_) => 1, - } +mod options { + pub const APPEND: &str = "append"; + pub const IGNORE_INTERRUPTS: &str = "ignore-interrupts"; + pub const FILE: &str = "file"; } #[allow(dead_code)] struct Options { - program: String, append: bool, ignore_interrupts: bool, - print_and_exit: Option, files: Vec, } -fn options(args: &[String]) -> Result { - let mut opts = getopts::Options::new(); - - opts.optflag("a", "append", "append to the given FILEs, do not overwrite"); - opts.optflag( - "i", - "ignore-interrupts", - "ignore interrupt signals (ignored on non-Unix platforms)", - ); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - opts.parse(&args[1..]) - .map_err(|e| Error::new(ErrorKind::Other, format!("{}", e))) - .map(|m| { - let version = format!("{} {}", NAME, VERSION); - let arguments = "[OPTION]... [FILE]..."; - let brief = "Copy standard input to each FILE, and also to standard output."; - let comment = "If a FILE is -, it refers to a file named - ."; - let help = format!( - "{}\n\nUsage:\n {} {}\n\n{}\n{}", - version, - NAME, - arguments, - opts.usage(brief), - comment - ); - let names: Vec = m.free.clone().into_iter().collect(); - let to_print = if m.opt_present("help") { - Some(help) - } else if m.opt_present("version") { - Some(version) - } else { - None - }; - Options { - program: NAME.to_owned(), - append: m.opt_present("append"), - ignore_interrupts: m.opt_present("ignore-interrupts"), - print_and_exit: to_print, - files: names, - } - }) - .map_err(|message| warn(format!("{}", message).as_ref())) +fn get_usage() -> String { + format!("{0} [OPTION]... [FILE]...", executable!()) } -fn exec(options: Options) -> Result<()> { - match options.print_and_exit { - Some(text) => { - println!("{}", text); - Ok(()) - } - None => tee(options), +pub fn uumain(args: impl uucore::Args) -> i32 { + let usage = get_usage(); + + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help("If a FILE is -, it refers to a file named - .") + .arg( + Arg::with_name(options::APPEND) + .long(options::APPEND) + .short("a") + .help("append to the given FILEs, do not overwrite"), + ) + .arg( + Arg::with_name(options::IGNORE_INTERRUPTS) + .long(options::IGNORE_INTERRUPTS) + .short("i") + .help("ignore interrupt signals (ignored on non-Unix platforms)"), + ) + .arg(Arg::with_name(options::FILE).multiple(true)) + .get_matches_from(args); + + let options = Options { + append: matches.is_present(options::APPEND), + ignore_interrupts: matches.is_present(options::IGNORE_INTERRUPTS), + files: matches + .values_of(options::FILE) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(), + }; + + match tee(options) { + Ok(_) => 0, + Err(_) => 1, } } @@ -173,7 +158,7 @@ impl Write for NamedWriter { match self.inner.write(buf) { Err(f) => { self.inner = Box::new(sink()) as Box; - warn(format!("{}: {}", self.path.display(), f.to_string()).as_ref()); + show_warning!("{}: {}", self.path.display(), f.to_string()); Err(f) } okay => okay, @@ -184,7 +169,7 @@ impl Write for NamedWriter { match self.inner.flush() { Err(f) => { self.inner = Box::new(sink()) as Box; - warn(format!("{}: {}", self.path.display(), f.to_string()).as_ref()); + show_warning!("{}: {}", self.path.display(), f.to_string()); Err(f) } okay => okay, @@ -200,15 +185,10 @@ impl Read for NamedReader { fn read(&mut self, buf: &mut [u8]) -> Result { match self.inner.read(buf) { Err(f) => { - warn(format!("{}: {}", Path::new("stdin").display(), f.to_string()).as_ref()); + show_warning!("{}: {}", Path::new("stdin").display(), f.to_string()); Err(f) } okay => okay, } } } - -fn warn(message: &str) -> Error { - eprintln!("{}: {}", NAME, message); - Error::new(ErrorKind::Other, format!("{}: {}", NAME, message)) -} From 785897efbd404d755bd6fb2a1a5cdb536ae414a1 Mon Sep 17 00:00:00 2001 From: Marco Satti Date: Sat, 20 Mar 2021 15:17:18 +0800 Subject: [PATCH 458/606] date: add more tests for setting (alt. formats) --- tests/by-util/test_date.rs | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 458e62004..216446266 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -177,3 +177,42 @@ fn test_date_set_mac_unavailable() { .stderr .starts_with("date: setting the date is not supported by macOS")); } + +#[test] +#[cfg(all(unix, not(target_os = "macos")))] +fn test_date_set_valid_2() { + if get_effective_uid() == 0 { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd + .arg("--set") + .arg("Sat 20 Mar 2021 14:53:01 AWST") + .succeeds(); + result.no_stdout().no_stderr(); + } +} + +#[test] +#[cfg(all(unix, not(target_os = "macos")))] +fn test_date_set_valid_3() { + if get_effective_uid() == 0 { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd + .arg("--set") + .arg("Sat 20 Mar 2021 14:53:01") // Local timezone + .succeeds(); + result.no_stdout().no_stderr(); + } +} + +#[test] +#[cfg(all(unix, not(target_os = "macos")))] +fn test_date_set_valid_4() { + if get_effective_uid() == 0 { + let (_, mut ucmd) = at_and_ucmd!(); + let result = ucmd + .arg("--set") + .arg("2020-03-11 21:45:00") // Local timezone + .succeeds(); + result.no_stdout().no_stderr(); + } +} From d1fc42a7c901362a33f832567022d362ed31a33e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 20 Mar 2021 10:28:06 +0100 Subject: [PATCH 459/606] refresh cargo.lock with recent updates --- Cargo.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 1c47c5c5f..8d4318dec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -297,6 +297,7 @@ dependencies = [ "uu_whoami 0.0.4", "uu_yes 0.0.4", "uucore 0.0.7", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2128,7 +2129,7 @@ dependencies = [ name = "uu_tee" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", From e9adc5067bf66f4e0c9d96623eabe48acf76a437 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Sat, 20 Mar 2021 02:33:04 -0700 Subject: [PATCH 460/606] cksum: generate CRC table in a const fn (#1744) --- src/uu/cksum/build.rs | 46 ------------------ src/uu/cksum/src/cksum.rs | 99 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 94 insertions(+), 51 deletions(-) delete mode 100644 src/uu/cksum/build.rs diff --git a/src/uu/cksum/build.rs b/src/uu/cksum/build.rs deleted file mode 100644 index a9edd0d59..000000000 --- a/src/uu/cksum/build.rs +++ /dev/null @@ -1,46 +0,0 @@ -// This file is part of the uutils coreutils package. -// -// (c) Alex Lyon -// (c) Michael Gehring -// -// For the full copyright and license information, please view the LICENSE -// file that was distributed with this source code. - -use std::env; -use std::fs::File; -use std::io::Write; -use std::path::Path; - -const CRC_TABLE_LEN: usize = 256; - -fn main() { - let out_dir = env::var("OUT_DIR").unwrap(); - - let mut table = Vec::with_capacity(CRC_TABLE_LEN); - for num in 0..CRC_TABLE_LEN { - table.push(crc_entry(num as u8) as u32); - } - let file = File::create(&Path::new(&out_dir).join("crc_table.rs")).unwrap(); - write!( - &file, - "#[allow(clippy::unreadable_literal)]\nconst CRC_TABLE: [u32; {}] = {:?};", - CRC_TABLE_LEN, table - ) - .unwrap(); -} - -#[inline] -fn crc_entry(input: u8) -> u32 { - let mut crc = (input as u32) << 24; - - for _ in 0..8 { - if crc & 0x8000_0000 != 0 { - crc <<= 1; - crc ^= 0x04c1_1db7; - } else { - crc <<= 1; - } - } - - crc -} diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index f589e6f81..e1c75fffc 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -14,11 +14,101 @@ use std::fs::File; use std::io::{self, stdin, BufReader, Read}; use std::path::Path; -include!(concat!(env!("OUT_DIR"), "/crc_table.rs")); +// NOTE: CRC_TABLE_LEN *must* be <= 256 as we cast 0..CRC_TABLE_LEN to u8 +const CRC_TABLE_LEN: usize = 256; +const CRC_TABLE: [u32; CRC_TABLE_LEN] = generate_crc_table(); -static SYNTAX: &str = "[OPTIONS] [FILE]..."; -static SUMMARY: &str = "Print CRC and size for each file"; -static LONG_HELP: &str = ""; +const SYNTAX: &str = "[OPTIONS] [FILE]..."; +const SUMMARY: &str = "Print CRC and size for each file"; +const LONG_HELP: &str = ""; + +// this is basically a hack to get "loops" to work on Rust 1.33. Once we update to Rust 1.46 or +// greater, we can just use while loops +macro_rules! unroll { + (256, |$i:ident| $s:expr) => {{ + unroll!(@ 32, 0 * 32, $i, $s); + unroll!(@ 32, 1 * 32, $i, $s); + unroll!(@ 32, 2 * 32, $i, $s); + unroll!(@ 32, 3 * 32, $i, $s); + unroll!(@ 32, 4 * 32, $i, $s); + unroll!(@ 32, 5 * 32, $i, $s); + unroll!(@ 32, 6 * 32, $i, $s); + unroll!(@ 32, 7 * 32, $i, $s); + }}; + (8, |$i:ident| $s:expr) => {{ + unroll!(@ 8, 0, $i, $s); + }}; + + (@ 32, $start:expr, $i:ident, $s:expr) => {{ + unroll!(@ 8, $start + 0 * 8, $i, $s); + unroll!(@ 8, $start + 1 * 8, $i, $s); + unroll!(@ 8, $start + 2 * 8, $i, $s); + unroll!(@ 8, $start + 3 * 8, $i, $s); + }}; + (@ 8, $start:expr, $i:ident, $s:expr) => {{ + unroll!(@ 4, $start, $i, $s); + unroll!(@ 4, $start + 4, $i, $s); + }}; + (@ 4, $start:expr, $i:ident, $s:expr) => {{ + unroll!(@ 2, $start, $i, $s); + unroll!(@ 2, $start + 2, $i, $s); + }}; + (@ 2, $start:expr, $i:ident, $s:expr) => {{ + unroll!(@ 1, $start, $i, $s); + unroll!(@ 1, $start + 1, $i, $s); + }}; + (@ 1, $start:expr, $i:ident, $s:expr) => {{ + let $i = $start; + let _ = $s; + }}; +} + +const fn generate_crc_table() -> [u32; CRC_TABLE_LEN] { + let mut table = [0; CRC_TABLE_LEN]; + + // NOTE: works on Rust 1.46 + //let mut i = 0; + //while i < CRC_TABLE_LEN { + // table[i] = crc_entry(i as u8) as u32; + // + // i += 1; + //} + unroll!(256, |i| { + table[i] = crc_entry(i as u8) as u32; + }); + + table +} + +const fn crc_entry(input: u8) -> u32 { + let mut crc = (input as u32) << 24; + + // NOTE: this does not work on Rust 1.33, but *does* on 1.46 + //let mut i = 0; + //while i < 8 { + // if crc & 0x8000_0000 != 0 { + // crc <<= 1; + // crc ^= 0x04c1_1db7; + // } else { + // crc <<= 1; + // } + // + // i += 1; + //} + unroll!(8, |_i| { + let if_cond = crc & 0x8000_0000; + let if_body = (crc << 1) ^ 0x04c1_1db7; + let else_body = crc << 1; + + // NOTE: i feel like this is easier to understand than emulating an if statement in bitwise + // ops + let cond_table = [else_body, if_body]; + + crc = cond_table[(if_cond != 0) as usize]; + }); + + crc +} #[inline] fn crc_update(crc: u32, input: u8) -> u32 { @@ -68,7 +158,6 @@ fn cksum(fname: &str) -> io::Result<(u32, usize)> { Err(err) => return Err(err), } } - //Ok((0 as u32,0 as usize)) } pub fn uumain(args: impl uucore::Args) -> i32 { From 8b9ac0c7c3231ebde87b875e95dc67d02e9e753a Mon Sep 17 00:00:00 2001 From: nicoo Date: Sat, 20 Mar 2021 11:46:58 +0100 Subject: [PATCH 461/606] =?UTF-8?q?Revert=20#1571=20=E2=80=9Cperf/factor?= =?UTF-8?q?=20~=20deduplicate=20divisors=E2=80=9D=20(#1842)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was a draft PR, not ready for merging, and its premature inclusion caused repeated issues, see 368f47381b7441ddb23bb7460417e0d1ce33e330 & friends. Close #1841. This reverts commits 3743a3e1e7a87bdd0ea7b923dc42386bfc14ccd5, ce218e01b6fcfadf4a9e55348d98f36dafff6c6b, and b7b0c76b8ea60297b43777d17d7322d1d45a9e91. --- src/uu/factor/src/factor.rs | 145 +++++++++++------------------------- src/uu/factor/src/table.rs | 5 +- 2 files changed, 45 insertions(+), 105 deletions(-) diff --git a/src/uu/factor/src/factor.rs b/src/uu/factor/src/factor.rs index 2715bad71..7d2e16a11 100644 --- a/src/uu/factor/src/factor.rs +++ b/src/uu/factor/src/factor.rs @@ -9,7 +9,7 @@ use smallvec::SmallVec; use std::cell::RefCell; use std::fmt; -use crate::numeric::{gcd, Arithmetic, Montgomery}; +use crate::numeric::{Arithmetic, Montgomery}; use crate::{miller_rabin, rho, table}; type Exponent = u8; @@ -29,20 +29,15 @@ impl Decomposition { fn add(&mut self, factor: u64, exp: Exponent) { debug_assert!(exp > 0); - // Assert the factor doesn't already exist in the Decomposition object - debug_assert_eq!(self.0.iter_mut().find(|(f, _)| *f == factor), None); - self.0.push((factor, exp)) - } - - fn is_one(&self) -> bool { - self.0.is_empty() - } - - fn pop(&mut self) -> Option<(u64, Exponent)> { - self.0.pop() + if let Some((_, e)) = self.0.iter_mut().find(|(f, _)| *f == factor) { + *e += exp; + } else { + self.0.push((factor, exp)) + } } + #[cfg(test)] fn product(&self) -> u64 { self.0 .iter() @@ -86,11 +81,11 @@ impl Factors { self.0.borrow_mut().add(prime, exp) } - #[cfg(test)] pub fn push(&mut self, prime: u64) { self.add(prime, 1) } + #[cfg(test)] fn product(&self) -> u64 { self.0.borrow().product() } @@ -111,116 +106,62 @@ impl fmt::Display for Factors { } } -fn _find_factor(num: u64) -> Option { +fn _factor(num: u64, f: Factors) -> Factors { use miller_rabin::Result::*; + // Shadow the name, so the recursion automatically goes from “Big” arithmetic to small. + let _factor = |n, f| { + if n < (1 << 32) { + _factor::>(n, f) + } else { + _factor::(n, f) + } + }; + + if num == 1 { + return f; + } + let n = A::new(num); - match miller_rabin::test::(n) { - Prime => None, - Composite(d) => Some(d), - Pseudoprime => Some(rho::find_divisor::(n)), - } + let divisor = match miller_rabin::test::(n) { + Prime => { + let mut r = f; + r.push(num); + return r; + } + + Composite(d) => d, + Pseudoprime => rho::find_divisor::(n), + }; + + let f = _factor(divisor, f); + _factor(num / divisor, f) } -fn find_factor(num: u64) -> Option { - if num < (1 << 32) { - _find_factor::>(num) - } else { - _find_factor::>(num) - } -} - -pub fn factor(num: u64) -> Factors { +pub fn factor(mut n: u64) -> Factors { let mut factors = Factors::one(); - if num < 2 { + if n < 2 { return factors; } - let mut n = num; - let n_zeros = num.trailing_zeros(); + let n_zeros = n.trailing_zeros(); if n_zeros > 0 { factors.add(2, n_zeros as Exponent); n >>= n_zeros; } - debug_assert_eq!(num, n * factors.product()); if n == 1 { return factors; } - table::factor(&mut n, &mut factors); - debug_assert_eq!(num, n * factors.product()); + let (factors, n) = table::factor(n, factors); - if n == 1 { - return factors; + if n < (1 << 32) { + _factor::>(n, factors) + } else { + _factor::>(n, factors) } - - let mut dec = Decomposition::one(); - dec.add(n, 1); - - while !dec.is_one() { - // Check correctness invariant - debug_assert_eq!(num, factors.product() * dec.product()); - - let (factor, exp) = dec.pop().unwrap(); - - if let Some(divisor) = find_factor(factor) { - let mut gcd_queue = Decomposition::one(); - - let quotient = factor / divisor; - let mut trivial_gcd = quotient == divisor; - if trivial_gcd { - gcd_queue.add(divisor, exp + 1); - } else { - gcd_queue.add(divisor, exp); - gcd_queue.add(quotient, exp); - } - - while !trivial_gcd { - debug_assert_eq!(factor, gcd_queue.product()); - - let mut tmp = Decomposition::one(); - trivial_gcd = true; - for i in 0..gcd_queue.0.len() - 1 { - let (mut a, exp_a) = gcd_queue.0[i]; - let (mut b, exp_b) = gcd_queue.0[i + 1]; - - if a == 1 { - continue; - } - - let g = gcd(a, b); - if g != 1 { - trivial_gcd = false; - a /= g; - b /= g; - } - if a != 1 { - tmp.add(a, exp_a); - } - if g != 1 { - tmp.add(g, exp_a + exp_b); - } - - if i + 1 != gcd_queue.0.len() - 1 { - gcd_queue.0[i + 1].0 = b; - } else if b != 1 { - tmp.add(b, exp_b); - } - } - gcd_queue = tmp; - } - - debug_assert_eq!(factor, gcd_queue.product()); - dec.0.extend(gcd_queue.0); - } else { - // factor is prime - factors.add(factor, exp); - } - } - - factors } #[cfg(test)] diff --git a/src/uu/factor/src/table.rs b/src/uu/factor/src/table.rs index b62e801cb..d6ef796fc 100644 --- a/src/uu/factor/src/table.rs +++ b/src/uu/factor/src/table.rs @@ -14,8 +14,7 @@ use crate::Factors; include!(concat!(env!("OUT_DIR"), "/prime_table.rs")); -pub(crate) fn factor(n: &mut u64, factors: &mut Factors) { - let mut num = *n; +pub(crate) fn factor(mut num: u64, mut factors: Factors) -> (Factors, u64) { for &(prime, inv, ceil) in P_INVS_U64 { if num == 1 { break; @@ -43,5 +42,5 @@ pub(crate) fn factor(n: &mut u64, factors: &mut Factors) { } } - *n = num; + (factors, num) } From 0f7423dfa6e44c11593f1acaca98c372b1dbe50f Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Sat, 20 Mar 2021 14:37:37 +0200 Subject: [PATCH 462/606] install: fix bug #1823 --- src/uu/install/src/install.rs | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 9d1acdc7e..a675549d1 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -426,18 +426,25 @@ fn copy_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behavior) -> let mut all_successful = true; for sourcepath in files.iter() { - let targetpath = match sourcepath.as_os_str().to_str() { - Some(name) => target_dir.join(name), - None => { - show_error!( - "cannot stat '{}': No such file or directory", - sourcepath.display() - ); + if !sourcepath.exists() { + show_error!( + "cannot stat '{}': No such file or directory", + sourcepath.display() + ); - all_successful = false; - continue; - } - }; + all_successful = false; + continue; + } + + if sourcepath.is_dir() { + show_info!("omitting directory '{}'", sourcepath.display()); + all_successful = false; + continue; + } + + let mut targetpath = target_dir.clone().to_path_buf(); + let filename = sourcepath.components().last().unwrap(); + targetpath.push(filename); if copy(sourcepath, &targetpath, b).is_err() { all_successful = false; From 7a9128197621e0faf75e8f7c095b8f197d01c0ff Mon Sep 17 00:00:00 2001 From: Dominik Bittner Date: Sat, 20 Mar 2021 13:49:53 +0100 Subject: [PATCH 463/606] Install: remove path when copining files - add a test for copying a file from one directory to another - add the desired behavior Fixes #1823 --- tests/by-util/test_install.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 7b3706f9e..9f4d9af18 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -358,3 +358,18 @@ fn test_install_target_file_dev_null() { ucmd.arg(file1).arg(file2).succeeds().no_stderr(); assert!(at.file_exists(file2)); } + +#[test] +fn test_install_copy_file_leading_dot() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir1 = "test_install_target_new_file_dir_l"; + let dir2 = "test_install_target_new_file_dir_m"; + let file1 = "test_install_target_file_file_l1"; + + at.mkdir(dir1); + at.mkdir(dir2); + at.touch(&format!("{}/{}", dir1, file1)); + + ucmd.arg(format!("{}/{}", dir1, file1)).arg(dir2).succeeds().no_stderr(); + assert!(at.file_exists(&format!("{}/{}", dir2, file1))); +} From ecddaf577a7e8dd7fc3d3c07e4c3ac56fd96e392 Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Sat, 20 Mar 2021 15:44:41 +0200 Subject: [PATCH 464/606] install: rustfmt test --- tests/by-util/test_install.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 9f4d9af18..a5ce040f7 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -370,6 +370,9 @@ fn test_install_copy_file_leading_dot() { at.mkdir(dir2); at.touch(&format!("{}/{}", dir1, file1)); - ucmd.arg(format!("{}/{}", dir1, file1)).arg(dir2).succeeds().no_stderr(); + ucmd.arg(format!("{}/{}", dir1, file1)) + .arg(dir2) + .succeeds() + .no_stderr(); assert!(at.file_exists(&format!("{}/{}", dir2, file1))); } From f8125a1040ff34745d101913a90892515e60ad88 Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Sat, 20 Mar 2021 16:11:29 +0200 Subject: [PATCH 465/606] install: match GNU warning output --- src/uu/install/src/install.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index a675549d1..1ac9bc743 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -427,7 +427,7 @@ fn copy_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behavior) -> let mut all_successful = true; for sourcepath in files.iter() { if !sourcepath.exists() { - show_error!( + show_info!( "cannot stat '{}': No such file or directory", sourcepath.display() ); From 9b0eee9066238c6197b316259388437095429879 Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Sat, 20 Mar 2021 20:07:19 +0200 Subject: [PATCH 466/606] install: added additional tests --- tests/by-util/test_install.rs | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index a5ce040f7..88f4c85cc 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -360,7 +360,7 @@ fn test_install_target_file_dev_null() { } #[test] -fn test_install_copy_file_leading_dot() { +fn test_install_nested_paths_copy_file() { let (at, mut ucmd) = at_and_ucmd!(); let dir1 = "test_install_target_new_file_dir_l"; let dir2 = "test_install_target_new_file_dir_m"; @@ -376,3 +376,34 @@ fn test_install_copy_file_leading_dot() { .no_stderr(); assert!(at.file_exists(&format!("{}/{}", dir2, file1))); } + +#[test] +fn test_install_failing_omitting_directory() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir1 = "source_dir"; + let file1 = "source_file"; + let dir2 = "target_dir"; + + at.mkdir(dir1); + at.mkdir(dir2); + at.touch(file1); + + let r = ucmd.arg(dir1).arg(file1).arg(dir2).run(); + assert!(r.code == Some(1)); + assert!(r.stderr.contains("omitting directory")); +} + +#[test] +fn test_install_failing_no_such_file() { + let (at, mut ucmd) = at_and_ucmd!(); + let file1 = "source_file"; + let file2 = "inexistent_file"; + let dir1 = "target_dir"; + + at.mkdir(dir1); + at.touch(file1); + + let r = ucmd.arg(file1).arg(file2).arg(dir1).run(); + assert!(r.code == Some(1)); + assert!(r.stderr.contains("No such file or directory")); +} From 220ca78c9bc81cd16425b9c79da06997161ae6b6 Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Sat, 20 Mar 2021 20:31:52 +0200 Subject: [PATCH 467/606] install: normalize test filenames --- tests/by-util/test_install.rs | 80 +++++++++++++++++------------------ 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 88f4c85cc..89dfb0e56 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -17,9 +17,9 @@ fn test_install_help() { #[test] fn test_install_basic() { let (at, mut ucmd) = at_and_ucmd!(); - let dir = "test_install_target_dir_dir_a"; - let file1 = "test_install_target_dir_file_a1"; - let file2 = "test_install_target_dir_file_a2"; + let dir = "target_dir"; + let file1 = "source_file1"; + let file2 = "source_file2"; at.touch(file1); at.touch(file2); @@ -34,7 +34,7 @@ fn test_install_basic() { #[test] fn test_install_twice_dir() { - let dir = "test_install_target_dir_dir_a"; + let dir = "dir"; let scene = TestScenario::new(util_name!()); scene.ucmd().arg("-d").arg(dir).succeeds(); @@ -47,9 +47,9 @@ fn test_install_twice_dir() { #[test] fn test_install_failing_not_dir() { let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_dir_file_a1"; - let file2 = "test_install_target_dir_file_a2"; - let file3 = "test_install_target_dir_file_a3"; + let file1 = "file1"; + let file2 = "file2"; + let file3 = "file3"; at.touch(file1); at.touch(file2); @@ -66,8 +66,8 @@ fn test_install_failing_not_dir() { #[test] fn test_install_unimplemented_arg() { let (at, mut ucmd) = at_and_ucmd!(); - let dir = "test_install_target_dir_dir_b"; - let file = "test_install_target_dir_file_b"; + let dir = "target_dir"; + let file = "source_file"; let context_arg = "--context"; at.touch(file); @@ -86,9 +86,9 @@ fn test_install_unimplemented_arg() { #[test] fn test_install_component_directories() { let (at, mut ucmd) = at_and_ucmd!(); - let component1 = "test_install_target_dir_component_c1"; - let component2 = "test_install_target_dir_component_c2"; - let component3 = "test_install_target_dir_component_c3"; + let component1 = "component1"; + let component2 = "component2"; + let component3 = "component3"; let directories_arg = "-d"; ucmd.args(&[directories_arg, component1, component2, component3]) @@ -104,10 +104,10 @@ fn test_install_component_directories() { fn test_install_mode_numeric() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; - let dir = "test_install_target_dir_dir_e"; - let dir2 = "test_install_target_dir_dir_e2"; + let dir = "dir1"; + let dir2 = "dir2"; - let file = "test_install_target_dir_file_e"; + let file = "file"; let mode_arg = "--mode=333"; at.touch(file); @@ -145,8 +145,8 @@ fn test_install_mode_numeric() { #[test] fn test_install_mode_symbolic() { let (at, mut ucmd) = at_and_ucmd!(); - let dir = "test_install_target_dir_dir_f"; - let file = "test_install_target_dir_file_f"; + let dir = "target_dir"; + let file = "source_file"; let mode_arg = "--mode=o+wx"; at.touch(file); @@ -163,8 +163,8 @@ fn test_install_mode_symbolic() { #[test] fn test_install_mode_failing() { let (at, mut ucmd) = at_and_ucmd!(); - let dir = "test_install_target_dir_dir_g"; - let file = "test_install_target_dir_file_g"; + let dir = "target_dir"; + let file = "source_file"; let mode_arg = "--mode=999"; at.touch(file); @@ -185,7 +185,7 @@ fn test_install_mode_failing() { #[test] fn test_install_mode_directories() { let (at, mut ucmd) = at_and_ucmd!(); - let component = "test_install_target_dir_component_h"; + let component = "component"; let directories_arg = "-d"; let mode_arg = "--mode=333"; @@ -203,8 +203,8 @@ fn test_install_mode_directories() { #[test] fn test_install_target_file() { let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_file_file_i1"; - let file2 = "test_install_target_file_file_i2"; + let file1 = "source_file"; + let file2 = "target_file"; at.touch(file1); at.touch(file2); @@ -217,8 +217,8 @@ fn test_install_target_file() { #[test] fn test_install_target_new_file() { let (at, mut ucmd) = at_and_ucmd!(); - let file = "test_install_target_new_filer_file_j"; - let dir = "test_install_target_new_file_dir_j"; + let file = "file"; + let dir = "target_dir"; at.touch(file); at.mkdir(dir); @@ -234,8 +234,8 @@ fn test_install_target_new_file() { #[test] fn test_install_target_new_file_with_group() { let (at, mut ucmd) = at_and_ucmd!(); - let file = "test_install_target_new_filer_file_j"; - let dir = "test_install_target_new_file_dir_j"; + let file = "file"; + let dir = "target_dir"; let gid = get_effective_gid(); at.touch(file); @@ -264,8 +264,8 @@ fn test_install_target_new_file_with_group() { #[test] fn test_install_target_new_file_with_owner() { let (at, mut ucmd) = at_and_ucmd!(); - let file = "test_install_target_new_filer_file_j"; - let dir = "test_install_target_new_file_dir_j"; + let file = "file"; + let dir = "target_dir"; let uid = get_effective_uid(); at.touch(file); @@ -294,9 +294,9 @@ fn test_install_target_new_file_with_owner() { #[test] fn test_install_target_new_file_failing_nonexistent_parent() { let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_new_file_failing_file_k1"; - let file2 = "test_install_target_new_file_failing_file_k2"; - let dir = "test_install_target_new_file_failing_dir_k"; + let file1 = "source_file"; + let file2 = "target_file"; + let dir = "target_dir"; at.touch(file1); @@ -312,8 +312,8 @@ fn test_install_target_new_file_failing_nonexistent_parent() { #[test] fn test_install_preserve_timestamps() { let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_dir_file_a1"; - let file2 = "test_install_target_dir_file_a2"; + let file1 = "source_file"; + let file2 = "target_file"; at.touch(file1); ucmd.arg(file1).arg(file2).arg("-p").succeeds().no_stderr(); @@ -338,8 +338,8 @@ fn test_install_preserve_timestamps() { #[test] fn test_install_copy_file() { let (at, mut ucmd) = at_and_ucmd!(); - let file1 = "test_install_target_dir_file_a1"; - let file2 = "test_install_target_dir_file_a2"; + let file1 = "source_file"; + let file2 = "target_file"; at.touch(file1); ucmd.arg(file1).arg(file2).succeeds().no_stderr(); @@ -353,7 +353,7 @@ fn test_install_copy_file() { fn test_install_target_file_dev_null() { let (at, mut ucmd) = at_and_ucmd!(); let file1 = "/dev/null"; - let file2 = "test_install_target_file_file_i2"; + let file2 = "target_file"; ucmd.arg(file1).arg(file2).succeeds().no_stderr(); assert!(at.file_exists(file2)); @@ -362,9 +362,9 @@ fn test_install_target_file_dev_null() { #[test] fn test_install_nested_paths_copy_file() { let (at, mut ucmd) = at_and_ucmd!(); - let dir1 = "test_install_target_new_file_dir_l"; - let dir2 = "test_install_target_new_file_dir_m"; - let file1 = "test_install_target_file_file_l1"; + let file1 = "source_file"; + let dir1 = "source_dir"; + let dir2 = "target_dir"; at.mkdir(dir1); at.mkdir(dir2); @@ -380,8 +380,8 @@ fn test_install_nested_paths_copy_file() { #[test] fn test_install_failing_omitting_directory() { let (at, mut ucmd) = at_and_ucmd!(); - let dir1 = "source_dir"; let file1 = "source_file"; + let dir1 = "source_dir"; let dir2 = "target_dir"; at.mkdir(dir1); From 0a661a6da27af00751ccaf9ce1f89b5018739399 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sat, 20 Mar 2021 22:15:47 +0000 Subject: [PATCH 468/606] Remove use of which to set system binaries --- .github/workflows/GNU.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 299f333e1..1fcc7c721 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -60,7 +60,7 @@ jobs: ./bootstrap --gnulib-srcdir="$GNULIB_SRCDIR" ./configure --quiet --disable-gcc-warnings #Add timeout to to protect against hangs - sed -i "s|\"\$@|$(which timeout) 600 \"\$@|" build-aux/test-driver + sed -i 's|"\$@|/usr/bin/timeout 600 "\$@|' build-aux/test-driver # Change the PATH in the Makefile to test the uutils coreutils instead of the GNU coreutils sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${BUILDDIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" Makefile sed -i 's| tr | /usr/bin/tr |' tests/init.sh @@ -71,7 +71,7 @@ jobs: make tests/factor/t${i}.sh done grep -rl 'path_prepend_' tests/* | xargs sed -i 's|path_prepend_ ./src||' - sed -i -e 's|^seq |/usr/bin/seq |' -e "s|sha1sum |$(which sha1sum) |" tests/factor/t*sh + sed -i -e 's|^seq |/usr/bin/seq |' -e 's|sha1sum |/usr/bin/sha1sum |' tests/factor/t*sh # Remove tests checking for --version & --help # Not really interesting for us and logs are too big @@ -81,21 +81,21 @@ jobs: Makefile # Use the system coreutils where the test fails due to error in a util that is not the one being tested - sed -i "s|stat|$(which stat)|" tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh - sed -i "s|ls -|$(which ls) -|" tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh - sed -i "s|mkdir |$(which mkdir) |" tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i "s|timeout |$(which timeout) |" tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh - sed -i "s| timeout | $(which timeout) |" tests/tail-2/inotify-rotate.sh # Don't break the function called 'grep_timeout' - sed -i "s|chmod |$(which chmod) |" tests/du/inacc-dir.sh tests/mkdir/p-3.sh - sed -i "s|sort |$(which sort) |" tests/ls/hyperlink.sh tests/misc/test-N.sh - sed -i "s|split |$(which split) |" tests/misc/factor-parallel.sh - sed -i "s|truncate |$(which truncate) |" tests/split/fail.sh - sed -i "s|dd |$(which dd) |" tests/du/8gb.sh tests/tail-2/big-4gb.sh - sed -i "s|id -|$(which id) -|" tests/misc/runcon-no-reorder.sh + sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh + sed -i 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh tests/du/8gb.sh + sed -i 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh + sed -i 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh + sed -i 's| timeout | /usr/bin/timeout |' tests/tail-2/inotify-rotate.sh # Don't break the function called 'grep_timeout' + sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh + sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh + sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh + sed -i 's|truncate |/usr/bin/truncate |' tests/split/fail.sh + sed -i '|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh + sed -i 's|id -|/usr/bin/id -|' tests/misc/runcon-no-reorder.sh #Add specific timeout to tests that currently hang to limit time spent waiting - sed -i "s|seq \\$|$(which timeout) 0.1 seq \$|" tests/misc/seq-precision.sh tests/misc/seq-long-double.sh - sed -i "s|cat |$(which timeout) 0.1 cat |" tests/misc/cat-self.sh + sed -i 's|seq \$|/usr/bin/timeout 0.1 seq \$|' tests/misc/seq-precision.sh tests/misc/seq-long-double.sh + sed -i 's|cat |/usr/bin/timeout 0.1 cat |' tests/misc/cat-self.sh test -f "${BUILDDIR}/getlimits" || cp src/getlimits "${BUILDDIR}" From 4352d47ac31f6aab4968cfa3aa1cb54f75eed7ed Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Mar 2021 14:45:34 +0000 Subject: [PATCH 469/606] Don't fail the job if test-suite.log is missing --- .github/workflows/GNU.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 1fcc7c721..79ef69b8c 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -110,13 +110,18 @@ jobs: - name: Extract tests info shell: bash run: | - TOTAL=$( grep "# TOTAL:" gnu/tests/test-suite.log|cut -d' ' -f2-) - PASS=$( grep "# PASS:" gnu/tests/test-suite.log|cut -d' ' -f2-) - SKIP=$( grep "# SKIP:" gnu/tests/test-suite.log|cut -d' ' -f2-) - FAIL=$( grep "# FAIL:" gnu/tests/test-suite.log|cut -d' ' -f2-) - XPASS=$( grep "# XPASS:" gnu/tests/test-suite.log|cut -d' ' -f2-) - ERROR=$( grep "# ERROR:" gnu/tests/test-suite.log|cut -d' ' -f2-) - echo "::warning ::GNU testsuite = $TOTAL / $PASS / $FAIL / $ERROR" + if test -f gnu/tests/test-suite.log + then + TOTAL=$( grep "# TOTAL:" gnu/tests/test-suite.log|cut -d' ' -f2-) + PASS=$( grep "# PASS:" gnu/tests/test-suite.log|cut -d' ' -f2-) + SKIP=$( grep "# SKIP:" gnu/tests/test-suite.log|cut -d' ' -f2-) + FAIL=$( grep "# FAIL:" gnu/tests/test-suite.log|cut -d' ' -f2-) + XPASS=$( grep "# XPASS:" gnu/tests/test-suite.log|cut -d' ' -f2-) + ERROR=$( grep "# ERROR:" gnu/tests/test-suite.log|cut -d' ' -f2-) + echo "::warning ::GNU testsuite = $TOTAL / $PASS / $FAIL / $ERROR" + else + echo "::error ::Failed to get summary of test results" + fi - uses: actions/upload-artifact@v2 with: From 0f77b54aeb8c44ca61979d9a772abe0b2cba29d4 Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Mar 2021 15:11:48 +0000 Subject: [PATCH 470/606] Fix typo --- .github/workflows/GNU.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 79ef69b8c..59ce82420 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -90,7 +90,7 @@ jobs: sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh sed -i 's|truncate |/usr/bin/truncate |' tests/split/fail.sh - sed -i '|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh + sed -i 's|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh sed -i 's|id -|/usr/bin/id -|' tests/misc/runcon-no-reorder.sh #Add specific timeout to tests that currently hang to limit time spent waiting From 25d4a083877db99af4887a1304afd245a94f0491 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 21 Mar 2021 16:18:06 +0100 Subject: [PATCH 471/606] 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. --- src/uu/ls/src/ls.rs | 240 +++++++++++++++++++++++++++++++-------- tests/by-util/test_ls.rs | 151 ++++++++++++++++++++++++ 2 files changed, 345 insertions(+), 46 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 6ade9e2e6..a935eef54 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -78,6 +78,8 @@ pub mod options { pub static ONELINE: &str = "1"; pub static LONG: &str = "long"; pub static COLUMNS: &str = "C"; + pub static LONG_NO_OWNER: &str = "g"; + pub static LONG_NO_GROUP: &str = "o"; } pub mod files { pub static ALL: &str = "all"; @@ -96,6 +98,8 @@ pub mod options { pub static HUMAN_READABLE: &str = "human-readable"; pub static SI: &str = "si"; } + pub static AUTHOR: &str = "author"; + pub static NO_GROUP: &str = "no-group"; pub static FORMAT: &str = "format"; pub static SORT: &str = "sort"; pub static TIME: &str = "time"; @@ -161,26 +165,85 @@ struct Config { inode: bool, #[cfg(unix)] color: bool, + long: LongFormat, +} + +// Fields that can be removed or added to the long format +struct LongFormat { + author: bool, + group: bool, + owner: bool, } impl Config { fn from(options: clap::ArgMatches) -> Config { - let format = if let Some(format_) = options.value_of(options::FORMAT) { - match format_ { - "long" | "verbose" => Format::Long, - "single-column" => Format::OneLine, - "columns" => Format::Columns, - // below should never happen as clap already restricts the values. - _ => unreachable!("Invalid field for --format"), - } + let (mut format, opt) = if let Some(format_) = options.value_of(options::FORMAT) { + ( + match format_ { + "long" | "verbose" => Format::Long, + "single-column" => Format::OneLine, + "columns" | "vertical" => Format::Columns, + // below should never happen as clap already restricts the values. + _ => unreachable!("Invalid field for --format"), + }, + options::FORMAT, + ) } else if options.is_present(options::format::LONG) { - Format::Long - } else if options.is_present(options::format::ONELINE) { - Format::OneLine + (Format::Long, options::format::LONG) } else { - Format::Columns + (Format::Columns, options::format::COLUMNS) }; + // The -o and -g options are tricky. They cannot override with each + // other because it's possible to combine them. For example, the option + // -og should hide both owner and group. Furthermore, they are not + // reset if -l or --format=long is used. So these should just show the + // group: -gl or "-g --format=long". Finally, they are also not reset + // when switching to a different format option inbetween like this: + // -ogCl or "-og --format=vertical --format=long". + // + // -1 has a similar issue: it does nothing if the format is long. This + // actually makes it distinct from the --format=singe-column option, + // which always applies. + // + // The idea here is to not let these options override with the other + // options, but manually check the last index they occur. If this index + // is larger than the index for the other format options, we apply the + // long format. + match options.indices_of(opt).map(|x| x.max().unwrap()) { + None => { + if options.is_present(options::format::LONG_NO_GROUP) + || options.is_present(options::format::LONG_NO_OWNER) + { + format = Format::Long; + } else if options.is_present(options::format::ONELINE) { + format = Format::OneLine; + } + } + Some(mut idx) => { + if let Some(indices) = options.indices_of(options::format::LONG_NO_OWNER) { + let i = indices.max().unwrap(); + if i > idx { + format = Format::Long; + idx = i; + } + } + if let Some(indices) = options.indices_of(options::format::LONG_NO_GROUP) { + let i = indices.max().unwrap(); + if i > idx { + format = Format::Long; + idx = i; + } + } + if let Some(indices) = options.indices_of(options::format::ONELINE) { + let i = indices.max().unwrap(); + if i > idx && format != Format::Long { + format = Format::OneLine; + } + } + } + } + let files = if options.is_present(options::files::ALL) { Files::All } else if options.is_present(options::files::ALMOST_ALL) { @@ -241,6 +304,18 @@ impl Config { SizeFormat::Bytes }; + let long = { + let author = options.is_present(options::AUTHOR); + let group = !options.is_present(options::NO_GROUP) + && !options.is_present(options::format::LONG_NO_GROUP); + let owner = !options.is_present(options::format::LONG_NO_OWNER); + LongFormat { + author, + group, + owner, + } + }; + Config { format, files, @@ -258,6 +333,7 @@ impl Config { color, #[cfg(unix)] inode: options.is_present(options::INODE), + long, } } } @@ -284,7 +360,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .overrides_with_all(&[ options::FORMAT, options::format::COLUMNS, - options::format::ONELINE, options::format::LONG, ]), ) @@ -292,17 +367,40 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::format::COLUMNS) .short(options::format::COLUMNS) .help("Display the files in columns.") - ) - .arg( - Arg::with_name(options::format::ONELINE) - .short(options::format::ONELINE) - .help("List one file per line.") + .overrides_with_all(&[ + options::FORMAT, + options::format::COLUMNS, + options::format::LONG, + ]), ) .arg( Arg::with_name(options::format::LONG) .short("l") .long(options::format::LONG) .help("Display detailed information.") + .overrides_with_all(&[ + options::FORMAT, + options::format::COLUMNS, + options::format::ONELINE, + options::format::LONG, + ]), + ) + // The next three arguments do not override with the other format + // options, see the comment in Config::from for the reason. + .arg( + Arg::with_name(options::format::ONELINE) + .short(options::format::ONELINE) + .help("List one file per line.") + ) + .arg( + Arg::with_name(options::format::LONG_NO_GROUP) + .short(options::format::LONG_NO_GROUP) + .help("Long format without group information. Identical to --format=long with --no-group.") + ) + .arg( + Arg::with_name(options::format::LONG_NO_OWNER) + .short(options::format::LONG_NO_OWNER) + .help("Long format without owner information.") ) // Time arguments @@ -329,8 +427,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("If the long listing format (e.g., -l, -o) is being used, print the status \ change time (the ‘ctime’ in the inode) instead of the modification time. When \ explicitly sorting by time (--sort=time or -t) or when not using a long listing \ - format, sort according to the status change time.", - )) + format, sort according to the status change time.") + .overrides_with_all(&[ + options::TIME, + options::time::ACCESS, + options::time::CHANGE, + ]) + ) .arg( Arg::with_name(options::time::ACCESS) .short(options::time::ACCESS) @@ -338,6 +441,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { access time instead of the modification time. When explicitly sorting by time \ (--sort=time or -t) or when not using a long listing format, sort according to the \ access time.") + .overrides_with_all(&[ + options::TIME, + options::time::ACCESS, + options::time::CHANGE, + ]) ) // Sort arguments @@ -359,12 +467,24 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg( Arg::with_name(options::sort::SIZE) .short(options::sort::SIZE) - .help("Sort by file size, largest first."), + .help("Sort by file size, largest first.") + .overrides_with_all(&[ + options::SORT, + options::sort::SIZE, + options::sort::TIME, + options::sort::NONE, + ]) ) .arg( Arg::with_name(options::sort::TIME) .short(options::sort::TIME) - .help("Sort by modification time (the 'mtime' in the inode), newest first."), + .help("Sort by modification time (the 'mtime' in the inode), newest first.") + .overrides_with_all(&[ + options::SORT, + options::sort::SIZE, + options::sort::TIME, + options::sort::NONE, + ]) ) .arg( Arg::with_name(options::sort::NONE) @@ -372,8 +492,27 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("Do not sort; list the files in whatever order they are stored in the \ directory. This is especially useful when listing very large directories, \ since not doing any sorting can be noticeably faster.") + .overrides_with_all(&[ + options::SORT, + options::sort::SIZE, + options::sort::TIME, + options::sort::NONE, + ]) ) + // Long format options + .arg( + Arg::with_name(options::NO_GROUP) + .long(options::NO_GROUP) + .short("-G") + .help("Do not show group in long format.") + ) + .arg( + Arg::with_name(options::AUTHOR) + .long(options::AUTHOR) + .help("Show author in long format. On the supported platforms, the author \ + always matches the file owner.") + ) // Other Flags .arg( Arg::with_name(options::files::ALL) @@ -699,32 +838,45 @@ fn display_item_long( Ok(md) => md, }; - println!( - "{}{}{} {} {} {} {} {} {}", - get_inode(&md, config), + #[cfg(unix)] + { + if config.inode { + print!("{} ", get_inode(&md)); + } + } + + print!( + "{}{} {}", display_file_type(md.file_type()), display_permissions(&md), pad_left(display_symlink_count(&md), max_links), - display_uname(&md, config), - display_group(&md, config), + ); + + if config.long.owner { + print!(" {}", display_uname(&md, config)); + } + + if config.long.group { + print!(" {}", display_group(&md, config)); + } + + // Author is only different from owner on GNU/Hurd, so we reuse + // the owner, since GNU/Hurd is not currently supported by Rust. + if config.long.author { + print!(" {}", display_uname(&md, config)); + } + + println!( + " {} {} {}", pad_left(display_file_size(&md, config), max_size), display_date(&md, config), - display_file_name(&item, strip, &md, config).contents + display_file_name(&item, strip, &md, config).contents, ); } #[cfg(unix)] -fn get_inode(metadata: &Metadata, config: &Config) -> String { - if config.inode { - format!("{:8} ", metadata.ino()) - } else { - "".to_string() - } -} - -#[cfg(not(unix))] -fn get_inode(_metadata: &Metadata, _config: &Config) -> String { - "".to_string() +fn get_inode(metadata: &Metadata) -> String { + format!("{:8}", metadata.ino()) } // Currently getpwuid is `linux` target only. If it's broken out into @@ -808,7 +960,7 @@ fn format_prefixed(prefixed: NumberPrefix) -> String { NumberPrefix::Standalone(bytes) => bytes.to_string(), NumberPrefix::Prefixed(prefix, bytes) => { // Remove the "i" from "Ki", "Mi", etc. if present - let prefix_str = prefix.symbol().trim_end_matches("i"); + let prefix_str = prefix.symbol().trim_end_matches('i'); // Check whether we get more than 10 if we round up to the first decimal // because we want do display 9.81 as "9.9", not as "10". @@ -861,10 +1013,6 @@ fn display_file_name( ) -> Cell { let mut name = get_file_name(path, strip); - if config.format == Format::Long { - name = get_inode(metadata, config) + &name; - } - if config.classify { let file_type = metadata.file_type(); if file_type.is_dir() { @@ -922,8 +1070,8 @@ fn display_file_name( config: &Config, ) -> Cell { let mut name = get_file_name(path, strip); - if config.format != Format::Long { - name = get_inode(metadata, config) + &name; + if config.format != Format::Long && config.inode { + name = get_inode(metadata) + " " + &name; } let mut width = UnicodeWidthStr::width(&*name); diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index e0063aa1a..ac5e0c8b3 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -124,6 +124,108 @@ fn test_ls_long() { } } +#[test] +fn test_ls_long_formats() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch(&at.plus_as_string("test-long-formats")); + + // Regex for three names, so all of author, group and owner + let re_three = Regex::new(r"[xrw-]{9} \d ([-0-9_a-z]+ ){3}0").unwrap(); + + // Regex for two names, either: + // - group and owner + // - author and owner + // - author and group + let re_two = Regex::new(r"[xrw-]{9} \d ([-0-9_a-z]+ ){2}0").unwrap(); + + // Regex for one name: author, group or owner + let re_one = Regex::new(r"[xrw-]{9} \d [-0-9_a-z]+ 0").unwrap(); + + // Regex for no names + let re_zero = Regex::new(r"[xrw-]{9} \d 0").unwrap(); + + let result = scene + .ucmd() + .arg("-l") + .arg("--author") + .arg("test-long-formats") + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_three.is_match(&result.stdout)); + + let result = scene + .ucmd() + .arg("-l1") + .arg("--author") + .arg("test-long-formats") + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_three.is_match(&result.stdout)); + + for arg in &[ + "-l", // only group and owner + "-g --author", // only author and group + "-o --author", // only author and owner + "-lG --author", // only author and owner + "-l --no-group --author", // only author and owner + ] { + let result = scene + .ucmd() + .args(&arg.split(" ").collect::>()) + .arg("test-long-formats") + .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_two.is_match(&result.stdout)); + } + + for arg in &[ + "-g", // only group + "-gl", // only group + "-o", // only owner + "-ol", // only owner + "-oG", // only owner + "-lG", // only owner + "-l --no-group", // only owner + "-gG --author", // only author + ] { + let result = scene + .ucmd() + .args(&arg.split(" ").collect::>()) + .arg("test-long-formats") + .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_one.is_match(&result.stdout)); + } + + for arg in &[ + "-og", + "-ogl", + "-lgo", + "-gG", + "-g --no-group", + "-og --no-group", + "-og --format=long", + "-ogCl", + "-og --format=vertical -l", + "-og1", + "-og1l", + ] { + let result = scene + .ucmd() + .args(&arg.split(" ").collect::>()) + .arg("test-long-formats") + .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_zero.is_match(&result.stdout)); + } +} + #[test] fn test_ls_oneline() { let scene = TestScenario::new(util_name!()); @@ -426,6 +528,55 @@ fn test_ls_ls_color() { assert_eq!(result.stdout, ""); } +#[cfg(unix)] +#[test] +fn test_ls_inode() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let file = "test_inode"; + at.touch(file); + + let re_short = Regex::new(r" *(\d+) test_inode").unwrap(); + let re_long = Regex::new(r" *(\d+) [xrw-]{10} \d .+ test_inode").unwrap(); + + let result = scene.ucmd().arg("test_inode").arg("-i").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_short.is_match(&result.stdout)); + let inode_short = re_short + .captures(&result.stdout) + .unwrap() + .get(1) + .unwrap() + .as_str(); + + let result = scene.ucmd().arg("test_inode").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(!re_short.is_match(&result.stdout)); + assert!(!result.stdout.contains(inode_short)); + + let result = scene.ucmd().arg("-li").arg("test_inode").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_long.is_match(&result.stdout)); + let inode_long = re_long + .captures(&result.stdout) + .unwrap() + .get(1) + .unwrap() + .as_str(); + + let result = scene.ucmd().arg("-l").arg("test_inode").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(!re_long.is_match(&result.stdout)); + assert!(!result.stdout.contains(inode_long)); + + assert_eq!(inode_short, inode_long) +} + #[cfg(not(any(target_vendor = "apple", target_os = "windows")))] // Truncate not available on mac or win #[test] fn test_ls_human_si() { From f60790dd411fbdc85a77eef24faab5c34422b00b Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Sun, 21 Mar 2021 18:18:47 +0300 Subject: [PATCH 472/606] chroot: move to clap from getopts (#1792) + add tests --- src/uu/chroot/Cargo.toml | 2 +- src/uu/chroot/src/chroot.rs | 122 +++++++++++++++++++++-------------- tests/by-util/test_chroot.rs | 99 +++++++++++++++++++++++++++- 3 files changed, 172 insertions(+), 51 deletions(-) diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index 7ad2f0908..e967d4137 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/chroot.rs" [dependencies] -getopts = "0.2.18" +clap= "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index ab654abf8..2c3bcbca4 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -10,60 +10,81 @@ #[macro_use] extern crate uucore; -use uucore::entries; -use uucore::libc::{self, chroot, setgid, setgroups, setuid}; - +use clap::{App, Arg}; use std::ffi::CString; use std::io::Error; use std::path::Path; use std::process::Command; +use uucore::entries; +use uucore::libc::{self, chroot, setgid, setgroups, setuid}; +static VERSION: &str = env!("CARGO_PKG_VERSION"); static NAME: &str = "chroot"; +static ABOUT: &str = "Run COMMAND with root directory set to NEWROOT."; static SYNTAX: &str = "[OPTION]... NEWROOT [COMMAND [ARG]...]"; -static SUMMARY: &str = "Run COMMAND with root directory set to NEWROOT."; -static LONG_HELP: &str = " - If COMMAND is not specified, it defaults to '$(SHELL) -i'. - If $(SHELL) is not set, /bin/sh is used. -"; + +mod options { + pub const NEWROOT: &str = "newroot"; + pub const USER: &str = "user"; + pub const GROUP: &str = "group"; + pub const GROUPS: &str = "groups"; + pub const USERSPEC: &str = "userspec"; +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optopt( - "u", - "user", - "User (ID or name) to switch before running the program", - "USER", + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(SYNTAX) + .arg(Arg::with_name(options::NEWROOT).hidden(true).required(true)) + .arg( + Arg::with_name(options::USER) + .short("u") + .long(options::USER) + .help("User (ID or name) to switch before running the program") + .value_name("USER"), ) - .optopt("g", "group", "Group (ID or name) to switch to", "GROUP") - .optopt( - "G", - "groups", - "Comma-separated list of groups to switch to", - "GROUP1,GROUP2...", + .arg( + Arg::with_name(options::GROUP) + .short("g") + .long(options::GROUP) + .help("Group (ID or name) to switch to") + .value_name("GROUP"), ) - .optopt( - "", - "userspec", - "Colon-separated user and group to switch to. \ + .arg( + Arg::with_name(options::GROUPS) + .short("G") + .long(options::GROUPS) + .help("Comma-separated list of groups to switch to") + .value_name("GROUP1,GROUP2..."), + ) + .arg( + Arg::with_name(options::USERSPEC) + .long(options::USERSPEC) + .help( + "Colon-separated user and group to switch to. \ Same as -u USER -g GROUP. \ Userspec has higher preference than -u and/or -g", - "USER:GROUP", + ) + .value_name("USER:GROUP"), ) - .parse(args); - - if matches.free.is_empty() { - println!("Missing operand: NEWROOT"); - println!("Try `{} --help` for more information.", NAME); - return 1; - } + .get_matches_from(args); let default_shell: &'static str = "/bin/sh"; let default_option: &'static str = "-i"; let user_shell = std::env::var("SHELL"); - let newroot = Path::new(&matches.free[0][..]); + let newroot: &Path = match matches.value_of(options::NEWROOT) { + Some(v) => Path::new(v), + None => crash!( + 1, + "Missing operand: NEWROOT\nTry '{} --help' for more information.", + NAME + ), + }; + if !newroot.is_dir() { crash!( 1, @@ -72,7 +93,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ); } - let command: Vec<&str> = match matches.free.len() { + let command: Vec<&str> = match matches.args.len() { 1 => { let shell: &str = match user_shell { Err(_) => default_shell, @@ -80,7 +101,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; vec![shell, default_option] } - _ => matches.free[1..].iter().map(|x| &x[..]).collect(), + _ => { + let mut vector: Vec<&str> = Vec::new(); + for (&k, v) in matches.args.iter() { + vector.push(k.clone()); + vector.push(&v.vals[0].to_str().unwrap()); + } + vector + } }; set_context(&newroot, &matches); @@ -97,30 +125,26 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } -fn set_context(root: &Path, options: &getopts::Matches) { - let userspec_str = options.opt_str("userspec"); - let user_str = options.opt_str("user").unwrap_or_default(); - let group_str = options.opt_str("group").unwrap_or_default(); - let groups_str = options.opt_str("groups").unwrap_or_default(); +fn set_context(root: &Path, options: &clap::ArgMatches) { + let userspec_str = options.value_of(options::USERSPEC); + let user_str = options.value_of(options::USER).unwrap_or_default(); + let group_str = options.value_of(options::GROUP).unwrap_or_default(); + let groups_str = options.value_of(options::GROUPS).unwrap_or_default(); let userspec = match userspec_str { Some(ref u) => { let s: Vec<&str> = u.split(':').collect(); - if s.len() != 2 { + if s.len() != 2 || s.iter().any(|&spec| spec == "") { crash!(1, "invalid userspec: `{}`", u) }; s } None => Vec::new(), }; - let user = if userspec.is_empty() { - &user_str[..] + + let (user, group) = if userspec.is_empty() { + (&user_str[..], &group_str[..]) } else { - &userspec[0][..] - }; - let group = if userspec.is_empty() { - &group_str[..] - } else { - &userspec[1][..] + (&userspec[0][..], &userspec[1][..]) }; enter_chroot(root); diff --git a/tests/by-util/test_chroot.rs b/tests/by-util/test_chroot.rs index 651491045..9a8fb71dd 100644 --- a/tests/by-util/test_chroot.rs +++ b/tests/by-util/test_chroot.rs @@ -1 +1,98 @@ -// ToDO: add tests +use crate::common::util::*; + +#[test] +fn test_missing_operand() { + let result = new_ucmd!().run(); + + assert_eq!( + true, + result + .stderr + .starts_with("error: The following required arguments were not provided") + ); + + assert_eq!(true, result.stderr.contains("")); +} + +#[test] +fn test_enter_chroot_fails() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.mkdir("jail"); + + let result = ucmd.arg("jail").run(); + + assert_eq!( + true, + result.stderr.starts_with( + "chroot: error: cannot chroot to jail: Operation not permitted (os error 1)" + ) + ) +} + +#[test] +fn test_no_such_directory() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.touch(&at.plus_as_string("a")); + + ucmd.arg("a") + .fails() + .stderr_is("chroot: error: cannot change root directory to `a`: no such directory"); +} + +#[test] +fn test_invalid_user_spec() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.mkdir("a"); + + let result = ucmd.arg("a").arg("--userspec=ARABA:").run(); + + assert_eq!( + true, + result.stderr.starts_with("chroot: error: invalid userspec") + ); +} + +#[test] +fn test_preference_of_userspec() { + let scene = TestScenario::new(util_name!()); + let result = scene.cmd("whoami").run(); + if is_ci() && result.stderr.contains("No such user/group") { + // In the CI, some server are failing to return whoami. + // As seems to be a configuration issue, ignoring it + return; + } + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); + let username = result.stdout.trim_end(); + + let ts = TestScenario::new("id"); + let result = ts.cmd("id").arg("-g").arg("-n").run(); + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); + + if is_ci() && result.stderr.contains("cannot find name for user ID") { + // In the CI, some server are failing to return id. + // As seems to be a configuration issue, ignoring it + return; + } + + let group_name = result.stdout.trim_end(); + let (at, mut ucmd) = at_and_ucmd!(); + + at.mkdir("a"); + + let result = ucmd + .arg("a") + .arg("--user") + .arg("fake") + .arg("-G") + .arg("ABC,DEF") + .arg(format!("--userspec={}:{}", username, group_name)) + .run(); + + println!("result.stdout {}", result.stdout); + println!("result.stderr = {}", result.stderr); +} From ca8fbc37bfe5526af61d210480895069aecc8030 Mon Sep 17 00:00:00 2001 From: pedrohjordao Date: Sun, 21 Mar 2021 15:19:30 +0000 Subject: [PATCH 473/606] od: Changes command line parser to clap (#1849) --- Cargo.lock | 4 +- src/uu/od/Cargo.toml | 2 +- src/uu/od/src/od.rs | 361 ++++++++++++++++++++++++---------- src/uu/od/src/parse_inputs.rs | 40 ++-- 4 files changed, 284 insertions(+), 123 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8d4318dec..ad207edd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,3 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" @@ -1868,7 +1866,7 @@ name = "uu_od" version = "0.0.4" dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index 14aea59a7..e4db9faf0 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -16,7 +16,7 @@ path = "src/od.rs" [dependencies] byteorder = "1.3.2" -getopts = "0.2.18" +clap = "2.33" half = "1.6" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 47d3c29f8..791ddc4fc 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -41,15 +41,18 @@ use crate::parse_nrofbytes::parse_number_of_bytes; use crate::partialreader::*; use crate::peekreader::*; use crate::prn_char::format_ascii_dump; +use clap::{self, AppSettings, Arg, ArgMatches}; static VERSION: &str = env!("CARGO_PKG_VERSION"); const PEEK_BUFFER_SIZE: usize = 4; // utf-8 can be 4 bytes +static ABOUT: &str = "dump files in octal and other formats"; -static USAGE: &str = r#"Usage: +static USAGE: &str = r#" od [OPTION]... [--] [FILENAME]... od [-abcdDefFhHiIlLoOsxX] [FILENAME] [[+][0x]OFFSET[.][b]] - od --traditional [OPTION]... [FILENAME] [[+][0x]OFFSET[.][b] [[+][0x]LABEL[.][b]]] + od --traditional [OPTION]... [FILENAME] [[+][0x]OFFSET[.][b] [[+][0x]LABEL[.][b]]]"#; +static LONG_HELP: &str = r#" Displays data in various human-readable formats. If multiple formats are specified, the output will contain all formats in the order they appear on the command line. Each format will be printed on a new line. Only the line @@ -88,85 +91,18 @@ Any type specification can have a "z" suffix, which will add a ASCII dump at If an error occurred, a diagnostic message will be printed to stderr, and the exitcode will be non-zero."#; -fn create_getopts_options() -> getopts::Options { - let mut opts = getopts::Options::new(); - - opts.optopt( - "A", - "address-radix", - "Select the base in which file offsets are printed.", - "RADIX", - ); - opts.optopt( - "j", - "skip-bytes", - "Skip bytes input bytes before formatting and writing.", - "BYTES", - ); - opts.optopt( - "N", - "read-bytes", - "limit dump to BYTES input bytes", - "BYTES", - ); - opts.optopt( - "", - "endian", - "byte order to use for multi-byte formats", - "big|little", - ); - opts.optopt( - "S", - "strings", - "output strings of at least BYTES graphic chars. 3 is assumed when \ - BYTES is not specified.", - "BYTES", - ); - opts.optflagmulti("a", "", "named characters, ignoring high-order bit"); - opts.optflagmulti("b", "", "octal bytes"); - opts.optflagmulti("c", "", "ASCII characters or backslash escapes"); - opts.optflagmulti("d", "", "unsigned decimal 2-byte units"); - opts.optflagmulti("D", "", "unsigned decimal 4-byte units"); - opts.optflagmulti("o", "", "octal 2-byte units"); - - opts.optflagmulti("I", "", "decimal 8-byte units"); - opts.optflagmulti("L", "", "decimal 8-byte units"); - opts.optflagmulti("i", "", "decimal 4-byte units"); - opts.optflagmulti("l", "", "decimal 8-byte units"); - opts.optflagmulti("x", "", "hexadecimal 2-byte units"); - opts.optflagmulti("h", "", "hexadecimal 2-byte units"); - - opts.optflagmulti("O", "", "octal 4-byte units"); - opts.optflagmulti("s", "", "decimal 2-byte units"); - opts.optflagmulti("X", "", "hexadecimal 4-byte units"); - opts.optflagmulti("H", "", "hexadecimal 4-byte units"); - - opts.optflagmulti("e", "", "floating point double precision (64-bit) units"); - opts.optflagmulti("f", "", "floating point single precision (32-bit) units"); - opts.optflagmulti("F", "", "floating point double precision (64-bit) units"); - - opts.optmulti("t", "format", "select output format or formats", "TYPE"); - opts.optflag( - "v", - "output-duplicates", - "do not use * to mark line suppression", - ); - opts.optflagopt( - "w", - "width", - "output BYTES bytes per output line. 32 is implied when BYTES is not \ - specified.", - "BYTES", - ); - opts.optflag("", "help", "display this help and exit."); - opts.optflag("", "version", "output version information and exit."); - opts.optflag( - "", - "traditional", - "compatibility mode with one input, offset and label.", - ); - - opts +pub(crate) mod options { + pub const ADDRESS_RADIX: &str = "address-radix"; + pub const SKIP_BYTES: &str = "skip-bytes"; + pub const READ_BYTES: &str = "read-bytes"; + pub const ENDIAN: &str = "endian"; + pub const STRINGS: &str = "strings"; + pub const FORMAT: &str = "format"; + pub const OUTPUT_DUPLICATES: &str = "output-duplicates"; + pub const TRADITIONAL: &str = "traditional"; + pub const WIDTH: &str = "width"; + pub const VERSION: &str = "version"; + pub const FILENAME: &str = "FILENAME"; } struct OdOptions { @@ -182,8 +118,8 @@ struct OdOptions { } impl OdOptions { - fn new(matches: getopts::Matches, args: Vec) -> Result { - let byte_order = match matches.opt_str("endian").as_ref().map(String::as_ref) { + fn new<'a>(matches: ArgMatches<'a>, args: Vec) -> Result { + let byte_order = match matches.value_of(options::ENDIAN) { None => ByteOrder::Native, Some("little") => ByteOrder::Little, Some("big") => ByteOrder::Big, @@ -192,7 +128,7 @@ impl OdOptions { } }; - let mut skip_bytes = match matches.opt_default("skip-bytes", "0") { + let mut skip_bytes = match matches.value_of(options::SKIP_BYTES) { None => 0, Some(s) => match parse_number_of_bytes(&s) { Ok(i) => i, @@ -223,8 +159,9 @@ impl OdOptions { } }; - let mut line_bytes = match matches.opt_default("w", "32") { + let mut line_bytes = match matches.value_of(options::WIDTH) { None => 16, + Some(_) if matches.occurrences_of(options::WIDTH) == 0 => 16, Some(s) => s.parse::().unwrap_or(0), }; let min_bytes = formats.iter().fold(1, |max, next| { @@ -235,9 +172,9 @@ impl OdOptions { line_bytes = min_bytes; } - let output_duplicates = matches.opt_present("v"); + let output_duplicates = matches.is_present(options::OUTPUT_DUPLICATES); - let read_bytes = match matches.opt_str("read-bytes") { + let read_bytes = match matches.value_of(options::READ_BYTES) { None => None, Some(s) => match parse_number_of_bytes(&s) { Ok(i) => Some(i), @@ -247,10 +184,10 @@ impl OdOptions { }, }; - let radix = match matches.opt_str("A") { + let radix = match matches.value_of(options::ADDRESS_RADIX) { None => Radix::Octal, Some(s) => { - let st = s.into_bytes(); + let st = s.as_bytes(); if st.len() != 1 { return Err("Radix must be one of [d, o, n, x]".to_string()); } else { @@ -286,26 +223,244 @@ impl OdOptions { pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let opts = create_getopts_options(); + let clap_opts = clap::App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(USAGE) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::ADDRESS_RADIX) + .short("A") + .long(options::ADDRESS_RADIX) + .help("Select the base in which file offsets are printed.") + .value_name("RADIX"), + ) + .arg( + Arg::with_name(options::SKIP_BYTES) + .short("j") + .long(options::SKIP_BYTES) + .help("Skip bytes input bytes before formatting and writing.") + .value_name("BYTES"), + ) + .arg( + Arg::with_name(options::READ_BYTES) + .short("N") + .long(options::READ_BYTES) + .help("limit dump to BYTES input bytes") + .value_name("BYTES"), + ) + .arg( + Arg::with_name(options::ENDIAN) + .long(options::ENDIAN) + .help("byte order to use for multi-byte formats") + .possible_values(&["big", "little"]) + .value_name("big|little"), + ) + .arg( + Arg::with_name(options::STRINGS) + .short("S") + .long(options::STRINGS) + .help( + "output strings of at least BYTES graphic chars. 3 is assumed when \ + BYTES is not specified.", + ) + .default_value("3") + .value_name("BYTES"), + ) + .arg( + Arg::with_name("a") + .short("a") + .help("named characters, ignoring high-order bit") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("b") + .short("b") + .help("octal bytes") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("c") + .short("c") + .help("ASCII characters or backslash escapes") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("d") + .short("d") + .help("unsigned decimal 2-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("D") + .short("D") + .help("unsigned decimal 4-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("o") + .short("o") + .help("octal 2-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("I") + .short("I") + .help("decimal 8-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("L") + .short("L") + .help("decimal 8-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("i") + .short("i") + .help("decimal 4-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("l") + .short("l") + .help("decimal 8-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("x") + .short("x") + .help("hexadecimal 2-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("h") + .short("h") + .help("hexadecimal 2-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("O") + .short("O") + .help("octal 4-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("s") + .short("s") + .help("decimal 2-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("X") + .short("X") + .help("hexadecimal 4-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("H") + .short("H") + .help("hexadecimal 4-byte units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("e") + .short("e") + .help("floating point double precision (64-bit) units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("f") + .short("f") + .help("floating point double precision (32-bit) units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name("F") + .short("F") + .help("floating point double precision (64-bit) units") + .multiple(true) + .takes_value(false), + ) + .arg( + Arg::with_name(options::FORMAT) + .short("t") + .long(options::FORMAT) + .help("select output format or formats") + .multiple(true) + .value_name("TYPE"), + ) + .arg( + Arg::with_name(options::OUTPUT_DUPLICATES) + .short("v") + .long(options::OUTPUT_DUPLICATES) + .help("do not use * to mark line suppression") + .takes_value(false) + .possible_values(&["big", "little"]), + ) + .arg( + Arg::with_name(options::WIDTH) + .short("w") + .long(options::WIDTH) + .help( + "output BYTES bytes per output line. 32 is implied when BYTES is not \ + specified.", + ) + .default_value("32") + .value_name("BYTES"), + ) + .arg( + Arg::with_name(options::VERSION) + .long(options::VERSION) + .help("output version information and exit.") + .takes_value(false), + ) + .arg( + Arg::with_name(options::TRADITIONAL) + .long(options::TRADITIONAL) + .help("compatibility mode with one input, offset and label.") + .takes_value(false), + ) + .arg( + Arg::with_name(options::FILENAME) + .hidden(true) + .multiple(true) + ) + .settings(&[ + AppSettings::TrailingVarArg, + AppSettings::DontDelimitTrailingValues, + AppSettings::DisableVersion, + AppSettings::DeriveDisplayOrder, + ]); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_usage_error!("{}", f); - return 1; - } - }; + let clap_matches = clap_opts + .clone() // Clone to reuse clap_otps to print help + .get_matches_from(args.clone()); - if matches.opt_present("help") { - println!("{}", opts.usage(&USAGE)); - return 0; - } - if matches.opt_present("version") { + if clap_matches.is_present(options::VERSION) { println!("{} {}", executable!(), VERSION); return 0; } - let od_options = match OdOptions::new(matches, args) { + let od_options = match OdOptions::new(clap_matches, args) { Err(s) => { show_usage_error!("{}", s); return 1; diff --git a/src/uu/od/src/parse_inputs.rs b/src/uu/od/src/parse_inputs.rs index 89a833d94..915aa1d92 100644 --- a/src/uu/od/src/parse_inputs.rs +++ b/src/uu/od/src/parse_inputs.rs @@ -1,20 +1,24 @@ -use getopts::Matches; +use super::options; +use clap::ArgMatches; /// Abstraction for getopts pub trait CommandLineOpts { /// returns all command line parameters which do not belong to an option. - fn inputs(&self) -> Vec; + fn inputs(&self) -> Vec<&str>; /// tests if any of the specified options is present. fn opts_present(&self, _: &[&str]) -> bool; } /// Implementation for `getopts` -impl CommandLineOpts for Matches { - fn inputs(&self) -> Vec { - self.free.clone() +impl<'a> CommandLineOpts for ArgMatches<'a> { + fn inputs(&self) -> Vec<&str> { + self.values_of(options::FILENAME) + .map(|values| values.collect()) + .unwrap_or_default() } + fn opts_present(&self, opts: &[&str]) -> bool { - self.opts_present(&opts.iter().map(|s| (*s).to_string()).collect::>()) + opts.iter().any(|opt| self.is_present(opt)) } } @@ -39,7 +43,7 @@ pub enum CommandLineInputs { /// '-' is used as filename if stdin is meant. This is also returned if /// there is no input, as stdin is the default input. pub fn parse_inputs(matches: &dyn CommandLineOpts) -> Result { - let mut input_strings: Vec = matches.inputs(); + let mut input_strings = matches.inputs(); if matches.opts_present(&["traditional"]) { return parse_inputs_traditional(input_strings); @@ -59,7 +63,7 @@ pub fn parse_inputs(matches: &dyn CommandLineOpts) -> Result Result) -> Result { +pub fn parse_inputs_traditional(input_strings: Vec<&str>) -> Result { match input_strings.len() { 0 => Ok(CommandLineInputs::FileNames(vec!["-".to_string()])), 1 => { let offset0 = parse_offset_operand(&input_strings[0]); Ok(match offset0 { Ok(n) => CommandLineInputs::FileAndOffset(("-".to_string(), n, None)), - _ => CommandLineInputs::FileNames(input_strings), + _ => CommandLineInputs::FileNames( + input_strings.iter().map(|s| s.to_string()).collect(), + ), }) } 2 => { @@ -98,7 +106,7 @@ pub fn parse_inputs_traditional(input_strings: Vec) -> Result Ok(CommandLineInputs::FileAndOffset(( - input_strings[0].clone(), + input_strings[0].clone().to_owned(), m, None, ))), @@ -110,7 +118,7 @@ pub fn parse_inputs_traditional(input_strings: Vec) -> Result Ok(CommandLineInputs::FileAndOffset(( - input_strings[0].clone(), + input_strings[0].clone().to_owned(), n, Some(m), ))), @@ -178,8 +186,8 @@ mod tests { } impl<'a> CommandLineOpts for MockOptions<'a> { - fn inputs(&self) -> Vec { - self.inputs.clone() + fn inputs(&self) -> Vec<&str> { + self.inputs.iter().map(|s| s.as_str()).collect() } fn opts_present(&self, opts: &[&str]) -> bool { for expected in opts.iter() { From 734368bc92e8f4093bf109a60c126b61f8bac499 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 21 Mar 2021 17:03:58 +0100 Subject: [PATCH 474/606] refresh cargo.lock with recent updates --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index ad207edd3..e5852987e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1410,7 +1410,7 @@ dependencies = [ name = "uu_chroot" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", ] From 6c9841534020eacc62aee5e450f57d1439db295e Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Sun, 21 Mar 2021 23:27:44 +0300 Subject: [PATCH 475/606] fix(head): check the whether file exists before unwrap (#1858) closes https://github.com/uutils/coreutils/issues/1800 --- src/uu/head/src/head.rs | 7 +++++++ tests/by-util/test_head.rs | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index ae5807c22..0036dbba9 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -149,6 +149,13 @@ pub fn uumain(args: impl uucore::Args) -> i32 { first_time = false; let path = Path::new(file); + if path.is_dir() || !path.metadata().is_ok() { + eprintln!( + "cannot open '{}' for reading: No such file or directory", + &path.to_str().unwrap() + ); + continue; + } let reader = File::open(&path).unwrap(); let mut buffer = BufReader::new(reader); if !head(&mut buffer, &settings) { diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index eec82b51f..a1086c004 100644 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -167,3 +167,15 @@ fn test_bug_in_negative_zero_lines() { //GNU Head returns "a\nb\n" .stdout_is(""); } + +#[test] +fn test_no_such_file_or_directory() { + let result = new_ucmd!().arg("no_such_file.toml").run(); + + assert_eq!( + true, + result + .stderr + .contains("cannot open 'no_such_file.toml' for reading: No such file or directory") + ) +} From 40677bdc7a367b85dc0b0a40fb2f52a776ecda6f Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Mar 2021 20:49:15 +0000 Subject: [PATCH 476/606] Fix more problems with utils that aren't being tested --- .github/workflows/GNU.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 59ce82420..5b8742b6b 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -84,14 +84,20 @@ jobs: sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh sed -i 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh tests/du/8gb.sh sed -i 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i 's|timeout |/usr/bin/timeout |' tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh - sed -i 's| timeout | /usr/bin/timeout |' tests/tail-2/inotify-rotate.sh # Don't break the function called 'grep_timeout' - sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh + sed -i 's|timeout \([[:digit:]]\)| /usr/bin/timeout \1|' tests/tail-2/inotify-rotate.sh tests/tail-2/inotify-dir-recreate.sh tests/tail-2/inotify-rotate-resources.sh tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh tests/tail-2/follow-name.sh + # Don't break the function called 'grep_timeout' + sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/du/inaccessible-cwd.sh tests/mv/i-2.sh sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh sed -i 's|truncate |/usr/bin/truncate |' tests/split/fail.sh - sed -i 's|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh + sed -i 's|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh tests/cp/fiemap-2.sh tests/init.sh sed -i 's|id -|/usr/bin/id -|' tests/misc/runcon-no-reorder.sh + sed -i 's|touch |/usr/bin/touch |' tests/cp/preserve-link.sh tests/cp/reflink-perm.sh tests/ls/block-size.sh tests/ls/abmon-align.sh tests/ls/rt-1.sh tests/mv/update.sh tests/misc/ls-time.sh tests/misc/stat-nanoseconds.sh tests/misc/time-style.sh tests/misc/test-N.sh + sed -i 's|ln -|/usr/bin/ln -|' tests/cp/link-deref.sh + sed -i 's|printf |/usr/bin/printf |' tests/dd/ascii.sh + sed -i 's|cp |/usr/bin/cp |' tests/mv/hard-2.sh + sed -i 's|paste |/usr/bin/paste |' tests/misc/od-endian.sh + sed -i 's|seq |/usr/bin/seq |' tests/misc/sort-discrim.sh #Add specific timeout to tests that currently hang to limit time spent waiting sed -i 's|seq \$|/usr/bin/timeout 0.1 seq \$|' tests/misc/seq-precision.sh tests/misc/seq-long-double.sh From 21be280c5a3f9f13b740db9f5f4e48dd0cb7c207 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 21 Mar 2021 22:21:57 +0100 Subject: [PATCH 477/606] rustfmt the od changes --- src/uu/od/src/od.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 791ddc4fc..c3b39fca1 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -442,7 +442,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg( Arg::with_name(options::FILENAME) .hidden(true) - .multiple(true) + .multiple(true), ) .settings(&[ AppSettings::TrailingVarArg, From 027d5e6d9d848a5f58389db79591b63763d9011f Mon Sep 17 00:00:00 2001 From: James Robson Date: Sun, 21 Mar 2021 22:31:15 +0000 Subject: [PATCH 478/606] Fix yaml syntax --- .github/workflows/GNU.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 5b8742b6b..f89621e3f 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -84,8 +84,7 @@ jobs: sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh sed -i 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh tests/du/8gb.sh sed -i 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i 's|timeout \([[:digit:]]\)| /usr/bin/timeout \1|' tests/tail-2/inotify-rotate.sh tests/tail-2/inotify-dir-recreate.sh tests/tail-2/inotify-rotate-resources.sh tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh tests/tail-2/follow-name.sh - # Don't break the function called 'grep_timeout' + sed -i 's|timeout \([[:digit:]]\)| /usr/bin/timeout \1|' tests/tail-2/inotify-rotate.sh tests/tail-2/inotify-dir-recreate.sh tests/tail-2/inotify-rotate-resources.sh tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh tests/tail-2/follow-name.sh # Don't break the function called 'grep_timeout' sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/du/inaccessible-cwd.sh tests/mv/i-2.sh sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh From 27b7552ef4a8986b0e931718563021ee7270fc22 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Mon, 22 Mar 2021 12:01:54 +0300 Subject: [PATCH 479/606] fix(tail): add support for negative indexing (#1865) closes: https://github.com/uutils/coreutils/issues/1860 --- src/uu/tail/src/tail.rs | 6 ++++-- tests/by-util/test_tail.rs | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index cd391a53e..3a6b04b29 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -80,6 +80,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .short("c") .long(options::BYTES) .takes_value(true) + .allow_hyphen_values(true) .help("Number of bytes to print"), ) .arg( @@ -93,6 +94,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .short("n") .long(options::LINES) .takes_value(true) + .allow_hyphen_values(true) .help("Number of lines to print"), ) .arg( @@ -343,9 +345,9 @@ pub fn parse_size(mut size_slice: &str) -> Result { // sole B is not a valid suffix Err(ParseSizeErr::parse_failure(size_slice)) } else { - let value: Option = size_slice.parse().ok(); + let value: Option = size_slice.parse().ok(); value - .map(|v| Ok(multiplier * v)) + .map(|v| Ok((multiplier as i64 * v.abs()) as u64)) .unwrap_or_else(|| Err(ParseSizeErr::parse_failure(size_slice))) } } diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 458fc6aa7..5edff4d55 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -329,3 +329,17 @@ fn test_multiple_input_quiet_flag_overrides_verbose_flag_for_suppressing_headers .run() .stdout_is_fixture("foobar_multiple_quiet.expected"); } + +#[test] +fn test_negative_indexing() { + let positive_lines_index = new_ucmd!().arg("-n").arg("5").arg(FOOBAR_TXT).run(); + + let negative_lines_index = new_ucmd!().arg("-n").arg("-5").arg(FOOBAR_TXT).run(); + + let positive_bytes_index = new_ucmd!().arg("-c").arg("20").arg(FOOBAR_TXT).run(); + + let negative_bytes_index = new_ucmd!().arg("-c").arg("-20").arg(FOOBAR_TXT).run(); + + assert_eq!(positive_lines_index.stdout, negative_lines_index.stdout); + assert_eq!(positive_bytes_index.stdout, negative_bytes_index.stdout); +} From b9662c78a5c520b8661f7a27227b2331e069d725 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 22 Mar 2021 10:14:59 +0100 Subject: [PATCH 480/606] ls: possible fix for access time tests (#1866) --- tests/by-util/test_ls.rs | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index ac5e0c8b3..4fd35a286 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -344,6 +344,7 @@ fn test_ls_order_time() { sleep(Duration::from_millis(100)); at.touch("test-2"); at.append("test-2", "22"); + sleep(Duration::from_millis(100)); at.touch("test-3"); at.append("test-3", "333"); @@ -361,6 +362,7 @@ fn test_ls_order_time() { at.metadata("test-2").permissions(), ) .unwrap(); + let second_access = at.open("test-2").metadata().unwrap().accessed().unwrap(); let result = scene.ucmd().arg("-al").run(); println!("stderr = {:?}", result.stderr); @@ -392,13 +394,23 @@ fn test_ls_order_time() { println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(result.success); - #[cfg(not(windows))] - assert_eq!(result.stdout, "test-3\ntest-4\ntest-2\ntest-1\n"); - - // Access time does not seem to be set on Windows on read call - // so the order is 4 3 2 1 - #[cfg(windows)] - assert_eq!(result.stdout, "test-4 test-3 test-2 test-1\n"); + let file3_access = at.open("test-3").metadata().unwrap().accessed().unwrap(); + let file4_access = at.open("test-4").metadata().unwrap().accessed().unwrap(); + if file3_access > file4_access { + if cfg!(not(windows)) { + assert_eq!(result.stdout, "test-3\ntest-4\ntest-2\ntest-1\n"); + } else { + assert_eq!(result.stdout, "test-3 test-4 test-2 test-1\n"); + } + } else { + // Access time does not seem to be set on Windows and some other + // systems so the order is 4 3 2 1 + if cfg!(not(windows)) { + assert_eq!(result.stdout, "test-4\ntest-3\ntest-2\ntest-1\n"); + } else { + assert_eq!(result.stdout, "test-4 test-3 test-2 test-1\n"); + } + } // test-2 had the last ctime change when the permissions were set // So the order should be 2 4 3 1 From 93c7cbe65e0d4a189960772a4f4f32c718096e59 Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Mon, 22 Mar 2021 12:13:38 +0200 Subject: [PATCH 481/606] documentation for usual macros - removed repeat_str helper as it's now part of std - added docstrings for usual macros and test utils --- src/uucore/src/lib/macros.rs | 16 ++++++++++++++++ tests/by-util/test_pathchk.rs | 2 +- tests/common/macros.rs | 35 +++++++++++++++++++++++++++++++++++ tests/common/util.rs | 24 ++++++++++++++---------- 4 files changed, 66 insertions(+), 11 deletions(-) diff --git a/src/uucore/src/lib/macros.rs b/src/uucore/src/lib/macros.rs index 0aa6d8f0a..6836f81aa 100644 --- a/src/uucore/src/lib/macros.rs +++ b/src/uucore/src/lib/macros.rs @@ -5,6 +5,9 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +/// Deduce the name of the binary from the current source code filename. +/// +/// e.g.: `src/uu/cp/src/cp.rs` -> `cp` #[macro_export] macro_rules! executable( () => ({ @@ -18,6 +21,7 @@ macro_rules! executable( }) ); +/// Show an error to stderr in a silimar style to GNU coreutils. #[macro_export] macro_rules! show_error( ($($args:tt)+) => ({ @@ -26,6 +30,7 @@ macro_rules! show_error( }) ); +/// Show a warning to stderr in a silimar style to GNU coreutils. #[macro_export] macro_rules! show_warning( ($($args:tt)+) => ({ @@ -34,6 +39,7 @@ macro_rules! show_warning( }) ); +/// Show an info message to stderr in a silimar style to GNU coreutils. #[macro_export] macro_rules! show_info( ($($args:tt)+) => ({ @@ -42,6 +48,7 @@ macro_rules! show_info( }) ); +/// Show a bad inocation help message in a similar style to GNU coreutils. #[macro_export] macro_rules! show_usage_error( ($($args:tt)+) => ({ @@ -51,6 +58,7 @@ macro_rules! show_usage_error( }) ); +/// Display the provided error message, then `exit()` with the provided exit code #[macro_export] macro_rules! crash( ($exit_code:expr, $($args:tt)+) => ({ @@ -59,6 +67,7 @@ macro_rules! crash( }) ); +/// Calls `exit()` with the provided exit code. #[macro_export] macro_rules! exit( ($exit_code:expr) => ({ @@ -66,6 +75,8 @@ macro_rules! exit( }) ); +/// Unwraps the Result. Instead of panicking, it exists the program with the +/// provided exit code. #[macro_export] macro_rules! crash_if_err( ($exit_code:expr, $exp:expr) => ( @@ -76,6 +87,9 @@ macro_rules! crash_if_err( ) ); +/// Unwraps the Result. Instead of panicking, it shows the error and then +/// returns from the function with the provided exit code. +/// Assumes the current function returns an i32 value. #[macro_export] macro_rules! return_if_err( ($exit_code:expr, $exp:expr) => ( @@ -109,6 +123,8 @@ macro_rules! safe_writeln( ) ); +/// Unwraps the Result. Instead of panicking, it exists the program with exit +/// code 1. #[macro_export] macro_rules! safe_unwrap( ($exp:expr) => ( diff --git a/tests/by-util/test_pathchk.rs b/tests/by-util/test_pathchk.rs index bdce377b3..e24a464e0 100644 --- a/tests/by-util/test_pathchk.rs +++ b/tests/by-util/test_pathchk.rs @@ -9,7 +9,7 @@ fn test_default_mode() { // fail on long inputs new_ucmd!() - .args(&[repeat_str("test", 20000)]) + .args(&["test".repeat(20000)]) .fails() .no_stdout(); } diff --git a/tests/common/macros.rs b/tests/common/macros.rs index 645cfcc67..32ff7cbe8 100644 --- a/tests/common/macros.rs +++ b/tests/common/macros.rs @@ -1,3 +1,6 @@ +/// Assertion helper macro for [`CmdResult`] types +/// +/// [`CmdResult`]: crate::tests::common::util::CmdResult #[macro_export] macro_rules! assert_empty_stderr( ($cond:expr) => ( @@ -7,6 +10,9 @@ macro_rules! assert_empty_stderr( ); ); +/// Assertion helper macro for [`CmdResult`] types +/// +/// [`CmdResult`]: crate::tests::common::util::CmdResult #[macro_export] macro_rules! assert_empty_stdout( ($cond:expr) => ( @@ -16,6 +22,9 @@ macro_rules! assert_empty_stdout( ); ); +/// Assertion helper macro for [`CmdResult`] types +/// +/// [`CmdResult`]: crate::tests::common::util::CmdResult #[macro_export] macro_rules! assert_no_error( ($cond:expr) => ( @@ -26,6 +35,7 @@ macro_rules! assert_no_error( ); ); +/// Platform-independent helper for constructing a PathBuf from individual elements #[macro_export] macro_rules! path_concat { ($e:expr, ..$n:expr) => {{ @@ -47,6 +57,9 @@ macro_rules! path_concat { }}; } +/// Deduce the name of the test binary from the test filename. +/// +/// e.g.: `tests/by-util/test_cat.rs` -> `cat` #[macro_export] macro_rules! util_name { () => { @@ -54,6 +67,16 @@ macro_rules! util_name { }; } +/// Convenience macro for acquiring a [`UCommand`] builder. +/// +/// Returns the following: +/// - a [`UCommand`] builder for invoking the binary to be tested +/// +/// This macro is intended for quick, single-call tests. For more complex tests +/// that require multiple invocations of the tested binary, see [`TestScenario`] +/// +/// [`UCommand`]: crate::tests::common::util::UCommand +/// [`TestScenario]: crate::tests::common::util::TestScenario #[macro_export] macro_rules! new_ucmd { () => { @@ -61,6 +84,18 @@ macro_rules! new_ucmd { }; } +/// Convenience macro for acquiring a [`UCommand`] builder and a test path. +/// +/// Returns a tuple containing the following: +/// - an [`AsPath`] that points to a unique temporary test directory +/// - a [`UCommand`] builder for invoking the binary to be tested +/// +/// This macro is intended for quick, single-call tests. For more complex tests +/// that require multiple invocations of the tested binary, see [`TestScenario`] +/// +/// [`UCommand`]: crate::tests::common::util::UCommand +/// [`AsPath`]: crate::tests::common::util::AsPath +/// [`TestScenario]: crate::tests::common::util::TestScenario #[macro_export] macro_rules! at_and_ucmd { () => {{ diff --git a/tests/common/util.rs b/tests/common/util.rs index 0f1acd49a..a2fab66c6 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + use std::env; use std::ffi::OsStr; use std::fs::{self, File, OpenOptions}; @@ -27,7 +29,7 @@ static ALREADY_RUN: &str = " you have already run this UCommand, if you want to testing();"; static MULTIPLE_STDIN_MEANINGLESS: &str = "Ucommand is designed around a typical use case of: provide args and input stream -> spawn process -> block until completion -> return output streams. For verifying that a particular section of the input stream is what causes a particular behavior, use the Command type directly."; -/// Test if the program are running under CI +/// Test if the program is running under CI pub fn is_ci() -> bool { std::env::var("CI") .unwrap_or(String::from("false")) @@ -55,14 +57,6 @@ fn read_scenario_fixture>(tmpd: &Option>, file_rel_p AtPath::new(tmpdir_path).read(file_rel_path.as_ref().to_str().unwrap()) } -pub fn repeat_str(s: &str, n: u32) -> String { - let mut repeated = String::new(); - for _ in 0..n { - repeated.push_str(s); - } - repeated -} - /// A command result is the outputs of a command (streams and status code) /// within a struct which has convenience assertion functions about those outputs #[derive(Debug)] @@ -384,8 +378,10 @@ impl AtPath { /// An environment for running a single uutils test case, serves three functions: /// 1. centralizes logic for locating the uutils binary and calling the utility -/// 2. provides a temporary directory for the test case +/// 2. provides a unique temporary directory for the test case /// 3. copies over fixtures for the utility to the temporary directory +/// +/// Fixtures can be found under `tests/fixtures/$util_name/` pub struct TestScenario { bin_path: PathBuf, util_name: String, @@ -420,12 +416,16 @@ impl TestScenario { ts } + /// Returns builder for invoking the target uutils binary. Paths given are + /// treated relative to the environment's unique temporary test directory. pub fn ucmd(&self) -> UCommand { let mut cmd = self.cmd(&self.bin_path); cmd.arg(&self.util_name); cmd } + /// Returns builder for invoking any system command. Paths given are treated + /// relative to the environment's unique temporary test directory. pub fn cmd>(&self, bin: S) -> UCommand { UCommand::new_from_tmp(bin, self.tmpd.clone(), true) } @@ -495,6 +495,8 @@ impl UCommand { ucmd } + /// Add a parameter to the invocation. Path arguments are treated relative + /// to the test environment directory. pub fn arg>(&mut self, arg: S) -> Box<&mut UCommand> { if self.has_run { panic!(ALREADY_RUN); @@ -505,6 +507,8 @@ impl UCommand { Box::new(self) } + /// Add multiple parameters to the invocation. Path arguments are treated relative + /// to the test environment directory. pub fn args>(&mut self, args: &[S]) -> Box<&mut UCommand> { if self.has_run { panic!(MULTIPLE_STDIN_MEANINGLESS); From d86ee34bc60846650aa1ca5e0179e31a8fd923f3 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Mon, 22 Mar 2021 20:16:28 +0300 Subject: [PATCH 482/606] tsort: move from getopts to clap (#1867) --- src/uu/tsort/Cargo.toml | 2 +- src/uu/tsort/src/tsort.rs | 50 +++++++++++++------------------------ tests/by-util/test_tsort.rs | 33 ++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 33 deletions(-) diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index 10672a9e0..d870e0155 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/tsort.rs" [dependencies] -getopts = "0.2.18" +clap= "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/tsort/src/tsort.rs b/src/uu/tsort/src/tsort.rs index 0a0023031..3440972a2 100644 --- a/src/uu/tsort/src/tsort.rs +++ b/src/uu/tsort/src/tsort.rs @@ -9,49 +9,35 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::collections::{HashMap, HashSet}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::path::Path; -static NAME: &str = "tsort"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static SUMMARY: &str = "Topological sort the strings in FILE. +Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline). +If FILE is not passed in, stdin is used instead."; +static USAGE: &str = "tsort [OPTIONS] FILE"; + +mod options { + pub const FILE: &str = "file"; +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .usage(USAGE) + .about(SUMMARY) + .arg(Arg::with_name(options::FILE).hidden(true)) + .get_matches_from(args); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f), - }; - - if matches.opt_present("h") { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage:"); - println!(" {} [OPTIONS] FILE", NAME); - println!(); - println!("{}", opts.usage("Topological sort the strings in FILE. Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline). If FILE is not passed in, stdin is used instead.")); - return 0; - } - - if matches.opt_present("V") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let files = matches.free.clone(); - let input = if files.len() > 1 { - crash!(1, "{}, extra operand '{}'", NAME, matches.free[1]); - } else if files.is_empty() { - "-".to_owned() - } else { - files[0].clone() + let input = match matches.value_of(options::FILE) { + Some(v) => v, + None => "-", }; let mut stdin_buf; diff --git a/tests/by-util/test_tsort.rs b/tests/by-util/test_tsort.rs index c743868ec..159b80025 100644 --- a/tests/by-util/test_tsort.rs +++ b/tests/by-util/test_tsort.rs @@ -15,3 +15,36 @@ fn test_sort_self_loop() { .succeeds() .stdout_only("first\nsecond\n"); } + +#[test] +fn test_no_such_file() { + let result = new_ucmd!().arg("invalid_file_txt").run(); + + assert_eq!(true, result.stderr.contains("No such file or directory")); +} + +#[test] +fn test_version_flag() { + let version_short = new_ucmd!().arg("-V").run(); + let version_long = new_ucmd!().arg("--version").run(); + + assert_eq!(version_short.stdout, version_long.stdout); +} + +#[test] +fn test_help_flag() { + let help_short = new_ucmd!().arg("-h").run(); + let help_long = new_ucmd!().arg("--help").run(); + + assert_eq!(help_short.stdout, help_long.stdout); +} + +#[test] +fn test_multiple_arguments() { + let result = new_ucmd!() + .arg("call_graph.txt") + .arg("invalid_file.txt") + .run(); + + assert_eq!(true, result.stderr.contains("error: Found argument 'invalid_file.txt' which wasn't expected, or isn't valid in this context")) +} From de3f9b8186c2d4cc48c83c94ed06ca53a3950236 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 22 Mar 2021 18:24:23 +0100 Subject: [PATCH 483/606] ls: across & commas formats and width parameter (#1869) --- src/uu/ls/src/ls.rs | 160 +++++++++++++++++++++++++++--------- tests/by-util/test_ls.rs | 172 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 290 insertions(+), 42 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index a935eef54..455b4f7b6 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -15,7 +15,6 @@ extern crate uucore; use clap::{App, Arg}; use number_prefix::NumberPrefix; -use std::cmp::Reverse; #[cfg(unix)] use std::collections::HashMap; use std::fs; @@ -30,6 +29,7 @@ use std::path::{Path, PathBuf}; #[cfg(unix)] use std::time::Duration; use std::time::{SystemTime, UNIX_EPOCH}; +use std::{cmp::Reverse, process::exit}; use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use time::{strftime, Timespec}; @@ -78,6 +78,8 @@ pub mod options { pub static ONELINE: &str = "1"; pub static LONG: &str = "long"; pub static COLUMNS: &str = "C"; + pub static ACROSS: &str = "x"; + pub static COMMAS: &str = "m"; pub static LONG_NO_OWNER: &str = "g"; pub static LONG_NO_GROUP: &str = "o"; } @@ -98,6 +100,7 @@ pub mod options { pub static HUMAN_READABLE: &str = "human-readable"; pub static SI: &str = "si"; } + pub static WIDTH: &str = "width"; pub static AUTHOR: &str = "author"; pub static NO_GROUP: &str = "no-group"; pub static FORMAT: &str = "format"; @@ -120,6 +123,8 @@ enum Format { Columns, Long, OneLine, + Across, + Commas, } enum Sort { @@ -166,6 +171,7 @@ struct Config { #[cfg(unix)] color: bool, long: LongFormat, + width: Option, } // Fields that can be removed or added to the long format @@ -183,6 +189,8 @@ impl Config { "long" | "verbose" => Format::Long, "single-column" => Format::OneLine, "columns" | "vertical" => Format::Columns, + "across" | "horizontal" => Format::Across, + "commas" => Format::Commas, // below should never happen as clap already restricts the values. _ => unreachable!("Invalid field for --format"), }, @@ -190,6 +198,10 @@ impl Config { ) } else if options.is_present(options::format::LONG) { (Format::Long, options::format::LONG) + } else if options.is_present(options::format::ACROSS) { + (Format::Across, options::format::ACROSS) + } else if options.is_present(options::format::COMMAS) { + (Format::Commas, options::format::COMMAS) } else { (Format::Columns, options::format::COLUMNS) }; @@ -316,6 +328,16 @@ impl Config { } }; + let width = options + .value_of(options::WIDTH) + .map(|x| { + x.parse::().unwrap_or_else(|_e| { + show_error!("invalid line width: ‘{}’", x); + exit(2); + }) + }) + .or_else(|| termsize::get().map(|s| s.cols)); + Config { format, files, @@ -334,6 +356,7 @@ impl Config { #[cfg(unix)] inode: options.is_present(options::INODE), long, + width, } } } @@ -354,13 +377,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::FORMAT) .help("Set the display format.") .takes_value(true) - .possible_values(&["long", "verbose", "single-column", "columns"]) + .possible_values(&["long", "verbose", "single-column", "columns", "vertical", "across", "horizontal", "commas"]) .hide_possible_values(true) .require_equals(true) .overrides_with_all(&[ options::FORMAT, options::format::COLUMNS, options::format::LONG, + options::format::ACROSS, + options::format::COLUMNS, ]), ) .arg( @@ -371,6 +396,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::FORMAT, options::format::COLUMNS, options::format::LONG, + options::format::ACROSS, + options::format::COLUMNS, ]), ) .arg( @@ -381,8 +408,33 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .overrides_with_all(&[ options::FORMAT, options::format::COLUMNS, - options::format::ONELINE, options::format::LONG, + options::format::ACROSS, + options::format::COLUMNS, + ]), + ) + .arg( + Arg::with_name(options::format::ACROSS) + .short(options::format::ACROSS) + .help("List entries in rows instead of in columns.") + .overrides_with_all(&[ + options::FORMAT, + options::format::COLUMNS, + options::format::LONG, + options::format::ACROSS, + options::format::COLUMNS, + ]), + ) + .arg( + Arg::with_name(options::format::COMMAS) + .short(options::format::COMMAS) + .help("List entries separated by commas.") + .overrides_with_all(&[ + options::FORMAT, + options::format::COLUMNS, + options::format::LONG, + options::format::ACROSS, + options::format::COLUMNS, ]), ) // The next three arguments do not override with the other format @@ -601,6 +653,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::RECURSIVE) .help("List the contents of all directories recursively."), ) + .arg( + Arg::with_name(options::WIDTH) + .long(options::WIDTH) + .short("w") + .help("Assume that the terminal is COLS columns wide.") + .value_name("COLS") + .takes_value(true) + ) .arg( Arg::with_name(options::COLOR) .long(options::COLOR) @@ -779,47 +839,71 @@ fn display_items(items: &[PathBuf], strip: Option<&Path>, config: &Config) { display_item_long(item, strip, max_links, max_size, config); } } else { - if config.format != Format::OneLine { - let names = items.iter().filter_map(|i| { - let md = get_metadata(i, config); - match md { - Err(e) => { - let filename = get_file_name(i, strip); - show_error!("'{}': {}", filename, e); - None - } - Ok(md) => Some(display_file_name(&i, strip, &md, config)), - } - }); - - if let Some(size) = termsize::get() { - let mut grid = Grid::new(GridOptions { - filling: Filling::Spaces(2), - direction: Direction::TopToBottom, - }); - - for name in names { - grid.add(name); - } - - if let Some(output) = grid.fit_into_width(size.cols as usize) { - print!("{}", output); - return; - } - } - } - - // Couldn't display a grid, either because we don't know - // the terminal width or because fit_into_width failed - for i in items { + let names = items.iter().filter_map(|i| { let md = get_metadata(i, config); - if let Ok(md) = md { - println!("{}", display_file_name(&i, strip, &md, config).contents); + match md { + Err(e) => { + let filename = get_file_name(i, strip); + show_error!("'{}': {}", filename, e); + None + } + Ok(md) => Some(display_file_name(&i, strip, &md, config)), + } + }); + + match (&config.format, config.width) { + (Format::Columns, Some(width)) => display_grid(names, width, Direction::TopToBottom), + (Format::Across, Some(width)) => display_grid(names, width, Direction::LeftToRight), + (Format::Commas, width_opt) => { + let term_width = width_opt.unwrap_or(1); + let mut current_col = 0; + let mut names = names; + if let Some(name) = names.next() { + print!("{}", name.contents); + current_col = name.width as u16 + 2; + } + for name in names { + let name_width = name.width as u16; + if current_col + name_width + 1 > term_width { + current_col = name_width + 2; + print!(",\n{}", name.contents); + } else { + current_col += name_width + 2; + print!(", {}", name.contents); + } + } + // Current col is never zero again if names have been printed. + // So we print a newline. + if current_col > 0 { + println!(); + } + } + _ => { + for name in names { + println!("{}", name.contents); + } } } } } +fn display_grid(names: impl Iterator, width: u16, direction: Direction) { + let mut grid = Grid::new(GridOptions { + filling: Filling::Spaces(2), + direction, + }); + + for name in names { + grid.add(name); + } + + match grid.fit_into_width(width as usize) { + Some(output) => print!("{}", output), + // Width is too small for the grid, so we fit it in one column + None => print!("{}", grid.fit_into_columns(1)), + } +} + use uucore::fs::display_permissions; fn display_item_long( diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 4fd35a286..ecd288735 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -57,12 +57,72 @@ fn test_ls_a() { assert!(!result.stdout.contains("..")); } +#[test] +fn test_ls_width() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch(&at.plus_as_string("test-width-1")); + at.touch(&at.plus_as_string("test-width-2")); + at.touch(&at.plus_as_string("test-width-3")); + at.touch(&at.plus_as_string("test-width-4")); + + for option in &["-w 100", "-w=100", "--width=100", "--width 100"] { + let result = scene + .ucmd() + .args(&option.split(" ").collect::>()) + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!( + result.stdout, + "test-width-1 test-width-2 test-width-3 test-width-4\n", + ) + } + + for option in &["-w 50", "-w=50", "--width=50", "--width 50"] { + let result = scene + .ucmd() + .args(&option.split(" ").collect::>()) + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!( + result.stdout, + "test-width-1 test-width-3\ntest-width-2 test-width-4\n", + ) + } + + for option in &[ + "-w 25", + "-w=25", + "--width=25", + "--width 25", + "-w 0", + "-w=0", + "--width=0", + "--width 0", + ] { + let result = scene + .ucmd() + .args(&option.split(" ").collect::>()) + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!( + result.stdout, + "test-width-1\ntest-width-2\ntest-width-3\ntest-width-4\n", + ) + } +} + #[test] fn test_ls_columns() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.touch(&at.plus_as_string("test-columns-1")); at.touch(&at.plus_as_string("test-columns-2")); + at.touch(&at.plus_as_string("test-columns-3")); + at.touch(&at.plus_as_string("test-columns-4")); // Columns is the default let result = scene.ucmd().run(); @@ -71,9 +131,15 @@ fn test_ls_columns() { assert!(result.success); #[cfg(not(windows))] - assert_eq!(result.stdout, "test-columns-1\ntest-columns-2\n"); + assert_eq!( + result.stdout, + "test-columns-1\ntest-columns-2\ntest-columns-3\ntest-columns-4\n" + ); #[cfg(windows)] - assert_eq!(result.stdout, "test-columns-1 test-columns-2\n"); + assert_eq!( + result.stdout, + "test-columns-1 test-columns-2 test-columns-3 test-columns-4\n" + ); for option in &["-C", "--format=columns"] { let result = scene.ucmd().arg(option).run(); @@ -81,9 +147,107 @@ fn test_ls_columns() { println!("stdout = {:?}", result.stdout); assert!(result.success); #[cfg(not(windows))] - assert_eq!(result.stdout, "test-columns-1\ntest-columns-2\n"); + assert_eq!( + result.stdout, + "test-columns-1\ntest-columns-2\ntest-columns-3\ntest-columns-4\n" + ); #[cfg(windows)] - assert_eq!(result.stdout, "test-columns-1 test-columns-2\n"); + assert_eq!( + result.stdout, + "test-columns-1 test-columns-2 test-columns-3 test-columns-4\n" + ); + } + + for option in &["-C", "--format=columns"] { + let result = scene.ucmd().arg("-w=40").arg(option).run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(result.success); + assert_eq!( + result.stdout, + "test-columns-1 test-columns-3\ntest-columns-2 test-columns-4\n" + ); + } +} + +#[test] +fn test_ls_across() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch(&at.plus_as_string("test-across-1")); + at.touch(&at.plus_as_string("test-across-2")); + at.touch(&at.plus_as_string("test-across-3")); + at.touch(&at.plus_as_string("test-across-4")); + + for option in &["-x", "--format=across"] { + let result = scene.ucmd().arg(option).succeeds(); + // Because the test terminal has width 0, this is the same output as + // the columns option. + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + if cfg!(unix) { + assert_eq!( + result.stdout, + "test-across-1\ntest-across-2\ntest-across-3\ntest-across-4\n" + ); + } else { + assert_eq!( + result.stdout, + "test-across-1 test-across-2 test-across-3 test-across-4\n" + ); + } + } + + for option in &["-x", "--format=across"] { + let result = scene.ucmd().arg("-w=30").arg(option).run(); + // Because the test terminal has width 0, this is the same output as + // the columns option. + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!( + result.stdout, + "test-across-1 test-across-2\ntest-across-3 test-across-4\n" + ); + } +} + +#[test] +fn test_ls_commas() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.touch(&at.plus_as_string("test-commas-1")); + at.touch(&at.plus_as_string("test-commas-2")); + at.touch(&at.plus_as_string("test-commas-3")); + at.touch(&at.plus_as_string("test-commas-4")); + + for option in &["-m", "--format=commas"] { + let result = scene.ucmd().arg(option).succeeds(); + if cfg!(unix) { + assert_eq!( + result.stdout, + "test-commas-1,\ntest-commas-2,\ntest-commas-3,\ntest-commas-4\n" + ); + } else { + assert_eq!( + result.stdout, + "test-commas-1, test-commas-2, test-commas-3, test-commas-4\n" + ); + } + } + + for option in &["-m", "--format=commas"] { + let result = scene.ucmd().arg("-w=30").arg(option).succeeds(); + assert_eq!( + result.stdout, + "test-commas-1, test-commas-2,\ntest-commas-3, test-commas-4\n" + ); + } + for option in &["-m", "--format=commas"] { + let result = scene.ucmd().arg("-w=45").arg(option).succeeds(); + assert_eq!( + result.stdout, + "test-commas-1, test-commas-2, test-commas-3,\ntest-commas-4\n" + ); } } From 56da6b4a2c656e387ebd9d98ffae74e82068c7c9 Mon Sep 17 00:00:00 2001 From: James Robson Date: Mon, 22 Mar 2021 17:48:12 +0000 Subject: [PATCH 484/606] Fix test setup --- .github/workflows/GNU.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index f89621e3f..9eb5da2b9 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -81,15 +81,15 @@ jobs: Makefile # Use the system coreutils where the test fails due to error in a util that is not the one being tested - sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh tests/touch/60-seconds.sh + sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh sed -i 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh tests/du/8gb.sh sed -i 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh sed -i 's|timeout \([[:digit:]]\)| /usr/bin/timeout \1|' tests/tail-2/inotify-rotate.sh tests/tail-2/inotify-dir-recreate.sh tests/tail-2/inotify-rotate-resources.sh tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh tests/tail-2/follow-name.sh # Don't break the function called 'grep_timeout' - sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/du/inaccessible-cwd.sh tests/mv/i-2.sh + sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/du/inaccessible-cwd.sh tests/mv/i-2.sh tests/chgrp/basic.sh sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh sed -i 's|truncate |/usr/bin/truncate |' tests/split/fail.sh - sed -i 's|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh tests/cp/fiemap-2.sh tests/init.sh + sed -i 's|dd |/usr/bin/dd |' tests/du/8gb.sh tests/tail-2/big-4gb.sh tests/cp/fiemap-2.sh init.cfg sed -i 's|id -|/usr/bin/id -|' tests/misc/runcon-no-reorder.sh sed -i 's|touch |/usr/bin/touch |' tests/cp/preserve-link.sh tests/cp/reflink-perm.sh tests/ls/block-size.sh tests/ls/abmon-align.sh tests/ls/rt-1.sh tests/mv/update.sh tests/misc/ls-time.sh tests/misc/stat-nanoseconds.sh tests/misc/time-style.sh tests/misc/test-N.sh sed -i 's|ln -|/usr/bin/ln -|' tests/cp/link-deref.sh From 20dec4cbba9ee3153f517d7b444c0fe8ac8aa558 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Mon, 22 Mar 2021 22:08:07 +0300 Subject: [PATCH 485/606] fix: fix clippy warnings (#1876) --- src/uu/expr/src/syntax_tree.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/uu/expr/src/syntax_tree.rs b/src/uu/expr/src/syntax_tree.rs index d56bab4fc..3381c29bd 100644 --- a/src/uu/expr/src/syntax_tree.rs +++ b/src/uu/expr/src/syntax_tree.rs @@ -148,11 +148,11 @@ impl ASTNode { |a: &String, b: &String| Ok(bool_as_string(a >= b)), &operand_values, ), - "|" => infix_operator_or(&operand_values), - "&" => infix_operator_and(&operand_values), + "|" => Ok(infix_operator_or(&operand_values)), + "&" => Ok(infix_operator_and(&operand_values)), ":" | "match" => operator_match(&operand_values), - "length" => prefix_operator_length(&operand_values), - "index" => prefix_operator_index(&operand_values), + "length" => Ok(prefix_operator_length(&operand_values)), + "index" => Ok(prefix_operator_index(&operand_values)), "substr" => prefix_operator_substr(&operand_values), _ => Err(format!("operation not implemented: {}", op_type)), @@ -465,20 +465,20 @@ where } } -fn infix_operator_or(values: &[String]) -> Result { +fn infix_operator_or(values: &[String]) -> String { assert!(values.len() == 2); if value_as_bool(&values[0]) { - Ok(values[0].clone()) + values[0].clone() } else { - Ok(values[1].clone()) + values[1].clone() } } -fn infix_operator_and(values: &[String]) -> Result { +fn infix_operator_and(values: &[String]) -> String { if value_as_bool(&values[0]) && value_as_bool(&values[1]) { - Ok(values[0].clone()) + values[0].clone() } else { - Ok(0.to_string()) + 0.to_string() } } @@ -502,12 +502,12 @@ fn operator_match(values: &[String]) -> Result { } } -fn prefix_operator_length(values: &[String]) -> Result { +fn prefix_operator_length(values: &[String]) -> String { assert!(values.len() == 1); - Ok(values[0].len().to_string()) + values[0].len().to_string() } -fn prefix_operator_index(values: &[String]) -> Result { +fn prefix_operator_index(values: &[String]) -> String { assert!(values.len() == 2); let haystack = &values[0]; let needles = &values[1]; @@ -515,11 +515,11 @@ fn prefix_operator_index(values: &[String]) -> Result { for (current_idx, ch_h) in haystack.chars().enumerate() { for ch_n in needles.chars() { if ch_n == ch_h { - return Ok(current_idx.to_string()); + return current_idx.to_string(); } } } - Ok("0".to_string()) + "0".to_string() } fn prefix_operator_substr(values: &[String]) -> Result { From a1b50ae0f43e78424de6ccdfc545a59aa0156d8c Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Mon, 22 Mar 2021 21:09:00 +0200 Subject: [PATCH 486/606] 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 --- src/uu/nohup/Cargo.toml | 2 +- src/uu/nohup/src/nohup.rs | 134 +++++++++++++++++++----------------- tests/by-util/test_nohup.rs | 20 +++++- 3 files changed, 90 insertions(+), 66 deletions(-) diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index 0c5709a65..e9b6f8bd4 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/nohup.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/nohup/src/nohup.rs b/src/uu/nohup/src/nohup.rs index 5fce208da..afbf2541b 100644 --- a/src/uu/nohup/src/nohup.rs +++ b/src/uu/nohup/src/nohup.rs @@ -10,6 +10,7 @@ #[macro_use] extern crate uucore; +use clap::{App, AppSettings, Arg}; use libc::{c_char, dup2, execvp, signal}; use libc::{SIGHUP, SIG_IGN}; use std::env; @@ -20,50 +21,42 @@ use std::os::unix::prelude::*; use std::path::{Path, PathBuf}; use uucore::fs::{is_stderr_interactive, is_stdin_interactive, is_stdout_interactive}; -static NAME: &str = "nohup"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Run COMMAND ignoring hangup signals."; +static LONG_HELP: &str = " +If standard input is terminal, it'll be replaced with /dev/null. +If standard output is terminal, it'll be appended to nohup.out instead, +or $HOME/nohup.out, if nohup.out open failed. +If standard error is terminal, it'll be redirected to stdout. +"; +static NOHUP_OUT: &str = "nohup.out"; +// exit codes that match the GNU implementation +static EXIT_CANCELED: i32 = 125; +static EXIT_CANNOT_INVOKE: i32 = 126; +static EXIT_ENOENT: i32 = 127; +static POSIX_NOHUP_FAILURE: i32 = 127; -#[cfg(target_vendor = "apple")] -extern "C" { - fn _vprocmgr_detach_from_console(flags: u32) -> *const libc::c_int; -} - -#[cfg(any(target_os = "linux", target_os = "freebsd"))] -unsafe fn _vprocmgr_detach_from_console(_: u32) -> *const libc::c_int { - std::ptr::null() +mod options { + pub const CMD: &str = "cmd"; } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::CMD) + .hidden(true) + .required(true) + .multiple(true), + ) + .setting(AppSettings::TrailingVarArg) + .get_matches_from(args); - opts.optflag("h", "help", "Show help and exit"); - opts.optflag("V", "version", "Show version and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - show_usage(&opts); - return 1; - } - }; - - if matches.opt_present("V") { - println!("{} {}", NAME, VERSION); - return 0; - } - if matches.opt_present("h") { - show_usage(&opts); - return 0; - } - - if matches.free.is_empty() { - show_error!("Missing operand: COMMAND"); - println!("Try `{} --help` for more information.", NAME); - return 1; - } replace_fds(); unsafe { signal(SIGHUP, SIG_IGN) }; @@ -73,13 +66,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }; let cstrs: Vec = matches - .free - .iter() + .values_of(options::CMD) + .unwrap() .map(|x| CString::new(x.as_bytes()).unwrap()) .collect(); let mut args: Vec<*const c_char> = cstrs.iter().map(|s| s.as_ptr()).collect(); args.push(std::ptr::null()); - unsafe { execvp(args[0], args.as_mut_ptr()) } + + let ret = unsafe { execvp(args[0], args.as_mut_ptr()) }; + match ret { + libc::ENOENT => EXIT_ENOENT, + _ => EXIT_CANNOT_INVOKE, + } } fn replace_fds() { @@ -108,23 +106,32 @@ fn replace_fds() { } fn find_stdout() -> File { + let internal_failure_code = match std::env::var("POSIXLY_CORRECT") { + Ok(_) => POSIX_NOHUP_FAILURE, + Err(_) => EXIT_CANCELED, + }; + match OpenOptions::new() .write(true) .create(true) .append(true) - .open(Path::new("nohup.out")) + .open(Path::new(NOHUP_OUT)) { Ok(t) => { - show_warning!("Output is redirected to: nohup.out"); + show_info!("ignoring input and appending output to '{}'", NOHUP_OUT); t } - Err(e) => { + Err(e1) => { let home = match env::var("HOME") { - Err(_) => crash!(2, "Cannot replace STDOUT: {}", e), + Err(_) => { + show_info!("failed to open '{}': {}", NOHUP_OUT, e1); + exit!(internal_failure_code) + } Ok(h) => h, }; let mut homeout = PathBuf::from(home); - homeout.push("nohup.out"); + homeout.push(NOHUP_OUT); + let homeout_str = homeout.to_str().unwrap(); match OpenOptions::new() .write(true) .create(true) @@ -132,30 +139,29 @@ fn find_stdout() -> File { .open(&homeout) { Ok(t) => { - show_warning!("Output is redirected to: {:?}", homeout); + show_info!("ignoring input and appending output to '{}'", homeout_str); t } - Err(e) => crash!(2, "Cannot replace STDOUT: {}", e), + Err(e2) => { + show_info!("failed to open '{}': {}", NOHUP_OUT, e1); + show_info!("failed to open '{}': {}", homeout_str, e2); + exit!(internal_failure_code) + } } } } } -fn show_usage(opts: &getopts::Options) { - let msg = format!( - "{0} {1} - -Usage: - {0} COMMAND [ARG]... - {0} OPTION - -Run COMMAND ignoring hangup signals. -If standard input is terminal, it'll be replaced with /dev/null. -If standard output is terminal, it'll be appended to nohup.out instead, -or $HOME/nohup.out, if nohup.out open failed. -If standard error is terminal, it'll be redirected to stdout.", - NAME, VERSION - ); - - print!("{}", opts.usage(&msg)); +fn get_usage() -> String { + format!("{0} COMMAND [ARG]...\n {0} FLAG", executable!()) +} + +#[cfg(target_vendor = "apple")] +extern "C" { + fn _vprocmgr_detach_from_console(flags: u32) -> *const libc::c_int; +} + +#[cfg(any(target_os = "linux", target_os = "freebsd"))] +unsafe fn _vprocmgr_detach_from_console(_: u32) -> *const libc::c_int { + std::ptr::null() } diff --git a/tests/by-util/test_nohup.rs b/tests/by-util/test_nohup.rs index 651491045..b98ae007c 100644 --- a/tests/by-util/test_nohup.rs +++ b/tests/by-util/test_nohup.rs @@ -1 +1,19 @@ -// ToDO: add tests +use crate::common::util::*; +use std::thread::sleep; + +// General observation: nohup.out will not be created in tests run by cargo test +// because stdin/stdout is not attached to a TTY. +// All that can be tested is the side-effects. + +#[test] +#[cfg(any(target_os = "linux", target_os = "freebsd", target_vendor = "apple"))] +fn test_nohup_multiple_args_and_flags() { + let (at, mut ucmd) = at_and_ucmd!(); + + ucmd.args(&["touch", "-t", "1006161200", "file1", "file2"]) + .succeeds(); + sleep(std::time::Duration::from_millis(10)); + + assert!(at.file_exists("file1")); + assert!(at.file_exists("file2")); +} From e5ef7486d5be004324dc26239fbf520d4f3bc6b2 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Tue, 23 Mar 2021 00:42:14 +0300 Subject: [PATCH 487/606] feat: move echo to clap (#1884) --- src/uu/echo/Cargo.toml | 1 + src/uu/echo/src/echo.rs | 50 ++++++++++++++++++++++++++++++++--------- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index a8742b68f..7b831fcb8 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/echo.rs" [dependencies] +clap = "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index 93c395391..7dfdf3113 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -9,10 +9,13 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::io::{self, Write}; use std::iter::Peekable; use std::str::Chars; +static VERSION: &str = env!("CARGO_PKG_VERSION"); +const NAME: &str = "echo"; const SYNTAX: &str = "[OPTIONS]... [STRING]..."; const SUMMARY: &str = "display a line of text"; const HELP: &str = r#" @@ -33,6 +36,13 @@ const HELP: &str = r#" \\xHH byte with hexadecimal value HH (1 to 2 digits) "#; +mod options { + pub const STRING: &str = "string"; + pub const NEWLINE: &str = "n"; + pub const ENABLE_ESCAPE: &str = "e"; + pub const DISABLE_ESCAPE: &str = "E"; +} + fn parse_code( input: &mut Peekable, base: u32, @@ -105,20 +115,38 @@ fn print_escaped(input: &str, mut output: impl Write) -> io::Result { pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let matches = app!(SYNTAX, SUMMARY, HELP) - .optflag("n", "", "do not output the trailing newline") - .optflag("e", "", "enable interpretation of backslash escapes") - .optflag( - "E", - "", - "disable interpretation of backslash escapes (default)", + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(SYNTAX) + .about(SUMMARY) + .help(HELP) + .arg(Arg::with_name(options::STRING).hidden(true).multiple(true)) + .arg( + Arg::with_name(options::NEWLINE) + .short("n") + .help("do not output the trailing newline"), ) - .parse(args); + .arg( + Arg::with_name(options::ENABLE_ESCAPE) + .short("e") + .help("enable interpretation of backslash escapes"), + ) + .arg( + Arg::with_name(options::DISABLE_ESCAPE) + .short("E") + .help("disable interpretation of backslash escapes (default)"), + ) + .get_matches_from(args); - let no_newline = matches.opt_present("n"); - let escaped = matches.opt_present("e"); + let no_newline = matches.is_present("n"); + let escaped = matches.is_present("e"); + let values: Vec = match matches.values_of(options::STRING) { + Some(v) => v.map(|v| v.to_string()).collect(), + None => vec!["".to_string()], + }; - match execute(no_newline, escaped, matches.free) { + match execute(no_newline, escaped, values) { Ok(_) => 0, Err(f) => { show_error!("{}", f); From 5e2e2e8ab6902cde39c0b5d027c83b9cbcd61553 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Tue, 23 Mar 2021 11:40:05 +0300 Subject: [PATCH 488/606] 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 --- src/uu/echo/src/echo.rs | 5 ++++ tests/by-util/test_echo.rs | 55 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index 7dfdf3113..7c0014229 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -117,6 +117,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .name(NAME) + // TrailingVarArg specifies the final positional argument is a VarArg + // and it doesn't attempts the parse any further args. + // Final argument must have multiple(true) or the usage string equivalent. + .setting(clap::AppSettings::TrailingVarArg) + .setting(clap::AppSettings::AllowLeadingHyphen) .version(VERSION) .usage(SYNTAX) .about(SUMMARY) diff --git a/tests/by-util/test_echo.rs b/tests/by-util/test_echo.rs index 2d073d60b..7394ffc1e 100644 --- a/tests/by-util/test_echo.rs +++ b/tests/by-util/test_echo.rs @@ -173,3 +173,58 @@ fn test_disable_escapes() { .succeeds() .stdout_only(format!("{}\n", input_str)); } + +#[test] +fn test_hyphen_value() { + new_ucmd!().arg("-abc").succeeds().stdout_is("-abc\n"); +} + +#[test] +fn test_multiple_hyphen_values() { + new_ucmd!() + .args(&["-abc", "-def", "-edf"]) + .succeeds() + .stdout_is("-abc -def -edf\n"); +} + +#[test] +fn test_hyphen_values_inside_string() { + new_ucmd!() + .arg("'\"\n'CXXFLAGS=-g -O2'\n\"'") + .succeeds() + .stdout + .contains("CXXFLAGS"); +} + +#[test] +fn test_hyphen_values_at_start() { + let result = new_ucmd!() + .arg("-E") + .arg("-test") + .arg("araba") + .arg("-merci") + .run(); + + assert!(result.success); + assert_eq!(false, result.stdout.contains("-E")); + assert_eq!(result.stdout, "-test araba -merci\n"); +} + +#[test] +fn test_hyphen_values_between() { + let result = new_ucmd!().arg("test").arg("-E").arg("araba").run(); + + assert!(result.success); + assert_eq!(result.stdout, "test -E araba\n"); + + let result = new_ucmd!() + .arg("dumdum ") + .arg("dum dum dum") + .arg("-e") + .arg("dum") + .run(); + + assert!(result.success); + assert_eq!(result.stdout, "dumdum dum dum dum -e dum\n"); + assert_eq!(true, result.stdout.contains("-e")); +} From 545fe7d887d5e162610474e07922169f7b78fd2b Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Tue, 23 Mar 2021 11:42:05 +0300 Subject: [PATCH 489/606] 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 --- src/uu/unexpand/Cargo.toml | 2 +- src/uu/unexpand/src/unexpand.rs | 119 +++++++++++------------- tests/by-util/test_unexpand.rs | 19 ++++ tests/fixtures/unexpand/with_spaces.txt | 2 + 4 files changed, 76 insertions(+), 66 deletions(-) create mode 100644 tests/fixtures/unexpand/with_spaces.txt diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index ec6967e21..d66d335bf 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/unexpand.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" unicode-width = "0.1.5" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index 59a2dc6a0..5b08c33cf 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -11,7 +11,7 @@ #[macro_use] extern crate uucore; - +use clap::{App, Arg}; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Stdout, Write}; use std::str::from_utf8; @@ -19,6 +19,9 @@ use unicode_width::UnicodeWidthChar; static NAME: &str = "unexpand"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static USAGE: &str = "unexpand [OPTION]... [FILE]..."; +static SUMMARY: &str = "Convert blanks in each FILE to tabs, writing to standard output.\n + With no FILE, or when FILE is -, read standard input."; const DEFAULT_TABSTOP: usize = 8; @@ -46,6 +49,14 @@ fn tabstops_parse(s: String) -> Vec { nums } +mod options { + pub const FILE: &str = "file"; + pub const ALL: &str = "all"; + pub const FIRST_ONLY: &str = "first-only"; + pub const TABS: &str = "tabs"; + pub const NO_UTF8: &str = "no-utf8"; +} + struct Options { files: Vec, tabstops: Vec, @@ -54,20 +65,19 @@ struct Options { } impl Options { - fn new(matches: getopts::Matches) -> Options { - let tabstops = match matches.opt_str("t") { + fn new(matches: clap::ArgMatches) -> Options { + let tabstops = match matches.value_of(options::TABS) { None => vec![DEFAULT_TABSTOP], - Some(s) => tabstops_parse(s), + Some(s) => tabstops_parse(s.to_string()), }; - let aflag = (matches.opt_present("all") || matches.opt_present("tabs")) - && !matches.opt_present("first-only"); - let uflag = !matches.opt_present("U"); + let aflag = (matches.is_present(options::ALL) || matches.is_present(options::TABS)) + && !matches.is_present(options::FIRST_ONLY); + let uflag = !matches.is_present(options::NO_UTF8); - let files = if matches.free.is_empty() { - vec!["-".to_owned()] - } else { - matches.free + let files = match matches.value_of(options::FILE) { + Some(v) => vec![v.to_string()], + None => vec!["-".to_owned()], }; Options { @@ -82,60 +92,39 @@ impl Options { pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = getopts::Options::new(); - - opts.optflag( - "a", - "all", - "convert all blanks, instead of just initial blanks", - ); - opts.optflag( - "", - "first-only", - "convert only leading sequences of blanks (overrides -a)", - ); - opts.optopt( - "t", - "tabs", - "have tabs N characters apart instead of 8 (enables -a)", - "N", - ); - opts.optopt( - "t", - "tabs", - "use comma separated LIST of tab positions (enables -a)", - "LIST", - ); - opts.optflag( - "U", - "no-utf8", - "interpret input file as 8-bit ASCII rather than UTF-8", - ); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f), - }; - - if matches.opt_present("help") { - println!("{} {}\n", NAME, VERSION); - println!("Usage: {} [OPTION]... [FILE]...\n", NAME); - println!( - "{}", - opts.usage( - "Convert blanks in each FILE to tabs, writing to standard output.\n\ - With no FILE, or when FILE is -, read standard input." - ) - ); - return 0; - } - - if matches.opt_present("V") { - println!("{} {}", NAME, VERSION); - return 0; - } + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(USAGE) + .about(SUMMARY) + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) + .arg( + Arg::with_name(options::ALL) + .short("a") + .long(options::ALL) + .help("convert all blanks, instead of just initial blanks") + .takes_value(false), + ) + .arg( + Arg::with_name(options::FIRST_ONLY) + .long(options::FIRST_ONLY) + .help("convert only leading sequences of blanks (overrides -a)") + .takes_value(false), + ) + .arg( + Arg::with_name(options::TABS) + .short("t") + .long(options::TABS) + .long_help("use comma separated LIST of tab positions or have tabs N characters apart instead of 8 (enables -a)") + .takes_value(true) + ) + .arg( + Arg::with_name(options::NO_UTF8) + .short("U") + .long(options::NO_UTF8) + .takes_value(false) + .help("interpret input file as 8-bit ASCII rather than UTF-8")) + .get_matches_from(args); unexpand(Options::new(matches)); diff --git a/tests/by-util/test_unexpand.rs b/tests/by-util/test_unexpand.rs index 93cc42d90..e8b880287 100644 --- a/tests/by-util/test_unexpand.rs +++ b/tests/by-util/test_unexpand.rs @@ -136,3 +136,22 @@ fn unexpand_spaces_after_fields() { .run() .stdout_is("\t\tA B C D\t\t A\t\n"); } + +#[test] +fn unexpand_read_from_file() { + new_ucmd!() + .arg("with_spaces.txt") + .arg("-t4") + .run() + .success(); +} + +#[test] +fn unexpand_read_from_two_file() { + new_ucmd!() + .arg("with_spaces.txt") + .arg("with_spaces.txt") + .arg("-t4") + .run() + .success(); +} diff --git a/tests/fixtures/unexpand/with_spaces.txt b/tests/fixtures/unexpand/with_spaces.txt new file mode 100644 index 000000000..3f39671a1 --- /dev/null +++ b/tests/fixtures/unexpand/with_spaces.txt @@ -0,0 +1,2 @@ + abc d e f g \t\t A + \ No newline at end of file From b54f0b1ff20919b42de48f74c0265a889696d726 Mon Sep 17 00:00:00 2001 From: Alessandro Stoltenberg Date: Tue, 23 Mar 2021 11:55:18 +0100 Subject: [PATCH 490/606] echo: Refactored help message. (#1886) --- src/uu/echo/src/echo.rs | 57 ++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index 7c0014229..c991f5d3f 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -9,17 +9,17 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use std::io::{self, Write}; use std::iter::Peekable; use std::str::Chars; -static VERSION: &str = env!("CARGO_PKG_VERSION"); -const NAME: &str = "echo"; -const SYNTAX: &str = "[OPTIONS]... [STRING]..."; -const SUMMARY: &str = "display a line of text"; -const HELP: &str = r#" +static NAME: &str = "echo"; +static USAGE: &str = "[OPTIONS]... [STRING]..."; +static SUMMARY: &str = "display a line of text"; +static AFTER_HELP: &str = r#" Echo the STRING(s) to standard output. + If -e is in effect, the following sequences are recognized: \\\\ backslash @@ -37,10 +37,10 @@ const HELP: &str = r#" "#; mod options { - pub const STRING: &str = "string"; - pub const NEWLINE: &str = "n"; - pub const ENABLE_ESCAPE: &str = "e"; - pub const DISABLE_ESCAPE: &str = "E"; + pub static STRING: &str = "STRING"; + pub static NO_NEWLINE: &str = "no_newline"; + pub static ENABLE_BACKSLASH_ESCAPE: &str = "enable_backslash_escape"; + pub static DISABLE_BACKSLASH_ESCAPE: &str = "disable_backslash_escape"; } fn parse_code( @@ -122,32 +122,43 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // Final argument must have multiple(true) or the usage string equivalent. .setting(clap::AppSettings::TrailingVarArg) .setting(clap::AppSettings::AllowLeadingHyphen) - .version(VERSION) - .usage(SYNTAX) + .version(crate_version!()) + .usage(USAGE) .about(SUMMARY) - .help(HELP) - .arg(Arg::with_name(options::STRING).hidden(true).multiple(true)) + .after_help(AFTER_HELP) .arg( - Arg::with_name(options::NEWLINE) + Arg::with_name(options::NO_NEWLINE) .short("n") - .help("do not output the trailing newline"), + .help("do not output the trailing newline") + .takes_value(false) + .display_order(1), ) .arg( - Arg::with_name(options::ENABLE_ESCAPE) + Arg::with_name(options::ENABLE_BACKSLASH_ESCAPE) .short("e") - .help("enable interpretation of backslash escapes"), + .help("enable interpretation of backslash escapes") + .takes_value(false) + .display_order(2), ) .arg( - Arg::with_name(options::DISABLE_ESCAPE) + Arg::with_name(options::DISABLE_BACKSLASH_ESCAPE) .short("E") - .help("disable interpretation of backslash escapes (default)"), + .help("disable interpretation of backslash escapes (default)") + .takes_value(false) + .display_order(3), + ) + .arg( + Arg::with_name(options::STRING) + .hidden(true) + .multiple(true) + .allow_hyphen_values(true), ) .get_matches_from(args); - let no_newline = matches.is_present("n"); - let escaped = matches.is_present("e"); + let no_newline = matches.is_present(options::NO_NEWLINE); + let escaped = matches.is_present(options::ENABLE_BACKSLASH_ESCAPE); let values: Vec = match matches.values_of(options::STRING) { - Some(v) => v.map(|v| v.to_string()).collect(), + Some(s) => s.map(|s| s.to_string()).collect(), None => vec!["".to_string()], }; From 4873c8a24b7e00283572f05da18e3b74a6819562 Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Tue, 23 Mar 2021 13:49:35 -0700 Subject: [PATCH 491/606] 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 --- src/uu/mv/src/mv.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 6575ad37a..b481aeebc 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -380,7 +380,7 @@ fn rename(from: &PathBuf, to: &PathBuf, b: &Behavior) -> io::Result<()> { match b.overwrite { OverwriteMode::NoClobber => return Ok(()), OverwriteMode::Interactive => { - print!("{}: overwrite ‘{}’? ", executable!(), to.display()); + println!("{}: overwrite ‘{}’? ", executable!(), to.display()); if !read_yes() { return Ok(()); } From 9b2ee1ce06199be5f7cbf09a5ec39aa7245a1c2d Mon Sep 17 00:00:00 2001 From: Marco Satti Date: Wed, 24 Mar 2021 15:33:11 +0800 Subject: [PATCH 492/606] date: change tests to expect failure (#1895) * date: change tests to expect failure Although these tests contain valid dates, the parsing logic is not implemented yet. It should be changed to expect success when the parsing logic is done. * date: fix test build errors --- tests/by-util/test_date.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 216446266..5619aed94 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -180,39 +180,45 @@ fn test_date_set_mac_unavailable() { #[test] #[cfg(all(unix, not(target_os = "macos")))] +/// TODO: expected to fail currently; change to succeeds() when required. fn test_date_set_valid_2() { if get_effective_uid() == 0 { let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd .arg("--set") .arg("Sat 20 Mar 2021 14:53:01 AWST") - .succeeds(); - result.no_stdout().no_stderr(); + .fails(); + let result = result.no_stdout(); + assert!(result.stderr.starts_with("date: invalid date ")); } } #[test] #[cfg(all(unix, not(target_os = "macos")))] +/// TODO: expected to fail currently; change to succeeds() when required. fn test_date_set_valid_3() { if get_effective_uid() == 0 { let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd .arg("--set") .arg("Sat 20 Mar 2021 14:53:01") // Local timezone - .succeeds(); - result.no_stdout().no_stderr(); + .fails(); + let result = result.no_stdout(); + assert!(result.stderr.starts_with("date: invalid date ")); } } #[test] #[cfg(all(unix, not(target_os = "macos")))] +/// TODO: expected to fail currently; change to succeeds() when required. fn test_date_set_valid_4() { if get_effective_uid() == 0 { let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd .arg("--set") .arg("2020-03-11 21:45:00") // Local timezone - .succeeds(); - result.no_stdout().no_stderr(); + .fails(); + let result = result.no_stdout(); + assert!(result.stderr.starts_with("date: invalid date ")); } } From 365c23049394fd29ff1506827d8eff778b452a2d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 24 Mar 2021 08:56:30 +0100 Subject: [PATCH 493/606] refresh cargo.lock with recent updates (#1896) --- Cargo.lock | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e5852987e..aabac3783 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -90,7 +90,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -295,7 +295,7 @@ dependencies = [ "uu_whoami 0.0.4", "uu_yes 0.0.4", "uucore 0.0.7", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -401,12 +401,12 @@ dependencies = [ "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -468,7 +468,7 @@ dependencies = [ "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1100,7 +1100,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.124" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1109,12 +1109,12 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.124" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1129,7 +1129,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1286,7 +1286,7 @@ name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1382,7 +1382,7 @@ version = "0.0.4" dependencies = [ "uucore 0.0.7", "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1392,7 +1392,7 @@ dependencies = [ "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1403,7 +1403,7 @@ dependencies = [ "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1445,7 +1445,7 @@ dependencies = [ "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1525,6 +1525,7 @@ dependencies = [ name = "uu_echo" version = "0.0.4" dependencies = [ + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", ] @@ -1835,7 +1836,7 @@ dependencies = [ name = "uu_nohup" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1977,7 +1978,7 @@ dependencies = [ "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", - "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2196,7 +2197,7 @@ dependencies = [ name = "uu_tsort" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", ] @@ -2225,7 +2226,7 @@ dependencies = [ name = "uu_unexpand" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -2344,7 +2345,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "walkdir" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2595,9 +2596,9 @@ dependencies = [ "checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)" = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" +"checksum serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" "checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)" = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" +"checksum serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" "checksum serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" @@ -2625,7 +2626,7 @@ dependencies = [ "checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" "checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" +"checksum walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" "checksum wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" "checksum wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" From bdf603a65ef5d40741cdf18b765611d239822230 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Tue, 23 Mar 2021 19:12:10 +0100 Subject: [PATCH 494/606] rm: make -d/-r obligatory for removing symlink_dir (windows) --- src/uu/rm/src/rm.rs | 31 ++++++++++++++++++++----------- tests/by-util/test_rm.rs | 3 +++ 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index e858e3b0a..6e26cb82a 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -306,21 +306,30 @@ fn remove_dir(path: &Path, options: &Options) -> bool { }; if response { if let Ok(mut read_dir) = fs::read_dir(path) { - if options.dir && read_dir.next().is_none() { - match fs::remove_dir(path) { - Ok(_) => { - if options.verbose { - println!("removed directory '{}'", path.display()); + if options.dir || options.recursive { + if read_dir.next().is_none() { + match fs::remove_dir(path) { + Ok(_) => { + if options.verbose { + println!("removed directory '{}'", path.display()); + } + } + Err(e) => { + show_error!("cannot remove '{}': {}", path.display(), e); + return true; } } - Err(e) => { - show_error!("cannot remove '{}': {}", path.display(), e); - return true; - } + } else { + // directory can be read but is not empty + show_error!("cannot remove '{}': Directory not empty", path.display()); + return true; } } else { - // directory can be read but is not empty - show_error!("cannot remove '{}': Directory not empty", path.display()); + // called to remove a symlink_dir (windows) without "-r"/"-R" or "-d" + show_error!( + "could not remove directory '{}' (did you mean to pass '-r' or '-R'?)", + path.display() + ); return true; } } else { diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 06d1d435d..9556bf8e7 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -194,7 +194,10 @@ fn test_rm_dir_symlink() { at.mkdir(dir); at.symlink_dir(dir, link); + #[cfg(not(windows))] ucmd.arg(link).succeeds(); + #[cfg(windows)] + ucmd.arg("-r").arg(link).succeeds(); } #[test] From ffcfcfeef75810d8465aabe76bc1a01008ff9a5f Mon Sep 17 00:00:00 2001 From: dkg Date: Wed, 24 Mar 2021 12:56:07 -0400 Subject: [PATCH 495/606] tac is "semi-done" because of unimplemented ---regex (#1901) --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 9d25a1120..dd60d2126 100644 --- a/README.md +++ b/README.md @@ -301,7 +301,7 @@ Utilities | csplit | date | | | cut | join | | | dircolors | df | | -| dirname | | | +| dirname | tac | | | du | | | | echo | | | | env | | | @@ -354,7 +354,6 @@ Utilities | stdbuf | | | | sum | | | | sync | | | -| tac | | | | tee | | | | timeout | | | | touch | | | From 63317b35292079af1a5f3c3f8c81471dcb83a0b3 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Wed, 24 Mar 2021 23:46:17 +0300 Subject: [PATCH 496/606] ptx: move from getopts to clap (#1893) * ptx: move from getopts to clap * chore: delete comment * chore: fix some clippy warnings --- src/uu/ptx/Cargo.toml | 1 + src/uu/ptx/src/ptx.rs | 335 ++++++++++++++++++++++++++---------------- 2 files changed, 206 insertions(+), 130 deletions(-) diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index 3a91feeb0..d1e0267b6 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/ptx.rs" [dependencies] +clap = "2.33" aho-corasick = "0.7.3" getopts = "0.2.18" libc = "0.2.42" diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index bfcd6699f..989ab52ef 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate uucore; -use getopts::{Matches, Options}; +use clap::{App, Arg}; use regex::Regex; use std::cmp; use std::collections::{BTreeSet, HashMap, HashSet}; @@ -20,6 +20,12 @@ use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write}; static NAME: &str = "ptx"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static BRIEF: &str = "Usage: ptx [OPTION]... [INPUT]... (without -G) or: \ + ptx -G [OPTION]... [INPUT [OUTPUT]] \n Output a permuted index, \ + including context, of the words in the input files. \n\n Mandatory \ + arguments to long options are mandatory for short options too.\n + With no FILE, or when FILE is -, read standard input. \ + Default is '-F /'."; #[derive(Debug)] enum OutFormat { @@ -61,8 +67,11 @@ impl Default for Config { } } -fn read_word_filter_file(matches: &Matches, option: &str) -> HashSet { - let filename = matches.opt_str(option).expect("parsing options failed!"); +fn read_word_filter_file(matches: &clap::ArgMatches, option: &str) -> HashSet { + let filename = matches + .value_of(option) + .expect("parsing options failed!") + .to_string(); let reader = BufReader::new(crash_if_err!(1, File::open(filename))); let mut words: HashSet = HashSet::new(); for word in reader.lines() { @@ -81,23 +90,29 @@ struct WordFilter { } impl WordFilter { - fn new(matches: &Matches, config: &Config) -> WordFilter { - let (o, oset): (bool, HashSet) = if matches.opt_present("o") { - (true, read_word_filter_file(matches, "o")) + fn new(matches: &clap::ArgMatches, config: &Config) -> WordFilter { + let (o, oset): (bool, HashSet) = if matches.is_present(options::ONLY_FILE) { + (true, read_word_filter_file(matches, options::ONLY_FILE)) } else { (false, HashSet::new()) }; - let (i, iset): (bool, HashSet) = if matches.opt_present("i") { - (true, read_word_filter_file(matches, "i")) + let (i, iset): (bool, HashSet) = if matches.is_present(options::IGNORE_FILE) { + (true, read_word_filter_file(matches, options::IGNORE_FILE)) } else { (false, HashSet::new()) }; - if matches.opt_present("b") { + if matches.is_present(options::BREAK_FILE) { crash!(1, "-b not implemented yet"); } // Ignore empty string regex from cmd-line-args - let arg_reg: Option = if matches.opt_present("W") { - matches.opt_str("W").filter(|reg| !reg.is_empty()) + let arg_reg: Option = if matches.is_present(options::WORD_REGEXP) { + match matches.value_of(options::WORD_REGEXP) { + Some(v) => match v.is_empty() { + true => None, + false => Some(v.to_string()), + }, + None => None, + } } else { None }; @@ -131,55 +146,50 @@ struct WordRef { filename: String, } -fn print_version() { - println!("{} {}", NAME, VERSION); -} - -fn print_usage(opts: &Options) { - let brief = "Usage: ptx [OPTION]... [INPUT]... (without -G) or: \ - ptx -G [OPTION]... [INPUT [OUTPUT]] \n Output a permuted index, \ - including context, of the words in the input files. \n\n Mandatory \ - arguments to long options are mandatory for short options too."; - let explanation = "With no FILE, or when FILE is -, read standard input. \ - Default is '-F /'."; - println!("{}\n{}", opts.usage(&brief), explanation); -} - -fn get_config(matches: &Matches) -> Config { +fn get_config(matches: &clap::ArgMatches) -> Config { let mut config: Config = Default::default(); let err_msg = "parsing options failed"; - if matches.opt_present("G") { + if matches.is_present(options::TRADITIONAL) { config.gnu_ext = false; config.format = OutFormat::Roff; config.context_regex = "[^ \t\n]+".to_owned(); } else { crash!(1, "GNU extensions not implemented yet"); } - if matches.opt_present("S") { + if matches.is_present(options::SENTENCE_REGEXP) { crash!(1, "-S not implemented yet"); } - config.auto_ref = matches.opt_present("A"); - config.input_ref = matches.opt_present("r"); - config.right_ref &= matches.opt_present("R"); - config.ignore_case = matches.opt_present("f"); - if matches.opt_present("M") { - config.macro_name = matches.opt_str("M").expect(err_msg); + config.auto_ref = matches.is_present(options::AUTO_REFERENCE); + config.input_ref = matches.is_present(options::REFERENCES); + config.right_ref &= matches.is_present(options::RIGHT_SIDE_REFS); + config.ignore_case = matches.is_present(options::IGNORE_CASE); + if matches.is_present(options::MACRO_NAME) { + config.macro_name = matches + .value_of(options::MACRO_NAME) + .expect(err_msg) + .to_string(); } - if matches.opt_present("F") { - config.trunc_str = matches.opt_str("F").expect(err_msg); + if matches.is_present(options::IGNORE_CASE) { + config.trunc_str = matches + .value_of(options::IGNORE_CASE) + .expect(err_msg) + .to_string(); } - if matches.opt_present("w") { - let width_str = matches.opt_str("w").expect(err_msg); + if matches.is_present(options::WIDTH) { + let width_str = matches.value_of(options::WIDTH).expect(err_msg).to_string(); config.line_width = crash_if_err!(1, usize::from_str_radix(&width_str, 10)); } - if matches.opt_present("g") { - let gap_str = matches.opt_str("g").expect(err_msg); + if matches.is_present(options::GAP_SIZE) { + let gap_str = matches + .value_of(options::GAP_SIZE) + .expect(err_msg) + .to_string(); config.gap_size = crash_if_err!(1, usize::from_str_radix(&gap_str, 10)); } - if matches.opt_present("O") { + if matches.is_present(options::FORMAT_ROFF) { config.format = OutFormat::Roff; } - if matches.opt_present("T") { + if matches.is_present(options::FORMAT_TEX) { config.format = OutFormat::Tex; } config @@ -494,102 +504,167 @@ fn write_traditional_output( } } +mod options { + pub static FILE: &str = "file"; + pub static AUTO_REFERENCE: &str = "auto-reference"; + pub static TRADITIONAL: &str = "traditional"; + pub static FLAG_TRUNCATION: &str = "flag-truncation"; + pub static MACRO_NAME: &str = "macro-name"; + pub static FORMAT_ROFF: &str = "format=roff"; + pub static RIGHT_SIDE_REFS: &str = "right-side-refs"; + pub static SENTENCE_REGEXP: &str = "sentence-regexp"; + pub static FORMAT_TEX: &str = "format=tex"; + pub static WORD_REGEXP: &str = "word-regexp"; + pub static BREAK_FILE: &str = "break-file"; + pub static IGNORE_CASE: &str = "ignore-case"; + pub static GAP_SIZE: &str = "gap-size"; + pub static IGNORE_FILE: &str = "ignore-file"; + pub static ONLY_FILE: &str = "only-file"; + pub static REFERENCES: &str = "references"; + pub static WIDTH: &str = "width"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = Options::new(); - opts.optflag( - "A", - "auto-reference", - "output automatically generated references", - ); - opts.optflag("G", "traditional", "behave more like System V 'ptx'"); - opts.optopt( - "F", - "flag-truncation", - "use STRING for flagging line truncations", - "STRING", - ); - opts.optopt( - "M", - "macro-name", - "macro name to use instead of 'xx'", - "STRING", - ); - opts.optflag("O", "format=roff", "generate output as roff directives"); - opts.optflag( - "R", - "right-side-refs", - "put references at right, not counted in -w", - ); - opts.optopt( - "S", - "sentence-regexp", - "for end of lines or end of sentences", - "REGEXP", - ); - opts.optflag("T", "format=tex", "generate output as TeX directives"); - opts.optopt( - "W", - "word-regexp", - "use REGEXP to match each keyword", - "REGEXP", - ); - opts.optopt( - "b", - "break-file", - "word break characters in this FILE", - "FILE", - ); - opts.optflag( - "f", - "ignore-case", - "fold lower case to upper case for sorting", - ); - opts.optopt( - "g", - "gap-size", - "gap size in columns between output fields", - "NUMBER", - ); - opts.optopt( - "i", - "ignore-file", - "read ignore word list from FILE", - "FILE", - ); - opts.optopt( - "o", - "only-file", - "read only word list from this FILE", - "FILE", - ); - opts.optflag("r", "references", "first field of each line is a reference"); - opts.optopt( - "w", - "width", - "output width in columns, reference excluded", - "NUMBER", - ); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); + // let mut opts = Options::new(); + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(BRIEF) + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) + .arg( + Arg::with_name(options::AUTO_REFERENCE) + .short("A") + .long(options::AUTO_REFERENCE) + .help("output automatically generated references") + .takes_value(false), + ) + .arg( + Arg::with_name(options::TRADITIONAL) + .short("G") + .long(options::TRADITIONAL) + .help("behave more like System V 'ptx'"), + ) + .arg( + Arg::with_name(options::FLAG_TRUNCATION) + .short("F") + .long(options::FLAG_TRUNCATION) + .help("use STRING for flagging line truncations") + .value_name("STRING") + .takes_value(true), + ) + .arg( + Arg::with_name(options::MACRO_NAME) + .short("M") + .long(options::MACRO_NAME) + .help("macro name to use instead of 'xx'") + .value_name("STRING") + .takes_value(true), + ) + .arg( + Arg::with_name(options::FORMAT_ROFF) + .short("O") + .long(options::FORMAT_ROFF) + .help("generate output as roff directives"), + ) + .arg( + Arg::with_name(options::RIGHT_SIDE_REFS) + .short("R") + .long(options::RIGHT_SIDE_REFS) + .help("put references at right, not counted in -w") + .takes_value(false), + ) + .arg( + Arg::with_name(options::SENTENCE_REGEXP) + .short("S") + .long(options::SENTENCE_REGEXP) + .help("for end of lines or end of sentences") + .value_name("REGEXP") + .takes_value(true), + ) + .arg( + Arg::with_name(options::FORMAT_TEX) + .short("T") + .long(options::FORMAT_TEX) + .help("generate output as TeX directives"), + ) + .arg( + Arg::with_name(options::WORD_REGEXP) + .short("W") + .long(options::WORD_REGEXP) + .help("use REGEXP to match each keyword") + .value_name("REGEXP") + .takes_value(true), + ) + .arg( + Arg::with_name(options::BREAK_FILE) + .short("b") + .long(options::BREAK_FILE) + .help("word break characters in this FILE") + .value_name("FILE") + .takes_value(true), + ) + .arg( + Arg::with_name(options::IGNORE_CASE) + .short("f") + .long(options::IGNORE_CASE) + .help("fold lower case to upper case for sorting") + .takes_value(false), + ) + .arg( + Arg::with_name(options::GAP_SIZE) + .short("g") + .long(options::GAP_SIZE) + .help("gap size in columns between output fields") + .value_name("NUMBER") + .takes_value(true), + ) + .arg( + Arg::with_name(options::IGNORE_FILE) + .short("i") + .long(options::IGNORE_FILE) + .help("read ignore word list from FILE") + .value_name("FILE") + .takes_value(true), + ) + .arg( + Arg::with_name(options::ONLY_FILE) + .short("o") + .long(options::ONLY_FILE) + .help("read only word list from this FILE") + .value_name("FILE") + .takes_value(true), + ) + .arg( + Arg::with_name(options::REFERENCES) + .short("r") + .long(options::REFERENCES) + .help("first field of each line is a reference") + .value_name("FILE") + .takes_value(false), + ) + .arg( + Arg::with_name(options::WIDTH) + .short("w") + .long(options::WIDTH) + .help("output width in columns, reference excluded") + .value_name("NUMBER") + .takes_value(true), + ) + .get_matches_from(args); - let matches = return_if_err!(1, opts.parse(&args[1..])); + let input_files: Vec = match &matches.values_of(options::FILE) { + Some(v) => v.clone().map(|v| v.to_owned()).collect(), + None => vec!["-".to_string()], + }; - if matches.opt_present("help") { - print_usage(&opts); - return 0; - } - if matches.opt_present("version") { - print_version(); - return 0; - } let config = get_config(&matches); let word_filter = WordFilter::new(&matches, &config); - let file_map = read_input(&matches.free, &config); + let file_map = read_input(&input_files, &config); let word_set = create_word_set(&config, &word_filter, &file_map); - let output_file = if !config.gnu_ext && matches.free.len() == 2 { - matches.free[1].clone() + let output_file = if !config.gnu_ext && matches.args.len() == 2 { + matches.value_of(options::FILE).unwrap_or("-").to_string() } else { "-".to_owned() }; From a9786ce52804384dbf331aec43601c66dabac12f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 25 Mar 2021 08:07:27 +0100 Subject: [PATCH 497/606] Reword the "why" a bit (#1903) --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dd60d2126..da92c80c2 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,8 @@ Why? Many GNU, Linux and other utilities are useful, and obviously [some](http://gnuwin32.sourceforge.net) [effort](http://unxutils.sourceforge.net) has been spent in the past to port them to Windows. However, those projects -are either old and abandoned, are hosted on CVS (which makes it more difficult -for new contributors to contribute to them), are written in platform-specific C, or -suffer from other issues. +are written in platform-specific C, a language considered unsafe compared to Rust, and +have other issues. Rust provides a good, platform-agnostic way of writing systems utilities that are easy to compile anywhere, and this is as good a way as any to try and learn it. From 99da9ea6ec985af34c0f88583465043013d30bd4 Mon Sep 17 00:00:00 2001 From: Mekka Date: Thu, 25 Mar 2021 02:36:48 -0700 Subject: [PATCH 498/606] Cleanup: Fix grammar in "cp" macro comments. (#1905) Replaced "they if" with "if they" in the comments above the "prompt_yes" macro. --- src/uu/cp/src/cp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 01ad4a8aa..569ee78bc 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -112,7 +112,7 @@ macro_rules! or_continue( }) ); -/// Prompts the user yes/no and returns `true` they if successfully +/// Prompts the user yes/no and returns `true` if they successfully /// answered yes. macro_rules! prompt_yes( ($($args:tt)+) => ({ From 52997b63fbdd6ee08c1ad5d32422819389ce5338 Mon Sep 17 00:00:00 2001 From: Sivachandran Date: Thu, 25 Mar 2021 15:57:34 +0530 Subject: [PATCH 499/606] pathchk: move from getopts to clap (#1897) --- src/uu/pathchk/Cargo.toml | 2 +- src/uu/pathchk/src/pathchk.rs | 143 ++++++++++++++++------------------ 2 files changed, 66 insertions(+), 79 deletions(-) diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index 452199f4f..c1d0d0dfa 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/pathchk.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index 745d0d36c..c27e52513 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -12,7 +12,7 @@ #[macro_use] extern crate uucore; -use getopts::Options; +use clap::{App, Arg}; use std::fs; use std::io::{ErrorKind, Write}; @@ -22,107 +22,94 @@ enum Mode { Basic, // check basic compatibility with POSIX Extra, // check for leading dashes and empty names Both, // a combination of `Basic` and `Extra` - Help, // show help - Version, // show version information } static NAME: &str = "pathchk"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Check whether file names are valid or portable"; + +mod options { + pub const POSIX: &str = "posix"; + pub const POSIX_SPECIAL: &str = "posix-special"; + pub const PORTABILITY: &str = "portability"; + pub const PATH: &str = "path"; +} // a few global constants as used in the GNU implementation const POSIX_PATH_MAX: usize = 256; const POSIX_NAME_MAX: usize = 14; -pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); +fn get_usage() -> String { + format!("{0} [OPTION]... NAME...", executable!()) +} - // add options - let mut opts = Options::new(); - opts.optflag("p", "posix", "check for (most) POSIX systems"); - opts.optflag( - "P", - "posix-special", - "check for empty names and leading \"-\"", - ); - opts.optflag( - "", - "portability", - "check for all POSIX systems (equivalent to -p -P)", - ); - opts.optflag("h", "help", "display this help text and exit"); - opts.optflag("V", "version", "output version information and exit"); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(e) => crash!(1, "{}", e), - }; +pub fn uumain(args: impl uucore::Args) -> i32 { + let usage = get_usage(); + + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(options::POSIX) + .short("p") + .help("check for most POSIX systems"), + ) + .arg( + Arg::with_name(options::POSIX_SPECIAL) + .short("P") + .help(r#"check for empty names and leading "-""#), + ) + .arg( + Arg::with_name(options::PORTABILITY) + .long(options::PORTABILITY) + .help("check for all POSIX systems (equivalent to -p -P)"), + ) + .arg(Arg::with_name(options::PATH).hidden(true).multiple(true)) + .get_matches_from(args); // set working mode - let mode = if matches.opt_present("version") { - Mode::Version - } else if matches.opt_present("help") { - Mode::Help - } else if (matches.opt_present("posix") && matches.opt_present("posix-special")) - || matches.opt_present("portability") - { + let is_posix = matches.values_of(options::POSIX).is_some(); + let is_posix_special = matches.values_of(options::POSIX_SPECIAL).is_some(); + let is_portability = matches.values_of(options::PORTABILITY).is_some(); + + let mode = if (is_posix && is_posix_special) || is_portability { Mode::Both - } else if matches.opt_present("posix") { + } else if is_posix { Mode::Basic - } else if matches.opt_present("posix-special") { + } else if is_posix_special { Mode::Extra } else { Mode::Default }; // take necessary actions - match mode { - Mode::Help => { - help(opts); - 0 - } - Mode::Version => { - version(); - 0 - } - _ => { - let mut res = if matches.free.is_empty() { - show_error!("missing operand\nTry {} --help for more information", NAME); - false - } else { - true - }; - // free strings are path operands - // FIXME: TCS, seems inefficient and overly verbose (?) - for p in matches.free { - let mut path = Vec::new(); - for path_segment in p.split('/') { - path.push(path_segment.to_string()); - } - res &= check_path(&mode, &path); - } - // determine error code - if res { - 0 - } else { - 1 + let paths = matches.values_of(options::PATH); + let mut res = if paths.is_none() { + show_error!("missing operand\nTry {} --help for more information", NAME); + false + } else { + true + }; + + if res { + // free strings are path operands + // FIXME: TCS, seems inefficient and overly verbose (?) + for p in paths.unwrap() { + let mut path = Vec::new(); + for path_segment in p.split('/') { + path.push(path_segment.to_string()); } + res &= check_path(&mode, &path); } } -} -// print help -fn help(opts: Options) { - let msg = format!( - "Usage: {} [OPTION]... NAME...\n\n\ - Diagnose invalid or unportable file names.", - NAME - ); - - print!("{}", opts.usage(&msg)); -} - -// print version information -fn version() { - println!("{} {}", NAME, VERSION); + // determine error code + if res { + 0 + } else { + 1 + } } // check a path, given as a slice of it's components and an operating mode From 23b70001a820404b1f50ff9f2dbf5bff7f213bf7 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 25 Mar 2021 20:24:53 +0100 Subject: [PATCH 500/606] ls: version sort (#1898) --- src/uu/ls/src/ls.rs | 26 ++- src/uu/ls/src/version_cmp.rs | 304 +++++++++++++++++++++++++++++++++++ tests/by-util/test_ls.rs | 79 ++++++++- 3 files changed, 407 insertions(+), 2 deletions(-) create mode 100644 src/uu/ls/src/version_cmp.rs diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 455b4f7b6..8714a0fa1 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -13,6 +13,8 @@ extern crate lazy_static; #[macro_use] extern crate uucore; +mod version_cmp; + use clap::{App, Arg}; use number_prefix::NumberPrefix; #[cfg(unix)] @@ -91,6 +93,7 @@ pub mod options { pub static SIZE: &str = "S"; pub static TIME: &str = "t"; pub static NONE: &str = "U"; + pub static VERSION: &str = "v"; } pub mod time { pub static ACCESS: &str = "u"; @@ -132,6 +135,7 @@ enum Sort { Name, Size, Time, + Version, } enum SizeFormat { @@ -270,6 +274,7 @@ impl Config { "name" => Sort::Name, "time" => Sort::Time, "size" => Sort::Size, + "version" => Sort::Version, // below should never happen as clap already restricts the values. _ => unreachable!("Invalid field for --sort"), } @@ -279,6 +284,8 @@ impl Config { Sort::Size } else if options.is_present(options::sort::NONE) { Sort::None + } else if options.is_present(options::sort::VERSION) { + Sort::Version } else { Sort::Name }; @@ -507,13 +514,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("Sort by : name, none (-U), time (-t) or size (-S)") .value_name("field") .takes_value(true) - .possible_values(&["name", "none", "time", "size"]) + .possible_values(&["name", "none", "time", "size", "version"]) .require_equals(true) .overrides_with_all(&[ options::SORT, options::sort::SIZE, options::sort::TIME, options::sort::NONE, + options::sort::VERSION, ]) ) .arg( @@ -525,6 +533,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::sort::SIZE, options::sort::TIME, options::sort::NONE, + options::sort::VERSION, ]) ) .arg( @@ -536,6 +545,19 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::sort::SIZE, options::sort::TIME, options::sort::NONE, + options::sort::VERSION, + ]) + ) + .arg( + Arg::with_name(options::sort::VERSION) + .short(options::sort::VERSION) + .help("Natural sort of (version) numbers in the filenames.") + .overrides_with_all(&[ + options::SORT, + options::sort::SIZE, + options::sort::TIME, + options::sort::NONE, + options::sort::VERSION, ]) ) .arg( @@ -549,6 +571,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::sort::SIZE, options::sort::TIME, options::sort::NONE, + options::sort::VERSION, ]) ) @@ -747,6 +770,7 @@ fn sort_entries(entries: &mut Vec, config: &Config) { .sort_by_key(|k| Reverse(get_metadata(k, config).map(|md| md.len()).unwrap_or(0))), // The default sort in GNU ls is case insensitive Sort::Name => entries.sort_by_key(|k| k.to_string_lossy().to_lowercase()), + Sort::Version => entries.sort_by(version_cmp::version_cmp), Sort::None => {} } diff --git a/src/uu/ls/src/version_cmp.rs b/src/uu/ls/src/version_cmp.rs new file mode 100644 index 000000000..3cd5989f1 --- /dev/null +++ b/src/uu/ls/src/version_cmp.rs @@ -0,0 +1,304 @@ +use std::{cmp::Ordering, path::PathBuf}; + +/// Compare pathbufs in a way that matches the GNU version sort, meaning that +/// numbers get sorted in a natural way. +pub(crate) fn version_cmp(a: &PathBuf, b: &PathBuf) -> Ordering { + let a_string = a.to_string_lossy(); + let b_string = b.to_string_lossy(); + let mut a = a_string.chars().peekable(); + let mut b = b_string.chars().peekable(); + + // The order determined from the number of leading zeroes. + // This is used if the filenames are equivalent up to leading zeroes. + let mut leading_zeroes = Ordering::Equal; + + loop { + match (a.next(), b.next()) { + // If the characters are both numerical. We collect the rest of the number + // and parse them to u64's and compare them. + (Some(a_char @ '0'..='9'), Some(b_char @ '0'..='9')) => { + let mut a_leading_zeroes = 0; + if a_char == '0' { + a_leading_zeroes = 1; + while let Some('0') = a.peek() { + a_leading_zeroes += 1; + a.next(); + } + } + + let mut b_leading_zeroes = 0; + if b_char == '0' { + b_leading_zeroes = 1; + while let Some('0') = b.peek() { + b_leading_zeroes += 1; + b.next(); + } + } + // The first different number of leading zeros determines the order + // so if it's already been determined by a previous number, we leave + // it as that ordering. + // It's b.cmp(&a), because the *largest* number of leading zeros + // should go first + if leading_zeroes == Ordering::Equal { + leading_zeroes = b_leading_zeroes.cmp(&a_leading_zeroes); + } + + let mut a_str = String::new(); + let mut b_str = String::new(); + if a_char != '0' { + a_str.push(a_char); + } + if b_char != '0' { + b_str.push(b_char); + } + + // Unwrapping here is fine because we only call next if peek returns + // Some(_), so next should also return Some(_). + while let Some('0'..='9') = a.peek() { + a_str.push(a.next().unwrap()); + } + + while let Some('0'..='9') = b.peek() { + b_str.push(b.next().unwrap()); + } + + // Since the leading zeroes are stripped, the length can be + // used to compare the numbers. + match a_str.len().cmp(&b_str.len()) { + Ordering::Equal => {} + x => return x, + } + + // At this point, leading zeroes are stripped and the lengths + // are equal, meaning that the strings can be compared using + // the standard compare function. + match a_str.cmp(&b_str) { + Ordering::Equal => {} + x => return x, + } + } + // If there are two characters we just compare the characters + (Some(a_char), Some(b_char)) => match a_char.cmp(&b_char) { + Ordering::Equal => {} + x => return x, + }, + // Otherise, we compare the options (because None < Some(_)) + (a_opt, b_opt) => match a_opt.cmp(&b_opt) { + // If they are completely equal except for leading zeroes, we use the leading zeroes. + Ordering::Equal => return leading_zeroes, + x => return x, + }, + } + } +} + +#[cfg(test)] +mod tests { + use crate::version_cmp::version_cmp; + use std::cmp::Ordering; + use std::path::PathBuf; + #[test] + fn test_version_cmp() { + // Identical strings + assert_eq!( + version_cmp(&PathBuf::from("hello"), &PathBuf::from("hello")), + Ordering::Equal + ); + + assert_eq!( + version_cmp(&PathBuf::from("file12"), &PathBuf::from("file12")), + Ordering::Equal + ); + + assert_eq!( + version_cmp( + &PathBuf::from("file12-suffix"), + &PathBuf::from("file12-suffix") + ), + Ordering::Equal + ); + + assert_eq!( + version_cmp( + &PathBuf::from("file12-suffix24"), + &PathBuf::from("file12-suffix24") + ), + Ordering::Equal + ); + + // Shortened names + assert_eq!( + version_cmp(&PathBuf::from("world"), &PathBuf::from("wo")), + Ordering::Greater, + ); + + assert_eq!( + version_cmp(&PathBuf::from("hello10wo"), &PathBuf::from("hello10world")), + Ordering::Less, + ); + + // Simple names + assert_eq!( + version_cmp(&PathBuf::from("world"), &PathBuf::from("hello")), + Ordering::Greater, + ); + + assert_eq!( + version_cmp(&PathBuf::from("hello"), &PathBuf::from("world")), + Ordering::Less + ); + + assert_eq!( + version_cmp(&PathBuf::from("apple"), &PathBuf::from("ant")), + Ordering::Greater + ); + + assert_eq!( + version_cmp(&PathBuf::from("ant"), &PathBuf::from("apple")), + Ordering::Less + ); + + // Uppercase letters + assert_eq!( + version_cmp(&PathBuf::from("Beef"), &PathBuf::from("apple")), + Ordering::Less, + "Uppercase letters are sorted before all lowercase letters" + ); + + assert_eq!( + version_cmp(&PathBuf::from("Apple"), &PathBuf::from("apple")), + Ordering::Less + ); + + assert_eq!( + version_cmp(&PathBuf::from("apple"), &PathBuf::from("aPple")), + Ordering::Greater + ); + + // Numbers + assert_eq!( + version_cmp(&PathBuf::from("100"), &PathBuf::from("20")), + Ordering::Greater, + "Greater numbers are greater even if they start with a smaller digit", + ); + + assert_eq!( + version_cmp(&PathBuf::from("20"), &PathBuf::from("20")), + Ordering::Equal, + "Equal numbers are equal" + ); + + assert_eq!( + version_cmp(&PathBuf::from("15"), &PathBuf::from("200")), + Ordering::Less, + "Small numbers are smaller" + ); + + // Comparing numbers with other characters + assert_eq!( + version_cmp(&PathBuf::from("1000"), &PathBuf::from("apple")), + Ordering::Less, + "Numbers are sorted before other characters" + ); + + assert_eq!( + version_cmp(&PathBuf::from("file1000"), &PathBuf::from("fileapple")), + Ordering::Less, + "Numbers in the middle of the name are sorted before other characters" + ); + + // Leading zeroes + assert_eq!( + version_cmp(&PathBuf::from("012"), &PathBuf::from("12")), + Ordering::Less, + "A single leading zero can make a difference" + ); + + assert_eq!( + version_cmp(&PathBuf::from("000800"), &PathBuf::from("0000800")), + Ordering::Greater, + "Leading number of zeroes is used even if both non-zero number of zeros" + ); + + // Numbers and other characters combined + assert_eq!( + version_cmp(&PathBuf::from("ab10"), &PathBuf::from("aa11")), + Ordering::Greater + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa10"), &PathBuf::from("aa11")), + Ordering::Less, + "Numbers after other characters are handled correctly." + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa2"), &PathBuf::from("aa100")), + Ordering::Less, + "Numbers after alphabetical characters are handled correctly." + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa10bb"), &PathBuf::from("aa11aa")), + Ordering::Less, + "Number is used even if alphabetical characters after it differ." + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa10aa0010"), &PathBuf::from("aa11aa1")), + Ordering::Less, + "Second number is ignored if the first number differs." + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa10aa0010"), &PathBuf::from("aa10aa1")), + Ordering::Greater, + "Second number is used if the rest is equal." + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa10aa0010"), &PathBuf::from("aa00010aa1")), + Ordering::Greater, + "Second number is used if the rest is equal up to leading zeroes of the first number." + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa10aa0022"), &PathBuf::from("aa010aa022")), + Ordering::Greater, + "The leading zeroes of the first number has priority." + ); + + assert_eq!( + version_cmp(&PathBuf::from("aa10aa0022"), &PathBuf::from("aa10aa022")), + Ordering::Less, + "The leading zeroes of other numbers than the first are used." + ); + + assert_eq!( + version_cmp(&PathBuf::from("file-1.4"), &PathBuf::from("file-1.13")), + Ordering::Less, + "Periods are handled as normal text, not as a decimal point." + ); + + // Greater than u64::Max + // u64 == 18446744073709551615 so this should be plenty: + // 20000000000000000000000 + assert_eq!( + version_cmp( + &PathBuf::from("aa2000000000000000000000bb"), + &PathBuf::from("aa002000000000000000000001bb") + ), + Ordering::Less, + "Numbers larger than u64::MAX are handled correctly without crashing" + ); + + assert_eq!( + version_cmp( + &PathBuf::from("aa2000000000000000000000bb"), + &PathBuf::from("aa002000000000000000000000bb") + ), + Ordering::Greater, + "Leading zeroes for numbers larger than u64::MAX are handled correctly without crashing" + ); + } +} diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index ecd288735..091d47234 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -526,7 +526,6 @@ fn test_ls_order_time() { at.metadata("test-2").permissions(), ) .unwrap(); - let second_access = at.open("test-2").metadata().unwrap().accessed().unwrap(); let result = scene.ucmd().arg("-al").run(); println!("stderr = {:?}", result.stderr); @@ -870,3 +869,81 @@ fn test_ls_hidden_windows() { assert!(result.success); assert!(result.stdout.contains(file)); } + +#[test] +fn test_ls_version_sort() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + for filename in &[ + "a2", + "b1", + "b20", + "a1.4", + "a1.40", + "b3", + "b11", + "b20b", + "b20a", + "a100", + "a1.13", + "aa", + "a1", + "aaa", + "a1.00000040", + "abab", + "ab", + "a01.40", + "a001.001", + "a01.0000001", + "a01.001", + "a001.01", + ] { + at.touch(filename); + } + + let mut expected = vec![ + "a1", + "a001.001", + "a001.01", + "a01.0000001", + "a01.001", + "a1.4", + "a1.13", + "a01.40", + "a1.00000040", + "a1.40", + "a2", + "a100", + "aa", + "aaa", + "ab", + "abab", + "b1", + "b3", + "b11", + "b20", + "b20a", + "b20b", + "", // because of '\n' at the end of the output + ]; + + let result = scene.ucmd().arg("-1v").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + + assert_eq!(result.stdout.split('\n').collect::>(), expected); + + let result = scene.ucmd().arg("-1").arg("--sort=version").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + + assert_eq!(result.stdout.split('\n').collect::>(), expected); + + let result = scene.ucmd().arg("-a1v").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + + expected.insert(0, ".."); + expected.insert(0, "."); + assert_eq!(result.stdout.split('\n').collect::>(), expected,) +} From 61eb4f250d761e893168a6345fbf1f4c0338280b Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Thu, 25 Mar 2021 23:04:02 +0100 Subject: [PATCH 501/606] rm: add more tests --- src/uu/rm/src/rm.rs | 9 ++--- tests/by-util/test_rm.rs | 77 ++++++++++++++++++++++++++++++---------- 2 files changed, 61 insertions(+), 25 deletions(-) diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 6e26cb82a..033a1a4aa 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -233,7 +233,7 @@ fn remove(files: Vec, options: Options) -> bool { // (e.g., permission), even rm -f should fail with // outputting the error, but there's no easy eay. if !options.force { - show_error!("no such file or directory '{}'", filename); + show_error!("cannot remove '{}': No such file or directory", filename); true } else { false @@ -289,7 +289,7 @@ fn handle_dir(path: &Path, options: &Options) -> bool { had_err = true; } else { show_error!( - "could not remove directory '{}' (did you mean to pass '-r' or '-R'?)", + "cannot remove '{}': Is a directory", // GNU's rm error message does not include help path.display() ); had_err = true; @@ -326,10 +326,7 @@ fn remove_dir(path: &Path, options: &Options) -> bool { } } else { // called to remove a symlink_dir (windows) without "-r"/"-R" or "-d" - show_error!( - "could not remove directory '{}' (did you mean to pass '-r' or '-R'?)", - path.display() - ); + show_error!("cannot remove '{}': Is a directory", path.display()); return true; } } else { diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 9556bf8e7..149d509c5 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -17,7 +17,12 @@ fn test_rm_failed() { let (_at, mut ucmd) = at_and_ucmd!(); let file = "test_rm_one_file"; - ucmd.arg(file).fails(); // Doesn't exist + let result = ucmd.arg(file).fails(); // Doesn't exist + + assert!(result.stderr.contains(&format!( + "cannot remove '{}': No such file or directory", + file + ))); } #[test] @@ -115,6 +120,22 @@ fn test_rm_empty_directory() { assert!(!at.dir_exists(dir)); } +#[test] +fn test_rm_empty_directory_verbose() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir = "test_rm_empty_directory_verbose"; + + at.mkdir(dir); + + ucmd.arg("-d") + .arg("-v") + .arg(dir) + .succeeds() + .stdout_only(format!("removed directory '{}'\n", dir)); + + assert!(!at.dir_exists(dir)); +} + #[test] fn test_rm_non_empty_directory() { let (at, mut ucmd) = at_and_ucmd!(); @@ -151,22 +172,17 @@ fn test_rm_recursive() { } #[test] -fn test_rm_errors() { +fn test_rm_directory_without_flag() { let (at, mut ucmd) = at_and_ucmd!(); - let dir = "test_rm_errors_directory"; - let file_a = "test_rm_errors_directory/test_rm_errors_file_a"; - let file_b = "test_rm_errors_directory/test_rm_errors_file_b"; + let dir = "test_rm_directory_without_flag_dir"; at.mkdir(dir); - at.touch(file_a); - at.touch(file_b); - // $ rm test_rm_errors_directory - // rm: error: could not remove directory 'test_rm_errors_directory' (did you mean to pass '-r'?) - ucmd.arg(dir).fails().stderr_is( - "rm: error: could not remove directory 'test_rm_errors_directory' (did you mean \ - to pass '-r' or '-R'?)\n", - ); + let result = ucmd.arg(dir).fails(); + println!("{}", result.stderr); + assert!(result + .stderr + .contains(&format!("cannot remove '{}': Is a directory", dir))); } #[test] @@ -186,18 +202,41 @@ fn test_rm_verbose() { } #[test] -fn test_rm_dir_symlink() { +#[cfg(not(windows))] +// on unix symlink_dir is a file +fn test_rm_symlink_dir() { let (at, mut ucmd) = at_and_ucmd!(); - let dir = "test_rm_dir_symlink_dir"; - let link = "test_rm_dir_symlink_link"; + + let dir = "test_rm_symlink_dir_directory"; + let link = "test_rm_symlink_dir_link"; at.mkdir(dir); at.symlink_dir(dir, link); - #[cfg(not(windows))] ucmd.arg(link).succeeds(); - #[cfg(windows)] - ucmd.arg("-r").arg(link).succeeds(); +} + +#[test] +#[cfg(windows)] +// on windows removing symlink_dir requires "-r" or "-d" +fn test_rm_symlink_dir() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let dir = "test_rm_symlink_dir_directory"; + let link = "test_rm_symlink_dir_link"; + + at.mkdir(dir); + at.symlink_dir(dir, link); + + let result = scene.ucmd().arg(link).fails(); + assert!(result + .stderr + .contains(&format!("cannot remove '{}': Is a directory", link))); + + assert!(at.dir_exists(link)); + + scene.ucmd().arg("-r").arg(link).succeeds(); } #[test] From f431f58dd890ea9dad386233c18b9555182fcb46 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 25 Mar 2021 23:28:47 +0100 Subject: [PATCH 502/606] Bump min rustc to 1.40 (#1909) --- .github/workflows/CICD.yml | 2 +- .travis.yml | 2 +- Cargo.lock | 60 +++++++++++++------------------------- Cargo.toml | 8 ++--- README.md | 2 +- 5 files changed, 26 insertions(+), 48 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 97369a8e7..f1ddf9be1 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -11,7 +11,7 @@ env: PROJECT_NAME: coreutils PROJECT_DESC: "Core universal (cross-platform) utilities" PROJECT_AUTH: "uutils" - RUST_MIN_SRV: "1.33.0" ## v1.33.0 - minimum version for tempfile 3.1.0 and libc needed for aarch64 + RUST_MIN_SRV: "1.40.0" ## v1.40.0 RUST_COV_SRV: "2020-08-01" ## (~v1.47.0) supported rust version for code coverage; (date required/used by 'coverage') ## !maint: refactor when code coverage support is included in the stable channel on: [push, pull_request] diff --git a/.travis.yml b/.travis.yml index 3cd7db130..27525b5f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ matrix: - rust: nightly fast_finish: true include: - - rust: 1.33.0 + - rust: 1.40.0 env: FEATURES=unix # - rust: stable # os: linux diff --git a/Cargo.lock b/Cargo.lock index aabac3783..4851a6e13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "advapi32-sys" version = "0.2.0" @@ -105,7 +107,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" -version = "1.3.4" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -118,7 +120,7 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.61" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -180,8 +182,6 @@ dependencies = [ name = "coreutils" version = "0.0.4" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -189,12 +189,9 @@ dependencies = [ "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -296,7 +293,6 @@ dependencies = [ "uu_yes 0.0.4", "uucore 0.0.7", "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -312,7 +308,7 @@ name = "cpp_build" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -347,7 +343,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -728,7 +724,7 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -791,7 +787,7 @@ name = "onig_sys" version = "69.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1033,7 +1029,7 @@ name = "regex-automata" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1054,11 +1050,6 @@ name = "rust-ini" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "rustc-demangle" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "rustc_version" version = "0.2.3" @@ -1074,10 +1065,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "same-file" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1263,14 +1254,6 @@ dependencies = [ "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "thread_local" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "time" version = "0.1.42" @@ -1866,7 +1849,7 @@ dependencies = [ name = "uu_od" version = "0.0.4" dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1887,7 +1870,7 @@ dependencies = [ name = "uu_pathchk" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -1924,6 +1907,7 @@ name = "uu_ptx" version = "0.0.4" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2348,9 +2332,9 @@ name = "walkdir" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2450,7 +2434,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi-util" -version = "0.1.2" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2484,9 +2468,9 @@ dependencies = [ "checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" "checksum bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" -"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +"checksum byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" "checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" -"checksum cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)" = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" +"checksum cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)" = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" "checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" "checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" @@ -2589,10 +2573,9 @@ dependencies = [ "checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" -"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" +"checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" "checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" @@ -2614,7 +2597,6 @@ dependencies = [ "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" "checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" -"checksum thread_local 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" "checksum typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" @@ -2639,6 +2621,6 @@ dependencies = [ "checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" +"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" diff --git a/Cargo.toml b/Cargo.toml index bf11e66fa..208fd5d9c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -326,12 +326,8 @@ whoami = { optional=true, version="0.0.4", package="uu_whoami", path="src/uu/w yes = { optional=true, version="0.0.4", package="uu_yes", path="src/uu/yes" } # # * pinned transitive dependencies -pin_cc = { version="1.0.61, < 1.0.62", package="cc" } ## cc v1.0.62 has compiler errors for MinRustV v1.32.0, requires 1.34 (for `std::str::split_ascii_whitespace()`) -pin_rustc-demangle = { version="0.1.16, < 0.1.17", package="rustc-demangle" } ## rust-demangle v0.1.17 has compiler errors for MinRustV v1.32.0, expects 1.33 -pin_same-file = { version="1.0.4, < 1.0.6", package="same-file" } ## same-file v1.0.6 has compiler errors for MinRustV v1.32.0, expects 1.34 -pin_winapi-util = { version="0.1.2, < 0.1.3", package="winapi-util" } ## winapi-util v0.1.3 has compiler errors for MinRustV v1.32.0, expects 1.34 -pin_byteorder = { version="1.3.4, < 1.4.0", package="byteorder" } ## byteorder v1.4 has compiler errors for MinRustV v1.32.0, requires 1.3 (for `use of unstable library feature 'try_from' (see issue #33417)`) -pin_thread_local = { version="1.1.0, < 1.1.1", package="thread_local" } ## thread_local v1.1.2 has compiler errors for MinRustV v1.32.0, requires 1.36 (for `use of unstable library feature 'maybe_uninit'`) +# Not needed for now. Keep as examples: +#pin_cc = { version="1.0.61, < 1.0.62", package="cc" } ## cc v1.0.62 has compiler errors for MinRustV v1.32.0, requires 1.34 (for `std::str::split_ascii_whitespace()`) [dev-dependencies] conv = "0.3" diff --git a/README.md b/README.md index da92c80c2..7433f49e6 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Requirements ### Rust Version ### uutils follows Rust's release channels and is tested against stable, beta and nightly. -The current oldest supported version of the Rust compiler is `1.33.0`. +The current oldest supported version of the Rust compiler is `1.40.0`. On both Windows and Redox, only the nightly version is tested currently. From 035f811dd06f934cde7bc7a4bd48eb91184c2be0 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Fri, 26 Mar 2021 13:09:16 +0300 Subject: [PATCH 503/606] Fix "panic message is not a string literal" warnings (#1915) New in Rust 1.51. Closes #1914 --- src/uu/tail/src/tail.rs | 6 +++--- src/uucore_procs/src/lib.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 3a6b04b29..ffe27e26c 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -382,7 +382,7 @@ fn follow(readers: &mut [BufReader], filenames: &[String], settings: } print!("{}", datum); } - Err(err) => panic!(err), + Err(err) => panic!("{}", err), } } } @@ -509,7 +509,7 @@ fn unbounded_tail(reader: &mut BufReader, settings: &Settings) { ringbuf.push_back(datum); } } - Err(err) => panic!(err), + Err(err) => panic!("{}", err), } } let mut stdout = stdout(); @@ -540,7 +540,7 @@ fn unbounded_tail(reader: &mut BufReader, settings: &Settings) { ringbuf.push_back(datum[0]); } } - Err(err) => panic!(err), + Err(err) => panic!("{}", err), } } let mut stdout = stdout(); diff --git a/src/uucore_procs/src/lib.rs b/src/uucore_procs/src/lib.rs index aa77316ee..10368a5bd 100644 --- a/src/uucore_procs/src/lib.rs +++ b/src/uucore_procs/src/lib.rs @@ -56,10 +56,10 @@ pub fn main(stream: proc_macro::TokenStream) -> proc_macro::TokenStream { let mut expr = match expr { syn::Expr::Lit(expr_lit) => match expr_lit.lit { syn::Lit::Str(ref lit_str) => lit_str.parse::().unwrap(), - _ => panic!(ARG_PANIC_TEXT), + _ => panic!("{}", ARG_PANIC_TEXT), }, syn::Expr::Path(expr_path) => expr_path, - _ => panic!(ARG_PANIC_TEXT), + _ => panic!("{}", ARG_PANIC_TEXT), }; proc_dbg!(&expr); From 83f8140aafe80a9683eb008362caedef87edd831 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Fri, 26 Mar 2021 19:26:37 +0300 Subject: [PATCH 504/606] cat: move cat to clap (#1910) --- src/uu/cat/Cargo.toml | 1 + src/uu/cat/src/cat.rs | 142 ++++++++++++++++++++++++++++++++---------- 2 files changed, 109 insertions(+), 34 deletions(-) diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 415477588..b6254cf6b 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/cat.rs" [dependencies] +clap = "2.33" quick-error = "1.2.3" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index 0a35e243b..cf5a384a4 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -17,6 +17,7 @@ extern crate unix_socket; extern crate uucore; // last synced with: cat (GNU coreutils) 8.13 +use clap::{App, Arg}; use quick_error::ResultExt; use std::fs::{metadata, File}; use std::io::{self, stderr, stdin, stdout, BufWriter, Read, Write}; @@ -30,10 +31,11 @@ use std::os::unix::fs::FileTypeExt; #[cfg(unix)] use unix_socket::UnixStream; +static NAME: &str = "cat"; +static VERSION: &str = env!("CARGO_PKG_VERSION"); static SYNTAX: &str = "[OPTION]... [FILE]..."; static SUMMARY: &str = "Concatenate FILE(s), or standard input, to standard output With no FILE, or when FILE is -, read standard input."; -static LONG_HELP: &str = ""; #[derive(PartialEq)] enum NumberingMode { @@ -124,50 +126,122 @@ enum InputType { type CatResult = Result; +mod options { + pub static FILE: &str = "file"; + pub static SHOW_ALL: &str = "show-all"; + pub static NUMBER_NONBLANK: &str = "number-nonblank"; + pub static SHOW_NONPRINTING_ENDS: &str = "e"; + pub static SHOW_ENDS: &str = "show-ends"; + pub static NUMBER: &str = "number"; + pub static SQUEEZE_BLANK: &str = "squeeze-blank"; + pub static SHOW_NONPRINTING_TABS: &str = "t"; + pub static SHOW_TABS: &str = "show-tabs"; + pub static SHOW_NONPRINTING: &str = "show-nonprinting"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optflag("A", "show-all", "equivalent to -vET") - .optflag( - "b", - "number-nonblank", - "number nonempty output lines, overrides -n", + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(SYNTAX) + .about(SUMMARY) + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) + .arg( + Arg::with_name(options::SHOW_ALL) + .short("A") + .long(options::SHOW_ALL) + .help("equivalent to -vET"), ) - .optflag("e", "", "equivalent to -vE") - .optflag("E", "show-ends", "display $ at end of each line") - .optflag("n", "number", "number all output lines") - .optflag("s", "squeeze-blank", "suppress repeated empty output lines") - .optflag("t", "", "equivalent to -vT") - .optflag("T", "show-tabs", "display TAB characters as ^I") - .optflag( - "v", - "show-nonprinting", - "use ^ and M- notation, except for LF (\\n) and TAB (\\t)", + .arg( + Arg::with_name(options::NUMBER_NONBLANK) + .short("b") + .long(options::NUMBER_NONBLANK) + .help("number nonempty output lines, overrides -n") + .overrides_with(options::NUMBER), ) - .parse(args); + .arg( + Arg::with_name(options::SHOW_NONPRINTING_ENDS) + .short("e") + .help("equivalent to -vE"), + ) + .arg( + Arg::with_name(options::SHOW_ENDS) + .short("E") + .long(options::SHOW_ENDS) + .help("display $ at end of each line"), + ) + .arg( + Arg::with_name(options::NUMBER) + .short("n") + .long(options::NUMBER) + .help("number all output lines"), + ) + .arg( + Arg::with_name(options::SQUEEZE_BLANK) + .short("s") + .long(options::SQUEEZE_BLANK) + .help("suppress repeated empty output lines"), + ) + .arg( + Arg::with_name(options::SHOW_NONPRINTING_TABS) + .short("t") + .long(options::SHOW_NONPRINTING_TABS) + .help("equivalent to -vT"), + ) + .arg( + Arg::with_name(options::SHOW_TABS) + .short("T") + .long(options::SHOW_TABS) + .help("display TAB characters at ^I"), + ) + .arg( + Arg::with_name(options::SHOW_NONPRINTING) + .short("v") + .long(options::SHOW_NONPRINTING) + .help("use ^ and M- notation, except for LF (\\n) and TAB (\\t)"), + ) + .get_matches_from(args); - let number_mode = if matches.opt_present("b") { + let number_mode = if matches.is_present(options::NUMBER_NONBLANK) { NumberingMode::NonEmpty - } else if matches.opt_present("n") { + } else if matches.is_present(options::NUMBER) { NumberingMode::All } else { NumberingMode::None }; - let show_nonprint = matches.opts_present(&[ - "A".to_owned(), - "e".to_owned(), - "t".to_owned(), - "v".to_owned(), - ]); - let show_ends = matches.opts_present(&["E".to_owned(), "A".to_owned(), "e".to_owned()]); - let show_tabs = matches.opts_present(&["A".to_owned(), "T".to_owned(), "t".to_owned()]); - let squeeze_blank = matches.opt_present("s"); - let mut files = matches.free; - if files.is_empty() { - files.push("-".to_owned()); - } + let show_nonprint = vec![ + options::SHOW_ALL.to_owned(), + options::SHOW_NONPRINTING_ENDS.to_owned(), + options::SHOW_NONPRINTING_TABS.to_owned(), + options::SHOW_NONPRINTING.to_owned(), + ] + .iter() + .any(|v| matches.is_present(v)); + + let show_ends = vec![ + options::SHOW_ENDS.to_owned(), + options::SHOW_ALL.to_owned(), + options::SHOW_NONPRINTING_ENDS.to_owned(), + ] + .iter() + .any(|v| matches.is_present(v)); + + let show_tabs = vec![ + options::SHOW_ALL.to_owned(), + options::SHOW_TABS.to_owned(), + options::SHOW_NONPRINTING_TABS.to_owned(), + ] + .iter() + .any(|v| matches.is_present(v)); + + let squeeze_blank = matches.is_present(options::SQUEEZE_BLANK); + let files: Vec = match matches.values_of(options::FILE) { + Some(v) => v.clone().map(|v| v.to_owned()).collect(), + None => vec!["-".to_owned()], + }; let can_write_fast = !(show_tabs || show_nonprint @@ -361,7 +435,7 @@ fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState } writer.write_all(options.end_of_line.as_bytes())?; if handle.is_interactive { - writer.flush().context(&file[..])?; + writer.flush().context(file)?; } } state.at_line_start = true; From 955c547adffda3546ab6b9fb58d7d508f439eb3f Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 26 Mar 2021 19:12:01 +0100 Subject: [PATCH 505/606] ls: overrideable `-n` option (#1917) --- src/uu/ls/src/ls.rs | 87 +++++++++++++++++++--------------------- tests/by-util/test_ls.rs | 61 ++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 45 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 8714a0fa1..201ddc7a6 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -84,6 +84,7 @@ pub mod options { pub static COMMAS: &str = "m"; pub static LONG_NO_OWNER: &str = "g"; pub static LONG_NO_GROUP: &str = "o"; + pub static LONG_NUMERIC_UID_GID: &str = "numeric-uid-gid"; } pub mod files { pub static ALL: &str = "all"; @@ -114,7 +115,6 @@ pub mod options { pub static CLASSIFY: &str = "classify"; pub static INODE: &str = "inode"; pub static DEREFERENCE: &str = "dereference"; - pub static NUMERIC_UID_GID: &str = "numeric-uid-gid"; pub static REVERSE: &str = "reverse"; pub static RECURSIVE: &str = "recursive"; pub static COLOR: &str = "color"; @@ -167,7 +167,6 @@ struct Config { classify: bool, ignore_backups: bool, size_format: SizeFormat, - numeric_uid_gid: bool, directory: bool, time: Time, #[cfg(unix)] @@ -183,6 +182,8 @@ struct LongFormat { author: bool, group: bool, owner: bool, + #[cfg(unix)] + numeric_uid_gid: bool, } impl Config { @@ -210,7 +211,7 @@ impl Config { (Format::Columns, options::format::COLUMNS) }; - // The -o and -g options are tricky. They cannot override with each + // The -o, -n and -g options are tricky. They cannot override with each // other because it's possible to combine them. For example, the option // -og should hide both owner and group. Furthermore, they are not // reset if -l or --format=long is used. So these should just show the @@ -223,42 +224,26 @@ impl Config { // which always applies. // // The idea here is to not let these options override with the other - // options, but manually check the last index they occur. If this index - // is larger than the index for the other format options, we apply the - // long format. - match options.indices_of(opt).map(|x| x.max().unwrap()) { - None => { - if options.is_present(options::format::LONG_NO_GROUP) - || options.is_present(options::format::LONG_NO_OWNER) - { - format = Format::Long; - } else if options.is_present(options::format::ONELINE) { - format = Format::OneLine; - } - } - Some(mut idx) => { - if let Some(indices) = options.indices_of(options::format::LONG_NO_OWNER) { - let i = indices.max().unwrap(); - if i > idx { - format = Format::Long; - idx = i; - } - } - if let Some(indices) = options.indices_of(options::format::LONG_NO_GROUP) { - let i = indices.max().unwrap(); - if i > idx { - format = Format::Long; - idx = i; - } - } - if let Some(indices) = options.indices_of(options::format::ONELINE) { - let i = indices.max().unwrap(); - if i > idx && format != Format::Long { + // options, but manually whether they have an index that's greater than + // the other format options. If so, we set the appropriate format. + if format != Format::Long { + let idx = options.indices_of(opt).map(|x| x.max().unwrap()).unwrap_or(0); + if [options::format::LONG_NO_OWNER, options::format::LONG_NO_GROUP, options::format::LONG_NUMERIC_UID_GID] + .iter() + .flat_map(|opt| options.indices_of(opt)) + .flatten() + .any(|i| i >= idx) + { + format = Format::Long; + } else { + if let Some(mut indices) = options.indices_of(options::format::ONELINE) { + if indices.any(|i| i > idx) { format = Format::OneLine; } } } } + let files = if options.is_present(options::files::ALL) { Files::All @@ -328,10 +313,14 @@ impl Config { let group = !options.is_present(options::NO_GROUP) && !options.is_present(options::format::LONG_NO_GROUP); let owner = !options.is_present(options::format::LONG_NO_OWNER); + #[cfg(unix)] + let numeric_uid_gid = options.is_present(options::format::LONG_NUMERIC_UID_GID); LongFormat { author, group, owner, + #[cfg(unix)] + numeric_uid_gid, } }; @@ -355,7 +344,6 @@ impl Config { classify: options.is_present(options::CLASSIFY), ignore_backups: options.is_present(options::IGNORE_BACKUPS), size_format, - numeric_uid_gid: options.is_present(options::NUMERIC_UID_GID), directory: options.is_present(options::DIRECTORY), time, #[cfg(unix)] @@ -444,22 +432,36 @@ pub fn uumain(args: impl uucore::Args) -> i32 { options::format::COLUMNS, ]), ) - // The next three arguments do not override with the other format + // The next four arguments do not override with the other format // options, see the comment in Config::from for the reason. + // Ideally, they would use Arg::override_with, with their own name + // but that doesn't seem to work in all cases. Example: + // ls -1g1 + // even though `ls -11` and `ls -1 -g -1` work. .arg( Arg::with_name(options::format::ONELINE) .short(options::format::ONELINE) .help("List one file per line.") + .multiple(true) ) .arg( Arg::with_name(options::format::LONG_NO_GROUP) .short(options::format::LONG_NO_GROUP) .help("Long format without group information. Identical to --format=long with --no-group.") + .multiple(true) ) .arg( Arg::with_name(options::format::LONG_NO_OWNER) .short(options::format::LONG_NO_OWNER) .help("Long format without owner information.") + .multiple(true) + ) + .arg( + Arg::with_name(options::format::LONG_NUMERIC_UID_GID) + .short("n") + .long(options::format::LONG_NUMERIC_UID_GID) + .help("-l with numeric UIDs and GIDs.") + .multiple(true) ) // Time arguments @@ -657,12 +659,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { file the link references rather than the link itself.", ), ) - .arg( - Arg::with_name(options::NUMERIC_UID_GID) - .short("n") - .long(options::NUMERIC_UID_GID) - .help("-l with numeric UIDs and GIDs."), - ) + .arg( Arg::with_name(options::REVERSE) .short("r") @@ -852,7 +849,7 @@ fn pad_left(string: String, count: usize) -> String { } fn display_items(items: &[PathBuf], strip: Option<&Path>, config: &Config) { - if config.format == Format::Long || config.numeric_uid_gid { + if config.format == Format::Long { let (mut max_links, mut max_size) = (1, 1); for item in items { let (links, size) = display_dir_entry_size(item, config); @@ -994,7 +991,7 @@ use uucore::entries; #[cfg(unix)] fn display_uname(metadata: &Metadata, config: &Config) -> String { - if config.numeric_uid_gid { + if config.long.numeric_uid_gid { metadata.uid().to_string() } else { entries::uid2usr(metadata.uid()).unwrap_or_else(|_| metadata.uid().to_string()) @@ -1003,7 +1000,7 @@ fn display_uname(metadata: &Metadata, config: &Config) -> String { #[cfg(unix)] fn display_group(metadata: &Metadata, config: &Config) -> String { - if config.numeric_uid_gid { + if config.long.numeric_uid_gid { metadata.gid().to_string() } else { entries::gid2grp(metadata.gid()).unwrap_or_else(|_| metadata.gid().to_string()) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 091d47234..7d5a3da7b 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -297,15 +297,24 @@ fn test_ls_long_formats() { // Regex for three names, so all of author, group and owner let re_three = Regex::new(r"[xrw-]{9} \d ([-0-9_a-z]+ ){3}0").unwrap(); + #[cfg(unix)] + let re_three_num = Regex::new(r"[xrw-]{9} \d (\d+ ){3}0").unwrap(); + // Regex for two names, either: // - group and owner // - author and owner // - author and group let re_two = Regex::new(r"[xrw-]{9} \d ([-0-9_a-z]+ ){2}0").unwrap(); + #[cfg(unix)] + let re_two_num = Regex::new(r"[xrw-]{9} \d (\d+ ){2}0").unwrap(); + // Regex for one name: author, group or owner let re_one = Regex::new(r"[xrw-]{9} \d [-0-9_a-z]+ 0").unwrap(); + #[cfg(unix)] + let re_one_num = Regex::new(r"[xrw-]{9} \d \d+ 0").unwrap(); + // Regex for no names let re_zero = Regex::new(r"[xrw-]{9} \d 0").unwrap(); @@ -329,6 +338,19 @@ fn test_ls_long_formats() { println!("stdout = {:?}", result.stdout); assert!(re_three.is_match(&result.stdout)); + #[cfg(unix)] + { + let result = scene + .ucmd() + .arg("-n") + .arg("--author") + .arg("test-long-formats") + .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_three_num.is_match(&result.stdout)); + } + for arg in &[ "-l", // only group and owner "-g --author", // only author and group @@ -344,6 +366,19 @@ fn test_ls_long_formats() { println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(re_two.is_match(&result.stdout)); + + #[cfg(unix)] + { + let result = scene + .ucmd() + .arg("-n") + .args(&arg.split(" ").collect::>()) + .arg("test-long-formats") + .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_two_num.is_match(&result.stdout)); + } } for arg in &[ @@ -364,6 +399,19 @@ fn test_ls_long_formats() { println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(re_one.is_match(&result.stdout)); + + #[cfg(unix)] + { + let result = scene + .ucmd() + .arg("-n") + .args(&arg.split(" ").collect::>()) + .arg("test-long-formats") + .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_one_num.is_match(&result.stdout)); + } } for arg in &[ @@ -387,6 +435,19 @@ fn test_ls_long_formats() { println!("stderr = {:?}", result.stderr); println!("stdout = {:?}", result.stdout); assert!(re_zero.is_match(&result.stdout)); + + #[cfg(unix)] + { + let result = scene + .ucmd() + .arg("-n") + .args(&arg.split(" ").collect::>()) + .arg("test-long-formats") + .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert!(re_zero.is_match(&result.stdout)); + } } } From 3ca21940f8c8f75c3948ed07465a26cf0dc0f960 Mon Sep 17 00:00:00 2001 From: Rein F Date: Sat, 27 Mar 2021 08:55:31 +0100 Subject: [PATCH 506/606] nl: move from getopts to clap (#1921) --- src/uu/nl/Cargo.toml | 2 +- src/uu/nl/src/helper.rs | 26 +++--- src/uu/nl/src/nl.rs | 202 +++++++++++++++++++++------------------- 3 files changed, 119 insertions(+), 111 deletions(-) diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index d5cddbde2..41f7c60ab 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/nl.rs" [dependencies] +clap = "2.33.3" aho-corasick = "0.7.3" -getopts = "0.2.18" libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index 9b98129f1..94ff835d7 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -1,5 +1,7 @@ // spell-checker:ignore (ToDO) conv +use crate::options; + // parse_style parses a style string into a NumberingStyle. fn parse_style(chars: &[char]) -> Result { if chars.len() == 1 && chars[0] == 'a' { @@ -23,17 +25,17 @@ fn parse_style(chars: &[char]) -> Result { // parse_options loads the options into the settings, returning an array of // error messages. -pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> Vec { +pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> Vec { // This vector holds error messages encountered. let mut errs: Vec = vec![]; - settings.renumber = !opts.opt_present("p"); - match opts.opt_str("s") { + settings.renumber = !opts.is_present(options::NO_RENUMBER); + match opts.value_of(options::NUMER_SEPARATOR) { None => {} Some(val) => { - settings.number_separator = val; + settings.number_separator = val.to_owned(); } } - match opts.opt_str("n") { + match opts.value_of(options::NUMBER_FORMAT) { None => {} Some(val) => match val.as_ref() { "ln" => { @@ -50,7 +52,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> } }, } - match opts.opt_str("b") { + match opts.value_of(options::BODY_NUMBERING) { None => {} Some(val) => { let chars: Vec = val.chars().collect(); @@ -64,7 +66,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> } } } - match opts.opt_str("f") { + match opts.value_of(options::FOOTER_NUMBERING) { None => {} Some(val) => { let chars: Vec = val.chars().collect(); @@ -78,7 +80,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> } } } - match opts.opt_str("h") { + match opts.value_of(options::HEADER_NUMBERING) { None => {} Some(val) => { let chars: Vec = val.chars().collect(); @@ -92,7 +94,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> } } } - match opts.opt_str("i") { + match opts.value_of(options::LINE_INCREMENT) { None => {} Some(val) => { let conv: Option = val.parse().ok(); @@ -104,7 +106,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> } } } - match opts.opt_str("w") { + match opts.value_of(options::NUMBER_WIDTH) { None => {} Some(val) => { let conv: Option = val.parse().ok(); @@ -116,7 +118,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> } } } - match opts.opt_str("v") { + match opts.value_of(options::STARTING_LINE_NUMER) { None => {} Some(val) => { let conv: Option = val.parse().ok(); @@ -128,7 +130,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> } } } - match opts.opt_str("l") { + match opts.value_of(options::JOIN_BLANK_LINES) { None => {} Some(val) => { let conv: Option = val.parse().ok(); diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 47b6c3ae9..3b5b5a2e8 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -11,6 +11,7 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::iter::repeat; @@ -67,78 +68,106 @@ enum NumberFormat { RightZero, } +pub mod options { + pub const FILE: &str = "file"; + pub const BODY_NUMBERING: &str = "body-numbering"; + pub const SECTION_DELIMITER: &str = "section-delimiter"; + pub const FOOTER_NUMBERING: &str = "footer-numbering"; + pub const HEADER_NUMBERING: &str = "header-numbering"; + pub const LINE_INCREMENT: &str = "line-increment"; + pub const JOIN_BLANK_LINES: &str = "join-blank-lines"; + pub const NUMBER_FORMAT: &str = "number-format"; + pub const NO_RENUMBER: &str = "no-renumber"; + pub const NUMER_SEPARATOR: &str = "number-separator"; + pub const STARTING_LINE_NUMER: &str = "starting-line-number"; + pub const NUMBER_WIDTH: &str = "number-width"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = getopts::Options::new(); - - opts.optopt( - "b", - "body-numbering", - "use STYLE for numbering body lines", - "STYLE", - ); - opts.optopt( - "d", - "section-delimiter", - "use CC for separating logical pages", - "CC", - ); - opts.optopt( - "f", - "footer-numbering", - "use STYLE for numbering footer lines", - "STYLE", - ); - opts.optopt( - "h", - "header-numbering", - "use STYLE for numbering header lines", - "STYLE", - ); - opts.optopt( - "i", - "line-increment", - "line number increment at each line", - "", - ); - opts.optopt( - "l", - "join-blank-lines", - "group of NUMBER empty lines counted as one", - "NUMBER", - ); - opts.optopt( - "n", - "number-format", - "insert line numbers according to FORMAT", - "FORMAT", - ); - opts.optflag( - "p", - "no-renumber", - "do not reset line numbers at logical pages", - ); - opts.optopt( - "s", - "number-separator", - "add STRING after (possible) line number", - "STRING", - ); - opts.optopt( - "v", - "starting-line-number", - "first line number on each logical page", - "NUMBER", - ); - opts.optopt( - "w", - "number-width", - "use NUMBER columns for line numbers", - "NUMBER", - ); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("V", "version", "version"); + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(USAGE) + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) + .arg( + Arg::with_name(options::BODY_NUMBERING) + .short("b") + .long(options::BODY_NUMBERING) + .help("use STYLE for numbering body lines") + .value_name("SYNTAX"), + ) + .arg( + Arg::with_name(options::SECTION_DELIMITER) + .short("d") + .long(options::SECTION_DELIMITER) + .help("use CC for separating logical pages") + .value_name("CC"), + ) + .arg( + Arg::with_name(options::FOOTER_NUMBERING) + .short("f") + .long(options::FOOTER_NUMBERING) + .help("use STYLE for numbering footer lines") + .value_name("STYLE"), + ) + .arg( + Arg::with_name(options::HEADER_NUMBERING) + .short("h") + .long(options::HEADER_NUMBERING) + .help("use STYLE for numbering header lines") + .value_name("STYLE"), + ) + .arg( + Arg::with_name(options::LINE_INCREMENT) + .short("i") + .long(options::LINE_INCREMENT) + .help("line number increment at each line") + .value_name("NUMBER"), + ) + .arg( + Arg::with_name(options::JOIN_BLANK_LINES) + .short("l") + .long(options::JOIN_BLANK_LINES) + .help("group of NUMBER empty lines counted as one") + .value_name("NUMBER"), + ) + .arg( + Arg::with_name(options::NUMBER_FORMAT) + .short("n") + .long(options::NUMBER_FORMAT) + .help("insert line numbers according to FORMAT") + .value_name("FORMAT"), + ) + .arg( + Arg::with_name(options::NO_RENUMBER) + .short("p") + .long(options::NO_RENUMBER) + .help("do not reset line numbers at logical pages"), + ) + .arg( + Arg::with_name(options::NUMER_SEPARATOR) + .short("s") + .long(options::NUMER_SEPARATOR) + .help("add STRING after (possible) line number") + .value_name("STRING"), + ) + .arg( + Arg::with_name(options::STARTING_LINE_NUMER) + .short("v") + .long(options::STARTING_LINE_NUMER) + .help("first line number on each logical page") + .value_name("NUMBER"), + ) + .arg( + Arg::with_name(options::NUMBER_WIDTH) + .short("w") + .long(options::NUMBER_WIDTH) + .help("use NUMBER columns for line numbers") + .value_name("NUMBER"), + ) + .get_matches_from(args); // A mutable settings object, initialized with the defaults. let mut settings = Settings { @@ -155,27 +184,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { number_separator: String::from("\t"), }; - let given_options = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - print_usage(&opts); - return 1; - } - }; - - if given_options.opt_present("help") { - print_usage(&opts); - return 0; - } - if given_options.opt_present("version") { - version(); - return 0; - } - // Update the settings from the command line options, and terminate the // program if some options could not successfully be parsed. - let parse_errors = helper::parse_options(&mut settings, &given_options); + let parse_errors = helper::parse_options(&mut settings, &matches); if !parse_errors.is_empty() { show_error!("Invalid arguments supplied."); for message in &parse_errors { @@ -184,8 +195,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 1; } - let files = given_options.free; - let mut read_stdin = files.is_empty(); + let mut read_stdin = false; + let files: Vec = match matches.values_of(options::FILE) { + Some(v) => v.clone().map(|v| v.to_owned()).collect(), + None => vec!["-".to_owned()], + }; for file in &files { if file == "-" { @@ -370,11 +384,3 @@ fn pass_none(_: &str, _: ®ex::Regex) -> bool { fn pass_all(_: &str, _: ®ex::Regex) -> bool { true } - -fn print_usage(opts: &getopts::Options) { - println!("{}", opts.usage(USAGE)); -} - -fn version() { - println!("{} {}", NAME, VERSION); -} From 3ae714e88cdf2e2176ac5386e175794ab5bdf48a Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sat, 27 Mar 2021 09:16:45 +0100 Subject: [PATCH 507/606] tests/tee: implemented tests for tee (#1804) These tests are ported from `https://github.com/coreutils/coreutils/tests/misc/tee.sh`. --- tests/by-util/test_tee.rs | 103 +++++++++++++++++++++++++++++++++++++- 1 file changed, 102 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_tee.rs b/tests/by-util/test_tee.rs index 651491045..5819b3044 100644 --- a/tests/by-util/test_tee.rs +++ b/tests/by-util/test_tee.rs @@ -1 +1,102 @@ -// ToDO: add tests +use crate::common::util::*; + +// tests for basic tee functionality. +// inspired by: +// https://github.com/coreutils/coreutils/tests/misc/tee.sh + +#[test] +fn test_tee_processing_multiple_operands() { + // POSIX says: "Processing of at least 13 file operands shall be supported." + + let content = "tee_sample_content"; + for &n in [1, 2, 12, 13].iter() { + let files = (1..=n).map(|x| x.to_string()).collect::>(); + let (at, mut ucmd) = at_and_ucmd!(); + + ucmd.args(&files) + .pipe_in(content) + .succeeds() + .stdout_is(content); + + for file in files.iter() { + assert!(at.file_exists(file)); + assert_eq!(at.read(file), content); + } + } +} + +#[test] +fn test_tee_treat_minus_as_filename() { + // Ensure tee treats '-' as the name of a file, as mandated by POSIX. + + let (at, mut ucmd) = at_and_ucmd!(); + let content = "tee_sample_content"; + let file = "-"; + + ucmd.arg("-").pipe_in(content).succeeds().stdout_is(content); + + assert!(at.file_exists(file)); + assert_eq!(at.read(file), content); +} + +#[test] +fn test_tee_append() { + let (at, mut ucmd) = at_and_ucmd!(); + let content = "tee_sample_content"; + let file = "tee_out"; + + at.touch(file); + at.write(file, content); + assert_eq!(at.read(file), content); + + ucmd.arg("-a") + .arg(file) + .pipe_in(content) + .succeeds() + .stdout_is(content); + assert!(at.file_exists(file)); + assert_eq!(at.read(file), content.repeat(2)); +} + +#[test] +#[cfg(target_os = "linux")] +fn test_tee_no_more_writeable_stdout() { + let (_at, mut ucmd) = at_and_ucmd!(); + let content = (1..=10) + .map(|x| format!("{}\n", x.to_string())) + .collect::(); + let file_out = "tee_file_out"; + + let _result = ucmd + .arg("/dev/full") + .arg(file_out) + .pipe_in(&content[..]) + .fails(); + + // TODO: comment in after https://github.com/uutils/coreutils/issues/1805 is fixed + // assert_eq!(at.read(file_out), content); + // assert!(result.stdout.contains(&content)); + // assert!(result.stderr.contains("No space left on device")); +} + +#[test] +#[cfg(target_os = "linux")] +fn test_tee_no_more_writeable_stdin() { + let (_at, mut ucmd) = at_and_ucmd!(); + let _content = (1..=10) + .map(|x| format!("{}\n", x.to_string())) + .collect::(); + let file_out_a = "tee_file_out_a"; + let file_out_b = "tee_file_out_b"; + + let _result = ucmd + .arg(file_out_a) + .arg(file_out_b) + .pipe_in("/dev/full") + .succeeds(); // TODO: expected to succeed currently; change to fails() when required + + // TODO: comment in after https://github.com/uutils/coreutils/issues/1805 is fixed + // assert_eq!(at.read(file_out_a), content); + // assert_eq!(at.read(file_out_b), content); + // assert!(result.stderr.contains("No space left on device")); +} From 35675fdfe7639acdb81c0bdc97a3f59780a52a04 Mon Sep 17 00:00:00 2001 From: Antonio Gurgel Date: Sat, 27 Mar 2021 01:18:47 -0700 Subject: [PATCH 508/606] 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 --- Cargo.lock | 20 ++++++++ Cargo.toml | 1 + src/uu/install/Cargo.toml | 1 + src/uu/install/src/install.rs | 95 +++++++++++++++++++++++++++++++++-- tests/by-util/test_install.rs | 85 +++++++++++++++++++++++++++++++ 5 files changed, 197 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4851a6e13..12cfe7ed6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -187,6 +187,7 @@ dependencies = [ "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -517,6 +518,11 @@ name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "file_diff" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "filetime" version = "0.2.14" @@ -730,6 +736,17 @@ dependencies = [ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "nix" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nodrop" version = "0.1.14" @@ -1658,6 +1675,7 @@ name = "uu_install" version = "0.0.4" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2501,6 +2519,7 @@ dependencies = [ "checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +"checksum file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "31a7a908b8f32538a2143e59a6e4e2508988832d5d4d6f7c156b3cbc762643a5" "checksum filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" "checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" "checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" @@ -2532,6 +2551,7 @@ dependencies = [ "checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" "checksum memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" "checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" +"checksum nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" "checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" "checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" diff --git a/Cargo.toml b/Cargo.toml index 208fd5d9c..08e9a3bb2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -334,6 +334,7 @@ conv = "0.3" filetime = "0.2" glob = "0.3.0" libc = "0.2" +nix = "0.20.0" rand = "0.7" regex = "1.0" sha1 = { version="0.6", features=["std"] } diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 9841ac64a..5aec0b07c 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -20,6 +20,7 @@ path = "src/install.rs" [dependencies] clap = "2.33" filetime = "0.2" +file_diff = "1.0.0" libc = ">= 0.2" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["mode", "perms", "entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 1ac9bc743..db54ee22d 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -13,10 +13,12 @@ mod mode; extern crate uucore; use clap::{App, Arg, ArgMatches}; +use file_diff::diff; use filetime::{set_file_times, FileTime}; use uucore::entries::{grp2gid, usr2uid}; use uucore::perms::{wrap_chgrp, wrap_chown, Verbosity}; +use libc::{getegid, geteuid}; use std::fs; use std::fs::File; use std::os::unix::fs::MetadataExt; @@ -34,6 +36,7 @@ pub struct Behavior { group: String, verbose: bool, preserve_timestamps: bool, + compare: bool, } #[derive(Clone, Eq, PartialEq)] @@ -112,11 +115,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("ignored") ) .arg( - // TODO implement flag Arg::with_name(OPT_COMPARE) .short("C") .long(OPT_COMPARE) - .help("(unimplemented) compare each pair of source and destination files, and in some cases, do not modify the destination at all") + .help("compare each pair of source and destination files, and in some cases, do not modify the destination at all") ) .arg( Arg::with_name(OPT_DIRECTORY) @@ -262,8 +264,6 @@ fn check_unimplemented<'a>(matches: &ArgMatches) -> Result<(), &'a str> { Err("--backup") } else if matches.is_present(OPT_BACKUP_2) { Err("-b") - } else if matches.is_present(OPT_COMPARE) { - Err("--compare, -C") } else if matches.is_present(OPT_CREATED) { Err("-D") } else if matches.is_present(OPT_STRIP) { @@ -338,6 +338,7 @@ fn behavior(matches: &ArgMatches) -> Result { group: matches.value_of(OPT_GROUP).unwrap_or("").to_string(), verbose: matches.is_present(OPT_VERBOSE), preserve_timestamps: matches.is_present(OPT_PRESERVE_TIMESTAMPS), + compare: matches.is_present(OPT_COMPARE), }) } @@ -500,7 +501,13 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { ); return Err(()); } - } else if let Err(err) = fs::copy(from, to) { + } + + if b.compare && !need_copy(from, to, b) { + return Ok(()); + } + + if let Err(err) = fs::copy(from, to) { show_error!( "cannot install '{}' to '{}': {}", from.display(), @@ -583,3 +590,81 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { Ok(()) } + +/// Return true if a file is necessary to copy. This is the case when: +/// - _from_ or _to_ is nonexistent; +/// - either file has a sticky bit or set[ug]id bit, or the user specified one; +/// - either file isn't a regular file; +/// - the sizes of _from_ and _to_ differ; +/// - _to_'s owner differs from intended; or +/// - the contents of _from_ and _to_ differ. +/// +/// # Parameters +/// +/// _from_ and _to_, if existent, must be non-directories. +/// +/// # Errors +/// +/// Crashes the program if a nonexistent owner or group is specified in _b_. +/// +fn need_copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> bool { + let from_meta = match fs::metadata(from) { + Ok(meta) => meta, + Err(_) => return true, + }; + let to_meta = match fs::metadata(to) { + Ok(meta) => meta, + Err(_) => return true, + }; + + // setuid || setgid || sticky + let extra_mode: u32 = 0o7000; + + if b.specified_mode.unwrap_or(0) & extra_mode != 0 + || from_meta.mode() & extra_mode != 0 + || to_meta.mode() & extra_mode != 0 + { + return true; + } + + if !from_meta.is_file() || !to_meta.is_file() { + return true; + } + + if from_meta.len() != to_meta.len() { + return true; + } + + // TODO: if -P (#1809) and from/to contexts mismatch, return true. + + if !b.owner.is_empty() { + let owner_id = match usr2uid(&b.owner) { + Ok(id) => id, + _ => crash!(1, "no such user: {}", b.owner), + }; + if owner_id != to_meta.uid() { + return true; + } + } else if !b.group.is_empty() { + let group_id = match grp2gid(&b.group) { + Ok(id) => id, + _ => crash!(1, "no such group: {}", b.group), + }; + if group_id != to_meta.gid() { + return true; + } + } else { + #[cfg(not(target_os = "windows"))] + unsafe { + if to_meta.uid() != geteuid() || to_meta.gid() != getegid() { + return true; + } + } + } + + if !diff(from.to_str().unwrap(), to.to_str().unwrap()) { + return true; + } + + false +} diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 89dfb0e56..dfd5c1c8d 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -1,4 +1,5 @@ use crate::common::util::*; +use filetime::FileTime; use rust_users::*; use std::os::unix::fs::PermissionsExt; @@ -407,3 +408,87 @@ fn test_install_failing_no_such_file() { assert!(r.code == Some(1)); assert!(r.stderr.contains("No such file or directory")); } + +#[test] +fn test_install_copy_then_compare_file() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let file1 = "test_install_copy_then_compare_file_a1"; + let file2 = "test_install_copy_then_compare_file_a2"; + + at.touch(file1); + scene + .ucmd() + .arg("-C") + .arg(file1) + .arg(file2) + .succeeds() + .no_stderr(); + + let mut file2_meta = at.metadata(file2); + let before = FileTime::from_last_modification_time(&file2_meta); + + scene + .ucmd() + .arg("-C") + .arg(file1) + .arg(file2) + .succeeds() + .no_stderr(); + + file2_meta = at.metadata(file2); + let after = FileTime::from_last_modification_time(&file2_meta); + + assert!(before == after); +} + +#[test] +#[cfg(target_os = "linux")] +fn test_install_copy_then_compare_file_with_extra_mode() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + // XXX: can't tests introspect on their own names? + let file1 = "test_install_copy_then_compare_file_with_extra_mode_a1"; + let file2 = "test_install_copy_then_compare_file_with_extra_mode_a2"; + + at.touch(file1); + scene + .ucmd() + .arg("-C") + .arg(file1) + .arg(file2) + .succeeds() + .no_stderr(); + + let mut file2_meta = at.metadata(file2); + let before = FileTime::from_last_modification_time(&file2_meta); + + scene + .ucmd() + .arg("-C") + .arg(file1) + .arg(file2) + .arg("-m") + .arg("1644") + .succeeds() + .no_stderr(); + + file2_meta = at.metadata(file2); + let after_install_sticky = FileTime::from_last_modification_time(&file2_meta); + + assert!(before != after_install_sticky); + + // dest file still 1644, so need_copy ought to return `true` + scene + .ucmd() + .arg("-C") + .arg(file1) + .arg(file2) + .succeeds() + .no_stderr(); + + file2_meta = at.metadata(file2); + let after_install_sticky_again = FileTime::from_last_modification_time(&file2_meta); + + assert!(after_install_sticky != after_install_sticky_again); +} From e1439dd199dba0b0f600dfaa45218a4a5daa9b98 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 27 Mar 2021 10:06:22 +0100 Subject: [PATCH 509/606] refresh cargo.lock with recent updates (#1924) Updating memoffset v0.6.1 -> v0.6.2 Updating syn v1.0.64 -> v1.0.65 --- Cargo.lock | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 12cfe7ed6..99fd7a3f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -335,7 +335,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -350,7 +350,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -442,7 +442,7 @@ dependencies = [ "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -718,7 +718,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memoffset" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -742,7 +742,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.61 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1127,7 +1127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1183,7 +1183,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1268,7 +1268,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1370,6 +1370,7 @@ dependencies = [ name = "uu_cat" version = "0.0.4" dependencies = [ + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", @@ -1824,7 +1825,7 @@ name = "uu_nl" version = "0.0.4" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2332,7 +2333,7 @@ version = "0.0.5" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2379,7 +2380,7 @@ dependencies = [ "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2399,7 +2400,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2549,7 +2550,7 @@ dependencies = [ "checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" "checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" -"checksum memoffset 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" +"checksum memoffset 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cc14fc54a812b4472b4113facc3e44d099fbc0ea2ce0551fa5c703f8edfbfd38" "checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" "checksum nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" @@ -2608,7 +2609,7 @@ dependencies = [ "checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" "checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f" +"checksum syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)" = "f3a1d708c221c5a612956ef9f75b37e454e88d1f7b899fbd3a18d4252012d663" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" "checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" From faef7e9214e865e369c780bd6182ca306560b1aa Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 27 Mar 2021 10:05:13 +0100 Subject: [PATCH 510/606] fix(install): Unbreak the CI by bringing the old behavior for install of /dev/null --- src/uu/install/src/install.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index db54ee22d..b4f98ec1a 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -488,6 +488,10 @@ fn copy_file_to_file(file: &PathBuf, target: &PathBuf, b: &Behavior) -> i32 { /// If the copy system call fails, we print a verbose error and return an empty error value. /// fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { + if b.compare && !need_copy(from, to, b) { + return Ok(()); + } + if from.to_string_lossy() == "/dev/null" { /* workaround a limitation of fs::copy * https://github.com/rust-lang/rust/issues/79390 @@ -501,13 +505,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> { ); return Err(()); } - } - - if b.compare && !need_copy(from, to, b) { - return Ok(()); - } - - if let Err(err) = fs::copy(from, to) { + } else if let Err(err) = fs::copy(from, to) { show_error!( "cannot install '{}' to '{}': {}", from.display(), From 75700677ca440203be5a6cb348b508ff5b592369 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 27 Mar 2021 10:08:03 +0100 Subject: [PATCH 511/606] fix(install): improve the error output when the test is failing --- tests/by-util/test_install.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index dfd5c1c8d..3a8771f5d 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -352,11 +352,19 @@ fn test_install_copy_file() { #[test] #[cfg(target_os = "linux")] fn test_install_target_file_dev_null() { - let (at, mut ucmd) = at_and_ucmd!(); + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let file1 = "/dev/null"; let file2 = "target_file"; - ucmd.arg(file1).arg(file2).succeeds().no_stderr(); + let result = scene.ucmd().arg(file1).arg(file2).run(); + + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + + assert!(result.success); + assert!(at.file_exists(file2)); } From 4845b3f5dcf1c532ff7774424170efa59091ebae Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 27 Mar 2021 10:29:46 +0100 Subject: [PATCH 512/606] Enable the stale bot to close issues/PR without any activity (#1926) --- .github/stale.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 000000000..47076f60f --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,18 @@ +# Number of days of inactivity before an issue/PR becomes stale +daysUntilStale: 365 +# Number of days of inactivity before a stale issue/PR is closed +daysUntilClose: 14 +# Issues with these labels will never be considered stale +exemptLabels: + - pinned + - security + - "Good first bug" +# Label to use when marking an issue as stale +staleLabel: wontfix +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false From e9ffaf87ea9a84e81d72deb9f86323615324fbec Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 27 Mar 2021 10:47:26 +0100 Subject: [PATCH 513/606] ignore test_install_copy_then_compare_file_with_extra_mode see https://github.com/uutils/coreutils/issues/1927 --- tests/by-util/test_install.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 3a8771f5d..411de61f3 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -452,6 +452,7 @@ fn test_install_copy_then_compare_file() { #[test] #[cfg(target_os = "linux")] +#[ignore] fn test_install_copy_then_compare_file_with_extra_mode() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; From 16878c2daa7c6c525f151f709333f48774c7f08e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 27 Mar 2021 10:54:18 +0100 Subject: [PATCH 514/606] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 128 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..6c50b811d --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +sylvestre@debian.org. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. From ac7edcc4fad4a046bb3a8ae8371cebc5e58256e9 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Sat, 27 Mar 2021 15:31:06 +0300 Subject: [PATCH 515/606] ptx: delete getopts dependency (#1942) * chore: delete getopts dependency * deps: update Cargo.lock --- Cargo.lock | 1 - src/uu/ptx/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 99fd7a3f6..8a56ffbfd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1927,7 +1927,6 @@ version = "0.0.4" dependencies = [ "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index d1e0267b6..790b06305 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -17,7 +17,6 @@ path = "src/ptx.rs" [dependencies] clap = "2.33" aho-corasick = "0.7.3" -getopts = "0.2.18" libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" From 0bdd61af5e6572be3f77e09d42f0b3d5d9ee91d3 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Sat, 27 Mar 2021 15:31:29 +0300 Subject: [PATCH 516/606] cksum: use clap for argument management (#1943) --- src/uu/cksum/Cargo.toml | 1 + src/uu/cksum/src/cksum.rs | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index ef3ec8b46..b7ac630f0 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/cksum.rs" [dependencies] +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index e1c75fffc..bc71a2d97 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -10,6 +10,7 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs::File; use std::io::{self, stdin, BufReader, Read}; use std::path::Path; @@ -18,9 +19,10 @@ use std::path::Path; const CRC_TABLE_LEN: usize = 256; const CRC_TABLE: [u32; CRC_TABLE_LEN] = generate_crc_table(); +const VERSION: &str = env!("CARGO_PKG_VERSION"); +const NAME: &str = "cksum"; const SYNTAX: &str = "[OPTIONS] [FILE]..."; const SUMMARY: &str = "Print CRC and size for each file"; -const LONG_HELP: &str = ""; // this is basically a hack to get "loops" to work on Rust 1.33. Once we update to Rust 1.46 or // greater, we can just use while loops @@ -160,10 +162,25 @@ fn cksum(fname: &str) -> io::Result<(u32, usize)> { } } -pub fn uumain(args: impl uucore::Args) -> i32 { - let matches = app!(SYNTAX, SUMMARY, LONG_HELP).parse(args.collect_str()); +mod options { + pub static FILE: &str = "file"; +} - let files = matches.free; +pub fn uumain(args: impl uucore::Args) -> i32 { + let args = args.collect_str(); + + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .about(SUMMARY) + .usage(SYNTAX) + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) + .get_matches_from(args); + + let files: Vec = match matches.values_of(options::FILE) { + Some(v) => v.clone().map(|v| v.to_owned()).collect(), + None => vec![], + }; if files.is_empty() { match cksum("-") { From f66a188414886d28f9c5c583e6f048086766040d Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Sat, 27 Mar 2021 22:00:59 +0300 Subject: [PATCH 517/606] 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 --- Cargo.lock | 2 +- src/uu/mkfifo/Cargo.toml | 2 +- src/uu/mkfifo/src/mkfifo.rs | 94 ++++++++++++++++++------------------ tests/by-util/test_mkfifo.rs | 49 ++++++++++++++++++- 4 files changed, 97 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a56ffbfd..a5c551228 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1760,7 +1760,7 @@ dependencies = [ name = "uu_mkfifo" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index 627d4a721..aa347a86e 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/mkfifo.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/mkfifo/src/mkfifo.rs b/src/uu/mkfifo/src/mkfifo.rs index 41582b14a..14701af4d 100644 --- a/src/uu/mkfifo/src/mkfifo.rs +++ b/src/uu/mkfifo/src/mkfifo.rs @@ -8,56 +8,55 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use libc::mkfifo; use std::ffi::CString; -use std::io::Error; static NAME: &str = "mkfifo"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static USAGE: &str = "mkfifo [OPTION]... NAME..."; +static SUMMARY: &str = "Create a FIFO with the given name."; + +mod options { + pub static MODE: &str = "mode"; + pub static SE_LINUX_SECURITY_CONTEXT: &str = "Z"; + pub static CONTEXT: &str = "context"; + pub static FIFO: &str = "fifo"; +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(USAGE) + .about(SUMMARY) + .arg( + Arg::with_name(options::MODE) + .short("m") + .long(options::MODE) + .help("file permissions for the fifo") + .default_value("0666") + .value_name("0666"), + ) + .arg( + Arg::with_name(options::SE_LINUX_SECURITY_CONTEXT) + .short(options::SE_LINUX_SECURITY_CONTEXT) + .help("set the SELinux security context to default type") + ) + .arg(Arg::with_name(options::CONTEXT).long(options::CONTEXT).value_name("CTX").help("like -Z, or if CTX is specified then set the SELinux\nor SMACK security context to CTX")) + .arg(Arg::with_name(options::FIFO).hidden(true).multiple(true)) + .get_matches_from(args); - opts.optopt( - "m", - "mode", - "file permissions for the fifo", - "(default 0666)", - ); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(err) => panic!("{}", err), - }; - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; + if matches.is_present(options::CONTEXT) { + crash!(1, "--context is not implemented"); + } + if matches.is_present(options::SE_LINUX_SECURITY_CONTEXT) { + crash!(1, "-Z is not implemented"); } - if matches.opt_present("help") || matches.free.is_empty() { - let msg = format!( - "{0} {1} - -Usage: - {0} [OPTIONS] NAME... - -Create a FIFO with the given name.", - NAME, VERSION - ); - - print!("{}", opts.usage(&msg)); - if matches.free.is_empty() { - return 1; - } - return 0; - } - - let mode = match matches.opt_str("m") { + let mode = match matches.value_of(options::MODE) { Some(m) => match usize::from_str_radix(&m, 8) { Ok(m) => m, Err(e) => { @@ -68,21 +67,22 @@ Create a FIFO with the given name.", None => 0o666, }; - let mut exit_status = 0; - for f in &matches.free { + let fifos: Vec = match matches.values_of(options::FIFO) { + Some(v) => v.clone().map(|s| s.to_owned()).collect(), + None => crash!(1, "missing operand"), + }; + + let mut exit_code = 0; + for f in fifos { let err = unsafe { let name = CString::new(f.as_bytes()).unwrap(); mkfifo(name.as_ptr(), mode as libc::mode_t) }; if err == -1 { - show_error!( - "creating '{}': {}", - f, - Error::last_os_error().raw_os_error().unwrap() - ); - exit_status = 1; + show_error!("cannot create fifo '{}': File exists", f); + exit_code = 1; } } - exit_status + exit_code } diff --git a/tests/by-util/test_mkfifo.rs b/tests/by-util/test_mkfifo.rs index 651491045..f60c0a4b8 100644 --- a/tests/by-util/test_mkfifo.rs +++ b/tests/by-util/test_mkfifo.rs @@ -1 +1,48 @@ -// ToDO: add tests +use crate::common::util::*; + +#[test] +fn test_create_fifo_missing_operand() { + new_ucmd!() + .fails() + .stderr_is("mkfifo: error: missing operand"); +} + +#[test] +fn test_create_one_fifo() { + new_ucmd!().arg("abc").succeeds(); +} + +#[test] +fn test_create_one_fifo_with_invalid_mode() { + new_ucmd!() + .arg("abcd") + .arg("-m") + .arg("invalid") + .fails() + .stderr + .contains("invalid mode"); +} + +#[test] +fn test_create_multiple_fifos() { + new_ucmd!() + .arg("abcde") + .arg("def") + .arg("sed") + .arg("dum") + .succeeds(); +} + +#[test] +fn test_create_one_fifo_with_mode() { + new_ucmd!().arg("abcde").arg("-m600").succeeds(); +} + +#[test] +fn test_create_one_fifo_already_exists() { + new_ucmd!() + .arg("abcdef") + .arg("abcdef") + .fails() + .stderr_is("mkfifo: error: cannot create fifo 'abcdef': File exists"); +} From 500771c78d4b6b62bc7203d1624174cd28bd994b Mon Sep 17 00:00:00 2001 From: Ivan Date: Sat, 27 Mar 2021 22:02:49 +0300 Subject: [PATCH 518/606] 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 --- src/uu/tee/Cargo.toml | 1 + src/uu/tee/src/tee.rs | 93 +++++++++++++++++++++++++-------------- tests/by-util/test_tee.rs | 19 ++++---- 3 files changed, 73 insertions(+), 40 deletions(-) diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index 99a6ec23e..51bba2e45 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -17,6 +17,7 @@ path = "src/tee.rs" [dependencies] clap = "2.33.3" libc = "0.2.42" +retain_mut = "0.1.2" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index c54fa0d16..4b0f19038 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -12,6 +12,7 @@ use clap::{App, Arg}; use std::fs::OpenOptions; use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write}; use std::path::{Path, PathBuf}; +use retain_mut::RetainMut; #[cfg(unix)] use uucore::libc; @@ -93,18 +94,33 @@ fn tee(options: Options) -> Result<()> { if options.ignore_interrupts { ignore_interrupts()? } - let mut writers: Vec> = options + let mut writers: Vec = options .files .clone() .into_iter() - .map(|file| open(file, options.append)) + .map(|file| + NamedWriter { + name: file.clone(), + inner: open(file, options.append), + } + ) .collect(); - writers.push(Box::new(stdout())); - let output = &mut MultiWriter { writers }; + + + writers.insert(0, NamedWriter { + name: "'standard output'".to_owned(), + inner: Box::new(stdout()), + }); + + let mut output = MultiWriter::new(writers); let input = &mut NamedReader { inner: Box::new(stdin()) as Box, }; - if copy(input, output).is_err() || output.flush().is_err() { + + // TODO: replaced generic 'copy' call to be able to stop copying + // if all outputs are closed (due to errors) + if copy(input, &mut output).is_err() || output.flush().is_err() || + output.error_occured() { Err(Error::new(ErrorKind::Other, "")) } else { Ok(()) @@ -112,7 +128,7 @@ fn tee(options: Options) -> Result<()> { } fn open(name: String, append: bool) -> Box { - let path = PathBuf::from(name); + let path = PathBuf::from(name.clone()); let inner: Box = { let mut options = OpenOptions::new(); let mode = if append { @@ -125,55 +141,68 @@ fn open(name: String, append: bool) -> Box { Err(_) => Box::new(sink()), } }; - Box::new(NamedWriter { inner, path }) as Box + Box::new(NamedWriter { inner, name }) as Box } struct MultiWriter { - writers: Vec>, + writers: Vec, + initial_len: usize, +} + +impl MultiWriter { + fn new (writers: Vec) -> Self { + Self { + initial_len: writers.len(), + writers, + } + } + fn error_occured(&self) -> bool { + self.writers.len() != self.initial_len + } } impl Write for MultiWriter { fn write(&mut self, buf: &[u8]) -> Result { - for writer in &mut self.writers { - writer.write_all(buf)?; - } + self.writers.retain_mut(|writer| { + let result = writer.write_all(buf); + match result { + Err(f) => { + show_info!("{}: {}", writer.name, f.to_string()); + false + } + _ => true + } + }); Ok(buf.len()) } fn flush(&mut self) -> Result<()> { - for writer in &mut self.writers { - writer.flush()?; - } + self.writers.retain_mut(|writer| { + let result = writer.flush(); + match result { + Err(f) => { + show_info!("{}: {}", writer.name, f.to_string()); + false + } + _ => true + } + }); Ok(()) } } struct NamedWriter { inner: Box, - path: PathBuf, + pub name: String, } impl Write for NamedWriter { fn write(&mut self, buf: &[u8]) -> Result { - match self.inner.write(buf) { - Err(f) => { - self.inner = Box::new(sink()) as Box; - show_warning!("{}: {}", self.path.display(), f.to_string()); - Err(f) - } - okay => okay, - } + self.inner.write(buf) } fn flush(&mut self) -> Result<()> { - match self.inner.flush() { - Err(f) => { - self.inner = Box::new(sink()) as Box; - show_warning!("{}: {}", self.path.display(), f.to_string()); - Err(f) - } - okay => okay, - } + self.inner.flush() } } @@ -185,7 +214,7 @@ impl Read for NamedReader { fn read(&mut self, buf: &mut [u8]) -> Result { match self.inner.read(buf) { Err(f) => { - show_warning!("{}: {}", Path::new("stdin").display(), f.to_string()); + show_info!("{}: {}", Path::new("stdin").display(), f.to_string()); Err(f) } okay => okay, diff --git a/tests/by-util/test_tee.rs b/tests/by-util/test_tee.rs index 5819b3044..f01677ae7 100644 --- a/tests/by-util/test_tee.rs +++ b/tests/by-util/test_tee.rs @@ -60,28 +60,31 @@ fn test_tee_append() { #[test] #[cfg(target_os = "linux")] -fn test_tee_no_more_writeable_stdout() { - let (_at, mut ucmd) = at_and_ucmd!(); +fn test_tee_no_more_writeable_1() { + // equals to 'tee /dev/full out2 (); let file_out = "tee_file_out"; - let _result = ucmd + let result = ucmd .arg("/dev/full") .arg(file_out) .pipe_in(&content[..]) .fails(); - // TODO: comment in after https://github.com/uutils/coreutils/issues/1805 is fixed - // assert_eq!(at.read(file_out), content); - // assert!(result.stdout.contains(&content)); - // assert!(result.stderr.contains("No space left on device")); + assert_eq!(at.read(file_out), content); + assert!(result.stdout.contains(&content)); + assert!(result.stderr.contains("No space left on device")); } #[test] #[cfg(target_os = "linux")] -fn test_tee_no_more_writeable_stdin() { +fn test_tee_no_more_writeable_2() { + // should be equals to 'tee out1 out2 >/dev/full Date: Sat, 27 Mar 2021 20:03:47 +0100 Subject: [PATCH 519/606] refresh cargo.lock with recent updates --- Cargo.lock | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index a5c551228..9911ba928 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1062,6 +1062,11 @@ dependencies = [ "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "retain_mut" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rust-ini" version = "0.13.0" @@ -1420,6 +1425,7 @@ dependencies = [ name = "uu_cksum" version = "0.0.4" dependencies = [ + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", @@ -2132,6 +2138,7 @@ version = "0.0.4" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", ] @@ -2592,6 +2599,7 @@ dependencies = [ "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" "checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +"checksum retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" From 4f6041e39d46cd8c8dcd58fc5e2e490b60bd78e4 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 27 Mar 2021 22:26:08 +0100 Subject: [PATCH 520/606] Only close if stale for one year --- .github/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/stale.yml b/.github/stale.yml index 47076f60f..e0988d0bd 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -1,7 +1,7 @@ # Number of days of inactivity before an issue/PR becomes stale daysUntilStale: 365 # Number of days of inactivity before a stale issue/PR is closed -daysUntilClose: 14 +daysUntilClose: 365 # Issues with these labels will never be considered stale exemptLabels: - pinned From bcb1828ad608e26072277d5d2738c8eb91d64966 Mon Sep 17 00:00:00 2001 From: k0ur0x Date: Sun, 28 Mar 2021 05:51:43 +0430 Subject: [PATCH 521/606] comm: move from getopts to clap --- src/uu/comm/Cargo.toml | 2 +- src/uu/comm/src/comm.rs | 86 ++++++++++++++++++++++++++++------------- 2 files changed, 61 insertions(+), 27 deletions(-) diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index ddfbb6a47..a0dc4e06f 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/comm.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/comm/src/comm.rs b/src/uu/comm/src/comm.rs index 3fb1ef395..34b4330c9 100644 --- a/src/uu/comm/src/comm.rs +++ b/src/uu/comm/src/comm.rs @@ -15,21 +15,34 @@ use std::fs::File; use std::io::{self, stdin, BufRead, BufReader, Stdin}; use std::path::Path; -static SYNTAX: &str = "[OPTIONS] FILE1 FILE2"; -static SUMMARY: &str = "Compare sorted files line by line"; +use clap::{App, Arg, ArgMatches}; + +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "compare two sorted files line by line"; static LONG_HELP: &str = ""; -fn mkdelim(col: usize, opts: &getopts::Matches) -> String { - let mut s = String::new(); - let delim = match opts.opt_str("output-delimiter") { - Some(d) => d, - None => "\t".to_owned(), - }; +mod options { + pub const COLUMN_1: &str = "1"; + pub const COLUMN_2: &str = "2"; + pub const COLUMN_3: &str = "3"; + pub const DELIMITER: &str = "output-delimiter"; + pub const DELIMITER_DEFAULT: &str = "\t"; + pub const FILE_1: &str = "FILE1"; + pub const FILE_2: &str = "FILE2"; +} - if col > 1 && !opts.opt_present("1") { +fn get_usage() -> String { + format!("{} [OPTION]... FILE1 FILE2", executable!()) +} + +fn mkdelim(col: usize, opts: &ArgMatches) -> String { + let mut s = String::new(); + let delim = opts.value_of(options::DELIMITER).unwrap(); + + if col > 1 && !opts.is_present(options::COLUMN_1) { s.push_str(delim.as_ref()); } - if col > 2 && !opts.opt_present("2") { + if col > 2 && !opts.is_present(options::COLUMN_2) { s.push_str(delim.as_ref()); } @@ -57,7 +70,7 @@ impl LineReader { } } -fn comm(a: &mut LineReader, b: &mut LineReader, opts: &getopts::Matches) { +fn comm(a: &mut LineReader, b: &mut LineReader, opts: &ArgMatches) { let delim: Vec = (0..4).map(|col| mkdelim(col, opts)).collect(); let ra = &mut String::new(); @@ -80,7 +93,7 @@ fn comm(a: &mut LineReader, b: &mut LineReader, opts: &getopts::Matches) { match ord { Ordering::Less => { - if !opts.opt_present("1") { + if !opts.is_present(options::COLUMN_1) { ensure_nl(ra); print!("{}{}", delim[1], ra); } @@ -88,7 +101,7 @@ fn comm(a: &mut LineReader, b: &mut LineReader, opts: &getopts::Matches) { na = a.read_line(ra); } Ordering::Greater => { - if !opts.opt_present("2") { + if !opts.is_present(options::COLUMN_2) { ensure_nl(rb); print!("{}{}", delim[2], rb); } @@ -96,7 +109,7 @@ fn comm(a: &mut LineReader, b: &mut LineReader, opts: &getopts::Matches) { nb = b.read_line(rb); } Ordering::Equal => { - if !opts.opt_present("3") { + if !opts.is_present(options::COLUMN_3) { ensure_nl(ra); print!("{}{}", delim[3], ra); } @@ -120,21 +133,42 @@ fn open_file(name: &str) -> io::Result { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optflag("1", "", "suppress column 1 (lines uniq to FILE1)") - .optflag("2", "", "suppress column 2 (lines uniq to FILE2)") - .optflag( - "3", - "", - "suppress column 3 (lines that appear in both files)", + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::COLUMN_1) + .short(options::COLUMN_1) + .help("suppress column 1 (lines unique to FILE1)"), ) - .optopt("", "output-delimiter", "separate columns with STR", "STR") - .parse(args); + .arg( + Arg::with_name(options::COLUMN_2) + .short(options::COLUMN_2) + .help("suppress column 2 (lines unique to FILE2)"), + ) + .arg( + Arg::with_name(options::COLUMN_3) + .short(options::COLUMN_3) + .help("suppress column 3 (lines that appear in both files)"), + ) + .arg( + Arg::with_name(options::DELIMITER) + .long(options::DELIMITER) + .help("separate columns with STR") + .value_name("STR") + .default_value(options::DELIMITER_DEFAULT) + .hide_default_value(true), + ) + .arg(Arg::with_name(options::FILE_1).required(true)) + .arg(Arg::with_name(options::FILE_2).required(true)) + .get_matches_from(args); - let mut f1 = open_file(matches.free[0].as_ref()).unwrap(); - let mut f2 = open_file(matches.free[1].as_ref()).unwrap(); + let mut f1 = open_file(matches.value_of(options::FILE_1).unwrap()).unwrap(); + let mut f2 = open_file(matches.value_of(options::FILE_2).unwrap()).unwrap(); comm(&mut f1, &mut f2, &matches); From 01eb913c05969182c4aadb51fd98f96355f61575 Mon Sep 17 00:00:00 2001 From: Antonio Gurgel Date: Sat, 27 Mar 2021 19:37:58 -0700 Subject: [PATCH 522/606] test_install: Add sleeps To ensure timestamps don't match. Fixes #1927. --- tests/by-util/test_install.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 411de61f3..957bb54d5 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -2,6 +2,7 @@ use crate::common::util::*; use filetime::FileTime; use rust_users::*; use std::os::unix::fs::PermissionsExt; +use std::thread::sleep; #[test] fn test_install_help() { @@ -471,6 +472,7 @@ fn test_install_copy_then_compare_file_with_extra_mode() { let mut file2_meta = at.metadata(file2); let before = FileTime::from_last_modification_time(&file2_meta); + sleep(std::time::Duration::from_millis(1000)); scene .ucmd() @@ -487,6 +489,8 @@ fn test_install_copy_then_compare_file_with_extra_mode() { assert!(before != after_install_sticky); + sleep(std::time::Duration::from_millis(1000)); + // dest file still 1644, so need_copy ought to return `true` scene .ucmd() From ebb4568d5270582edc6da5d91976be2b90604088 Mon Sep 17 00:00:00 2001 From: Antonio Gurgel Date: Sat, 27 Mar 2021 22:46:57 -0700 Subject: [PATCH 523/606] Forgot to unignore the test --- tests/by-util/test_install.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 957bb54d5..d12dc0b8d 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -453,7 +453,6 @@ fn test_install_copy_then_compare_file() { #[test] #[cfg(target_os = "linux")] -#[ignore] fn test_install_copy_then_compare_file_with_extra_mode() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; From a655117a5fe3bfe09ed02eae852a519714d603c9 Mon Sep 17 00:00:00 2001 From: Antonio Gurgel Date: Sun, 28 Mar 2021 00:42:25 -0700 Subject: [PATCH 524/606] `std::thread::sleep` needs target_os Co-authored-by: Sylvestre Ledru --- tests/by-util/test_install.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index d12dc0b8d..af48a0e66 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -2,6 +2,7 @@ use crate::common::util::*; use filetime::FileTime; use rust_users::*; use std::os::unix::fs::PermissionsExt; +#[cfg(target_os = "linux")] use std::thread::sleep; #[test] From 1bfea356a65bae95c4ac5b0cc42439195895e113 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 28 Mar 2021 10:36:44 +0200 Subject: [PATCH 525/606] refresh cargo.lock with recent updates --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 9911ba928..5b5869e02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1435,7 +1435,7 @@ dependencies = [ name = "uu_comm" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "uucore 0.0.7", "uucore_procs 0.0.5", From dd0addb9c12e23a43818a1bfe14559921da59a20 Mon Sep 17 00:00:00 2001 From: Sivachandran Paramasivam Date: Sun, 28 Mar 2021 16:30:49 +0530 Subject: [PATCH 526/606] pathchk: improve unit test code coverage with more tests --- tests/by-util/test_pathchk.rs | 147 +++++++++++++++++++++++++++++++++- 1 file changed, 144 insertions(+), 3 deletions(-) diff --git a/tests/by-util/test_pathchk.rs b/tests/by-util/test_pathchk.rs index e24a464e0..d01beccc2 100644 --- a/tests/by-util/test_pathchk.rs +++ b/tests/by-util/test_pathchk.rs @@ -5,11 +5,152 @@ fn test_default_mode() { // test the default mode // accept some reasonable default - new_ucmd!().args(&["abc/def"]).succeeds().no_stdout(); + new_ucmd!().args(&["dir/file"]).succeeds().no_stdout(); - // fail on long inputs + // accept non-portable chars + new_ucmd!().args(&["dir#/$file"]).succeeds().no_stdout(); + + // accept empty path + new_ucmd!().args(&[""]).succeeds().no_stdout(); + + // fail on long path new_ucmd!() - .args(&["test".repeat(20000)]) + .args(&["dir".repeat(libc::PATH_MAX as usize + 1)]) + .fails() + .no_stdout(); + + // fail on long filename + new_ucmd!() + .args(&[format!( + "dir/{}", + "file".repeat(libc::FILENAME_MAX as usize + 1) + )]) .fails() .no_stdout(); } + +#[test] +fn test_posix_mode() { + // test the posix mode + + // accept some reasonable default + new_ucmd!().args(&["-p", "dir/file"]).succeeds().no_stdout(); + + // fail on long path + new_ucmd!() + .args(&[ + "-p", + &"dir".repeat(libc::PATH_MAX as usize + 1).as_str(), + ]) + .fails() + .no_stdout(); + + // fail on long filename + new_ucmd!() + .args(&[ + "-p", + &format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(), + ]) + .fails() + .no_stdout(); + + // fail on non-portable chars + new_ucmd!().args(&["-p", "dir#/$file"]).fails().no_stdout(); +} + +#[test] +fn test_posix_special() { + // test the posix special mode + + // accept some reasonable default + new_ucmd!().args(&["-P", "dir/file"]).succeeds().no_stdout(); + + // accept non-portable chars + new_ucmd!() + .args(&["-P", "dir#/$file"]) + .succeeds() + .no_stdout(); + + // accept non-leading hyphen + new_ucmd!() + .args(&["-P", "dir/file-name"]) + .succeeds() + .no_stdout(); + + // fail on long path + new_ucmd!() + .args(&[ + "-P", + &"dir".repeat(libc::PATH_MAX as usize + 1).as_str(), + ]) + .fails() + .no_stdout(); + + // fail on long filename + new_ucmd!() + .args(&[ + "-P", + &format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(), + ]) + .fails() + .no_stdout(); + + // fail on leading hyphen char + new_ucmd!().args(&["-P", "dir/-file"]).fails().no_stdout(); + + // fail on empty path + new_ucmd!().args(&["-P", ""]).fails().no_stdout(); +} + +#[test] +fn test_posix_all() { + // test the posix special mode + + // accept some reasonable default + new_ucmd!().args(&["-p", "-P", "dir/file"]).succeeds().no_stdout(); + + // accept non-leading hyphen + new_ucmd!() + .args(&["-p", "-P", "dir/file-name"]) + .succeeds() + .no_stdout(); + + // fail on long path + new_ucmd!() + .args(&[ + "-p", + "-P", + &"dir".repeat(libc::PATH_MAX as usize + 1).as_str(), + ]) + .fails() + .no_stdout(); + + // fail on long filename + new_ucmd!() + .args(&[ + "-p", + "-P", + &format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(), + ]) + .fails() + .no_stdout(); + + // fail on non-portable chars + new_ucmd!().args(&["-p", "-P", "dir#/$file"]).fails().no_stdout(); + + // fail on leading hyphen char + new_ucmd!().args(&["-p", "-P", "dir/-file"]).fails().no_stdout(); + + // fail on empty path + new_ucmd!().args(&["-p", "-P", ""]).fails().no_stdout(); +} + +#[test] +fn test_args_parsing() { + // fail on no args + let empty_args: [String; 0] = []; + new_ucmd!() + .args(&empty_args) + .fails() + .no_stdout(); +} \ No newline at end of file From 43c6a52b63623d6c75d924ee85617c8556f86f5b Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 28 Mar 2021 13:11:39 +0200 Subject: [PATCH 527/606] chmod: move from getopts to clap --- src/uu/chmod/Cargo.toml | 1 + src/uu/chmod/src/chmod.rs | 235 ++++++++++++++++++++++++-------------- 2 files changed, 148 insertions(+), 88 deletions(-) diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index 41b73d8a6..d4917b525 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/chmod.rs" [dependencies] +clap = "2.33.3" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs", "mode"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index 61c56dd77..119447b14 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -10,6 +10,7 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs; use std::os::unix::fs::{MetadataExt, PermissionsExt}; use std::path::Path; @@ -18,115 +19,173 @@ use uucore::fs::display_permissions_unix; use uucore::mode; use walkdir::WalkDir; -const NAME: &str = "chmod"; -static SUMMARY: &str = "Change the mode of each FILE to MODE. +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Change the mode of each FILE to MODE. With --reference, change the mode of each FILE to that of RFILE."; -static LONG_HELP: &str = " - Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+'. -"; + +mod options { + pub const CHANGES: &str = "changes"; + pub const QUIET: &str = "quiet"; // visible_alias("silent") + pub const VERBOSE: &str = "verbose"; + pub const NO_PRESERVE_ROOT: &str = "no-preserve-root"; + pub const PRESERVE_ROOT: &str = "preserve-root"; + pub const REFERENCE: &str = "RFILE"; + pub const RECURSIVE: &str = "recursive"; + pub const MODE: &str = "MODE"; + pub const FILE: &str = "FILE"; +} + +fn get_usage() -> String { + format!( + "{0} [OPTION]... MODE[,MODE]... FILE... +or: {0} [OPTION]... OCTAL-MODE FILE... +or: {0} [OPTION]... --reference=RFILE FILE...", + executable!() + ) +} + +fn get_long_usage() -> String { + String::from("Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+'.") +} pub fn uumain(args: impl uucore::Args) -> i32 { let mut args = args.collect_str(); - let syntax = format!( - "[OPTION]... MODE[,MODE]... FILE... - {0} [OPTION]... OCTAL-MODE FILE... - {0} [OPTION]... --reference=RFILE FILE...", - NAME - ); - let mut opts = app!(&syntax, SUMMARY, LONG_HELP); - opts.optflag( - "c", - "changes", - "like verbose but report only when a change is made", - ) - // TODO: support --silent (can be done using clap) - .optflag("f", "quiet", "suppress most error messages") - .optflag( - "v", - "verbose", - "output a diagnostic for every file processed", - ) - .optflag( - "", - "no-preserve-root", - "do not treat '/' specially (the default)", - ) - .optflag("", "preserve-root", "fail to operate recursively on '/'") - .optopt( - "", - "reference", - "use RFILE's mode instead of MODE values", - "RFILE", - ) - .optflag("R", "recursive", "change files and directories recursively"); + // Before we can parse 'args' with clap (and previously getopts), + // a possible MODE prefix '-' needs to be removed (e.g. "chmod -x FILE"). + let mode_had_minus_prefix = strip_minus_from_mode(&mut args); - // sanitize input for - at beginning (e.g. chmod -x test_file). Remove - // the option and save it for later, after parsing is finished. - let negative_option = sanitize_input(&mut args); + let usage = get_usage(); + let after_help = get_long_usage(); - let mut matches = opts.parse(args); - if matches.free.is_empty() { - show_error!("missing an argument"); - show_error!("for help, try '{} --help'", NAME); - return 1; - } else { - let changes = matches.opt_present("changes"); - let quiet = matches.opt_present("quiet"); - let verbose = matches.opt_present("verbose"); - let preserve_root = matches.opt_present("preserve-root"); - let recursive = matches.opt_present("recursive"); - let fmode = matches - .opt_str("reference") + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(&after_help[..]) + .arg( + Arg::with_name(options::CHANGES) + .long(options::CHANGES) + .short("c") + .help("like verbose but report only when a change is made"), + ) + .arg( + Arg::with_name(options::QUIET) + .long(options::QUIET) + .visible_alias("silent") + .short("f") + .help("suppress most error messages"), + ) + .arg( + Arg::with_name(options::VERBOSE) + .long(options::VERBOSE) + .short("v") + .help("output a diagnostic for every file processed"), + ) + .arg( + Arg::with_name(options::NO_PRESERVE_ROOT) + .long(options::NO_PRESERVE_ROOT) + .help("do not treat '/' specially (the default)"), + ) + .arg( + Arg::with_name(options::PRESERVE_ROOT) + .long(options::PRESERVE_ROOT) + .help("fail to operate recursively on '/'"), + ) + .arg( + Arg::with_name(options::RECURSIVE) + .long(options::RECURSIVE) + .short("R") + .help("change files and directories recursively"), + ) + .arg( + Arg::with_name(options::REFERENCE) + .long("reference") + .takes_value(true) + .help("use RFILE's mode instead of MODE values"), + ) + .arg( + Arg::with_name(options::MODE) + .required_unless(options::REFERENCE) + .takes_value(true), + // It would be nice if clap could parse with delimeter, e.g. "g-x,u+x", + // however .multiple(true) cannot be used here because FILE already needs that. + // Only one positional argument with .multiple(true) set is allowed per command + ) + .arg( + Arg::with_name(options::FILE) + .required_unless(options::MODE) + .multiple(true), + ) + .get_matches_from(args); + + let changes = matches.is_present(options::CHANGES); + let quiet = matches.is_present(options::QUIET); + let verbose = matches.is_present(options::VERBOSE); + let preserve_root = matches.is_present(options::PRESERVE_ROOT); + let recursive = matches.is_present(options::RECURSIVE); + let fmode = + matches + .value_of(options::REFERENCE) .and_then(|ref fref| match fs::metadata(fref) { Ok(meta) => Some(meta.mode()), Err(err) => crash!(1, "cannot stat attributes of '{}': {}", fref, err), }); - let cmode = if fmode.is_none() { - // If there was a negative option, now it's a good time to - // use it. - if negative_option.is_some() { - negative_option - } else { - Some(matches.free.remove(0)) - } - } else { - None - }; - let chmoder = Chmoder { - changes, - quiet, - verbose, - preserve_root, - recursive, - fmode, - cmode, - }; - match chmoder.chmod(matches.free) { - Ok(()) => {} - Err(e) => return e, - } + let modes = matches.value_of(options::MODE).unwrap(); // should always be Some because required + let mut cmode = if mode_had_minus_prefix { + // clap parsing is finished, now put prefix back + Some(format!("-{}", modes)) + } else { + Some(modes.to_string()) + }; + let mut files: Vec = matches + .values_of(options::FILE) + .map(|v| v.map(ToString::to_string).collect()) + .unwrap_or_default(); + if fmode.is_some() { + // "--reference" and MODE are mutually exclusive + // if "--reference" was used MODE needs to be interpreted as another FILE + // it wasn't possible to implement this behavior directly with clap + files.push(cmode.unwrap()); + cmode = None; + } + + let chmoder = Chmoder { + changes, + quiet, + verbose, + preserve_root, + recursive, + fmode, + cmode, + }; + match chmoder.chmod(files) { + Ok(()) => {} + Err(e) => return e, } 0 } -fn sanitize_input(args: &mut Vec) -> Option { +// Iterate 'args' and delete the first occurrence +// of a prefix '-' if it's associated with MODE +// e.g. "chmod -v -xw -R FILE" -> "chmod -v xw -R FILE" +fn strip_minus_from_mode(args: &mut Vec) -> bool { for i in 0..args.len() { - let first = args[i].chars().next().unwrap(); - if first != '-' { - continue; - } - if let Some(second) = args[i].chars().nth(1) { - match second { - 'r' | 'w' | 'x' | 'X' | 's' | 't' | 'u' | 'g' | 'o' | '0'..='7' => { - return Some(args.remove(i)); + if args[i].starts_with("-") { + if let Some(second) = args[i].chars().nth(1) { + match second { + 'r' | 'w' | 'x' | 'X' | 's' | 't' | 'u' | 'g' | 'o' | '0'..='7' => { + // TODO: use strip_prefix() once minimum rust version reaches 1.45.0 + args[i] = args[i][1..args[i].len()].to_string(); + return true; + } + _ => {} } - _ => {} } } } - None + false } struct Chmoder { From 6d4f70ccb24294f7f6d1e4165809efae41919e13 Mon Sep 17 00:00:00 2001 From: Craig Pastro Date: Sun, 28 Mar 2021 22:08:37 +0900 Subject: [PATCH 528/606] shuf: move from getopts to clap (#1950) --- Cargo.lock | 1960 ++++++++++++++++++------------------ src/uu/shuf/Cargo.toml | 2 +- src/uu/shuf/src/shuf.rs | 279 ++--- tests/by-util/test_shuf.rs | 56 +- 4 files changed, 1186 insertions(+), 1111 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5b5869e02..343ad1e30 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,2651 +4,2649 @@ name = "advapi32-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "aho-corasick" version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4", ] [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "arrayvec" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" dependencies = [ - "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", + "winapi 0.3.9", ] [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bit-set" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" dependencies = [ - "bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-vec", ] [[package]] name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ - "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec", + "constant_time_eq", ] [[package]] name = "block-buffer" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" dependencies = [ - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools", + "generic-array", ] [[package]] name = "bstr" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "memchr 2.3.4", + "regex-automata", + "serde", ] [[package]] name = "bumpalo" version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "byte-tools" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cast" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version", ] [[package]] name = "cc" version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" dependencies = [ - "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer", + "num-traits", + "time", ] [[package]] name = "clap" version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", ] [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", ] [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "conv" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" dependencies = [ - "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "custom_derive", ] [[package]] name = "coreutils" version = "0.0.4" dependencies = [ - "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_arch 0.0.4", - "uu_base32 0.0.4", - "uu_base64 0.0.4", - "uu_basename 0.0.4", - "uu_cat 0.0.4", - "uu_chgrp 0.0.4", - "uu_chmod 0.0.4", - "uu_chown 0.0.4", - "uu_chroot 0.0.4", - "uu_cksum 0.0.4", - "uu_comm 0.0.4", - "uu_cp 0.0.4", - "uu_csplit 0.0.4", - "uu_cut 0.0.4", - "uu_date 0.0.4", - "uu_df 0.0.4", - "uu_dircolors 0.0.4", - "uu_dirname 0.0.4", - "uu_du 0.0.4", - "uu_echo 0.0.4", - "uu_env 0.0.4", - "uu_expand 0.0.4", - "uu_expr 0.0.4", - "uu_factor 0.0.4", - "uu_false 0.0.4", - "uu_fmt 0.0.4", - "uu_fold 0.0.4", - "uu_groups 0.0.4", - "uu_hashsum 0.0.4", - "uu_head 0.0.4", - "uu_hostid 0.0.4", - "uu_hostname 0.0.4", - "uu_id 0.0.4", - "uu_install 0.0.4", - "uu_join 0.0.4", - "uu_kill 0.0.4", - "uu_link 0.0.4", - "uu_ln 0.0.4", - "uu_logname 0.0.4", - "uu_ls 0.0.4", - "uu_mkdir 0.0.4", - "uu_mkfifo 0.0.4", - "uu_mknod 0.0.4", - "uu_mktemp 0.0.4", - "uu_more 0.0.4", - "uu_mv 0.0.4", - "uu_nice 0.0.4", - "uu_nl 0.0.4", - "uu_nohup 0.0.4", - "uu_nproc 0.0.4", - "uu_numfmt 0.0.4", - "uu_od 0.0.4", - "uu_paste 0.0.4", - "uu_pathchk 0.0.4", - "uu_pinky 0.0.4", - "uu_printenv 0.0.4", - "uu_printf 0.0.4", - "uu_ptx 0.0.4", - "uu_pwd 0.0.4", - "uu_readlink 0.0.4", - "uu_realpath 0.0.4", - "uu_relpath 0.0.4", - "uu_rm 0.0.4", - "uu_rmdir 0.0.4", - "uu_seq 0.0.4", - "uu_shred 0.0.4", - "uu_shuf 0.0.4", - "uu_sleep 0.0.4", - "uu_sort 0.0.4", - "uu_split 0.0.4", - "uu_stat 0.0.4", - "uu_stdbuf 0.0.4", - "uu_sum 0.0.4", - "uu_sync 0.0.4", - "uu_tac 0.0.4", - "uu_tail 0.0.4", - "uu_tee 0.0.4", - "uu_test 0.0.4", - "uu_timeout 0.0.4", - "uu_touch 0.0.4", - "uu_tr 0.0.4", - "uu_true 0.0.4", - "uu_truncate 0.0.4", - "uu_tsort 0.0.4", - "uu_tty 0.0.4", - "uu_uname 0.0.4", - "uu_unexpand 0.0.4", - "uu_uniq 0.0.4", - "uu_unlink 0.0.4", - "uu_uptime 0.0.4", - "uu_users 0.0.4", - "uu_wc 0.0.4", - "uu_who 0.0.4", - "uu_whoami 0.0.4", - "uu_yes 0.0.4", - "uucore 0.0.7", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "conv", + "filetime", + "glob 0.3.0", + "lazy_static", + "libc", + "nix 0.20.0", + "rand 0.7.3", + "regex", + "sha1", + "tempfile", + "textwrap", + "time", + "unindent", + "unix_socket", + "users", + "uu_arch", + "uu_base32", + "uu_base64", + "uu_basename", + "uu_cat", + "uu_chgrp", + "uu_chmod", + "uu_chown", + "uu_chroot", + "uu_cksum", + "uu_comm", + "uu_cp", + "uu_csplit", + "uu_cut", + "uu_date", + "uu_df", + "uu_dircolors", + "uu_dirname", + "uu_du", + "uu_echo", + "uu_env", + "uu_expand", + "uu_expr", + "uu_factor", + "uu_false", + "uu_fmt", + "uu_fold", + "uu_groups", + "uu_hashsum", + "uu_head", + "uu_hostid", + "uu_hostname", + "uu_id", + "uu_install", + "uu_join", + "uu_kill", + "uu_link", + "uu_ln", + "uu_logname", + "uu_ls", + "uu_mkdir", + "uu_mkfifo", + "uu_mknod", + "uu_mktemp", + "uu_more", + "uu_mv", + "uu_nice", + "uu_nl", + "uu_nohup", + "uu_nproc", + "uu_numfmt", + "uu_od", + "uu_paste", + "uu_pathchk", + "uu_pinky", + "uu_printenv", + "uu_printf", + "uu_ptx", + "uu_pwd", + "uu_readlink", + "uu_realpath", + "uu_relpath", + "uu_rm", + "uu_rmdir", + "uu_seq", + "uu_shred", + "uu_shuf", + "uu_sleep", + "uu_sort", + "uu_split", + "uu_stat", + "uu_stdbuf", + "uu_sum", + "uu_sync", + "uu_tac", + "uu_tail", + "uu_tee", + "uu_test", + "uu_timeout", + "uu_touch", + "uu_tr", + "uu_true", + "uu_truncate", + "uu_tsort", + "uu_tty", + "uu_uname", + "uu_unexpand", + "uu_uniq", + "uu_unlink", + "uu_uptime", + "uu_users", + "uu_wc", + "uu_who", + "uu_whoami", + "uu_yes", + "uucore", + "walkdir", ] [[package]] name = "cpp" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" dependencies = [ - "cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_macros", ] [[package]] name = "cpp_build" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" dependencies = [ - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "cpp_common 0.4.0", + "cpp_syn", + "cpp_synmap", + "cpp_synom", + "lazy_static", ] [[package]] name = "cpp_common" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" dependencies = [ - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn", + "cpp_synom", + "lazy_static", + "quote 0.3.15", ] [[package]] name = "cpp_common" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "proc-macro2", + "syn", ] [[package]] name = "cpp_macros" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "byteorder", + "cpp_common 0.5.6", + "if_rust_version", + "lazy_static", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "cpp_syn" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" dependencies = [ - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom", + "quote 0.3.15", + "unicode-xid 0.0.4", ] [[package]] name = "cpp_synmap" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" dependencies = [ - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn", + "cpp_synom", + "memchr 1.0.2", ] [[package]] name = "cpp_synom" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" dependencies = [ - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4", ] [[package]] name = "criterion" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", - "tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "cast", + "clap", + "criterion-plot", + "csv", + "itertools 0.10.0", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", ] [[package]] name = "criterion-plot" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" dependencies = [ - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cast", + "itertools 0.9.0", ] [[package]] name = "crossbeam-channel" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-utils", ] [[package]] name = "crossbeam-deque" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", ] [[package]] name = "crossbeam-utils" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "cfg-if 1.0.0", + "lazy_static", ] [[package]] name = "csv" version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" dependencies = [ - "bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr", + "csv-core", + "itoa", + "ryu", + "serde", ] [[package]] name = "csv-core" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" dependencies = [ - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4", ] [[package]] name = "custom_derive" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" [[package]] name = "data-encoding" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" [[package]] name = "digest" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" dependencies = [ - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array", ] [[package]] name = "dunce" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "regex", ] [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "file_diff" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31a7a908b8f32538a2143e59a6e4e2508988832d5d4d6f7c156b3cbc762643a5" [[package]] name = "filetime" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.2.5", + "winapi 0.3.9", ] [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fs_extra" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "generic-array" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" dependencies = [ - "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", + "typenum", ] [[package]] name = "getopts" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" dependencies = [ - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "getrandom" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "libc", + "wasi", ] [[package]] name = "glob" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "half" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "hermit-abi" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "hex" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" [[package]] name = "hostname" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "match_cfg", + "winapi 0.3.9", ] [[package]] name = "if_rust_version" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" [[package]] name = "ioctl-sys" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" [[package]] name = "itertools" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itertools" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itertools" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itoa" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" dependencies = [ - "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen", ] [[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" [[package]] name = "log" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", ] [[package]] name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "maybe-uninit" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "md5" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" [[package]] name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "memchr" version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memoffset" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "nix" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "cc", + "cfg-if 0.1.10", + "libc", + "void", ] [[package]] name = "nix" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "cc", + "cfg-if 1.0.0", + "libc", ] [[package]] name = "nodrop" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "num-integer" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "num-traits", ] [[package]] name = "num-traits" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", ] [[package]] name = "number_prefix" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "numtoa" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "onig" version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "lazy_static", + "libc", + "onig_sys", ] [[package]] name = "onig_sys" version = "69.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" dependencies = [ - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "pkg-config", ] [[package]] name = "oorandom" version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "paste" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" dependencies = [ - "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", + "paste-impl", + "proc-macro-hack", ] [[package]] name = "paste-impl" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" dependencies = [ - "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack", ] [[package]] name = "pkg-config" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "platform-info" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi 0.3.9", ] [[package]] name = "plotters" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" dependencies = [ - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", ] [[package]] name = "plotters-backend" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" [[package]] name = "plotters-svg" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" dependencies = [ - "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-backend", ] [[package]] name = "ppv-lite86" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro-hack" version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1", ] [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quickcheck" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" dependencies = [ - "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger", + "log", + "rand 0.7.3", + "rand_core 0.5.1", ] [[package]] name = "quote" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "rand" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "winapi 0.3.9", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", + "libc", + "rand_chacha", + "rand_core 0.5.1", + "rand_hc", + "rand_pcg", ] [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2", ] [[package]] name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", ] [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1", ] [[package]] name = "rand_pcg" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1", ] [[package]] name = "rayon" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", ] [[package]] name = "rayon-core" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ - "crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", ] [[package]] name = "redox_syscall" version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", ] [[package]] name = "redox_termios" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5", ] [[package]] name = "regex" version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "memchr 2.3.4", + "regex-syntax", ] [[package]] name = "regex-automata" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" dependencies = [ - "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder", ] [[package]] name = "regex-syntax" version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "retain_mut" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" [[package]] name = "rust-ini" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver", ] [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "same-file" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ - "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util", ] [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver-parser", ] [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" [[package]] name = "serde_cbor" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" dependencies = [ - "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "half", + "serde", ] [[package]] name = "serde_derive" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "serde_json" version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ - "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa", + "ryu", + "serde", ] [[package]] name = "sha1" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" dependencies = [ - "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "byte-tools", + "digest", + "fake-simd", + "generic-array", ] [[package]] name = "sha3" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" dependencies = [ - "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "byte-tools", + "digest", + "generic-array", ] [[package]] name = "smallvec" version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit", ] [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1d708c221c5a612956ef9f75b37e454e88d1f7b899fbd3a18d4252012d663" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "unicode-xid 0.2.1", ] [[package]] name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", + "rand 0.7.3", + "redox_syscall 0.1.57", + "remove_dir_all", + "winapi 0.3.9", ] [[package]] name = "term_grid" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" dependencies = [ - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "term_size" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi 0.3.9", ] [[package]] name = "termion" version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "numtoa", + "redox_syscall 0.2.5", + "redox_termios", ] [[package]] name = "termsize" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "kernel32-sys", + "libc", + "termion", + "winapi 0.2.8", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "term_size", + "unicode-width", ] [[package]] name = "thiserror" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ - "thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "redox_syscall 0.1.57", + "winapi 0.3.9", ] [[package]] name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "serde", + "serde_json", ] [[package]] name = "typenum" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" [[package]] name = "unicode-width" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unindent" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" [[package]] name = "unix_socket" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", ] [[package]] name = "users" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "log", ] [[package]] name = "uu_arch" version = "0.0.4" dependencies = [ - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "platform-info", + "uucore", + "uucore_procs", ] [[package]] name = "uu_base32" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_base64" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_basename" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cat" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "quick-error", + "unix_socket", + "uucore", + "uucore_procs", ] [[package]] name = "uu_chgrp" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chmod" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chown" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "glob 0.3.0", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chroot" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cksum" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_comm" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cp" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "filetime", + "ioctl-sys", + "libc", + "quick-error", + "uucore", + "uucore_procs", + "walkdir", + "winapi 0.3.9", + "xattr", ] [[package]] name = "uu_csplit" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "glob 0.2.11", + "regex", + "thiserror", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cut" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_date" version = "0.0.4" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono", + "clap", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_df" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "number_prefix", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_dircolors" version = "0.0.4" dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "glob 0.3.0", + "uucore", + "uucore_procs", ] [[package]] name = "uu_dirname" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_du" version = "0.0.4" dependencies = [ - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_echo" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_env" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "rust-ini", + "uucore", + "uucore_procs", ] [[package]] name = "uu_expand" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_expr" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "onig", + "uucore", + "uucore_procs", ] [[package]] name = "uu_factor" version = "0.0.4" dependencies = [ - "criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "criterion", + "num-traits", + "paste", + "quickcheck", + "rand 0.7.3", + "rand_chacha", + "smallvec", + "uucore", + "uucore_procs", ] [[package]] name = "uu_false" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_fmt" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_fold" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_groups" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hashsum" version = "0.0.4" dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "blake2-rfc", + "clap", + "digest", + "hex", + "libc", + "md5", + "regex", + "regex-syntax", + "sha1", + "sha2", + "sha3", + "uucore", + "uucore_procs", ] [[package]] name = "uu_head" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hostid" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hostname" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "hostname", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_id" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_install" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "file_diff", + "filetime", + "libc", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_join" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_kill" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_link" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ln" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_logname" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ls" version = "0.0.4" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "atty", + "clap", + "lazy_static", + "number_prefix", + "term_grid", + "termsize", + "time", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mkdir" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mkfifo" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mknod" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mktemp" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "rand 0.5.6", + "tempfile", + "uucore", + "uucore_procs", ] [[package]] name = "uu_more" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "nix 0.13.1", + "redox_syscall 0.1.57", + "redox_termios", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mv" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "fs_extra", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nice" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "nix 0.13.1", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nl" version = "0.0.4" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "aho-corasick", + "clap", + "libc", + "memchr 2.3.4", + "regex", + "regex-syntax", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nohup" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nproc" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "num_cpus", + "uucore", + "uucore_procs", ] [[package]] name = "uu_numfmt" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_od" version = "0.0.4" dependencies = [ - "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "byteorder", + "clap", + "half", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_paste" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pathchk" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pinky" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_printenv" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_printf" version = "0.0.4" dependencies = [ - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "itertools 0.8.2", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ptx" version = "0.0.4" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "aho-corasick", + "clap", + "libc", + "memchr 2.3.4", + "regex", + "regex-syntax", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pwd" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_readlink" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_realpath" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_relpath" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_rm" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "remove_dir_all", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_rmdir" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_seq" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_shred" version = "0.0.4" dependencies = [ - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "filetime", + "getopts", + "libc", + "rand 0.5.6", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_shuf" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "rand 0.5.6", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sleep" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sort" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "itertools 0.8.2", + "semver", + "uucore", + "uucore_procs", ] [[package]] name = "uu_split" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stat" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stdbuf" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_stdbuf_libstdbuf 0.0.4", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "tempfile", + "uu_stdbuf_libstdbuf", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stdbuf_libstdbuf" version = "0.0.4" dependencies = [ - "cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "cpp", + "cpp_build", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sum" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sync" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_tac" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tail" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "redox_syscall 0.1.57", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_tee" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "retain_mut", + "uucore", + "uucore_procs", ] [[package]] name = "uu_test" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "redox_syscall 0.1.57", + "uucore", + "uucore_procs", ] [[package]] name = "uu_timeout" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_touch" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "filetime", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tr" version = "0.0.4" dependencies = [ - "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "bit-set", + "fnv", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_true" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_truncate" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tsort" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tty" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uname" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "platform-info", + "uucore", + "uucore_procs", ] [[package]] name = "uu_unexpand" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uniq" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_unlink" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uptime" version = "0.0.4" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "chrono", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_users" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_wc" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_who" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_whoami" version = "0.0.4" dependencies = [ - "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "advapi32-sys", + "clap", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_yes" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uucore" version = "0.0.7" dependencies = [ - "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "data-encoding", + "dunce", + "getopts", + "lazy_static", + "libc", + "nix 0.13.1", + "platform-info", + "termion", + "thiserror", + "time", + "wild", ] [[package]] name = "uucore_procs" version = "0.0.5" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "walkdir" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ - "same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file", + "winapi 0.3.9", + "winapi-util", ] [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" dependencies = [ - "bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote 1.0.9", + "syn", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" dependencies = [ - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9", + "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" [[package]] name = "web-sys" version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" dependencies = [ - "js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys", + "wasm-bindgen", ] [[package]] name = "wild" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0", ] [[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] - -[metadata] -"checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" -"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -"checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" -"checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" -"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -"checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" -"checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" -"checksum bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" -"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" -"checksum byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -"checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" -"checksum cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)" = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" -"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" -"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" -"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" -"checksum cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" -"checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" -"checksum cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" -"checksum cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" -"checksum cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" -"checksum cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" -"checksum cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" -"checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" -"checksum criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" -"checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" -"checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" -"checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" -"checksum crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" -"checksum crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" -"checksum csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" -"checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" -"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" -"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" -"checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" -"checksum dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" -"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "31a7a908b8f32538a2143e59a6e4e2508988832d5d4d6f7c156b3cbc762643a5" -"checksum filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" -"checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -"checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" -"checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -"checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -"checksum half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" -"checksum hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" -"checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" -"checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -"checksum if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" -"checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" -"checksum itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" -"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" -"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -"checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" -"checksum js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)" = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" -"checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -"checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" -"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" -"checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" -"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -"checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" -"checksum memoffset 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cc14fc54a812b4472b4113facc3e44d099fbc0ea2ce0551fa5c703f8edfbfd38" -"checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" -"checksum nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" -"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" -"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -"checksum number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" -"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" -"checksum onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" -"checksum onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" -"checksum oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" -"checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" -"checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" -"checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" -"checksum platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" -"checksum plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" -"checksum plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" -"checksum plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" -"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" -"checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" -"checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" -"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -"checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" -"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" -"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" -"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" -"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -"checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -"checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" -"checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" -"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -"checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" -"checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" -"checksum regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" -"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -"checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" -"checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -"checksum retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" -"checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" -"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -"checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" -"checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" -"checksum serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" -"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" -"checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" -"checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" -"checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.65 (registry+https://github.com/rust-lang/crates.io-index)" = "f3a1d708c221c5a612956ef9f75b37e454e88d1f7b899fbd3a18d4252012d663" -"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" -"checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" -"checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" -"checksum termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" -"checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" -"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" -"checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" -"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -"checksum typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" -"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" -"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" -"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" -"checksum unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" -"checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" -"checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" -"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" -"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" -"checksum wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" -"checksum wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" -"checksum wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" -"checksum wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" -"checksum web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" -"checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index b78d4fc04..5e7c6c71a 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/shuf.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" rand = "0.5" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/shuf/src/shuf.rs b/src/uu/shuf/src/shuf.rs index 278e872fb..f7af05214 100644 --- a/src/uu/shuf/src/shuf.rs +++ b/src/uu/shuf/src/shuf.rs @@ -10,132 +10,162 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use rand::Rng; use std::fs::File; use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write}; -use std::usize::MAX as MAX_USIZE; - -enum Mode { - Default, - Echo, - InputRange((usize, usize)), -} static NAME: &str = "shuf"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static USAGE: &str = r#"shuf [OPTION]... [FILE] + or: shuf -e [OPTION]... [ARG]... + or: shuf -i LO-HI [OPTION]... +Write a random permutation of the input lines to standard output. + +With no FILE, or when FILE is -, read standard input. +"#; +static TEMPLATE: &str = "Usage: {usage}\nMandatory arguments to long options are mandatory for short options too.\n{unified}"; + +struct Options { + head_count: usize, + output: Option, + random_source: Option, + repeat: bool, + sep: u8, +} + +enum Mode { + Default(String), + Echo(Vec), + InputRange((usize, usize)), +} + +mod options { + pub static ECHO: &str = "echo"; + pub static INPUT_RANGE: &str = "input-range"; + pub static HEAD_COUNT: &str = "head-count"; + pub static OUTPUT: &str = "output"; + pub static RANDOM_SOURCE: &str = "random-source"; + pub static REPEAT: &str = "repeat"; + pub static ZERO_TERMINATED: &str = "zero-terminated"; + pub static FILE: &str = "file"; +} pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .template(TEMPLATE) + .usage(USAGE) + .arg( + Arg::with_name(options::ECHO) + .short("e") + .long(options::ECHO) + .takes_value(true) + .value_name("ARG") + .help("treat each ARG as an input line") + .multiple(true) + .use_delimiter(false) + .min_values(0) + .conflicts_with(options::INPUT_RANGE), + ) + .arg( + Arg::with_name(options::INPUT_RANGE) + .short("i") + .long(options::INPUT_RANGE) + .takes_value(true) + .value_name("LO-HI") + .help("treat each number LO through HI as an input line") + .conflicts_with(options::FILE), + ) + .arg( + Arg::with_name(options::HEAD_COUNT) + .short("n") + .long(options::HEAD_COUNT) + .takes_value(true) + .value_name("COUNT") + .help("output at most COUNT lines"), + ) + .arg( + Arg::with_name(options::OUTPUT) + .short("o") + .long(options::OUTPUT) + .takes_value(true) + .value_name("FILE") + .help("write result to FILE instead of standard output"), + ) + .arg( + Arg::with_name(options::RANDOM_SOURCE) + .long(options::RANDOM_SOURCE) + .takes_value(true) + .value_name("FILE") + .help("get random bytes from FILE"), + ) + .arg( + Arg::with_name(options::REPEAT) + .short("r") + .long(options::REPEAT) + .help("output lines can be repeated"), + ) + .arg( + Arg::with_name(options::ZERO_TERMINATED) + .short("z") + .long(options::ZERO_TERMINATED) + .help("line delimiter is NUL, not newline"), + ) + .arg(Arg::with_name(options::FILE).takes_value(true)) + .get_matches_from(args); - let mut opts = getopts::Options::new(); - opts.optflag("e", "echo", "treat each ARG as an input line"); - opts.optopt( - "i", - "input-range", - "treat each number LO through HI as an input line", - "LO-HI", - ); - opts.optopt("n", "head-count", "output at most COUNT lines", "COUNT"); - opts.optopt( - "o", - "output", - "write result to FILE instead of standard output", - "FILE", - ); - opts.optopt("", "random-source", "get random bytes from FILE", "FILE"); - opts.optflag("r", "repeat", "output lines can be repeated"); - opts.optflag("z", "zero-terminated", "end lines with 0 byte, not newline"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - let mut matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f), - }; - if matches.opt_present("help") { - let msg = format!( - "{0} {1} - -Usage: - {0} [OPTION]... [FILE] - {0} -e [OPTION]... [ARG]... - {0} -i LO-HI [OPTION]... - -Write a random permutation of the input lines to standard output. -With no FILE, or when FILE is -, read standard input.", - NAME, VERSION - ); - print!("{}", opts.usage(&msg)); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); + let mode = if let Some(args) = matches.values_of(options::ECHO) { + Mode::Echo(args.map(String::from).collect()) + } else if let Some(range) = matches.value_of(options::INPUT_RANGE) { + match parse_range(range) { + Ok(m) => Mode::InputRange(m), + Err(msg) => { + crash!(1, "{}", msg); + } + } } else { - let echo = matches.opt_present("echo"); - let mode = match matches.opt_str("input-range") { - Some(range) => { - if echo { - show_error!("cannot specify more than one mode"); - return 1; - } - match parse_range(range) { - Ok(m) => Mode::InputRange(m), - Err(msg) => { - crash!(1, "{}", msg); - } - } - } - None => { - if echo { - Mode::Echo - } else { - if matches.free.is_empty() { - matches.free.push("-".to_owned()); - } else if matches.free.len() > 1 { - show_error!("extra operand '{}'", &matches.free[1][..]); - } - Mode::Default - } - } - }; - let repeat = matches.opt_present("repeat"); - let sep = if matches.opt_present("zero-terminated") { - 0x00_u8 - } else { - 0x0a_u8 - }; - let count = match matches.opt_str("head-count") { - Some(cnt) => match cnt.parse::() { + Mode::Default(matches.value_of(options::FILE).unwrap_or("-").to_string()) + }; + + let options = Options { + head_count: match matches.value_of(options::HEAD_COUNT) { + Some(count) => match count.parse::() { Ok(val) => val, - Err(e) => { - show_error!("'{}' is not a valid count: {}", cnt, e); + Err(_) => { + show_error!("invalid line count: '{}'", count); return 1; } }, - None => MAX_USIZE, - }; - let output = matches.opt_str("output"); - let random = matches.opt_str("random-source"); + None => std::usize::MAX, + }, + output: matches.value_of(options::OUTPUT).map(String::from), + random_source: matches.value_of(options::RANDOM_SOURCE).map(String::from), + repeat: matches.is_present(options::REPEAT), + sep: if matches.is_present(options::ZERO_TERMINATED) { + 0x00_u8 + } else { + 0x0a_u8 + }, + }; - match mode { - Mode::Echo => { - // XXX: this doesn't correctly handle non-UTF-8 cmdline args - let mut evec = matches - .free - .iter() - .map(String::as_bytes) - .collect::>(); - find_seps(&mut evec, sep); - shuf_bytes(&mut evec, repeat, count, sep, output, random); - } - Mode::InputRange((b, e)) => { - let rvec = (b..e).map(|x| format!("{}", x)).collect::>(); - let mut rvec = rvec.iter().map(String::as_bytes).collect::>(); - shuf_bytes(&mut rvec, repeat, count, sep, output, random); - } - Mode::Default => { - let fdata = read_input_file(&matches.free[0][..]); - let mut fdata = vec![&fdata[..]]; - find_seps(&mut fdata, sep); - shuf_bytes(&mut fdata, repeat, count, sep, output, random); - } + match mode { + Mode::Echo(args) => { + let mut evec = args.iter().map(String::as_bytes).collect::>(); + find_seps(&mut evec, options.sep); + shuf_bytes(&mut evec, options); + } + Mode::InputRange((b, e)) => { + let rvec = (b..e).map(|x| format!("{}", x)).collect::>(); + let mut rvec = rvec.iter().map(String::as_bytes).collect::>(); + shuf_bytes(&mut rvec, options); + } + Mode::Default(filename) => { + let fdata = read_input_file(&filename); + let mut fdata = vec![&fdata[..]]; + find_seps(&mut fdata, options.sep); + shuf_bytes(&mut fdata, options); } } @@ -193,15 +223,8 @@ fn find_seps(data: &mut Vec<&[u8]>, sep: u8) { } } -fn shuf_bytes( - input: &mut Vec<&[u8]>, - repeat: bool, - count: usize, - sep: u8, - output: Option, - random: Option, -) { - let mut output = BufWriter::new(match output { +fn shuf_bytes(input: &mut Vec<&[u8]>, opts: Options) { + let mut output = BufWriter::new(match opts.output { None => Box::new(stdout()) as Box, Some(s) => match File::create(&s[..]) { Ok(f) => Box::new(f) as Box, @@ -209,7 +232,7 @@ fn shuf_bytes( }, }); - let mut rng = match random { + let mut rng = match opts.random_source { Some(r) => WrappedRng::RngFile(rand::read::ReadRng::new(match File::open(&r[..]) { Ok(f) => f, Err(e) => crash!(1, "failed to open random source '{}': {}", &r[..], e), @@ -225,7 +248,7 @@ fn shuf_bytes( len_mod <<= 1; } - let mut count = count; + let mut count = opts.head_count; while count > 0 && !input.is_empty() { let mut r = input.len(); while r >= input.len() { @@ -237,11 +260,11 @@ fn shuf_bytes( .write_all(input[r]) .unwrap_or_else(|e| crash!(1, "write failed: {}", e)); output - .write_all(&[sep]) + .write_all(&[opts.sep]) .unwrap_or_else(|e| crash!(1, "write failed: {}", e)); // if we do not allow repeats, remove the chosen value from the input vector - if !repeat { + if !opts.repeat { // shrink the mask if we will drop below a power of 2 if input.len() % 2 == 0 && len_mod > 2 { len_mod >>= 1; @@ -253,18 +276,18 @@ fn shuf_bytes( } } -fn parse_range(input_range: String) -> Result<(usize, usize), String> { +fn parse_range(input_range: &str) -> Result<(usize, usize), String> { let split: Vec<&str> = input_range.split('-').collect(); if split.len() != 2 { - Err("invalid range format".to_owned()) + Err(format!("invalid input range: '{}'", input_range)) } else { let begin = match split[0].parse::() { Ok(m) => m, - Err(e) => return Err(format!("{} is not a valid number: {}", split[0], e)), + Err(_) => return Err(format!("invalid input range: '{}'", split[0])), }; let end = match split[1].parse::() { Ok(m) => m, - Err(e) => return Err(format!("{} is not a valid number: {}", split[1], e)), + Err(_) => return Err(format!("invalid input range: '{}'", split[1])), }; Ok((begin, end + 1)) } diff --git a/tests/by-util/test_shuf.rs b/tests/by-util/test_shuf.rs index 651491045..3913621ef 100644 --- a/tests/by-util/test_shuf.rs +++ b/tests/by-util/test_shuf.rs @@ -1 +1,55 @@ -// ToDO: add tests +// ToDO: add more tests + +use crate::common::util::*; + +#[test] +fn test_shuf_echo_and_input_range_not_allowed() { + let result = new_ucmd!().args(&["-e", "0", "-i", "0-2"]).run(); + + assert!(!result.success); + assert!(result + .stderr + .contains("The argument '--input-range ' cannot be used with '--echo ...'")); +} + +#[test] +fn test_shuf_input_range_and_file_not_allowed() { + let result = new_ucmd!().args(&["-i", "0-9", "file"]).run(); + + assert!(!result.success); + assert!(result + .stderr + .contains("The argument '' cannot be used with '--input-range '")); +} + +#[test] +fn test_shuf_invalid_input_range_one() { + let result = new_ucmd!().args(&["-i", "0"]).run(); + + assert!(!result.success); + assert!(result.stderr.contains("invalid input range")); +} + +#[test] +fn test_shuf_invalid_input_range_two() { + let result = new_ucmd!().args(&["-i", "a-9"]).run(); + + assert!(!result.success); + assert!(result.stderr.contains("invalid input range: 'a'")); +} + +#[test] +fn test_shuf_invalid_input_range_three() { + let result = new_ucmd!().args(&["-i", "0-b"]).run(); + + assert!(!result.success); + assert!(result.stderr.contains("invalid input range: 'b'")); +} + +#[test] +fn test_shuf_invalid_input_line_count() { + let result = new_ucmd!().args(&["-n", "a"]).run(); + + assert!(!result.success); + assert!(result.stderr.contains("invalid line count: 'a'")); +} From 88d0bb01c01f238a611f24687d089f272ad44f12 Mon Sep 17 00:00:00 2001 From: jaggededgedjustice Date: Sun, 28 Mar 2021 16:52:01 +0100 Subject: [PATCH 529/606] Add shuf tests (#1958) * Add tests for shuf * Fixup GNU tests for shuf --- .github/workflows/GNU.yml | 4 +- tests/by-util/test_shuf.rs | 165 ++++++++++++++++++++++++++++- tests/fixtures/shuf/file_input.txt | 10 ++ 3 files changed, 175 insertions(+), 4 deletions(-) create mode 100644 tests/fixtures/shuf/file_input.txt diff --git a/.github/workflows/GNU.yml b/.github/workflows/GNU.yml index 9eb5da2b9..35efccbe5 100644 --- a/.github/workflows/GNU.yml +++ b/.github/workflows/GNU.yml @@ -84,8 +84,8 @@ jobs: sed -i 's|stat|/usr/bin/stat|' tests/chgrp/basic.sh tests/cp/existing-perm-dir.sh tests/touch/60-seconds.sh tests/misc/sort-compress-proc.sh sed -i 's|ls -|/usr/bin/ls -|' tests/chgrp/posix-H.sh tests/chown/deref.sh tests/cp/same-file.sh tests/misc/mknod.sh tests/mv/part-symlink.sh tests/du/8gb.sh sed -i 's|mkdir |/usr/bin/mkdir |' tests/cp/existing-perm-dir.sh tests/rm/empty-inacc.sh - sed -i 's|timeout \([[:digit:]]\)| /usr/bin/timeout \1|' tests/tail-2/inotify-rotate.sh tests/tail-2/inotify-dir-recreate.sh tests/tail-2/inotify-rotate-resources.sh tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh tests/tail-2/follow-name.sh # Don't break the function called 'grep_timeout' - sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/du/inaccessible-cwd.sh tests/mv/i-2.sh tests/chgrp/basic.sh + sed -i 's|timeout \([[:digit:]]\)| /usr/bin/timeout \1|' tests/tail-2/inotify-rotate.sh tests/tail-2/inotify-dir-recreate.sh tests/tail-2/inotify-rotate-resources.sh tests/cp/parent-perm-race.sh tests/ls/infloop.sh tests/misc/sort-exit-early.sh tests/misc/sort-NaN-infloop.sh tests/misc/uniq-perf.sh tests/tail-2/inotify-only-regular.sh tests/tail-2/pipe-f2.sh tests/tail-2/retry.sh tests/tail-2/symlink.sh tests/tail-2/wait.sh tests/tail-2/pid.sh tests/dd/stats.sh tests/tail-2/follow-name.sh tests/misc/shuf.sh # Don't break the function called 'grep_timeout' + sed -i 's|chmod |/usr/bin/chmod |' tests/du/inacc-dir.sh tests/mkdir/p-3.sh tests/tail-2/tail-n0f.sh tests/cp/fail-perm.sh tests/du/inaccessible-cwd.sh tests/mv/i-2.sh tests/chgrp/basic.sh tests/misc/shuf.sh sed -i 's|sort |/usr/bin/sort |' tests/ls/hyperlink.sh tests/misc/test-N.sh sed -i 's|split |/usr/bin/split |' tests/misc/factor-parallel.sh sed -i 's|truncate |/usr/bin/truncate |' tests/split/fail.sh diff --git a/tests/by-util/test_shuf.rs b/tests/by-util/test_shuf.rs index 3913621ef..065cef804 100644 --- a/tests/by-util/test_shuf.rs +++ b/tests/by-util/test_shuf.rs @@ -1,7 +1,168 @@ -// ToDO: add more tests - use crate::common::util::*; +#[test] +fn test_output_is_random_permutation() { + let input_seq = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let input = input_seq + .iter() + .map(|x| x.to_string()) + .collect::>() + .join("\n"); + + let result = new_ucmd!() + .pipe_in(input.as_bytes()) + .succeeds() + .no_stderr() + .stdout + .clone(); + + let mut result_seq: Vec = result + .split("\n") + .filter(|x| !x.is_empty()) + .map(|x| x.parse().unwrap()) + .collect(); + result_seq.sort(); + assert_ne!(result, input, "Output is not randomised"); + assert_eq!(result_seq, input_seq, "Output is not a permutation"); +} + +#[test] +fn test_zero_termination() { + let input_seq = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let result = new_ucmd!() + .arg("-z") + .arg("-i1-10") + .succeeds() + .no_stderr() + .stdout + .clone(); + + let mut result_seq: Vec = result + .split("\0") + .filter(|x| !x.is_empty()) + .map(|x| x.parse().unwrap()) + .collect(); + result_seq.sort(); + assert_eq!(result_seq, input_seq, "Output is not a permutation"); +} + +#[test] +fn test_echo() { + let input_seq = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let result = new_ucmd!() + .arg("-e") + .args( + &input_seq + .iter() + .map(|x| x.to_string()) + .collect::>(), + ) + .succeeds() + .no_stderr() + .stdout + .clone(); + + let mut result_seq: Vec = result + .split("\n") + .filter(|x| !x.is_empty()) + .map(|x| x.parse().unwrap()) + .collect(); + result_seq.sort(); + assert_eq!(result_seq, input_seq, "Output is not a permutation"); +} + +#[test] +fn test_head_count() { + let repeat_limit = 5; + let input_seq = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let input = input_seq + .iter() + .map(|x| x.to_string()) + .collect::>() + .join("\n"); + + let result = new_ucmd!() + .args(&["-n", &repeat_limit.to_string()]) + .pipe_in(input.as_bytes()) + .succeeds() + .no_stderr() + .stdout + .clone(); + + let mut result_seq: Vec = result + .split("\n") + .filter(|x| !x.is_empty()) + .map(|x| x.parse().unwrap()) + .collect(); + result_seq.sort(); + assert_eq!(result_seq.len(), repeat_limit, "Output is not limited"); + assert!( + result_seq.iter().all(|x| input_seq.contains(x)), + format!("Output includes element not from input: {}", result) + ) +} + +#[test] +fn test_repeat() { + let repeat_limit = 15000; + let input_seq = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let input = input_seq + .iter() + .map(|x| x.to_string()) + .collect::>() + .join("\n"); + + let result = new_ucmd!() + .arg("-r") + .args(&["-n", &repeat_limit.to_string()]) + .pipe_in(input.as_bytes()) + .succeeds() + .no_stderr() + .stdout + .clone(); + + let result_seq: Vec = result + .split("\n") + .filter(|x| !x.is_empty()) + .map(|x| x.parse().unwrap()) + .collect(); + assert_eq!( + result_seq.len(), + repeat_limit, + "Output is not repeating forever" + ); + assert!( + result_seq.iter().all(|x| input_seq.contains(x)), + format!( + "Output includes element not from input: {:?}", + result_seq + .iter() + .filter(|x| !input_seq.contains(x)) + .collect::>() + ) + ) +} + +#[test] +fn test_file_input() { + let expected_seq = vec![11, 12, 13, 14, 15, 16, 17, 18, 19, 20]; + + let result = new_ucmd!() + .arg("file_input.txt") + .succeeds() + .no_stderr() + .stdout + .clone(); + + let mut result_seq: Vec = result + .split("\n") + .filter(|x| !x.is_empty()) + .map(|x| x.parse().unwrap()) + .collect(); + result_seq.sort(); + assert_eq!(result_seq, expected_seq, "Output is not a permutation"); +} + #[test] fn test_shuf_echo_and_input_range_not_allowed() { let result = new_ucmd!().args(&["-e", "0", "-i", "0-2"]).run(); diff --git a/tests/fixtures/shuf/file_input.txt b/tests/fixtures/shuf/file_input.txt new file mode 100644 index 000000000..fc316949e --- /dev/null +++ b/tests/fixtures/shuf/file_input.txt @@ -0,0 +1,10 @@ +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 From a9a3794d5a366f185d65e8c4908b4db180cdec20 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 28 Mar 2021 20:56:37 +0200 Subject: [PATCH 530/606] chmod: add tests --- src/uu/chmod/src/chmod.rs | 2 +- tests/by-util/test_chmod.rs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index 119447b14..819c674a0 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -170,7 +170,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // Iterate 'args' and delete the first occurrence // of a prefix '-' if it's associated with MODE // e.g. "chmod -v -xw -R FILE" -> "chmod -v xw -R FILE" -fn strip_minus_from_mode(args: &mut Vec) -> bool { +pub fn strip_minus_from_mode(args: &mut Vec) -> bool { for i in 0..args.len() { if args[i].starts_with("-") { if let Some(second) = args[i].chars().nth(1) { diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index e7bc72677..3a53202fc 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -4,6 +4,8 @@ use std::os::unix::fs::{OpenOptionsExt, PermissionsExt}; use std::sync::Mutex; extern crate libc; +use self::chmod::strip_minus_from_mode; +extern crate chmod; use self::libc::umask; static TEST_FILE: &'static str = "file"; @@ -374,3 +376,32 @@ fn test_chmod_symlink_non_existing_recursive() { .stderr .contains("neither symbolic link 'tmp/test-long.link' nor referent has been changed")); } + +#[test] +fn test_chmod_strip_minus_from_mode() { + let tests = vec![ + // ( before, after ) + ("chmod -v -xw -R FILE", "chmod -v xw -R FILE"), + ("chmod g=rwx FILE -c", "chmod g=rwx FILE -c"), + ( + "chmod -c -R -w,o+w FILE --preserve-root", + "chmod -c -R w,o+w FILE --preserve-root", + ), + ("chmod -c -R +w FILE ", "chmod -c -R +w FILE "), + ("chmod a=r,=xX FILE", "chmod a=r,=xX FILE"), + ( + "chmod -v --reference RFILE -R FILE", + "chmod -v --reference RFILE -R FILE", + ), + ("chmod -Rvc -w-x FILE", "chmod -Rvc w-x FILE"), + ("chmod 755 -v FILE", "chmod 755 -v FILE"), + ("chmod -v +0004 FILE -R", "chmod -v +0004 FILE -R"), + ("chmod -v -0007 FILE -R", "chmod -v 0007 FILE -R"), + ]; + + for test in tests { + let mut args: Vec = test.0.split(" ").map(|v| v.to_string()).collect(); + let _mode_had_minus_prefix = strip_minus_from_mode(&mut args); + assert_eq!(test.1, args.join(" ")); + } +} From 3714e2201b388b8d07e81ded15031433dab7a2db Mon Sep 17 00:00:00 2001 From: Dominik Bittner Date: Mon, 29 Mar 2021 13:00:47 +0200 Subject: [PATCH 531/606] tty: Move from getopts to clap (#1956) + tty: Add some tests --- src/uu/tty/Cargo.toml | 2 +- src/uu/tty/src/tty.rs | 90 ++++++++++++++++++--------------------- tests/by-util/test_tty.rs | 58 ++++++++++++++++++++++++- 3 files changed, 100 insertions(+), 50 deletions(-) diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index 9912a3b9a..7e4ffbd79 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/tty.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index 110f76d30..18d69db46 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -12,68 +12,62 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::ffi::CStr; use uucore::fs::is_stdin_interactive; -extern "C" { - fn ttyname(filedesc: libc::c_int) -> *const libc::c_char; +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Print the file name of the terminal connected to standard input."; + +mod options { + pub const SILENT: &str = "silent"; } -static NAME: &str = "tty"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); +fn get_usage() -> String { + format!("{0} [OPTION]...", executable!()) +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); + let usage = get_usage(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(options::SILENT) + .long(options::SILENT) + .visible_alias("quiet") + .short("s") + .help("print nothing, only return an exit status") + .required(false), + ) + .get_matches_from(args); - opts.optflag("s", "silent", "print nothing, only return an exit status"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); + let silent = matches.is_present(options::SILENT); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(2, "{}", f), + // Call libc function ttyname + let tty = unsafe { + let ptr = libc::ttyname(libc::STDIN_FILENO); + if !ptr.is_null() { + String::from_utf8_lossy(CStr::from_ptr(ptr).to_bytes()).to_string() + } else { + "".to_owned() + } }; - if matches.opt_present("help") { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage:"); - println!(" {} [OPTION]...", NAME); - println!(); - print!( - "{}", - opts.usage("Print the file name of the terminal connected to standard input.") - ); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else { - let silent = matches.opt_present("s"); - - let tty = unsafe { - let ptr = ttyname(libc::STDIN_FILENO); - if !ptr.is_null() { - String::from_utf8_lossy(CStr::from_ptr(ptr).to_bytes()).to_string() - } else { - "".to_owned() - } - }; - - if !silent { - if !tty.chars().all(|c| c.is_whitespace()) { - println!("{}", tty); - } else { - println!("not a tty"); - } - } - - return if is_stdin_interactive() { - libc::EXIT_SUCCESS + if !silent { + if !tty.chars().all(|c| c.is_whitespace()) { + println!("{}", tty); } else { - libc::EXIT_FAILURE - }; + println!("not a tty"); + } } - 0 + return if is_stdin_interactive() { + libc::EXIT_SUCCESS + } else { + libc::EXIT_FAILURE + }; } diff --git a/tests/by-util/test_tty.rs b/tests/by-util/test_tty.rs index 651491045..6bca54e03 100644 --- a/tests/by-util/test_tty.rs +++ b/tests/by-util/test_tty.rs @@ -1 +1,57 @@ -// ToDO: add tests +use crate::common::util::*; + +#[test] +#[cfg(not(windows))] +fn test_dev_null() { + new_ucmd!() + .pipe_in(" Date: Mon, 29 Mar 2021 21:33:24 +1030 Subject: [PATCH 532/606] tr: move from getopts to claps #1929 (#1954) --- Cargo.lock | 6 +-- src/uu/tr/Cargo.toml | 2 +- src/uu/tr/src/tr.rs | 101 +++++++++++++++++++++++++------------------ 3 files changed, 62 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 343ad1e30..8d42c573e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1325,9 +1325,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.65" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a1d708c221c5a612956ef9f75b37e454e88d1f7b899fbd3a18d4252012d663" +checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" dependencies = [ "proc-macro2", "quote 1.0.9", @@ -2334,8 +2334,8 @@ name = "uu_tr" version = "0.0.4" dependencies = [ "bit-set", + "clap", "fnv", - "getopts", "uucore", "uucore_procs", ] diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index 918698e24..3683211f6 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -17,7 +17,7 @@ path = "src/tr.rs" [dependencies] bit-set = "0.5.0" fnv = "1.0.5" -getopts = "0.2.18" +clap = "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index d60d2559a..ff1bb49d5 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -16,16 +16,27 @@ extern crate uucore; mod expand; use bit_set::BitSet; +use clap::{App, Arg}; use fnv::FnvHashMap; -use getopts::Options; use std::io::{stdin, stdout, BufRead, BufWriter, Write}; use crate::expand::ExpandSet; static NAME: &str = "tr"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "translate or delete characters"; +static LONG_HELP: &str = "Translate, squeeze, and/or delete characters from standard input, +writing to standard output."; const BUFFER_LEN: usize = 1024; +mod options { + pub const COMPLEMENT: &str = "complement"; + pub const DELETE: &str = "delete"; + pub const SQUEEZE: &str = "squeeze-repeats"; + pub const TRUNCATE: &str = "truncate"; + pub const SETS: &str = "sets"; +} + trait SymbolTranslator { fn translate(&self, c: char, prev_c: char) -> Option; } @@ -170,56 +181,60 @@ fn translate_input( } } -fn usage(opts: &Options) { - println!("{} {}", NAME, VERSION); - println!(); - println!("Usage:"); - println!(" {} [OPTIONS] SET1 [SET2]", NAME); - println!(); - println!("{}", opts.usage("Translate or delete characters.")); +fn get_usage() -> String { + format!("{} [OPTION]... SET1 [SET2]", executable!()) } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::COMPLEMENT) + .short("C") + .short("c") + .long(options::COMPLEMENT) + .help("use the complement of SET1"), + ) + .arg( + Arg::with_name(options::DELETE) + .short("d") + .long(options::DELETE) + .help("delete characters in SET1, do not translate"), + ) + .arg( + Arg::with_name(options::SQUEEZE) + .long(options::SQUEEZE) + .short("s") + .help( + "replace each sequence of a repeated character that is + listed in the last specified SET, with a single occurrence + of that character", + ), + ) + .arg( + Arg::with_name(options::TRUNCATE) + .long(options::TRUNCATE) + .short("t") + .help("first truncate SET1 to length of SET2"), + ) + .arg(Arg::with_name(options::SETS).multiple(true)) + .get_matches_from(args); - opts.optflag("c", "complement", "use the complement of SET1"); - opts.optflag("C", "", "same as -c"); - opts.optflag("d", "delete", "delete characters in SET1"); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("s", "squeeze", "replace each sequence of a repeated character that is listed in the last specified SET, with a single occurrence of that character"); - opts.optflag( - "t", - "truncate-set1", - "first truncate SET1 to length of SET2", - ); - opts.optflag("V", "version", "output version information and exit"); + let dflag = matches.is_present(options::DELETE); + let cflag = matches.is_present(options::COMPLEMENT); + let sflag = matches.is_present(options::SQUEEZE); + let tflag = matches.is_present(options::TRUNCATE); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(err) => { - show_error!("{}", err); - return 1; - } + let sets: Vec = match matches.values_of(options::SETS) { + Some(v) => v.map(|v| v.to_string()).collect(), + None => vec![], }; - if matches.opt_present("help") { - usage(&opts); - return 0; - } - - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let dflag = matches.opt_present("d"); - let cflag = matches.opts_present(&["c".to_owned(), "C".to_owned()]); - let sflag = matches.opt_present("s"); - let tflag = matches.opt_present("t"); - let sets = matches.free; - if sets.is_empty() { show_error!( "missing operand\nTry `{} --help` for more information.", From 8cc7a90d7ceb580b695ac5c2de264467456bbd69 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Mon, 29 Mar 2021 14:03:56 +0300 Subject: [PATCH 533/606] sum: fix crash on invalid inputs, move to clap, add tests (#1952) --- Cargo.lock | 6 +-- src/uu/sum/Cargo.toml | 2 +- src/uu/sum/src/sum.rs | 93 ++++++++++++++++++++++----------------- tests/by-util/test_sum.rs | 20 +++++++++ 4 files changed, 77 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8d42c573e..c950fb58e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2250,9 +2250,9 @@ dependencies = [ name = "uu_sum" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index a880ba1f7..1e8590616 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/sum.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/sum/src/sum.rs b/src/uu/sum/src/sum.rs index 5c1652196..ed5655a3d 100644 --- a/src/uu/sum/src/sum.rs +++ b/src/uu/sum/src/sum.rs @@ -10,12 +10,16 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs::File; use std::io::{stdin, Read, Result}; use std::path::Path; static NAME: &str = "sum"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static USAGE: &str = + "[OPTION]... [FILE]...\nWith no FILE, or when FILE is -, read standard input."; +static SUMMARY: &str = "Checksum and count the blocks in a file."; fn bsd_sum(mut reader: Box) -> (usize, u16) { let mut buf = [0; 1024]; @@ -64,55 +68,59 @@ fn open(name: &str) -> Result> { match name { "-" => Ok(Box::new(stdin()) as Box), _ => { - let f = File::open(&Path::new(name))?; + let path = &Path::new(name); + if path.is_dir() { + return Err(std::io::Error::new( + std::io::ErrorKind::InvalidInput, + "Is a directory", + )); + }; + if !path.metadata().is_ok() { + return Err(std::io::Error::new( + std::io::ErrorKind::NotFound, + "No such file or directory", + )); + }; + let f = File::open(path)?; Ok(Box::new(f) as Box) } } } +mod options { + pub static FILE: &str = "file"; + pub static BSD_COMPATIBLE: &str = "r"; + pub static SYSTEM_V_COMPATIBLE: &str = "sysv"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(USAGE) + .about(SUMMARY) + .arg(Arg::with_name(options::FILE).multiple(true).hidden(true)) + .arg( + Arg::with_name(options::BSD_COMPATIBLE) + .short(options::BSD_COMPATIBLE) + .help("use the BSD compatible algorithm (default)"), + ) + .arg( + Arg::with_name(options::SYSTEM_V_COMPATIBLE) + .short("s") + .long(options::SYSTEM_V_COMPATIBLE) + .help("use the BSD compatible algorithm (default)"), + ) + .get_matches_from(args); - opts.optflag("r", "", "use the BSD compatible algorithm (default)"); - opts.optflag("s", "sysv", "use System V compatible algorithm"); - opts.optflag("h", "help", "show this help message"); - opts.optflag("v", "version", "print the version and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "Invalid options\n{}", f), + let files: Vec = match matches.values_of(options::FILE) { + Some(v) => v.clone().map(|v| v.to_owned()).collect(), + None => vec!["-".to_owned()], }; - if matches.opt_present("help") { - let msg = format!( - "{0} {1} - -Usage: - {0} [OPTION]... [FILE]... - -Checksum and count the blocks in a file.", - NAME, VERSION - ); - println!( - "{}\nWith no FILE, or when FILE is -, read standard input.", - opts.usage(&msg) - ); - return 0; - } - if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - return 0; - } - - let sysv = matches.opt_present("sysv"); - - let files = if matches.free.is_empty() { - vec!["-".to_owned()] - } else { - matches.free - }; + let sysv = matches.is_present(options::SYSTEM_V_COMPATIBLE); let print_names = if sysv { files.len() > 1 || files[0] != "-" @@ -120,10 +128,15 @@ Checksum and count the blocks in a file.", files.len() > 1 }; + let mut exit_code = 0; for file in &files { let reader = match open(file) { Ok(f) => f, - _ => crash!(1, "unable to open file"), + Err(error) => { + show_error!("'{}' {}", file, error); + exit_code = 2; + continue; + } }; let (blocks, sum) = if sysv { sysv_sum(reader) @@ -138,5 +151,5 @@ Checksum and count the blocks in a file.", } } - 0 + exit_code } diff --git a/tests/by-util/test_sum.rs b/tests/by-util/test_sum.rs index 83cf689ac..d12455749 100644 --- a/tests/by-util/test_sum.rs +++ b/tests/by-util/test_sum.rs @@ -52,3 +52,23 @@ fn test_sysv_stdin() { .succeeds() .stdout_only_fixture("sysv_stdin.expected"); } + +#[test] +fn test_invalid_file() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.mkdir("a"); + + ucmd.arg("a") + .fails() + .stderr_is("sum: error: 'a' Is a directory"); +} + +#[test] +fn test_invalid_metadata() { + let (_, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("b") + .fails() + .stderr_is("sum: error: 'b' No such file or directory"); +} From da5f2f3a6c774fd495ec003065321a4c31843db2 Mon Sep 17 00:00:00 2001 From: electricboogie <32370782+electricboogie@users.noreply.github.com> Date: Mon, 29 Mar 2021 06:05:52 -0500 Subject: [PATCH 534/606] sort: Add a GNU-style Random Sorter (#1922) --- Cargo.lock | 19 ++++ src/uu/sort/Cargo.toml | 2 + src/uu/sort/src/sort.rs | 222 +++++++++++++++++++++++++++++++------ tests/by-util/test_sort.rs | 62 +++++++++-- 4 files changed, 261 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c950fb58e..07a99069c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1317,6 +1317,12 @@ dependencies = [ "maybe-uninit", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "strsim" version = "0.8.0" @@ -1443,6 +1449,17 @@ dependencies = [ "serde_json", ] +[[package]] +name = "twox-hash" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59" +dependencies = [ + "cfg-if 0.1.10", + "rand 0.7.3", + "static_assertions", +] + [[package]] name = "typenum" version = "1.13.0" @@ -2200,7 +2217,9 @@ version = "0.0.4" dependencies = [ "clap", "itertools 0.8.2", + "rand 0.7.3", "semver", + "twox-hash", "uucore", "uucore_procs", ] diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 5158f6e52..e50caf53b 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -15,7 +15,9 @@ edition = "2018" path = "src/sort.rs" [dependencies] +rand = "0.7" clap = "2.33" +twox-hash = "1.6.0" itertools = "0.8.0" semver = "0.9.0" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 8e79ff947..f8789835a 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1,6 +1,7 @@ // * This file is part of the uutils coreutils package. // * // * (c) Michael Yin +// * (c) Robert Swinford // * // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. @@ -12,13 +13,17 @@ extern crate uucore; use clap::{App, Arg}; use itertools::Itertools; +use rand::distributions::Alphanumeric; +use rand::{thread_rng, Rng}; use semver::Version; use std::cmp::Ordering; use std::collections::BinaryHeap; use std::fs::File; +use std::hash::{Hash, Hasher}; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Lines, Read, Write}; use std::mem::replace; use std::path::Path; +use twox_hash::XxHash64; use uucore::fs::is_stdin_interactive; // for Iterator::dedup() static NAME: &str = "sort"; @@ -34,16 +39,18 @@ static OPT_DICTIONARY_ORDER: &str = "dictionary-order"; static OPT_MERGE: &str = "merge"; static OPT_CHECK: &str = "check"; static OPT_IGNORE_CASE: &str = "ignore-case"; +static OPT_IGNORE_BLANKS: &str = "ignore-blanks"; static OPT_OUTPUT: &str = "output"; static OPT_REVERSE: &str = "reverse"; static OPT_STABLE: &str = "stable"; static OPT_UNIQUE: &str = "unique"; +static OPT_RANDOM: &str = "random-sort"; static ARG_FILES: &str = "files"; static DECIMAL_PT: char = '.'; static THOUSANDS_SEP: char = ','; - +#[derive(Eq, Ord, PartialEq, PartialOrd)] enum SortMode { Numeric, HumanNumeric, @@ -60,8 +67,10 @@ struct Settings { stable: bool, unique: bool, check: bool, + random: bool, compare_fns: Vec Ordering>, transform_fns: Vec String>, + salt: String, } impl Default for Settings { @@ -74,8 +83,10 @@ impl Default for Settings { stable: false, unique: false, check: false, + random: false, compare_fns: Vec::new(), transform_fns: Vec::new(), + salt: String::new(), } } } @@ -155,17 +166,14 @@ impl<'a> Iterator for FileMerger<'a> { } } } + fn get_usage() -> String { format!( "{0} {1} - Usage: {0} [OPTION]... [FILE]... - Write the sorted concatenation of all FILE(s) to standard output. - Mandatory arguments for long options are mandatory for short options too. - With no FILE, or when FILE is -, read standard input.", NAME, VERSION ) @@ -228,6 +236,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_IGNORE_CASE) .help("fold lower case to upper case characters"), ) + .arg( + Arg::with_name(OPT_IGNORE_BLANKS) + .short("b") + .long(OPT_IGNORE_BLANKS) + .help("ignore leading blanks when finding sort keys in each line"), + ) .arg( Arg::with_name(OPT_OUTPUT) .short("o") @@ -236,6 +250,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .value_name("FILENAME"), ) + .arg( + Arg::with_name(OPT_RANDOM) + .short("R") + .long(OPT_RANDOM) + .help("shuffle in random order"), + ) .arg( Arg::with_name(OPT_REVERSE) .short("r") @@ -285,11 +305,20 @@ pub fn uumain(args: impl uucore::Args) -> i32 { settings.transform_fns.push(|s| s.to_uppercase()); } + if matches.is_present(OPT_IGNORE_BLANKS) { + settings.transform_fns.push(|s| s.trim_start().to_string()); + } + settings.outfile = matches.value_of(OPT_OUTPUT).map(String::from); settings.reverse = matches.is_present(OPT_REVERSE); settings.stable = matches.is_present(OPT_STABLE); settings.unique = matches.is_present(OPT_UNIQUE); + if matches.is_present(OPT_RANDOM) { + settings.random = matches.is_present(OPT_RANDOM); + settings.salt = get_rand_string(); + } + //let mut files = matches.free; if files.is_empty() { /* if no file, default to stdin */ @@ -313,10 +342,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } - exec(files, &settings) + exec(files, &mut settings) } -fn exec(files: Vec, settings: &Settings) -> i32 { +fn exec(files: Vec, settings: &mut Settings) -> i32 { let mut lines = Vec::new(); let mut file_merger = FileMerger::new(&settings); @@ -351,6 +380,13 @@ fn exec(files: Vec, settings: &Settings) -> i32 { } else { print_sorted(file_merger, &settings.outfile) } + } else if settings.unique && settings.mode == SortMode::Numeric { + print_sorted( + lines + .iter() + .dedup_by(|a, b| num_sort_dedup(a) == num_sort_dedup(b)), + &settings.outfile, + ) } else if settings.unique { print_sorted(lines.iter().dedup(), &settings.outfile) } else { @@ -419,7 +455,11 @@ fn compare_by(a: &str, b: &str, settings: &Settings) -> Ordering { }; for compare_fn in &settings.compare_fns { - let cmp = compare_fn(a, b); + let cmp: Ordering = if settings.random { + random_shuffle(a, b, settings.salt.clone()) + } else { + compare_fn(a, b) + }; if cmp != Ordering::Equal { if settings.reverse { return cmp.reverse(); @@ -431,36 +471,60 @@ fn compare_by(a: &str, b: &str, settings: &Settings) -> Ordering { Ordering::Equal } -/// Parse the beginning string into an f64, returning -inf instead of NaN on errors. -fn permissive_f64_parse(a: &str) -> f64 { - // Maybe should be split on non-digit, but then 10e100 won't parse properly. - // On the flip side, this will give NEG_INFINITY for "1,234", which might be OK - // because there's no way to handle both CSV and thousands separators without a new flag. - // GNU sort treats "1,234" as "1" in numeric, so maybe it's fine. - // GNU sort treats "NaN" as non-number in numeric, so it needs special care. - match a.split_whitespace().next() { - None => std::f64::NEG_INFINITY, - Some(sa) => match sa.parse::() { - Ok(a) if a.is_nan() => std::f64::NEG_INFINITY, - Ok(a) => a, - Err(_) => std::f64::NEG_INFINITY, - }, - } -} - fn default_compare(a: &str, b: &str) -> Ordering { a.cmp(b) } -/// Compares two floating point numbers, with errors being assumed to be -inf. -/// Stops coercing at the first whitespace char, so 1e2 will parse as 100 but -/// 1,000 will parse as -inf. +fn get_leading_number(a: &str) -> &str { + let mut s = ""; + for c in a.chars() { + if !c.is_numeric() && !c.eq(&'-') && !c.eq(&' ') && !c.eq(&'.') && !c.eq(&',') { + s = a.trim().split(c).next().unwrap(); + break; + } + s = a.trim(); + } + return s; +} + +// Matches GNU behavior, see: +// https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html +// Specifically *not* the same as sort -n | uniq +fn num_sort_dedup(a: &str) -> &str { + // Empty lines are dumped + if a.is_empty() { + return "0" + // And lines that don't begin numerically are dumped + } else if !a.trim().chars().nth(0).unwrap_or('\0').is_numeric() { + return "0" + } else { + // Prepare lines for comparison of only the numerical leading numbers + return get_leading_number(a) + }; +} + +/// Parse the beginning string into an f64, returning -inf instead of NaN on errors. +fn permissive_f64_parse(a: &str) -> f64 { + // GNU sort treats "NaN" as non-number in numeric, so it needs special care. + match a.parse::() { + Ok(a) if a.is_nan() => std::f64::NEG_INFINITY, + Ok(a) => a, + Err(_) => std::f64::NEG_INFINITY, + } +} + +/// Compares two floats, with errors and non-numerics assumed to be -inf. +/// Stops coercing at the first non-numeric char. fn numeric_compare(a: &str, b: &str) -> Ordering { #![allow(clippy::comparison_chain)] - let fa = permissive_f64_parse(a); - let fb = permissive_f64_parse(b); - // f64::cmp isn't implemented because NaN messes with it - // but we sidestep that with permissive_f64_parse so just fake it + + let sa = get_leading_number(a); + let sb = get_leading_number(b); + + let fa = permissive_f64_parse(sa); + let fb = permissive_f64_parse(sb); + + // f64::cmp isn't implemented (due to NaN issues); implement directly instead if fa > fb { Ordering::Greater } else if fa < fb { @@ -471,10 +535,10 @@ fn numeric_compare(a: &str, b: &str) -> Ordering { } fn human_numeric_convert(a: &str) -> f64 { - let int_str: String = a.chars().take_while(|c| c.is_numeric()).collect(); - let suffix = a.chars().find(|c| !c.is_numeric()); - let int_part = int_str.parse::().unwrap_or(-1f64) as f64; - let suffix: f64 = match suffix.unwrap_or('\0') { + let int_str = get_leading_number(a); + let (_, s) = a.split_at(int_str.len()); + let int_part = permissive_f64_parse(int_str); + let suffix: f64 = match s.parse().unwrap_or('\0') { 'K' => 1000f64, 'M' => 1E6, 'G' => 1E9, @@ -501,6 +565,30 @@ fn human_numeric_size_compare(a: &str, b: &str) -> Ordering { } } +fn random_shuffle(a: &str, b: &str, salt: String) -> Ordering { + #![allow(clippy::comparison_chain)] + let salt_slice = salt.as_str(); + + let da = hash(&[a, salt_slice].concat()); + let db = hash(&[b, salt_slice].concat()); + + da.cmp(&db) +} + +fn get_rand_string() -> String { + thread_rng() + .sample_iter(&Alphanumeric) + .take(16) + .map(char::from) + .collect::() +} + +fn hash(t: &T) -> u64 { + let mut s: XxHash64 = Default::default(); + t.hash(&mut s); + s.finish() +} + #[derive(Eq, Ord, PartialEq, PartialOrd)] enum Month { Unknown, @@ -606,3 +694,65 @@ fn open(path: &str) -> Option<(Box, bool)> { } } } + +#[cfg(test)] +mod tests { + + use super::*; + + #[test] + fn test_default_compare() { + let a = "your own"; + let b = "your place"; + + assert_eq!(Ordering::Less, default_compare(a, b)); + } + + #[test] + fn test_numeric_compare1() { + let a = "149:7"; + let b = "150:5"; + + assert_eq!(Ordering::Less, numeric_compare(a, b)); + } + + #[test] + fn test_numeric_compare2() { + let a = "-1.02"; + let b = "1"; + + assert_eq!(Ordering::Less, numeric_compare(a, b)); + } + + #[test] + fn test_human_numeric_compare() { + let a = "300K"; + let b = "1M"; + + assert_eq!(Ordering::Less, human_numeric_size_compare(a, b)); + } + + #[test] + fn test_month_compare() { + let a = "JaN"; + let b = "OCt"; + + assert_eq!(Ordering::Less, month_compare(a, b)); + } + #[test] + fn test_version_compare() { + let a = "1.2.3-alpha2"; + let b = "1.4.0"; + + assert_eq!(Ordering::Less, version_compare(a, b)); + } + + #[test] + fn test_random_compare() { + let a = "9"; + let b = "9"; + let c = get_rand_string(); + + assert_eq!(Ordering::Equal, random_shuffle(a, b, c)); + } +} diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 9ff1b3522..2bac71def 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -2,22 +2,43 @@ use crate::common::util::*; #[test] fn test_numeric_floats_and_ints() { - test_helper("numeric_floats_and_ints", "-n"); + for numeric_sort_param in vec!["-n", "--numeric-sort"] { + let input = "1.444\n8.013\n1\n-8\n1.04\n-1"; + new_ucmd!() + .arg(numeric_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("-8\n-1\n1\n1.04\n1.444\n8.013\n"); + } } #[test] fn test_numeric_floats() { - test_helper("numeric_floats", "-n"); + for numeric_sort_param in vec!["-n", "--numeric-sort"] { + let input = "1.444\n8.013\n1.58590\n-8.90880\n1.040000000\n-.05"; + new_ucmd!() + .arg(numeric_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("-8.90880\n-.05\n1.040000000\n1.444\n1.58590\n8.013\n"); + } } #[test] fn test_numeric_floats_with_nan() { - test_helper("numeric_floats_with_nan", "-n"); + for numeric_sort_param in vec!["-n", "--numeric-sort"] { + let input = "1.444\n1.0/0.0\n1.58590\n-8.90880\n1.040000000\n-.05"; + new_ucmd!() + .arg(numeric_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("-8.90880\n-.05\n1.0/0.0\n1.040000000\n1.444\n1.58590\n"); + } } #[test] fn test_numeric_unfixed_floats() { - test_helper("numeric_unfixed_floats", "-n"); + test_helper("numeric_fixed_floats", "-n"); } #[test] @@ -32,12 +53,26 @@ fn test_numeric_unsorted_ints() { #[test] fn test_human_block_sizes() { - test_helper("human_block_sizes", "-h"); + for human_numeric_sort_param in vec!["-h", "--human-numeric-sort"] { + let input = "8981K\n909991M\n-8T\n21G\n0.8M"; + new_ucmd!() + .arg(human_numeric_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("-8T\n0.8M\n8981K\n21G\n909991M\n"); + } } #[test] fn test_month_default() { - test_helper("month_default", "-M"); + for month_sort_param in vec!["-M", "--month-sort"] { + let input = "JAn\nMAY\n000may\nJun\nFeb"; + new_ucmd!() + .arg(month_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("000may\nJAn\nFeb\nMAY\nJun\n"); + } } #[test] @@ -47,12 +82,23 @@ fn test_month_stable() { #[test] fn test_default_unsorted_ints() { - test_helper("default_unsorted_ints", ""); + let input = "9\n1909888\n000\n1\n2"; + new_ucmd!() + .pipe_in(input) + .succeeds() + .stdout_only("000\n1\n1909888\n2\n9\n"); } #[test] fn test_numeric_unique_ints() { - test_helper("numeric_unsorted_ints_unique", "-nu"); + for numeric_unique_sort_param in vec!["-nu"] { + let input = "9\n9\n8\n1\n"; + new_ucmd!() + .arg(numeric_unique_sort_param) + .pipe_in(input) + .succeeds() + .stdout_only("1\n8\n9\n"); + } } #[test] From 8320b1ec5f58a94372edce2477480fb0116df262 Mon Sep 17 00:00:00 2001 From: Mikadore Date: Mon, 29 Mar 2021 13:08:48 +0200 Subject: [PATCH 535/606] Rewrote head (#1911) See https://github.com/uutils/coreutils/pull/1911 for the details --- src/uu/head/Cargo.toml | 2 +- src/uu/head/src/head.rs | 828 +++++++++++++----- src/uu/head/src/parse.rs | 282 ++++++ src/uu/head/src/split.rs | 60 ++ tests/by-util/test_head.rs | 105 ++- .../head/lorem_ipsum_backwards_file.expected | 24 + tests/fixtures/head/sequence | 100 +++ tests/fixtures/head/sequence.expected | 90 ++ 8 files changed, 1235 insertions(+), 256 deletions(-) create mode 100644 src/uu/head/src/parse.rs create mode 100644 src/uu/head/src/split.rs mode change 100644 => 100755 tests/by-util/test_head.rs create mode 100644 tests/fixtures/head/lorem_ipsum_backwards_file.expected create mode 100644 tests/fixtures/head/sequence create mode 100644 tests/fixtures/head/sequence.expected diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index adcce2726..1cd075113 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/head.rs" [dependencies] -libc = "0.2.42" +clap = "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 0036dbba9..a8f519f6b 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -1,240 +1,642 @@ -// * This file is part of the uutils coreutils package. -// * -// * (c) Alan Andrade -// * -// * For the full copyright and license information, please view the LICENSE -// * file that was distributed with this source code. -// * -// * Synced with: https://raw.github.com/avsm/src/master/usr.bin/head/head.c +use clap::{App, Arg}; +use std::convert::TryFrom; +use std::ffi::OsString; +use std::io::{ErrorKind, Read, Seek, SeekFrom, Write}; +use uucore::{crash, executable, show_error}; -#[macro_use] -extern crate uucore; +const EXIT_FAILURE: i32 = 1; +const EXIT_SUCCESS: i32 = 0; +const BUF_SIZE: usize = 65536; -use std::collections::VecDeque; -use std::fs::File; -use std::io::{stdin, BufRead, BufReader, Read}; -use std::path::Path; -use std::str::from_utf8; +const VERSION: &str = env!("CARGO_PKG_VERSION"); +const ABOUT: &str = "\ + Print the first 10 lines of each FILE to standard output.\n\ + With more than one FILE, precede each with a header giving the file name.\n\ + \n\ + With no FILE, or when FILE is -, read standard input.\n\ + \n\ + Mandatory arguments to long flags are mandatory for short flags too.\ + "; +const USAGE: &str = "head [FLAG]... [FILE]..."; -static SYNTAX: &str = ""; -static SUMMARY: &str = ""; -static LONG_HELP: &str = ""; +mod options { + pub const BYTES_NAME: &str = "BYTES"; + pub const LINES_NAME: &str = "LINES"; + pub const QUIET_NAME: &str = "QUIET"; + pub const VERBOSE_NAME: &str = "VERBOSE"; + pub const ZERO_NAME: &str = "ZERO"; + pub const FILES_NAME: &str = "FILE"; +} +mod parse; +mod split; -enum FilterMode { - Bytes(usize), +fn app<'a>() -> App<'a, 'a> { + App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(USAGE) + .arg( + Arg::with_name(options::BYTES_NAME) + .short("c") + .long("bytes") + .value_name("[-]NUM") + .takes_value(true) + .help( + "\ + print the first NUM bytes of each file;\n\ + with the leading '-', print all but the last\n\ + NUM bytes of each file\ + ", + ) + .overrides_with_all(&[options::BYTES_NAME, options::LINES_NAME]) + .allow_hyphen_values(true), + ) + .arg( + Arg::with_name(options::LINES_NAME) + .short("n") + .long("lines") + .value_name("[-]NUM") + .takes_value(true) + .help( + "\ + print the first NUM lines instead of the first 10;\n\ + with the leading '-', print all but the last\n\ + NUM lines of each file\ + ", + ) + .overrides_with_all(&[options::LINES_NAME, options::BYTES_NAME]) + .allow_hyphen_values(true), + ) + .arg( + Arg::with_name(options::QUIET_NAME) + .short("q") + .long("--quiet") + .visible_alias("silent") + .help("never print headers giving file names") + .overrides_with_all(&[options::VERBOSE_NAME, options::QUIET_NAME]), + ) + .arg( + Arg::with_name(options::VERBOSE_NAME) + .short("v") + .long("verbose") + .help("always print headers giving file names") + .overrides_with_all(&[options::QUIET_NAME, options::VERBOSE_NAME]), + ) + .arg( + Arg::with_name(options::ZERO_NAME) + .short("z") + .long("zero-terminated") + .help("line delimiter is NUL, not newline") + .overrides_with(options::ZERO_NAME), + ) + .arg(Arg::with_name(options::FILES_NAME).multiple(true)) +} +#[derive(PartialEq, Debug, Clone, Copy)] +enum Modes { Lines(usize), - NLines(usize), + Bytes(usize), } -struct Settings { - mode: FilterMode, - verbose: bool, - zero_terminated: bool, +fn parse_mode(src: &str, closure: F) -> Result<(Modes, bool), String> +where + F: FnOnce(usize) -> Modes, +{ + match parse::parse_num(src) { + Ok((n, last)) => Ok((closure(n), last)), + Err(reason) => match reason { + parse::ParseError::Syntax => Err(format!("'{}'", src)), + parse::ParseError::Overflow => { + Err(format!("'{}': Value too large for defined datatype", src)) + } + }, + } } -impl Default for Settings { - fn default() -> Settings { - Settings { - mode: FilterMode::Lines(10), - verbose: false, - zero_terminated: false, +fn arg_iterate<'a>( + mut args: impl uucore::Args + 'a, +) -> Result + 'a>, String> { + // argv[0] is always present + let first = args.next().unwrap(); + if let Some(second) = args.next() { + if let Some(s) = second.to_str() { + match parse::parse_obsolete(s) { + Some(Ok(iter)) => Ok(Box::new(vec![first].into_iter().chain(iter).chain(args))), + Some(Err(e)) => match e { + parse::ParseError::Syntax => Err(format!("bad argument format: '{}'", s)), + parse::ParseError::Overflow => Err(format!( + "invalid argument: '{}' Value too large for defined datatype", + s + )), + }, + None => Ok(Box::new(vec![first, second].into_iter().chain(args))), + } + } else { + Err("bad argument encoding".to_owned()) } + } else { + Ok(Box::new(vec![first].into_iter())) + } +} + +#[derive(Debug, PartialEq)] +struct HeadOptions { + pub quiet: bool, + pub verbose: bool, + pub zeroed: bool, + pub all_but_last: bool, + pub mode: Modes, + pub files: Vec, +} + +impl HeadOptions { + pub fn new() -> HeadOptions { + HeadOptions { + quiet: false, + verbose: false, + zeroed: false, + all_but_last: false, + mode: Modes::Lines(10), + files: Vec::new(), + } + } + + ///Construct options from matches + pub fn get_from(args: impl uucore::Args) -> Result { + let matches = app().get_matches_from(arg_iterate(args)?); + + let mut options = HeadOptions::new(); + + options.quiet = matches.is_present(options::QUIET_NAME); + options.verbose = matches.is_present(options::VERBOSE_NAME); + options.zeroed = matches.is_present(options::ZERO_NAME); + + let mode_and_from_end = if let Some(v) = matches.value_of(options::BYTES_NAME) { + match parse_mode(v, Modes::Bytes) { + Ok(v) => v, + Err(err) => { + return Err(format!("invalid number of bytes: {}", err)); + } + } + } else if let Some(v) = matches.value_of(options::LINES_NAME) { + match parse_mode(v, Modes::Lines) { + Ok(v) => v, + Err(err) => { + return Err(format!("invalid number of lines: {}", err)); + } + } + } else { + (Modes::Lines(10), false) + }; + + options.mode = mode_and_from_end.0; + options.all_but_last = mode_and_from_end.1; + + options.files = match matches.values_of(options::FILES_NAME) { + Some(v) => v.map(|s| s.to_owned()).collect(), + None => vec!["-".to_owned()], + }; + //println!("{:#?}", options); + Ok(options) + } +} +// to make clippy shut up +impl Default for HeadOptions { + fn default() -> Self { + Self::new() + } +} + +fn rbuf_n_bytes(input: &mut impl std::io::BufRead, n: usize) -> std::io::Result<()> { + if n == 0 { + return Ok(()); + } + let mut readbuf = [0u8; BUF_SIZE]; + let mut i = 0usize; + + let stdout = std::io::stdout(); + let mut stdout = stdout.lock(); + + loop { + let read = loop { + match input.read(&mut readbuf) { + Ok(n) => break n, + Err(e) => match e.kind() { + ErrorKind::Interrupted => {} + _ => return Err(e), + }, + } + }; + if read == 0 { + // might be unexpected if + // we haven't read `n` bytes + // but this mirrors GNU's behavior + return Ok(()); + } + stdout.write_all(&readbuf[..read.min(n - i)])?; + i += read.min(n - i); + if i == n { + return Ok(()); + } + } +} + +fn rbuf_n_lines(input: &mut impl std::io::BufRead, n: usize, zero: bool) -> std::io::Result<()> { + if n == 0 { + return Ok(()); + } + let stdout = std::io::stdout(); + let mut stdout = stdout.lock(); + let mut lines = 0usize; + split::walk_lines(input, zero, |e| match e { + split::Event::Data(dat) => { + stdout.write_all(dat)?; + Ok(true) + } + split::Event::Line => { + lines += 1; + if lines == n { + Ok(false) + } else { + Ok(true) + } + } + }) +} + +fn rbuf_but_last_n_bytes(input: &mut impl std::io::BufRead, n: usize) -> std::io::Result<()> { + if n == 0 { + //prints everything + return rbuf_n_bytes(input, std::usize::MAX); + } + let stdout = std::io::stdout(); + let mut stdout = stdout.lock(); + + let mut ringbuf = vec![0u8; n]; + + // first we fill the ring buffer + if let Err(e) = input.read_exact(&mut ringbuf) { + if e.kind() == ErrorKind::UnexpectedEof { + return Ok(()); + } else { + return Err(e); + } + } + let mut buffer = [0u8; BUF_SIZE]; + loop { + let read = loop { + match input.read(&mut buffer) { + Ok(n) => break n, + Err(e) => match e.kind() { + ErrorKind::Interrupted => {} + _ => return Err(e), + }, + } + }; + if read == 0 { + return Ok(()); + } else if read >= n { + stdout.write_all(&ringbuf)?; + stdout.write_all(&buffer[..read - n])?; + for i in 0..n { + ringbuf[i] = buffer[read - n + i]; + } + } else { + stdout.write_all(&ringbuf[..read])?; + for i in 0..n - read { + ringbuf[i] = ringbuf[read + i]; + } + ringbuf[n - read..].copy_from_slice(&buffer[..read]); + } + } +} + +fn rbuf_but_last_n_lines( + input: &mut impl std::io::BufRead, + n: usize, + zero: bool, +) -> std::io::Result<()> { + if n == 0 { + //prints everything + return rbuf_n_bytes(input, std::usize::MAX); + } + let mut ringbuf = vec![Vec::new(); n]; + let stdout = std::io::stdout(); + let mut stdout = stdout.lock(); + let mut line = Vec::new(); + let mut lines = 0usize; + split::walk_lines(input, zero, |e| match e { + split::Event::Data(dat) => { + line.extend_from_slice(dat); + Ok(true) + } + split::Event::Line => { + if lines < n { + ringbuf[lines] = std::mem::replace(&mut line, Vec::new()); + lines += 1; + } else { + stdout.write_all(&ringbuf[0])?; + ringbuf.rotate_left(1); + ringbuf[n - 1] = std::mem::replace(&mut line, Vec::new()); + } + Ok(true) + } + }) +} + +fn head_backwards_file(input: &mut std::fs::File, options: &HeadOptions) -> std::io::Result<()> { + assert!(options.all_but_last); + let size = input.seek(SeekFrom::End(0))?; + let size = usize::try_from(size).unwrap(); + match options.mode { + Modes::Bytes(n) => { + if n >= size { + return Ok(()); + } else { + input.seek(SeekFrom::Start(0))?; + rbuf_n_bytes( + &mut std::io::BufReader::with_capacity(BUF_SIZE, input), + size - n, + )?; + } + } + Modes::Lines(n) => { + let mut buffer = [0u8; BUF_SIZE]; + let buffer = &mut buffer[..BUF_SIZE.min(size)]; + let mut i = 0usize; + let mut lines = 0usize; + + let found = 'o: loop { + // the casts here are ok, `buffer.len()` should never be above a few k + input.seek(SeekFrom::Current( + -((buffer.len() as i64).min((size - i) as i64)), + ))?; + input.read_exact(buffer)?; + for byte in buffer.iter().rev() { + match byte { + b'\n' if !options.zeroed => { + lines += 1; + } + 0u8 if options.zeroed => { + lines += 1; + } + _ => {} + } + // if it were just `n`, + if lines == n + 1 { + break 'o i; + } + i += 1; + } + if size - i == 0 { + return Ok(()); + } + }; + input.seek(SeekFrom::Start(0))?; + rbuf_n_bytes( + &mut std::io::BufReader::with_capacity(BUF_SIZE, input), + size - found, + )?; + } + } + Ok(()) +} + +fn head_file(input: &mut std::fs::File, options: &HeadOptions) -> std::io::Result<()> { + if options.all_but_last { + head_backwards_file(input, options) + } else { + match options.mode { + Modes::Bytes(n) => { + rbuf_n_bytes(&mut std::io::BufReader::with_capacity(BUF_SIZE, input), n) + } + Modes::Lines(n) => rbuf_n_lines( + &mut std::io::BufReader::with_capacity(BUF_SIZE, input), + n, + options.zeroed, + ), + } + } +} + +fn uu_head(options: &HeadOptions) { + let mut first = true; + for fname in &options.files { + let res = match fname.as_str() { + "-" => { + if options.verbose { + if !first { + println!(); + } + println!("==> standard input <==") + } + let stdin = std::io::stdin(); + let mut stdin = stdin.lock(); + match options.mode { + Modes::Bytes(n) => { + if options.all_but_last { + rbuf_but_last_n_bytes(&mut stdin, n) + } else { + rbuf_n_bytes(&mut stdin, n) + } + } + Modes::Lines(n) => { + if options.all_but_last { + rbuf_but_last_n_lines(&mut stdin, n, options.zeroed) + } else { + rbuf_n_lines(&mut stdin, n, options.zeroed) + } + } + } + } + name => { + let mut file = match std::fs::File::open(name) { + Ok(f) => f, + Err(err) => match err.kind() { + ErrorKind::NotFound => { + crash!( + EXIT_FAILURE, + "head: cannot open '{}' for reading: No such file or directory", + name + ); + } + ErrorKind::PermissionDenied => { + crash!( + EXIT_FAILURE, + "head: cannot open '{}' for reading: Permission denied", + name + ); + } + _ => { + crash!( + EXIT_FAILURE, + "head: cannot open '{}' for reading: {}", + name, + err + ); + } + }, + }; + if (options.files.len() > 1 && !options.quiet) || options.verbose { + println!("==> {} <==", name) + } + head_file(&mut file, options) + } + }; + if res.is_err() { + if fname.as_str() == "-" { + crash!( + EXIT_FAILURE, + "head: error reading standard input: Input/output error" + ); + } else { + crash!( + EXIT_FAILURE, + "head: error reading {}: Input/output error", + fname + ); + } + } + first = false; } } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); - - let mut settings: Settings = Default::default(); - - // handle obsolete -number syntax - let new_args = match obsolete(&args[0..]) { - (args, Some(n)) => { - settings.mode = FilterMode::Lines(n); - args - } - (args, None) => args, - }; - - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optopt( - "c", - "bytes", - "Print the first K bytes. With the leading '-', print all but the last K bytes", - "[-]K", - ) - .optopt( - "n", - "lines", - "Print the first K lines. With the leading '-', print all but the last K lines", - "[-]K", - ) - .optflag("q", "quiet", "never print headers giving file names") - .optflag("v", "verbose", "always print headers giving file names") - .optflag("z", "zero-terminated", "line delimiter is NUL, not newline") - .optflag("h", "help", "display this help and exit") - .optflag("V", "version", "output version information and exit") - .parse(new_args); - - let use_bytes = matches.opt_present("c"); - // TODO: suffixes (e.g. b, kB, etc.) - match matches.opt_str("n") { - Some(n) => { - if use_bytes { - show_error!("cannot specify both --bytes and --lines."); - return 1; - } - - match n.parse::() { - Ok(m) => { - settings.mode = if m < 0 { - let m: usize = m.abs() as usize; - FilterMode::NLines(m) - } else { - let m: usize = m.abs() as usize; - FilterMode::Lines(m) - } - } - Err(e) => { - show_error!("invalid line count '{}': {}", n, e); - return 1; - } - } - } - None => { - if let Some(count) = matches.opt_str("c") { - match count.parse::() { - Ok(m) => settings.mode = FilterMode::Bytes(m), - Err(e) => { - show_error!("invalid byte count '{}': {}", count, e); - return 1; - } - } - } + let args = match HeadOptions::get_from(args) { + Ok(o) => o, + Err(s) => { + crash!(EXIT_FAILURE, "head: {}", s); } }; + uu_head(&args); - let quiet = matches.opt_present("q"); - let verbose = matches.opt_present("v"); - settings.zero_terminated = matches.opt_present("z"); - let files = matches.free; - - // GNU implementation allows multiple declarations of "-q" and "-v" with the - // last flag winning. This can't be simulated with the getopts cargo unless - // we manually parse the arguments. Given the declaration of both flags, - // verbose mode always wins. This is a potential future improvement. - if files.len() > 1 && !quiet && !verbose { - settings.verbose = true; - } - if quiet { - settings.verbose = false; - } - if verbose { - settings.verbose = true; - } - - if files.is_empty() { - let mut buffer = BufReader::new(stdin()); - head(&mut buffer, &settings); - } else { - let mut first_time = true; - - for file in &files { - if settings.verbose { - if !first_time { - println!(); - } - println!("==> {} <==", file); - } - first_time = false; - - let path = Path::new(file); - if path.is_dir() || !path.metadata().is_ok() { - eprintln!( - "cannot open '{}' for reading: No such file or directory", - &path.to_str().unwrap() - ); - continue; - } - let reader = File::open(&path).unwrap(); - let mut buffer = BufReader::new(reader); - if !head(&mut buffer, &settings) { - break; - } - } - } - - 0 + EXIT_SUCCESS } -// It searches for an option in the form of -123123 -// -// In case is found, the options vector will get rid of that object so that -// getopts works correctly. -fn obsolete(options: &[String]) -> (Vec, Option) { - let mut options: Vec = options.to_vec(); - let mut a = 1; - let b = options.len(); +#[cfg(test)] +mod tests { + use std::ffi::OsString; - while a < b { - let previous = options[a - 1].clone(); - let current = options[a].clone(); - let current = current.as_bytes(); - - if previous != "-n" && current.len() > 1 && current[0] == b'-' { - let len = current.len(); - for pos in 1..len { - // Ensure that the argument is only made out of digits - if !(current[pos] as char).is_numeric() { - break; - } - - // If this is the last number - if pos == len - 1 { - options.remove(a); - let number: Option = - from_utf8(¤t[1..len]).unwrap().parse::().ok(); - return (options, Some(number.unwrap())); - } - } - } - - a += 1; + use super::*; + fn options(args: &str) -> Result { + let combined = "head ".to_owned() + args; + let args = combined.split_whitespace(); + HeadOptions::get_from(args.map(|s| OsString::from(s))) } + #[test] + fn test_args_modes() { + let args = options("-n -10M -vz").unwrap(); + assert!(args.zeroed); + assert!(args.verbose); + assert!(args.all_but_last); + assert_eq!(args.mode, Modes::Lines(10 * 1024 * 1024)); + } + #[test] + fn test_gnu_compatibility() { + let args = options("-n 1 -c 1 -n 5 -c kiB -vqvqv").unwrap(); + assert!(args.mode == Modes::Bytes(1024)); + assert!(args.verbose); + assert_eq!(options("-5").unwrap().mode, Modes::Lines(5)); + assert_eq!(options("-2b").unwrap().mode, Modes::Bytes(1024)); + assert_eq!(options("-5 -c 1").unwrap().mode, Modes::Bytes(1)); + } + #[test] + fn all_args_test() { + assert!(options("--silent").unwrap().quiet); + assert!(options("--quiet").unwrap().quiet); + assert!(options("-q").unwrap().quiet); + assert!(options("--verbose").unwrap().verbose); + assert!(options("-v").unwrap().verbose); + assert!(options("--zero-terminated").unwrap().zeroed); + assert!(options("-z").unwrap().zeroed); + assert_eq!(options("--lines 15").unwrap().mode, Modes::Lines(15)); + assert_eq!(options("-n 15").unwrap().mode, Modes::Lines(15)); + assert_eq!(options("--bytes 15").unwrap().mode, Modes::Bytes(15)); + assert_eq!(options("-c 15").unwrap().mode, Modes::Bytes(15)); + } + #[test] + fn test_options_errors() { + assert!(options("-n IsThisTheRealLife?").is_err()); + assert!(options("-c IsThisJustFantasy").is_err()); + } + #[test] + fn test_options_correct_defaults() { + let opts = HeadOptions::new(); + let opts2: HeadOptions = Default::default(); - (options, None) -} + assert_eq!(opts, opts2); -// TODO: handle errors on read -fn head(reader: &mut BufReader, settings: &Settings) -> bool { - match settings.mode { - FilterMode::Bytes(count) => { - for byte in reader.bytes().take(count) { - print!("{}", byte.unwrap() as char); - } - } - FilterMode::Lines(count) => { - if settings.zero_terminated { - for line in reader.split(0).take(count) { - print!("{}\0", String::from_utf8(line.unwrap()).unwrap()) - } - } else { - for line in reader.lines().take(count) { - println!("{}", line.unwrap()); - } - } - } - FilterMode::NLines(count) => { - let mut vector: VecDeque = VecDeque::new(); - - for line in reader.lines() { - vector.push_back(line.unwrap()); - if vector.len() <= count { - continue; - } - println!("{}", vector.pop_front().unwrap()); + assert!(opts.verbose == false); + assert!(opts.quiet == false); + assert!(opts.zeroed == false); + assert!(opts.all_but_last == false); + assert_eq!(opts.mode, Modes::Lines(10)); + assert!(opts.files.is_empty()); + } + #[test] + fn test_parse_mode() { + assert_eq!( + parse_mode("123", Modes::Lines), + Ok((Modes::Lines(123), false)) + ); + assert_eq!( + parse_mode("-456", Modes::Bytes), + Ok((Modes::Bytes(456), true)) + ); + assert!(parse_mode("Nonsensical Nonsense", Modes::Bytes).is_err()); + #[cfg(target_pointer_width = "64")] + assert!(parse_mode("1Y", Modes::Lines).is_err()); + #[cfg(target_pointer_width = "32")] + assert!(parse_mode("1T", Modes::Bytes).is_err()); + } + fn arg_outputs(src: &str) -> Result { + let split = src.split_whitespace().map(|x| OsString::from(x)); + match arg_iterate(split) { + Ok(args) => { + let vec = args + .map(|s| s.to_str().unwrap().to_owned()) + .collect::>(); + Ok(vec.join(" ")) } + Err(e) => Err(e), } } - true + #[test] + fn test_arg_iterate() { + // test that normal args remain unchanged + assert_eq!( + arg_outputs("head -n -5 -zv"), + Ok("head -n -5 -zv".to_owned()) + ); + // tests that nonsensical args are unchanged + assert_eq!( + arg_outputs("head -to_be_or_not_to_be,..."), + Ok("head -to_be_or_not_to_be,...".to_owned()) + ); + //test that the obsolete syntax is unrolled + assert_eq!( + arg_outputs("head -123qvqvqzc"), + Ok("head -q -z -c 123".to_owned()) + ); + //test that bad obsoletes are an error + assert!(arg_outputs("head -123FooBar").is_err()); + //test overflow + assert!(arg_outputs("head -100000000000000000000000000000000000000000").is_err()); + //test that empty args remain unchanged + assert_eq!(arg_outputs("head"), Ok("head".to_owned())); + } + #[test] + #[cfg(linux)] + fn test_arg_iterate_bad_encoding() { + let invalid = unsafe { std::str::from_utf8_unchecked(b"\x80\x81") }; + // this arises from a conversion from OsString to &str + assert!( + arg_iterate(vec![OsString::from("head"), OsString::from(invalid)].into_iter()).is_err() + ); + } + #[test] + fn rbuf_early_exit() { + let mut empty = std::io::BufReader::new(std::io::Cursor::new(Vec::new())); + assert!(rbuf_n_bytes(&mut empty, 0).is_ok()); + assert!(rbuf_n_lines(&mut empty, 0, false).is_ok()); + } } diff --git a/src/uu/head/src/parse.rs b/src/uu/head/src/parse.rs new file mode 100644 index 000000000..470d821e0 --- /dev/null +++ b/src/uu/head/src/parse.rs @@ -0,0 +1,282 @@ +use std::convert::TryFrom; +use std::ffi::OsString; + +#[derive(PartialEq, Debug)] +pub enum ParseError { + Syntax, + Overflow, +} +/// Parses obsolete syntax +/// head -NUM[kmzv] +pub fn parse_obsolete(src: &str) -> Option, ParseError>> { + let mut chars = src.char_indices(); + if let Some((_, '-')) = chars.next() { + let mut num_end = 0usize; + let mut has_num = false; + let mut last_char = 0 as char; + while let Some((n, c)) = chars.next() { + if c.is_numeric() { + has_num = true; + num_end = n; + } else { + last_char = c; + break; + } + } + if has_num { + match src[1..=num_end].parse::() { + Ok(num) => { + let mut quiet = false; + let mut verbose = false; + let mut zero_terminated = false; + let mut multiplier = None; + let mut c = last_char; + loop { + // not that here, we only match lower case 'k', 'c', and 'm' + match c { + // we want to preserve order + // this also saves us 1 heap allocation + 'q' => { + quiet = true; + verbose = false + } + 'v' => { + verbose = true; + quiet = false + } + 'z' => zero_terminated = true, + 'c' => multiplier = Some(1), + 'b' => multiplier = Some(512), + 'k' => multiplier = Some(1024), + 'm' => multiplier = Some(1024 * 1024), + '\0' => {} + _ => return Some(Err(ParseError::Syntax)), + } + if let Some((_, next)) = chars.next() { + c = next + } else { + break; + } + } + let mut options = Vec::new(); + if quiet { + options.push(OsString::from("-q")) + } + if verbose { + options.push(OsString::from("-v")) + } + if zero_terminated { + options.push(OsString::from("-z")) + } + if let Some(n) = multiplier { + options.push(OsString::from("-c")); + let num = match num.checked_mul(n) { + Some(n) => n, + None => return Some(Err(ParseError::Overflow)), + }; + options.push(OsString::from(format!("{}", num))); + } else { + options.push(OsString::from("-n")); + options.push(OsString::from(format!("{}", num))); + } + Some(Ok(options.into_iter())) + } + Err(_) => Some(Err(ParseError::Overflow)), + } + } else { + None + } + } else { + None + } +} +/// Parses an -c or -n argument, +/// the bool specifies whether to read from the end +pub fn parse_num(src: &str) -> Result<(usize, bool), ParseError> { + let mut num_start = 0; + let mut chars = src.char_indices(); + let (mut chars, all_but_last) = match chars.next() { + Some((_, c)) => { + if c == '-' { + num_start += 1; + (chars, true) + } else { + (src.char_indices(), false) + } + } + None => return Err(ParseError::Syntax), + }; + let mut num_end = 0usize; + let mut last_char = 0 as char; + let mut num_count = 0usize; + while let Some((n, c)) = chars.next() { + if c.is_numeric() { + num_end = n; + num_count += 1; + } else { + last_char = c; + break; + } + } + + let num = if num_count > 0 { + match src[num_start..=num_end].parse::() { + Ok(n) => Some(n), + Err(_) => return Err(ParseError::Overflow), + } + } else { + None + }; + + if last_char == 0 as char { + if let Some(n) = num { + Ok((n, all_but_last)) + } else { + Err(ParseError::Syntax) + } + } else { + let base: u128 = match chars.next() { + Some((_, c)) => { + let b = match c { + 'B' if last_char != 'b' => 1000, + 'i' if last_char != 'b' => { + if let Some((_, 'B')) = chars.next() { + 1024 + } else { + return Err(ParseError::Syntax); + } + } + _ => return Err(ParseError::Syntax), + }; + if chars.next().is_some() { + return Err(ParseError::Syntax); + } else { + b + } + } + None => 1024, + }; + let mul = match last_char.to_lowercase().next().unwrap() { + 'b' => 512, + 'k' => base.pow(1), + 'm' => base.pow(2), + 'g' => base.pow(3), + 't' => base.pow(4), + 'p' => base.pow(5), + 'e' => base.pow(6), + 'z' => base.pow(7), + 'y' => base.pow(8), + _ => return Err(ParseError::Syntax), + }; + let mul = match usize::try_from(mul) { + Ok(n) => n, + Err(_) => return Err(ParseError::Overflow), + }; + match num.unwrap_or(1).checked_mul(mul) { + Some(n) => Ok((n, all_but_last)), + None => Err(ParseError::Overflow), + } + } +} +#[cfg(test)] +mod tests { + use super::*; + fn obsolete(src: &str) -> Option, ParseError>> { + let r = parse_obsolete(src); + match r { + Some(s) => match s { + Ok(v) => Some(Ok(v.map(|s| s.to_str().unwrap().to_owned()).collect())), + Err(e) => Some(Err(e)), + }, + None => None, + } + } + fn obsolete_result(src: &[&str]) -> Option, ParseError>> { + Some(Ok(src.iter().map(|s| s.to_string()).collect())) + } + #[test] + #[cfg(not(target_pointer_width = "128"))] + fn test_parse_overflow_x64() { + assert_eq!(parse_num("1Y"), Err(ParseError::Overflow)); + assert_eq!(parse_num("1Z"), Err(ParseError::Overflow)); + assert_eq!(parse_num("100E"), Err(ParseError::Overflow)); + assert_eq!(parse_num("100000P"), Err(ParseError::Overflow)); + assert_eq!(parse_num("1000000000T"), Err(ParseError::Overflow)); + assert_eq!( + parse_num("10000000000000000000000"), + Err(ParseError::Overflow) + ); + } + #[test] + #[cfg(target_pointer_width = "32")] + fn test_parse_overflow_x32() { + assert_eq!(parse_num("1T"), Err(ParseError::Overflow)); + assert_eq!(parse_num("1000G"), Err(ParseError::Overflow)); + } + #[test] + fn test_parse_bad_syntax() { + assert_eq!(parse_num("5MiB nonsense"), Err(ParseError::Syntax)); + assert_eq!(parse_num("Nonsense string"), Err(ParseError::Syntax)); + assert_eq!(parse_num("5mib"), Err(ParseError::Syntax)); + assert_eq!(parse_num("biB"), Err(ParseError::Syntax)); + assert_eq!(parse_num("-"), Err(ParseError::Syntax)); + assert_eq!(parse_num(""), Err(ParseError::Syntax)); + } + #[test] + fn test_parse_numbers() { + assert_eq!(parse_num("k"), Ok((1024, false))); + assert_eq!(parse_num("MiB"), Ok((1024 * 1024, false))); + assert_eq!(parse_num("-5"), Ok((5, true))); + assert_eq!(parse_num("b"), Ok((512, false))); + assert_eq!(parse_num("-2GiB"), Ok((2 * 1024 * 1024 * 1024, true))); + assert_eq!(parse_num("5M"), Ok((5 * 1024 * 1024, false))); + assert_eq!(parse_num("5MB"), Ok((5 * 1000 * 1000, false))); + } + #[test] + fn test_parse_numbers_obsolete() { + assert_eq!(obsolete("-5"), obsolete_result(&["-n", "5"])); + assert_eq!(obsolete("-100"), obsolete_result(&["-n", "100"])); + assert_eq!(obsolete("-5m"), obsolete_result(&["-c", "5242880"])); + assert_eq!(obsolete("-1k"), obsolete_result(&["-c", "1024"])); + assert_eq!(obsolete("-2b"), obsolete_result(&["-c", "1024"])); + assert_eq!(obsolete("-1mmk"), obsolete_result(&["-c", "1024"])); + assert_eq!(obsolete("-1vz"), obsolete_result(&["-v", "-z", "-n", "1"])); + assert_eq!( + obsolete("-1vzqvq"), + obsolete_result(&["-q", "-z", "-n", "1"]) + ); + assert_eq!(obsolete("-1vzc"), obsolete_result(&["-v", "-z", "-c", "1"])); + assert_eq!( + obsolete("-105kzm"), + obsolete_result(&["-z", "-c", "110100480"]) + ); + } + #[test] + fn test_parse_errors_obsolete() { + assert_eq!(obsolete("-5n"), Some(Err(ParseError::Syntax))); + assert_eq!(obsolete("-5c5"), Some(Err(ParseError::Syntax))); + } + #[test] + fn test_parse_obsolete_nomatch() { + assert_eq!(obsolete("-k"), None); + assert_eq!(obsolete("asd"), None); + } + #[test] + #[cfg(target_pointer_width = "64")] + fn test_parse_obsolete_overflow_x64() { + assert_eq!( + obsolete("-1000000000000000m"), + Some(Err(ParseError::Overflow)) + ); + assert_eq!( + obsolete("-10000000000000000000000"), + Some(Err(ParseError::Overflow)) + ); + } + #[test] + #[cfg(target_pointer_width = "32")] + fn test_parse_obsolete_overflow_x32() { + assert_eq!(obsolete("-42949672960"), Some(Err(ParseError::Overflow))); + assert_eq!(obsolete("-42949672k"), Some(Err(ParseError::Overflow))); + } +} diff --git a/src/uu/head/src/split.rs b/src/uu/head/src/split.rs new file mode 100644 index 000000000..9e9a0c685 --- /dev/null +++ b/src/uu/head/src/split.rs @@ -0,0 +1,60 @@ +#[derive(Debug)] +pub enum Event<'a> { + Data(&'a [u8]), + Line, +} +/// Loops over the lines read from a BufRead. +/// # Arguments +/// * `input` the ReadBuf to read from +/// * `zero` whether to use 0u8 as a line delimiter +/// * `on_event` a closure receiving some bytes read in a slice, or +/// event signalling a line was just read. +/// this is guaranteed to be signalled *directly* after the +/// slice containing the (CR on win)LF / 0 is passed +/// +/// Return whether to continue +pub fn walk_lines( + input: &mut impl std::io::BufRead, + zero: bool, + mut on_event: F, +) -> std::io::Result<()> +where + F: FnMut(Event) -> std::io::Result, +{ + let mut buffer = [0u8; super::BUF_SIZE]; + loop { + let read = loop { + match input.read(&mut buffer) { + Ok(n) => break n, + Err(e) => match e.kind() { + std::io::ErrorKind::Interrupted => {} + _ => return Err(e), + }, + } + }; + if read == 0 { + return Ok(()); + } + let mut base = 0usize; + for (i, byte) in buffer[..read].iter().enumerate() { + match byte { + b'\n' if !zero => { + on_event(Event::Data(&buffer[base..=i]))?; + base = i + 1; + if !on_event(Event::Line)? { + return Ok(()); + } + } + 0u8 if zero => { + on_event(Event::Data(&buffer[base..=i]))?; + base = i + 1; + if !on_event(Event::Line)? { + return Ok(()); + } + } + _ => {} + } + } + on_event(Event::Data(&buffer[base..read]))?; + } +} diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs old mode 100644 new mode 100755 index a1086c004..d91cc1289 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -86,88 +86,74 @@ fn test_verbose() { .stdout_is_fixture("lorem_ipsum_verbose.expected"); } -#[test] -fn test_zero_terminated() { - new_ucmd!() - .args(&["-z", "zero_terminated.txt"]) - .run() - .stdout_is_fixture("zero_terminated.expected"); -} - #[test] #[ignore] fn test_spams_newline() { + //this test is does not mirror what GNU does new_ucmd!().pipe_in("a").succeeds().stdout_is("a\n"); } #[test] -#[ignore] -fn test_unsupported_byte_syntax() { +fn test_byte_syntax() { new_ucmd!() .args(&["-1c"]) .pipe_in("abc") - .fails() - //GNU head returns "a" - .stdout_is("") - .stderr_is("head: error: Unrecognized option: \'1\'"); + .run() + .stdout_is("a"); } #[test] -#[ignore] -fn test_unsupported_line_syntax() { +fn test_line_syntax() { new_ucmd!() .args(&["-n", "2048m"]) .pipe_in("a\n") - .fails() - //.stdout_is("a\n"); What GNU head returns. - .stdout_is("") - .stderr_is("head: error: invalid line count \'2048m\': invalid digit found in string"); + .run() + .stdout_is("a\n"); } #[test] -#[ignore] -fn test_unsupported_zero_terminated_syntax() { +fn test_zero_terminated_syntax() { new_ucmd!() - .args(&["-z -n 1"]) + .args(&["-z", "-n", "1"]) .pipe_in("x\0y") - .fails() - //GNU Head returns "x\0" - .stderr_is("head: error: Unrecognized option: \'z\'"); + .run() + .stdout_is("x\0"); } #[test] -#[ignore] -fn test_unsupported_zero_terminated_syntax_2() { +fn test_zero_terminated_syntax_2() { new_ucmd!() - .args(&["-z -n 2"]) + .args(&["-z", "-n", "2"]) .pipe_in("x\0y") - .fails() - //GNU Head returns "x\0y" - .stderr_is("head: error: Unrecognized option: \'z\'"); + .run() + .stdout_is("x\0y"); } #[test] -#[ignore] -fn test_unsupported_negative_byte_syntax() { +fn test_negative_byte_syntax() { new_ucmd!() .args(&["--bytes=-2"]) .pipe_in("a\n") - .fails() - //GNU Head returns "" - .stderr_is("head: error: invalid byte count \'-2\': invalid digit found in string"); + .run() + .stdout_is(""); } #[test] -#[ignore] -fn test_bug_in_negative_zero_lines() { +fn test_negative_zero_lines() { new_ucmd!() .args(&["--lines=-0"]) .pipe_in("a\nb\n") .succeeds() - //GNU Head returns "a\nb\n" - .stdout_is(""); + .stdout_is("a\nb\n"); +} +#[test] +fn test_negative_zero_bytes() { + new_ucmd!() + .args(&["--bytes=-0"]) + .pipe_in("qwerty") + .succeeds() + .stdout_is("qwerty"); } - #[test] fn test_no_such_file_or_directory() { let result = new_ucmd!().arg("no_such_file.toml").run(); @@ -179,3 +165,38 @@ fn test_no_such_file_or_directory() { .contains("cannot open 'no_such_file.toml' for reading: No such file or directory") ) } + +// there was a bug not caught by previous tests +// where for negative n > 3, the total amount of lines +// was correct, but it would eat from the second line +#[test] +fn test_sequence_fixture() { + new_ucmd!() + .args(&["-n", "-10", "sequence"]) + .run() + .stdout_is_fixture("sequence.expected"); +} +#[test] +fn test_file_backwards() { + new_ucmd!() + .args(&["-c", "-10", "lorem_ipsum.txt"]) + .run() + .stdout_is_fixture("lorem_ipsum_backwards_file.expected"); +} + +#[test] +fn test_zero_terminated() { + new_ucmd!() + .args(&["-z", "zero_terminated.txt"]) + .run() + .stdout_is_fixture("zero_terminated.expected"); +} + +#[test] +fn test_obsolete_extras() { + new_ucmd!() + .args(&["-5zv"]) + .pipe_in("1\02\03\04\05\06") + .succeeds() + .stdout_is("==> standard input <==\n1\02\03\04\05\0"); +} diff --git a/tests/fixtures/head/lorem_ipsum_backwards_file.expected b/tests/fixtures/head/lorem_ipsum_backwards_file.expected new file mode 100644 index 000000000..fcf432187 --- /dev/null +++ b/tests/fixtures/head/lorem_ipsum_backwards_file.expected @@ -0,0 +1,24 @@ +Lorem ipsum dolor sit amet, +consectetur adipiscing elit. +Nunc interdum suscipit sem vel ornare. +Proin euismod, +justo sed mollis dictum, +eros urna ultricies augue, +eu pharetra mi ex id ante. +Duis convallis porttitor aliquam. +Nunc vitae tincidunt ex. +Suspendisse iaculis ligula ac diam consectetur lacinia. +Donec vel velit dui. +Etiam fringilla, +dolor quis tempor vehicula, +lacus turpis bibendum velit, +et pellentesque elit odio a magna. +Cras vulputate tortor non libero vehicula euismod. +Aliquam tincidunt nisl eget enim cursus, +viverra sagittis magna commodo. +Cras rhoncus egestas leo nec blandit. +Suspendisse potenti. +Etiam ullamcorper leo vel lacus vestibulum, +cursus semper eros efficitur. +In hac habitasse platea dictumst. +Phasellus scelerisque vehicula f \ No newline at end of file diff --git a/tests/fixtures/head/sequence b/tests/fixtures/head/sequence new file mode 100644 index 000000000..190423f88 --- /dev/null +++ b/tests/fixtures/head/sequence @@ -0,0 +1,100 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 diff --git a/tests/fixtures/head/sequence.expected b/tests/fixtures/head/sequence.expected new file mode 100644 index 000000000..17d2a1390 --- /dev/null +++ b/tests/fixtures/head/sequence.expected @@ -0,0 +1,90 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 From 5f17719a59344066ae0b4adff51a7096d97a9b43 Mon Sep 17 00:00:00 2001 From: Ricardo Iglesias Date: Mon, 29 Mar 2021 04:10:13 -0700 Subject: [PATCH 536/606] 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 --- Cargo.toml | 2 + src/uu/ls/src/ls.rs | 182 ++++++++++++++++++++++++++++++++------- tests/by-util/test_ls.rs | 114 ++++++++++++++++++++++++ tests/common/util.rs | 26 +++++- 4 files changed, 290 insertions(+), 34 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 08e9a3bb2..9136b5d64 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -345,11 +345,13 @@ time = "0.1" unindent = "0.1" uucore = { version=">=0.0.7", package="uucore", path="src/uucore", features=["entries"] } walkdir = "2.2" +tempdir = "0.3" [target.'cfg(unix)'.dev-dependencies] rust-users = { version="0.10", package="users" } unix_socket = "0.5.0" + [[bin]] name = "coreutils" path = "src/bin/coreutils.rs" diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 201ddc7a6..80a7bf328 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -104,6 +104,14 @@ pub mod options { pub static HUMAN_READABLE: &str = "human-readable"; pub static SI: &str = "si"; } + + pub mod indicator_style { + pub static NONE: &str = "none"; + pub static SLASH: &str = "slash"; + pub static FILE_TYPE: &str = "file-type"; + pub static CLASSIFY: &str = "classify"; + } + pub static WIDTH: &str = "width"; pub static AUTHOR: &str = "author"; pub static NO_GROUP: &str = "no-group"; @@ -113,12 +121,15 @@ pub mod options { pub static IGNORE_BACKUPS: &str = "ignore-backups"; pub static DIRECTORY: &str = "directory"; pub static CLASSIFY: &str = "classify"; + pub static FILE_TYPE: &str = "file-type"; + pub static SLASH: &str = "p"; pub static INODE: &str = "inode"; pub static DEREFERENCE: &str = "dereference"; pub static REVERSE: &str = "reverse"; pub static RECURSIVE: &str = "recursive"; pub static COLOR: &str = "color"; pub static PATHS: &str = "paths"; + pub static INDICATOR_STYLE: &str = "indicator-style"; } #[derive(PartialEq, Eq)] @@ -157,6 +168,14 @@ enum Time { Change, } +#[derive(PartialEq, Eq)] +enum IndicatorStyle { + None, + Slash, + FileType, + Classify, +} + struct Config { format: Format, files: Files, @@ -164,7 +183,6 @@ struct Config { recursive: bool, reverse: bool, dereference: bool, - classify: bool, ignore_backups: bool, size_format: SizeFormat, directory: bool, @@ -175,6 +193,7 @@ struct Config { color: bool, long: LongFormat, width: Option, + indicator_style: IndicatorStyle, } // Fields that can be removed or added to the long format @@ -227,12 +246,19 @@ impl Config { // options, but manually whether they have an index that's greater than // the other format options. If so, we set the appropriate format. if format != Format::Long { - let idx = options.indices_of(opt).map(|x| x.max().unwrap()).unwrap_or(0); - if [options::format::LONG_NO_OWNER, options::format::LONG_NO_GROUP, options::format::LONG_NUMERIC_UID_GID] - .iter() - .flat_map(|opt| options.indices_of(opt)) - .flatten() - .any(|i| i >= idx) + let idx = options + .indices_of(opt) + .map(|x| x.max().unwrap()) + .unwrap_or(0); + if [ + options::format::LONG_NO_OWNER, + options::format::LONG_NO_GROUP, + options::format::LONG_NUMERIC_UID_GID, + ] + .iter() + .flat_map(|opt| options.indices_of(opt)) + .flatten() + .any(|i| i >= idx) { format = Format::Long; } else { @@ -243,7 +269,6 @@ impl Config { } } } - let files = if options.is_present(options::files::ALL) { Files::All @@ -334,6 +359,32 @@ impl Config { }) .or_else(|| termsize::get().map(|s| s.cols)); + let indicator_style = if let Some(field) = options.value_of(options::INDICATOR_STYLE) { + match field { + "none" => IndicatorStyle::None, + "file-type" => IndicatorStyle::FileType, + "classify" => IndicatorStyle::Classify, + "slash" => IndicatorStyle::Slash, + &_ => IndicatorStyle::None, + } + } else if options.is_present(options::indicator_style::NONE) { + IndicatorStyle::None + } else if options.is_present(options::indicator_style::CLASSIFY) + || options.is_present(options::CLASSIFY) + { + IndicatorStyle::Classify + } else if options.is_present(options::indicator_style::SLASH) + || options.is_present(options::SLASH) + { + IndicatorStyle::Slash + } else if options.is_present(options::indicator_style::FILE_TYPE) + || options.is_present(options::FILE_TYPE) + { + IndicatorStyle::FileType + } else { + IndicatorStyle::None + }; + Config { format, files, @@ -341,7 +392,6 @@ impl Config { recursive: options.is_present(options::RECURSIVE), reverse: options.is_present(options::REVERSE), dereference: options.is_present(options::DEREFERENCE), - classify: options.is_present(options::CLASSIFY), ignore_backups: options.is_present(options::IGNORE_BACKUPS), size_format, directory: options.is_present(options::DIRECTORY), @@ -352,6 +402,7 @@ impl Config { inode: options.is_present(options::INODE), long, width, + indicator_style, } } } @@ -623,15 +674,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { specified.", ), ) - .arg( - Arg::with_name(options::CLASSIFY) - .short("F") - .long(options::CLASSIFY) - .help("Append a character to each file name indicating the file type. Also, for \ - regular files that are executable, append '*'. The file type indicators are \ - '/' for directories, '@' for symbolic links, '|' for FIFOs, '=' for sockets, \ - '>' for doors, and nothing for regular files.", - )) .arg( Arg::with_name(options::size::HUMAN_READABLE) .short("h") @@ -659,7 +701,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { file the link references rather than the link itself.", ), ) - .arg( Arg::with_name(options::REVERSE) .short("r") @@ -689,8 +730,57 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .require_equals(true) .min_values(0), ) + .arg( + Arg::with_name(options::INDICATOR_STYLE) + .long(options::INDICATOR_STYLE) + .help(" append indicator with style WORD to entry names: none (default), slash\ + (-p), file-type (--file-type), classify (-F)") + .takes_value(true) + .possible_values(&["none", "slash", "file-type", "classify"]) + .overrides_with_all(&[ + options::FILE_TYPE, + options::SLASH, + options::CLASSIFY, + options::INDICATOR_STYLE, + ])) + .arg( + Arg::with_name(options::CLASSIFY) + .short("F") + .long(options::CLASSIFY) + .help("Append a character to each file name indicating the file type. Also, for \ + regular files that are executable, append '*'. The file type indicators are \ + '/' for directories, '@' for symbolic links, '|' for FIFOs, '=' for sockets, \ + '>' for doors, and nothing for regular files.") + .overrides_with_all(&[ + options::FILE_TYPE, + options::SLASH, + options::CLASSIFY, + options::INDICATOR_STYLE, + ]) + ) + .arg( + Arg::with_name(options::FILE_TYPE) + .long(options::FILE_TYPE) + .help("Same as --classify, but do not append '*'") + .overrides_with_all(&[ + options::FILE_TYPE, + options::SLASH, + options::CLASSIFY, + options::INDICATOR_STYLE, + ])) + .arg( + Arg::with_name(options::SLASH) + .short(options::SLASH) + .help("Append / indicator to directories." + ) + .overrides_with_all(&[ + options::FILE_TYPE, + options::SLASH, + options::CLASSIFY, + options::INDICATOR_STYLE, + ])) - // Positional arguments + // Positional arguments .arg(Arg::with_name(options::PATHS).multiple(true).takes_value(true)); let matches = app.get_matches_from(args); @@ -1117,15 +1207,24 @@ fn display_file_name( config: &Config, ) -> Cell { let mut name = get_file_name(path, strip); + let file_type = metadata.file_type(); - if config.classify { - let file_type = metadata.file_type(); - if file_type.is_dir() { - name.push('/'); - } else if file_type.is_symlink() { - name.push('@'); + match config.indicator_style { + IndicatorStyle::Classify | IndicatorStyle::FileType => { + if file_type.is_dir() { + name.push('/'); + } + if file_type.is_symlink() { + name.push('@'); + } } - } + IndicatorStyle::Slash => { + if file_type.is_dir() { + name.push('/'); + } + } + _ => (), + }; if config.format == Format::Long && metadata.file_type().is_symlink() { if let Ok(target) = path.read_link() { @@ -1181,8 +1280,7 @@ fn display_file_name( let mut width = UnicodeWidthStr::width(&*name); let ext; - - if config.color || config.classify { + if config.color || config.indicator_style != IndicatorStyle::None { let file_type = metadata.file_type(); let (code, sym) = if file_type.is_dir() { @@ -1235,11 +1333,29 @@ fn display_file_name( if config.color { name = color_name(name, code); } - if config.classify { - if let Some(s) = sym { - name.push(s); - width += 1; + + let char_opt = match config.indicator_style { + IndicatorStyle::Classify => sym, + IndicatorStyle::FileType => { + // Don't append an asterisk. + match sym { + Some('*') => None, + _ => sym, + } } + IndicatorStyle::Slash => { + // Append only a slash. + match sym { + Some('/') => Some('/'), + _ => None, + } + } + IndicatorStyle::None => None, + }; + + if let Some(c) = char_opt { + name.push(c); + width += 1; } } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 7d5a3da7b..638102cc7 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1,3 +1,5 @@ +#[cfg(unix)] +extern crate unix_socket; use crate::common::util::*; extern crate regex; @@ -11,7 +13,13 @@ extern crate libc; #[cfg(not(windows))] use self::libc::umask; #[cfg(not(windows))] +use std::path::PathBuf; +#[cfg(not(windows))] use std::sync::Mutex; +#[cfg(not(windows))] +extern crate tempdir; +#[cfg(not(windows))] +use self::tempdir::TempDir; #[cfg(not(windows))] lazy_static! { @@ -813,6 +821,112 @@ fn test_ls_inode() { assert_eq!(inode_short, inode_long) } +#[test] +#[cfg(not(windows))] +fn test_ls_indicator_style() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + // Setup: Directory, Symlink, and Pipes. + at.mkdir("directory"); + assert!(at.dir_exists("directory")); + + at.touch(&at.plus_as_string("link-src")); + at.symlink_file("link-src", "link-dest.link"); + assert!(at.is_symlink("link-dest.link")); + + at.mkfifo("named-pipe.fifo"); + assert!(at.is_fifo("named-pipe.fifo")); + + // Classify, File-Type, and Slash all contain indicators for directories. + let options = vec!["classify", "file-type", "slash"]; + for opt in options { + // Verify that classify and file-type both contain indicators for symlinks. + let result = scene.ucmd().arg(format!("--indicator-style={}", opt)).run(); + println!("stdout = {:?}", result.stdout); + assert!(result.stdout.contains("/")); + } + + // Same test as above, but with the alternate flags. + let options = vec!["--classify", "--file-type", "-p"]; + for opt in options { + let result = scene.ucmd().arg(format!("{}", opt)).run(); + println!("stdout = {:?}", result.stdout); + assert!(result.stdout.contains("/")); + } + + // Classify and File-Type all contain indicators for pipes and links. + let options = vec!["classify", "file-type"]; + for opt in options { + // Verify that classify and file-type both contain indicators for symlinks. + let result = scene.ucmd().arg(format!("--indicator-style={}", opt)).run(); + println!("stdout = {}", result.stdout); + assert!(result.stdout.contains("@")); + assert!(result.stdout.contains("|")); + } + + // Test sockets. Because the canonical way of making sockets to test is with + // TempDir, we need a separate test. + { + use self::unix_socket::UnixListener; + + let dir = TempDir::new("unix_socket").expect("failed to create dir"); + let socket_path = dir.path().join("sock"); + let _listener = UnixListener::bind(&socket_path).expect("failed to create socket"); + + new_ucmd!() + .args(&[ + PathBuf::from(dir.path().to_str().unwrap()), + PathBuf::from("--indicator-style=classify"), + ]) + .succeeds() + .stdout_only("sock=\n"); + } +} + +// Essentially the same test as above, but only test symlinks and directories, +// not pipes or sockets. +#[test] +#[cfg(not(unix))] +fn test_ls_indicator_style() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + // Setup: Directory, Symlink. + at.mkdir("directory"); + assert!(at.dir_exists("directory")); + + at.touch(&at.plus_as_string("link-src")); + at.symlink_file("link-src", "link-dest.link"); + assert!(at.is_symlink("link-dest.link")); + + // Classify, File-Type, and Slash all contain indicators for directories. + let options = vec!["classify", "file-type", "slash"]; + for opt in options { + // Verify that classify and file-type both contain indicators for symlinks. + let result = scene.ucmd().arg(format!("--indicator-style={}", opt)).run(); + println!("stdout = {:?}", result.stdout); + assert!(result.stdout.contains("/")); + } + + // Same test as above, but with the alternate flags. + let options = vec!["--classify", "--file-type", "-p"]; + for opt in options { + let result = scene.ucmd().arg(format!("{}", opt)).run(); + println!("stdout = {:?}", result.stdout); + assert!(result.stdout.contains("/")); + } + + // Classify and File-Type all contain indicators for pipes and links. + let options = vec!["classify", "file-type"]; + for opt in options { + // Verify that classify and file-type both contain indicators for symlinks. + let result = scene.ucmd().arg(format!("--indicator-style={}", opt)).run(); + println!("stdout = {}", result.stdout); + assert!(result.stdout.contains("@")); + } +} + #[cfg(not(any(target_vendor = "apple", target_os = "windows")))] // Truncate not available on mac or win #[test] fn test_ls_human_si() { diff --git a/tests/common/util.rs b/tests/common/util.rs index a2fab66c6..d33b1943d 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -1,7 +1,8 @@ #![allow(dead_code)] +use libc; use std::env; -use std::ffi::OsStr; +use std::ffi::{CString, OsStr}; use std::fs::{self, File, OpenOptions}; use std::io::{Read, Result, Write}; #[cfg(unix)] @@ -290,6 +291,29 @@ impl AtPath { File::create(&self.plus(file)).unwrap(); } + #[cfg(not(windows))] + pub fn mkfifo(&self, fifo: &str) { + let full_path = self.plus_as_string(fifo); + log_info("mkfifo", &full_path); + unsafe { + let fifo_name: CString = CString::new(full_path).expect("CString creation failed."); + libc::mkfifo(fifo_name.as_ptr(), libc::S_IWUSR | libc::S_IRUSR); + } + } + + #[cfg(not(windows))] + pub fn is_fifo(&self, fifo: &str) -> bool { + unsafe { + let name = CString::new(self.plus_as_string(fifo)).unwrap(); + let mut stat: libc::stat = std::mem::zeroed(); + if libc::stat(name.as_ptr(), &mut stat) >= 0 { + libc::S_IFIFO & stat.st_mode != 0 + } else { + false + } + } + } + pub fn symlink_file(&self, src: &str, dst: &str) { log_info( "symlink", From 32ddef9b9e8110f0032c437b615d22b6148bcbf2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 29 Mar 2021 14:35:12 +0200 Subject: [PATCH 537/606] refresh cargo.lock with recent updates (#1964) --- Cargo.lock | 2000 ++++++++++++++++++++++++++-------------------------- 1 file changed, 1018 insertions(+), 982 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 07a99069c..b8293f666 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,2265 +4,2139 @@ name = "advapi32-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "aho-corasick" version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ - "memchr 2.3.4", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "arrayvec" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" dependencies = [ - "nodrop", + "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.9", + "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bit-set" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" dependencies = [ - "bit-vec", + "bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ - "arrayvec", - "constant_time_eq", + "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "block-buffer" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" dependencies = [ - "byte-tools", - "generic-array", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bstr" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ - "lazy_static", - "memchr 2.3.4", - "regex-automata", - "serde", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bumpalo" version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "byte-tools" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cast" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" dependencies = [ - "rustc_version", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cc" version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" dependencies = [ - "num-integer", - "num-traits", - "time", + "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clap" version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim", - "textwrap", - "unicode-width", - "vec_map", + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "conv" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" dependencies = [ - "custom_derive", + "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "coreutils" version = "0.0.4" dependencies = [ - "conv", - "filetime", - "glob 0.3.0", - "lazy_static", - "libc", - "nix 0.20.0", - "rand 0.7.3", - "regex", - "sha1", - "tempfile", - "textwrap", - "time", - "unindent", - "unix_socket", - "users", - "uu_arch", - "uu_base32", - "uu_base64", - "uu_basename", - "uu_cat", - "uu_chgrp", - "uu_chmod", - "uu_chown", - "uu_chroot", - "uu_cksum", - "uu_comm", - "uu_cp", - "uu_csplit", - "uu_cut", - "uu_date", - "uu_df", - "uu_dircolors", - "uu_dirname", - "uu_du", - "uu_echo", - "uu_env", - "uu_expand", - "uu_expr", - "uu_factor", - "uu_false", - "uu_fmt", - "uu_fold", - "uu_groups", - "uu_hashsum", - "uu_head", - "uu_hostid", - "uu_hostname", - "uu_id", - "uu_install", - "uu_join", - "uu_kill", - "uu_link", - "uu_ln", - "uu_logname", - "uu_ls", - "uu_mkdir", - "uu_mkfifo", - "uu_mknod", - "uu_mktemp", - "uu_more", - "uu_mv", - "uu_nice", - "uu_nl", - "uu_nohup", - "uu_nproc", - "uu_numfmt", - "uu_od", - "uu_paste", - "uu_pathchk", - "uu_pinky", - "uu_printenv", - "uu_printf", - "uu_ptx", - "uu_pwd", - "uu_readlink", - "uu_realpath", - "uu_relpath", - "uu_rm", - "uu_rmdir", - "uu_seq", - "uu_shred", - "uu_shuf", - "uu_sleep", - "uu_sort", - "uu_split", - "uu_stat", - "uu_stdbuf", - "uu_sum", - "uu_sync", - "uu_tac", - "uu_tail", - "uu_tee", - "uu_test", - "uu_timeout", - "uu_touch", - "uu_tr", - "uu_true", - "uu_truncate", - "uu_tsort", - "uu_tty", - "uu_uname", - "uu_unexpand", - "uu_uniq", - "uu_unlink", - "uu_uptime", - "uu_users", - "uu_wc", - "uu_who", - "uu_whoami", - "uu_yes", - "uucore", - "walkdir", + "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uu_arch 0.0.4", + "uu_base32 0.0.4", + "uu_base64 0.0.4", + "uu_basename 0.0.4", + "uu_cat 0.0.4", + "uu_chgrp 0.0.4", + "uu_chmod 0.0.4", + "uu_chown 0.0.4", + "uu_chroot 0.0.4", + "uu_cksum 0.0.4", + "uu_comm 0.0.4", + "uu_cp 0.0.4", + "uu_csplit 0.0.4", + "uu_cut 0.0.4", + "uu_date 0.0.4", + "uu_df 0.0.4", + "uu_dircolors 0.0.4", + "uu_dirname 0.0.4", + "uu_du 0.0.4", + "uu_echo 0.0.4", + "uu_env 0.0.4", + "uu_expand 0.0.4", + "uu_expr 0.0.4", + "uu_factor 0.0.4", + "uu_false 0.0.4", + "uu_fmt 0.0.4", + "uu_fold 0.0.4", + "uu_groups 0.0.4", + "uu_hashsum 0.0.4", + "uu_head 0.0.4", + "uu_hostid 0.0.4", + "uu_hostname 0.0.4", + "uu_id 0.0.4", + "uu_install 0.0.4", + "uu_join 0.0.4", + "uu_kill 0.0.4", + "uu_link 0.0.4", + "uu_ln 0.0.4", + "uu_logname 0.0.4", + "uu_ls 0.0.4", + "uu_mkdir 0.0.4", + "uu_mkfifo 0.0.4", + "uu_mknod 0.0.4", + "uu_mktemp 0.0.4", + "uu_more 0.0.4", + "uu_mv 0.0.4", + "uu_nice 0.0.4", + "uu_nl 0.0.4", + "uu_nohup 0.0.4", + "uu_nproc 0.0.4", + "uu_numfmt 0.0.4", + "uu_od 0.0.4", + "uu_paste 0.0.4", + "uu_pathchk 0.0.4", + "uu_pinky 0.0.4", + "uu_printenv 0.0.4", + "uu_printf 0.0.4", + "uu_ptx 0.0.4", + "uu_pwd 0.0.4", + "uu_readlink 0.0.4", + "uu_realpath 0.0.4", + "uu_relpath 0.0.4", + "uu_rm 0.0.4", + "uu_rmdir 0.0.4", + "uu_seq 0.0.4", + "uu_shred 0.0.4", + "uu_shuf 0.0.4", + "uu_sleep 0.0.4", + "uu_sort 0.0.4", + "uu_split 0.0.4", + "uu_stat 0.0.4", + "uu_stdbuf 0.0.4", + "uu_sum 0.0.4", + "uu_sync 0.0.4", + "uu_tac 0.0.4", + "uu_tail 0.0.4", + "uu_tee 0.0.4", + "uu_test 0.0.4", + "uu_timeout 0.0.4", + "uu_touch 0.0.4", + "uu_tr 0.0.4", + "uu_true 0.0.4", + "uu_truncate 0.0.4", + "uu_tsort 0.0.4", + "uu_tty 0.0.4", + "uu_uname 0.0.4", + "uu_unexpand 0.0.4", + "uu_uniq 0.0.4", + "uu_unlink 0.0.4", + "uu_uptime 0.0.4", + "uu_users 0.0.4", + "uu_wc 0.0.4", + "uu_who 0.0.4", + "uu_whoami 0.0.4", + "uu_yes 0.0.4", + "uucore 0.0.7", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" dependencies = [ - "cpp_macros", + "cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_build" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" dependencies = [ - "cc", - "cpp_common 0.4.0", - "cpp_syn", - "cpp_synmap", - "cpp_synom", - "lazy_static", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_common" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" dependencies = [ - "cpp_syn", - "cpp_synom", - "lazy_static", - "quote 0.3.15", + "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_common" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" dependencies = [ - "lazy_static", - "proc-macro2", - "syn", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_macros" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" dependencies = [ - "aho-corasick", - "byteorder", - "cpp_common 0.5.6", - "if_rust_version", - "lazy_static", - "proc-macro2", - "quote 1.0.9", - "syn", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_syn" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" dependencies = [ - "cpp_synom", - "quote 0.3.15", - "unicode-xid 0.0.4", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_synmap" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" dependencies = [ - "cpp_syn", - "cpp_synom", - "memchr 1.0.2", + "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cpp_synom" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" dependencies = [ - "unicode-xid 0.0.4", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "criterion" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" dependencies = [ - "atty", - "cast", - "clap", - "criterion-plot", - "csv", - "itertools 0.10.0", - "lazy_static", - "num-traits", - "oorandom", - "plotters", - "rayon", - "regex", - "serde", - "serde_cbor", - "serde_derive", - "serde_json", - "tinytemplate", - "walkdir", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "criterion-plot" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" dependencies = [ - "cast", - "itertools 0.9.0", + "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-channel" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-deque" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", - "lazy_static", - "memoffset", - "scopeguard", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-utils" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "lazy_static", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv" version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" dependencies = [ - "bstr", - "csv-core", - "itoa", - "ryu", - "serde", + "bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", + "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv-core" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" dependencies = [ - "memchr 2.3.4", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "custom_derive" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" [[package]] name = "data-encoding" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" [[package]] name = "digest" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" dependencies = [ - "generic-array", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "dunce" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "log", - "regex", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "file_diff" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31a7a908b8f32538a2143e59a6e4e2508988832d5d4d6f7c156b3cbc762643a5" [[package]] name = "filetime" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall 0.2.5", - "winapi 0.3.9", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fs_extra" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "generic-array" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" dependencies = [ - "nodrop", - "typenum", + "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "getopts" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" dependencies = [ - "unicode-width", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "getrandom" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glob" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "half" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "hermit-abi" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ - "libc", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hex" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" [[package]] name = "hostname" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ - "libc", - "match_cfg", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "if_rust_version" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" [[package]] name = "ioctl-sys" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" [[package]] name = "itertools" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ - "either", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itertools" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" dependencies = [ - "either", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itertools" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" dependencies = [ - "either", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itoa" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" dependencies = [ - "wasm-bindgen", + "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" [[package]] name = "log" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "maybe-uninit" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "md5" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" [[package]] name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" dependencies = [ - "libc", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "memchr" version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memoffset" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d" dependencies = [ - "autocfg", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nix" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" dependencies = [ - "bitflags", - "cc", - "cfg-if 0.1.10", - "libc", - "void", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nix" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" dependencies = [ - "bitflags", - "cc", - "cfg-if 1.0.0", - "libc", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nodrop" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "num-integer" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg", - "num-traits", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "hermit-abi", - "libc", + "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "number_prefix" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "numtoa" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "onig" version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" dependencies = [ - "bitflags", - "lazy_static", - "libc", - "onig_sys", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "onig_sys" version = "69.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" dependencies = [ - "cc", - "pkg-config", + "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "oorandom" version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "paste" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" dependencies = [ - "paste-impl", - "proc-macro-hack", + "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "paste-impl" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" dependencies = [ - "proc-macro-hack", + "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pkg-config" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "platform-info" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" dependencies = [ - "libc", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "plotters" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" dependencies = [ - "num-traits", - "plotters-backend", - "plotters-svg", - "wasm-bindgen", - "web-sys", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "plotters-backend" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" [[package]] name = "plotters-svg" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" dependencies = [ - "plotters-backend", + "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ppv-lite86" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro-hack" version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "unicode-xid 0.2.1", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quickcheck" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" dependencies = [ - "env_logger", - "log", - "rand 0.7.3", - "rand_core 0.5.1", + "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "quote" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ - "proc-macro2", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "winapi 0.3.9", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", - "libc", - "rand_chacha", - "rand_core 0.5.1", - "rand_hc", - "rand_pcg", + "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "rand_core 0.4.2", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_pcg" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core 0.5.1", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon-core" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "lazy_static", - "num_cpus", + "crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_syscall" version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" dependencies = [ - "bitflags", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_termios" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall 0.2.5", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" dependencies = [ - "aho-corasick", - "memchr 2.3.4", - "regex-syntax", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-automata" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" dependencies = [ - "byteorder", + "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "retain_mut" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" [[package]] name = "rust-ini" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "same-file" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ - "winapi-util", + "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser", + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" [[package]] name = "serde_cbor" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" dependencies = [ - "half", - "serde", + "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ - "itoa", - "ryu", - "serde", + "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sha1" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" dependencies = [ - "block-buffer", - "byte-tools", - "digest", - "fake-simd", - "generic-array", + "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sha3" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" dependencies = [ - "block-buffer", - "byte-tools", - "digest", - "generic-array", + "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "smallvec" version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ - "maybe-uninit", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "unicode-xid 0.2.1", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tempdir" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if 0.1.10", - "libc", - "rand 0.7.3", - "redox_syscall 0.1.57", - "remove_dir_all", - "winapi 0.3.9", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "term_grid" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" dependencies = [ - "unicode-width", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "term_size" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" dependencies = [ - "libc", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termion" version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ - "libc", - "numtoa", - "redox_syscall 0.2.5", - "redox_termios", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termsize" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" dependencies = [ - "atty", - "kernel32-sys", - "libc", - "termion", - "winapi 0.2.8", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "term_size", - "unicode-width", + "term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thiserror" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thiserror-impl" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" dependencies = [ - "libc", - "redox_syscall 0.1.57", - "winapi 0.3.9", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "serde", - "serde_json", + "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "twox-hash" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59" dependencies = [ - "cfg-if 0.1.10", - "rand 0.7.3", - "static_assertions", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "typenum" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" [[package]] name = "unicode-width" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unindent" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" [[package]] name = "unix_socket" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" dependencies = [ - "cfg-if 0.1.10", - "libc", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "users" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" dependencies = [ - "libc", - "log", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_arch" version = "0.0.4" dependencies = [ - "platform-info", - "uucore", - "uucore_procs", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_base32" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_base64" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_basename" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cat" version = "0.0.4" dependencies = [ - "clap", - "quick-error", - "unix_socket", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_chgrp" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", - "walkdir", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_chmod" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", - "walkdir", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_chown" version = "0.0.4" dependencies = [ - "clap", - "glob 0.3.0", - "uucore", - "uucore_procs", - "walkdir", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_chroot" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cksum" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_comm" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cp" version = "0.0.4" dependencies = [ - "clap", - "filetime", - "ioctl-sys", - "libc", - "quick-error", - "uucore", - "uucore_procs", - "walkdir", - "winapi 0.3.9", - "xattr", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_csplit" version = "0.0.4" dependencies = [ - "getopts", - "glob 0.2.11", - "regex", - "thiserror", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_cut" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_date" version = "0.0.4" dependencies = [ - "chrono", - "clap", - "libc", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_df" version = "0.0.4" dependencies = [ - "clap", - "libc", - "number_prefix", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_dircolors" version = "0.0.4" dependencies = [ - "glob 0.3.0", - "uucore", - "uucore_procs", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_dirname" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_du" version = "0.0.4" dependencies = [ - "time", - "uucore", - "uucore_procs", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_echo" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_env" version = "0.0.4" dependencies = [ - "clap", - "libc", - "rust-ini", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_expand" version = "0.0.4" dependencies = [ - "clap", - "unicode-width", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_expr" version = "0.0.4" dependencies = [ - "libc", - "onig", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_factor" version = "0.0.4" dependencies = [ - "criterion", - "num-traits", - "paste", - "quickcheck", - "rand 0.7.3", - "rand_chacha", - "smallvec", - "uucore", - "uucore_procs", + "criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_false" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_fmt" version = "0.0.4" dependencies = [ - "clap", - "libc", - "unicode-width", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_fold" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_groups" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_hashsum" version = "0.0.4" dependencies = [ - "blake2-rfc", - "clap", - "digest", - "hex", - "libc", - "md5", - "regex", - "regex-syntax", - "sha1", - "sha2", - "sha3", - "uucore", - "uucore_procs", + "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_head" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_hostid" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_hostname" version = "0.0.4" dependencies = [ - "clap", - "hostname", - "libc", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_id" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_install" version = "0.0.4" dependencies = [ - "clap", - "file_diff", - "filetime", - "libc", - "time", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_join" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_kill" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_link" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_ln" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_logname" version = "0.0.4" dependencies = [ - "libc", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_ls" version = "0.0.4" dependencies = [ - "atty", - "clap", - "lazy_static", - "number_prefix", - "term_grid", - "termsize", - "time", - "unicode-width", - "uucore", - "uucore_procs", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mkdir" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mkfifo" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mknod" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mktemp" version = "0.0.4" dependencies = [ - "clap", - "rand 0.5.6", - "tempfile", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_more" version = "0.0.4" dependencies = [ - "getopts", - "nix 0.13.1", - "redox_syscall 0.1.57", - "redox_termios", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_mv" version = "0.0.4" dependencies = [ - "clap", - "fs_extra", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nice" version = "0.0.4" dependencies = [ - "clap", - "libc", - "nix 0.13.1", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nl" version = "0.0.4" dependencies = [ - "aho-corasick", - "clap", - "libc", - "memchr 2.3.4", - "regex", - "regex-syntax", - "uucore", - "uucore_procs", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nohup" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_nproc" version = "0.0.4" dependencies = [ - "clap", - "libc", - "num_cpus", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_numfmt" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_od" version = "0.0.4" dependencies = [ - "byteorder", - "clap", - "half", - "libc", - "uucore", - "uucore_procs", + "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_paste" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pathchk" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pinky" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_printenv" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_printf" version = "0.0.4" dependencies = [ - "itertools 0.8.2", - "uucore", - "uucore_procs", + "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_ptx" version = "0.0.4" dependencies = [ - "aho-corasick", - "clap", - "libc", - "memchr 2.3.4", - "regex", - "regex-syntax", - "uucore", - "uucore_procs", + "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_pwd" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_readlink" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_realpath" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_relpath" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_rm" version = "0.0.4" dependencies = [ - "clap", - "remove_dir_all", - "uucore", - "uucore_procs", - "walkdir", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_rmdir" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_seq" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_shred" version = "0.0.4" dependencies = [ - "filetime", - "getopts", - "libc", - "rand 0.5.6", - "time", - "uucore", - "uucore_procs", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_shuf" version = "0.0.4" dependencies = [ - "clap", - "rand 0.5.6", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sleep" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_sort" version = "0.0.4" dependencies = [ - "clap", - "itertools 0.8.2", - "rand 0.7.3", - "semver", - "twox-hash", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "twox-hash 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_split" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_stat" version = "0.0.4" dependencies = [ - "clap", - "time", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_stdbuf" version = "0.0.4" dependencies = [ - "getopts", - "tempfile", - "uu_stdbuf_libstdbuf", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uu_stdbuf_libstdbuf 0.0.4", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_stdbuf_libstdbuf" version = "0.0.4" dependencies = [ - "cpp", - "cpp_build", - "libc", - "uucore", - "uucore_procs", + "cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] @@ -2278,394 +2152,556 @@ dependencies = [ name = "uu_sync" version = "0.0.4" dependencies = [ - "clap", - "libc", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_tac" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tail" version = "0.0.4" dependencies = [ - "clap", - "libc", - "redox_syscall 0.1.57", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_tee" version = "0.0.4" dependencies = [ - "clap", - "libc", - "retain_mut", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_test" version = "0.0.4" dependencies = [ - "libc", - "redox_syscall 0.1.57", - "uucore", - "uucore_procs", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_timeout" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_touch" version = "0.0.4" dependencies = [ - "clap", - "filetime", - "time", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tr" version = "0.0.4" dependencies = [ - "bit-set", - "clap", - "fnv", - "uucore", - "uucore_procs", + "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_true" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_truncate" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tsort" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_tty" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_uname" version = "0.0.4" dependencies = [ - "clap", - "platform-info", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_unexpand" version = "0.0.4" dependencies = [ - "clap", - "unicode-width", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_uniq" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_unlink" version = "0.0.4" dependencies = [ - "getopts", - "libc", - "uucore", - "uucore_procs", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_uptime" version = "0.0.4" dependencies = [ - "chrono", - "clap", - "uucore", - "uucore_procs", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_users" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_wc" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_who" version = "0.0.4" dependencies = [ - "uucore", - "uucore_procs", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uu_whoami" version = "0.0.4" dependencies = [ - "advapi32-sys", - "clap", - "uucore", - "uucore_procs", - "winapi 0.3.9", + "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uu_yes" version = "0.0.4" dependencies = [ - "clap", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] name = "uucore" version = "0.0.7" dependencies = [ - "data-encoding", - "dunce", - "getopts", - "lazy_static", - "libc", - "nix 0.13.1", - "platform-info", - "termion", - "thiserror", - "time", - "wild", + "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uucore_procs" version = "0.0.5" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "walkdir" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ - "same-file", - "winapi 0.3.9", - "winapi-util", + "same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" dependencies = [ - "cfg-if 1.0.0", - "wasm-bindgen-macro", + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote 1.0.9", - "syn", - "wasm-bindgen-shared", + "bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" dependencies = [ - "quote 1.0.9", - "wasm-bindgen-macro-support", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" dependencies = [ - "proc-macro2", - "quote 1.0.9", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", + "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" [[package]] name = "web-sys" version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" dependencies = [ - "js-sys", - "wasm-bindgen", + "js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wild" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" dependencies = [ - "glob 0.3.0", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" dependencies = [ - "libc", + "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", ] + +[metadata] +"checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" +"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" +"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +"checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" +"checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +"checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" +"checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" +"checksum bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" +"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" +"checksum byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +"checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" +"checksum cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)" = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" +"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +"checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" +"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" +"checksum cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" +"checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" +"checksum cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" +"checksum cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" +"checksum cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" +"checksum cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" +"checksum cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" +"checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" +"checksum criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" +"checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" +"checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" +"checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" +"checksum crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" +"checksum crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" +"checksum csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" +"checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" +"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" +"checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" +"checksum dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" +"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +"checksum file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "31a7a908b8f32538a2143e59a6e4e2508988832d5d4d6f7c156b3cbc762643a5" +"checksum filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" +"checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +"checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" +"checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +"checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" +"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +"checksum half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" +"checksum hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +"checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" +"checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +"checksum if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" +"checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" +"checksum itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" +"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" +"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +"checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +"checksum js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +"checksum libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)" = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" +"checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +"checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" +"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" +"checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" +"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" +"checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +"checksum memoffset 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d" +"checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" +"checksum nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" +"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +"checksum number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" +"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" +"checksum onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" +"checksum onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" +"checksum oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +"checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" +"checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" +"checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +"checksum platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" +"checksum plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" +"checksum plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" +"checksum plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" +"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +"checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" +"checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +"checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" +"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" +"checksum quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" +"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +"checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +"checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" +"checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +"checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" +"checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" +"checksum regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" +"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +"checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" +"checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +"checksum retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" +"checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +"checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" +"checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" +"checksum serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" +"checksum serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +"checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" +"checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" +"checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +"checksum static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +"checksum syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)" = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" +"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" +"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +"checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" +"checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" +"checksum termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" +"checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" +"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +"checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" +"checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +"checksum twox-hash 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59" +"checksum typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" +"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +"checksum unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" +"checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" +"checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" +"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +"checksum wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" +"checksum wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" +"checksum wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" +"checksum wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" +"checksum wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" +"checksum web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" +"checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" From d88de3c6a6f1b3113802d4eec120969566b64849 Mon Sep 17 00:00:00 2001 From: Raymond Wang <61680028+RazB924@users.noreply.github.com> Date: Tue, 30 Mar 2021 01:46:48 +1030 Subject: [PATCH 538/606] tr: more explicit flag names (#1966) --- src/uu/tr/src/tr.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index ff1bb49d5..b94b11b9d 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -225,10 +225,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .arg(Arg::with_name(options::SETS).multiple(true)) .get_matches_from(args); - let dflag = matches.is_present(options::DELETE); - let cflag = matches.is_present(options::COMPLEMENT); - let sflag = matches.is_present(options::SQUEEZE); - let tflag = matches.is_present(options::TRUNCATE); + let delete_flag = matches.is_present(options::DELETE); + let complement_flag = matches.is_present(options::COMPLEMENT); + let squeeze_flag = matches.is_present(options::SQUEEZE); + let truncate_flag = matches.is_present(options::TRUNCATE); let sets: Vec = match matches.values_of(options::SETS) { Some(v) => v.map(|v| v.to_string()).collect(), @@ -243,7 +243,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 1; } - if !(dflag || sflag) && sets.len() < 2 { + if !(delete_flag || squeeze_flag) && sets.len() < 2 { show_error!( "missing operand after ‘{}’\nTry `{} --help` for more information.", sets[0], @@ -252,7 +252,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { return 1; } - if cflag && !dflag && !sflag { + if complement_flag && !delete_flag && !squeeze_flag { show_error!("-c is only supported with -d or -s"); return 1; } @@ -264,21 +264,21 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let mut buffered_stdout = BufWriter::new(locked_stdout); let set1 = ExpandSet::new(sets[0].as_ref()); - if dflag { - if sflag { + if delete_flag { + if squeeze_flag { let set2 = ExpandSet::new(sets[1].as_ref()); - let op = DeleteAndSqueezeOperation::new(set1, set2, cflag); + let op = DeleteAndSqueezeOperation::new(set1, set2, complement_flag); translate_input(&mut locked_stdin, &mut buffered_stdout, op); } else { - let op = DeleteOperation::new(set1, cflag); + let op = DeleteOperation::new(set1, complement_flag); translate_input(&mut locked_stdin, &mut buffered_stdout, op); } - } else if sflag { - let op = SqueezeOperation::new(set1, cflag); + } else if squeeze_flag { + let op = SqueezeOperation::new(set1, complement_flag); translate_input(&mut locked_stdin, &mut buffered_stdout, op); } else { let mut set2 = ExpandSet::new(sets[1].as_ref()); - let op = TranslateOperation::new(set1, &mut set2, tflag); + let op = TranslateOperation::new(set1, &mut set2, truncate_flag); translate_input(&mut locked_stdin, &mut buffered_stdout, op) } From 25df51a52580ad417d24fcb1862c17cc7b1853d7 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:44:42 +0300 Subject: [PATCH 539/606] fix(cksum): check metadata of the path (#1951) * fix: check metadata of the path * chore: use existing path --- src/uu/cksum/src/cksum.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index bc71a2d97..b7659ea62 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -140,7 +140,20 @@ fn cksum(fname: &str) -> io::Result<(u32, usize)> { let mut rd: Box = match fname { "-" => Box::new(stdin()), _ => { - file = File::open(&Path::new(fname))?; + let path = &Path::new(fname); + if path.is_dir() { + return Err(std::io::Error::new( + io::ErrorKind::InvalidInput, + "Is a directory", + )); + }; + if !path.metadata().is_ok() { + return Err(std::io::Error::new( + io::ErrorKind::NotFound, + "No such file or directory", + )); + }; + file = File::open(&path)?; Box::new(BufReader::new(file)) } }; From 2647a72e9ec77270070b169863e21714e988f4f8 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 29 Mar 2021 22:07:09 +0200 Subject: [PATCH 540/606] chmod: fixed behavior for dangling symlinks (#1775) --- src/uu/chmod/src/chmod.rs | 38 +++++++----- tests/by-util/test_chmod.rs | 120 ++++++++++++++++++++++++++++++------ 2 files changed, 123 insertions(+), 35 deletions(-) diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index 819c674a0..d9d8c8cf2 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -206,7 +206,17 @@ impl Chmoder { let filename = &filename[..]; let file = Path::new(filename); if !file.exists() { - show_error!("no such file or directory '{}'", filename); + if is_symlink(file) { + println!( + "failed to change mode of '{}' from 0000 (---------) to 0000 (---------)", + filename + ); + if !self.quiet { + show_error!("cannot operate on dangling symlink '{}'", filename); + } + } else { + show_error!("cannot access '{}': No such file or directory", filename); + } return Err(1); } if self.recursive && self.preserve_root && filename == "/" { @@ -240,18 +250,16 @@ impl Chmoder { let mut fperm = match fs::metadata(file) { Ok(meta) => meta.mode() & 0o7777, Err(err) => { - if !self.quiet { - if is_symlink(file) { - if self.verbose { - show_info!( - "neither symbolic link '{}' nor referent has been changed", - file.display() - ); - } - return Ok(()); - } else { - show_error!("{}: '{}'", err, file.display()); + if is_symlink(file) { + if self.verbose { + println!( + "neither symbolic link '{}' nor referent has been changed", + file.display() + ); } + return Ok(()); + } else { + show_error!("{}: '{}'", err, file.display()); } return Err(1); } @@ -291,11 +299,11 @@ impl Chmoder { fn change_file(&self, fperm: u32, mode: u32, file: &Path) -> Result<(), i32> { if fperm == mode { if self.verbose && !self.changes { - show_info!( - "mode of '{}' retained as {:o} ({})", + println!( + "mode of '{}' retained as {:04o} ({})", file.display(), fperm, - display_permissions_unix(fperm) + display_permissions_unix(fperm), ); } Ok(()) diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index 3a53202fc..78fee462d 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -329,10 +329,9 @@ fn test_chmod_non_existing_file() { .arg("-r,a+w") .arg("dont-exist") .fails(); - assert_eq!( - result.stderr, - "chmod: error: no such file or directory 'dont-exist'\n" - ); + assert!(result + .stderr + .contains("cannot access 'dont-exist': No such file or directory")); } #[test] @@ -351,30 +350,111 @@ fn test_chmod_preserve_root() { #[test] fn test_chmod_symlink_non_existing_file() { - let (at, mut ucmd) = at_and_ucmd!(); - at.symlink_file("/non-existing", "test-long.link"); + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; - let _result = ucmd - .arg("-R") + let non_existing = "test_chmod_symlink_non_existing_file"; + let test_symlink = "test_chmod_symlink_non_existing_file_symlink"; + let expected_stdout = &format!( + "failed to change mode of '{}' from 0000 (---------) to 0000 (---------)", + test_symlink + ); + let expected_stderr = &format!("cannot operate on dangling symlink '{}'", test_symlink); + + at.symlink_file(non_existing, test_symlink); + let mut result; + + // this cannot succeed since the symbolic link dangles + result = scene.ucmd().arg("755").arg("-v").arg(test_symlink).fails(); + + println!("stdout = {:?}", result.stdout); + println!("stderr = {:?}", result.stderr); + + assert!(result.stdout.contains(expected_stdout)); + assert!(result.stderr.contains(expected_stderr)); + assert_eq!(result.code, Some(1)); + + // this should be the same than with just '-v' but without stderr + result = scene + .ucmd() .arg("755") .arg("-v") - .arg("test-long.link") + .arg("-f") + .arg(test_symlink) .fails(); + + println!("stdout = {:?}", result.stdout); + println!("stderr = {:?}", result.stderr); + + assert!(result.stdout.contains(expected_stdout)); + assert!(result.stderr.is_empty()); + assert_eq!(result.code, Some(1)); } #[test] -fn test_chmod_symlink_non_existing_recursive() { - let (at, mut ucmd) = at_and_ucmd!(); - at.mkdir("tmp"); - at.symlink_file("/non-existing", "tmp/test-long.link"); +fn test_chmod_symlink_non_existing_file_recursive() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; - let result = ucmd.arg("-R").arg("755").arg("-v").arg("tmp").succeeds(); - // it should be a success - println!("stderr {}", result.stderr); - println!("stdout {}", result.stdout); - assert!(result - .stderr - .contains("neither symbolic link 'tmp/test-long.link' nor referent has been changed")); + let non_existing = "test_chmod_symlink_non_existing_file_recursive"; + let test_symlink = "test_chmod_symlink_non_existing_file_recursive_symlink"; + let test_directory = "test_chmod_symlink_non_existing_file_directory"; + + at.mkdir(test_directory); + at.symlink_file( + non_existing, + &format!("{}/{}", test_directory, test_symlink), + ); + let mut result; + + // this should succeed + result = scene + .ucmd() + .arg("-R") + .arg("755") + .arg(test_directory) + .succeeds(); + assert_eq!(result.code, Some(0)); + assert!(result.stdout.is_empty()); + assert!(result.stderr.is_empty()); + + let expected_stdout = &format!( + "mode of '{}' retained as 0755 (rwxr-xr-x)\nneither symbolic link '{}/{}' nor referent has been changed", + test_directory, test_directory, test_symlink + ); + + // '-v': this should succeed without stderr + result = scene + .ucmd() + .arg("-R") + .arg("-v") + .arg("755") + .arg(test_directory) + .succeeds(); + + println!("stdout = {:?}", result.stdout); + println!("stderr = {:?}", result.stderr); + + assert!(result.stdout.contains(expected_stdout)); + assert!(result.stderr.is_empty()); + assert_eq!(result.code, Some(0)); + + // '-vf': this should be the same than with just '-v' + result = scene + .ucmd() + .arg("-R") + .arg("-v") + .arg("-f") + .arg("755") + .arg(test_directory) + .succeeds(); + + println!("stdout = {:?}", result.stdout); + println!("stderr = {:?}", result.stderr); + + assert!(result.stdout.contains(expected_stdout)); + assert!(result.stderr.is_empty()); + assert_eq!(result.code, Some(0)); } #[test] From 902476980820ed936d7028fba6eaced970f1697f Mon Sep 17 00:00:00 2001 From: Sivachandran Date: Tue, 30 Mar 2021 12:03:24 +0530 Subject: [PATCH 541/606] Add instructions for code coverage report generation (#1963) --- DEVELOPER_INSTRUCTIONS.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 DEVELOPER_INSTRUCTIONS.md diff --git a/DEVELOPER_INSTRUCTIONS.md b/DEVELOPER_INSTRUCTIONS.md new file mode 100644 index 000000000..be6373409 --- /dev/null +++ b/DEVELOPER_INSTRUCTIONS.md @@ -0,0 +1,26 @@ +Code Coverage Report Generation +--------------------------------- + +Code coverage report can be generated using [grcov](https://github.com/mozilla/grcov). + +### Using Nightly Rust + +To generate [gcov-based](https://github.com/mozilla/grcov#example-how-to-generate-gcda-files-for-cc) coverage report + +```bash +$ export CARGO_INCREMENTAL=0 +$ export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" +$ export RUSTDOCFLAGS="-Cpanic=abort" +$ cargo build # e.g., --features feat_os_unix +$ cargo test # e.g., --features feat_os_unix test_pathchk +$ grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing --ignore build.rs --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?\#\[derive\()" -o ./target/debug/coverage/ +$ # open target/debug/coverage/index.html in browser +``` + +if changes are not reflected in the report then run `cargo clean` and run the above commands. + +### Using Stable Rust + +If you are using stable version of Rust that doesn't enable code coverage instrumentation by default +then add `-Z-Zinstrument-coverage` flag to `RUSTFLAGS` env variable specified above. + From 775682508a479512dfb7269c97e82258170d3717 Mon Sep 17 00:00:00 2001 From: Kourosh Date: Tue, 30 Mar 2021 23:09:58 +0430 Subject: [PATCH 542/606] more: move from getopts to clap (#1962) --- src/uu/more/Cargo.toml | 2 +- src/uu/more/src/more.rs | 85 +++++++++++++++-------------------------- 2 files changed, 31 insertions(+), 56 deletions(-) diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index acd9378b2..243462232 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/more.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version = ">=0.0.7", package = "uucore", path = "../../uucore" } uucore_procs = { version = ">=0.0.5", package = "uucore_procs", path = "../../uucore_procs" } diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 524b0fbc4..981b5f502 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -10,9 +10,8 @@ #[macro_use] extern crate uucore; -use getopts::Options; use std::fs::File; -use std::io::{stdout, Read, Write}; +use std::io::{stdin, stdout, BufRead, BufReader, Read, Write}; #[cfg(all(unix, not(target_os = "fuchsia")))] extern crate nix; @@ -24,70 +23,44 @@ extern crate redox_termios; #[cfg(target_os = "redox")] extern crate syscall; -#[derive(Clone, Eq, PartialEq)] -pub enum Mode { - More, - Help, - Version, +use clap::{App, Arg, ArgMatches}; + +static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "A file perusal filter for CRT viewing."; + +mod options { + pub const FILE: &str = "file"; } -static NAME: &str = "more"; -static VERSION: &str = env!("CARGO_PKG_VERSION"); +fn get_usage() -> String { + format!("{} [options] ...", executable!()) +} pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); + let usage = get_usage(); - let mut opts = Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .usage(&usage[..]) + .about(ABOUT) + .arg( + Arg::with_name(options::FILE) + .number_of_values(1) + .multiple(true), + ) + .get_matches_from(args); // FixME: fail without panic for now; but `more` should work with no arguments (ie, for piped input) - if args.len() < 2 { - println!("{}: incorrect usage", args[0]); + if let None | Some("-") = matches.value_of(options::FILE) { + println!("{}: incorrect usage", executable!()); return 1; } - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("v", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(e) => { - show_error!("{}", e); - panic!() - } - }; - let usage = opts.usage("more TARGET."); - let mode = if matches.opt_present("version") { - Mode::Version - } else if matches.opt_present("help") { - Mode::Help - } else { - Mode::More - }; - - match mode { - Mode::More => more(matches), - Mode::Help => help(&usage), - Mode::Version => version(), - } + more(matches); 0 } -fn version() { - println!("{} {}", NAME, VERSION); -} - -fn help(usage: &str) { - let msg = format!( - "{0} {1}\n\n\ - Usage: {0} TARGET\n \ - \n\ - {2}", - NAME, VERSION, usage - ); - println!("{}", msg); -} - #[cfg(all(unix, not(target_os = "fuchsia")))] fn setup_term() -> termios::Termios { let mut term = termios::tcgetattr(0).unwrap(); @@ -138,9 +111,11 @@ fn reset_term(term: &mut redox_termios::Termios) { let _ = syscall::close(fd); } -fn more(matches: getopts::Matches) { - let files = matches.free; - let mut f = File::open(files.first().unwrap()).unwrap(); +fn more(matches: ArgMatches) { + let mut f: Box = match matches.value_of(options::FILE) { + None | Some("-") => Box::new(BufReader::new(stdin())), + Some(filename) => Box::new(BufReader::new(File::open(filename).unwrap())), + }; let mut buffer = [0; 1024]; let mut term = setup_term(); From 3e06882acce7a952e080b79f5c919d2222c9073d Mon Sep 17 00:00:00 2001 From: Neculai Balaban Date: Tue, 30 Mar 2021 21:51:11 +0300 Subject: [PATCH 543/606] loosely document supported architectures (#1899) - add script to generate a table of bins that compile - add section in README --- README.md | 28 +++++ docs/compiles_table.csv | 21 ++++ docs/compiles_table.py | 234 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 283 insertions(+) create mode 100644 docs/compiles_table.csv create mode 100644 docs/compiles_table.py diff --git a/README.md b/README.md index 7433f49e6..b6d265278 100644 --- a/README.md +++ b/README.md @@ -372,6 +372,34 @@ Utilities | whoami | | | | yes | | | +Targets that compile +------- + +This is an auto-generated table showing which binaries compile for each target-triple. Note that this **does not** indicate that they are fully implemented, or that the tests pass. + +|######OS######|###ARCH####|arch|base32|base64|basename|cat|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|df|dircolors|dirname|du|echo|env|expand|expr|factor|false|fmt|fold|groups|hashsum|head|hostid|hostname|id|install|join|kill|link|ln|logname|ls|mkdir|mkfifo|mknod|mktemp|more|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|printenv|printf|ptx|pwd|readlink|realpath|relpath|rm|rmdir|seq|shred|shuf|sleep|sort|split|stat|stdbuf|sum|sync|tac|tail|tee|test|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|uptime|users|wc|who|whoami|yes| +|--------------|-----------|----|------|------|--------|---|-----|-----|-----|------|-----|----|--|------|---|----|--|---------|-------|--|----|---|------|----|------|-----|---|----|------|-------|----|------|--------|--|-------|----|----|----|--|-------|--|-----|------|-----|------|----|--|----|--|-----|-----|------|--|-----|-------|-----|--------|------|---|---|--------|--------|-------|--|-----|---|-----|----|-----|----|-----|----|------|---|----|---|----|---|----|-------|-----|--|----|--------|-----|---|-----|--------|----|------|------|-----|--|---|------|---| +|linux-gnu|aarch64|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| +|linux-gnu|i686|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| +|linux-gnu|powerpc64|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| +|linux-gnu|riscv64gc| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +|linux-gnu|x86_64|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| +|windows-msvc|aarch64|y|y|y|y|y| | | | |y|y|y|y|y|y|y|y|y| |y|y|y| |y|y|y|y| |y|y|y|y| | |y| |y|y|y| |y| | |y|y|y| |y| |y|y|y|y| | |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| | |y|y|y|y|y|y| |y|y|y|y|y| |y|y|y| |y| |y| | |y| +|windows-gnu|i686|y|y|y|y|y| | | | |y|y|y|y|y|y|y|y|y| |y|y|y| |y|y|y|y| |y|y|y|y| | |y| |y|y|y|y|y| | |y|y|y| |y| |y|y|y|y| | |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| | |y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y| |y| |y| |y|y| +|windows-msvc|i686|y|y|y|y|y| | | | |y|y|y|y|y|y|y|y|y| |y|y|y| |y|y|y|y| |y|y|y|y| | |y| |y|y|y|y|y| | |y|y|y| |y| |y|y|y|y| | |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| | |y|y|y|y|y|y| |y|y|y|y|y| |y|y|y| |y| |y| |y|y| +|windows-gnu|x86_64|y|y|y|y|y| | | | |y|y|y|y|y|y|y|y|y| |y|y|y| |y|y|y|y| |y|y|y|y| | |y| |y|y|y|y|y| | |y|y|y| |y| |y|y|y|y| | |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| | |y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y| |y| |y| |y|y| +|windows-msvc|x86_64|y|y|y|y|y| | | | |y|y|y|y|y|y|y|y|y| |y|y|y| |y|y|y|y| |y|y|y|y| | |y| |y|y|y|y|y| | |y|y|y| |y| |y|y|y|y| | |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| | |y|y|y|y|y|y| |y|y|y|y|y| |y|y|y| |y| |y| |y|y| +|apple MacOS|x86_64|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| +|freebsd|x86_64|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| +|netbsd|x86_64|y|y|y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y| |y|y| |y|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y| |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y| | |y| |y|y| +|android|aarch64|y|y|y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y| |y|y| |y|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y| |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| |y|y| |y|y|y|y| |y|y|y|y|y|y| |y|y|y| | |y| |y|y| +|android|x86_64|y|y|y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y|y|y|y| |y|y|y|y|y|y|y|y|y| |y|y| |y|y|y|y|y|y|y|y|y|y|y|y| |y|y|y|y|y| |y|y|y|y|y|y|y|y|y|y|y|y|y|y|y| |y|y| |y|y|y|y| |y|y|y|y|y|y| |y|y|y| | |y| |y|y| +|solaris|x86_64| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +|wasi|wasm32| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +|redox|x86_64| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +|fuchsia|aarch64| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +|fuchsia|x86_64| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + License ------- diff --git a/docs/compiles_table.csv b/docs/compiles_table.csv new file mode 100644 index 000000000..6da110132 --- /dev/null +++ b/docs/compiles_table.csv @@ -0,0 +1,21 @@ +target,arch,base32,base64,basename,cat,chgrp,chmod,chown,chroot,cksum,comm,cp,csplit,cut,date,df,dircolors,dirname,du,echo,env,expand,expr,factor,false,fmt,fold,groups,hashsum,head,hostid,hostname,id,install,join,kill,link,ln,logname,ls,mkdir,mkfifo,mknod,mktemp,more,mv,nice,nl,nohup,nproc,numfmt,od,paste,pathchk,pinky,printenv,printf,ptx,pwd,readlink,realpath,relpath,rm,rmdir,seq,shred,shuf,sleep,sort,split,stat,stdbuf,sum,sync,tac,tail,tee,test,timeout,touch,tr,true,truncate,tsort,tty,uname,unexpand,uniq,unlink,uptime,users,wc,who,whoami,yes +aarch64-unknown-linux-gnu,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +i686-unknown-linux-gnu,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +powerpc64-unknown-linux-gnu,0,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +riscv64gc-unknown-linux-gnu,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101 +x86_64-unknown-linux-gnu,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +aarch64-pc-windows-msvc,0,0,0,0,0,101,101,101,101,0,0,0,0,0,0,0,0,0,101,0,0,0,101,0,0,0,0,101,0,0,0,0,101,101,0,101,0,0,0,101,0,101,101,0,0,0,101,0,101,0,0,0,0,101,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,101,0,0,0,0,0,0,101,0,0,0,0,0,101,0,0,0,101,0,101,0,101,101,0 +i686-pc-windows-gnu,0,0,0,0,0,101,101,101,101,0,0,0,0,0,0,0,0,0,101,0,0,0,101,0,0,0,0,101,0,0,0,0,101,101,0,101,0,0,0,0,0,101,101,0,0,0,101,0,101,0,0,0,0,101,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,101,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,101,0,101,0,101,0,0 +i686-pc-windows-msvc,0,0,0,0,0,101,101,101,101,0,0,0,0,0,0,0,0,0,101,0,0,0,101,0,0,0,0,101,0,0,0,0,101,101,0,101,0,0,0,0,0,101,101,0,0,0,101,0,101,0,0,0,0,101,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,101,0,0,0,0,0,0,101,0,0,0,0,0,101,0,0,0,101,0,101,0,101,0,0 +x86_64-pc-windows-gnu,0,0,0,0,0,101,101,101,101,0,0,0,0,0,0,0,0,0,101,0,0,0,101,0,0,0,0,101,0,0,0,0,101,101,0,101,0,0,0,0,0,101,101,0,0,0,101,0,101,0,0,0,0,101,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,101,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,101,0,101,0,101,0,0 +x86_64-pc-windows-msvc,0,0,0,0,0,101,101,101,101,0,0,0,0,0,0,0,0,0,101,0,0,0,101,0,0,0,0,101,0,0,0,0,101,101,0,101,0,0,0,0,0,101,101,0,0,0,101,0,101,0,0,0,0,101,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,101,0,0,0,0,0,0,101,0,0,0,0,0,101,0,0,0,101,0,101,0,101,0,0 +x86_64-apple-darwin,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +x86_64-unknown-freebsd,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +x86_64-unknown-netbsd,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,101,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,101,101,0,101,0,0 +aarch64-linux-android,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,101,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,101,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,101,101,0,101,0,0 +x86_64-linux-android,0,0,0,0,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,101,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,0,0,101,0,0,0,0,101,0,0,0,0,0,0,101,0,0,0,101,101,0,101,0,0 +x86_64-sun-solaris,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101 +wasm32-wasi,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101 +x86_64-unknown-redox,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101 +aarch64-fuchsia,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101 +x86_64-fuchsia,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101 diff --git a/docs/compiles_table.py b/docs/compiles_table.py new file mode 100644 index 000000000..0cbfdf0e9 --- /dev/null +++ b/docs/compiles_table.py @@ -0,0 +1,234 @@ +#!/usr/bin/env python3 +import multiprocessing +import subprocess +import argparse +import csv +import sys +from collections import defaultdict +from pathlib import Path + +# third party dependencies +from tqdm import tqdm + +BINS_PATH=Path("../src/uu") +CACHE_PATH=Path("compiles_table.csv") +TARGETS = [ + # Linux - GNU + "aarch64-unknown-linux-gnu", + "i686-unknown-linux-gnu", + "powerpc64-unknown-linux-gnu", + "riscv64gc-unknown-linux-gnu", + "x86_64-unknown-linux-gnu", + # Windows + "aarch64-pc-windows-msvc", + "i686-pc-windows-gnu", + "i686-pc-windows-msvc", + "x86_64-pc-windows-gnu", + "x86_64-pc-windows-msvc", + # Apple + "x86_64-apple-darwin", + "aarch64-apple-ios", + "x86_64-apple-ios", + # BSDs + "x86_64-unknown-freebsd", + "x86_64-unknown-netbsd", + # Android + "aarch64-linux-android", + "x86_64-linux-android", + # Solaris + "x86_64-sun-solaris", + # WASM + "wasm32-wasi", + # Redox + "x86_64-unknown-redox", + # Fuchsia + "aarch64-fuchsia", + "x86_64-fuchsia", +] + +class Target(str): + def __new__(cls, content): + obj = super().__new__(cls, content) + obj.arch, obj.platfrom, obj.os = Target.parse(content) + return obj + + @staticmethod + def parse(s): + elem = s.split("-") + if len(elem) == 2: + arch, platform, os = elem[0], "n/a", elem[1] + else: + arch, platform, os = elem[0], elem[1], "-".join(elem[2:]) + if os == "ios": + os = "apple IOS" + if os == "darwin": + os = "apple MacOS" + return (arch, platform, os) + + @staticmethod + def get_heading(): + return ["OS", "ARCH"] + + def get_row_heading(self): + return [self.os, self.arch] + + def requires_nightly(self): + return "redox" in self + + # Perform the 'it-compiles' check + def check(self, binary): + if self.requires_nightly(): + args = [ "cargo", "+nightly", "check", + "-p", f"uu_{binary}", "--bin", binary, + f"--target={self}"] + else: + args = ["cargo", "check", + "-p", f"uu_{binary}", "--bin", binary, + f"--target={self}"] + + res = subprocess.run(args, capture_output=True) + return res.returncode + + # Validate that the dependencies for running this target are met + def is_installed(self): + # check IOS sdk is installed, raise exception otherwise + if "ios" in self: + res = subprocess.run(["which", "xcrun"], capture_output=True) + if len(res.stdout) == 0: + raise Exception("Error: IOS sdk does not seem to be installed. Please do that manually") + if not self.requires_nightly(): + # check std toolchains are installed + toolchains = subprocess.run(["rustup", "target", "list"], capture_output=True) + toolchains = toolchains.stdout.decode('utf-8').split("\n") + if "installed" not in next(filter(lambda x: self in x, toolchains)): + raise Exception(f"Error: the {t} target is not installed. Please do that manually") + else: + # check nightly toolchains are installed + toolchains = subprocess.run(["rustup", "+nightly", "target", "list"], capture_output=True) + toolchains = toolchains.stdout.decode('utf-8').split("\n") + if "installed" not in next(filter(lambda x: self in x, toolchains)): + raise Exception(f"Error: the {t} nightly target is not installed. Please do that manually") + return True + +def install_targets(): + cmd = ["rustup", "target", "add"] + TARGETS + print(" ".join(cmd)) + ret = subprocess.run(cmd) + assert(ret.returncode == 0) + +def get_all_bins(): + bins = map(lambda x: x.name, BINS_PATH.iterdir()) + return sorted(list(bins)) + +def get_targets(selection): + if "all" in selection: + return list(map(Target, TARGETS)) + else: + # preserve the same order as in TARGETS + return list(map(Target, filter(lambda x: x in selection, TARGETS))) + +def test_helper(tup): + bin, target = tup + retcode = target.check(bin) + return (target, bin, retcode) + +def test_all_targets(targets, bins): + pool = multiprocessing.Pool() + inputs = [(b, t) for b in bins for t in targets] + + outputs = list(tqdm(pool.imap(test_helper, inputs), total=len(inputs))) + + table = defaultdict(dict) + for (t, b, r) in outputs: + table[t][b] = r + return table + +def save_csv(file, table): + targets = get_targets(table.keys()) # preserve order in CSV + bins = list(list(table.values())[0].keys()) + with open(file, "w") as csvfile: + header = ["target"] + bins + writer = csv.DictWriter(csvfile, fieldnames=header) + writer.writeheader() + for t in targets: + d = {"target" : t} + d.update(table[t]) + writer.writerow(d) + +def load_csv(file): + table = {} + cols = [] + rows = [] + with open(file, "r") as csvfile: + reader = csv.DictReader(csvfile) + cols = list(filter(lambda x: x!="target", reader.fieldnames)) + for row in reader: + t = Target(row["target"]) + rows += [t] + del row["target"] + table[t] = dict([k, int(v)] for k, v in row.items()) + return (table, rows, cols) + +def merge_tables(old, new): + from copy import deepcopy + tmp = deepcopy(old) + tmp.update(deepcopy(new)) + return tmp + +def render_md(fd, table, headings: str, row_headings: Target): + def print_row(lst, lens=[]): + lens = lens + [0] * (len(lst) - len(lens)) + for e, l in zip(lst, lens): + fmt = '|{}' if l == 0 else '|{:>%s}' % len(header[0]) + fd.write(fmt.format(e)) + fd.write("|\n") + def cell_render(target, bin): + return "y" if table[target][bin] == 0 else " " + + # add some 'hard' padding to specific columns + lens = [ + max(map(lambda x: len(x.os), row_headings)) + 2, + max(map(lambda x: len(x.arch), row_headings)) + 2 + ] + header = Target.get_heading() + header[0] = ("{:#^%d}" % lens[0]).format(header[0]) + header[1] = ("{:#^%d}" % lens[1]).format(header[1]) + + header += headings + print_row(header) + lines = list(map(lambda x: '-'*len(x), header)) + print_row(lines) + + for t in row_headings: + row = list(map(lambda b: cell_render(t, b), headings)) + row = t.get_row_heading() + row + print_row(row) + +if __name__ == "__main__": + # create the top-level parser + parser = argparse.ArgumentParser(prog='compiles_table.py') + subparsers = parser.add_subparsers(help='sub-command to execute', required=True, dest="cmd") + # create the parser for the "check" command + parser_a = subparsers.add_parser('check', help='run cargo check on specified targets and update csv cache') + parser_a.add_argument("targets", metavar="TARGET", type=str, nargs='+', choices=["all"]+TARGETS, + help="target-triple to check, as shown by 'rustup target list'") + # create the parser for the "render" command + parser_b = subparsers.add_parser('render', help='print a markdown table to stdout') + parser_b.add_argument("--equidistant", action="store_true", + help="NOT IMPLEMENTED: render each column with an equal width (in plaintext)") + args = parser.parse_args() + + if args.cmd == "render": + table, targets, bins = load_csv(CACHE_PATH) + render_md(sys.stdout, table, bins, targets) + + if args.cmd == "check": + targets = get_targets(args.targets) + bins = get_all_bins() + + assert(all(map(Target.is_installed, targets))) + table = test_all_targets(targets, bins) + + prev_table, _, _ = load_csv(CACHE_PATH) + new_table = merge_tables(prev_table, table) + save_csv(CACHE_PATH, new_table) \ No newline at end of file From 698dab12a6528e471d08d1b723c083b0e3989699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81rni=20Dagur?= Date: Tue, 30 Mar 2021 18:53:02 +0000 Subject: [PATCH 544/606] wc: Don't read() if we only need to count number of bytes (Version 2) (#1851) * wc: Don't read() if we only need to count number of bytes * Resolve a few code review comments * Use write macros instead of print * Fix wc tests in case only one thing is printed * wc: Fix style * wc: Use return value of first splice rather than second * wc: Make main loop more readable * wc: Don't unwrap on failed write to stdout * wc: Increment error count when stats fail to print * Re-add Cargo.lock --- Cargo.lock | 2017 +++++++++++++++++----------------- src/uu/wc/Cargo.toml | 5 + src/uu/wc/src/count_bytes.rs | 95 ++ src/uu/wc/src/wc.rs | 411 ++++--- tests/by-util/test_wc.rs | 6 +- 5 files changed, 1382 insertions(+), 1152 deletions(-) create mode 100644 src/uu/wc/src/count_bytes.rs diff --git a/Cargo.lock b/Cargo.lock index b8293f666..6b79e018b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,2707 +1,2710 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "advapi32-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "aho-corasick" version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4", ] [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "arrayvec" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" dependencies = [ - "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", + "winapi 0.3.9", ] [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bit-set" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" dependencies = [ - "bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-vec", ] [[package]] name = "bit-vec" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ - "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec", + "constant_time_eq", ] [[package]] name = "block-buffer" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" dependencies = [ - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools", + "generic-array", ] [[package]] name = "bstr" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "memchr 2.3.4", + "regex-automata", + "serde", ] [[package]] name = "bumpalo" version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "byte-tools" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cast" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version", ] [[package]] name = "cc" version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" dependencies = [ - "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer", + "num-traits", + "time", ] [[package]] name = "clap" version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", ] [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", ] [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "conv" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" dependencies = [ - "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "custom_derive", ] [[package]] name = "coreutils" version = "0.0.4" dependencies = [ - "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_arch 0.0.4", - "uu_base32 0.0.4", - "uu_base64 0.0.4", - "uu_basename 0.0.4", - "uu_cat 0.0.4", - "uu_chgrp 0.0.4", - "uu_chmod 0.0.4", - "uu_chown 0.0.4", - "uu_chroot 0.0.4", - "uu_cksum 0.0.4", - "uu_comm 0.0.4", - "uu_cp 0.0.4", - "uu_csplit 0.0.4", - "uu_cut 0.0.4", - "uu_date 0.0.4", - "uu_df 0.0.4", - "uu_dircolors 0.0.4", - "uu_dirname 0.0.4", - "uu_du 0.0.4", - "uu_echo 0.0.4", - "uu_env 0.0.4", - "uu_expand 0.0.4", - "uu_expr 0.0.4", - "uu_factor 0.0.4", - "uu_false 0.0.4", - "uu_fmt 0.0.4", - "uu_fold 0.0.4", - "uu_groups 0.0.4", - "uu_hashsum 0.0.4", - "uu_head 0.0.4", - "uu_hostid 0.0.4", - "uu_hostname 0.0.4", - "uu_id 0.0.4", - "uu_install 0.0.4", - "uu_join 0.0.4", - "uu_kill 0.0.4", - "uu_link 0.0.4", - "uu_ln 0.0.4", - "uu_logname 0.0.4", - "uu_ls 0.0.4", - "uu_mkdir 0.0.4", - "uu_mkfifo 0.0.4", - "uu_mknod 0.0.4", - "uu_mktemp 0.0.4", - "uu_more 0.0.4", - "uu_mv 0.0.4", - "uu_nice 0.0.4", - "uu_nl 0.0.4", - "uu_nohup 0.0.4", - "uu_nproc 0.0.4", - "uu_numfmt 0.0.4", - "uu_od 0.0.4", - "uu_paste 0.0.4", - "uu_pathchk 0.0.4", - "uu_pinky 0.0.4", - "uu_printenv 0.0.4", - "uu_printf 0.0.4", - "uu_ptx 0.0.4", - "uu_pwd 0.0.4", - "uu_readlink 0.0.4", - "uu_realpath 0.0.4", - "uu_relpath 0.0.4", - "uu_rm 0.0.4", - "uu_rmdir 0.0.4", - "uu_seq 0.0.4", - "uu_shred 0.0.4", - "uu_shuf 0.0.4", - "uu_sleep 0.0.4", - "uu_sort 0.0.4", - "uu_split 0.0.4", - "uu_stat 0.0.4", - "uu_stdbuf 0.0.4", - "uu_sum 0.0.4", - "uu_sync 0.0.4", - "uu_tac 0.0.4", - "uu_tail 0.0.4", - "uu_tee 0.0.4", - "uu_test 0.0.4", - "uu_timeout 0.0.4", - "uu_touch 0.0.4", - "uu_tr 0.0.4", - "uu_true 0.0.4", - "uu_truncate 0.0.4", - "uu_tsort 0.0.4", - "uu_tty 0.0.4", - "uu_uname 0.0.4", - "uu_unexpand 0.0.4", - "uu_uniq 0.0.4", - "uu_unlink 0.0.4", - "uu_uptime 0.0.4", - "uu_users 0.0.4", - "uu_wc 0.0.4", - "uu_who 0.0.4", - "uu_whoami 0.0.4", - "uu_yes 0.0.4", - "uucore 0.0.7", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "conv", + "filetime", + "glob 0.3.0", + "lazy_static", + "libc", + "nix 0.20.0", + "rand 0.7.3", + "regex", + "sha1", + "tempdir", + "tempfile", + "textwrap", + "time", + "unindent", + "unix_socket", + "users", + "uu_arch", + "uu_base32", + "uu_base64", + "uu_basename", + "uu_cat", + "uu_chgrp", + "uu_chmod", + "uu_chown", + "uu_chroot", + "uu_cksum", + "uu_comm", + "uu_cp", + "uu_csplit", + "uu_cut", + "uu_date", + "uu_df", + "uu_dircolors", + "uu_dirname", + "uu_du", + "uu_echo", + "uu_env", + "uu_expand", + "uu_expr", + "uu_factor", + "uu_false", + "uu_fmt", + "uu_fold", + "uu_groups", + "uu_hashsum", + "uu_head", + "uu_hostid", + "uu_hostname", + "uu_id", + "uu_install", + "uu_join", + "uu_kill", + "uu_link", + "uu_ln", + "uu_logname", + "uu_ls", + "uu_mkdir", + "uu_mkfifo", + "uu_mknod", + "uu_mktemp", + "uu_more", + "uu_mv", + "uu_nice", + "uu_nl", + "uu_nohup", + "uu_nproc", + "uu_numfmt", + "uu_od", + "uu_paste", + "uu_pathchk", + "uu_pinky", + "uu_printenv", + "uu_printf", + "uu_ptx", + "uu_pwd", + "uu_readlink", + "uu_realpath", + "uu_relpath", + "uu_rm", + "uu_rmdir", + "uu_seq", + "uu_shred", + "uu_shuf", + "uu_sleep", + "uu_sort", + "uu_split", + "uu_stat", + "uu_stdbuf", + "uu_sum", + "uu_sync", + "uu_tac", + "uu_tail", + "uu_tee", + "uu_test", + "uu_timeout", + "uu_touch", + "uu_tr", + "uu_true", + "uu_truncate", + "uu_tsort", + "uu_tty", + "uu_uname", + "uu_unexpand", + "uu_uniq", + "uu_unlink", + "uu_uptime", + "uu_users", + "uu_wc", + "uu_who", + "uu_whoami", + "uu_yes", + "uucore", + "walkdir", ] [[package]] name = "cpp" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" dependencies = [ - "cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_macros", ] [[package]] name = "cpp_build" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" dependencies = [ - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "cpp_common 0.4.0", + "cpp_syn", + "cpp_synmap", + "cpp_synom", + "lazy_static", ] [[package]] name = "cpp_common" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" dependencies = [ - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn", + "cpp_synom", + "lazy_static", + "quote 0.3.15", ] [[package]] name = "cpp_common" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "proc-macro2", + "syn", ] [[package]] name = "cpp_macros" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "byteorder", + "cpp_common 0.5.6", + "if_rust_version", + "lazy_static", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "cpp_syn" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" dependencies = [ - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_synom", + "quote 0.3.15", + "unicode-xid 0.0.4", ] [[package]] name = "cpp_synmap" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" dependencies = [ - "cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cpp_syn", + "cpp_synom", + "memchr 1.0.2", ] [[package]] name = "cpp_synom" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" dependencies = [ - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4", ] [[package]] name = "criterion" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", - "tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "cast", + "clap", + "criterion-plot", + "csv", + "itertools 0.10.0", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", ] [[package]] name = "criterion-plot" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" dependencies = [ - "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cast", + "itertools 0.9.0", ] [[package]] name = "crossbeam-channel" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-utils", ] [[package]] name = "crossbeam-deque" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", ] [[package]] name = "crossbeam-utils" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "cfg-if 1.0.0", + "lazy_static", ] [[package]] name = "csv" version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" dependencies = [ - "bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "bstr", + "csv-core", + "itoa", + "ryu", + "serde", ] [[package]] name = "csv-core" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" dependencies = [ - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.4", ] [[package]] name = "custom_derive" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" [[package]] name = "data-encoding" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" [[package]] name = "digest" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" dependencies = [ - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array", ] [[package]] name = "dunce" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "regex", ] [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "file_diff" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31a7a908b8f32538a2143e59a6e4e2508988832d5d4d6f7c156b3cbc762643a5" [[package]] name = "filetime" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.2.5", + "winapi 0.3.9", ] [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fs_extra" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "generic-array" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" dependencies = [ - "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop", + "typenum", ] [[package]] name = "getopts" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" dependencies = [ - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "getrandom" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "libc", + "wasi", ] [[package]] name = "glob" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "half" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "hermit-abi" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "hex" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" [[package]] name = "hostname" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "match_cfg", + "winapi 0.3.9", ] [[package]] name = "if_rust_version" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" [[package]] name = "ioctl-sys" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" [[package]] name = "itertools" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itertools" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itertools" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" dependencies = [ - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itoa" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" -version = "0.3.49" +version = "0.3.50" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d99f9e3e84b8f67f846ef5b4cbbc3b1c29f6c759fcbce6f01aa0e73d932a24c" dependencies = [ - "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen", ] [[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" [[package]] name = "log" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", ] [[package]] name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "maybe-uninit" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "md5" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" [[package]] name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "memchr" version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memoffset" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "nix" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "cc", + "cfg-if 0.1.10", + "libc", + "void", ] [[package]] name = "nix" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "cc", + "cfg-if 1.0.0", + "libc", ] [[package]] name = "nodrop" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "num-integer" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "num-traits", ] [[package]] name = "num-traits" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", ] [[package]] name = "number_prefix" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "numtoa" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "onig" version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "lazy_static", + "libc", + "onig_sys", ] [[package]] name = "onig_sys" version = "69.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" dependencies = [ - "cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "pkg-config", ] [[package]] name = "oorandom" version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "paste" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" dependencies = [ - "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", + "paste-impl", + "proc-macro-hack", ] [[package]] name = "paste-impl" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" dependencies = [ - "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack", ] [[package]] name = "pkg-config" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "platform-info" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi 0.3.9", ] [[package]] name = "plotters" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" dependencies = [ - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", ] [[package]] name = "plotters-backend" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" [[package]] name = "plotters-svg" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" dependencies = [ - "plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters-backend", ] [[package]] name = "ppv-lite86" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro-hack" version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.1", ] [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quickcheck" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" dependencies = [ - "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger", + "log", + "rand 0.7.3", + "rand_core 0.5.1", ] [[package]] name = "quote" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "quote" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "rand" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" dependencies = [ - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "rdrand", + "winapi 0.3.9", ] [[package]] name = "rand" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "winapi 0.3.9", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", + "libc", + "rand_chacha", + "rand_core 0.5.1", + "rand_hc", + "rand_pcg", ] [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2", ] [[package]] name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom", ] [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1", ] [[package]] name = "rand_pcg" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1", ] [[package]] name = "rayon" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" dependencies = [ - "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", ] [[package]] name = "rayon-core" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ - "crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", ] [[package]] name = "rdrand" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1", ] [[package]] name = "redox_syscall" version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", ] [[package]] name = "redox_termios" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.5", ] [[package]] name = "regex" version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "memchr 2.3.4", + "regex-syntax", ] [[package]] name = "regex-automata" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" dependencies = [ - "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder", ] [[package]] name = "regex-syntax" version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "retain_mut" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" [[package]] name = "rust-ini" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver", ] [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "same-file" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ - "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util", ] [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver-parser", ] [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" [[package]] name = "serde_cbor" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" dependencies = [ - "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "half", + "serde", ] [[package]] name = "serde_derive" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "serde_json" version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ - "itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa", + "ryu", + "serde", ] [[package]] name = "sha1" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" dependencies = [ - "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "byte-tools", + "digest", + "fake-simd", + "generic-array", ] [[package]] name = "sha3" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" dependencies = [ - "block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer", + "byte-tools", + "digest", + "generic-array", ] [[package]] name = "smallvec" version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit", ] [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "unicode-xid 0.2.1", ] [[package]] name = "tempdir" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" dependencies = [ - "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6", + "remove_dir_all", ] [[package]] name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", + "rand 0.7.3", + "redox_syscall 0.1.57", + "remove_dir_all", + "winapi 0.3.9", ] [[package]] name = "term_grid" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" dependencies = [ - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "term_size" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi 0.3.9", ] [[package]] name = "termion" version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "numtoa", + "redox_syscall 0.2.5", + "redox_termios", ] [[package]] name = "termsize" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "kernel32-sys", + "libc", + "termion", + "winapi 0.2.8", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "term_size", + "unicode-width", ] [[package]] name = "thiserror" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ - "thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "redox_syscall 0.1.57", + "winapi 0.3.9", ] [[package]] name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)", + "serde", + "serde_json", ] [[package]] name = "twox-hash" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "rand 0.7.3", + "static_assertions", ] [[package]] name = "typenum" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" [[package]] name = "unicode-width" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unindent" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" [[package]] name = "unix_socket" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10", + "libc", ] [[package]] name = "users" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "log", ] [[package]] name = "uu_arch" version = "0.0.4" dependencies = [ - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "platform-info", + "uucore", + "uucore_procs", ] [[package]] name = "uu_base32" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_base64" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_basename" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cat" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "quick-error", + "unix_socket", + "uucore", + "uucore_procs", ] [[package]] name = "uu_chgrp" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chmod" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chown" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "glob 0.3.0", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_chroot" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cksum" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_comm" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cp" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "filetime", + "ioctl-sys", + "libc", + "quick-error", + "uucore", + "uucore_procs", + "walkdir", + "winapi 0.3.9", + "xattr", ] [[package]] name = "uu_csplit" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "glob 0.2.11", + "regex", + "thiserror", + "uucore", + "uucore_procs", ] [[package]] name = "uu_cut" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_date" version = "0.0.4" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono", + "clap", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_df" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "number_prefix", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_dircolors" version = "0.0.4" dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "glob 0.3.0", + "uucore", + "uucore_procs", ] [[package]] name = "uu_dirname" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_du" version = "0.0.4" dependencies = [ - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_echo" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_env" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "rust-ini", + "uucore", + "uucore_procs", ] [[package]] name = "uu_expand" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_expr" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "onig", + "uucore", + "uucore_procs", ] [[package]] name = "uu_factor" version = "0.0.4" dependencies = [ - "criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", - "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "criterion", + "num-traits", + "paste", + "quickcheck", + "rand 0.7.3", + "rand_chacha", + "smallvec", + "uucore", + "uucore_procs", ] [[package]] name = "uu_false" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_fmt" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_fold" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_groups" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hashsum" version = "0.0.4" dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", - "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "blake2-rfc", + "clap", + "digest", + "hex", + "libc", + "md5", + "regex", + "regex-syntax", + "sha1", + "sha2", + "sha3", + "uucore", + "uucore_procs", ] [[package]] name = "uu_head" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hostid" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_hostname" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "hostname", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_id" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_install" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "file_diff", + "filetime", + "libc", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_join" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_kill" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_link" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ln" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_logname" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ls" version = "0.0.4" dependencies = [ - "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "atty", + "clap", + "lazy_static", + "number_prefix", + "term_grid", + "termsize", + "time", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mkdir" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mkfifo" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mknod" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mktemp" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "rand 0.5.6", + "tempfile", + "uucore", + "uucore_procs", ] [[package]] name = "uu_more" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "nix 0.13.1", + "redox_syscall 0.1.57", + "redox_termios", + "uucore", + "uucore_procs", ] [[package]] name = "uu_mv" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "fs_extra", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nice" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "nix 0.13.1", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nl" version = "0.0.4" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "aho-corasick", + "clap", + "libc", + "memchr 2.3.4", + "regex", + "regex-syntax", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nohup" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_nproc" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "num_cpus", + "uucore", + "uucore_procs", ] [[package]] name = "uu_numfmt" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_od" version = "0.0.4" dependencies = [ - "byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "byteorder", + "clap", + "half", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_paste" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pathchk" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pinky" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_printenv" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_printf" version = "0.0.4" dependencies = [ - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "itertools 0.8.2", + "uucore", + "uucore_procs", ] [[package]] name = "uu_ptx" version = "0.0.4" dependencies = [ - "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "aho-corasick", + "clap", + "libc", + "memchr 2.3.4", + "regex", + "regex-syntax", + "uucore", + "uucore_procs", ] [[package]] name = "uu_pwd" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_readlink" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_realpath" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_relpath" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_rm" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "remove_dir_all", + "uucore", + "uucore_procs", + "walkdir", ] [[package]] name = "uu_rmdir" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_seq" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_shred" version = "0.0.4" dependencies = [ - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "filetime", + "getopts", + "libc", + "rand 0.5.6", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_shuf" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "rand 0.5.6", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sleep" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sort" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "twox-hash 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "itertools 0.8.2", + "rand 0.7.3", + "semver", + "twox-hash", + "uucore", + "uucore_procs", ] [[package]] name = "uu_split" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stat" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stdbuf" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uu_stdbuf_libstdbuf 0.0.4", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "tempfile", + "uu_stdbuf_libstdbuf", + "uucore", + "uucore_procs", ] [[package]] name = "uu_stdbuf_libstdbuf" version = "0.0.4" dependencies = [ - "cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "cpp", + "cpp_build", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sum" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_sync" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_tac" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tail" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "clap", + "libc", + "redox_syscall 0.1.57", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_tee" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "retain_mut", + "uucore", + "uucore_procs", ] [[package]] name = "uu_test" version = "0.0.4" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "libc", + "redox_syscall 0.1.57", + "uucore", + "uucore_procs", ] [[package]] name = "uu_timeout" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_touch" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "filetime", + "time", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tr" version = "0.0.4" dependencies = [ - "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "bit-set", + "clap", + "fnv", + "uucore", + "uucore_procs", ] [[package]] name = "uu_true" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_truncate" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tsort" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_tty" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uname" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "platform-info", + "uucore", + "uucore_procs", ] [[package]] name = "uu_unexpand" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "unicode-width", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uniq" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_unlink" version = "0.0.4" dependencies = [ - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "getopts", + "libc", + "uucore", + "uucore_procs", ] [[package]] name = "uu_uptime" version = "0.0.4" dependencies = [ - "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "chrono", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_users" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uu_wc" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "libc", + "nix 0.20.0", + "thiserror", + "uucore", + "uucore_procs", ] [[package]] name = "uu_who" version = "0.0.4" dependencies = [ - "uucore 0.0.7", - "uucore_procs 0.0.5", + "uucore", + "uucore_procs", ] [[package]] name = "uu_whoami" version = "0.0.4" dependencies = [ - "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "advapi32-sys", + "clap", + "uucore", + "uucore_procs", + "winapi 0.3.9", ] [[package]] name = "uu_yes" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] name = "uucore" version = "0.0.7" dependencies = [ - "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "data-encoding", + "dunce", + "getopts", + "lazy_static", + "libc", + "nix 0.13.1", + "platform-info", + "termion", + "thiserror", + "time", + "wild", ] [[package]] name = "uucore_procs" version = "0.0.5" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", ] [[package]] name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "walkdir" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ - "same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file", + "winapi 0.3.9", + "winapi-util", ] [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" -version = "0.2.72" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83240549659d187488f91f33c0f8547cbfef0b2088bc470c116d1d260ef623d9" dependencies = [ - "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 1.0.0", + "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.72" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae70622411ca953215ca6d06d3ebeb1e915f0f6613e3b495122878d7ebec7dae" dependencies = [ - "bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote 1.0.9", + "syn", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.72" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e734d91443f177bfdb41969de821e15c516931c3c3db3d318fa1b68975d0f6f" dependencies = [ - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.9", + "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.72" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53739ff08c8a68b0fdbcd54c372b8ab800b1449ab3c9d706503bc7dd1621b2c" dependencies = [ - "proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote 1.0.9", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.72" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9a543ae66aa233d14bb765ed9af4a33e81b8b58d1584cf1b47ff8cd0b9e4489" [[package]] name = "web-sys" -version = "0.3.49" +version = "0.3.50" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a905d57e488fec8861446d3393670fb50d27a262344013181c2cdf9fff5481be" dependencies = [ - "js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys", + "wasm-bindgen", ] [[package]] name = "wild" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0", ] [[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" dependencies = [ - "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] - -[metadata] -"checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" -"checksum aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -"checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" -"checksum bit-vec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" -"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -"checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" -"checksum bstr 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" -"checksum bumpalo 3.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" -"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" -"checksum byteorder 1.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -"checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" -"checksum cc 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)" = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" -"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" -"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" -"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" -"checksum cpp 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4875a08600be48dcc9cb6ee07f104a3e0752e95184dede6a30044d6480bf50e8" -"checksum cpp_build 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c47531e7e09532ad4827098729794f5e1a5b1c2ccbb5e295498d2e7ab451c445" -"checksum cpp_common 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79e39149a7943affa02f5b6e347ca2840a129cc78d5883ee229f0f1c4027d628" -"checksum cpp_common 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "df78ad28e5fe814285016779fb3d3b874520c799a847e6190bf2b834cc4ff283" -"checksum cpp_macros 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f93a21e618c10abc84ebb63ffa5952e1f7a4568b8141d542d5ef860e4a8fc25" -"checksum cpp_syn 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8cd649bf5b3804d92fe12a60c7698f5a538a6033ed8a668bf5241d4d4f1644e" -"checksum cpp_synmap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "897e4f9cdbe2874edd3ffe53718ee5d8b89e2a970057b2c93d3214104f2e90b6" -"checksum cpp_synom 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc8da5694233b646150c785118f77835ad0a49680c7f312a10ef30957c67b6d" -"checksum criterion 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23" -"checksum criterion-plot 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d" -"checksum crossbeam-channel 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" -"checksum crossbeam-deque 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" -"checksum crossbeam-epoch 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12" -"checksum crossbeam-utils 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" -"checksum csv 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" -"checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" -"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" -"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" -"checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" -"checksum dunce 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2641c4a7c0c4101df53ea572bffdc561c146f6c2eb09e4df02bc4811e3feeb4" -"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum file_diff 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "31a7a908b8f32538a2143e59a6e4e2508988832d5d4d6f7c156b3cbc762643a5" -"checksum filetime 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" -"checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -"checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum generic-array 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2297fb0e3ea512e380da24b52dca3924028f59df5e3a17a18f81d8349ca7ebe" -"checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -"checksum getrandom 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -"checksum half 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" -"checksum hermit-abi 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" -"checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" -"checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -"checksum if_rust_version 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46dbcb333e86939721589d25a3557e180b52778cb33c7fdfe9e0158ff790d5ec" -"checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a" -"checksum itertools 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" -"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" -"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" -"checksum itoa 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" -"checksum js-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)" = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" -"checksum log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -"checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" -"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" -"checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" -"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" -"checksum memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" -"checksum memoffset 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d" -"checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" -"checksum nix 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" -"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -"checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" -"checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -"checksum number_prefix 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" -"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" -"checksum onig 4.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8518fcb2b1b8c2f45f0ad499df4fda6087fc3475ca69a185c173b8315d2fb383" -"checksum onig_sys 69.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388410bf5fa341f10e58e6db3975f4bea1ac30247dd79d37a9e5ced3cb4cc3b0" -"checksum oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" -"checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" -"checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" -"checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" -"checksum platform-info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ea9cd21d89bffb387b6c7363d23bead0807be9de676c671b474dd29e7436d3" -"checksum plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a" -"checksum plotters-backend 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590" -"checksum plotters-svg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211" -"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" -"checksum proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" -"checksum proc-macro2 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" -"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -"checksum quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" -"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum quote 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" -"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" -"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" -"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -"checksum rand_pcg 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -"checksum rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" -"checksum rayon-core 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" -"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -"checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" -"checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" -"checksum regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" -"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" -"checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" -"checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -"checksum retain_mut 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53552c6c49e1e13f1a203ef0080ab3bbef0beb570a528993e83df057a9d9bba1" -"checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" -"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -"checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" -"checksum serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" -"checksum serde_derive 1.0.125 (registry+https://github.com/rust-lang/crates.io-index)" = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" -"checksum serde_json 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)" = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" -"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" -"checksum sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d963c78ce367df26d7ea8b8cc655c651b42e8a1e584e869c1e17dae3ccb116a" -"checksum sha3 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26405905b6a56a94c60109cfda62610507ac14a65be531f5767dec5c5a8dd6a0" -"checksum smallvec 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -"checksum static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.67 (registry+https://github.com/rust-lang/crates.io-index)" = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" -"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" -"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" -"checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf" -"checksum term_size 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" -"checksum termion 1.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" -"checksum termsize 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517" -"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" -"checksum thiserror-impl 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" -"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tinytemplate 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -"checksum twox-hash 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59" -"checksum typenum 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" -"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" -"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" -"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" -"checksum unindent 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7" -"checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564" -"checksum users 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa4227e95324a443c9fcb06e03d4d85e91aabe9a5a02aa818688b6918b6af486" -"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum walkdir 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" -"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum wasm-bindgen 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" -"checksum wasm-bindgen-backend 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" -"checksum wasm-bindgen-macro 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" -"checksum wasm-bindgen-macro-support 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" -"checksum wasm-bindgen-shared 0.2.72 (registry+https://github.com/rust-lang/crates.io-index)" = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" -"checksum web-sys 0.3.49 (registry+https://github.com/rust-lang/crates.io-index)" = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" -"checksum wild 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "035793abb854745033f01a07647a79831eba29ec0be377205f2a25b0aa830020" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index 894ac44dd..4e6cef101 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -18,6 +18,11 @@ path = "src/wc.rs" clap = "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +thiserror = "1.0" + +[target.'cfg(unix)'.dependencies] +nix = "0.20" +libc = "0.2" [[bin]] name = "wc" diff --git a/src/uu/wc/src/count_bytes.rs b/src/uu/wc/src/count_bytes.rs new file mode 100644 index 000000000..dc90f67cc --- /dev/null +++ b/src/uu/wc/src/count_bytes.rs @@ -0,0 +1,95 @@ +use super::{WcResult, WordCountable}; + +#[cfg(any(target_os = "linux", target_os = "android"))] +use std::fs::OpenOptions; +use std::io::ErrorKind; + +#[cfg(unix)] +use libc::S_IFREG; +#[cfg(unix)] +use nix::sys::stat::fstat; +#[cfg(any(target_os = "linux", target_os = "android"))] +use std::os::unix::io::{AsRawFd, RawFd}; + +#[cfg(any(target_os = "linux", target_os = "android"))] +use libc::S_IFIFO; +#[cfg(any(target_os = "linux", target_os = "android"))] +use nix::fcntl::{splice, SpliceFFlags}; +#[cfg(any(target_os = "linux", target_os = "android"))] +use nix::unistd::pipe; + +const BUF_SIZE: usize = 16384; + +/// This is a Linux-specific function to count the number of bytes using the +/// `splice` system call, which is faster than using `read`. +#[inline] +#[cfg(any(target_os = "linux", target_os = "android"))] +fn count_bytes_using_splice(fd: RawFd) -> nix::Result { + let null_file = OpenOptions::new() + .write(true) + .open("/dev/null") + .map_err(|_| nix::Error::last())?; + let null = null_file.as_raw_fd(); + let (pipe_rd, pipe_wr) = pipe()?; + + let mut byte_count = 0; + loop { + let res = splice(fd, None, pipe_wr, None, BUF_SIZE, SpliceFFlags::empty())?; + if res == 0 { + break; + } + byte_count += res; + splice(pipe_rd, None, null, None, res, SpliceFFlags::empty())?; + } + + Ok(byte_count) +} + +/// In the special case where we only need to count the number of bytes. There +/// are several optimizations we can do: +/// 1. On Unix, we can simply `stat` the file if it is regular. +/// 2. On Linux -- if the above did not work -- we can use splice to count +/// the number of bytes if the file is a FIFO. +/// 3. Otherwise, we just read normally, but without the overhead of counting +/// other things such as lines and words. +#[inline] +pub(crate) fn count_bytes_fast(handle: &mut T) -> WcResult { + #[cfg(unix)] + { + let fd = handle.as_raw_fd(); + match fstat(fd) { + Ok(stat) => { + // If the file is regular, then the `st_size` should hold + // the file's size in bytes. + if (stat.st_mode & S_IFREG) != 0 { + return Ok(stat.st_size as usize); + } + #[cfg(any(target_os = "linux", target_os = "android"))] + { + // Else, if we're on Linux and our file is a FIFO pipe + // (or stdin), we use splice to count the number of bytes. + if (stat.st_mode & S_IFIFO) != 0 { + if let Ok(n) = count_bytes_using_splice(fd) { + return Ok(n); + } + } + } + } + _ => {} + } + } + + // Fall back on `read`, but without the overhead of counting words and lines. + let mut buf = [0 as u8; BUF_SIZE]; + let mut byte_count = 0; + loop { + match handle.read(&mut buf) { + Ok(0) => return Ok(byte_count), + Ok(n) => { + byte_count += n; + } + Err(ref e) if e.kind() == ErrorKind::Interrupted => continue, + Err(e) => return Err(e.into()), + } + } +} diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 972802f81..22463caa4 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -10,14 +10,31 @@ #[macro_use] extern crate uucore; -use clap::{App, Arg, ArgMatches}; +mod count_bytes; +use count_bytes::count_bytes_fast; +use clap::{App, Arg, ArgMatches}; +use thiserror::Error; + +use std::cmp::max; use std::fs::File; -use std::io::{stdin, BufRead, BufReader, Read}; +use std::io::{self, BufRead, BufReader, Read, StdinLock, Write}; +use std::ops::{Add, AddAssign}; +#[cfg(unix)] +use std::os::unix::io::AsRawFd; use std::path::Path; -use std::result::Result as StdResult; use std::str::from_utf8; +#[derive(Error, Debug)] +pub enum WcError { + #[error("{0}")] + Io(#[from] io::Error), + #[error("Expected a file, found directory {0}")] + IsDirectory(String), +} + +type WcResult = Result; + struct Settings { show_bytes: bool, show_chars: bool, @@ -53,10 +70,46 @@ impl Settings { show_max_line_length: false, } } + + fn number_enabled(&self) -> u32 { + let mut result = 0; + result += self.show_bytes as u32; + result += self.show_chars as u32; + result += self.show_lines as u32; + result += self.show_max_line_length as u32; + result += self.show_words as u32; + result + } } -struct Result { - title: String, +#[cfg(unix)] +trait WordCountable: AsRawFd + Read { + type Buffered: BufRead; + fn get_buffered(self) -> Self::Buffered; +} +#[cfg(not(unix))] +trait WordCountable: Read { + type Buffered: BufRead; + fn get_buffered(self) -> Self::Buffered; +} + +impl WordCountable for StdinLock<'_> { + type Buffered = Self; + + fn get_buffered(self) -> Self::Buffered { + self + } +} +impl WordCountable for File { + type Buffered = BufReader; + + fn get_buffered(self) -> Self::Buffered { + BufReader::new(self) + } +} + +#[derive(Debug, Default, Copy, Clone)] +struct WordCount { bytes: usize, chars: usize, lines: usize, @@ -64,6 +117,45 @@ struct Result { max_line_length: usize, } +impl Add for WordCount { + type Output = Self; + + fn add(self, other: Self) -> Self { + Self { + bytes: self.bytes + other.bytes, + chars: self.chars + other.chars, + lines: self.lines + other.lines, + words: self.words + other.words, + max_line_length: max(self.max_line_length, other.max_line_length), + } + } +} + +impl AddAssign for WordCount { + fn add_assign(&mut self, other: Self) { + *self = *self + other + } +} + +impl WordCount { + fn with_title<'a>(self, title: &'a str) -> TitledWordCount<'a> { + return TitledWordCount { + title: title, + count: self, + }; + } +} + +/// This struct supplements the actual word count with a title that is displayed +/// to the user at the end of the program. +/// The reason we don't simply include title in the `WordCount` struct is that +/// it would result in unneccesary copying of `String`. +#[derive(Debug, Default, Clone)] +struct TitledWordCount<'a> { + title: &'a str, + count: WordCount, +} + static ABOUT: &str = "Display newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified."; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -137,12 +229,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let settings = Settings::new(&matches); - match wc(files, &settings) { - Ok(()) => ( /* pass */ ), - Err(e) => return e, + if wc(files, &settings).is_ok() { + 0 + } else { + 1 } - - 0 } const CR: u8 = b'\r'; @@ -157,151 +248,187 @@ fn is_word_separator(byte: u8) -> bool { byte == SPACE || byte == TAB || byte == CR || byte == SYN || byte == FF } -fn wc(files: Vec, settings: &Settings) -> StdResult<(), i32> { - let mut total_line_count: usize = 0; - let mut total_word_count: usize = 0; - let mut total_char_count: usize = 0; - let mut total_byte_count: usize = 0; - let mut total_longest_line_length: usize = 0; - - let mut results = vec![]; - let mut max_width: usize = 0; +fn word_count_from_reader( + mut reader: T, + settings: &Settings, + path: &String, +) -> WcResult { + let only_count_bytes = settings.show_bytes + && (!(settings.show_chars + || settings.show_lines + || settings.show_max_line_length + || settings.show_words)); + if only_count_bytes { + return Ok(WordCount { + bytes: count_bytes_fast(&mut reader)?, + ..WordCount::default() + }); + } // we do not need to decode the byte stream if we're only counting bytes/newlines let decode_chars = settings.show_chars || settings.show_words || settings.show_max_line_length; + let mut line_count: usize = 0; + let mut word_count: usize = 0; + let mut byte_count: usize = 0; + let mut char_count: usize = 0; + let mut longest_line_length: usize = 0; + let mut raw_line = Vec::new(); + let mut ends_lf: bool; + + // reading from a TTY seems to raise a condition on, rather than return Some(0) like a file. + // hence the option wrapped in a result here + let mut buffered_reader = reader.get_buffered(); + loop { + match buffered_reader.read_until(LF, &mut raw_line) { + Ok(n) => { + if n == 0 { + break; + } + } + Err(ref e) => { + if !raw_line.is_empty() { + show_warning!("Error while reading {}: {}", path, e); + } else { + break; + } + } + }; + + // GNU 'wc' only counts lines that end in LF as lines + ends_lf = *raw_line.last().unwrap() == LF; + line_count += ends_lf as usize; + + byte_count += raw_line.len(); + + if decode_chars { + // try and convert the bytes to UTF-8 first + let current_char_count; + match from_utf8(&raw_line[..]) { + Ok(line) => { + word_count += line.split_whitespace().count(); + current_char_count = line.chars().count(); + } + Err(..) => { + word_count += raw_line.split(|&x| is_word_separator(x)).count(); + current_char_count = raw_line.iter().filter(|c| c.is_ascii()).count() + } + } + char_count += current_char_count; + if current_char_count > longest_line_length { + // -L is a GNU 'wc' extension so same behavior on LF + longest_line_length = current_char_count - (ends_lf as usize); + } + } + + raw_line.truncate(0); + } + + Ok(WordCount { + bytes: byte_count, + chars: char_count, + lines: line_count, + words: word_count, + max_line_length: longest_line_length, + }) +} + +fn word_count_from_path(path: &String, settings: &Settings) -> WcResult { + if path == "-" { + let stdin = io::stdin(); + let stdin_lock = stdin.lock(); + return Ok(word_count_from_reader(stdin_lock, settings, path)?); + } else { + let path_obj = Path::new(path); + if path_obj.is_dir() { + return Err(WcError::IsDirectory(path.clone())); + } else { + let file = File::open(path)?; + return Ok(word_count_from_reader(file, settings, path)?); + } + } +} + +fn wc(files: Vec, settings: &Settings) -> Result<(), u32> { + let mut total_word_count = WordCount::default(); + let mut results = vec![]; + let mut max_width: usize = 0; + let mut error_count = 0; + + let num_files = files.len(); + for path in &files { - let mut reader = open(&path[..])?; - - let mut line_count: usize = 0; - let mut word_count: usize = 0; - let mut byte_count: usize = 0; - let mut char_count: usize = 0; - let mut longest_line_length: usize = 0; - let mut raw_line = Vec::new(); - let mut ends_lf: bool; - // reading from a TTY seems to raise a condition on, rather than return Some(0) like a file. - // hence the option wrapped in a result here - while match reader.read_until(LF, &mut raw_line) { - Ok(n) if n > 0 => true, - Err(ref e) if !raw_line.is_empty() => { - show_warning!("Error while reading {}: {}", path, e); - !raw_line.is_empty() - } - _ => false, - } { - // GNU 'wc' only counts lines that end in LF as lines - ends_lf = *raw_line.last().unwrap() == LF; - line_count += ends_lf as usize; - - byte_count += raw_line.len(); - - if decode_chars { - // try and convert the bytes to UTF-8 first - let current_char_count; - match from_utf8(&raw_line[..]) { - Ok(line) => { - word_count += line.split_whitespace().count(); - current_char_count = line.chars().count(); - } - Err(..) => { - word_count += raw_line.split(|&x| is_word_separator(x)).count(); - current_char_count = raw_line.iter().filter(|c| c.is_ascii()).count() - } - } - char_count += current_char_count; - if current_char_count > longest_line_length { - // -L is a GNU 'wc' extension so same behavior on LF - longest_line_length = current_char_count - (ends_lf as usize); - } - } - - raw_line.truncate(0); - } - - results.push(Result { - title: path.clone(), - bytes: byte_count, - chars: char_count, - lines: line_count, - words: word_count, - max_line_length: longest_line_length, + let word_count = word_count_from_path(&path, settings).unwrap_or_else(|err| { + show_error!("{}", err); + error_count += 1; + WordCount::default() }); - - total_line_count += line_count; + max_width = max(max_width, word_count.bytes.to_string().len() + 1); total_word_count += word_count; - total_char_count += char_count; - total_byte_count += byte_count; - - if longest_line_length > total_longest_line_length { - total_longest_line_length = longest_line_length; - } - - // used for formatting - max_width = total_byte_count.to_string().len() + 1; + results.push(word_count.with_title(path)); } for result in &results { - print_stats(settings, &result, max_width); + if let Err(err) = print_stats(settings, &result, max_width) { + show_warning!("failed to print result for {}: {}", result.title, err); + error_count += 1; + } } - if files.len() > 1 { - let result = Result { - title: "total".to_owned(), - bytes: total_byte_count, - chars: total_char_count, - lines: total_line_count, - words: total_word_count, - max_line_length: total_longest_line_length, - }; - print_stats(settings, &result, max_width); + if num_files > 1 { + let total_result = total_word_count.with_title("total"); + if let Err(err) = print_stats(settings, &total_result, max_width) { + show_warning!("failed to print total: {}", err); + error_count += 1; + } + } + + if error_count == 0 { + Ok(()) + } else { + Err(error_count) + } +} + +fn print_stats( + settings: &Settings, + result: &TitledWordCount, + mut min_width: usize, +) -> WcResult<()> { + let stdout = io::stdout(); + let mut stdout_lock = stdout.lock(); + + if settings.number_enabled() <= 1 { + // Prevent a leading space in case we only need to display a single + // number. + min_width = 0; + } + + if settings.show_lines { + write!(stdout_lock, "{:1$}", result.count.lines, min_width)?; + } + if settings.show_words { + write!(stdout_lock, "{:1$}", result.count.words, min_width)?; + } + if settings.show_bytes { + write!(stdout_lock, "{:1$}", result.count.bytes, min_width)?; + } + if settings.show_chars { + write!(stdout_lock, "{:1$}", result.count.chars, min_width)?; + } + if settings.show_max_line_length { + write!( + stdout_lock, + "{:1$}", + result.count.max_line_length, min_width + )?; + } + + if result.title == "-" { + writeln!(stdout_lock, "")?; + } else { + writeln!(stdout_lock, " {}", result.title)?; } Ok(()) } - -fn print_stats(settings: &Settings, result: &Result, max_width: usize) { - if settings.show_lines { - print!("{:1$}", result.lines, max_width); - } - if settings.show_words { - print!("{:1$}", result.words, max_width); - } - if settings.show_bytes { - print!("{:1$}", result.bytes, max_width); - } - if settings.show_chars { - print!("{:1$}", result.chars, max_width); - } - if settings.show_max_line_length { - print!("{:1$}", result.max_line_length, max_width); - } - - if result.title != "-" { - println!(" {}", result.title); - } else { - println!(); - } -} - -fn open(path: &str) -> StdResult>, i32> { - if "-" == path { - let reader = Box::new(stdin()) as Box; - return Ok(BufReader::new(reader)); - } - - let fpath = Path::new(path); - if fpath.is_dir() { - show_info!("{}: is a directory", path); - } - match File::open(&fpath) { - Ok(fd) => { - let reader = Box::new(fd) as Box; - Ok(BufReader::new(reader)) - } - Err(e) => { - show_error!("wc: {}: {}", path, e); - Err(1) - } - } -} diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index b064d7e0e..fd1143f05 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -25,7 +25,7 @@ fn test_stdin_line_len_regression() { .args(&["-L"]) .pipe_in("\n123456") .run() - .stdout_is(" 6\n"); + .stdout_is("6\n"); } #[test] @@ -34,7 +34,7 @@ fn test_stdin_only_bytes() { .args(&["-c"]) .pipe_in_fixture("lorem_ipsum.txt") .run() - .stdout_is(" 772\n"); + .stdout_is("772\n"); } #[test] @@ -59,7 +59,7 @@ fn test_single_only_lines() { new_ucmd!() .args(&["-l", "moby_dick.txt"]) .run() - .stdout_is(" 18 moby_dick.txt\n"); + .stdout_is("18 moby_dick.txt\n"); } #[test] From da18ffa496a71d6409710789088864b1f15cd355 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 30 Mar 2021 20:54:25 +0200 Subject: [PATCH 545/606] refresh cargo.lock with recent updates --- Cargo.lock | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6b79e018b..ab8e59352 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,7 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - [[package]] name = "advapi32-sys" version = "0.2.0" @@ -2005,7 +2003,7 @@ dependencies = [ name = "uu_more" version = "0.0.4" dependencies = [ - "getopts", + "clap", "nix 0.13.1", "redox_syscall 0.1.57", "redox_termios", From be03c948ed3b077f0d492353e5126b26016861bc Mon Sep 17 00:00:00 2001 From: desbma Date: Tue, 30 Mar 2021 21:24:01 +0200 Subject: [PATCH 546/606] Add pre-commit hook + run fmt (#1959) --- .pre-commit-config.yaml | 8 ++++++++ src/uu/tee/src/tee.rs | 33 ++++++++++++++++----------------- tests/by-util/test_pathchk.rs | 32 ++++++++++++++++---------------- tests/by-util/test_rm.rs | 2 +- 4 files changed, 41 insertions(+), 34 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..66d2a5f5a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +# https://pre-commit.com +repos: + - repo: https://github.com/doublify/pre-commit-rust + rev: v1.0 + hooks: + - id: cargo-check + - id: clippy + - id: fmt diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index 4b0f19038..7c6a86b4c 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -9,10 +9,10 @@ extern crate uucore; use clap::{App, Arg}; +use retain_mut::RetainMut; use std::fs::OpenOptions; use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write}; use std::path::{Path, PathBuf}; -use retain_mut::RetainMut; #[cfg(unix)] use uucore::libc; @@ -98,19 +98,19 @@ fn tee(options: Options) -> Result<()> { .files .clone() .into_iter() - .map(|file| - NamedWriter { - name: file.clone(), - inner: open(file, options.append), - } - ) + .map(|file| NamedWriter { + name: file.clone(), + inner: open(file, options.append), + }) .collect(); - - writers.insert(0, NamedWriter { - name: "'standard output'".to_owned(), - inner: Box::new(stdout()), - }); + writers.insert( + 0, + NamedWriter { + name: "'standard output'".to_owned(), + inner: Box::new(stdout()), + }, + ); let mut output = MultiWriter::new(writers); let input = &mut NamedReader { @@ -119,8 +119,7 @@ fn tee(options: Options) -> Result<()> { // TODO: replaced generic 'copy' call to be able to stop copying // if all outputs are closed (due to errors) - if copy(input, &mut output).is_err() || output.flush().is_err() || - output.error_occured() { + if copy(input, &mut output).is_err() || output.flush().is_err() || output.error_occured() { Err(Error::new(ErrorKind::Other, "")) } else { Ok(()) @@ -150,7 +149,7 @@ struct MultiWriter { } impl MultiWriter { - fn new (writers: Vec) -> Self { + fn new(writers: Vec) -> Self { Self { initial_len: writers.len(), writers, @@ -170,7 +169,7 @@ impl Write for MultiWriter { show_info!("{}: {}", writer.name, f.to_string()); false } - _ => true + _ => true, } }); Ok(buf.len()) @@ -184,7 +183,7 @@ impl Write for MultiWriter { show_info!("{}: {}", writer.name, f.to_string()); false } - _ => true + _ => true, } }); Ok(()) diff --git a/tests/by-util/test_pathchk.rs b/tests/by-util/test_pathchk.rs index d01beccc2..3bc12f0b6 100644 --- a/tests/by-util/test_pathchk.rs +++ b/tests/by-util/test_pathchk.rs @@ -38,10 +38,7 @@ fn test_posix_mode() { // fail on long path new_ucmd!() - .args(&[ - "-p", - &"dir".repeat(libc::PATH_MAX as usize + 1).as_str(), - ]) + .args(&["-p", &"dir".repeat(libc::PATH_MAX as usize + 1).as_str()]) .fails() .no_stdout(); @@ -79,10 +76,7 @@ fn test_posix_special() { // fail on long path new_ucmd!() - .args(&[ - "-P", - &"dir".repeat(libc::PATH_MAX as usize + 1).as_str(), - ]) + .args(&["-P", &"dir".repeat(libc::PATH_MAX as usize + 1).as_str()]) .fails() .no_stdout(); @@ -107,7 +101,10 @@ fn test_posix_all() { // test the posix special mode // accept some reasonable default - new_ucmd!().args(&["-p", "-P", "dir/file"]).succeeds().no_stdout(); + new_ucmd!() + .args(&["-p", "-P", "dir/file"]) + .succeeds() + .no_stdout(); // accept non-leading hyphen new_ucmd!() @@ -136,10 +133,16 @@ fn test_posix_all() { .no_stdout(); // fail on non-portable chars - new_ucmd!().args(&["-p", "-P", "dir#/$file"]).fails().no_stdout(); + new_ucmd!() + .args(&["-p", "-P", "dir#/$file"]) + .fails() + .no_stdout(); // fail on leading hyphen char - new_ucmd!().args(&["-p", "-P", "dir/-file"]).fails().no_stdout(); + new_ucmd!() + .args(&["-p", "-P", "dir/-file"]) + .fails() + .no_stdout(); // fail on empty path new_ucmd!().args(&["-p", "-P", ""]).fails().no_stdout(); @@ -149,8 +152,5 @@ fn test_posix_all() { fn test_args_parsing() { // fail on no args let empty_args: [String; 0] = []; - new_ucmd!() - .args(&empty_args) - .fails() - .no_stdout(); -} \ No newline at end of file + new_ucmd!().args(&empty_args).fails().no_stdout(); +} diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 40cc6839a..149d509c5 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -177,7 +177,7 @@ fn test_rm_directory_without_flag() { let dir = "test_rm_directory_without_flag_dir"; at.mkdir(dir); - + let result = ucmd.arg(dir).fails(); println!("{}", result.stderr); assert!(result From ba315de6aa90a4e62401d6d5fd10b8b5d6d89c02 Mon Sep 17 00:00:00 2001 From: desbma Date: Tue, 30 Mar 2021 21:39:24 +0200 Subject: [PATCH 547/606] Add pre-commit instructions --- DEVELOPER_INSTRUCTIONS.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/DEVELOPER_INSTRUCTIONS.md b/DEVELOPER_INSTRUCTIONS.md index be6373409..c3b20dd46 100644 --- a/DEVELOPER_INSTRUCTIONS.md +++ b/DEVELOPER_INSTRUCTIONS.md @@ -24,3 +24,15 @@ if changes are not reflected in the report then run `cargo clean` and run the a If you are using stable version of Rust that doesn't enable code coverage instrumentation by default then add `-Z-Zinstrument-coverage` flag to `RUSTFLAGS` env variable specified above. + +pre-commit hooks +---------------- + +A configuration for `pre-commit` is provided in the repository. It allows automatically checking every git commit you make to ensure it compiles, and passes `clippy` and `rustfmt` without warnings. + +To use the provided hook: + +1. [Install `pre-commit`](https://pre-commit.com/#install) +2. Run `pre-commit install` while in the repository directory + +Your git commits will then automatically be checked. If a check fails, an error message will explain why, and your commit will be canceled. You can then make the suggested changes, and run `git commit ...` again. From a57f17ac5b7d66f7b2800adbda58f3bdfae6e24b Mon Sep 17 00:00:00 2001 From: Mikadore Date: Wed, 31 Mar 2021 11:25:23 +0200 Subject: [PATCH 548/606] Expand `CmdResult`'s API (#1977) --- tests/by-util/test_wc.rs | 2 +- tests/common/util.rs | 208 ++++++++++++++++++++++++++++++++------- 2 files changed, 171 insertions(+), 39 deletions(-) diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index fd1143f05..fc1665efc 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -14,7 +14,7 @@ fn test_utf8() { .args(&["-lwmcL"]) .pipe_in_fixture("UTF_8_test.txt") .run() - .stdout_is(" 0 0 0 0 0\n"); + .stdout_is(" 300 4969 22781 22213 79\n"); // GNU returns " 300 2086 22219 22781 79" // TODO: we should fix that to match GNU's behavior } diff --git a/tests/common/util.rs b/tests/common/util.rs index d33b1943d..2cee36267 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -53,9 +53,10 @@ pub fn is_wsl() -> bool { false } -fn read_scenario_fixture>(tmpd: &Option>, file_rel_path: S) -> String { +/// Read a test scenario fixture, returning its bytes +fn read_scenario_fixture>(tmpd: &Option>, file_rel_path: S) -> Vec { let tmpdir_path = tmpd.as_ref().unwrap().as_ref().path(); - AtPath::new(tmpdir_path).read(file_rel_path.as_ref().to_str().unwrap()) + AtPath::new(tmpdir_path).read_bytes(file_rel_path.as_ref().to_str().unwrap()) } /// A command result is the outputs of a command (streams and status code) @@ -69,29 +70,95 @@ pub struct CmdResult { /// zero-exit from running the Command? /// see [`success`] pub success: bool, - /// captured utf-8 standard output after running the Command + /// captured standard output after running the Command pub stdout: String, - /// captured utf-8 standard error after running the Command + /// captured standard error after running the Command pub stderr: String, } impl CmdResult { + /// Returns a reference to the program's standard output as a slice of bytes + pub fn stdout(&self) -> &[u8] { + &self.stdout.as_bytes() + } + + /// Returns the program's standard output as a string slice + pub fn stdout_str(&self) -> &str { + &self.stdout + } + + /// Returns the program's standard output as a string + /// consumes self + pub fn stdout_move_str(self) -> String { + self.stdout + } + + /// Returns the program's standard output as a vec of bytes + /// consumes self + pub fn stdout_move_bytes(self) -> Vec { + Vec::from(self.stdout) + } + + /// Returns a reference to the program's standard error as a slice of bytes + pub fn stderr(&self) -> &[u8] { + &self.stderr.as_bytes() + } + + /// Returns the program's standard error as a string slice + pub fn stderr_str(&self) -> &str { + &self.stderr + } + + /// Returns the program's standard error as a string + /// consumes self + pub fn stderr_move_str(self) -> String { + self.stderr + } + + /// Returns the program's standard error as a vec of bytes + /// consumes self + pub fn stderr_move_bytes(self) -> Vec { + Vec::from(self.stderr) + } + + /// Returns the program's exit code + /// Panics if not run + pub fn code(&self) -> i32 { + self.code.expect("Program must be run first") + } + + /// Returns the program's TempDir + /// Panics if not present + pub fn tmpd(&self) -> Rc { + match &self.tmpd { + Some(ptr) => ptr.clone(), + None => { + panic!("Command not associated with a TempDir") + } + } + } + + /// Returns whether the program succeeded + pub fn succeeded(&self) -> bool { + self.success + } + /// asserts that the command resulted in a success (zero) status code - pub fn success(&self) -> Box<&CmdResult> { + pub fn success(&self) -> &CmdResult { assert!(self.success); - Box::new(self) + self } /// asserts that the command resulted in a failure (non-zero) status code - pub fn failure(&self) -> Box<&CmdResult> { + pub fn failure(&self) -> &CmdResult { assert!(!self.success); - Box::new(self) + self } /// asserts that the command's exit code is the same as the given one - pub fn status_code(&self, code: i32) -> Box<&CmdResult> { + pub fn status_code(&self, code: i32) -> &CmdResult { assert!(self.code == Some(code)); - Box::new(self) + self } /// asserts that the command resulted in empty (zero-length) stderr stream output @@ -99,9 +166,9 @@ impl CmdResult { /// but you might find yourself using this function if /// 1. you can not know exactly what stdout will be /// or 2. you know that stdout will also be empty - pub fn no_stderr(&self) -> Box<&CmdResult> { - assert_eq!(self.stderr, ""); - Box::new(self) + pub fn no_stderr(&self) -> &CmdResult { + assert!(self.stderr.is_empty()); + self } /// asserts that the command resulted in empty (zero-length) stderr stream output @@ -110,62 +177,102 @@ impl CmdResult { /// but you might find yourself using this function if /// 1. you can not know exactly what stderr will be /// or 2. you know that stderr will also be empty - pub fn no_stdout(&self) -> Box<&CmdResult> { - assert_eq!(self.stdout, ""); - Box::new(self) + pub fn no_stdout(&self) -> &CmdResult { + assert!(self.stdout.is_empty()); + self } /// asserts that the command resulted in stdout stream output that equals the /// passed in value, trailing whitespace are kept to force strict comparison (#1235) /// stdout_only is a better choice unless stderr may or will be non-empty - pub fn stdout_is>(&self, msg: T) -> Box<&CmdResult> { + pub fn stdout_is>(&self, msg: T) -> &CmdResult { assert_eq!(self.stdout, String::from(msg.as_ref())); - Box::new(self) + self + } + + /// asserts that the command resulted in stdout stream output, + /// whose bytes equal those of the passed in slice + pub fn stdout_is_bytes>(&self, msg: T) -> &CmdResult { + assert_eq!(self.stdout.as_bytes(), msg.as_ref()); + self } /// like stdout_is(...), but expects the contents of the file at the provided relative path - pub fn stdout_is_fixture>(&self, file_rel_path: T) -> Box<&CmdResult> { + pub fn stdout_is_fixture>(&self, file_rel_path: T) -> &CmdResult { let contents = read_scenario_fixture(&self.tmpd, file_rel_path); - self.stdout_is(contents) + self.stdout_is_bytes(contents) } /// asserts that the command resulted in stderr stream output that equals the /// passed in value, when both are trimmed of trailing whitespace /// stderr_only is a better choice unless stdout may or will be non-empty - pub fn stderr_is>(&self, msg: T) -> Box<&CmdResult> { + pub fn stderr_is>(&self, msg: T) -> &CmdResult { assert_eq!( self.stderr.trim_end(), String::from(msg.as_ref()).trim_end() ); - Box::new(self) + self + } + + /// asserts that the command resulted in stderr stream output, + /// whose bytes equal those of the passed in slice + pub fn stderr_is_bytes>(&self, msg: T) -> &CmdResult { + assert_eq!(self.stderr.as_bytes(), msg.as_ref()); + self } /// asserts that /// 1. the command resulted in stdout stream output that equals the /// passed in value, when both are trimmed of trailing whitespace /// and 2. the command resulted in empty (zero-length) stderr stream output - pub fn stdout_only>(&self, msg: T) -> Box<&CmdResult> { + pub fn stdout_only>(&self, msg: T) -> &CmdResult { self.no_stderr().stdout_is(msg) } + /// asserts that + /// 1. the command resulted in a stdout stream whose bytes + /// equal those of the passed in value + /// 2. the command resulted in an empty stderr stream + pub fn stdout_only_bytes>(&self, msg: T) -> &CmdResult { + self.no_stderr().stdout_is_bytes(msg) + } + /// like stdout_only(...), but expects the contents of the file at the provided relative path - pub fn stdout_only_fixture>(&self, file_rel_path: T) -> Box<&CmdResult> { + pub fn stdout_only_fixture>(&self, file_rel_path: T) -> &CmdResult { let contents = read_scenario_fixture(&self.tmpd, file_rel_path); - self.stdout_only(contents) + self.stdout_only_bytes(contents) } /// asserts that /// 1. the command resulted in stderr stream output that equals the /// passed in value, when both are trimmed of trailing whitespace /// and 2. the command resulted in empty (zero-length) stdout stream output - pub fn stderr_only>(&self, msg: T) -> Box<&CmdResult> { + pub fn stderr_only>(&self, msg: T) -> &CmdResult { self.no_stdout().stderr_is(msg) } - pub fn fails_silently(&self) -> Box<&CmdResult> { + /// asserts that + /// 1. the command resulted in a stderr stream whose bytes equal the ones + /// of the passed value + /// 2. the command resulted in an empty stdout stream + pub fn stderr_only_bytes>(&self, msg: T) -> &CmdResult { + self.no_stderr().stderr_is_bytes(msg) + } + + pub fn fails_silently(&self) -> &CmdResult { assert!(!self.success); - assert_eq!(self.stderr, ""); - Box::new(self) + assert!(self.stderr.is_empty()); + self + } + + pub fn stdout_contains>(&self, cmp: T) -> &CmdResult { + assert!(self.stdout_str().contains(cmp.as_ref())); + self + } + + pub fn stderr_contains>(&self, cmp: &T) -> &CmdResult { + assert!(self.stderr_str().contains(cmp.as_ref())); + self } } @@ -255,11 +362,25 @@ impl AtPath { contents } + pub fn read_bytes(&self, name: &str) -> Vec { + let mut f = self.open(name); + let mut contents = Vec::new(); + f.read_to_end(&mut contents) + .unwrap_or_else(|e| panic!("Couldn't read {}: {}", name, e)); + contents + } + pub fn write(&self, name: &str, contents: &str) { log_info("open(write)", self.plus_as_string(name)); let _ = std::fs::write(self.plus(name), contents); } + pub fn write_bytes(&self, name: &str, contents: &[u8]) { + log_info("open(write)", self.plus_as_string(name)); + std::fs::write(self.plus(name), contents) + .unwrap_or_else(|e| panic!("Couldn't write {}: {}", name, e)); + } + pub fn append(&self, name: &str, contents: &str) { log_info("open(append)", self.plus_as_string(name)); let mut f = OpenOptions::new() @@ -270,6 +391,17 @@ impl AtPath { let _ = f.write(contents.as_bytes()); } + pub fn append_bytes(&self, name: &str, contents: &[u8]) { + log_info("open(append)", self.plus_as_string(name)); + let mut f = OpenOptions::new() + .write(true) + .append(true) + .open(self.plus(name)) + .unwrap(); + f.write_all(contents) + .unwrap_or_else(|e| panic!("Couldn't append to {}: {}", name, e)); + } + pub fn mkdir(&self, dir: &str) { log_info("mkdir", self.plus_as_string(dir)); fs::create_dir(&self.plus(dir)).unwrap(); @@ -521,19 +653,19 @@ impl UCommand { /// Add a parameter to the invocation. Path arguments are treated relative /// to the test environment directory. - pub fn arg>(&mut self, arg: S) -> Box<&mut UCommand> { + pub fn arg>(&mut self, arg: S) -> &mut UCommand { if self.has_run { panic!(ALREADY_RUN); } self.comm_string.push_str(" "); self.comm_string.push_str(arg.as_ref().to_str().unwrap()); self.raw.arg(arg.as_ref()); - Box::new(self) + self } /// Add multiple parameters to the invocation. Path arguments are treated relative /// to the test environment directory. - pub fn args>(&mut self, args: &[S]) -> Box<&mut UCommand> { + pub fn args>(&mut self, args: &[S]) -> &mut UCommand { if self.has_run { panic!(MULTIPLE_STDIN_MEANINGLESS); } @@ -543,25 +675,25 @@ impl UCommand { } self.raw.args(args.as_ref()); - Box::new(self) + self } /// provides stdinput to feed in to the command when spawned - pub fn pipe_in>>(&mut self, input: T) -> Box<&mut UCommand> { + pub fn pipe_in>>(&mut self, input: T) -> &mut UCommand { if self.stdin.is_some() { panic!(MULTIPLE_STDIN_MEANINGLESS); } self.stdin = Some(input.into()); - Box::new(self) + self } /// like pipe_in(...), but uses the contents of the file at the provided relative path as the piped in data - pub fn pipe_in_fixture>(&mut self, file_rel_path: S) -> Box<&mut UCommand> { + pub fn pipe_in_fixture>(&mut self, file_rel_path: S) -> &mut UCommand { let contents = read_scenario_fixture(&self.tmpd, file_rel_path); self.pipe_in(contents) } - pub fn env(&mut self, key: K, val: V) -> Box<&mut UCommand> + pub fn env(&mut self, key: K, val: V) -> &mut UCommand where K: AsRef, V: AsRef, @@ -570,7 +702,7 @@ impl UCommand { panic!(ALREADY_RUN); } self.raw.env(key, val); - Box::new(self) + self } /// Spawns the command, feeds the stdin if any, and returns the From 96643d6f918529891c1b8d43e000ea24a1bcd3ed Mon Sep 17 00:00:00 2001 From: Mikadore Date: Wed, 31 Mar 2021 12:54:16 +0200 Subject: [PATCH 549/606] fix #1970 (#1980) --- tests/common/util.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/common/util.rs b/tests/common/util.rs index 2cee36267..e13bdd3e6 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -358,7 +358,8 @@ impl AtPath { pub fn read(&self, name: &str) -> String { let mut f = self.open(name); let mut contents = String::new(); - let _ = f.read_to_string(&mut contents); + f.read_to_string(&mut contents) + .unwrap_or_else(|e| panic!("Couldn't read {}: {}", name, e)); contents } @@ -372,7 +373,8 @@ impl AtPath { pub fn write(&self, name: &str, contents: &str) { log_info("open(write)", self.plus_as_string(name)); - let _ = std::fs::write(self.plus(name), contents); + std::fs::write(self.plus(name), contents) + .unwrap_or_else(|e| panic!("Couldn't write {}: {}", name, e)); } pub fn write_bytes(&self, name: &str, contents: &[u8]) { @@ -388,7 +390,8 @@ impl AtPath { .append(true) .open(self.plus(name)) .unwrap(); - let _ = f.write(contents.as_bytes()); + f.write(contents.as_bytes()) + .unwrap_or_else(|e| panic!("Couldn't write {}: {}", name, e)); } pub fn append_bytes(&self, name: &str, contents: &[u8]) { @@ -781,7 +784,7 @@ pub fn read_size(child: &mut Child, size: usize) -> String { .stdout .as_mut() .unwrap() - .read(output.as_mut_slice()) + .read_exact(output.as_mut_slice()) .unwrap(); String::from_utf8(output).unwrap() } From b8079098f2824036bd683645a99354c3a7ec5e5f Mon Sep 17 00:00:00 2001 From: Mikadore Date: Wed, 31 Mar 2021 13:30:06 +0200 Subject: [PATCH 550/606] fixed panic! formatting --- tests/by-util/test_chmod.rs | 10 +++++----- tests/by-util/test_cp.rs | 4 ++-- tests/by-util/test_shuf.rs | 15 +++++++-------- tests/common/macros.rs | 6 +++--- tests/common/util.rs | 10 +++++----- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index 78fee462d..b85567166 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -37,10 +37,10 @@ fn run_single_test(test: &TestCase, at: AtPath, mut ucmd: UCommand) { mkfile(&at.plus_as_string(TEST_FILE), test.before); let perms = at.metadata(TEST_FILE).permissions().mode(); if perms != test.before { - panic!(format!( + panic!( "{}: expected: {:o} got: {:o}", "setting permissions on test files before actual test run failed", test.after, perms - )); + ); } for arg in &test.args { @@ -49,15 +49,15 @@ fn run_single_test(test: &TestCase, at: AtPath, mut ucmd: UCommand) { let r = ucmd.run(); if !r.success { println!("{}", r.stderr); - panic!(format!("{:?}: failed", ucmd.raw)); + panic!("{:?}: failed", ucmd.raw); } let perms = at.metadata(TEST_FILE).permissions().mode(); if perms != test.after { - panic!(format!( + panic!( "{:?}: expected: {:o} got: {:o}", ucmd.raw, test.after, perms - )); + ); } } diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index a00ed2fd2..1fa8212ca 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1038,7 +1038,7 @@ fn test_cp_one_file_system() { .arg("tmpfs") .arg(mountpoint_path) .run(); - assert!(_r.code == Some(0), _r.stderr); + assert!(_r.code == Some(0), "{}", _r.stderr); at_src.touch(TEST_MOUNT_OTHER_FILESYSTEM_FILE); @@ -1052,7 +1052,7 @@ fn test_cp_one_file_system() { // Ditch the mount before the asserts let _r = scene.cmd("umount").arg(mountpoint_path).run(); - assert!(_r.code == Some(0), _r.stderr); + assert!(_r.code == Some(0), "{}", _r.stderr); assert!(result.success); assert!(!at_dst.file_exists(TEST_MOUNT_OTHER_FILESYSTEM_FILE)); diff --git a/tests/by-util/test_shuf.rs b/tests/by-util/test_shuf.rs index 065cef804..717971bd4 100644 --- a/tests/by-util/test_shuf.rs +++ b/tests/by-util/test_shuf.rs @@ -98,7 +98,8 @@ fn test_head_count() { assert_eq!(result_seq.len(), repeat_limit, "Output is not limited"); assert!( result_seq.iter().all(|x| input_seq.contains(x)), - format!("Output includes element not from input: {}", result) + "Output includes element not from input: {}", + result ) } @@ -133,13 +134,11 @@ fn test_repeat() { ); assert!( result_seq.iter().all(|x| input_seq.contains(x)), - format!( - "Output includes element not from input: {:?}", - result_seq - .iter() - .filter(|x| !input_seq.contains(x)) - .collect::>() - ) + "Output includes element not from input: {:?}", + result_seq + .iter() + .filter(|x| !input_seq.contains(x)) + .collect::>() ) } diff --git a/tests/common/macros.rs b/tests/common/macros.rs index 32ff7cbe8..e8b9c9d5d 100644 --- a/tests/common/macros.rs +++ b/tests/common/macros.rs @@ -5,7 +5,7 @@ macro_rules! assert_empty_stderr( ($cond:expr) => ( if $cond.stderr.len() > 0 { - panic!(format!("stderr: {}", $cond.stderr)) + panic!("stderr: {}", $cond.stderr_str()) } ); ); @@ -17,7 +17,7 @@ macro_rules! assert_empty_stderr( macro_rules! assert_empty_stdout( ($cond:expr) => ( if $cond.stdout.len() > 0 { - panic!(format!("stdout: {}", $cond.stdout)) + panic!("stdout: {}", $cond.stdout_str()) } ); ); @@ -30,7 +30,7 @@ macro_rules! assert_no_error( ($cond:expr) => ( assert!($cond.success); if $cond.stderr.len() > 0 { - panic!(format!("stderr: {}", $cond.stderr)) + panic!("stderr: {}", $cond.stderr_str()) } ); ); diff --git a/tests/common/util.rs b/tests/common/util.rs index e13bdd3e6..e4b452289 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -658,7 +658,7 @@ impl UCommand { /// to the test environment directory. pub fn arg>(&mut self, arg: S) -> &mut UCommand { if self.has_run { - panic!(ALREADY_RUN); + panic!("{}", ALREADY_RUN); } self.comm_string.push_str(" "); self.comm_string.push_str(arg.as_ref().to_str().unwrap()); @@ -670,7 +670,7 @@ impl UCommand { /// to the test environment directory. pub fn args>(&mut self, args: &[S]) -> &mut UCommand { if self.has_run { - panic!(MULTIPLE_STDIN_MEANINGLESS); + panic!("{}", MULTIPLE_STDIN_MEANINGLESS); } for s in args { self.comm_string.push_str(" "); @@ -684,7 +684,7 @@ impl UCommand { /// provides stdinput to feed in to the command when spawned pub fn pipe_in>>(&mut self, input: T) -> &mut UCommand { if self.stdin.is_some() { - panic!(MULTIPLE_STDIN_MEANINGLESS); + panic!("{}", MULTIPLE_STDIN_MEANINGLESS); } self.stdin = Some(input.into()); self @@ -702,7 +702,7 @@ impl UCommand { V: AsRef, { if self.has_run { - panic!(ALREADY_RUN); + panic!("{}", ALREADY_RUN); } self.raw.env(key, val); self @@ -712,7 +712,7 @@ impl UCommand { /// child process immediately. pub fn run_no_wait(&mut self) -> Child { if self.has_run { - panic!(ALREADY_RUN); + panic!("{}", ALREADY_RUN); } self.has_run = true; log_info("run", &self.comm_string); From 751ae6a8f857c6fd00eed5b571f6e3e36bbb360d Mon Sep 17 00:00:00 2001 From: Aleksandar Janicijevic Date: Wed, 31 Mar 2021 15:19:04 -0400 Subject: [PATCH 551/606] shred: use clap for argument management (#1961) --- Cargo.lock | 2 +- src/uu/shred/Cargo.toml | 2 +- src/uu/shred/src/shred.rs | 275 +++++++++++++++++++++----------------- 3 files changed, 158 insertions(+), 121 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ab8e59352..1caa4750d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2217,8 +2217,8 @@ dependencies = [ name = "uu_shred" version = "0.0.4" dependencies = [ + "clap", "filetime", - "getopts", "libc", "rand 0.5.6", "time", diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index 72e6119a8..6ff6e23ec 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -15,8 +15,8 @@ edition = "2018" path = "src/shred.rs" [dependencies] +clap = "2.33" filetime = "0.2.1" -getopts = "0.2.18" libc = "0.2.42" rand = "0.5" time = "0.1.40" diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 4946ed35d..b54d3db45 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -8,6 +8,7 @@ // spell-checker:ignore (ToDO) NAMESET FILESIZE fstab coeff journaling writeback REiser journaled +use clap::{App, Arg}; use rand::{Rng, ThreadRng}; use std::cell::{Cell, RefCell}; use std::fs; @@ -212,138 +213,174 @@ impl<'a> BytesGenerator<'a> { } } +static ABOUT: &str = "Overwrite the specified FILE(s) repeatedly, in order to make it harder\n\ +for even very expensive hardware probing to recover the data. +"; + +fn get_usage() -> String { + format!("{} [OPTION]... FILE...", executable!()) +} + +static AFTER_HELP: &str = + "Delete FILE(s) if --remove (-u) is specified. The default is not to remove\n\ +the files because it is common to operate on device files like /dev/hda,\n\ +and those files usually should not be removed.\n\ +\n\ +CAUTION: Note that shred relies on a very important assumption:\n\ +that the file system overwrites data in place. This is the traditional\n\ +way to do things, but many modern file system designs do not satisfy this\n\ +assumption. The following are examples of file systems on which shred is\n\ +not effective, or is not guaranteed to be effective in all file system modes:\n\ +\n\ +* log-structured or journaled file systems, such as those supplied with\n\ +AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)\n\ +\n\ +* file systems that write redundant data and carry on even if some writes\n\ +fail, such as RAID-based file systems\n\ +\n\ +* file systems that make snapshots, such as Network Appliance's NFS server\n\ +\n\ +* file systems that cache in temporary locations, such as NFS\n\ +version 3 clients\n\ +\n\ +* compressed file systems\n\ +\n\ +In the case of ext3 file systems, the above disclaimer applies\n\ +and shred is thus of limited effectiveness) only in data=journal mode,\n\ +which journals file data in addition to just metadata. In both the\n\ +data=ordered (default) and data=writeback modes, shred works as usual.\n\ +Ext3 journaling modes can be changed by adding the data=something option\n\ +to the mount options for a particular file system in the /etc/fstab file,\n\ +as documented in the mount man page (man mount).\n\ +\n\ +In addition, file system backups and remote mirrors may contain copies\n\ +of the file that cannot be removed, and that will allow a shredded file\n\ +to be recovered later.\n\ +"; + +pub mod options { + pub const FILE: &str = "file"; + pub const ITERATIONS: &str = "iterations"; + pub const SIZE: &str = "size"; + pub const REMOVE: &str = "remove"; + pub const VERBOSE: &str = "verbose"; + pub const EXACT: &str = "exact"; + pub const ZERO: &str = "zero"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = getopts::Options::new(); + let usage = get_usage(); - // TODO: Add force option - opts.optopt( - "n", - "iterations", - "overwrite N times instead of the default (3)", - "N", - ); - opts.optopt( - "s", - "size", - "shred this many bytes (suffixes like K, M, G accepted)", - "FILESIZE", - ); - opts.optflag( - "u", - "remove", - "truncate and remove the file after overwriting; See below", - ); - opts.optflag("v", "verbose", "show progress"); - opts.optflag( - "x", - "exact", - "do not round file sizes up to the next full block; \ - this is the default for non-regular files", - ); - opts.optflag( - "z", - "zero", - "add a final overwrite with zeros to hide shredding", - ); - opts.optflag("", "help", "display this help and exit"); - opts.optflag("", "version", "output version information and exit"); + let app = App::new(executable!()) + .version(VERSION_STR) + .about(ABOUT) + .after_help(AFTER_HELP) + .usage(&usage[..]) + .arg( + Arg::with_name(options::ITERATIONS) + .long(options::ITERATIONS) + .short("n") + .help("overwrite N times instead of the default (3)") + .value_name("NUMBER") + .default_value("3"), + ) + .arg( + Arg::with_name(options::SIZE) + .long(options::SIZE) + .short("s") + .takes_value(true) + .value_name("N") + .help("shred this many bytes (suffixes like K, M, G accepted)"), + ) + .arg( + Arg::with_name(options::REMOVE) + .short("u") + .long(options::REMOVE) + .help("truncate and remove file after overwriting; See below"), + ) + .arg( + Arg::with_name(options::VERBOSE) + .long(options::VERBOSE) + .short("v") + .help("show progress"), + ) + .arg( + Arg::with_name(options::EXACT) + .long(options::EXACT) + .short("x") + .help( + "do not round file sizes up to the next full block;\n\ +this is the default for non-regular files", + ), + ) + .arg( + Arg::with_name(options::ZERO) + .long(options::ZERO) + .short("z") + .help("add a final overwrite with zeros to hide shredding"), + ) + // Positional arguments + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)); - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(e) => panic!("Invalid options\n{}", e), + let matches = app.get_matches_from(args); + + let mut errs: Vec = vec![]; + + if !matches.is_present(options::FILE) { + eprintln!("{}: Missing an argument", NAME); + eprintln!("For help, try '{} --help'", NAME); + return 0; + } + + let iterations = match matches.value_of(options::ITERATIONS) { + Some(s) => match s.parse::() { + Ok(u) => u, + Err(_) => { + errs.push(String::from(format!("invalid number of passes: '{}'", s))); + 0 + } + }, + None => unreachable!(), }; - if matches.opt_present("help") { - show_help(&opts); - return 0; - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION_STR); - return 0; - } else if matches.free.is_empty() { - println!("{}: Missing an argument", NAME); - println!("For help, try '{} --help'", NAME); - return 0; - } else { - let iterations = match matches.opt_str("iterations") { - Some(s) => match s.parse::() { - Ok(u) => u, - Err(_) => { - println!("{}: Invalid number of passes", NAME); - return 1; - } - }, - None => 3, - }; - let remove = matches.opt_present("remove"); - let size = get_size(matches.opt_str("size")); - let exact = matches.opt_present("exact") && size.is_none(); // if -s is given, ignore -x - let zero = matches.opt_present("zero"); - let verbose = matches.opt_present("verbose"); - for path_str in matches.free.into_iter() { - wipe_file(&path_str, iterations, remove, size, exact, zero, verbose); + // TODO: implement --remove HOW + // The optional HOW parameter indicates how to remove a directory entry: + // - 'unlink' => use a standard unlink call. + // - 'wipe' => also first obfuscate bytes in the name. + // - 'wipesync' => also sync each obfuscated byte to disk. + // The default mode is 'wipesync', but note it can be expensive. + + // TODO: implement --random-source + + // TODO: implement --force + + let remove = matches.is_present(options::REMOVE); + let size_arg = match matches.value_of(options::SIZE) { + Some(s) => Some(s.to_string()), + None => None, + }; + let size = get_size(size_arg); + let exact = matches.is_present(options::EXACT) && size.is_none(); // if -s is given, ignore -x + let zero = matches.is_present(options::ZERO); + let verbose = matches.is_present(options::VERBOSE); + + if !errs.is_empty() { + eprintln!("Invalid arguments supplied."); + for message in errs { + eprintln!("{}", message); } + return 1; + } + + for path_str in matches.values_of(options::FILE).unwrap() { + wipe_file(&path_str, iterations, remove, size, exact, zero, verbose); } 0 } -fn show_help(opts: &getopts::Options) { - println!("Usage: {} [OPTION]... FILE...", NAME); - println!( - "Overwrite the specified FILE(s) repeatedly, in order to make it harder \ - for even very expensive hardware probing to recover the data." - ); - println!("{}", opts.usage("")); - println!("Delete FILE(s) if --remove (-u) is specified. The default is not to remove"); - println!("the files because it is common to operate on device files like /dev/hda,"); - println!("and those files usually should not be removed."); - println!(); - println!( - "CAUTION: Note that {} relies on a very important assumption:", - NAME - ); - println!("that the file system overwrites data in place. This is the traditional"); - println!("way to do things, but many modern file system designs do not satisfy this"); - println!( - "assumption. The following are examples of file systems on which {} is", - NAME - ); - println!("not effective, or is not guaranteed to be effective in all file system modes:"); - println!(); - println!("* log-structured or journaled file systems, such as those supplied with"); - println!("AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)"); - println!(); - println!("* file systems that write redundant data and carry on even if some writes"); - println!("fail, such as RAID-based file systems"); - println!(); - println!("* file systems that make snapshots, such as Network Appliance's NFS server"); - println!(); - println!("* file systems that cache in temporary locations, such as NFS"); - println!("version 3 clients"); - println!(); - println!("* compressed file systems"); - println!(); - println!("In the case of ext3 file systems, the above disclaimer applies"); - println!( - "(and {} is thus of limited effectiveness) only in data=journal mode,", - NAME - ); - println!("which journals file data in addition to just metadata. In both the"); - println!( - "data=ordered (default) and data=writeback modes, {} works as usual.", - NAME - ); - println!("Ext3 journaling modes can be changed by adding the data=something option"); - println!("to the mount options for a particular file system in the /etc/fstab file,"); - println!("as documented in the mount man page (man mount)."); - println!(); - println!("In addition, file system backups and remote mirrors may contain copies"); - println!("of the file that cannot be removed, and that will allow a shredded file"); - println!("to be recovered later."); -} - // TODO: Add support for all postfixes here up to and including EiB // http://www.gnu.org/software/coreutils/manual/coreutils.html#Block-size fn get_size(size_str_opt: Option) -> Option { From e958864bd9aaf2f90f8d78f09f8281b47519150a Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Wed, 31 Mar 2021 22:21:10 +0300 Subject: [PATCH 552/606] tac: exit with proper code, move from getopts to clap, add test for invalid inputs (#1957) --- Cargo.lock | 6 +- src/uu/tac/Cargo.toml | 2 +- src/uu/tac/src/tac.rs | 136 ++++++++++++++++++++------------------ tests/by-util/test_tac.rs | 18 +++++ 4 files changed, 95 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1caa4750d..08a7bad43 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2323,9 +2323,9 @@ dependencies = [ name = "uu_tac" version = "0.0.4" dependencies = [ - "getopts", - "uucore", - "uucore_procs", + "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "uucore 0.0.7", + "uucore_procs 0.0.5", ] [[package]] diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index 15e743006..2e54c129e 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/tac.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/tac/src/tac.rs b/src/uu/tac/src/tac.rs index 843babac9..68dae94e2 100644 --- a/src/uu/tac/src/tac.rs +++ b/src/uu/tac/src/tac.rs @@ -10,79 +10,77 @@ #[macro_use] extern crate uucore; -use std::fs::File; +use clap::{App, Arg}; use std::io::{stdin, stdout, BufReader, Read, Stdout, Write}; +use std::{fs::File, path::Path}; static NAME: &str = "tac"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static USAGE: &str = "[OPTION]... [FILE]..."; +static SUMMARY: &str = "Write each file to standard output, last line first."; + +mod options { + pub static BEFORE: &str = "before"; + pub static REGEX: &str = "regex"; + pub static SEPARATOR: &str = "separator"; + pub static FILE: &str = "file"; +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(USAGE) + .about(SUMMARY) + .arg( + Arg::with_name(options::BEFORE) + .short("b") + .long(options::BEFORE) + .help("attach the separator before instead of after") + .takes_value(false), + ) + .arg( + Arg::with_name(options::REGEX) + .short("r") + .long(options::REGEX) + .help("interpret the sequence as a regular expression (NOT IMPLEMENTED)") + .takes_value(false), + ) + .arg( + Arg::with_name(options::SEPARATOR) + .short("s") + .long(options::SEPARATOR) + .help("use STRING as the separator instead of newline") + .takes_value(true), + ) + .arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) + .get_matches_from(args); - opts.optflag( - "b", - "before", - "attach the separator before instead of after", - ); - opts.optflag( - "r", - "regex", - "interpret the sequence as a regular expression (NOT IMPLEMENTED)", - ); - opts.optopt( - "s", - "separator", - "use STRING as the separator instead of newline", - "STRING", - ); - opts.optflag("h", "help", "display this help and exit"); - opts.optflag("V", "version", "output version information and exit"); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => crash!(1, "{}", f), - }; - if matches.opt_present("help") { - let msg = format!( - "{0} {1} - -Usage: - {0} [OPTION]... [FILE]... - -Write each file to standard output, last line first.", - NAME, VERSION - ); - - print!("{}", opts.usage(&msg)); - } else if matches.opt_present("version") { - println!("{} {}", NAME, VERSION); - } else { - let before = matches.opt_present("b"); - let regex = matches.opt_present("r"); - let separator = match matches.opt_str("s") { - Some(m) => { - if m.is_empty() { - crash!(1, "separator cannot be empty") - } else { - m - } + let before = matches.is_present(options::BEFORE); + let regex = matches.is_present(options::REGEX); + let separator = match matches.value_of(options::SEPARATOR) { + Some(m) => { + if m.is_empty() { + crash!(1, "separator cannot be empty") + } else { + m.to_owned() } - None => "\n".to_owned(), - }; - let files = if matches.free.is_empty() { - vec!["-".to_owned()] - } else { - matches.free - }; - tac(files, before, regex, &separator[..]); - } + } + None => "\n".to_owned(), + }; - 0 + let files: Vec = match matches.values_of(options::FILE) { + Some(v) => v.map(|v| v.to_owned()).collect(), + None => vec!["-".to_owned()], + }; + + tac(files, before, regex, &separator[..]) } -fn tac(filenames: Vec, before: bool, _: bool, separator: &str) { +fn tac(filenames: Vec, before: bool, _: bool, separator: &str) -> i32 { + let mut exit_code = 0; let mut out = stdout(); let sbytes = separator.as_bytes(); let slen = sbytes.len(); @@ -91,10 +89,19 @@ fn tac(filenames: Vec, before: bool, _: bool, separator: &str) { let mut file = BufReader::new(if filename == "-" { Box::new(stdin()) as Box } else { - match File::open(filename) { + let path = Path::new(filename); + if path.is_dir() || !path.metadata().is_ok() { + show_error!( + "failed to open '{}' for reading: No such file or directory", + filename + ); + continue; + } + match File::open(path) { Ok(f) => Box::new(f) as Box, Err(e) => { - show_warning!("failed to open '{}' for reading: {}", filename, e); + show_error!("failed to open '{}' for reading: {}", filename, e); + exit_code = 1; continue; } } @@ -102,7 +109,8 @@ fn tac(filenames: Vec, before: bool, _: bool, separator: &str) { let mut data = Vec::new(); if let Err(e) = file.read_to_end(&mut data) { - show_warning!("failed to read '{}': {}", filename, e); + show_error!("failed to read '{}': {}", filename, e); + exit_code = 1; continue; }; @@ -141,6 +149,8 @@ fn tac(filenames: Vec, before: bool, _: bool, separator: &str) { } show_line(&mut out, sbytes, &data[0..prev], before); } + + exit_code } fn show_line(out: &mut Stdout, sep: &[u8], dat: &[u8], before: bool) { diff --git a/tests/by-util/test_tac.rs b/tests/by-util/test_tac.rs index d46f9aec6..3733adbec 100644 --- a/tests/by-util/test_tac.rs +++ b/tests/by-util/test_tac.rs @@ -49,3 +49,21 @@ fn test_single_non_newline_separator_before() { .run() .stdout_is_fixture("delimited_primes_before.expected"); } + +#[test] +fn test_invalid_input() { + let (_, mut ucmd) = at_and_ucmd!(); + + ucmd.arg("b") + .run() + .stderr + .contains("tac: error: failed to open 'b' for reading"); + + let (at, mut ucmd) = at_and_ucmd!(); + + at.mkdir("a"); + ucmd.arg("a") + .run() + .stderr + .contains("tac: error: failed to read 'a'"); +} From 7669a4387af52d0a4f979618ef7ce7eb98af5113 Mon Sep 17 00:00:00 2001 From: Alessandro Stoltenberg Date: Wed, 31 Mar 2021 22:27:24 +0200 Subject: [PATCH 553/606] echo: Some minor changes to options (#1960) --- src/uu/echo/src/echo.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index c991f5d3f..1e0c04d1d 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -14,10 +14,10 @@ use std::io::{self, Write}; use std::iter::Peekable; use std::str::Chars; -static NAME: &str = "echo"; -static USAGE: &str = "[OPTIONS]... [STRING]..."; -static SUMMARY: &str = "display a line of text"; -static AFTER_HELP: &str = r#" +const NAME: &str = "echo"; +const SUMMARY: &str = "display a line of text"; +const USAGE: &str = "[OPTIONS]... [STRING]..."; +const AFTER_HELP: &str = r#" Echo the STRING(s) to standard output. If -e is in effect, the following sequences are recognized: @@ -36,11 +36,12 @@ static AFTER_HELP: &str = r#" \\xHH byte with hexadecimal value HH (1 to 2 digits) "#; + mod options { - pub static STRING: &str = "STRING"; - pub static NO_NEWLINE: &str = "no_newline"; - pub static ENABLE_BACKSLASH_ESCAPE: &str = "enable_backslash_escape"; - pub static DISABLE_BACKSLASH_ESCAPE: &str = "disable_backslash_escape"; + pub const STRING: &str = "STRING"; + pub const NO_NEWLINE: &str = "no_newline"; + pub const ENABLE_BACKSLASH_ESCAPE: &str = "enable_backslash_escape"; + pub const DISABLE_BACKSLASH_ESCAPE: &str = "disable_backslash_escape"; } fn parse_code( @@ -113,8 +114,6 @@ fn print_escaped(input: &str, mut output: impl Write) -> io::Result { } pub fn uumain(args: impl uucore::Args) -> i32 { - let args = args.collect_str(); - let matches = App::new(executable!()) .name(NAME) // TrailingVarArg specifies the final positional argument is a VarArg @@ -123,9 +122,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .setting(clap::AppSettings::TrailingVarArg) .setting(clap::AppSettings::AllowLeadingHyphen) .version(crate_version!()) - .usage(USAGE) .about(SUMMARY) .after_help(AFTER_HELP) + .usage(USAGE) .arg( Arg::with_name(options::NO_NEWLINE) .short("n") @@ -149,7 +148,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .arg( Arg::with_name(options::STRING) - .hidden(true) .multiple(true) .allow_hyphen_values(true), ) From bb3e93372f82b85f9fcc26e485892dab32b96ec5 Mon Sep 17 00:00:00 2001 From: Mikadore Date: Thu, 1 Apr 2021 02:16:15 +0200 Subject: [PATCH 554/606] od: refactor tests for #1982 --- tests/by-util/test_od.rs | 484 +++++++++++++++++---------------------- 1 file changed, 209 insertions(+), 275 deletions(-) diff --git a/tests/by-util/test_od.rs b/tests/by-util/test_od.rs index f3b766c26..b49e6f0ca 100644 --- a/tests/by-util/test_od.rs +++ b/tests/by-util/test_od.rs @@ -21,6 +21,7 @@ static ALPHA_OUT: &'static str = " // Test that od can read one file and dump with default format #[test] fn test_file() { + // TODO: Can this be replaced by AtPath? use std::env; let temp = env::temp_dir(); let tmpdir = Path::new(&temp); @@ -33,15 +34,12 @@ fn test_file() { } } - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg(file.as_os_str()) - .run(); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, unindent(ALPHA_OUT)); - + .succeeds() + .no_stderr() + .stdout_is(unindent(ALPHA_OUT)); let _ = remove_file(file); } @@ -64,16 +62,14 @@ fn test_2files() { } } - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg(file1.as_os_str()) .arg(file2.as_os_str()) - .run(); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, unindent(ALPHA_OUT)); - + .succeeds() + .no_stderr() + .stdout_is(unindent(ALPHA_OUT)); + // TODO: Handle errors? let _ = remove_file(file1); let _ = remove_file(file2); } @@ -85,22 +81,19 @@ fn test_no_file() { let tmpdir = Path::new(&temp); let file = tmpdir.join("}surely'none'would'thus'a'file'name"); - let result = new_ucmd!().arg(file.as_os_str()).run(); - - assert!(!result.success); + new_ucmd!().arg(file.as_os_str()).fails(); } // Test that od reads from stdin instead of a file #[test] fn test_from_stdin() { let input = "abcdefghijklmnopqrstuvwxyz\n"; - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, unindent(ALPHA_OUT)); + .run_piped_stdin(input.as_bytes()) + .success() + .no_stderr() + .stdout_is(unindent(ALPHA_OUT)); } // Test that od reads from stdin and also from files @@ -119,40 +112,35 @@ fn test_from_mixed() { } } - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg(file1.as_os_str()) .arg("-") .arg(file3.as_os_str()) - .run_piped_stdin(data2.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, unindent(ALPHA_OUT)); + .run_piped_stdin(data2.as_bytes()) + .success() + .no_stderr() + .stdout_is(unindent(ALPHA_OUT)); } #[test] fn test_multiple_formats() { let input = "abcdefghijklmnopqrstuvwxyz\n"; - let result = new_ucmd!() + new_ucmd!() .arg("-c") .arg("-b") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin(input.as_bytes()) + .success() + .no_stderr() + .stdout_is(unindent( " 0000000 a b c d e f g h i j k l m n o p 141 142 143 144 145 146 147 150 151 152 153 154 155 156 157 160 0000020 q r s t u v w x y z \\n 161 162 163 164 165 166 167 170 171 172 012 0000033 - " - ) - ); + ", + )); } #[test] @@ -166,14 +154,13 @@ fn test_dec() { 0000016 ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-s") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] @@ -185,14 +172,13 @@ fn test_hex16() { 0000011 ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-x") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] @@ -204,14 +190,13 @@ fn test_hex32() { 0000011 ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-X") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] @@ -232,15 +217,14 @@ fn test_f16() { 0000016 ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-tf2") .arg("-w8") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] @@ -261,14 +245,13 @@ fn test_f32() { 0000034 ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-f") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] @@ -291,36 +274,31 @@ fn test_f64() { 0000050 ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-F") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] fn test_multibyte() { - let result = new_ucmd!() + new_ucmd!() .arg("-c") .arg("-w12") - .run_piped_stdin("Universität Tübingen \u{1B000}".as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin("Universität Tübingen \u{1B000}".as_bytes()) + .success() + .no_stderr() + .stdout_is(unindent( " 0000000 U n i v e r s i t ä ** t 0000014 T ü ** b i n g e n \u{1B000} 0000030 ** ** ** 0000033 - " - ) - ); + ", + )); } #[test] @@ -334,11 +312,13 @@ fn test_width() { ", ); - let result = new_ucmd!().arg("-w4").arg("-v").run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + new_ucmd!() + .arg("-w4") + .arg("-v") + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] @@ -352,14 +332,13 @@ fn test_invalid_width() { ", ); - let result = new_ucmd!().arg("-w5").arg("-v").run_piped_stdin(&input[..]); - - assert_eq!( - result.stderr, - "od: warning: invalid width 5; using 2 instead\n" - ); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + new_ucmd!() + .arg("-w5") + .arg("-v") + .run_piped_stdin(&input[..]) + .success() + .stderr_is_bytes("od: warning: invalid width 5; using 2 instead\n".as_bytes()) + .stdout_is(expected_output); } #[test] @@ -373,14 +352,13 @@ fn test_zero_width() { ", ); - let result = new_ucmd!().arg("-w0").arg("-v").run_piped_stdin(&input[..]); - - assert_eq!( - result.stderr, - "od: warning: invalid width 0; using 2 instead\n" - ); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + new_ucmd!() + .arg("-w0") + .arg("-v") + .run_piped_stdin(&input[..]) + .success() + .stderr_is_bytes("od: warning: invalid width 0; using 2 instead\n".as_bytes()) + .stdout_is(expected_output); } #[test] @@ -392,11 +370,12 @@ fn test_width_without_value() { 0000050 "); - let result = new_ucmd!().arg("-w").run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + new_ucmd!() + .arg("-w") + .run_piped_stdin(&input[..]) + .success() + .no_stderr() + .stdout_is(expected_output); } #[test] @@ -421,15 +400,14 @@ fn test_suppress_duplicates() { ", ); - let result = new_ucmd!() + new_ucmd!() .arg("-w4") .arg("-O") .arg("-x") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] @@ -446,17 +424,16 @@ fn test_big_endian() { ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--endian=big") .arg("-F") .arg("-f") .arg("-X") .arg("-x") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] @@ -474,16 +451,15 @@ fn test_alignment_Xxa() { ); // in this case the width of the -a (8-bit) determines the alignment for the other fields - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-X") .arg("-x") .arg("-a") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] @@ -500,15 +476,14 @@ fn test_alignment_Fx() { ); // in this case the width of the -F (64-bit) determines the alignment for the other field - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("-F") .arg("-x") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] @@ -528,16 +503,15 @@ fn test_maxuint() { ", ); - let result = new_ucmd!() + new_ucmd!() .arg("--format=o8") .arg("-Oobtu8") .arg("-Dd") .arg("--format=u1") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] @@ -553,15 +527,14 @@ fn test_hex_offset() { ", ); - let result = new_ucmd!() + new_ucmd!() .arg("-Ax") .arg("-X") .arg("-X") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] @@ -577,15 +550,14 @@ fn test_dec_offset() { ", ); - let result = new_ucmd!() + new_ucmd!() .arg("-Ad") .arg("-X") .arg("-X") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] @@ -594,66 +566,57 @@ fn test_no_offset() { const LINE: &'static str = " 00000000 00000000 00000000 00000000\n"; let expected_output = [LINE, LINE, LINE, LINE].join(""); - let result = new_ucmd!() + new_ucmd!() .arg("-An") .arg("-X") .arg("-X") - .run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, expected_output); + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(expected_output); } #[test] fn test_invalid_offset() { - let result = new_ucmd!().arg("-Ab").run(); - - assert!(!result.success); + new_ucmd!().arg("-Ab").fails(); } #[test] fn test_skip_bytes() { let input = "abcdefghijklmnopq"; - let result = new_ucmd!() + new_ucmd!() .arg("-c") .arg("--skip-bytes=5") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent( " 0000005 f g h i j k l m n o p q 0000021 - " - ) - ); + ", + )); } #[test] fn test_skip_bytes_error() { let input = "12345"; - let result = new_ucmd!() + new_ucmd!() .arg("--skip-bytes=10") - .run_piped_stdin(input.as_bytes()); - - assert!(!result.success); + .run_piped_stdin(input.as_bytes()) + .failure(); } #[test] fn test_read_bytes() { let input = "abcdefghijklmnopqrstuvwxyz\n12345678"; - let result = new_ucmd!() + new_ucmd!() .arg("--endian=little") .arg("--read-bytes=27") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!(result.stdout, unindent(ALPHA_OUT)); + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent(ALPHA_OUT)); } #[test] @@ -662,13 +625,12 @@ fn test_ascii_dump() { 0x00, 0x01, 0x0a, 0x0d, 0x10, 0x1f, 0x20, 0x61, 0x62, 0x63, 0x7d, 0x7e, 0x7f, 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff, ]; - let result = new_ucmd!().arg("-tx1zacz").run_piped_stdin(&input[..]); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + new_ucmd!() + .arg("-tx1zacz") + .run_piped_stdin(&input[..]) + .no_stderr() + .success() + .stdout_is(unindent( r" 0000000 00 01 0a 0d 10 1f 20 61 62 63 7d 7e 7f 80 90 a0 >...... abc}~....< nul soh nl cr dle us sp a b c } ~ del nul dle sp @@ -677,9 +639,8 @@ fn test_ascii_dump() { 0 @ P ` p del ** 300 320 340 360 377 >......< 0000026 - " - ) - ); + ", + )); } #[test] @@ -687,159 +648,136 @@ fn test_filename_parsing() { // files "a" and "x" both exists, but are no filenames in the commandline below // "-f" must be treated as a filename, it contains the text: minus lowercase f // so "-f" should not be interpreted as a formatting option. - let result = new_ucmd!() + new_ucmd!() .arg("--format") .arg("a") .arg("-A") .arg("x") .arg("--") .arg("-f") - .run(); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .succeeds() + .no_stderr() + .stdout_is(unindent( " 000000 m i n u s sp l o w e r c a s e sp 000010 f nl 000012 - " - ) - ); + ", + )); } #[test] fn test_stdin_offset() { let input = "abcdefghijklmnopq"; - let result = new_ucmd!() + new_ucmd!() .arg("-c") .arg("+5") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent( " 0000005 f g h i j k l m n o p q 0000021 - " - ) - ); + ", + )); } #[test] fn test_file_offset() { - let result = new_ucmd!().arg("-c").arg("--").arg("-f").arg("10").run(); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + new_ucmd!() + .arg("-c") + .arg("--") + .arg("-f") + .arg("10") + .succeeds() + .no_stderr() + .stdout_is(unindent( r" 0000010 w e r c a s e f \n 0000022 - " - ) - ); + ", + )); } #[test] fn test_traditional() { // note gnu od does not align both lines let input = "abcdefghijklmnopq"; - let result = new_ucmd!() + new_ucmd!() .arg("--traditional") .arg("-a") .arg("-c") .arg("-") .arg("10") .arg("0") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent( r" 0000010 (0000000) i j k l m n o p q i j k l m n o p q 0000021 (0000011) - " - ) - ); + ", + )); } #[test] fn test_traditional_with_skip_bytes_override() { // --skip-bytes is ignored in this case let input = "abcdefghijklmnop"; - let result = new_ucmd!() + new_ucmd!() .arg("--traditional") .arg("--skip-bytes=10") .arg("-c") .arg("0") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent( r" 0000000 a b c d e f g h i j k l m n o p 0000020 - " - ) - ); + ", + )); } #[test] fn test_traditional_with_skip_bytes_non_override() { // no offset specified in the traditional way, so --skip-bytes is used let input = "abcdefghijklmnop"; - let result = new_ucmd!() + new_ucmd!() .arg("--traditional") .arg("--skip-bytes=10") .arg("-c") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent( r" 0000012 k l m n o p 0000020 - " - ) - ); + ", + )); } #[test] fn test_traditional_error() { // file "0" exists - don't fail on that, but --traditional only accepts a single input - let result = new_ucmd!() + new_ucmd!() .arg("--traditional") .arg("0") .arg("0") .arg("0") .arg("0") - .run(); - - assert!(!result.success); + .fails(); } #[test] fn test_traditional_only_label() { let input = "abcdefghijklmnopqrstuvwxyz"; - let result = new_ucmd!() + new_ucmd!() .arg("-An") .arg("--traditional") .arg("-a") @@ -847,20 +785,16 @@ fn test_traditional_only_label() { .arg("-") .arg("10") .arg("0x10") - .run_piped_stdin(input.as_bytes()); - - assert_empty_stderr!(result); - assert!(result.success); - assert_eq!( - result.stdout, - unindent( + .run_piped_stdin(input.as_bytes()) + .no_stderr() + .success() + .stdout_is(unindent( r" (0000020) i j k l m n o p q r s t u v w x i j k l m n o p q r s t u v w x (0000040) y z y z (0000042) - " - ) - ); + ", + )); } From cf4970f083d13887c49625acbece22eb761c0181 Mon Sep 17 00:00:00 2001 From: Aleksandar Janicijevic Date: Thu, 1 Apr 2021 02:53:48 -0400 Subject: [PATCH 555/606] shred: Replaced eprintln with show_error (#1992) --- Cargo.lock | 6 +++--- src/uu/shred/src/shred.rs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 08a7bad43..e273f776c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2323,9 +2323,9 @@ dependencies = [ name = "uu_tac" version = "0.0.4" dependencies = [ - "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uucore 0.0.7", - "uucore_procs 0.0.5", + "clap", + "uucore", + "uucore_procs", ] [[package]] diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index b54d3db45..f9d8b9c73 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -329,8 +329,8 @@ this is the default for non-regular files", let mut errs: Vec = vec![]; if !matches.is_present(options::FILE) { - eprintln!("{}: Missing an argument", NAME); - eprintln!("For help, try '{} --help'", NAME); + show_error!("Missing an argument"); + show_error!("For help, try '{} --help'", NAME); return 0; } @@ -367,9 +367,9 @@ this is the default for non-regular files", let verbose = matches.is_present(options::VERBOSE); if !errs.is_empty() { - eprintln!("Invalid arguments supplied."); + show_error!("Invalid arguments supplied."); for message in errs { - eprintln!("{}", message); + show_error!("{}", message); } return 1; } From 2941dfd698d19095da56f73f7052a9790d39bd82 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 1 Apr 2021 22:50:13 +0200 Subject: [PATCH 556/606] ls: quoting style (#1989) --- src/uu/ls/src/ls.rs | 110 ++++++- src/uu/ls/src/quoting_style.rs | 542 +++++++++++++++++++++++++++++++++ tests/by-util/test_ls.rs | 87 ++++++ 3 files changed, 737 insertions(+), 2 deletions(-) create mode 100644 src/uu/ls/src/quoting_style.rs diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 80a7bf328..9633acf43 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -13,10 +13,12 @@ extern crate lazy_static; #[macro_use] extern crate uucore; +mod quoting_style; mod version_cmp; use clap::{App, Arg}; use number_prefix::NumberPrefix; +use quoting_style::{escape_name, QuotingStyle}; #[cfg(unix)] use std::collections::HashMap; use std::fs; @@ -104,6 +106,12 @@ pub mod options { pub static HUMAN_READABLE: &str = "human-readable"; pub static SI: &str = "si"; } + pub mod quoting { + pub static ESCAPE: &str = "escape"; + pub static LITERAL: &str = "literal"; + pub static C: &str = "quote-name"; + } + pub static QUOTING_STYLE: &str = "quoting-style"; pub mod indicator_style { pub static NONE: &str = "none"; @@ -193,6 +201,7 @@ struct Config { color: bool, long: LongFormat, width: Option, + quoting_style: QuotingStyle, indicator_style: IndicatorStyle, } @@ -359,6 +368,51 @@ impl Config { }) .or_else(|| termsize::get().map(|s| s.cols)); + let quoting_style = if let Some(style) = options.value_of(options::QUOTING_STYLE) { + match style { + "literal" => QuotingStyle::Literal, + "shell" => QuotingStyle::Shell { + escape: false, + always_quote: false, + }, + "shell-always" => QuotingStyle::Shell { + escape: false, + always_quote: true, + }, + "shell-escape" => QuotingStyle::Shell { + escape: true, + always_quote: false, + }, + "shell-escape-always" => QuotingStyle::Shell { + escape: true, + always_quote: true, + }, + "c" => QuotingStyle::C { + quotes: quoting_style::Quotes::Double, + }, + "escape" => QuotingStyle::C { + quotes: quoting_style::Quotes::None, + }, + _ => unreachable!("Should have been caught by Clap"), + } + } else if options.is_present(options::quoting::LITERAL) { + QuotingStyle::Literal + } else if options.is_present(options::quoting::ESCAPE) { + QuotingStyle::C { + quotes: quoting_style::Quotes::None, + } + } else if options.is_present(options::quoting::C) { + QuotingStyle::C { + quotes: quoting_style::Quotes::Double, + } + } else { + // TODO: use environment variable if available + QuotingStyle::Shell { + escape: true, + always_quote: false, + } + }; + let indicator_style = if let Some(field) = options.value_of(options::INDICATOR_STYLE) { match field { "none" => IndicatorStyle::None, @@ -402,6 +456,7 @@ impl Config { inode: options.is_present(options::INODE), long, width, + quoting_style, indicator_style, } } @@ -515,6 +570,57 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .multiple(true) ) + // Quoting style + .arg( + Arg::with_name(options::QUOTING_STYLE) + .long(options::QUOTING_STYLE) + .takes_value(true) + .help("Set quoting style.") + .possible_values(&["literal", "shell", "shell-always", "shell-escape", "shell-escape-always", "c", "escape"]) + .overrides_with_all(&[ + options::QUOTING_STYLE, + options::quoting::LITERAL, + options::quoting::ESCAPE, + options::quoting::C, + ]) + ) + .arg( + Arg::with_name(options::quoting::LITERAL) + .short("N") + .long(options::quoting::LITERAL) + .help("Use literal quoting style. Equivalent to `--quoting-style=literal`") + .overrides_with_all(&[ + options::QUOTING_STYLE, + options::quoting::LITERAL, + options::quoting::ESCAPE, + options::quoting::C, + ]) + ) + .arg( + Arg::with_name(options::quoting::ESCAPE) + .short("b") + .long(options::quoting::ESCAPE) + .help("Use escape quoting style. Equivalent to `--quoting-style=escape`") + .overrides_with_all(&[ + options::QUOTING_STYLE, + options::quoting::LITERAL, + options::quoting::ESCAPE, + options::quoting::C, + ]) + ) + .arg( + Arg::with_name(options::quoting::C) + .short("Q") + .long(options::quoting::C) + .help("Use C quoting style. Equivalent to `--quoting-style=c`") + .overrides_with_all(&[ + options::QUOTING_STYLE, + options::quoting::LITERAL, + options::quoting::ESCAPE, + options::quoting::C, + ]) + ) + // Time arguments .arg( Arg::with_name(options::TIME) @@ -1206,7 +1312,7 @@ fn display_file_name( metadata: &Metadata, config: &Config, ) -> Cell { - let mut name = get_file_name(path, strip); + let mut name = escape_name(get_file_name(path, strip), &config.quoting_style); let file_type = metadata.file_type(); match config.indicator_style { @@ -1273,7 +1379,7 @@ fn display_file_name( metadata: &Metadata, config: &Config, ) -> Cell { - let mut name = get_file_name(path, strip); + let mut name = escape_name(get_file_name(path, strip), &config.quoting_style); if config.format != Format::Long && config.inode { name = get_inode(metadata) + " " + &name; } diff --git a/src/uu/ls/src/quoting_style.rs b/src/uu/ls/src/quoting_style.rs new file mode 100644 index 000000000..74108094a --- /dev/null +++ b/src/uu/ls/src/quoting_style.rs @@ -0,0 +1,542 @@ +use std::char::from_digit; + +const SPECIAL_SHELL_CHARS: &str = "~`#$&*()\\|[]{};'\"<>?! "; + +pub(crate) enum QuotingStyle { + Shell { escape: bool, always_quote: bool }, + C { quotes: Quotes }, + Literal, +} + +#[derive(Clone, Copy)] +pub(crate) enum Quotes { + None, + Single, + Double, + // TODO: Locale +} + +// This implementation is heavily inspired by the std::char::EscapeDefault implementation +// in the Rust standard library. This custom implementation is needed because the +// characters \a, \b, \e, \f & \v are not recognized by Rust. +#[derive(Clone, Debug)] +struct EscapedChar { + state: EscapeState, +} + +#[derive(Clone, Debug)] +enum EscapeState { + Done, + Char(char), + Backslash(char), + ForceQuote(char), + Octal(EscapeOctal), +} + +#[derive(Clone, Debug)] +struct EscapeOctal { + c: char, + state: EscapeOctalState, + idx: usize, +} + +#[derive(Clone, Debug)] +enum EscapeOctalState { + Done, + Backslash, + Value, +} + +impl Iterator for EscapeOctal { + type Item = char; + + fn next(&mut self) -> Option { + match self.state { + EscapeOctalState::Done => None, + EscapeOctalState::Backslash => { + self.state = EscapeOctalState::Value; + Some('\\') + } + EscapeOctalState::Value => { + let octal_digit = ((self.c as u32) >> (self.idx * 3)) & 0o7; + if self.idx == 0 { + self.state = EscapeOctalState::Done; + } else { + self.idx -= 1; + } + Some(from_digit(octal_digit, 8).unwrap()) + } + } + } +} + +impl EscapeOctal { + fn from(c: char) -> EscapeOctal { + EscapeOctal { + c, + idx: 2, + state: EscapeOctalState::Backslash, + } + } +} + +impl EscapedChar { + fn new_c(c: char, quotes: Quotes) -> Self { + use EscapeState::*; + let init_state = match c { + '\x07' => Backslash('a'), + '\x08' => Backslash('b'), + '\t' => Backslash('t'), + '\n' => Backslash('n'), + '\x0B' => Backslash('v'), + '\x0C' => Backslash('f'), + '\r' => Backslash('r'), + '\\' => Backslash('\\'), + '\'' => match quotes { + Quotes::Single => Backslash('\''), + _ => Char('\''), + }, + '"' => match quotes { + Quotes::Double => Backslash('"'), + _ => Char('"'), + }, + ' ' => match quotes { + Quotes::None => Backslash(' '), + _ => Char(' '), + }, + _ if c.is_ascii_control() => Octal(EscapeOctal::from(c)), + _ => Char(c), + }; + Self { state: init_state } + } + + // fn new_shell(c: char, quotes: Quotes) -> Self { + // use EscapeState::*; + // let init_state = match c { + // // If the string is single quoted, the single quote should be escaped + // '\'' => match quotes { + // Quotes::Single => Backslash('\''), + // _ => Char('\''), + // }, + // // All control characters should be rendered as ?: + // _ if c.is_ascii_control() => Char('?'), + // // Special shell characters must be escaped: + // _ if SPECIAL_SHELL_CHARS.contains(c) => ForceQuote(c), + // _ => Char(c), + // }; + // Self { state: init_state } + // } + + fn new_shell(c: char, escape: bool, quotes: Quotes) -> Self { + use EscapeState::*; + let init_state = match c { + _ if !escape && c.is_control() => Char('?'), + '\x07' => Backslash('a'), + '\x08' => Backslash('b'), + '\t' => Backslash('t'), + '\n' => Backslash('n'), + '\x0B' => Backslash('v'), + '\x0C' => Backslash('f'), + '\r' => Backslash('r'), + '\\' => Backslash('\\'), + '\x00'..='\x1F' | '\x7F' => Octal(EscapeOctal::from(c)), + '\'' => match quotes { + Quotes::Single => Backslash('\''), + _ => Char('\''), + }, + _ if SPECIAL_SHELL_CHARS.contains(c) => ForceQuote(c), + _ => Char(c), + }; + Self { state: init_state } + } +} + +impl Iterator for EscapedChar { + type Item = char; + + fn next(&mut self) -> Option { + match self.state { + EscapeState::Backslash(c) => { + self.state = EscapeState::Char(c); + Some('\\') + } + EscapeState::Char(c) | EscapeState::ForceQuote(c) => { + self.state = EscapeState::Done; + Some(c) + } + EscapeState::Done => None, + EscapeState::Octal(ref mut iter) => iter.next(), + } + } +} + +fn shell_without_escape(name: String, quotes: Quotes) -> (String, bool) { + let mut must_quote = false; + let mut escaped_str = String::with_capacity(name.len()); + + for c in name.chars() { + let escaped = EscapedChar::new_shell(c, false, quotes); + match escaped.state { + EscapeState::Backslash('\'') => escaped_str.push_str("'\\''"), + EscapeState::ForceQuote(x) => { + must_quote = true; + escaped_str.push(x); + } + _ => { + for char in escaped { + escaped_str.push(char); + } + } + } + } + (escaped_str, must_quote) +} + +fn shell_with_escape(name: String, quotes: Quotes) -> (String, bool) { + // We need to keep track of whether we are in a dollar expression + // because e.g. \b\n is escaped as $'\b\n' and not like $'b'$'n' + let mut in_dollar = false; + let mut must_quote = false; + let mut escaped_str = String::with_capacity(name.len()); + + for c in name.chars() { + let escaped = EscapedChar::new_shell(c, true, quotes); + match escaped.state { + EscapeState::Char(x) => { + if in_dollar { + escaped_str.push_str("''"); + in_dollar = false; + } + escaped_str.push(x); + } + EscapeState::ForceQuote(x) => { + if in_dollar { + escaped_str.push_str("''"); + in_dollar = false; + } + must_quote = true; + escaped_str.push(x); + } + // Single quotes are not put in dollar expressions, but are escaped + // if the string also contains double quotes. In that case, they must + // be handled separately. + EscapeState::Backslash('\'') => { + must_quote = true; + in_dollar = false; + escaped_str.push_str("'\\''"); + } + _ => { + if !in_dollar { + escaped_str.push_str("'$'"); + in_dollar = true; + } + must_quote = true; + for char in escaped { + escaped_str.push(char); + } + } + } + } + (escaped_str, must_quote) +} + +pub(super) fn escape_name(name: String, style: &QuotingStyle) -> String { + match style { + QuotingStyle::Literal => name, + QuotingStyle::C { quotes } => { + let escaped_str: String = name + .chars() + .flat_map(|c| EscapedChar::new_c(c, *quotes)) + .collect(); + + match quotes { + Quotes::Single => format!("'{}'", escaped_str), + Quotes::Double => format!("\"{}\"", escaped_str), + _ => escaped_str, + } + } + QuotingStyle::Shell { + escape, + always_quote, + } => { + let (quotes, must_quote) = if name.contains('"') { + (Quotes::Single, true) + } else if name.contains('\'') { + (Quotes::Double, true) + } else if *always_quote { + (Quotes::Single, true) + } else { + (Quotes::Single, false) + }; + + let (escaped_str, contains_quote_chars) = if *escape { + shell_with_escape(name, quotes) + } else { + shell_without_escape(name, quotes) + }; + + match (must_quote | contains_quote_chars, quotes) { + (true, Quotes::Single) => format!("'{}'", escaped_str), + (true, Quotes::Double) => format!("\"{}\"", escaped_str), + _ => escaped_str, + } + } + } +} + +#[cfg(test)] +mod tests { + use crate::quoting_style::{escape_name, Quotes, QuotingStyle}; + fn get_style(s: &str) -> QuotingStyle { + match s { + "literal" => QuotingStyle::Literal, + "escape" => QuotingStyle::C { + quotes: Quotes::None, + }, + "c" => QuotingStyle::C { + quotes: Quotes::Double, + }, + "shell" => QuotingStyle::Shell { + escape: false, + always_quote: false, + }, + "shell-always" => QuotingStyle::Shell { + escape: false, + always_quote: true, + }, + "shell-escape" => QuotingStyle::Shell { + escape: true, + always_quote: false, + }, + "shell-escape-always" => QuotingStyle::Shell { + escape: true, + always_quote: true, + }, + _ => panic!("Invalid name!"), + } + } + + fn check_names(name: &str, map: Vec<(&str, &str)>) { + assert_eq!( + map.iter() + .map(|(_, style)| escape_name(name.to_string(), &get_style(style))) + .collect::>(), + map.iter() + .map(|(correct, _)| correct.to_string()) + .collect::>() + ); + } + + #[test] + fn test_simple_names() { + check_names( + "one_two", + vec![ + ("one_two", "literal"), + ("one_two", "escape"), + ("\"one_two\"", "c"), + ("one_two", "shell"), + ("\'one_two\'", "shell-always"), + ("one_two", "shell-escape"), + ("\'one_two\'", "shell-escape-always"), + ], + ); + } + + #[test] + fn test_spaces() { + check_names( + "one two", + vec![ + ("one two", "literal"), + ("one\\ two", "escape"), + ("\"one two\"", "c"), + ("\'one two\'", "shell"), + ("\'one two\'", "shell-always"), + ("\'one two\'", "shell-escape"), + ("\'one two\'", "shell-escape-always"), + ], + ); + + check_names( + " one", + vec![ + (" one", "literal"), + ("\\ one", "escape"), + ("\" one\"", "c"), + ("' one'", "shell"), + ("' one'", "shell-always"), + ("' one'", "shell-escape"), + ("' one'", "shell-escape-always"), + ], + ); + } + + #[test] + fn test_quotes() { + // One double quote + check_names( + "one\"two", + vec![ + ("one\"two", "literal"), + ("one\"two", "escape"), + ("\"one\\\"two\"", "c"), + ("'one\"two'", "shell"), + ("'one\"two'", "shell-always"), + ("'one\"two'", "shell-escape"), + ("'one\"two'", "shell-escape-always"), + ], + ); + + // One single quote + check_names( + "one\'two", + vec![ + ("one'two", "literal"), + ("one'two", "escape"), + ("\"one'two\"", "c"), + ("\"one'two\"", "shell"), + ("\"one'two\"", "shell-always"), + ("\"one'two\"", "shell-escape"), + ("\"one'two\"", "shell-escape-always"), + ], + ); + + // One single quote and one double quote + check_names( + "one'two\"three", + vec![ + ("one'two\"three", "literal"), + ("one'two\"three", "escape"), + ("\"one'two\\\"three\"", "c"), + ("'one'\\''two\"three'", "shell"), + ("'one'\\''two\"three'", "shell-always"), + ("'one'\\''two\"three'", "shell-escape"), + ("'one'\\''two\"three'", "shell-escape-always"), + ], + ); + + // Consecutive quotes + check_names( + "one''two\"\"three", + vec![ + ("one''two\"\"three", "literal"), + ("one''two\"\"three", "escape"), + ("\"one''two\\\"\\\"three\"", "c"), + ("'one'\\'''\\''two\"\"three'", "shell"), + ("'one'\\'''\\''two\"\"three'", "shell-always"), + ("'one'\\'''\\''two\"\"three'", "shell-escape"), + ("'one'\\'''\\''two\"\"three'", "shell-escape-always"), + ], + ); + } + + #[test] + fn test_control_chars() { + // A simple newline + check_names( + "one\ntwo", + vec![ + ("one\ntwo", "literal"), + ("one\\ntwo", "escape"), + ("\"one\\ntwo\"", "c"), + ("one?two", "shell"), + ("'one?two'", "shell-always"), + ("'one'$'\\n''two'", "shell-escape"), + ("'one'$'\\n''two'", "shell-escape-always"), + ], + ); + + // The first 16 control characters. NUL is also included, even though it is of + // no importance for file names. + check_names( + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F", + vec![ + ( + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F", + "literal", + ), + ( + "\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017", + "escape", + ), + ( + "\"\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017\"", + "c", + ), + ("????????????????", "shell"), + ("'????????????????'", "shell-always"), + ( + "''$'\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017'", + "shell-escape", + ), + ( + "''$'\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017'", + "shell-escape-always", + ), + ], + ); + + // The last 16 control characters. + check_names( + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", + vec![ + ( + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", + "literal", + ), + ( + "\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037", + "escape", + ), + ( + "\"\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037\"", + "c", + ), + ("????????????????", "shell"), + ("'????????????????'", "shell-always"), + ( + "''$'\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037'", + "shell-escape", + ), + ( + "''$'\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037'", + "shell-escape-always", + ), + ], + ); + + // DEL + check_names( + "\x7F", + vec![ + ("\x7F", "literal"), + ("\\177", "escape"), + ("\"\\177\"", "c"), + ("?", "shell"), + ("'?'", "shell-always"), + ("''$'\\177'", "shell-escape"), + ("''$'\\177'", "shell-escape-always"), + ], + ); + } + + #[test] + fn test_question_mark() { + // A question mark must force quotes in shell and shell-always, unless + // it is in place of a control character (that case is already covered + // in other tests) + check_names( + "one?two", + vec![ + ("one?two", "literal"), + ("one?two", "escape"), + ("\"one?two\"", "c"), + ("'one?two'", "shell"), + ("'one?two'", "shell-always"), + ("'one?two'", "shell-escape"), + ("'one?two'", "shell-escape-always"), + ], + ); + } +} diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 638102cc7..d403e5577 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -765,6 +765,8 @@ fn test_ls_ls_color() { .arg("--color=always") .arg("a/nested_file") .succeeds(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); assert!(result.stdout.contains("a/nested_file\n")); // No output @@ -1122,3 +1124,88 @@ fn test_ls_version_sort() { expected.insert(0, "."); assert_eq!(result.stdout.split('\n').collect::>(), expected,) } + +#[test] +fn test_ls_quoting_style() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("one two"); + at.touch("one"); + + // It seems that windows doesn't allow \n in filenames. + #[cfg(unix)] + { + at.touch("one\ntwo"); + // Default is shell-escape + let result = scene.ucmd().arg("one\ntwo").succeeds(); + assert_eq!(result.stdout, "'one'$'\\n''two'\n"); + + for (arg, correct) in &[ + ("--quoting-style=literal", "one\ntwo"), + ("-N", "one\ntwo"), + ("--literal", "one\ntwo"), + ("--quoting-style=c", "\"one\\ntwo\""), + ("-Q", "\"one\\ntwo\""), + ("--quote-name", "\"one\\ntwo\""), + ("--quoting-style=escape", "one\\ntwo"), + ("-b", "one\\ntwo"), + ("--escape", "one\\ntwo"), + ("--quoting-style=shell-escape", "'one'$'\\n''two'"), + ("--quoting-style=shell-escape-always", "'one'$'\\n''two'"), + ("--quoting-style=shell", "one?two"), + ("--quoting-style=shell-always", "'one?two'"), + ] { + let result = scene.ucmd().arg(arg).arg("one\ntwo").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!(result.stdout, format!("{}\n", correct)); + } + } + + let result = scene.ucmd().arg("one two").succeeds(); + assert_eq!(result.stdout, "'one two'\n"); + + for (arg, correct) in &[ + ("--quoting-style=literal", "one two"), + ("-N", "one two"), + ("--literal", "one two"), + ("--quoting-style=c", "\"one two\""), + ("-Q", "\"one two\""), + ("--quote-name", "\"one two\""), + ("--quoting-style=escape", "one\\ two"), + ("-b", "one\\ two"), + ("--escape", "one\\ two"), + ("--quoting-style=shell-escape", "'one two'"), + ("--quoting-style=shell-escape-always", "'one two'"), + ("--quoting-style=shell", "'one two'"), + ("--quoting-style=shell-always", "'one two'"), + ] { + let result = scene.ucmd().arg(arg).arg("one two").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!(result.stdout, format!("{}\n", correct)); + } + + let result = scene.ucmd().arg("one").succeeds(); + assert_eq!(result.stdout, "one\n"); + + for (arg, correct) in &[ + ("--quoting-style=literal", "one"), + ("-N", "one"), + ("--quoting-style=c", "\"one\""), + ("-Q", "\"one\""), + ("--quote-name", "\"one\""), + ("--quoting-style=escape", "one"), + ("-b", "one"), + ("--quoting-style=shell-escape", "one"), + ("--quoting-style=shell-escape-always", "'one'"), + ("--quoting-style=shell", "one"), + ("--quoting-style=shell-always", "'one'"), + ] { + let result = scene.ucmd().arg(arg).arg("one").run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!(result.stdout, format!("{}\n", correct)); + } +} From 7a947cfe46b694f61a5a7d840d622ce292da457c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81rni=20Dagur?= Date: Thu, 1 Apr 2021 21:08:48 +0000 Subject: [PATCH 557/606] cat: Improve performance on Linux (#1978) * cat: Improve performance, especially on Linux * cat: Don't use io::copy for splice fallback On my MacBook Pro 2020, it is around 25% faster to not use io::copy. * cat: Only fall back to generic copy if first splice fails * cat: Don't double buffer stdout * cat: Don't use experimental or-pattern syntax * cat: Remove nix symbol use from non-Linux --- Cargo.lock | 5 +- src/uu/cat/Cargo.toml | 5 +- src/uu/cat/src/cat.rs | 420 +++++++++++++++++++++++++----------------- 3 files changed, 255 insertions(+), 175 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e273f776c..f7e1187b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "advapi32-sys" version = "0.2.0" @@ -1581,7 +1583,8 @@ name = "uu_cat" version = "0.0.4" dependencies = [ "clap", - "quick-error", + "nix 0.20.0", + "thiserror", "unix_socket", "uucore", "uucore_procs", diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index b6254cf6b..3878aee96 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -16,13 +16,16 @@ path = "src/cat.rs" [dependencies] clap = "2.33" -quick-error = "1.2.3" +thiserror = "1.0" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] unix_socket = "0.5.0" +[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies] +nix = "0.20" + [[bin]] name = "cat" path = "src/main.rs" diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index cf5a384a4..f39708fd8 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -3,14 +3,13 @@ // (c) Jordi Boggiano // (c) Evgeniy Klyuchikov // (c) Joshua S. Miller +// (c) Árni Dagur // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // spell-checker:ignore (ToDO) nonprint nonblank nonprinting -#[macro_use] -extern crate quick_error; #[cfg(unix)] extern crate unix_socket; #[macro_use] @@ -18,9 +17,9 @@ extern crate uucore; // last synced with: cat (GNU coreutils) 8.13 use clap::{App, Arg}; -use quick_error::ResultExt; use std::fs::{metadata, File}; -use std::io::{self, stderr, stdin, stdout, BufWriter, Read, Write}; +use std::io::{self, Read, Write}; +use thiserror::Error; use uucore::fs::is_stdin_interactive; /// Unix domain socket support @@ -31,12 +30,44 @@ use std::os::unix::fs::FileTypeExt; #[cfg(unix)] use unix_socket::UnixStream; +#[cfg(any(target_os = "linux", target_os = "android"))] +use nix::errno::Errno; +/// Linux splice support +#[cfg(any(target_os = "linux", target_os = "android"))] +use nix::fcntl::{splice, SpliceFFlags}; +#[cfg(any(target_os = "linux", target_os = "android"))] +use nix::unistd::pipe; +#[cfg(any(target_os = "linux", target_os = "android"))] +use std::os::unix::io::{AsRawFd, RawFd}; + static NAME: &str = "cat"; static VERSION: &str = env!("CARGO_PKG_VERSION"); static SYNTAX: &str = "[OPTION]... [FILE]..."; static SUMMARY: &str = "Concatenate FILE(s), or standard input, to standard output With no FILE, or when FILE is -, read standard input."; +#[derive(Error, Debug)] +enum CatError { + /// Wrapper around `io::Error` + #[error("{0}")] + Io(#[from] io::Error), + /// Wrapper around `nix::Error` + #[cfg(any(target_os = "linux", target_os = "android"))] + #[error("{0}")] + Nix(#[from] nix::Error), + /// Unknown file type; it's not a regular file, socket, etc. + #[error("{}: unknown filetype: {}", path, ft_debug)] + UnknownFiletype { + path: String, + /// A debug print of the file type + ft_debug: String, + }, + #[error("{0}: Expected a file, found directory")] + IsDirectory(String), +} + +type CatResult = Result; + #[derive(PartialEq)] enum NumberingMode { None, @@ -44,39 +75,6 @@ enum NumberingMode { All, } -quick_error! { - #[derive(Debug)] - enum CatError { - /// Wrapper for io::Error with path context - Input(err: io::Error, path: String) { - display("cat: {0}: {1}", path, err) - context(path: &'a str, err: io::Error) -> (err, path.to_owned()) - cause(err) - } - - /// Wrapper for io::Error with no context - Output(err: io::Error) { - display("cat: {0}", err) from() - cause(err) - } - - /// Unknown Filetype classification - UnknownFiletype(path: String) { - display("cat: {0}: unknown filetype", path) - } - - /// At least one error was encountered in reading or writing - EncounteredErrors(count: usize) { - display("cat: encountered {0} errors", count) - } - - /// Denotes an error caused by trying to `cat` a directory - IsDirectory(path: String) { - display("cat: {0}: Is a directory", path) - } - } -} - struct OutputOptions { /// Line numbering mode number: NumberingMode, @@ -87,21 +85,56 @@ struct OutputOptions { /// display TAB characters as `tab` show_tabs: bool, - /// If `show_tabs == true`, this string will be printed in the - /// place of tabs - tab: String, - - /// Can be set to show characters other than '\n' a the end of - /// each line, e.g. $ - end_of_line: String, + /// Show end of lines + show_ends: bool, /// use ^ and M- notation, except for LF (\\n) and TAB (\\t) show_nonprint: bool, } +impl OutputOptions { + fn tab(&self) -> &'static str { + if self.show_tabs { + "^I" + } else { + "\t" + } + } + + fn end_of_line(&self) -> &'static str { + if self.show_ends { + "$\n" + } else { + "\n" + } + } + + /// We can write fast if we can simply copy the contents of the file to + /// stdout, without augmenting the output with e.g. line numbers. + fn can_write_fast(&self) -> bool { + !(self.show_tabs + || self.show_nonprint + || self.show_ends + || self.squeeze_blank + || self.number != NumberingMode::None) + } +} + +/// State that persists between output of each file. This struct is only used +/// when we can't write fast. +struct OutputState { + /// The current line number + line_number: usize, + + /// Whether the output cursor is at the beginning of a new line + at_line_start: bool, +} + /// Represents an open file handle, stream, or other device -struct InputHandle { - reader: Box, +struct InputHandle { + #[cfg(any(target_os = "linux", target_os = "android"))] + file_descriptor: RawFd, + reader: R, is_interactive: bool, } @@ -124,8 +157,6 @@ enum InputType { Socket, } -type CatResult = Result; - mod options { pub static FILE: &str = "file"; pub static SHOW_ALL: &str = "show-all"; @@ -243,30 +274,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { None => vec!["-".to_owned()], }; - let can_write_fast = !(show_tabs - || show_nonprint - || show_ends - || squeeze_blank - || number_mode != NumberingMode::None); - - let success = if can_write_fast { - write_fast(files).is_ok() - } else { - let tab = if show_tabs { "^I" } else { "\t" }.to_owned(); - - let end_of_line = if show_ends { "$\n" } else { "\n" }.to_owned(); - - let options = OutputOptions { - end_of_line, - number: number_mode, - show_nonprint, - show_tabs, - squeeze_blank, - tab, - }; - - write_lines(files, &options).is_ok() + let options = OutputOptions { + show_ends, + number: number_mode, + show_nonprint, + show_tabs, + squeeze_blank, }; + let success = cat_files(files, &options).is_ok(); if success { 0 @@ -275,6 +290,76 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } +fn cat_handle( + handle: &mut InputHandle, + options: &OutputOptions, + state: &mut OutputState, +) -> CatResult<()> { + if options.can_write_fast() { + write_fast(handle) + } else { + write_lines(handle, &options, state) + } +} + +fn cat_path(path: &str, options: &OutputOptions, state: &mut OutputState) -> CatResult<()> { + if path == "-" { + let stdin = io::stdin(); + let mut handle = InputHandle { + #[cfg(any(target_os = "linux", target_os = "android"))] + file_descriptor: stdin.as_raw_fd(), + reader: stdin, + is_interactive: is_stdin_interactive(), + }; + return cat_handle(&mut handle, &options, state); + } + match get_input_type(path)? { + InputType::Directory => Err(CatError::IsDirectory(path.to_owned())), + #[cfg(unix)] + InputType::Socket => { + let socket = UnixStream::connect(path)?; + socket.shutdown(Shutdown::Write)?; + let mut handle = InputHandle { + #[cfg(any(target_os = "linux", target_os = "android"))] + file_descriptor: socket.as_raw_fd(), + reader: socket, + is_interactive: false, + }; + cat_handle(&mut handle, &options, state) + } + _ => { + let file = File::open(path)?; + let mut handle = InputHandle { + #[cfg(any(target_os = "linux", target_os = "android"))] + file_descriptor: file.as_raw_fd(), + reader: file, + is_interactive: false, + }; + cat_handle(&mut handle, &options, state) + } + } +} + +fn cat_files(files: Vec, options: &OutputOptions) -> Result<(), u32> { + let mut error_count = 0; + let mut state = OutputState { + line_number: 1, + at_line_start: true, + }; + + for path in &files { + if let Err(err) = cat_path(path, &options, &mut state) { + show_error!("{}", err); + error_count += 1; + } + } + if error_count == 0 { + Ok(()) + } else { + Err(error_count) + } +} + /// Classifies the `InputType` of file at `path` if possible /// /// # Arguments @@ -285,7 +370,8 @@ fn get_input_type(path: &str) -> CatResult { return Ok(InputType::StdIn); } - match metadata(path).context(path)?.file_type() { + let ft = metadata(path)?.file_type(); + match ft { #[cfg(unix)] ft if ft.is_block_device() => Ok(InputType::BlockDevice), #[cfg(unix)] @@ -297,125 +383,113 @@ fn get_input_type(path: &str) -> CatResult { ft if ft.is_dir() => Ok(InputType::Directory), ft if ft.is_file() => Ok(InputType::File), ft if ft.is_symlink() => Ok(InputType::SymLink), - _ => Err(CatError::UnknownFiletype(path.to_owned())), + _ => Err(CatError::UnknownFiletype { + path: path.to_owned(), + ft_debug: format!("{:?}", ft), + }), } } -/// Returns an InputHandle from which a Reader can be accessed or an -/// error -/// -/// # Arguments -/// -/// * `path` - `InputHandler` will wrap a reader from this file path -fn open(path: &str) -> CatResult { - if path == "-" { - let stdin = stdin(); - return Ok(InputHandle { - reader: Box::new(stdin) as Box, - is_interactive: is_stdin_interactive(), - }); - } - - match get_input_type(path)? { - InputType::Directory => Err(CatError::IsDirectory(path.to_owned())), - #[cfg(unix)] - InputType::Socket => { - let socket = UnixStream::connect(path).context(path)?; - socket.shutdown(Shutdown::Write).context(path)?; - Ok(InputHandle { - reader: Box::new(socket) as Box, - is_interactive: false, - }) - } - _ => { - let file = File::open(path).context(path)?; - Ok(InputHandle { - reader: Box::new(file) as Box, - is_interactive: false, - }) +/// Writes handle to stdout with no configuration. This allows a +/// simple memory copy. +fn write_fast(handle: &mut InputHandle) -> CatResult<()> { + let stdout = io::stdout(); + let mut stdout_lock = stdout.lock(); + #[cfg(any(target_os = "linux", target_os = "android"))] + { + // If we're on Linux or Android, try to use the splice() system call + // for faster writing. If it works, we're done. + if !write_fast_using_splice(handle, stdout.as_raw_fd())? { + return Ok(()); } } + // If we're not on Linux or Android, or the splice() call failed, + // fall back on slower writing. + let mut buf = [0; 1024 * 64]; + while let Ok(n) = handle.reader.read(&mut buf) { + if n == 0 { + break; + } + stdout_lock.write_all(&buf[..n])?; + } + Ok(()) } -/// Writes files to stdout with no configuration. This allows a -/// simple memory copy. Returns `Ok(())` if no errors were -/// encountered, or an error with the number of errors encountered. +/// This function is called from `write_fast()` on Linux and Android. The +/// function `splice()` is used to move data between two file descriptors +/// without copying between kernel- and userspace. This results in a large +/// speedup. /// -/// # Arguments -/// -/// * `files` - There is no short circuit when encountering an error -/// reading a file in this vector -fn write_fast(files: Vec) -> CatResult<()> { - let mut writer = stdout(); - let mut in_buf = [0; 1024 * 64]; - let mut error_count = 0; +/// The `bool` in the result value indicates if we need to fall back to normal +/// copying or not. False means we don't have to. +#[cfg(any(target_os = "linux", target_os = "android"))] +#[inline] +fn write_fast_using_splice(handle: &mut InputHandle, writer: RawFd) -> CatResult { + const BUF_SIZE: usize = 1024 * 16; - for file in files { - match open(&file[..]) { - Ok(mut handle) => { - while let Ok(n) = handle.reader.read(&mut in_buf) { - if n == 0 { - break; - } - writer.write_all(&in_buf[..n]).context(&file[..])?; + let (pipe_rd, pipe_wr) = pipe()?; + + // We only fall back if splice fails on the first call. + match splice( + handle.file_descriptor, + None, + pipe_wr, + None, + BUF_SIZE, + SpliceFFlags::empty(), + ) { + Ok(n) => { + if n == 0 { + return Ok(false); + } + } + Err(err) => { + match err.as_errno() { + Some(Errno::EPERM) | Some(Errno::ENOSYS) | Some(Errno::EINVAL) => { + // EPERM indicates the call was blocked by seccomp. + // ENOSYS indicates we're running on an ancient Kernel. + // EINVAL indicates some other failure. + return Ok(true); + } + _ => { + // Other errors include running out of memory, etc. We + // don't attempt to fall back from these. + return Err(err)?; } } - Err(error) => { - writeln!(&mut stderr(), "{}", error)?; - error_count += 1; - } } } - match error_count { - 0 => Ok(()), - _ => Err(CatError::EncounteredErrors(error_count)), - } -} - -/// State that persists between output of each file -struct OutputState { - /// The current line number - line_number: usize, - - /// Whether the output cursor is at the beginning of a new line - at_line_start: bool, -} - -/// Writes files to stdout with `options` as configuration. Returns -/// `Ok(())` if no errors were encountered, or an error with the -/// number of errors encountered. -/// -/// # Arguments -/// -/// * `files` - There is no short circuit when encountering an error -/// reading a file in this vector -fn write_lines(files: Vec, options: &OutputOptions) -> CatResult<()> { - let mut error_count = 0; - let mut state = OutputState { - line_number: 1, - at_line_start: true, - }; - - for file in files { - if let Err(error) = write_file_lines(&file, options, &mut state) { - writeln!(&mut stderr(), "{}", error).context(&file[..])?; - error_count += 1; + loop { + let n = splice( + handle.file_descriptor, + None, + pipe_wr, + None, + BUF_SIZE, + SpliceFFlags::empty(), + )?; + if n == 0 { + // We read 0 bytes from the input, + // which means we're done copying. + break; } + splice(pipe_rd, None, writer, None, BUF_SIZE, SpliceFFlags::empty())?; } - match error_count { - 0 => Ok(()), - _ => Err(CatError::EncounteredErrors(error_count)), - } + Ok(false) } /// Outputs file contents to stdout in a line-by-line fashion, /// propagating any errors that might occur. -fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState) -> CatResult<()> { - let mut handle = open(file)?; +fn write_lines( + handle: &mut InputHandle, + options: &OutputOptions, + state: &mut OutputState, +) -> CatResult<()> { let mut in_buf = [0; 1024 * 31]; - let mut writer = BufWriter::with_capacity(1024 * 64, stdout()); + let stdout = io::stdout(); + let mut writer = stdout.lock(); let mut one_blank_kept = false; while let Ok(n) = handle.reader.read(&mut in_buf) { @@ -433,9 +507,9 @@ fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState write!(&mut writer, "{0:6}\t", state.line_number)?; state.line_number += 1; } - writer.write_all(options.end_of_line.as_bytes())?; + writer.write_all(options.end_of_line().as_bytes())?; if handle.is_interactive { - writer.flush().context(file)?; + writer.flush()?; } } state.at_line_start = true; @@ -450,7 +524,7 @@ fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState // print to end of line or end of buffer let offset = if options.show_nonprint { - write_nonprint_to_end(&in_buf[pos..], &mut writer, options.tab.as_bytes()) + write_nonprint_to_end(&in_buf[pos..], &mut writer, options.tab().as_bytes()) } else if options.show_tabs { write_tab_to_end(&in_buf[pos..], &mut writer) } else { @@ -462,7 +536,7 @@ fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState break; } // print suitable end of line - writer.write_all(options.end_of_line.as_bytes())?; + writer.write_all(options.end_of_line().as_bytes())?; if handle.is_interactive { writer.flush()?; } From 090d29496a016c81d437ecb61fa8e401c51d7856 Mon Sep 17 00:00:00 2001 From: paulotten Date: Thu, 1 Apr 2021 17:16:47 -0400 Subject: [PATCH 558/606] Issue #1622 port `du` to windows (#1788) * Issue #1622 port `du` to windows * Attempt to support Rust 1.32 Old version was getting "attributes are not yet allowed on `if` expressions" on Rust 1.32 * Less #[cfg] * Less duplicate code. I need the return and the semicolon after if otherwise the second #[cfg] leads to unexpected token complilation error * More accurate size on disk calculations for windows * Expect the same output on windows as with WSL * Better matches output from du on WSL * In the absence of feedback I'm disabling these tests on Windows. They require `ln`. Windows does not ship with this utility. * Use the coreutils version of `ln` to test `du` `fn ccmd` is courtesy of @Artoria2e5 * Look up inodes (file ids) on Windows * One more #[cfg(windows)] to prevent unreachable statement warning on linux --- Cargo.lock | 1 + Cargo.toml | 2 +- src/uu/du/Cargo.toml | 1 + src/uu/du/src/du.rs | 121 ++++++++++++++++++++++++++++++++++++--- tests/by-util/test_du.rs | 28 +++++++-- tests/common/util.rs | 8 +++ 6 files changed, 146 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f7e1187b4..95635159c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1735,6 +1735,7 @@ dependencies = [ "time", "uucore", "uucore_procs", + "winapi 0.3.9", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 9136b5d64..1562fcfb0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,6 +43,7 @@ feat_common_core = [ "df", "dircolors", "dirname", + "du", "echo", "env", "expand", @@ -149,7 +150,6 @@ feat_require_unix = [ "chmod", "chown", "chroot", - "du", "groups", "hostid", "id", diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index 912eef17e..bb46c299c 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -18,6 +18,7 @@ path = "src/du.rs" time = "0.1.40" uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } +winapi = { version="0.3", features=[] } [[bin]] name = "du" diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 4ed80f18b..2eb7bd658 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -15,9 +15,24 @@ use std::env; use std::fs; use std::io::{stderr, Result, Write}; use std::iter; +#[cfg(not(windows))] use std::os::unix::fs::MetadataExt; +#[cfg(windows)] +use std::os::windows::fs::MetadataExt; +#[cfg(windows)] +use std::os::windows::io::AsRawHandle; use std::path::PathBuf; use time::Timespec; +#[cfg(windows)] +use winapi::shared::minwindef::{DWORD, LPVOID}; +#[cfg(windows)] +use winapi::um::fileapi::{FILE_STANDARD_INFO, FILE_ID_INFO}; +#[cfg(windows)] +use winapi::um::minwinbase::{FileStandardInfo, FileIdInfo}; +#[cfg(windows)] +use winapi::um::winbase::GetFileInformationByHandleEx; +#[cfg(windows)] +use winapi::um::winnt::FILE_ID_128; const NAME: &str = "du"; const SUMMARY: &str = "estimate file space usage"; @@ -48,7 +63,7 @@ struct Stat { is_dir: bool, size: u64, blocks: u64, - inode: u64, + inode: Option, created: u64, accessed: u64, modified: u64, @@ -57,19 +72,106 @@ struct Stat { impl Stat { fn new(path: PathBuf) -> Result { let metadata = fs::symlink_metadata(&path)?; - Ok(Stat { + + #[cfg(not(windows))] + return Ok(Stat { path, is_dir: metadata.is_dir(), size: metadata.len(), blocks: metadata.blocks() as u64, - inode: metadata.ino() as u64, + inode: Some(metadata.ino() as u128), created: metadata.mtime() as u64, accessed: metadata.atime() as u64, modified: metadata.mtime() as u64, + }); + + #[cfg(windows)] + let size_on_disk = get_size_on_disk(&path); + #[cfg(windows)] + let inode = get_inode(&path); + #[cfg(windows)] + Ok(Stat { + path, + is_dir: metadata.is_dir(), + size: metadata.len(), + blocks: size_on_disk / 1024 * 2, + inode: inode, + created: windows_time_to_unix_time(metadata.creation_time()), + accessed: windows_time_to_unix_time(metadata.last_access_time()), + modified: windows_time_to_unix_time(metadata.last_write_time()), }) } } +#[cfg(windows)] +// https://doc.rust-lang.org/std/os/windows/fs/trait.MetadataExt.html#tymethod.creation_time +// "The returned 64-bit value [...] which represents the number of 100-nanosecond intervals since January 1, 1601 (UTC)." +fn windows_time_to_unix_time(win_time: u64) -> u64 { + win_time / 10_000 - 11_644_473_600_000 +} + +#[cfg(windows)] +fn get_size_on_disk(path: &PathBuf) -> u64 { + let mut size_on_disk = 0; + + // bind file so it stays in scope until end of function + // if it goes out of scope the handle below becomes invalid + let file = match fs::File::open(path) { + Ok(file) => file, + Err(_) => return size_on_disk, // opening directories will fail + }; + + let handle = file.as_raw_handle(); + + unsafe { + let mut file_info: FILE_STANDARD_INFO = core::mem::zeroed(); + let file_info_ptr: *mut FILE_STANDARD_INFO = &mut file_info; + + let success = GetFileInformationByHandleEx( + handle, + FileStandardInfo, + file_info_ptr as LPVOID, + std::mem::size_of::() as DWORD, + ); + + if success != 0 { + size_on_disk = *file_info.AllocationSize.QuadPart() as u64; + } + } + + size_on_disk +} + +#[cfg(windows)] +fn get_inode(path: &PathBuf) -> Option { + let mut inode = None; + + let file = match fs::File::open(path) { + Ok(file) => file, + Err(_) => return inode, + }; + + let handle = file.as_raw_handle(); + + unsafe { + let mut file_info: FILE_ID_INFO = core::mem::zeroed(); + let file_info_ptr: *mut FILE_ID_INFO = &mut file_info; + + let success = GetFileInformationByHandleEx( + handle, + FileIdInfo, + file_info_ptr as LPVOID, + std::mem::size_of::() as DWORD, + ); + + if success != 0 { + inode = Some(std::mem::transmute::(file_info.FileId)); + } + } + + inode +} + fn unit_string_to_number(s: &str) -> Option { let mut offset = 0; let mut s_chars = s.chars().rev(); @@ -137,7 +239,7 @@ fn du( mut my_stat: Stat, options: &Options, depth: usize, - inodes: &mut HashSet, + inodes: &mut HashSet, ) -> Box> { let mut stats = vec![]; let mut futures = vec![]; @@ -164,10 +266,13 @@ fn du( if this_stat.is_dir { futures.push(du(this_stat, options, depth + 1, inodes)); } else { - if inodes.contains(&this_stat.inode) { - continue; + if this_stat.inode.is_some() { + let inode = this_stat.inode.unwrap(); + if inodes.contains(&inode) { + continue; + } + inodes.insert(inode); } - inodes.insert(this_stat.inode); my_stat.size += this_stat.size; my_stat.blocks += this_stat.blocks; if options.all { @@ -418,7 +523,7 @@ Try '{} --help' for more information.", let path = PathBuf::from(&path_str); match Stat::new(path) { Ok(stat) => { - let mut inodes: HashSet = HashSet::new(); + let mut inodes: HashSet = HashSet::new(); let iter = du(stat, &options, 0, &mut inodes); let (_, len) = iter.size_hint(); diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index a79f820fb..c810bd395 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -45,7 +45,11 @@ fn test_du_basics_subdir() { fn _du_basics_subdir(s: String) { assert_eq!(s, "4\tsubdir/deeper\n"); } -#[cfg(not(target_vendor = "apple"))] +#[cfg(target_os = "windows")] +fn _du_basics_subdir(s: String) { + assert_eq!(s, "0\tsubdir/deeper\n"); +} +#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] fn _du_basics_subdir(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { @@ -71,7 +75,7 @@ fn test_du_basics_bad_name() { fn test_du_soft_link() { let ts = TestScenario::new("du"); - let link = ts.cmd("ln").arg("-s").arg(SUB_FILE).arg(SUB_LINK).run(); + let link = ts.ccmd("ln").arg("-s").arg(SUB_FILE).arg(SUB_LINK).run(); assert!(link.success); let result = ts.ucmd().arg(SUB_DIR_LINKS).run(); @@ -85,7 +89,11 @@ fn _du_soft_link(s: String) { // 'macos' host variants may have `du` output variation for soft links assert!((s == "12\tsubdir/links\n") || (s == "16\tsubdir/links\n")); } -#[cfg(not(target_vendor = "apple"))] +#[cfg(target_os = "windows")] +fn _du_soft_link(s: String) { + assert_eq!(s, "8\tsubdir/links\n"); +} +#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] fn _du_soft_link(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { @@ -99,7 +107,7 @@ fn _du_soft_link(s: String) { fn test_du_hard_link() { let ts = TestScenario::new("du"); - let link = ts.cmd("ln").arg(SUB_FILE).arg(SUB_LINK).run(); + let link = ts.ccmd("ln").arg(SUB_FILE).arg(SUB_LINK).run(); assert!(link.success); let result = ts.ucmd().arg(SUB_DIR_LINKS).run(); @@ -113,7 +121,11 @@ fn test_du_hard_link() { fn _du_hard_link(s: String) { assert_eq!(s, "12\tsubdir/links\n") } -#[cfg(not(target_vendor = "apple"))] +#[cfg(target_os = "windows")] +fn _du_hard_link(s: String) { + assert_eq!(s, "8\tsubdir/links\n") +} +#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] fn _du_hard_link(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { @@ -137,7 +149,11 @@ fn test_du_d_flag() { fn _du_d_flag(s: String) { assert_eq!(s, "16\t./subdir\n20\t./\n"); } -#[cfg(not(target_vendor = "apple"))] +#[cfg(target_os = "windows")] +fn _du_d_flag(s: String) { + assert_eq!(s, "8\t./subdir\n8\t./\n"); +} +#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] fn _du_d_flag(s: String) { // MS-WSL linux has altered expected output if !is_wsl() { diff --git a/tests/common/util.rs b/tests/common/util.rs index e4b452289..7aea8dc26 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -589,6 +589,14 @@ impl TestScenario { UCommand::new_from_tmp(bin, self.tmpd.clone(), true) } + /// Returns builder for invoking any uutils command. Paths given are treated + /// relative to the environment's unique temporary test directory. + pub fn ccmd>(&self, bin: S) -> UCommand { + let mut cmd = self.cmd(&self.bin_path); + cmd.arg(bin); + cmd + } + // different names are used rather than an argument // because the need to keep the environment is exceedingly rare. pub fn ucmd_keepenv(&self) -> UCommand { From 9c2cd81b111b028c07b6791568445acb18f30db0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 1 Apr 2021 23:18:57 +0200 Subject: [PATCH 559/606] refresh cargo.lock with recent updates --- Cargo.lock | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 95635159c..f40d512ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,7 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - [[package]] name = "advapi32-sys" version = "0.2.0" @@ -982,9 +980,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" dependencies = [ "unicode-xid 0.2.1", ] @@ -1356,9 +1354,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.67" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" +checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87" dependencies = [ "proc-macro2", "quote 1.0.9", From 6734ce785d5e17d8fb58dba29a94e3dfd06fb015 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 1 Apr 2021 23:25:37 +0200 Subject: [PATCH 560/606] rustfmt the recent changes --- src/uu/du/src/du.rs | 4 ++-- src/uu/echo/src/echo.rs | 1 - src/uu/sort/src/sort.rs | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 2eb7bd658..a4852b21c 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -26,9 +26,9 @@ use time::Timespec; #[cfg(windows)] use winapi::shared::minwindef::{DWORD, LPVOID}; #[cfg(windows)] -use winapi::um::fileapi::{FILE_STANDARD_INFO, FILE_ID_INFO}; +use winapi::um::fileapi::{FILE_ID_INFO, FILE_STANDARD_INFO}; #[cfg(windows)] -use winapi::um::minwinbase::{FileStandardInfo, FileIdInfo}; +use winapi::um::minwinbase::{FileIdInfo, FileStandardInfo}; #[cfg(windows)] use winapi::um::winbase::GetFileInformationByHandleEx; #[cfg(windows)] diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index 1e0c04d1d..4d38d7748 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -36,7 +36,6 @@ const AFTER_HELP: &str = r#" \\xHH byte with hexadecimal value HH (1 to 2 digits) "#; - mod options { pub const STRING: &str = "STRING"; pub const NO_NEWLINE: &str = "no_newline"; diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index f8789835a..6c29ad98d 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -493,13 +493,13 @@ fn get_leading_number(a: &str) -> &str { fn num_sort_dedup(a: &str) -> &str { // Empty lines are dumped if a.is_empty() { - return "0" + return "0"; // And lines that don't begin numerically are dumped } else if !a.trim().chars().nth(0).unwrap_or('\0').is_numeric() { - return "0" + return "0"; } else { - // Prepare lines for comparison of only the numerical leading numbers - return get_leading_number(a) + // Prepare lines for comparison of only the numerical leading numbers + return get_leading_number(a); }; } From dcbcf016658cebb24325197ba484c66d88e7a213 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 1 Apr 2021 23:37:22 +0200 Subject: [PATCH 561/606] Fix some clippy warnings --- src/uu/cksum/src/cksum.rs | 2 +- src/uu/fmt/src/linebreak.rs | 2 +- src/uu/ln/src/ln.rs | 2 +- src/uu/ls/src/ls.rs | 8 +++----- src/uu/nl/src/helper.rs | 2 +- .../num_format/formatters/cninetyninehexfloatf.rs | 2 +- .../src/tokenize/num_format/formatters/float_common.rs | 2 +- src/uu/shred/src/shred.rs | 2 +- tests/common/util.rs | 5 ++++- 9 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index b7659ea62..b6436de87 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -147,7 +147,7 @@ fn cksum(fname: &str) -> io::Result<(u32, usize)> { "Is a directory", )); }; - if !path.metadata().is_ok() { + if path.metadata().is_err() { return Err(std::io::Error::new( io::ErrorKind::NotFound, "No such file or directory", diff --git a/src/uu/fmt/src/linebreak.rs b/src/uu/fmt/src/linebreak.rs index c41fd41bd..50cb6f77f 100644 --- a/src/uu/fmt/src/linebreak.rs +++ b/src/uu/fmt/src/linebreak.rs @@ -81,7 +81,7 @@ pub fn break_lines(para: &Paragraph, opts: &FmtOptions, ostream: &mut BufWriter< let mut break_args = BreakArgs { opts, init_len: p_init_len, - indent_str: &p_indent[..], + indent_str: p_indent, indent_len: p_indent_len, uniform, ostream, diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index ab07a2b08..394cf13af 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -223,7 +223,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } else if matches.is_present(OPT_BACKUP) { match matches.value_of(OPT_BACKUP) { None => BackupMode::ExistingBackup, - Some(mode) => match &mode[..] { + Some(mode) => match mode { "simple" | "never" => BackupMode::SimpleBackup, "numbered" | "t" => BackupMode::NumberedBackup, "existing" | "nil" => BackupMode::ExistingBackup, diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 9633acf43..ece497bdb 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -270,11 +270,9 @@ impl Config { .any(|i| i >= idx) { format = Format::Long; - } else { - if let Some(mut indices) = options.indices_of(options::format::ONELINE) { - if indices.any(|i| i > idx) { - format = Format::OneLine; - } + } else if let Some(mut indices) = options.indices_of(options::format::ONELINE) { + if indices.any(|i| i > idx) { + format = Format::OneLine; } } } diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index 94ff835d7..e31477c62 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -37,7 +37,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> } match opts.value_of(options::NUMBER_FORMAT) { None => {} - Some(val) => match val.as_ref() { + Some(val) => match val { "ln" => { settings.number_format = crate::NumberFormat::Left; } diff --git a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs index bf21bf8f9..10e58cc32 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/cninetyninehexfloatf.rs @@ -59,7 +59,7 @@ fn get_primitive_hex( // assign 0 let (mut first_segment_raw, second_segment_raw) = match analysis.decimal_pos { Some(pos) => (&str_in[..pos], &str_in[pos + 1..]), - None => (&str_in[..], "0"), + None => (str_in, "0"), }; if first_segment_raw.is_empty() { first_segment_raw = "0"; diff --git a/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs b/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs index 65fe5b6ea..a107078ae 100644 --- a/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs +++ b/src/uu/printf/src/tokenize/num_format/formatters/float_common.rs @@ -218,7 +218,7 @@ pub fn get_primitive_dec( // assign 0 let (mut first_segment_raw, second_segment_raw) = match analysis.decimal_pos { Some(pos) => (&str_in[..pos], &str_in[pos + 1..]), - None => (&str_in[..], "0"), + None => (str_in, "0"), }; if first_segment_raw.is_empty() { first_segment_raw = "0"; diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index f9d8b9c73..c5f4d6e57 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -338,7 +338,7 @@ this is the default for non-regular files", Some(s) => match s.parse::() { Ok(u) => u, Err(_) => { - errs.push(String::from(format!("invalid number of passes: '{}'", s))); + errs.push(format!("invalid number of passes: '{}'", s)); 0 } }, diff --git a/tests/common/util.rs b/tests/common/util.rs index 7aea8dc26..922525ed2 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -1,8 +1,11 @@ #![allow(dead_code)] +#[cfg(not(windows))] use libc; use std::env; -use std::ffi::{CString, OsStr}; +#[cfg(not(windows))] +use std::ffi::CString; +use std::ffi::OsStr; use std::fs::{self, File, OpenOptions}; use std::io::{Read, Result, Write}; #[cfg(unix)] From 7112182dbcbd55925df7d33d11d8090cd043d16f Mon Sep 17 00:00:00 2001 From: Paul Otten Date: Thu, 1 Apr 2021 18:37:20 -0400 Subject: [PATCH 562/606] Consider device id when comparing files --- src/uu/du/src/du.rs | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 2eb7bd658..c311f982e 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -32,7 +32,7 @@ use winapi::um::minwinbase::{FileStandardInfo, FileIdInfo}; #[cfg(windows)] use winapi::um::winbase::GetFileInformationByHandleEx; #[cfg(windows)] -use winapi::um::winnt::FILE_ID_128; +use winapi::um::winnt::{FILE_ID_128, ULONGLONG}; const NAME: &str = "du"; const SUMMARY: &str = "estimate file space usage"; @@ -58,12 +58,18 @@ struct Options { separate_dirs: bool, } +#[derive(PartialEq, Eq, Hash, Clone, Copy)] +struct FileInfo { + file_id: u128, + dev_id: u64, +} + struct Stat { path: PathBuf, is_dir: bool, size: u64, blocks: u64, - inode: Option, + inode: Option, created: u64, accessed: u64, modified: u64, @@ -73,13 +79,18 @@ impl Stat { fn new(path: PathBuf) -> Result { let metadata = fs::symlink_metadata(&path)?; + #[cfg(not(windows))] + let file_info = FileInfo { + file_id: metadata.ino() as u128, + dev_id: metadata.dev(), + }; #[cfg(not(windows))] return Ok(Stat { path, is_dir: metadata.is_dir(), size: metadata.len(), blocks: metadata.blocks() as u64, - inode: Some(metadata.ino() as u128), + inode: Some(file_info), created: metadata.mtime() as u64, accessed: metadata.atime() as u64, modified: metadata.mtime() as u64, @@ -88,14 +99,14 @@ impl Stat { #[cfg(windows)] let size_on_disk = get_size_on_disk(&path); #[cfg(windows)] - let inode = get_inode(&path); + let file_info = get_file_info(&path); #[cfg(windows)] Ok(Stat { path, is_dir: metadata.is_dir(), size: metadata.len(), blocks: size_on_disk / 1024 * 2, - inode: inode, + inode: file_info, created: windows_time_to_unix_time(metadata.creation_time()), accessed: windows_time_to_unix_time(metadata.last_access_time()), modified: windows_time_to_unix_time(metadata.last_write_time()), @@ -143,12 +154,12 @@ fn get_size_on_disk(path: &PathBuf) -> u64 { } #[cfg(windows)] -fn get_inode(path: &PathBuf) -> Option { - let mut inode = None; +fn get_file_info(path: &PathBuf) -> Option { + let mut result = None; let file = match fs::File::open(path) { Ok(file) => file, - Err(_) => return inode, + Err(_) => return result, }; let handle = file.as_raw_handle(); @@ -165,11 +176,14 @@ fn get_inode(path: &PathBuf) -> Option { ); if success != 0 { - inode = Some(std::mem::transmute::(file_info.FileId)); + result = Some(FileInfo { + file_id: std::mem::transmute::(file_info.FileId), + dev_id: std::mem::transmute::(file_info.VolumeSerialNumber), + }); } } - inode + result } fn unit_string_to_number(s: &str) -> Option { @@ -239,7 +253,7 @@ fn du( mut my_stat: Stat, options: &Options, depth: usize, - inodes: &mut HashSet, + inodes: &mut HashSet, ) -> Box> { let mut stats = vec![]; let mut futures = vec![]; @@ -523,7 +537,7 @@ Try '{} --help' for more information.", let path = PathBuf::from(&path_str); match Stat::new(path) { Ok(stat) => { - let mut inodes: HashSet = HashSet::new(); + let mut inodes: HashSet = HashSet::new(); let iter = du(stat, &options, 0, &mut inodes); let (_, len) = iter.size_hint(); From 7859bf885fa0c3ad666b2837174c592a84f62978 Mon Sep 17 00:00:00 2001 From: Paul Otten Date: Thu, 1 Apr 2021 19:42:43 -0400 Subject: [PATCH 563/606] Consistency with GNU version of `du` when doing `du -h` on an empty file --- src/uu/du/src/du.rs | 3 +++ tests/by-util/test_du.rs | 10 ++++++++++ tests/fixtures/du/empty.txt | 0 3 files changed, 13 insertions(+) create mode 100644 tests/fixtures/du/empty.txt diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 2eb7bd658..5ce193842 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -305,6 +305,9 @@ fn convert_size_human(size: u64, multiplier: u64, _block_size: u64) -> String { return format!("{:.1}{}", (size as f64) / (limit as f64), unit); } } + if size == 0 { + return format!("0"); + } format!("{}B", size) } diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index c810bd395..b3b1b3465 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -162,3 +162,13 @@ fn _du_d_flag(s: String) { assert_eq!(s, "8\t./subdir\n8\t./\n"); } } + +#[test] +fn test_du_h_flag_empty_file() { + let ts = TestScenario::new("du"); + + let result = ts.ucmd().arg("-h").arg("empty.txt").run(); + assert!(result.success); + assert_eq!(result.stderr, ""); + assert_eq!(result.stdout, "0\tempty.txt\n"); +} diff --git a/tests/fixtures/du/empty.txt b/tests/fixtures/du/empty.txt new file mode 100644 index 000000000..e69de29bb From 4a6176855a1911df37250557880a52ea1bf6542b Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Fri, 2 Apr 2021 09:55:57 +0200 Subject: [PATCH 564/606] relpath: move from getops to clap (#1939) (#1990) * relpath: add tests * relpath: move from getopts to clap --- src/uu/relpath/Cargo.toml | 2 +- src/uu/relpath/src/relpath.rs | 103 ++++++++------------- tests/by-util/test_relpath.rs | 166 +++++++++++++++++++++++++++++++++- 3 files changed, 206 insertions(+), 65 deletions(-) diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index 1dc296ec6..c923b42ac 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/relpath.rs" [dependencies] -getopts = "0.2.18" +clap = "2.33.3" uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/relpath/src/relpath.rs b/src/uu/relpath/src/relpath.rs index 4e165df1f..82779107a 100644 --- a/src/uu/relpath/src/relpath.rs +++ b/src/uu/relpath/src/relpath.rs @@ -10,62 +10,60 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::env; use std::path::{Path, PathBuf}; use uucore::fs::{canonicalize, CanonicalizeMode}; -static NAME: &str = "relpath"; static VERSION: &str = env!("CARGO_PKG_VERSION"); +static ABOUT: &str = "Convert TO destination to the relative path from the FROM dir. +If FROM path is omitted, current working dir will be used."; + +mod options { + pub const DIR: &str = "DIR"; + pub const TO: &str = "TO"; + pub const FROM: &str = "FROM"; +} + +fn get_usage() -> String { + format!("{} [-d DIR] TO [FROM]", executable!()) +} pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); + let usage = get_usage(); - let mut opts = getopts::Options::new(); + let matches = App::new(executable!()) + .version(VERSION) + .about(ABOUT) + .usage(&usage[..]) + .arg( + Arg::with_name(options::DIR) + .short("d") + .takes_value(true) + .help("If any of FROM and TO is not subpath of DIR, output absolute path instead of relative"), + ) + .arg( + Arg::with_name(options::TO) + .required(true) + .takes_value(true), + ) + .arg( + Arg::with_name(options::FROM) + .takes_value(true), + ) + .get_matches_from(args); - opts.optflag("h", "help", "Show help and exit"); - opts.optflag("V", "version", "Show version and exit"); - opts.optopt( - "d", - "", - "If any of FROM and TO is not subpath of DIR, output absolute path instead of relative", - "DIR", - ); - - let matches = match opts.parse(&args[1..]) { - Ok(m) => m, - Err(f) => { - show_error!("{}", f); - show_usage(&opts); - return 1; - } - }; - - if matches.opt_present("V") { - version(); - return 0; - } - if matches.opt_present("h") { - show_usage(&opts); - return 0; - } - - if matches.free.is_empty() { - show_error!("Missing operand: TO"); - println!("Try `{} --help` for more information.", NAME); - return 1; - } - - let to = Path::new(&matches.free[0]); - let from = if matches.free.len() > 1 { - Path::new(&matches.free[1]).to_path_buf() - } else { - env::current_dir().unwrap() + let to = Path::new(matches.value_of(options::TO).unwrap()).to_path_buf(); // required + let from = match matches.value_of(options::FROM) { + Some(p) => Path::new(p).to_path_buf(), + None => env::current_dir().unwrap(), }; let absto = canonicalize(to, CanonicalizeMode::Normal).unwrap(); let absfrom = canonicalize(from, CanonicalizeMode::Normal).unwrap(); - if matches.opt_present("d") { - let base = Path::new(&matches.opt_str("d").unwrap()).to_path_buf(); + if matches.is_present(options::DIR) { + let base = Path::new(&matches.value_of(options::DIR).unwrap()).to_path_buf(); let absbase = canonicalize(base, CanonicalizeMode::Normal).unwrap(); if !absto.as_path().starts_with(absbase.as_path()) || !absfrom.as_path().starts_with(absbase.as_path()) @@ -99,24 +97,3 @@ pub fn uumain(args: impl uucore::Args) -> i32 { println!("{}", result.display()); 0 } - -fn version() { - println!("{} {}", NAME, VERSION) -} - -fn show_usage(opts: &getopts::Options) { - version(); - println!(); - println!("Usage:"); - println!(" {} [-d DIR] TO [FROM]", NAME); - println!(" {} -V|--version", NAME); - println!(" {} -h|--help", NAME); - println!(); - print!( - "{}", - opts.usage( - "Convert TO destination to the relative path from the FROM dir.\n\ - If FROM path is omitted, current working dir will be used." - ) - ); -} diff --git a/tests/by-util/test_relpath.rs b/tests/by-util/test_relpath.rs index 651491045..690531896 100644 --- a/tests/by-util/test_relpath.rs +++ b/tests/by-util/test_relpath.rs @@ -1 +1,165 @@ -// ToDO: add tests +use crate::common::util::*; +use std::borrow::Cow; +use std::path::Path; + +struct TestCase<'a> { + from: &'a str, + to: &'a str, + expected: &'a str, +} + +const TESTS: [TestCase; 10] = [ + TestCase { + from: "A/B/C", + to: "A", + expected: "../..", + }, + TestCase { + from: "A/B/C", + to: "A/B", + expected: "..", + }, + TestCase { + from: "A/B/C", + to: "A/B/C", + expected: "", + }, + TestCase { + from: "A/B/C", + to: "A/B/C/D", + expected: "D", + }, + TestCase { + from: "A/B/C", + to: "A/B/C/D/E", + expected: "D/E", + }, + TestCase { + from: "A/B/C", + to: "A/B/D", + expected: "../D", + }, + TestCase { + from: "A/B/C", + to: "A/B/D/E", + expected: "../D/E", + }, + TestCase { + from: "A/B/C", + to: "A/D", + expected: "../../D", + }, + TestCase { + from: "A/B/C", + to: "D/E/F", + expected: "../../../D/E/F", + }, + TestCase { + from: "A/B/C", + to: "A/D/E", + expected: "../../D/E", + }, +]; + +fn convert_path<'a>(path: &'a str) -> Cow<'a, str> { + #[cfg(windows)] + return path.replace("/", "\\").into(); + #[cfg(not(windows))] + return path.into(); +} + +#[test] +fn test_relpath_with_from_no_d() { + for test in TESTS.iter() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let from: &str = &convert_path(test.from); + let to: &str = &convert_path(test.to); + let expected: &str = &convert_path(test.expected); + + at.mkdir_all(to); + at.mkdir_all(from); + + scene + .ucmd() + .arg(to) + .arg(from) + .succeeds() + .stdout_only(&format!("{}\n", expected)); + } +} + +#[test] +fn test_relpath_with_from_with_d() { + for test in TESTS.iter() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let from: &str = &convert_path(test.from); + let to: &str = &convert_path(test.to); + let pwd = at.as_string(); + at.mkdir_all(to); + at.mkdir_all(from); + + // d is part of subpath -> expect relative path + let mut result = scene + .ucmd() + .arg(to) + .arg(from) + .arg(&format!("-d{}", pwd)) + .run(); + assert!(result.success); + // relax rules for windows test environment + #[cfg(not(windows))] + assert!(Path::new(&result.stdout).is_relative()); + + // d is not part of subpath -> expect absolut path + result = scene.ucmd().arg(to).arg(from).arg("-dnon_existing").run(); + assert!(result.success); + assert!(Path::new(&result.stdout).is_absolute()); + } +} + +#[test] +fn test_relpath_no_from_no_d() { + for test in TESTS.iter() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let to: &str = &convert_path(test.to); + at.mkdir_all(to); + + let result = scene.ucmd().arg(to).run(); + assert!(result.success); + #[cfg(not(windows))] + assert_eq!(result.stdout, format!("{}\n", to)); + // relax rules for windows test environment + #[cfg(windows)] + assert!(result.stdout.ends_with(&format!("{}\n", to))); + } +} + +#[test] +fn test_relpath_no_from_with_d() { + for test in TESTS.iter() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + let to: &str = &convert_path(test.to); + let pwd = at.as_string(); + at.mkdir_all(to); + + // d is part of subpath -> expect relative path + let mut result = scene.ucmd().arg(to).arg(&format!("-d{}", pwd)).run(); + assert!(result.success); + // relax rules for windows test environment + #[cfg(not(windows))] + assert!(Path::new(&result.stdout).is_relative()); + + // d is not part of subpath -> expect absolut path + result = scene.ucmd().arg(to).arg("-dnon_existing").run(); + assert!(result.success); + assert!(Path::new(&result.stdout).is_absolute()); + } +} From 2eb32d845ec023ce4f1878e1b7a27d1206cee7fc Mon Sep 17 00:00:00 2001 From: ReggaeMuffin <644950+reggaemuffin@users.noreply.github.com> Date: Fri, 2 Apr 2021 10:56:49 +0100 Subject: [PATCH 565/606] chores: run `cargo +1.40.0 fmt` Apparently fmt from 1.40.0 is a bit more strict in some places Let me know if this is worthwhile merging :) --- Cargo.lock | 2 +- build.rs | 38 +++++++++--------- src/uu/chroot/src/chroot.rs | 4 +- src/uu/head/src/head.rs | 30 +++++++------- src/uu/hostname/src/hostname.rs | 2 +- src/uu/ln/src/ln.rs | 4 +- src/uu/mktemp/src/mktemp.rs | 10 ++--- src/uu/numfmt/src/numfmt.rs | 8 ++-- src/uu/readlink/src/readlink.rs | 6 +-- src/uu/shred/src/shred.rs | 70 ++++++++++++++++----------------- src/uu/stdbuf/src/stdbuf.rs | 3 +- src/uu/uptime/src/uptime.rs | 4 +- tests/common/util.rs | 8 ++-- 13 files changed, 94 insertions(+), 95 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f40d512ce..88984362b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2181,7 +2181,7 @@ dependencies = [ name = "uu_relpath" version = "0.0.4" dependencies = [ - "getopts", + "clap", "uucore", "uucore_procs", ] diff --git a/build.rs b/build.rs index 625a3ccc8..ae38177b0 100644 --- a/build.rs +++ b/build.rs @@ -44,10 +44,10 @@ pub fn main() { mf.write_all( "type UtilityMap = HashMap<&'static str, fn(T) -> i32>;\n\ - \n\ - fn util_map() -> UtilityMap {\n\ - \tlet mut map = UtilityMap::new();\n\ - " + \n\ + fn util_map() -> UtilityMap {\n\ + \tlet mut map = UtilityMap::new();\n\ + " .as_bytes(), ) .unwrap(); @@ -97,21 +97,21 @@ pub fn main() { mf.write_all( format!( "\ - \tmap.insert(\"{krate}\", {krate}::uumain);\n\ - \t\tmap.insert(\"md5sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha1sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha224sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha256sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha384sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha512sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha3sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha3-224sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha3-256sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha3-384sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"sha3-512sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"shake128sum\", {krate}::uumain);\n\ - \t\tmap.insert(\"shake256sum\", {krate}::uumain);\n\ - ", + \tmap.insert(\"{krate}\", {krate}::uumain);\n\ + \t\tmap.insert(\"md5sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha1sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha224sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha256sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha384sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha512sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha3sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha3-224sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha3-256sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha3-384sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"sha3-512sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"shake128sum\", {krate}::uumain);\n\ + \t\tmap.insert(\"shake256sum\", {krate}::uumain);\n\ + ", krate = krate ) .as_bytes(), diff --git a/src/uu/chroot/src/chroot.rs b/src/uu/chroot/src/chroot.rs index 2c3bcbca4..44c5dfa02 100644 --- a/src/uu/chroot/src/chroot.rs +++ b/src/uu/chroot/src/chroot.rs @@ -65,8 +65,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::USERSPEC) .help( "Colon-separated user and group to switch to. \ - Same as -u USER -g GROUP. \ - Userspec has higher preference than -u and/or -g", + Same as -u USER -g GROUP. \ + Userspec has higher preference than -u and/or -g", ) .value_name("USER:GROUP"), ) diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index a8f519f6b..3500af544 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -10,13 +10,13 @@ const BUF_SIZE: usize = 65536; const VERSION: &str = env!("CARGO_PKG_VERSION"); const ABOUT: &str = "\ - Print the first 10 lines of each FILE to standard output.\n\ - With more than one FILE, precede each with a header giving the file name.\n\ - \n\ - With no FILE, or when FILE is -, read standard input.\n\ - \n\ - Mandatory arguments to long flags are mandatory for short flags too.\ - "; + Print the first 10 lines of each FILE to standard output.\n\ + With more than one FILE, precede each with a header giving the file name.\n\ + \n\ + With no FILE, or when FILE is -, read standard input.\n\ + \n\ + Mandatory arguments to long flags are mandatory for short flags too.\ + "; const USAGE: &str = "head [FLAG]... [FILE]..."; mod options { @@ -43,10 +43,10 @@ fn app<'a>() -> App<'a, 'a> { .takes_value(true) .help( "\ - print the first NUM bytes of each file;\n\ - with the leading '-', print all but the last\n\ - NUM bytes of each file\ - ", + print the first NUM bytes of each file;\n\ + with the leading '-', print all but the last\n\ + NUM bytes of each file\ + ", ) .overrides_with_all(&[options::BYTES_NAME, options::LINES_NAME]) .allow_hyphen_values(true), @@ -59,10 +59,10 @@ fn app<'a>() -> App<'a, 'a> { .takes_value(true) .help( "\ - print the first NUM lines instead of the first 10;\n\ - with the leading '-', print all but the last\n\ - NUM lines of each file\ - ", + print the first NUM lines instead of the first 10;\n\ + with the leading '-', print all but the last\n\ + NUM lines of each file\ + ", ) .overrides_with_all(&[options::LINES_NAME, options::BYTES_NAME]) .allow_hyphen_values(true), diff --git a/src/uu/hostname/src/hostname.rs b/src/uu/hostname/src/hostname.rs index f37b6a74d..d6f70be16 100644 --- a/src/uu/hostname/src/hostname.rs +++ b/src/uu/hostname/src/hostname.rs @@ -78,7 +78,7 @@ fn execute(args: impl uucore::Args) -> i32 { ) .arg(Arg::with_name(OPT_SHORT).short("s").long("short").help( "Display the short hostname (the portion before the first dot) if \ - possible", + possible", )) .arg(Arg::with_name(OPT_HOST)) .get_matches_from(args); diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 394cf13af..96a0df813 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -111,7 +111,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_BACKUP) .help( "make a backup of each file that would otherwise be overwritten \ - or removed", + or removed", ) .takes_value(true) .possible_value("simple") @@ -145,7 +145,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_NO_DEREFERENCE) .help( "treat LINK_executable!() as a normal file if it is a \ - symbolic link to a directory", + symbolic link to a directory", ), ) // TODO: opts.arg( diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index 194b6625f..ed767ffe0 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -71,7 +71,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_SUFFIX) .help( "append SUFF to TEMPLATE; SUFF must not contain a path separator. \ - This option is implied if TEMPLATE does not end with X.", + This option is implied if TEMPLATE does not end with X.", ) .value_name("SUFF"), ) @@ -81,15 +81,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_TMPDIR) .help( "interpret TEMPLATE relative to DIR; if DIR is not specified, use \ - $TMPDIR if set, else /tmp. With this option, TEMPLATE must not \ - be an absolute name; unlike with -t, TEMPLATE may contain \ - slashes, but mktemp creates only the final component", + $TMPDIR if set, else /tmp. With this option, TEMPLATE must not \ + be an absolute name; unlike with -t, TEMPLATE may contain \ + slashes, but mktemp creates only the final component", ) .value_name("DIR"), ) .arg(Arg::with_name(OPT_T).short(OPT_T).help( "Generate a template (using the supplied prefix and TMPDIR if set) \ - to create a filename template [deprecated]", + to create a filename template [deprecated]", )) .arg( Arg::with_name(ARG_TEMPLATE) diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index 29c422a89..e9a476956 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -187,9 +187,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::PADDING) .help( "pad the output to N characters; positive N will \ - right-align; negative N will left-align; padding is \ - ignored if the output is wider than N; the default is \ - to automatically pad if a whitespace is found", + right-align; negative N will left-align; padding is \ + ignored if the output is wider than N; the default is \ + to automatically pad if a whitespace is found", ) .value_name("N"), ) @@ -198,7 +198,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::HEADER) .help( "print (without converting) the first N header lines; \ - N defaults to 1 if not specified", + N defaults to 1 if not specified", ) .value_name("N") .default_value(options::HEADER_DEFAULT) diff --git a/src/uu/readlink/src/readlink.rs b/src/uu/readlink/src/readlink.rs index 8bc9a2aeb..727c2cce5 100644 --- a/src/uu/readlink/src/readlink.rs +++ b/src/uu/readlink/src/readlink.rs @@ -46,7 +46,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_CANONICALIZE) .help( "canonicalize by following every symlink in every component of the \ - given name recursively; all but the last component must exist", + given name recursively; all but the last component must exist", ), ) .arg( @@ -55,7 +55,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long("canonicalize-existing") .help( "canonicalize by following every symlink in every component of the \ - given name recursively, all components must exist", + given name recursively, all components must exist", ), ) .arg( @@ -64,7 +64,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(OPT_CANONICALIZE_MISSING) .help( "canonicalize by following every symlink in every component of the \ - given name recursively, without requirements on components existence", + given name recursively, without requirements on components existence", ), ) .arg( diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index c5f4d6e57..d5f910297 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -223,40 +223,40 @@ fn get_usage() -> String { static AFTER_HELP: &str = "Delete FILE(s) if --remove (-u) is specified. The default is not to remove\n\ -the files because it is common to operate on device files like /dev/hda,\n\ -and those files usually should not be removed.\n\ -\n\ -CAUTION: Note that shred relies on a very important assumption:\n\ -that the file system overwrites data in place. This is the traditional\n\ -way to do things, but many modern file system designs do not satisfy this\n\ -assumption. The following are examples of file systems on which shred is\n\ -not effective, or is not guaranteed to be effective in all file system modes:\n\ -\n\ -* log-structured or journaled file systems, such as those supplied with\n\ -AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)\n\ -\n\ -* file systems that write redundant data and carry on even if some writes\n\ -fail, such as RAID-based file systems\n\ -\n\ -* file systems that make snapshots, such as Network Appliance's NFS server\n\ -\n\ -* file systems that cache in temporary locations, such as NFS\n\ -version 3 clients\n\ -\n\ -* compressed file systems\n\ -\n\ -In the case of ext3 file systems, the above disclaimer applies\n\ -and shred is thus of limited effectiveness) only in data=journal mode,\n\ -which journals file data in addition to just metadata. In both the\n\ -data=ordered (default) and data=writeback modes, shred works as usual.\n\ -Ext3 journaling modes can be changed by adding the data=something option\n\ -to the mount options for a particular file system in the /etc/fstab file,\n\ -as documented in the mount man page (man mount).\n\ -\n\ -In addition, file system backups and remote mirrors may contain copies\n\ -of the file that cannot be removed, and that will allow a shredded file\n\ -to be recovered later.\n\ -"; + the files because it is common to operate on device files like /dev/hda,\n\ + and those files usually should not be removed.\n\ + \n\ + CAUTION: Note that shred relies on a very important assumption:\n\ + that the file system overwrites data in place. This is the traditional\n\ + way to do things, but many modern file system designs do not satisfy this\n\ + assumption. The following are examples of file systems on which shred is\n\ + not effective, or is not guaranteed to be effective in all file system modes:\n\ + \n\ + * log-structured or journaled file systems, such as those supplied with\n\ + AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)\n\ + \n\ + * file systems that write redundant data and carry on even if some writes\n\ + fail, such as RAID-based file systems\n\ + \n\ + * file systems that make snapshots, such as Network Appliance's NFS server\n\ + \n\ + * file systems that cache in temporary locations, such as NFS\n\ + version 3 clients\n\ + \n\ + * compressed file systems\n\ + \n\ + In the case of ext3 file systems, the above disclaimer applies\n\ + and shred is thus of limited effectiveness) only in data=journal mode,\n\ + which journals file data in addition to just metadata. In both the\n\ + data=ordered (default) and data=writeback modes, shred works as usual.\n\ + Ext3 journaling modes can be changed by adding the data=something option\n\ + to the mount options for a particular file system in the /etc/fstab file,\n\ + as documented in the mount man page (man mount).\n\ + \n\ + In addition, file system backups and remote mirrors may contain copies\n\ + of the file that cannot be removed, and that will allow a shredded file\n\ + to be recovered later.\n\ + "; pub mod options { pub const FILE: &str = "file"; @@ -312,7 +312,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .short("x") .help( "do not round file sizes up to the next full block;\n\ -this is the default for non-regular files", + this is the default for non-regular files", ), ) .arg( diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 67ed9a838..a61ba967b 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -80,7 +80,8 @@ fn print_version() { fn print_usage(opts: &Options) { let brief = "Run COMMAND, with modified buffering operations for its standard streams\n \ Mandatory arguments to long options are mandatory for short options too."; - let explanation = "If MODE is 'L' the corresponding stream will be line buffered.\n \ + let explanation = + "If MODE is 'L' the corresponding stream will be line buffered.\n \ This option is invalid with standard input.\n\n \ If MODE is '0' the corresponding stream will be unbuffered.\n\n \ Otherwise MODE is a number which may be followed by one of the following:\n\n \ diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index 670d7845b..418b8317f 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -19,8 +19,8 @@ use uucore::libc::time_t; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Display the current time, the length of time the system has been up,\n\ -the number of users on the system, and the average number of jobs\n\ -in the run queue over the last 1, 5 and 15 minutes."; + the number of users on the system, and the average number of jobs\n\ + in the run queue over the last 1, 5 and 15 minutes."; pub mod options { pub static SINCE: &str = "since"; } diff --git a/tests/common/util.rs b/tests/common/util.rs index 922525ed2..708b8dbba 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -29,8 +29,8 @@ static TESTS_DIR: &str = "tests"; static FIXTURES_DIR: &str = "fixtures"; static ALREADY_RUN: &str = " you have already run this UCommand, if you want to run \ - another command in the same test, use TestScenario::new instead of \ - testing();"; + another command in the same test, use TestScenario::new instead of \ + testing();"; static MULTIPLE_STDIN_MEANINGLESS: &str = "Ucommand is designed around a typical use case of: provide args and input stream -> spawn process -> block until completion -> return output streams. For verifying that a particular section of the input stream is what causes a particular behavior, use the Command type directly."; /// Test if the program is running under CI @@ -135,9 +135,7 @@ impl CmdResult { pub fn tmpd(&self) -> Rc { match &self.tmpd { Some(ptr) => ptr.clone(), - None => { - panic!("Command not associated with a TempDir") - } + None => panic!("Command not associated with a TempDir"), } } From d12f96d9ca5c72f573782b252e64aa43f9b82a4d Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Fri, 2 Apr 2021 09:13:25 -0400 Subject: [PATCH 566/606] fold: preserve blank lines --- src/uu/fold/src/fold.rs | 5 ++++- tests/by-util/test_fold.rs | 28 +++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index 05f0725ef..27ab319d0 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -100,7 +100,10 @@ fn fold(filenames: Vec, bytes: bool, spaces: bool, width: usize) { fn fold_file(file: BufReader, bytes: bool, spaces: bool, width: usize) { for line_result in file.lines() { let mut line = safe_unwrap!(line_result); - if bytes { + + if line.is_empty() { + println!(); + } else if bytes { let len = line.len(); let mut i = 0; while i < len { diff --git a/tests/by-util/test_fold.rs b/tests/by-util/test_fold.rs index c17f300d2..64d77cd2b 100644 --- a/tests/by-util/test_fold.rs +++ b/tests/by-util/test_fold.rs @@ -25,9 +25,35 @@ fn test_40_column_word_boundary() { } #[test] -fn test_default_warp_with_newlines() { +fn test_default_wrap_with_newlines() { new_ucmd!() .arg("lorem_ipsum_new_line.txt") .run() .stdout_is_fixture("lorem_ipsum_new_line_80_column.expected"); } + +#[test] +fn test_should_preserve_empty_lines() { + new_ucmd!().pipe_in("\n").succeeds().stdout_is("\n"); + + new_ucmd!() + .arg("-w1") + .pipe_in("0\n1\n\n2\n\n\n") + .succeeds() + .stdout_is("0\n1\n\n2\n\n\n"); +} + +#[test] +fn test_word_boundary_split_should_preserve_empty_lines() { + new_ucmd!() + .arg("-s") + .pipe_in("\n") + .succeeds() + .stdout_is("\n"); + + new_ucmd!() + .args(&["-w1", "-s"]) + .pipe_in("0\n1\n\n2\n\n\n") + .succeeds() + .stdout_is("0\n1\n\n2\n\n\n"); +} From 349c4f7af66d5c4baa9ee806e7a327e35114fa94 Mon Sep 17 00:00:00 2001 From: Juliana Rodrigueiro Date: Fri, 2 Apr 2021 19:04:14 +0100 Subject: [PATCH 567/606] install: Make log message identical to GNU install $ install -v -d dir1 install: creating directory 'dir1' --- src/uu/install/src/install.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index b4f98ec1a..35097da09 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -372,7 +372,7 @@ fn directory(paths: Vec, b: Behavior) -> i32 { } if b.verbose { - show_info!("created directory '{}'", path.display()); + show_info!("creating directory '{}'", path.display()); } } if all_successful { From 2a02f01fc2ac3b5e86f56543cd6daf396ea70c07 Mon Sep 17 00:00:00 2001 From: Juliana Rodrigueiro Date: Fri, 2 Apr 2021 19:13:56 +0100 Subject: [PATCH 568/606] install: Don't display success message when the dir was not created Also don't run chmod when we just failed to create the directory. Behaviour before this patch: $ ./target/release/install -v -d dir1/dir2 install: dir1/dir2: Permission denied (os error 13) install: dir1/dir2: chmod failed with error No such file or directory (os error 2) install: created directory 'dir1/dir2' --- src/uu/install/src/install.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 35097da09..6267ed94f 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -364,15 +364,17 @@ fn directory(paths: Vec, b: Behavior) -> i32 { if let Err(e) = fs::create_dir(directory) { show_info!("{}: {}", path.display(), e.to_string()); all_successful = false; + continue; + } + + if b.verbose { + show_info!("creating directory '{}'", path.display()); } } if mode::chmod(&path, b.mode()).is_err() { all_successful = false; - } - - if b.verbose { - show_info!("creating directory '{}'", path.display()); + continue; } } if all_successful { From 97da14fcb20a13912ae177b5a781c2cde9d1c3f7 Mon Sep 17 00:00:00 2001 From: Juliana Rodrigueiro Date: Fri, 2 Apr 2021 20:04:25 +0100 Subject: [PATCH 569/606] install: Fix behaviour of the -d flag The '-d' flag should create all ancestors (or components) of a directory regardless of the presence of the "-D" flag. From the man page: -d, --directory treat all arguments as directory names; create all components of the specified directories With GNU: $ install -v -d dir1/di2 install: creating directory 'dir1' install: creating directory 'dir1/di2' With this version: $ ./target/release/install -v -d dir3/di4 install: dir3/di4: No such file or directory (os error 2) install: dir3/di4: chmod failed with error No such file or directory (os error 2) install: created directory 'dir3/di4' Also, one of the unit tests misinterprets what a "component" is, and hence was fixed. --- src/uu/install/src/install.rs | 14 ++++--- tests/by-util/test_install.rs | 77 +++++++++++++++++++++++++++++++---- 2 files changed, 78 insertions(+), 13 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 6267ed94f..a4f1ca6e6 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -356,13 +356,17 @@ fn directory(paths: Vec, b: Behavior) -> i32 { } else { let mut all_successful = true; - for directory in paths.iter() { - let path = Path::new(directory); - + for path in paths.iter().map(Path::new) { // if the path already exist, don't try to create it again if !path.exists() { - if let Err(e) = fs::create_dir(directory) { - show_info!("{}: {}", path.display(), e.to_string()); + // Differently than the primary functionality (MainFunction::Standard), the directory + // functionality should create all ancestors (or components) of a directory regardless + // of the presence of the "-D" flag. + // NOTE: the GNU "install" sets the expected mode only for the target directory. All + // created ancestor directories will have the default mode. Hence it is safe to use + // fs::create_dir_all and then only modify the target's dir mode. + if let Err(e) = fs::create_dir_all(path) { + show_info!("{}: {}", path.display(), e); all_successful = false; continue; } diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index af48a0e66..8ac6396fd 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -87,20 +87,81 @@ fn test_install_unimplemented_arg() { } #[test] -fn test_install_component_directories() { +fn test_install_ancestors_directories() { let (at, mut ucmd) = at_and_ucmd!(); - let component1 = "component1"; - let component2 = "component2"; - let component3 = "component3"; + let ancestor1 = "ancestor1"; + let ancestor2 = "ancestor1/ancestor2"; + let target_dir = "ancestor1/ancestor2/target_dir"; let directories_arg = "-d"; - ucmd.args(&[directories_arg, component1, component2, component3]) + ucmd.args(&[directories_arg, target_dir]) .succeeds() .no_stderr(); - assert!(at.dir_exists(component1)); - assert!(at.dir_exists(component2)); - assert!(at.dir_exists(component3)); + assert!(at.dir_exists(ancestor1)); + assert!(at.dir_exists(ancestor2)); + assert!(at.dir_exists(target_dir)); +} + +#[test] +fn test_install_ancestors_mode_directories() { + let (at, mut ucmd) = at_and_ucmd!(); + let ancestor1 = "ancestor1"; + let ancestor2 = "ancestor1/ancestor2"; + let target_dir = "ancestor1/ancestor2/target_dir"; + let directories_arg = "-d"; + let mode_arg = "--mode=700"; + + ucmd.args(&[mode_arg, directories_arg, target_dir]) + .succeeds() + .no_stderr(); + + assert!(at.dir_exists(ancestor1)); + assert!(at.dir_exists(ancestor2)); + assert!(at.dir_exists(target_dir)); + + assert_ne!(0o40700 as u32, at.metadata(ancestor1).permissions().mode()); + assert_ne!(0o40700 as u32, at.metadata(ancestor2).permissions().mode()); + + // Expected mode only on the target_dir. + assert_eq!(0o40700 as u32, at.metadata(target_dir).permissions().mode()); +} + +#[test] +fn test_install_parent_directories() { + let (at, mut ucmd) = at_and_ucmd!(); + let ancestor1 = "ancestor1"; + let ancestor2 = "ancestor1/ancestor2"; + let target_dir = "ancestor1/ancestor2/target_dir"; + let directories_arg = "-d"; + + // Here one of the ancestors already exist and only the target_dir and + // its parent must be created. + at.mkdir(ancestor1); + + ucmd.args(&[directories_arg, target_dir]) + .succeeds() + .no_stderr(); + + assert!(at.dir_exists(ancestor2)); + assert!(at.dir_exists(target_dir)); +} + +#[test] +fn test_install_several_directories() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir1 = "dir1"; + let dir2 = "dir2"; + let dir3 = "dir3"; + let directories_arg = "-d"; + + ucmd.args(&[directories_arg, dir1, dir2, dir3]) + .succeeds() + .no_stderr(); + + assert!(at.dir_exists(dir1)); + assert!(at.dir_exists(dir2)); + assert!(at.dir_exists(dir3)); } #[test] From 9151410d08bdf332a7edca93518810278aad5568 Mon Sep 17 00:00:00 2001 From: Sivachandran Date: Sat, 3 Apr 2021 01:44:56 +0530 Subject: [PATCH 570/606] csplit: move from getopts to clap (#1995) --- src/uu/csplit/Cargo.toml | 2 +- src/uu/csplit/src/csplit.rs | 139 +++++++++++++++++++++++------------- 2 files changed, 91 insertions(+), 50 deletions(-) diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index 68c6e2322..7cec4564b 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -15,7 +15,7 @@ edition = "2018" path = "src/csplit.rs" [dependencies] -getopts = "0.2.17" +clap = "2.33" thiserror = "1.0" regex = "1.0.0" glob = "0.2.11" diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index 7eb287522..ce11ba49a 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -2,7 +2,7 @@ #[macro_use] extern crate uucore; -use getopts::Matches; +use clap::{App, Arg, ArgMatches}; use regex::Regex; use std::cmp::Ordering; use std::io::{self, BufReader}; @@ -18,17 +18,25 @@ mod splitname; use crate::csplit_error::CsplitError; use crate::splitname::SplitName; -static SYNTAX: &str = "[OPTION]... FILE PATTERN..."; +static VERSION: &str = env!("CARGO_PKG_VERSION"); static SUMMARY: &str = "split a file into sections determined by context lines"; static LONG_HELP: &str = "Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output."; -static SUFFIX_FORMAT_OPT: &str = "suffix-format"; -static SUPPRESS_MATCHED_OPT: &str = "suppress-matched"; -static DIGITS_OPT: &str = "digits"; -static PREFIX_OPT: &str = "prefix"; -static KEEP_FILES_OPT: &str = "keep-files"; -static QUIET_OPT: &str = "quiet"; -static ELIDE_EMPTY_FILES_OPT: &str = "elide-empty-files"; +mod options { + pub const SUFFIX_FORMAT: &str = "suffix-format"; + pub const SUPPRESS_MATCHED: &str = "suppress-matched"; + pub const DIGITS: &str = "digits"; + pub const PREFIX: &str = "prefix"; + pub const KEEP_FILES: &str = "keep-files"; + pub const QUIET: &str = "quiet"; + pub const ELIDE_EMPTY_FILES: &str = "elide-empty-files"; + pub const FILE: &str = "file"; + pub const PATTERN: &str = "pattern"; +} + +fn get_usage() -> String { + format!("{0} [OPTION]... FILE PATTERN...", executable!()) +} /// Command line options for csplit. pub struct CsplitOptions { @@ -40,19 +48,19 @@ pub struct CsplitOptions { } impl CsplitOptions { - fn new(matches: &Matches) -> CsplitOptions { - let keep_files = matches.opt_present(KEEP_FILES_OPT); - let quiet = matches.opt_present(QUIET_OPT); - let elide_empty_files = matches.opt_present(ELIDE_EMPTY_FILES_OPT); - let suppress_matched = matches.opt_present(SUPPRESS_MATCHED_OPT); + fn new(matches: &ArgMatches) -> CsplitOptions { + let keep_files = matches.is_present(options::KEEP_FILES); + let quiet = matches.is_present(options::QUIET); + let elide_empty_files = matches.is_present(options::ELIDE_EMPTY_FILES); + let suppress_matched = matches.is_present(options::SUPPRESS_MATCHED); CsplitOptions { split_name: crash_if_err!( 1, SplitName::new( - matches.opt_str(PREFIX_OPT), - matches.opt_str(SUFFIX_FORMAT_OPT), - matches.opt_str(DIGITS_OPT) + matches.value_of(options::PREFIX).map(str::to_string), + matches.value_of(options::SUFFIX_FORMAT).map(str::to_string), + matches.value_of(options::DIGITS).map(str::to_string) ) ), keep_files, @@ -702,45 +710,78 @@ mod tests { } pub fn uumain(args: impl uucore::Args) -> i32 { + let usage = get_usage(); let args = args.collect_str(); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optopt( - "b", - SUFFIX_FORMAT_OPT, - "use sprintf FORMAT instead of %02d", - "FORMAT", + let matches = App::new(executable!()) + .version(VERSION) + .about(SUMMARY) + .usage(&usage[..]) + .arg( + Arg::with_name(options::SUFFIX_FORMAT) + .short("b") + .long(options::SUFFIX_FORMAT) + .value_name("FORMAT") + .help("use sprintf FORMAT instead of %02d"), ) - .optopt("f", PREFIX_OPT, "use PREFIX instead of 'xx'", "PREFIX") - .optflag("k", KEEP_FILES_OPT, "do not remove output files on errors") - .optflag( - "", - SUPPRESS_MATCHED_OPT, - "suppress the lines matching PATTERN", + .arg( + Arg::with_name(options::PREFIX) + .short("f") + .long(options::PREFIX) + .value_name("PREFIX") + .help("use PREFIX instead of 'xx'"), ) - .optopt( - "n", - DIGITS_OPT, - "use specified number of digits instead of 2", - "DIGITS", + .arg( + Arg::with_name(options::KEEP_FILES) + .short("k") + .long(options::KEEP_FILES) + .help("do not remove output files on errors"), ) - .optflag("s", QUIET_OPT, "do not print counts of output file sizes") - .optflag("z", ELIDE_EMPTY_FILES_OPT, "remove empty output files") - .parse(args); + .arg( + Arg::with_name(options::SUPPRESS_MATCHED) + .long(options::SUPPRESS_MATCHED) + .help("suppress the lines matching PATTERN"), + ) + .arg( + Arg::with_name(options::DIGITS) + .short("n") + .long(options::DIGITS) + .value_name("DIGITS") + .help("use specified number of digits instead of 2"), + ) + .arg( + Arg::with_name(options::QUIET) + .short("s") + .long(options::QUIET) + .visible_alias("silent") + .help("do not print counts of output file sizes"), + ) + .arg( + Arg::with_name(options::ELIDE_EMPTY_FILES) + .short("z") + .long(options::ELIDE_EMPTY_FILES) + .help("remove empty output files"), + ) + .arg(Arg::with_name(options::FILE).hidden(true).required(true)) + .arg( + Arg::with_name(options::PATTERN) + .hidden(true) + .multiple(true) + .required(true), + ) + .after_help(LONG_HELP) + .get_matches_from(args); - // check for mandatory arguments - if matches.free.is_empty() { - show_error!("missing operand"); - exit!(1); - } - if matches.free.len() == 1 { - show_error!("missing operand after '{}'", matches.free[0]); - exit!(1); - } - // get the patterns to split on - let patterns = return_if_err!(1, patterns::get_patterns(&matches.free[1..])); // get the file to split - let file_name: &str = &matches.free[0]; + let file_name = matches.value_of(options::FILE).unwrap(); + + // get the patterns to split on + let patterns: Vec = matches + .values_of(options::PATTERN) + .unwrap() + .map(str::to_string) + .collect(); + let patterns = return_if_err!(1, patterns::get_patterns(&patterns[..])); let options = CsplitOptions::new(&matches); if file_name == "-" { let stdin = io::stdin(); From 9fbed0b07ae171f2bdddc7cd0837ec2329ae0e3c Mon Sep 17 00:00:00 2001 From: Sandro Date: Fri, 2 Apr 2021 22:18:31 +0200 Subject: [PATCH 571/606] makefile: replace all uutils with coreutils (#1815) Co-authored-by: Sylvestre Ledru --- GNUmakefile | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index c4c9cbe8b..409a527cd 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -30,7 +30,7 @@ ifneq ($(.SHELLSTATUS),0) override INSTALLDIR_MAN=$(DESTDIR)$(PREFIX)$(MANDIR) endif -#prefix to apply to uutils binary and all tool binaries +#prefix to apply to coreutils binary and all tool binaries PROG_PREFIX ?= # This won't support any directory with spaces in its name, but you can just @@ -237,7 +237,7 @@ EXES := \ INSTALLEES := ${EXES} ifeq (${MULTICALL}, y) -INSTALLEES := ${INSTALLEES} uutils +INSTALLEES := ${INSTALLEES} coreutils endif all: build @@ -250,13 +250,13 @@ ifneq (${MULTICALL}, y) ${CARGO} build ${CARGOFLAGS} ${PROFILE_CMD} $(foreach pkg,$(EXES),-p uu_$(pkg)) endif -build-uutils: +build-coreutils: ${CARGO} build ${CARGOFLAGS} --features "${EXES}" ${PROFILE_CMD} --no-default-features build-manpages: cd $(DOCSDIR) && $(MAKE) man -build: build-uutils build-pkgs build-manpages +build: build-coreutils build-pkgs build-manpages $(foreach test,$(filter-out $(SKIP_UTILS),$(PROGS)),$(eval $(call TEST_BUSYBOX,$(test)))) @@ -275,7 +275,7 @@ $(BUILDDIR)/.config: $(BASEDIR)/.busybox-config cp $< $@ # Test under the busybox testsuite -$(BUILDDIR)/busybox: busybox-src build-uutils $(BUILDDIR)/.config +$(BUILDDIR)/busybox: busybox-src build-coreutils $(BUILDDIR)/.config cp $(BUILDDIR)/coreutils $(BUILDDIR)/busybox; \ chmod +x $@; @@ -298,10 +298,10 @@ install: build mkdir -p $(INSTALLDIR_BIN) mkdir -p $(INSTALLDIR_MAN) ifeq (${MULTICALL}, y) - $(INSTALL) $(BUILDDIR)/uutils $(INSTALLDIR_BIN)/$(PROG_PREFIX)uutils - cd $(INSTALLDIR_BIN) && $(foreach prog, $(filter-out uutils, $(INSTALLEES)), \ - ln -fs $(PROG_PREFIX)uutils $(PROG_PREFIX)$(prog) &&) : - cat $(DOCSDIR)/_build/man/uutils.1 | gzip > $(INSTALLDIR_MAN)/$(PROG_PREFIX)uutils.1.gz + $(INSTALL) $(BUILDDIR)/coreutils $(INSTALLDIR_BIN)/$(PROG_PREFIX)coreutils + cd $(INSTALLDIR_BIN) && $(foreach prog, $(filter-out coreutils, $(INSTALLEES)), \ + ln -fs $(PROG_PREFIX)coreutils $(PROG_PREFIX)$(prog) &&) : + cat $(DOCSDIR)/_build/man/coreutils.1 | gzip > $(INSTALLDIR_MAN)/$(PROG_PREFIX)coreutils.1.gz else $(foreach prog, $(INSTALLEES), \ $(INSTALL) $(BUILDDIR)/$(prog) $(INSTALLDIR_BIN)/$(PROG_PREFIX)$(prog);) @@ -311,10 +311,10 @@ endif uninstall: ifeq (${MULTICALL}, y) - rm -f $(addprefix $(INSTALLDIR_BIN)/,$(PROG_PREFIX)uutils) + rm -f $(addprefix $(INSTALLDIR_BIN)/,$(PROG_PREFIX)coreutils) endif - rm -f $(addprefix $(INSTALLDIR_MAN)/,$(PROG_PREFIX)uutils.1.gz) + rm -f $(addprefix $(INSTALLDIR_MAN)/,$(PROG_PREFIX)coreutils.1.gz) rm -f $(addprefix $(INSTALLDIR_BIN)/$(PROG_PREFIX),$(PROGS)) rm -f $(addprefix $(INSTALLDIR_MAN)/$(PROG_PREFIX),$(addsuffix .1.gz,$(PROGS))) -.PHONY: all build build-uutils build-pkgs build-docs test distclean clean busytest install uninstall +.PHONY: all build build-coreutils build-pkgs build-docs test distclean clean busytest install uninstall From 31f566672768d941a74169a90476400a8d1cd212 Mon Sep 17 00:00:00 2001 From: Jamie Quigley Date: Fri, 2 Apr 2021 21:34:02 +0100 Subject: [PATCH 572/606] more: add error message if the argument is a directory (#1983) --- src/uu/more/src/more.rs | 12 ++++++++++-- tests/by-util/test_more.rs | 11 +++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 981b5f502..59e7d0faa 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -41,7 +41,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let matches = App::new(executable!()) .version(VERSION) - .usage(&usage[..]) + .usage(usage.as_str()) .about(ABOUT) .arg( Arg::with_name(options::FILE) @@ -52,10 +52,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { // FixME: fail without panic for now; but `more` should work with no arguments (ie, for piped input) if let None | Some("-") = matches.value_of(options::FILE) { - println!("{}: incorrect usage", executable!()); + show_usage_error!("Reading from stdin isn't supported yet."); return 1; } + if let Some(x) = matches.value_of(options::FILE) { + let path = std::path::Path::new(x); + if path.is_dir() { + show_usage_error!("'{}' is a directory.", x); + return 1; + } + } + more(matches); 0 diff --git a/tests/by-util/test_more.rs b/tests/by-util/test_more.rs index 3b7cfa9a8..736fb6956 100644 --- a/tests/by-util/test_more.rs +++ b/tests/by-util/test_more.rs @@ -6,3 +6,14 @@ fn test_more_no_arg() { let result = ucmd.run(); assert!(!result.success); } + +#[test] +fn test_more_dir_arg() { + let (_, mut ucmd) = at_and_ucmd!(); + ucmd.arg("."); + let result = ucmd.run(); + assert!(!result.success); + const EXPECTED_ERROR_MESSAGE: &str = + "more: '.' is a directory.\nTry 'more --help' for more information."; + assert_eq!(result.stderr.trim(), EXPECTED_ERROR_MESSAGE); +} From 14a49edd1cb9a841b390d796557e08d2b37d0039 Mon Sep 17 00:00:00 2001 From: est31 Date: Fri, 2 Apr 2021 23:30:07 +0200 Subject: [PATCH 573/606] Use Iterator::copied() in sieve.rs (#1774) --- src/uu/factor/sieve.rs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/uu/factor/sieve.rs b/src/uu/factor/sieve.rs index c10321a7f..083efb3ef 100644 --- a/src/uu/factor/sieve.rs +++ b/src/uu/factor/sieve.rs @@ -7,7 +7,7 @@ // spell-checker:ignore (ToDO) filts, minidx, minkey paridx -use std::iter::{Chain, Cycle, Map}; +use std::iter::{Chain, Cycle, Copied}; use std::slice::Iter; /// A lazy Sieve of Eratosthenes. @@ -68,27 +68,17 @@ impl Sieve { #[allow(dead_code)] #[inline] pub fn primes() -> PrimeSieve { - #[allow(clippy::trivially_copy_pass_by_ref)] - fn deref(x: &u64) -> u64 { - *x - } - let deref = deref as fn(&u64) -> u64; - INIT_PRIMES.iter().map(deref).chain(Sieve::new()) + INIT_PRIMES.iter().copied().chain(Sieve::new()) } #[allow(dead_code)] #[inline] pub fn odd_primes() -> PrimeSieve { - #[allow(clippy::trivially_copy_pass_by_ref)] - fn deref(x: &u64) -> u64 { - *x - } - let deref = deref as fn(&u64) -> u64; - (&INIT_PRIMES[1..]).iter().map(deref).chain(Sieve::new()) + (&INIT_PRIMES[1..]).iter().copied().chain(Sieve::new()) } } -pub type PrimeSieve = Chain, fn(&u64) -> u64>, Sieve>; +pub type PrimeSieve = Chain>, Sieve>; /// An iterator that generates an infinite list of numbers that are /// not divisible by any of 2, 3, 5, or 7. From 2ef1b25d856774c553624d5ed909a2f300445054 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 2 Apr 2021 22:22:50 +0200 Subject: [PATCH 574/606] Create a new job to test make build --- .github/workflows/CICD.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index f1ddf9be1..a1683ab83 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -181,6 +181,28 @@ jobs: cd tmp/busybox-*/testsuite S=$(bindir=$bindir ./runtest) && printf "%s\n" "$S" || { printf "%s\n" "$S" | grep "FAIL:" | sed -e "s/FAIL: /::warning ::Test failure:/g" ; } + makefile_build: + name: Test the build target of the Makefile + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + - { os: ubuntu-latest } + steps: + - uses: actions/checkout@v1 + - name: Install `rust` toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + profile: minimal # minimal component installation (ie, no documentation) + - name: "Run make build" + shell: bash + run: | + sudo apt-get -y update ; sudo apt-get -y install python3-sphinx; + make build + build: name: Build runs-on: ${{ matrix.job.os }} From f10de40ab8fe7159392a358d2c67b8ac7dc49b63 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 2 Apr 2021 22:27:11 +0200 Subject: [PATCH 575/606] refresh cargo.lock with recent updates --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 88984362b..8806588ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1668,7 +1668,7 @@ dependencies = [ name = "uu_csplit" version = "0.0.4" dependencies = [ - "getopts", + "clap", "glob 0.2.11", "regex", "thiserror", From 4d7ad7743323dc5197866f2ae1f142cc6687fa98 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 2 Apr 2021 23:31:22 +0200 Subject: [PATCH 576/606] rustfmt the recent change --- src/uu/factor/sieve.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/factor/sieve.rs b/src/uu/factor/sieve.rs index 083efb3ef..41893699b 100644 --- a/src/uu/factor/sieve.rs +++ b/src/uu/factor/sieve.rs @@ -7,7 +7,7 @@ // spell-checker:ignore (ToDO) filts, minidx, minkey paridx -use std::iter::{Chain, Cycle, Copied}; +use std::iter::{Chain, Copied, Cycle}; use std::slice::Iter; /// A lazy Sieve of Eratosthenes. From ac031dffa45fc3c3ca26538109965b3389986191 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 3 Apr 2021 10:28:12 +0200 Subject: [PATCH 577/606] new release 0.0.5 --- Cargo.lock | 196 ++++++++++++------------- Cargo.toml | 196 ++++++++++++------------- src/uu/arch/Cargo.toml | 4 +- src/uu/base32/Cargo.toml | 4 +- src/uu/base64/Cargo.toml | 4 +- src/uu/basename/Cargo.toml | 4 +- src/uu/cat/Cargo.toml | 4 +- src/uu/chgrp/Cargo.toml | 4 +- src/uu/chmod/Cargo.toml | 4 +- src/uu/chown/Cargo.toml | 4 +- src/uu/chroot/Cargo.toml | 4 +- src/uu/cksum/Cargo.toml | 4 +- src/uu/comm/Cargo.toml | 4 +- src/uu/cp/Cargo.toml | 4 +- src/uu/csplit/Cargo.toml | 4 +- src/uu/cut/Cargo.toml | 4 +- src/uu/date/Cargo.toml | 4 +- src/uu/df/Cargo.toml | 4 +- src/uu/dircolors/Cargo.toml | 4 +- src/uu/dirname/Cargo.toml | 4 +- src/uu/du/Cargo.toml | 4 +- src/uu/echo/Cargo.toml | 4 +- src/uu/env/Cargo.toml | 4 +- src/uu/expand/Cargo.toml | 4 +- src/uu/expr/Cargo.toml | 4 +- src/uu/factor/Cargo.toml | 4 +- src/uu/false/Cargo.toml | 4 +- src/uu/fmt/Cargo.toml | 4 +- src/uu/fold/Cargo.toml | 4 +- src/uu/groups/Cargo.toml | 4 +- src/uu/hashsum/Cargo.toml | 4 +- src/uu/head/Cargo.toml | 4 +- src/uu/hostid/Cargo.toml | 4 +- src/uu/hostname/Cargo.toml | 4 +- src/uu/id/Cargo.toml | 4 +- src/uu/install/Cargo.toml | 4 +- src/uu/join/Cargo.toml | 4 +- src/uu/kill/Cargo.toml | 4 +- src/uu/link/Cargo.toml | 4 +- src/uu/ln/Cargo.toml | 4 +- src/uu/logname/Cargo.toml | 4 +- src/uu/ls/Cargo.toml | 4 +- src/uu/mkdir/Cargo.toml | 4 +- src/uu/mkfifo/Cargo.toml | 4 +- src/uu/mknod/Cargo.toml | 4 +- src/uu/mktemp/Cargo.toml | 4 +- src/uu/more/Cargo.toml | 2 +- src/uu/mv/Cargo.toml | 4 +- src/uu/nice/Cargo.toml | 4 +- src/uu/nl/Cargo.toml | 4 +- src/uu/nohup/Cargo.toml | 4 +- src/uu/nproc/Cargo.toml | 4 +- src/uu/numfmt/Cargo.toml | 4 +- src/uu/od/Cargo.toml | 4 +- src/uu/paste/Cargo.toml | 4 +- src/uu/pathchk/Cargo.toml | 4 +- src/uu/pinky/Cargo.toml | 4 +- src/uu/printenv/Cargo.toml | 4 +- src/uu/printf/Cargo.toml | 4 +- src/uu/ptx/Cargo.toml | 4 +- src/uu/pwd/Cargo.toml | 4 +- src/uu/readlink/Cargo.toml | 4 +- src/uu/realpath/Cargo.toml | 4 +- src/uu/relpath/Cargo.toml | 4 +- src/uu/rm/Cargo.toml | 4 +- src/uu/rmdir/Cargo.toml | 4 +- src/uu/seq/Cargo.toml | 4 +- src/uu/shred/Cargo.toml | 4 +- src/uu/shuf/Cargo.toml | 4 +- src/uu/sleep/Cargo.toml | 4 +- src/uu/sort/Cargo.toml | 4 +- src/uu/split/Cargo.toml | 4 +- src/uu/stat/Cargo.toml | 4 +- src/uu/stdbuf/Cargo.toml | 6 +- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 4 +- src/uu/sum/Cargo.toml | 4 +- src/uu/sync/Cargo.toml | 4 +- src/uu/tac/Cargo.toml | 4 +- src/uu/tail/Cargo.toml | 4 +- src/uu/tee/Cargo.toml | 4 +- src/uu/test/Cargo.toml | 4 +- src/uu/timeout/Cargo.toml | 4 +- src/uu/touch/Cargo.toml | 4 +- src/uu/tr/Cargo.toml | 4 +- src/uu/true/Cargo.toml | 4 +- src/uu/truncate/Cargo.toml | 4 +- src/uu/tsort/Cargo.toml | 4 +- src/uu/tty/Cargo.toml | 4 +- src/uu/uname/Cargo.toml | 4 +- src/uu/unexpand/Cargo.toml | 4 +- src/uu/uniq/Cargo.toml | 4 +- src/uu/unlink/Cargo.toml | 4 +- src/uu/uptime/Cargo.toml | 4 +- src/uu/users/Cargo.toml | 4 +- src/uu/wc/Cargo.toml | 4 +- src/uu/who/Cargo.toml | 4 +- src/uu/whoami/Cargo.toml | 4 +- src/uu/yes/Cargo.toml | 4 +- src/uucore/Cargo.toml | 2 +- util/update-version.sh | 8 +- 100 files changed, 393 insertions(+), 393 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8806588ac..e5eb65a92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,7 +204,7 @@ dependencies = [ [[package]] name = "coreutils" -version = "0.0.4" +version = "0.0.5" dependencies = [ "conv", "filetime", @@ -1545,7 +1545,7 @@ dependencies = [ [[package]] name = "uu_arch" -version = "0.0.4" +version = "0.0.5" dependencies = [ "platform-info", "uucore", @@ -1554,7 +1554,7 @@ dependencies = [ [[package]] name = "uu_base32" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -1562,7 +1562,7 @@ dependencies = [ [[package]] name = "uu_base64" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -1570,7 +1570,7 @@ dependencies = [ [[package]] name = "uu_basename" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -1578,7 +1578,7 @@ dependencies = [ [[package]] name = "uu_cat" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "nix 0.20.0", @@ -1590,7 +1590,7 @@ dependencies = [ [[package]] name = "uu_chgrp" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -1599,7 +1599,7 @@ dependencies = [ [[package]] name = "uu_chmod" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1610,7 +1610,7 @@ dependencies = [ [[package]] name = "uu_chown" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "glob 0.3.0", @@ -1621,7 +1621,7 @@ dependencies = [ [[package]] name = "uu_chroot" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -1630,7 +1630,7 @@ dependencies = [ [[package]] name = "uu_cksum" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1640,7 +1640,7 @@ dependencies = [ [[package]] name = "uu_comm" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1650,7 +1650,7 @@ dependencies = [ [[package]] name = "uu_cp" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "filetime", @@ -1666,7 +1666,7 @@ dependencies = [ [[package]] name = "uu_csplit" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "glob 0.2.11", @@ -1678,7 +1678,7 @@ dependencies = [ [[package]] name = "uu_cut" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -1686,7 +1686,7 @@ dependencies = [ [[package]] name = "uu_date" -version = "0.0.4" +version = "0.0.5" dependencies = [ "chrono", "clap", @@ -1698,7 +1698,7 @@ dependencies = [ [[package]] name = "uu_df" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1710,7 +1710,7 @@ dependencies = [ [[package]] name = "uu_dircolors" -version = "0.0.4" +version = "0.0.5" dependencies = [ "glob 0.3.0", "uucore", @@ -1719,7 +1719,7 @@ dependencies = [ [[package]] name = "uu_dirname" -version = "0.0.4" +version = "0.0.5" dependencies = [ "libc", "uucore", @@ -1728,7 +1728,7 @@ dependencies = [ [[package]] name = "uu_du" -version = "0.0.4" +version = "0.0.5" dependencies = [ "time", "uucore", @@ -1738,7 +1738,7 @@ dependencies = [ [[package]] name = "uu_echo" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -1747,7 +1747,7 @@ dependencies = [ [[package]] name = "uu_env" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1758,7 +1758,7 @@ dependencies = [ [[package]] name = "uu_expand" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "unicode-width", @@ -1768,7 +1768,7 @@ dependencies = [ [[package]] name = "uu_expr" -version = "0.0.4" +version = "0.0.5" dependencies = [ "libc", "onig", @@ -1778,7 +1778,7 @@ dependencies = [ [[package]] name = "uu_factor" -version = "0.0.4" +version = "0.0.5" dependencies = [ "criterion", "num-traits", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "uu_false" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -1801,7 +1801,7 @@ dependencies = [ [[package]] name = "uu_fmt" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1812,7 +1812,7 @@ dependencies = [ [[package]] name = "uu_fold" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -1820,7 +1820,7 @@ dependencies = [ [[package]] name = "uu_groups" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -1829,7 +1829,7 @@ dependencies = [ [[package]] name = "uu_hashsum" -version = "0.0.4" +version = "0.0.5" dependencies = [ "blake2-rfc", "clap", @@ -1848,7 +1848,7 @@ dependencies = [ [[package]] name = "uu_head" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -1857,7 +1857,7 @@ dependencies = [ [[package]] name = "uu_hostid" -version = "0.0.4" +version = "0.0.5" dependencies = [ "libc", "uucore", @@ -1866,7 +1866,7 @@ dependencies = [ [[package]] name = "uu_hostname" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "hostname", @@ -1878,7 +1878,7 @@ dependencies = [ [[package]] name = "uu_id" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -1887,7 +1887,7 @@ dependencies = [ [[package]] name = "uu_install" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "file_diff", @@ -1900,7 +1900,7 @@ dependencies = [ [[package]] name = "uu_join" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -1909,7 +1909,7 @@ dependencies = [ [[package]] name = "uu_kill" -version = "0.0.4" +version = "0.0.5" dependencies = [ "libc", "uucore", @@ -1918,7 +1918,7 @@ dependencies = [ [[package]] name = "uu_link" -version = "0.0.4" +version = "0.0.5" dependencies = [ "libc", "uucore", @@ -1927,7 +1927,7 @@ dependencies = [ [[package]] name = "uu_ln" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1937,7 +1937,7 @@ dependencies = [ [[package]] name = "uu_logname" -version = "0.0.4" +version = "0.0.5" dependencies = [ "libc", "uucore", @@ -1946,7 +1946,7 @@ dependencies = [ [[package]] name = "uu_ls" -version = "0.0.4" +version = "0.0.5" dependencies = [ "atty", "clap", @@ -1962,7 +1962,7 @@ dependencies = [ [[package]] name = "uu_mkdir" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1972,7 +1972,7 @@ dependencies = [ [[package]] name = "uu_mkfifo" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -1982,7 +1982,7 @@ dependencies = [ [[package]] name = "uu_mknod" -version = "0.0.4" +version = "0.0.5" dependencies = [ "getopts", "libc", @@ -1992,7 +1992,7 @@ dependencies = [ [[package]] name = "uu_mktemp" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "rand 0.5.6", @@ -2003,7 +2003,7 @@ dependencies = [ [[package]] name = "uu_more" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "nix 0.13.1", @@ -2015,7 +2015,7 @@ dependencies = [ [[package]] name = "uu_mv" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "fs_extra", @@ -2025,7 +2025,7 @@ dependencies = [ [[package]] name = "uu_nice" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2036,7 +2036,7 @@ dependencies = [ [[package]] name = "uu_nl" -version = "0.0.4" +version = "0.0.5" dependencies = [ "aho-corasick", "clap", @@ -2050,7 +2050,7 @@ dependencies = [ [[package]] name = "uu_nohup" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2060,7 +2060,7 @@ dependencies = [ [[package]] name = "uu_nproc" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2071,7 +2071,7 @@ dependencies = [ [[package]] name = "uu_numfmt" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2080,7 +2080,7 @@ dependencies = [ [[package]] name = "uu_od" -version = "0.0.4" +version = "0.0.5" dependencies = [ "byteorder", "clap", @@ -2092,7 +2092,7 @@ dependencies = [ [[package]] name = "uu_paste" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2101,7 +2101,7 @@ dependencies = [ [[package]] name = "uu_pathchk" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2111,7 +2111,7 @@ dependencies = [ [[package]] name = "uu_pinky" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -2119,7 +2119,7 @@ dependencies = [ [[package]] name = "uu_printenv" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2128,7 +2128,7 @@ dependencies = [ [[package]] name = "uu_printf" -version = "0.0.4" +version = "0.0.5" dependencies = [ "itertools 0.8.2", "uucore", @@ -2137,7 +2137,7 @@ dependencies = [ [[package]] name = "uu_ptx" -version = "0.0.4" +version = "0.0.5" dependencies = [ "aho-corasick", "clap", @@ -2151,7 +2151,7 @@ dependencies = [ [[package]] name = "uu_pwd" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2160,7 +2160,7 @@ dependencies = [ [[package]] name = "uu_readlink" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2170,7 +2170,7 @@ dependencies = [ [[package]] name = "uu_realpath" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2179,7 +2179,7 @@ dependencies = [ [[package]] name = "uu_relpath" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2188,7 +2188,7 @@ dependencies = [ [[package]] name = "uu_rm" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "remove_dir_all", @@ -2199,7 +2199,7 @@ dependencies = [ [[package]] name = "uu_rmdir" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2208,7 +2208,7 @@ dependencies = [ [[package]] name = "uu_seq" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2217,7 +2217,7 @@ dependencies = [ [[package]] name = "uu_shred" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "filetime", @@ -2230,7 +2230,7 @@ dependencies = [ [[package]] name = "uu_shuf" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "rand 0.5.6", @@ -2240,7 +2240,7 @@ dependencies = [ [[package]] name = "uu_sleep" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2249,7 +2249,7 @@ dependencies = [ [[package]] name = "uu_sort" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "itertools 0.8.2", @@ -2262,7 +2262,7 @@ dependencies = [ [[package]] name = "uu_split" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2271,7 +2271,7 @@ dependencies = [ [[package]] name = "uu_stat" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "time", @@ -2281,7 +2281,7 @@ dependencies = [ [[package]] name = "uu_stdbuf" -version = "0.0.4" +version = "0.0.5" dependencies = [ "getopts", "tempfile", @@ -2292,7 +2292,7 @@ dependencies = [ [[package]] name = "uu_stdbuf_libstdbuf" -version = "0.0.4" +version = "0.0.5" dependencies = [ "cpp", "cpp_build", @@ -2303,7 +2303,7 @@ dependencies = [ [[package]] name = "uu_sum" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2312,7 +2312,7 @@ dependencies = [ [[package]] name = "uu_sync" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2323,7 +2323,7 @@ dependencies = [ [[package]] name = "uu_tac" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2332,7 +2332,7 @@ dependencies = [ [[package]] name = "uu_tail" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2344,7 +2344,7 @@ dependencies = [ [[package]] name = "uu_tee" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2355,7 +2355,7 @@ dependencies = [ [[package]] name = "uu_test" -version = "0.0.4" +version = "0.0.5" dependencies = [ "libc", "redox_syscall 0.1.57", @@ -2365,7 +2365,7 @@ dependencies = [ [[package]] name = "uu_timeout" -version = "0.0.4" +version = "0.0.5" dependencies = [ "getopts", "libc", @@ -2375,7 +2375,7 @@ dependencies = [ [[package]] name = "uu_touch" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "filetime", @@ -2386,7 +2386,7 @@ dependencies = [ [[package]] name = "uu_tr" -version = "0.0.4" +version = "0.0.5" dependencies = [ "bit-set", "clap", @@ -2397,7 +2397,7 @@ dependencies = [ [[package]] name = "uu_true" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -2405,7 +2405,7 @@ dependencies = [ [[package]] name = "uu_truncate" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2414,7 +2414,7 @@ dependencies = [ [[package]] name = "uu_tsort" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2423,7 +2423,7 @@ dependencies = [ [[package]] name = "uu_tty" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2433,7 +2433,7 @@ dependencies = [ [[package]] name = "uu_uname" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "platform-info", @@ -2443,7 +2443,7 @@ dependencies = [ [[package]] name = "uu_unexpand" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "unicode-width", @@ -2453,7 +2453,7 @@ dependencies = [ [[package]] name = "uu_uniq" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2462,7 +2462,7 @@ dependencies = [ [[package]] name = "uu_unlink" -version = "0.0.4" +version = "0.0.5" dependencies = [ "getopts", "libc", @@ -2472,7 +2472,7 @@ dependencies = [ [[package]] name = "uu_uptime" -version = "0.0.4" +version = "0.0.5" dependencies = [ "chrono", "clap", @@ -2482,7 +2482,7 @@ dependencies = [ [[package]] name = "uu_users" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2491,7 +2491,7 @@ dependencies = [ [[package]] name = "uu_wc" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "libc", @@ -2503,7 +2503,7 @@ dependencies = [ [[package]] name = "uu_who" -version = "0.0.4" +version = "0.0.5" dependencies = [ "uucore", "uucore_procs", @@ -2511,7 +2511,7 @@ dependencies = [ [[package]] name = "uu_whoami" -version = "0.0.4" +version = "0.0.5" dependencies = [ "advapi32-sys", "clap", @@ -2522,7 +2522,7 @@ dependencies = [ [[package]] name = "uu_yes" -version = "0.0.4" +version = "0.0.5" dependencies = [ "clap", "uucore", @@ -2531,7 +2531,7 @@ dependencies = [ [[package]] name = "uucore" -version = "0.0.7" +version = "0.0.8" dependencies = [ "data-encoding", "dunce", diff --git a/Cargo.toml b/Cargo.toml index 1562fcfb0..398791ca9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "coreutils" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "coreutils ~ GNU coreutils (updated); implemented as universal (cross-platform) utils, written in Rust" @@ -226,104 +226,104 @@ test = [ "uu_test" ] [dependencies] lazy_static = { version="1.3" } textwrap = { version="=0.11.0", features=["term_size"] } # !maint: [2020-05-10; rivy] unstable crate using undocumented features; pinned currently, will review -uucore = { version=">=0.0.7", package="uucore", path="src/uucore" } +uucore = { version=">=0.0.8", package="uucore", path="src/uucore" } # * uutils -uu_test = { optional=true, version="0.0.4", package="uu_test", path="src/uu/test" } +uu_test = { optional=true, version="0.0.5", package="uu_test", path="src/uu/test" } # -arch = { optional=true, version="0.0.4", package="uu_arch", path="src/uu/arch" } -base32 = { optional=true, version="0.0.4", package="uu_base32", path="src/uu/base32" } -base64 = { optional=true, version="0.0.4", package="uu_base64", path="src/uu/base64" } -basename = { optional=true, version="0.0.4", package="uu_basename", path="src/uu/basename" } -cat = { optional=true, version="0.0.4", package="uu_cat", path="src/uu/cat" } -chgrp = { optional=true, version="0.0.4", package="uu_chgrp", path="src/uu/chgrp" } -chmod = { optional=true, version="0.0.4", package="uu_chmod", path="src/uu/chmod" } -chown = { optional=true, version="0.0.4", package="uu_chown", path="src/uu/chown" } -chroot = { optional=true, version="0.0.4", package="uu_chroot", path="src/uu/chroot" } -cksum = { optional=true, version="0.0.4", package="uu_cksum", path="src/uu/cksum" } -comm = { optional=true, version="0.0.4", package="uu_comm", path="src/uu/comm" } -cp = { optional=true, version="0.0.4", package="uu_cp", path="src/uu/cp" } -csplit = { optional=true, version="0.0.4", package="uu_csplit", path="src/uu/csplit" } -cut = { optional=true, version="0.0.4", package="uu_cut", path="src/uu/cut" } -date = { optional=true, version="0.0.4", package="uu_date", path="src/uu/date" } -df = { optional=true, version="0.0.4", package="uu_df", path="src/uu/df" } -dircolors= { optional=true, version="0.0.4", package="uu_dircolors", path="src/uu/dircolors" } -dirname = { optional=true, version="0.0.4", package="uu_dirname", path="src/uu/dirname" } -du = { optional=true, version="0.0.4", package="uu_du", path="src/uu/du" } -echo = { optional=true, version="0.0.4", package="uu_echo", path="src/uu/echo" } -env = { optional=true, version="0.0.4", package="uu_env", path="src/uu/env" } -expand = { optional=true, version="0.0.4", package="uu_expand", path="src/uu/expand" } -expr = { optional=true, version="0.0.4", package="uu_expr", path="src/uu/expr" } -factor = { optional=true, version="0.0.4", package="uu_factor", path="src/uu/factor" } -false = { optional=true, version="0.0.4", package="uu_false", path="src/uu/false" } -fmt = { optional=true, version="0.0.4", package="uu_fmt", path="src/uu/fmt" } -fold = { optional=true, version="0.0.4", package="uu_fold", path="src/uu/fold" } -groups = { optional=true, version="0.0.4", package="uu_groups", path="src/uu/groups" } -hashsum = { optional=true, version="0.0.4", package="uu_hashsum", path="src/uu/hashsum" } -head = { optional=true, version="0.0.4", package="uu_head", path="src/uu/head" } -hostid = { optional=true, version="0.0.4", package="uu_hostid", path="src/uu/hostid" } -hostname = { optional=true, version="0.0.4", package="uu_hostname", path="src/uu/hostname" } -id = { optional=true, version="0.0.4", package="uu_id", path="src/uu/id" } -install = { optional=true, version="0.0.4", package="uu_install", path="src/uu/install" } -join = { optional=true, version="0.0.4", package="uu_join", path="src/uu/join" } -kill = { optional=true, version="0.0.4", package="uu_kill", path="src/uu/kill" } -link = { optional=true, version="0.0.4", package="uu_link", path="src/uu/link" } -ln = { optional=true, version="0.0.4", package="uu_ln", path="src/uu/ln" } -ls = { optional=true, version="0.0.4", package="uu_ls", path="src/uu/ls" } -logname = { optional=true, version="0.0.4", package="uu_logname", path="src/uu/logname" } -mkdir = { optional=true, version="0.0.4", package="uu_mkdir", path="src/uu/mkdir" } -mkfifo = { optional=true, version="0.0.4", package="uu_mkfifo", path="src/uu/mkfifo" } -mknod = { optional=true, version="0.0.4", package="uu_mknod", path="src/uu/mknod" } -mktemp = { optional=true, version="0.0.4", package="uu_mktemp", path="src/uu/mktemp" } -more = { optional=true, version="0.0.4", package="uu_more", path="src/uu/more" } -mv = { optional=true, version="0.0.4", package="uu_mv", path="src/uu/mv" } -nice = { optional=true, version="0.0.4", package="uu_nice", path="src/uu/nice" } -nl = { optional=true, version="0.0.4", package="uu_nl", path="src/uu/nl" } -nohup = { optional=true, version="0.0.4", package="uu_nohup", path="src/uu/nohup" } -nproc = { optional=true, version="0.0.4", package="uu_nproc", path="src/uu/nproc" } -numfmt = { optional=true, version="0.0.4", package="uu_numfmt", path="src/uu/numfmt" } -od = { optional=true, version="0.0.4", package="uu_od", path="src/uu/od" } -paste = { optional=true, version="0.0.4", package="uu_paste", path="src/uu/paste" } -pathchk = { optional=true, version="0.0.4", package="uu_pathchk", path="src/uu/pathchk" } -pinky = { optional=true, version="0.0.4", package="uu_pinky", path="src/uu/pinky" } -printenv = { optional=true, version="0.0.4", package="uu_printenv", path="src/uu/printenv" } -printf = { optional=true, version="0.0.4", package="uu_printf", path="src/uu/printf" } -ptx = { optional=true, version="0.0.4", package="uu_ptx", path="src/uu/ptx" } -pwd = { optional=true, version="0.0.4", package="uu_pwd", path="src/uu/pwd" } -readlink = { optional=true, version="0.0.4", package="uu_readlink", path="src/uu/readlink" } -realpath = { optional=true, version="0.0.4", package="uu_realpath", path="src/uu/realpath" } -relpath = { optional=true, version="0.0.4", package="uu_relpath", path="src/uu/relpath" } -rm = { optional=true, version="0.0.4", package="uu_rm", path="src/uu/rm" } -rmdir = { optional=true, version="0.0.4", package="uu_rmdir", path="src/uu/rmdir" } -seq = { optional=true, version="0.0.4", package="uu_seq", path="src/uu/seq" } -shred = { optional=true, version="0.0.4", package="uu_shred", path="src/uu/shred" } -shuf = { optional=true, version="0.0.4", package="uu_shuf", path="src/uu/shuf" } -sleep = { optional=true, version="0.0.4", package="uu_sleep", path="src/uu/sleep" } -sort = { optional=true, version="0.0.4", package="uu_sort", path="src/uu/sort" } -split = { optional=true, version="0.0.4", package="uu_split", path="src/uu/split" } -stat = { optional=true, version="0.0.4", package="uu_stat", path="src/uu/stat" } -stdbuf = { optional=true, version="0.0.4", package="uu_stdbuf", path="src/uu/stdbuf" } -sum = { optional=true, version="0.0.4", package="uu_sum", path="src/uu/sum" } -sync = { optional=true, version="0.0.4", package="uu_sync", path="src/uu/sync" } -tac = { optional=true, version="0.0.4", package="uu_tac", path="src/uu/tac" } -tail = { optional=true, version="0.0.4", package="uu_tail", path="src/uu/tail" } -tee = { optional=true, version="0.0.4", package="uu_tee", path="src/uu/tee" } -timeout = { optional=true, version="0.0.4", package="uu_timeout", path="src/uu/timeout" } -touch = { optional=true, version="0.0.4", package="uu_touch", path="src/uu/touch" } -tr = { optional=true, version="0.0.4", package="uu_tr", path="src/uu/tr" } -true = { optional=true, version="0.0.4", package="uu_true", path="src/uu/true" } -truncate = { optional=true, version="0.0.4", package="uu_truncate", path="src/uu/truncate" } -tsort = { optional=true, version="0.0.4", package="uu_tsort", path="src/uu/tsort" } -tty = { optional=true, version="0.0.4", package="uu_tty", path="src/uu/tty" } -uname = { optional=true, version="0.0.4", package="uu_uname", path="src/uu/uname" } -unexpand = { optional=true, version="0.0.4", package="uu_unexpand", path="src/uu/unexpand" } -uniq = { optional=true, version="0.0.4", package="uu_uniq", path="src/uu/uniq" } -unlink = { optional=true, version="0.0.4", package="uu_unlink", path="src/uu/unlink" } -uptime = { optional=true, version="0.0.4", package="uu_uptime", path="src/uu/uptime" } -users = { optional=true, version="0.0.4", package="uu_users", path="src/uu/users" } -wc = { optional=true, version="0.0.4", package="uu_wc", path="src/uu/wc" } -who = { optional=true, version="0.0.4", package="uu_who", path="src/uu/who" } -whoami = { optional=true, version="0.0.4", package="uu_whoami", path="src/uu/whoami" } -yes = { optional=true, version="0.0.4", package="uu_yes", path="src/uu/yes" } +arch = { optional=true, version="0.0.5", package="uu_arch", path="src/uu/arch" } +base32 = { optional=true, version="0.0.5", package="uu_base32", path="src/uu/base32" } +base64 = { optional=true, version="0.0.5", package="uu_base64", path="src/uu/base64" } +basename = { optional=true, version="0.0.5", package="uu_basename", path="src/uu/basename" } +cat = { optional=true, version="0.0.5", package="uu_cat", path="src/uu/cat" } +chgrp = { optional=true, version="0.0.5", package="uu_chgrp", path="src/uu/chgrp" } +chmod = { optional=true, version="0.0.5", package="uu_chmod", path="src/uu/chmod" } +chown = { optional=true, version="0.0.5", package="uu_chown", path="src/uu/chown" } +chroot = { optional=true, version="0.0.5", package="uu_chroot", path="src/uu/chroot" } +cksum = { optional=true, version="0.0.5", package="uu_cksum", path="src/uu/cksum" } +comm = { optional=true, version="0.0.5", package="uu_comm", path="src/uu/comm" } +cp = { optional=true, version="0.0.5", package="uu_cp", path="src/uu/cp" } +csplit = { optional=true, version="0.0.5", package="uu_csplit", path="src/uu/csplit" } +cut = { optional=true, version="0.0.5", package="uu_cut", path="src/uu/cut" } +date = { optional=true, version="0.0.5", package="uu_date", path="src/uu/date" } +df = { optional=true, version="0.0.5", package="uu_df", path="src/uu/df" } +dircolors= { optional=true, version="0.0.5", package="uu_dircolors", path="src/uu/dircolors" } +dirname = { optional=true, version="0.0.5", package="uu_dirname", path="src/uu/dirname" } +du = { optional=true, version="0.0.5", package="uu_du", path="src/uu/du" } +echo = { optional=true, version="0.0.5", package="uu_echo", path="src/uu/echo" } +env = { optional=true, version="0.0.5", package="uu_env", path="src/uu/env" } +expand = { optional=true, version="0.0.5", package="uu_expand", path="src/uu/expand" } +expr = { optional=true, version="0.0.5", package="uu_expr", path="src/uu/expr" } +factor = { optional=true, version="0.0.5", package="uu_factor", path="src/uu/factor" } +false = { optional=true, version="0.0.5", package="uu_false", path="src/uu/false" } +fmt = { optional=true, version="0.0.5", package="uu_fmt", path="src/uu/fmt" } +fold = { optional=true, version="0.0.5", package="uu_fold", path="src/uu/fold" } +groups = { optional=true, version="0.0.5", package="uu_groups", path="src/uu/groups" } +hashsum = { optional=true, version="0.0.5", package="uu_hashsum", path="src/uu/hashsum" } +head = { optional=true, version="0.0.5", package="uu_head", path="src/uu/head" } +hostid = { optional=true, version="0.0.5", package="uu_hostid", path="src/uu/hostid" } +hostname = { optional=true, version="0.0.5", package="uu_hostname", path="src/uu/hostname" } +id = { optional=true, version="0.0.5", package="uu_id", path="src/uu/id" } +install = { optional=true, version="0.0.5", package="uu_install", path="src/uu/install" } +join = { optional=true, version="0.0.5", package="uu_join", path="src/uu/join" } +kill = { optional=true, version="0.0.5", package="uu_kill", path="src/uu/kill" } +link = { optional=true, version="0.0.5", package="uu_link", path="src/uu/link" } +ln = { optional=true, version="0.0.5", package="uu_ln", path="src/uu/ln" } +ls = { optional=true, version="0.0.5", package="uu_ls", path="src/uu/ls" } +logname = { optional=true, version="0.0.5", package="uu_logname", path="src/uu/logname" } +mkdir = { optional=true, version="0.0.5", package="uu_mkdir", path="src/uu/mkdir" } +mkfifo = { optional=true, version="0.0.5", package="uu_mkfifo", path="src/uu/mkfifo" } +mknod = { optional=true, version="0.0.5", package="uu_mknod", path="src/uu/mknod" } +mktemp = { optional=true, version="0.0.5", package="uu_mktemp", path="src/uu/mktemp" } +more = { optional=true, version="0.0.5", package="uu_more", path="src/uu/more" } +mv = { optional=true, version="0.0.5", package="uu_mv", path="src/uu/mv" } +nice = { optional=true, version="0.0.5", package="uu_nice", path="src/uu/nice" } +nl = { optional=true, version="0.0.5", package="uu_nl", path="src/uu/nl" } +nohup = { optional=true, version="0.0.5", package="uu_nohup", path="src/uu/nohup" } +nproc = { optional=true, version="0.0.5", package="uu_nproc", path="src/uu/nproc" } +numfmt = { optional=true, version="0.0.5", package="uu_numfmt", path="src/uu/numfmt" } +od = { optional=true, version="0.0.5", package="uu_od", path="src/uu/od" } +paste = { optional=true, version="0.0.5", package="uu_paste", path="src/uu/paste" } +pathchk = { optional=true, version="0.0.5", package="uu_pathchk", path="src/uu/pathchk" } +pinky = { optional=true, version="0.0.5", package="uu_pinky", path="src/uu/pinky" } +printenv = { optional=true, version="0.0.5", package="uu_printenv", path="src/uu/printenv" } +printf = { optional=true, version="0.0.5", package="uu_printf", path="src/uu/printf" } +ptx = { optional=true, version="0.0.5", package="uu_ptx", path="src/uu/ptx" } +pwd = { optional=true, version="0.0.5", package="uu_pwd", path="src/uu/pwd" } +readlink = { optional=true, version="0.0.5", package="uu_readlink", path="src/uu/readlink" } +realpath = { optional=true, version="0.0.5", package="uu_realpath", path="src/uu/realpath" } +relpath = { optional=true, version="0.0.5", package="uu_relpath", path="src/uu/relpath" } +rm = { optional=true, version="0.0.5", package="uu_rm", path="src/uu/rm" } +rmdir = { optional=true, version="0.0.5", package="uu_rmdir", path="src/uu/rmdir" } +seq = { optional=true, version="0.0.5", package="uu_seq", path="src/uu/seq" } +shred = { optional=true, version="0.0.5", package="uu_shred", path="src/uu/shred" } +shuf = { optional=true, version="0.0.5", package="uu_shuf", path="src/uu/shuf" } +sleep = { optional=true, version="0.0.5", package="uu_sleep", path="src/uu/sleep" } +sort = { optional=true, version="0.0.5", package="uu_sort", path="src/uu/sort" } +split = { optional=true, version="0.0.5", package="uu_split", path="src/uu/split" } +stat = { optional=true, version="0.0.5", package="uu_stat", path="src/uu/stat" } +stdbuf = { optional=true, version="0.0.5", package="uu_stdbuf", path="src/uu/stdbuf" } +sum = { optional=true, version="0.0.5", package="uu_sum", path="src/uu/sum" } +sync = { optional=true, version="0.0.5", package="uu_sync", path="src/uu/sync" } +tac = { optional=true, version="0.0.5", package="uu_tac", path="src/uu/tac" } +tail = { optional=true, version="0.0.5", package="uu_tail", path="src/uu/tail" } +tee = { optional=true, version="0.0.5", package="uu_tee", path="src/uu/tee" } +timeout = { optional=true, version="0.0.5", package="uu_timeout", path="src/uu/timeout" } +touch = { optional=true, version="0.0.5", package="uu_touch", path="src/uu/touch" } +tr = { optional=true, version="0.0.5", package="uu_tr", path="src/uu/tr" } +true = { optional=true, version="0.0.5", package="uu_true", path="src/uu/true" } +truncate = { optional=true, version="0.0.5", package="uu_truncate", path="src/uu/truncate" } +tsort = { optional=true, version="0.0.5", package="uu_tsort", path="src/uu/tsort" } +tty = { optional=true, version="0.0.5", package="uu_tty", path="src/uu/tty" } +uname = { optional=true, version="0.0.5", package="uu_uname", path="src/uu/uname" } +unexpand = { optional=true, version="0.0.5", package="uu_unexpand", path="src/uu/unexpand" } +uniq = { optional=true, version="0.0.5", package="uu_uniq", path="src/uu/uniq" } +unlink = { optional=true, version="0.0.5", package="uu_unlink", path="src/uu/unlink" } +uptime = { optional=true, version="0.0.5", package="uu_uptime", path="src/uu/uptime" } +users = { optional=true, version="0.0.5", package="uu_users", path="src/uu/users" } +wc = { optional=true, version="0.0.5", package="uu_wc", path="src/uu/wc" } +who = { optional=true, version="0.0.5", package="uu_who", path="src/uu/who" } +whoami = { optional=true, version="0.0.5", package="uu_whoami", path="src/uu/whoami" } +yes = { optional=true, version="0.0.5", package="uu_yes", path="src/uu/yes" } # # * pinned transitive dependencies # Not needed for now. Keep as examples: @@ -343,7 +343,7 @@ sha1 = { version="0.6", features=["std"] } tempfile = "= 3.1.0" time = "0.1" unindent = "0.1" -uucore = { version=">=0.0.7", package="uucore", path="src/uucore", features=["entries"] } +uucore = { version=">=0.0.8", package="uucore", path="src/uucore", features=["entries"] } walkdir = "2.2" tempdir = "0.3" diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index 4ca0fbda7..e23067788 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_arch" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "arch ~ (uutils) display machine architecture" @@ -16,7 +16,7 @@ path = "src/arch.rs" [dependencies] platform-info = "0.1" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index 0abb718c8..d4415dd8c 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base32" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "base32 ~ (uutils) decode/encode input (base32-encoding)" @@ -15,7 +15,7 @@ edition = "2018" path = "src/base32.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features = ["encoding"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features = ["encoding"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index eef9b1ec3..e893caf3a 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base64" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "base64 ~ (uutils) decode/encode input (base64-encoding)" @@ -15,7 +15,7 @@ edition = "2018" path = "src/base64.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features = ["encoding"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features = ["encoding"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index 218d9eb08..681ccf1c4 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_basename" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "basename ~ (uutils) display PATHNAME with leading directory components removed" @@ -15,7 +15,7 @@ edition = "2018" path = "src/basename.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 3878aee96..25119dcfc 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cat" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "cat ~ (uutils) concatenate and display input" @@ -17,7 +17,7 @@ path = "src/cat.rs" [dependencies] clap = "2.33" thiserror = "1.0" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index 60f9d6370..2cefca4d8 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chgrp" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "chgrp ~ (uutils) change the group ownership of FILE" @@ -15,7 +15,7 @@ edition = "2018" path = "src/chgrp.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index d4917b525..71ded6d90 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chmod" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "chmod ~ (uutils) change mode of FILE" @@ -17,7 +17,7 @@ path = "src/chmod.rs" [dependencies] clap = "2.33.3" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs", "mode"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs", "mode"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index f2d21ef88..27a30da17 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chown" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "chown ~ (uutils) change the ownership of FILE" @@ -17,7 +17,7 @@ path = "src/chown.rs" [dependencies] clap = "2.33" glob = "0.3.0" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index e967d4137..51fb9541d 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chroot" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "chroot ~ (uutils) run COMMAND under a new root directory" @@ -16,7 +16,7 @@ path = "src/chroot.rs" [dependencies] clap= "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index b7ac630f0..2f589e877 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cksum" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "cksum ~ (uutils) display CRC and size of input" @@ -17,7 +17,7 @@ path = "src/cksum.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index a0dc4e06f..9babe82ea 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_comm" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "comm ~ (uutils) compare sorted inputs" @@ -17,7 +17,7 @@ path = "src/comm.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index a0253433f..53d27137f 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cp" -version = "0.0.4" +version = "0.0.5" authors = [ "Jordy Dickinson ", "Joshua S. Miller ", @@ -23,7 +23,7 @@ clap = "2.33" filetime = "0.2" libc = "0.2.85" quick-error = "1.2.3" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } walkdir = "2.2" diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index 7cec4564b..a5eac1a02 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_csplit" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "csplit ~ (uutils) Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output" @@ -19,7 +19,7 @@ clap = "2.33" thiserror = "1.0" regex = "1.0.0" glob = "0.2.11" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index 71f7c3f6a..10a282ecf 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cut" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "cut ~ (uutils) display byte/field columns of input lines" @@ -15,7 +15,7 @@ edition = "2018" path = "src/cut.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index c62cfe2b3..cacf29ff0 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_date" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "date ~ (uutils) display or set the current time" @@ -17,7 +17,7 @@ path = "src/date.rs" [dependencies] chrono = "0.4.4" clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 24fce763b..049422ce5 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_df" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "df ~ (uutils) display file system information" @@ -18,7 +18,7 @@ path = "src/df.rs" clap = "2.33" libc = "0.2" number_prefix = "0.4" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index 667fc3b70..9ed55d20d 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dircolors" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "dircolors ~ (uutils) display commands to set LS_COLORS" @@ -16,7 +16,7 @@ path = "src/dircolors.rs" [dependencies] glob = "0.3.0" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index 9c565a3e6..575aefd51 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dirname" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "dirname ~ (uutils) display parent directory of PATHNAME" @@ -16,7 +16,7 @@ path = "src/dirname.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index bb46c299c..01045f887 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_du" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "du ~ (uutils) display disk usage" @@ -16,7 +16,7 @@ path = "src/du.rs" [dependencies] time = "0.1.40" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=[] } diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index 7b831fcb8..2ac09cd39 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_echo" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "echo ~ (uutils) display TEXT" @@ -16,7 +16,7 @@ path = "src/echo.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index 864ecd1b2..fc5317184 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_env" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "env ~ (uutils) set each NAME to VALUE in the environment and run COMMAND" @@ -18,7 +18,7 @@ path = "src/env.rs" clap = "2.33" libc = "0.2.42" rust-ini = "0.13.0" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index b5c0343e7..09575254a 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expand" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "expand ~ (uutils) convert input tabs to spaces" @@ -17,7 +17,7 @@ path = "src/expand.rs" [dependencies] clap = "2.33" unicode-width = "0.1.5" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index 1246ff873..7e38103aa 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expr" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "expr ~ (uutils) display the value of EXPRESSION" @@ -17,7 +17,7 @@ path = "src/expr.rs" [dependencies] libc = "0.2.42" onig = "~4.3.2" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index d1160c493..1d415a951 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_factor" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "factor ~ (uutils) display the prime factors of each NUMBER" @@ -19,7 +19,7 @@ num-traits = "0.2.13" # used in src/numerics.rs, which is included by build.rs num-traits = "0.2.13" # Needs at least version 0.2.13 for "OverflowingAdd" rand = { version="0.7", features=["small_rng"] } smallvec = { version="0.6.14, < 1.0" } -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index 413cbc990..5651888d7 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_false" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "false ~ (uutils) do nothing and fail" @@ -15,7 +15,7 @@ edition = "2018" path = "src/false.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index e150b2962..688967a5a 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fmt" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "fmt ~ (uutils) reformat each paragraph of input" @@ -18,7 +18,7 @@ path = "src/fmt.rs" clap = "2.33" libc = "0.2.42" unicode-width = "0.1.5" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index 23dadc8eb..de1aa2dd5 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fold" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "fold ~ (uutils) wrap each line of input" @@ -15,7 +15,7 @@ edition = "2018" path = "src/fold.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index 455e2d224..d005599de 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_groups" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "groups ~ (uutils) display group memberships for USERNAME" @@ -15,7 +15,7 @@ edition = "2018" path = "src/groups.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } clap = "2.33" diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index c9bb4da9f..b08b853ef 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hashsum" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "hashsum ~ (uutils) display or check input digests" @@ -26,7 +26,7 @@ sha1 = "0.6.0" sha2 = "0.6.0" sha3 = "0.6.0" blake2-rfc = "0.2.18" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index 1cd075113..2f5d97d62 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_head" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "head ~ (uutils) display the first lines of input" @@ -16,7 +16,7 @@ path = "src/head.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index b3870652e..e872aff06 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostid" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "hostid ~ (uutils) display the numeric identifier of the current host" @@ -16,7 +16,7 @@ path = "src/hostid.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index 75b9b5f9a..bc4b10951 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostname" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "hostname ~ (uutils) display or set the host name of the current host" @@ -18,7 +18,7 @@ path = "src/hostname.rs" clap = "2.33" libc = "0.2.42" hostname = { version = "0.3", features = ["set"] } -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["wide"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["wide"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=["sysinfoapi", "winsock2"] } diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index 46e5cb578..6edb1d606 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_id" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "id ~ (uutils) display user and group information for USER" @@ -16,7 +16,7 @@ path = "src/id.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "process"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "process"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 5aec0b07c..16f78bb7b 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_install" -version = "0.0.4" +version = "0.0.5" authors = [ "Ben Eills ", "uutils developers", @@ -22,7 +22,7 @@ clap = "2.33" filetime = "0.2" file_diff = "1.0.0" libc = ">= 0.2" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["mode", "perms", "entries"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["mode", "perms", "entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [dev-dependencies] diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index d02703a62..5b18603ab 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_join" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "join ~ (uutils) merge lines from inputs with matching join fields" @@ -16,7 +16,7 @@ path = "src/join.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index dd69cd35d..16a34de69 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_kill" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "kill ~ (uutils) send a signal to a process" @@ -16,7 +16,7 @@ path = "src/kill.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["signals"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["signals"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index aaa183981..9c15d8682 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_link" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "link ~ (uutils) create a hard (file system) link to FILE" @@ -16,7 +16,7 @@ path = "src/link.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index 2b97f025a..2d7f39005 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ln" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "ln ~ (uutils) create a (file system) link to TARGET" @@ -17,7 +17,7 @@ path = "src/ln.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index d58576c77..896fd5eb7 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_logname" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "logname ~ (uutils) display the login name of the current user" @@ -16,7 +16,7 @@ path = "src/logname.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index 59901f807..b1d44e485 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ls" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "ls ~ (uutils) display directory contents" @@ -22,7 +22,7 @@ term_grid = "0.1.5" termsize = "0.1.6" time = "0.1.40" unicode-width = "0.1.5" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index 9cedb5c03..44a7eb18b 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkdir" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "mkdir ~ (uutils) create DIRECTORY" @@ -17,7 +17,7 @@ path = "src/mkdir.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs", "mode"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs", "mode"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index aa347a86e..8ff6694d6 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkfifo" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "mkfifo ~ (uutils) create FIFOs (named pipes)" @@ -17,7 +17,7 @@ path = "src/mkfifo.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index 426534e75..9badb5f13 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mknod" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "mknod ~ (uutils) create special file NAME of TYPE" @@ -18,7 +18,7 @@ path = "src/mknod.rs" [dependencies] getopts = "0.2.18" libc = "^0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["mode"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["mode"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index c48306a40..13685a586 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mktemp" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "mktemp ~ (uutils) create and display a temporary file or directory from TEMPLATE" @@ -18,7 +18,7 @@ path = "src/mktemp.rs" clap = "2.33" rand = "0.5" tempfile = "3.1" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index 243462232..c910d08b0 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_more" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "more ~ (uutils) input perusal filter" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index 1a4f90801..f84a68c3c 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mv" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "mv ~ (uutils) move (rename) SOURCE to DESTINATION" @@ -17,7 +17,7 @@ path = "src/mv.rs" [dependencies] clap = "2.33" fs_extra = "1.1.0" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index c851daa5a..2106b2d24 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nice" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "nice ~ (uutils) run PROGRAM with modified scheduling priority" @@ -18,7 +18,7 @@ path = "src/nice.rs" clap = "2.33" libc = "0.2.42" nix = { version="<=0.13" } -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index 41f7c60ab..f64182475 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nl" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "nl ~ (uutils) display input with added line numbers" @@ -21,7 +21,7 @@ libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" regex-syntax = "0.6.7" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index e9b6f8bd4..604e1e9da 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nohup" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "nohup ~ (uutils) run COMMAND, ignoring hangup signals" @@ -17,7 +17,7 @@ path = "src/nohup.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index 98f9a4afa..2541c5a3e 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nproc" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "nproc ~ (uutils) display the number of processing units available" @@ -18,7 +18,7 @@ path = "src/nproc.rs" libc = "0.2.42" num_cpus = "1.10" clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index b8e54656c..bde97cacb 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_numfmt" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "numfmt ~ (uutils) reformat NUMBER" @@ -16,7 +16,7 @@ path = "src/numfmt.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index e4db9faf0..a939c6ee4 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_od" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "od ~ (uutils) display formatted representation of input" @@ -19,7 +19,7 @@ byteorder = "1.3.2" clap = "2.33" half = "1.6" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index 3787ed270..2ac2074ed 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_paste" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "paste ~ (uutils) merge lines from inputs" @@ -16,7 +16,7 @@ path = "src/paste.rs" [dependencies] clap = "2.33.3" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index c1d0d0dfa..63d00daac 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pathchk" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "pathchk ~ (uutils) diagnose invalid or non-portable PATHNAME" @@ -17,7 +17,7 @@ path = "src/pathchk.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index 1618eab57..96fb32e74 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pinky" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "pinky ~ (uutils) display user information" @@ -15,7 +15,7 @@ edition = "2018" path = "src/pinky.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["utmpx", "entries"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["utmpx", "entries"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index 5266c1e03..f81240d77 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printenv" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "printenv ~ (uutils) display value of environment VAR" @@ -16,7 +16,7 @@ path = "src/printenv.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index c6737d178..7f54decb5 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printf" -version = "0.0.4" +version = "0.0.5" authors = [ "Nathan Ross", "uutils developers", @@ -19,7 +19,7 @@ path = "src/printf.rs" [dependencies] itertools = "0.8.0" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index 790b06305..889b4fafa 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ptx" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "ptx ~ (uutils) display a permuted index of input" @@ -21,7 +21,7 @@ libc = "0.2.42" memchr = "2.2.0" regex = "1.0.1" regex-syntax = "0.6.7" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index e074dc618..43ddeac2e 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pwd" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "pwd ~ (uutils) display current working directory" @@ -16,7 +16,7 @@ path = "src/pwd.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index 8e31f66f1..5d69125ce 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_readlink" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "readlink ~ (uutils) display resolved path of PATHNAME" @@ -17,7 +17,7 @@ path = "src/readlink.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index 6f03086ba..bd25d9980 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_realpath" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "realpath ~ (uutils) display resolved absolute path of PATHNAME" @@ -16,7 +16,7 @@ path = "src/realpath.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index c923b42ac..34d3dd067 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_relpath" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "relpath ~ (uutils) display relative path of PATHNAME_TO from PATHNAME_FROM" @@ -16,7 +16,7 @@ path = "src/relpath.rs" [dependencies] clap = "2.33.3" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index b916412d8..bd3415faf 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rm" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "rm ~ (uutils) remove PATHNAME" @@ -18,7 +18,7 @@ path = "src/rm.rs" clap = "2.33" walkdir = "2.2" remove_dir_all = "0.5.1" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index 9d6bb03cc..cfd8dd6b0 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rmdir" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "rmdir ~ (uutils) remove empty DIRECTORY" @@ -16,7 +16,7 @@ path = "src/rmdir.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index d7ee72b68..2e98a0bb8 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_seq" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "seq ~ (uutils) display a sequence of numbers" @@ -16,7 +16,7 @@ path = "src/seq.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index 6ff6e23ec..6157f3780 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shred" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "shred ~ (uutils) hide former FILE contents with repeated overwrites" @@ -20,7 +20,7 @@ filetime = "0.2.1" libc = "0.2.42" rand = "0.5" time = "0.1.40" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index 5e7c6c71a..7f911c156 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shuf" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "shuf ~ (uutils) display random permutations of input lines" @@ -17,7 +17,7 @@ path = "src/shuf.rs" [dependencies] clap = "2.33" rand = "0.5" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index 0ac5d6519..8ff8505e1 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sleep" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "sleep ~ (uutils) pause for DURATION" @@ -16,7 +16,7 @@ path = "src/sleep.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["parse_time"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["parse_time"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index e50caf53b..e805d4fa2 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sort" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "sort ~ (uutils) sort input lines" @@ -20,7 +20,7 @@ clap = "2.33" twox-hash = "1.6.0" itertools = "0.8.0" semver = "0.9.0" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index 7c3f1a56e..6032c6351 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_split" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "split ~ (uutils) split input into output files" @@ -16,7 +16,7 @@ path = "src/split.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index 52ea88110..bf19f95b7 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stat" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "stat ~ (uutils) display FILE status" @@ -17,7 +17,7 @@ path = "src/stat.rs" [dependencies] clap = "2.33" time = "0.1.40" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "libc"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index 7a80e99ae..3fde13f72 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "stdbuf ~ (uutils) run COMMAND with modified standard stream buffering" @@ -17,11 +17,11 @@ path = "src/stdbuf.rs" [dependencies] getopts = "0.2.18" tempfile = "3.1" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [build-dependencies] -libstdbuf = { version="0.0.4", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } +libstdbuf = { version="0.0.5", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } [[bin]] name = "stdbuf" diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index ac9c7230f..ba6e5ff42 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf_libstdbuf" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "stdbuf/libstdbuf ~ (uutils); dynamic library required for stdbuf" @@ -19,7 +19,7 @@ crate-type = ["cdylib", "rlib"] # XXX: note: the rlib is just to prevent Cargo f [dependencies] cpp = "0.5" libc = "0.2" -uucore = { version=">=0.0.7", package="uucore", path="../../../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../../../uucore_procs" } [build-dependencies] diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index 1e8590616..b5a6d5d91 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sum" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "sum ~ (uutils) display checksum and block counts for input" @@ -16,7 +16,7 @@ path = "src/sum.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index 4cbf69a41..39c49736a 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sync" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "sync ~ (uutils) synchronize cache writes to storage" @@ -17,7 +17,7 @@ path = "src/sync.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["wide"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["wide"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version = "0.3", features = ["errhandlingapi", "fileapi", "handleapi", "std", "winbase", "winerror"] } diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index 2e54c129e..18e9fa430 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tac" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "tac ~ (uutils) concatenate and display input lines in reverse order" @@ -16,7 +16,7 @@ path = "src/tac.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index 6e51e3e35..715a214e2 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tail" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "tail ~ (uutils) display the last lines of input" @@ -17,7 +17,7 @@ path = "src/tail.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } winapi = { version="0.3", features=["fileapi", "handleapi", "processthreadsapi", "synchapi", "winbase"] } diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index 51bba2e45..c1841ce0f 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tee" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "tee ~ (uutils) display input and copy to FILE" @@ -18,7 +18,7 @@ path = "src/tee.rs" clap = "2.33.3" libc = "0.2.42" retain_mut = "0.1.2" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["libc"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index 6471c9e62..c03b84ab4 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_test" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "test ~ (uutils) evaluate comparison and file type expressions" @@ -16,7 +16,7 @@ path = "src/test.rs" [dependencies] libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "redox")'.dependencies] diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index c13a98d19..c32547559 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_timeout" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "timeout ~ (uutils) run COMMAND with a DURATION time limit" @@ -17,7 +17,7 @@ path = "src/timeout.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["parse_time", "process", "signals"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index fc021c096..6fa84cbdd 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_touch" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "touch ~ (uutils) change FILE timestamps" @@ -18,7 +18,7 @@ path = "src/touch.rs" filetime = "0.2.1" clap = "2.33" time = "0.1.40" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["libc"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["libc"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index 3683211f6..04c013659 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tr" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "tr ~ (uutils) translate characters within input and display" @@ -18,7 +18,7 @@ path = "src/tr.rs" bit-set = "0.5.0" fnv = "1.0.5" clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index a73bfddd5..780288155 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_true" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "true ~ (uutils) do nothing and succeed" @@ -15,7 +15,7 @@ edition = "2018" path = "src/true.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index 4f770e666..19f0d2736 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_truncate" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "truncate ~ (uutils) truncate (or extend) FILE to SIZE" @@ -16,7 +16,7 @@ path = "src/truncate.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index d870e0155..3f3d20170 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tsort" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "tsort ~ (uutils) topologically sort input (partially ordered) pairs" @@ -16,7 +16,7 @@ path = "src/tsort.rs" [dependencies] clap= "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index 7e4ffbd79..d2c5110b5 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tty" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "tty ~ (uutils) display the name of the terminal connected to standard input" @@ -17,7 +17,7 @@ path = "src/tty.rs" [dependencies] clap = "2.33" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index 87754f45a..a0461e33f 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uname" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "uname ~ (uutils) display system information" @@ -17,7 +17,7 @@ path = "src/uname.rs" [dependencies] clap = "2.33" platform-info = "0.1" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index d66d335bf..6d1cad613 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unexpand" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "unexpand ~ (uutils) convert input spaces to tabs" @@ -17,7 +17,7 @@ path = "src/unexpand.rs" [dependencies] clap = "2.33" unicode-width = "0.1.5" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index d3cf4309d..53c2281c4 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uniq" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "uniq ~ (uutils) filter identical adjacent lines from input" @@ -16,7 +16,7 @@ path = "src/uniq.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index 68edec54d..ea18e2cbb 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unlink" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "unlink ~ (uutils) remove a (file system) link to FILE" @@ -17,7 +17,7 @@ path = "src/unlink.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index d66acc77f..823879954 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uptime" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "uptime ~ (uutils) display dynamic system information" @@ -17,7 +17,7 @@ path = "src/uptime.rs" [dependencies] chrono = "0.4" clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["libc", "utmpx"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["libc", "utmpx"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index ed6f110b6..087272a59 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_users" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "users ~ (uutils) display names of currently logged-in users" @@ -16,7 +16,7 @@ path = "src/users.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["utmpx"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["utmpx"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index 4e6cef101..3f44c1273 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_wc" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "wc ~ (uutils) display newline, word, and byte counts for input" @@ -16,7 +16,7 @@ path = "src/wc.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore" } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } thiserror = "1.0" diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index fce0178aa..928136b10 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_who" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "who ~ (uutils) display information about currently logged-in users" @@ -15,7 +15,7 @@ edition = "2018" path = "src/who.rs" [dependencies] -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["utmpx"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["utmpx"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index a3158f62a..e843b2167 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_whoami" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "whoami ~ (uutils) display user name of current effective user ID" @@ -16,7 +16,7 @@ path = "src/whoami.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["entries", "wide"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "wide"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index 729ce693a..ab8a6faff 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_yes" -version = "0.0.4" +version = "0.0.5" authors = ["uutils developers"] license = "MIT" description = "yes ~ (uutils) repeatedly display a line with STRING (or 'y')" @@ -16,7 +16,7 @@ path = "src/yes.rs" [dependencies] clap = "2.33" -uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["zero-copy"] } +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["zero-copy"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [features] diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index a5fbe4c79..855e64b36 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uucore" -version = "0.0.7" +version = "0.0.8" authors = ["uutils developers"] license = "MIT" description = "uutils ~ 'core' uutils code library (cross-platform)" diff --git a/util/update-version.sh b/util/update-version.sh index 584d13608..f5b66fb8c 100644 --- a/util/update-version.sh +++ b/util/update-version.sh @@ -3,11 +3,11 @@ # So, it should be triple-checked -FROM="0.0.3" -TO="0.0.4" +FROM="0.0.4" +TO="0.0.5" -UUCORE_FROM="0.0.6" -UUCORE_TO="0.0.7" +UUCORE_FROM="0.0.7" +UUCORE_TO="0.0.8" PROGS=$(ls -1d src/uu/*/Cargo.toml src/uu/stdbuf/src/libstdbuf/Cargo.toml Cargo.toml) From 06bdc144d70329d68c0268943175c7b798afbb47 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 3 Apr 2021 12:43:37 +0200 Subject: [PATCH 578/606] ls: show/hide control chars --- src/uu/ls/src/ls.rs | 41 ++++++++- src/uu/ls/src/quoting_style.rs | 152 ++++++++++++++++++++++++++------- 2 files changed, 158 insertions(+), 35 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index ece497bdb..9bb8b7e63 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -119,7 +119,8 @@ pub mod options { pub static FILE_TYPE: &str = "file-type"; pub static CLASSIFY: &str = "classify"; } - + pub static HIDE_CONTROL_CHARS: &str = "hide-control-chars"; + pub static SHOW_CONTROL_CHARS: &str = "show-control-chars"; pub static WIDTH: &str = "width"; pub static AUTHOR: &str = "author"; pub static NO_GROUP: &str = "no-group"; @@ -366,24 +367,36 @@ impl Config { }) .or_else(|| termsize::get().map(|s| s.cols)); + let show_control = if options.is_present(options::HIDE_CONTROL_CHARS) { + false + } else if options.is_present(options::SHOW_CONTROL_CHARS) { + true + } else { + false // TODO: only if output is a terminal and the program is `ls` + }; + let quoting_style = if let Some(style) = options.value_of(options::QUOTING_STYLE) { match style { - "literal" => QuotingStyle::Literal, + "literal" => QuotingStyle::Literal { show_control }, "shell" => QuotingStyle::Shell { escape: false, always_quote: false, + show_control, }, "shell-always" => QuotingStyle::Shell { escape: false, always_quote: true, + show_control, }, "shell-escape" => QuotingStyle::Shell { escape: true, always_quote: false, + show_control, }, "shell-escape-always" => QuotingStyle::Shell { escape: true, always_quote: true, + show_control, }, "c" => QuotingStyle::C { quotes: quoting_style::Quotes::Double, @@ -394,7 +407,7 @@ impl Config { _ => unreachable!("Should have been caught by Clap"), } } else if options.is_present(options::quoting::LITERAL) { - QuotingStyle::Literal + QuotingStyle::Literal { show_control } } else if options.is_present(options::quoting::ESCAPE) { QuotingStyle::C { quotes: quoting_style::Quotes::None, @@ -408,6 +421,7 @@ impl Config { QuotingStyle::Shell { escape: true, always_quote: false, + show_control, } }; @@ -619,6 +633,27 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ]) ) + // Control characters + .arg( + Arg::with_name(options::HIDE_CONTROL_CHARS) + .short("q") + .long(options::HIDE_CONTROL_CHARS) + .help("Replace control characters with '?' if they are not escaped.") + .overrides_with_all(&[ + options::HIDE_CONTROL_CHARS, + options::SHOW_CONTROL_CHARS, + ]) + ) + .arg( + Arg::with_name(options::SHOW_CONTROL_CHARS) + .long(options::SHOW_CONTROL_CHARS) + .help("Show control characters 'as is' if they are not escaped.") + .overrides_with_all(&[ + options::HIDE_CONTROL_CHARS, + options::SHOW_CONTROL_CHARS, + ]) + ) + // Time arguments .arg( Arg::with_name(options::TIME) diff --git a/src/uu/ls/src/quoting_style.rs b/src/uu/ls/src/quoting_style.rs index 74108094a..ceb54466c 100644 --- a/src/uu/ls/src/quoting_style.rs +++ b/src/uu/ls/src/quoting_style.rs @@ -2,14 +2,22 @@ use std::char::from_digit; const SPECIAL_SHELL_CHARS: &str = "~`#$&*()\\|[]{};'\"<>?! "; -pub(crate) enum QuotingStyle { - Shell { escape: bool, always_quote: bool }, - C { quotes: Quotes }, - Literal, +pub(super) enum QuotingStyle { + Shell { + escape: bool, + always_quote: bool, + show_control: bool, + }, + C { + quotes: Quotes, + }, + Literal { + show_control: bool, + }, } #[derive(Clone, Copy)] -pub(crate) enum Quotes { +pub(super) enum Quotes { None, Single, Double, @@ -81,6 +89,12 @@ impl EscapeOctal { } impl EscapedChar { + fn new_literal(c: char) -> Self { + Self { + state: EscapeState::Char(c), + } + } + fn new_c(c: char, quotes: Quotes) -> Self { use EscapeState::*; let init_state = match c { @@ -110,27 +124,10 @@ impl EscapedChar { Self { state: init_state } } - // fn new_shell(c: char, quotes: Quotes) -> Self { - // use EscapeState::*; - // let init_state = match c { - // // If the string is single quoted, the single quote should be escaped - // '\'' => match quotes { - // Quotes::Single => Backslash('\''), - // _ => Char('\''), - // }, - // // All control characters should be rendered as ?: - // _ if c.is_ascii_control() => Char('?'), - // // Special shell characters must be escaped: - // _ if SPECIAL_SHELL_CHARS.contains(c) => ForceQuote(c), - // _ => Char(c), - // }; - // Self { state: init_state } - // } - fn new_shell(c: char, escape: bool, quotes: Quotes) -> Self { use EscapeState::*; let init_state = match c { - _ if !escape && c.is_control() => Char('?'), + _ if !escape && c.is_control() => Char(c), '\x07' => Backslash('a'), '\x08' => Backslash('b'), '\t' => Backslash('t'), @@ -149,6 +146,15 @@ impl EscapedChar { }; Self { state: init_state } } + + fn hide_control(self) -> Self { + match self.state { + EscapeState::Char(c) if c.is_control() => Self { + state: EscapeState::Char('?'), + }, + _ => self, + } + } } impl Iterator for EscapedChar { @@ -170,12 +176,20 @@ impl Iterator for EscapedChar { } } -fn shell_without_escape(name: String, quotes: Quotes) -> (String, bool) { +fn shell_without_escape(name: String, quotes: Quotes, show_control_chars: bool) -> (String, bool) { let mut must_quote = false; let mut escaped_str = String::with_capacity(name.len()); for c in name.chars() { - let escaped = EscapedChar::new_shell(c, false, quotes); + let escaped = { + let ec = EscapedChar::new_shell(c, false, quotes); + if show_control_chars { + ec + } else { + ec.hide_control() + } + }; + match escaped.state { EscapeState::Backslash('\'') => escaped_str.push_str("'\\''"), EscapeState::ForceQuote(x) => { @@ -242,7 +256,15 @@ fn shell_with_escape(name: String, quotes: Quotes) -> (String, bool) { pub(super) fn escape_name(name: String, style: &QuotingStyle) -> String { match style { - QuotingStyle::Literal => name, + QuotingStyle::Literal { show_control } => { + if !show_control { + name.chars() + .flat_map(|c| EscapedChar::new_literal(c).hide_control()) + .collect() + } else { + name + } + } QuotingStyle::C { quotes } => { let escaped_str: String = name .chars() @@ -258,6 +280,7 @@ pub(super) fn escape_name(name: String, style: &QuotingStyle) -> String { QuotingStyle::Shell { escape, always_quote, + show_control, } => { let (quotes, must_quote) = if name.contains('"') { (Quotes::Single, true) @@ -272,7 +295,7 @@ pub(super) fn escape_name(name: String, style: &QuotingStyle) -> String { let (escaped_str, contains_quote_chars) = if *escape { shell_with_escape(name, quotes) } else { - shell_without_escape(name, quotes) + shell_without_escape(name, quotes, *show_control) }; match (must_quote | contains_quote_chars, quotes) { @@ -289,7 +312,10 @@ mod tests { use crate::quoting_style::{escape_name, Quotes, QuotingStyle}; fn get_style(s: &str) -> QuotingStyle { match s { - "literal" => QuotingStyle::Literal, + "literal" => QuotingStyle::Literal { + show_control: false, + }, + "literal-show" => QuotingStyle::Literal { show_control: true }, "escape" => QuotingStyle::C { quotes: Quotes::None, }, @@ -299,18 +325,32 @@ mod tests { "shell" => QuotingStyle::Shell { escape: false, always_quote: false, + show_control: false, + }, + "shell-show" => QuotingStyle::Shell { + escape: false, + always_quote: false, + show_control: true, }, "shell-always" => QuotingStyle::Shell { escape: false, always_quote: true, + show_control: false, + }, + "shell-always-show" => QuotingStyle::Shell { + escape: false, + always_quote: true, + show_control: true, }, "shell-escape" => QuotingStyle::Shell { escape: true, always_quote: false, + show_control: false, }, "shell-escape-always" => QuotingStyle::Shell { escape: true, always_quote: true, + show_control: false, }, _ => panic!("Invalid name!"), } @@ -333,10 +373,13 @@ mod tests { "one_two", vec![ ("one_two", "literal"), + ("one_two", "literal-show"), ("one_two", "escape"), ("\"one_two\"", "c"), ("one_two", "shell"), + ("one_two", "shell-show"), ("\'one_two\'", "shell-always"), + ("\'one_two\'", "shell-always-show"), ("one_two", "shell-escape"), ("\'one_two\'", "shell-escape-always"), ], @@ -349,10 +392,13 @@ mod tests { "one two", vec![ ("one two", "literal"), + ("one two", "literal-show"), ("one\\ two", "escape"), ("\"one two\"", "c"), ("\'one two\'", "shell"), + ("\'one two\'", "shell-show"), ("\'one two\'", "shell-always"), + ("\'one two\'", "shell-always-show"), ("\'one two\'", "shell-escape"), ("\'one two\'", "shell-escape-always"), ], @@ -362,10 +408,13 @@ mod tests { " one", vec![ (" one", "literal"), + (" one", "literal-show"), ("\\ one", "escape"), ("\" one\"", "c"), ("' one'", "shell"), + ("' one'", "shell-show"), ("' one'", "shell-always"), + ("' one'", "shell-always-show"), ("' one'", "shell-escape"), ("' one'", "shell-escape-always"), ], @@ -379,10 +428,13 @@ mod tests { "one\"two", vec![ ("one\"two", "literal"), + ("one\"two", "literal-show"), ("one\"two", "escape"), ("\"one\\\"two\"", "c"), ("'one\"two'", "shell"), + ("'one\"two'", "shell-show"), ("'one\"two'", "shell-always"), + ("'one\"two'", "shell-always-show"), ("'one\"two'", "shell-escape"), ("'one\"two'", "shell-escape-always"), ], @@ -393,10 +445,13 @@ mod tests { "one\'two", vec![ ("one'two", "literal"), + ("one'two", "literal-show"), ("one'two", "escape"), ("\"one'two\"", "c"), ("\"one'two\"", "shell"), + ("\"one'two\"", "shell-show"), ("\"one'two\"", "shell-always"), + ("\"one'two\"", "shell-always-show"), ("\"one'two\"", "shell-escape"), ("\"one'two\"", "shell-escape-always"), ], @@ -407,10 +462,13 @@ mod tests { "one'two\"three", vec![ ("one'two\"three", "literal"), + ("one'two\"three", "literal-show"), ("one'two\"three", "escape"), ("\"one'two\\\"three\"", "c"), ("'one'\\''two\"three'", "shell"), + ("'one'\\''two\"three'", "shell-show"), ("'one'\\''two\"three'", "shell-always"), + ("'one'\\''two\"three'", "shell-always-show"), ("'one'\\''two\"three'", "shell-escape"), ("'one'\\''two\"three'", "shell-escape-always"), ], @@ -421,10 +479,13 @@ mod tests { "one''two\"\"three", vec![ ("one''two\"\"three", "literal"), + ("one''two\"\"three", "literal-show"), ("one''two\"\"three", "escape"), ("\"one''two\\\"\\\"three\"", "c"), ("'one'\\'''\\''two\"\"three'", "shell"), + ("'one'\\'''\\''two\"\"three'", "shell-show"), ("'one'\\'''\\''two\"\"three'", "shell-always"), + ("'one'\\'''\\''two\"\"three'", "shell-always-show"), ("'one'\\'''\\''two\"\"three'", "shell-escape"), ("'one'\\'''\\''two\"\"three'", "shell-escape-always"), ], @@ -437,11 +498,14 @@ mod tests { check_names( "one\ntwo", vec![ - ("one\ntwo", "literal"), + ("one?two", "literal"), + ("one\ntwo", "literal-show"), ("one\\ntwo", "escape"), ("\"one\\ntwo\"", "c"), ("one?two", "shell"), + ("one\ntwo", "shell-show"), ("'one?two'", "shell-always"), + ("'one\ntwo'", "shell-always-show"), ("'one'$'\\n''two'", "shell-escape"), ("'one'$'\\n''two'", "shell-escape-always"), ], @@ -452,9 +516,10 @@ mod tests { check_names( "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F", vec![ + ("????????????????", "literal"), ( "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F", - "literal", + "literal-show", ), ( "\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017", @@ -465,7 +530,15 @@ mod tests { "c", ), ("????????????????", "shell"), + ( + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F", + "shell-show", + ), ("'????????????????'", "shell-always"), + ( + "'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F'", + "shell-always-show", + ), ( "''$'\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017'", "shell-escape", @@ -481,9 +554,10 @@ mod tests { check_names( "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", vec![ + ("????????????????", "literal"), ( "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", - "literal", + "literal-show", ), ( "\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037", @@ -494,7 +568,15 @@ mod tests { "c", ), ("????????????????", "shell"), + ( + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", + "shell-show", + ), ("'????????????????'", "shell-always"), + ( + "'\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F'", + "shell-always-show", + ), ( "''$'\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\033\\034\\035\\036\\037'", "shell-escape", @@ -510,11 +592,14 @@ mod tests { check_names( "\x7F", vec![ - ("\x7F", "literal"), + ("?", "literal"), + ("\x7F", "literal-show"), ("\\177", "escape"), ("\"\\177\"", "c"), ("?", "shell"), + ("\x7F", "shell-show"), ("'?'", "shell-always"), + ("'\x7F'", "shell-always-show"), ("''$'\\177'", "shell-escape"), ("''$'\\177'", "shell-escape-always"), ], @@ -530,10 +615,13 @@ mod tests { "one?two", vec![ ("one?two", "literal"), + ("one?two", "literal-show"), ("one?two", "escape"), ("\"one?two\"", "c"), ("'one?two'", "shell"), + ("'one?two'", "shell-show"), ("'one?two'", "shell-always"), + ("'one?two'", "shell-always-show"), ("'one?two'", "shell-escape"), ("'one?two'", "shell-escape-always"), ], From 9cb0fc2945afc7d7d5e7c96a4763039652c4c46c Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 3 Apr 2021 13:15:19 +0200 Subject: [PATCH 579/606] ls: forgot to push updated tests --- tests/by-util/test_ls.rs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index d403e5577..b49620eb1 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1142,9 +1142,9 @@ fn test_ls_quoting_style() { assert_eq!(result.stdout, "'one'$'\\n''two'\n"); for (arg, correct) in &[ - ("--quoting-style=literal", "one\ntwo"), - ("-N", "one\ntwo"), - ("--literal", "one\ntwo"), + ("--quoting-style=literal", "one?two"), + ("-N", "one?two"), + ("--literal", "one?two"), ("--quoting-style=c", "\"one\\ntwo\""), ("-Q", "\"one\\ntwo\""), ("--quote-name", "\"one\\ntwo\""), @@ -1161,6 +1161,24 @@ fn test_ls_quoting_style() { println!("stdout = {:?}", result.stdout); assert_eq!(result.stdout, format!("{}\n", correct)); } + + for (arg, correct) in &[ + ("--quoting-style=literal", "one\ntwo"), + ("-N", "one\ntwo"), + ("--literal", "one\ntwo"), + ("--quoting-style=shell", "one\ntwo"), + ("--quoting-style=shell-always", "'one\ntwo'"), + ] { + let result = scene + .ucmd() + .arg(arg) + .arg("--show-control-chars") + .arg("one\ntwo") + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!(result.stdout, format!("{}\n", correct)); + } } let result = scene.ucmd().arg("one two").succeeds(); From a85257474554e354d5018c9407c0d782b4ea8529 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 3 Apr 2021 15:49:13 +0200 Subject: [PATCH 580/606] Fix bug #2017 - cat isn't working Revert "cat: Improve performance on Linux (#1978)" This reverts commit 7a947cfe46b694f61a5a7d840d622ce292da457c. --- Cargo.lock | 3 +- src/uu/cat/Cargo.toml | 5 +- src/uu/cat/src/cat.rs | 426 +++++++++++++++++------------------------- 3 files changed, 178 insertions(+), 256 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e5eb65a92..6c7c165e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1581,8 +1581,7 @@ name = "uu_cat" version = "0.0.5" dependencies = [ "clap", - "nix 0.20.0", - "thiserror", + "quick-error", "unix_socket", "uucore", "uucore_procs", diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 25119dcfc..2176a5e0b 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -16,16 +16,13 @@ path = "src/cat.rs" [dependencies] clap = "2.33" -thiserror = "1.0" +quick-error = "1.2.3" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [target.'cfg(unix)'.dependencies] unix_socket = "0.5.0" -[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies] -nix = "0.20" - [[bin]] name = "cat" path = "src/main.rs" diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index f39708fd8..cf5a384a4 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -3,13 +3,14 @@ // (c) Jordi Boggiano // (c) Evgeniy Klyuchikov // (c) Joshua S. Miller -// (c) Árni Dagur // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // spell-checker:ignore (ToDO) nonprint nonblank nonprinting +#[macro_use] +extern crate quick_error; #[cfg(unix)] extern crate unix_socket; #[macro_use] @@ -17,9 +18,9 @@ extern crate uucore; // last synced with: cat (GNU coreutils) 8.13 use clap::{App, Arg}; +use quick_error::ResultExt; use std::fs::{metadata, File}; -use std::io::{self, Read, Write}; -use thiserror::Error; +use std::io::{self, stderr, stdin, stdout, BufWriter, Read, Write}; use uucore::fs::is_stdin_interactive; /// Unix domain socket support @@ -30,44 +31,12 @@ use std::os::unix::fs::FileTypeExt; #[cfg(unix)] use unix_socket::UnixStream; -#[cfg(any(target_os = "linux", target_os = "android"))] -use nix::errno::Errno; -/// Linux splice support -#[cfg(any(target_os = "linux", target_os = "android"))] -use nix::fcntl::{splice, SpliceFFlags}; -#[cfg(any(target_os = "linux", target_os = "android"))] -use nix::unistd::pipe; -#[cfg(any(target_os = "linux", target_os = "android"))] -use std::os::unix::io::{AsRawFd, RawFd}; - static NAME: &str = "cat"; static VERSION: &str = env!("CARGO_PKG_VERSION"); static SYNTAX: &str = "[OPTION]... [FILE]..."; static SUMMARY: &str = "Concatenate FILE(s), or standard input, to standard output With no FILE, or when FILE is -, read standard input."; -#[derive(Error, Debug)] -enum CatError { - /// Wrapper around `io::Error` - #[error("{0}")] - Io(#[from] io::Error), - /// Wrapper around `nix::Error` - #[cfg(any(target_os = "linux", target_os = "android"))] - #[error("{0}")] - Nix(#[from] nix::Error), - /// Unknown file type; it's not a regular file, socket, etc. - #[error("{}: unknown filetype: {}", path, ft_debug)] - UnknownFiletype { - path: String, - /// A debug print of the file type - ft_debug: String, - }, - #[error("{0}: Expected a file, found directory")] - IsDirectory(String), -} - -type CatResult = Result; - #[derive(PartialEq)] enum NumberingMode { None, @@ -75,6 +44,39 @@ enum NumberingMode { All, } +quick_error! { + #[derive(Debug)] + enum CatError { + /// Wrapper for io::Error with path context + Input(err: io::Error, path: String) { + display("cat: {0}: {1}", path, err) + context(path: &'a str, err: io::Error) -> (err, path.to_owned()) + cause(err) + } + + /// Wrapper for io::Error with no context + Output(err: io::Error) { + display("cat: {0}", err) from() + cause(err) + } + + /// Unknown Filetype classification + UnknownFiletype(path: String) { + display("cat: {0}: unknown filetype", path) + } + + /// At least one error was encountered in reading or writing + EncounteredErrors(count: usize) { + display("cat: encountered {0} errors", count) + } + + /// Denotes an error caused by trying to `cat` a directory + IsDirectory(path: String) { + display("cat: {0}: Is a directory", path) + } + } +} + struct OutputOptions { /// Line numbering mode number: NumberingMode, @@ -85,56 +87,21 @@ struct OutputOptions { /// display TAB characters as `tab` show_tabs: bool, - /// Show end of lines - show_ends: bool, + /// If `show_tabs == true`, this string will be printed in the + /// place of tabs + tab: String, + + /// Can be set to show characters other than '\n' a the end of + /// each line, e.g. $ + end_of_line: String, /// use ^ and M- notation, except for LF (\\n) and TAB (\\t) show_nonprint: bool, } -impl OutputOptions { - fn tab(&self) -> &'static str { - if self.show_tabs { - "^I" - } else { - "\t" - } - } - - fn end_of_line(&self) -> &'static str { - if self.show_ends { - "$\n" - } else { - "\n" - } - } - - /// We can write fast if we can simply copy the contents of the file to - /// stdout, without augmenting the output with e.g. line numbers. - fn can_write_fast(&self) -> bool { - !(self.show_tabs - || self.show_nonprint - || self.show_ends - || self.squeeze_blank - || self.number != NumberingMode::None) - } -} - -/// State that persists between output of each file. This struct is only used -/// when we can't write fast. -struct OutputState { - /// The current line number - line_number: usize, - - /// Whether the output cursor is at the beginning of a new line - at_line_start: bool, -} - /// Represents an open file handle, stream, or other device -struct InputHandle { - #[cfg(any(target_os = "linux", target_os = "android"))] - file_descriptor: RawFd, - reader: R, +struct InputHandle { + reader: Box, is_interactive: bool, } @@ -157,6 +124,8 @@ enum InputType { Socket, } +type CatResult = Result; + mod options { pub static FILE: &str = "file"; pub static SHOW_ALL: &str = "show-all"; @@ -274,14 +243,30 @@ pub fn uumain(args: impl uucore::Args) -> i32 { None => vec!["-".to_owned()], }; - let options = OutputOptions { - show_ends, - number: number_mode, - show_nonprint, - show_tabs, - squeeze_blank, + let can_write_fast = !(show_tabs + || show_nonprint + || show_ends + || squeeze_blank + || number_mode != NumberingMode::None); + + let success = if can_write_fast { + write_fast(files).is_ok() + } else { + let tab = if show_tabs { "^I" } else { "\t" }.to_owned(); + + let end_of_line = if show_ends { "$\n" } else { "\n" }.to_owned(); + + let options = OutputOptions { + end_of_line, + number: number_mode, + show_nonprint, + show_tabs, + squeeze_blank, + tab, + }; + + write_lines(files, &options).is_ok() }; - let success = cat_files(files, &options).is_ok(); if success { 0 @@ -290,76 +275,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { } } -fn cat_handle( - handle: &mut InputHandle, - options: &OutputOptions, - state: &mut OutputState, -) -> CatResult<()> { - if options.can_write_fast() { - write_fast(handle) - } else { - write_lines(handle, &options, state) - } -} - -fn cat_path(path: &str, options: &OutputOptions, state: &mut OutputState) -> CatResult<()> { - if path == "-" { - let stdin = io::stdin(); - let mut handle = InputHandle { - #[cfg(any(target_os = "linux", target_os = "android"))] - file_descriptor: stdin.as_raw_fd(), - reader: stdin, - is_interactive: is_stdin_interactive(), - }; - return cat_handle(&mut handle, &options, state); - } - match get_input_type(path)? { - InputType::Directory => Err(CatError::IsDirectory(path.to_owned())), - #[cfg(unix)] - InputType::Socket => { - let socket = UnixStream::connect(path)?; - socket.shutdown(Shutdown::Write)?; - let mut handle = InputHandle { - #[cfg(any(target_os = "linux", target_os = "android"))] - file_descriptor: socket.as_raw_fd(), - reader: socket, - is_interactive: false, - }; - cat_handle(&mut handle, &options, state) - } - _ => { - let file = File::open(path)?; - let mut handle = InputHandle { - #[cfg(any(target_os = "linux", target_os = "android"))] - file_descriptor: file.as_raw_fd(), - reader: file, - is_interactive: false, - }; - cat_handle(&mut handle, &options, state) - } - } -} - -fn cat_files(files: Vec, options: &OutputOptions) -> Result<(), u32> { - let mut error_count = 0; - let mut state = OutputState { - line_number: 1, - at_line_start: true, - }; - - for path in &files { - if let Err(err) = cat_path(path, &options, &mut state) { - show_error!("{}", err); - error_count += 1; - } - } - if error_count == 0 { - Ok(()) - } else { - Err(error_count) - } -} - /// Classifies the `InputType` of file at `path` if possible /// /// # Arguments @@ -370,8 +285,7 @@ fn get_input_type(path: &str) -> CatResult { return Ok(InputType::StdIn); } - let ft = metadata(path)?.file_type(); - match ft { + match metadata(path).context(path)?.file_type() { #[cfg(unix)] ft if ft.is_block_device() => Ok(InputType::BlockDevice), #[cfg(unix)] @@ -383,113 +297,125 @@ fn get_input_type(path: &str) -> CatResult { ft if ft.is_dir() => Ok(InputType::Directory), ft if ft.is_file() => Ok(InputType::File), ft if ft.is_symlink() => Ok(InputType::SymLink), - _ => Err(CatError::UnknownFiletype { - path: path.to_owned(), - ft_debug: format!("{:?}", ft), - }), + _ => Err(CatError::UnknownFiletype(path.to_owned())), } } -/// Writes handle to stdout with no configuration. This allows a -/// simple memory copy. -fn write_fast(handle: &mut InputHandle) -> CatResult<()> { - let stdout = io::stdout(); - let mut stdout_lock = stdout.lock(); - #[cfg(any(target_os = "linux", target_os = "android"))] - { - // If we're on Linux or Android, try to use the splice() system call - // for faster writing. If it works, we're done. - if !write_fast_using_splice(handle, stdout.as_raw_fd())? { - return Ok(()); - } - } - // If we're not on Linux or Android, or the splice() call failed, - // fall back on slower writing. - let mut buf = [0; 1024 * 64]; - while let Ok(n) = handle.reader.read(&mut buf) { - if n == 0 { - break; - } - stdout_lock.write_all(&buf[..n])?; - } - Ok(()) -} - -/// This function is called from `write_fast()` on Linux and Android. The -/// function `splice()` is used to move data between two file descriptors -/// without copying between kernel- and userspace. This results in a large -/// speedup. +/// Returns an InputHandle from which a Reader can be accessed or an +/// error /// -/// The `bool` in the result value indicates if we need to fall back to normal -/// copying or not. False means we don't have to. -#[cfg(any(target_os = "linux", target_os = "android"))] -#[inline] -fn write_fast_using_splice(handle: &mut InputHandle, writer: RawFd) -> CatResult { - const BUF_SIZE: usize = 1024 * 16; +/// # Arguments +/// +/// * `path` - `InputHandler` will wrap a reader from this file path +fn open(path: &str) -> CatResult { + if path == "-" { + let stdin = stdin(); + return Ok(InputHandle { + reader: Box::new(stdin) as Box, + is_interactive: is_stdin_interactive(), + }); + } - let (pipe_rd, pipe_wr) = pipe()?; - - // We only fall back if splice fails on the first call. - match splice( - handle.file_descriptor, - None, - pipe_wr, - None, - BUF_SIZE, - SpliceFFlags::empty(), - ) { - Ok(n) => { - if n == 0 { - return Ok(false); - } + match get_input_type(path)? { + InputType::Directory => Err(CatError::IsDirectory(path.to_owned())), + #[cfg(unix)] + InputType::Socket => { + let socket = UnixStream::connect(path).context(path)?; + socket.shutdown(Shutdown::Write).context(path)?; + Ok(InputHandle { + reader: Box::new(socket) as Box, + is_interactive: false, + }) } - Err(err) => { - match err.as_errno() { - Some(Errno::EPERM) | Some(Errno::ENOSYS) | Some(Errno::EINVAL) => { - // EPERM indicates the call was blocked by seccomp. - // ENOSYS indicates we're running on an ancient Kernel. - // EINVAL indicates some other failure. - return Ok(true); - } - _ => { - // Other errors include running out of memory, etc. We - // don't attempt to fall back from these. - return Err(err)?; + _ => { + let file = File::open(path).context(path)?; + Ok(InputHandle { + reader: Box::new(file) as Box, + is_interactive: false, + }) + } + } +} + +/// Writes files to stdout with no configuration. This allows a +/// simple memory copy. Returns `Ok(())` if no errors were +/// encountered, or an error with the number of errors encountered. +/// +/// # Arguments +/// +/// * `files` - There is no short circuit when encountering an error +/// reading a file in this vector +fn write_fast(files: Vec) -> CatResult<()> { + let mut writer = stdout(); + let mut in_buf = [0; 1024 * 64]; + let mut error_count = 0; + + for file in files { + match open(&file[..]) { + Ok(mut handle) => { + while let Ok(n) = handle.reader.read(&mut in_buf) { + if n == 0 { + break; + } + writer.write_all(&in_buf[..n]).context(&file[..])?; } } + Err(error) => { + writeln!(&mut stderr(), "{}", error)?; + error_count += 1; + } } } - loop { - let n = splice( - handle.file_descriptor, - None, - pipe_wr, - None, - BUF_SIZE, - SpliceFFlags::empty(), - )?; - if n == 0 { - // We read 0 bytes from the input, - // which means we're done copying. - break; + match error_count { + 0 => Ok(()), + _ => Err(CatError::EncounteredErrors(error_count)), + } +} + +/// State that persists between output of each file +struct OutputState { + /// The current line number + line_number: usize, + + /// Whether the output cursor is at the beginning of a new line + at_line_start: bool, +} + +/// Writes files to stdout with `options` as configuration. Returns +/// `Ok(())` if no errors were encountered, or an error with the +/// number of errors encountered. +/// +/// # Arguments +/// +/// * `files` - There is no short circuit when encountering an error +/// reading a file in this vector +fn write_lines(files: Vec, options: &OutputOptions) -> CatResult<()> { + let mut error_count = 0; + let mut state = OutputState { + line_number: 1, + at_line_start: true, + }; + + for file in files { + if let Err(error) = write_file_lines(&file, options, &mut state) { + writeln!(&mut stderr(), "{}", error).context(&file[..])?; + error_count += 1; } - splice(pipe_rd, None, writer, None, BUF_SIZE, SpliceFFlags::empty())?; } - Ok(false) + match error_count { + 0 => Ok(()), + _ => Err(CatError::EncounteredErrors(error_count)), + } } /// Outputs file contents to stdout in a line-by-line fashion, /// propagating any errors that might occur. -fn write_lines( - handle: &mut InputHandle, - options: &OutputOptions, - state: &mut OutputState, -) -> CatResult<()> { +fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState) -> CatResult<()> { + let mut handle = open(file)?; let mut in_buf = [0; 1024 * 31]; - let stdout = io::stdout(); - let mut writer = stdout.lock(); + let mut writer = BufWriter::with_capacity(1024 * 64, stdout()); let mut one_blank_kept = false; while let Ok(n) = handle.reader.read(&mut in_buf) { @@ -507,9 +433,9 @@ fn write_lines( write!(&mut writer, "{0:6}\t", state.line_number)?; state.line_number += 1; } - writer.write_all(options.end_of_line().as_bytes())?; + writer.write_all(options.end_of_line.as_bytes())?; if handle.is_interactive { - writer.flush()?; + writer.flush().context(file)?; } } state.at_line_start = true; @@ -524,7 +450,7 @@ fn write_lines( // print to end of line or end of buffer let offset = if options.show_nonprint { - write_nonprint_to_end(&in_buf[pos..], &mut writer, options.tab().as_bytes()) + write_nonprint_to_end(&in_buf[pos..], &mut writer, options.tab.as_bytes()) } else if options.show_tabs { write_tab_to_end(&in_buf[pos..], &mut writer) } else { @@ -536,7 +462,7 @@ fn write_lines( break; } // print suitable end of line - writer.write_all(options.end_of_line().as_bytes())?; + writer.write_all(options.end_of_line.as_bytes())?; if handle.is_interactive { writer.flush()?; } From 7750db4f8ecc84ac352d59946799ffbbc96a4f50 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 3 Apr 2021 16:06:29 +0200 Subject: [PATCH 581/606] cat: add a trivial test --- tests/by-util/test_cat.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index b194eb9b0..481b1683d 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -3,6 +3,14 @@ extern crate unix_socket; use crate::common::util::*; +#[test] +fn test_output_simple() { + new_ucmd!() + .args(&["alpha.txt"]) + .succeeds() + .stdout_only("abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); +} + #[test] fn test_output_multi_files_print_all_chars() { new_ucmd!() From f37284129e7f00a2d77fa768b7b87c529994ad1f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 3 Apr 2021 15:55:02 +0200 Subject: [PATCH 582/606] new release 0.0.6 to address the cat issue --- Cargo.lock | 194 ++++++++++++------------- Cargo.toml | 192 ++++++++++++------------ src/uu/arch/Cargo.toml | 2 +- src/uu/base32/Cargo.toml | 2 +- src/uu/base64/Cargo.toml | 2 +- src/uu/basename/Cargo.toml | 2 +- src/uu/cat/Cargo.toml | 2 +- src/uu/chgrp/Cargo.toml | 2 +- src/uu/chmod/Cargo.toml | 2 +- src/uu/chown/Cargo.toml | 2 +- src/uu/chroot/Cargo.toml | 2 +- src/uu/cksum/Cargo.toml | 2 +- src/uu/comm/Cargo.toml | 2 +- src/uu/cp/Cargo.toml | 2 +- src/uu/csplit/Cargo.toml | 2 +- src/uu/cut/Cargo.toml | 2 +- src/uu/date/Cargo.toml | 2 +- src/uu/df/Cargo.toml | 2 +- src/uu/dircolors/Cargo.toml | 2 +- src/uu/dirname/Cargo.toml | 2 +- src/uu/du/Cargo.toml | 2 +- src/uu/echo/Cargo.toml | 2 +- src/uu/env/Cargo.toml | 2 +- src/uu/expand/Cargo.toml | 2 +- src/uu/expr/Cargo.toml | 2 +- src/uu/factor/Cargo.toml | 2 +- src/uu/false/Cargo.toml | 2 +- src/uu/fmt/Cargo.toml | 2 +- src/uu/fold/Cargo.toml | 2 +- src/uu/groups/Cargo.toml | 2 +- src/uu/hashsum/Cargo.toml | 2 +- src/uu/head/Cargo.toml | 2 +- src/uu/hostid/Cargo.toml | 2 +- src/uu/hostname/Cargo.toml | 2 +- src/uu/id/Cargo.toml | 2 +- src/uu/install/Cargo.toml | 2 +- src/uu/join/Cargo.toml | 2 +- src/uu/kill/Cargo.toml | 2 +- src/uu/link/Cargo.toml | 2 +- src/uu/ln/Cargo.toml | 2 +- src/uu/logname/Cargo.toml | 2 +- src/uu/ls/Cargo.toml | 2 +- src/uu/mkdir/Cargo.toml | 2 +- src/uu/mkfifo/Cargo.toml | 2 +- src/uu/mknod/Cargo.toml | 2 +- src/uu/mktemp/Cargo.toml | 2 +- src/uu/more/Cargo.toml | 2 +- src/uu/mv/Cargo.toml | 2 +- src/uu/nice/Cargo.toml | 2 +- src/uu/nl/Cargo.toml | 2 +- src/uu/nohup/Cargo.toml | 2 +- src/uu/nproc/Cargo.toml | 2 +- src/uu/numfmt/Cargo.toml | 2 +- src/uu/od/Cargo.toml | 2 +- src/uu/paste/Cargo.toml | 2 +- src/uu/pathchk/Cargo.toml | 2 +- src/uu/pinky/Cargo.toml | 2 +- src/uu/printenv/Cargo.toml | 2 +- src/uu/printf/Cargo.toml | 2 +- src/uu/ptx/Cargo.toml | 2 +- src/uu/pwd/Cargo.toml | 2 +- src/uu/readlink/Cargo.toml | 2 +- src/uu/realpath/Cargo.toml | 2 +- src/uu/relpath/Cargo.toml | 2 +- src/uu/rm/Cargo.toml | 2 +- src/uu/rmdir/Cargo.toml | 2 +- src/uu/seq/Cargo.toml | 2 +- src/uu/shred/Cargo.toml | 2 +- src/uu/shuf/Cargo.toml | 2 +- src/uu/sleep/Cargo.toml | 2 +- src/uu/sort/Cargo.toml | 2 +- src/uu/split/Cargo.toml | 2 +- src/uu/stat/Cargo.toml | 2 +- src/uu/stdbuf/Cargo.toml | 4 +- src/uu/stdbuf/src/libstdbuf/Cargo.toml | 2 +- src/uu/sum/Cargo.toml | 2 +- src/uu/sync/Cargo.toml | 2 +- src/uu/tac/Cargo.toml | 2 +- src/uu/tail/Cargo.toml | 2 +- src/uu/tee/Cargo.toml | 2 +- src/uu/test/Cargo.toml | 2 +- src/uu/timeout/Cargo.toml | 2 +- src/uu/touch/Cargo.toml | 2 +- src/uu/tr/Cargo.toml | 2 +- src/uu/true/Cargo.toml | 2 +- src/uu/truncate/Cargo.toml | 2 +- src/uu/tsort/Cargo.toml | 2 +- src/uu/tty/Cargo.toml | 2 +- src/uu/uname/Cargo.toml | 2 +- src/uu/unexpand/Cargo.toml | 2 +- src/uu/uniq/Cargo.toml | 2 +- src/uu/unlink/Cargo.toml | 2 +- src/uu/uptime/Cargo.toml | 2 +- src/uu/users/Cargo.toml | 2 +- src/uu/wc/Cargo.toml | 2 +- src/uu/who/Cargo.toml | 2 +- src/uu/whoami/Cargo.toml | 2 +- src/uu/yes/Cargo.toml | 2 +- util/update-version.sh | 8 +- 99 files changed, 294 insertions(+), 294 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c7c165e6..ea1ee53ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,7 +204,7 @@ dependencies = [ [[package]] name = "coreutils" -version = "0.0.5" +version = "0.0.6" dependencies = [ "conv", "filetime", @@ -1545,7 +1545,7 @@ dependencies = [ [[package]] name = "uu_arch" -version = "0.0.5" +version = "0.0.6" dependencies = [ "platform-info", "uucore", @@ -1554,7 +1554,7 @@ dependencies = [ [[package]] name = "uu_base32" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -1562,7 +1562,7 @@ dependencies = [ [[package]] name = "uu_base64" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -1570,7 +1570,7 @@ dependencies = [ [[package]] name = "uu_basename" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -1578,7 +1578,7 @@ dependencies = [ [[package]] name = "uu_cat" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "quick-error", @@ -1589,7 +1589,7 @@ dependencies = [ [[package]] name = "uu_chgrp" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -1598,7 +1598,7 @@ dependencies = [ [[package]] name = "uu_chmod" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1609,7 +1609,7 @@ dependencies = [ [[package]] name = "uu_chown" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "glob 0.3.0", @@ -1620,7 +1620,7 @@ dependencies = [ [[package]] name = "uu_chroot" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -1629,7 +1629,7 @@ dependencies = [ [[package]] name = "uu_cksum" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1639,7 +1639,7 @@ dependencies = [ [[package]] name = "uu_comm" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1649,7 +1649,7 @@ dependencies = [ [[package]] name = "uu_cp" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "filetime", @@ -1665,7 +1665,7 @@ dependencies = [ [[package]] name = "uu_csplit" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "glob 0.2.11", @@ -1677,7 +1677,7 @@ dependencies = [ [[package]] name = "uu_cut" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -1685,7 +1685,7 @@ dependencies = [ [[package]] name = "uu_date" -version = "0.0.5" +version = "0.0.6" dependencies = [ "chrono", "clap", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "uu_df" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1709,7 +1709,7 @@ dependencies = [ [[package]] name = "uu_dircolors" -version = "0.0.5" +version = "0.0.6" dependencies = [ "glob 0.3.0", "uucore", @@ -1718,7 +1718,7 @@ dependencies = [ [[package]] name = "uu_dirname" -version = "0.0.5" +version = "0.0.6" dependencies = [ "libc", "uucore", @@ -1727,7 +1727,7 @@ dependencies = [ [[package]] name = "uu_du" -version = "0.0.5" +version = "0.0.6" dependencies = [ "time", "uucore", @@ -1737,7 +1737,7 @@ dependencies = [ [[package]] name = "uu_echo" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -1746,7 +1746,7 @@ dependencies = [ [[package]] name = "uu_env" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1757,7 +1757,7 @@ dependencies = [ [[package]] name = "uu_expand" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "unicode-width", @@ -1767,7 +1767,7 @@ dependencies = [ [[package]] name = "uu_expr" -version = "0.0.5" +version = "0.0.6" dependencies = [ "libc", "onig", @@ -1777,7 +1777,7 @@ dependencies = [ [[package]] name = "uu_factor" -version = "0.0.5" +version = "0.0.6" dependencies = [ "criterion", "num-traits", @@ -1792,7 +1792,7 @@ dependencies = [ [[package]] name = "uu_false" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -1800,7 +1800,7 @@ dependencies = [ [[package]] name = "uu_fmt" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1811,7 +1811,7 @@ dependencies = [ [[package]] name = "uu_fold" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -1819,7 +1819,7 @@ dependencies = [ [[package]] name = "uu_groups" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -1828,7 +1828,7 @@ dependencies = [ [[package]] name = "uu_hashsum" -version = "0.0.5" +version = "0.0.6" dependencies = [ "blake2-rfc", "clap", @@ -1847,7 +1847,7 @@ dependencies = [ [[package]] name = "uu_head" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -1856,7 +1856,7 @@ dependencies = [ [[package]] name = "uu_hostid" -version = "0.0.5" +version = "0.0.6" dependencies = [ "libc", "uucore", @@ -1865,7 +1865,7 @@ dependencies = [ [[package]] name = "uu_hostname" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "hostname", @@ -1877,7 +1877,7 @@ dependencies = [ [[package]] name = "uu_id" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -1886,7 +1886,7 @@ dependencies = [ [[package]] name = "uu_install" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "file_diff", @@ -1899,7 +1899,7 @@ dependencies = [ [[package]] name = "uu_join" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -1908,7 +1908,7 @@ dependencies = [ [[package]] name = "uu_kill" -version = "0.0.5" +version = "0.0.6" dependencies = [ "libc", "uucore", @@ -1917,7 +1917,7 @@ dependencies = [ [[package]] name = "uu_link" -version = "0.0.5" +version = "0.0.6" dependencies = [ "libc", "uucore", @@ -1926,7 +1926,7 @@ dependencies = [ [[package]] name = "uu_ln" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1936,7 +1936,7 @@ dependencies = [ [[package]] name = "uu_logname" -version = "0.0.5" +version = "0.0.6" dependencies = [ "libc", "uucore", @@ -1945,7 +1945,7 @@ dependencies = [ [[package]] name = "uu_ls" -version = "0.0.5" +version = "0.0.6" dependencies = [ "atty", "clap", @@ -1961,7 +1961,7 @@ dependencies = [ [[package]] name = "uu_mkdir" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1971,7 +1971,7 @@ dependencies = [ [[package]] name = "uu_mkfifo" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -1981,7 +1981,7 @@ dependencies = [ [[package]] name = "uu_mknod" -version = "0.0.5" +version = "0.0.6" dependencies = [ "getopts", "libc", @@ -1991,7 +1991,7 @@ dependencies = [ [[package]] name = "uu_mktemp" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "rand 0.5.6", @@ -2002,7 +2002,7 @@ dependencies = [ [[package]] name = "uu_more" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "nix 0.13.1", @@ -2014,7 +2014,7 @@ dependencies = [ [[package]] name = "uu_mv" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "fs_extra", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "uu_nice" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2035,7 +2035,7 @@ dependencies = [ [[package]] name = "uu_nl" -version = "0.0.5" +version = "0.0.6" dependencies = [ "aho-corasick", "clap", @@ -2049,7 +2049,7 @@ dependencies = [ [[package]] name = "uu_nohup" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2059,7 +2059,7 @@ dependencies = [ [[package]] name = "uu_nproc" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2070,7 +2070,7 @@ dependencies = [ [[package]] name = "uu_numfmt" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2079,7 +2079,7 @@ dependencies = [ [[package]] name = "uu_od" -version = "0.0.5" +version = "0.0.6" dependencies = [ "byteorder", "clap", @@ -2091,7 +2091,7 @@ dependencies = [ [[package]] name = "uu_paste" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2100,7 +2100,7 @@ dependencies = [ [[package]] name = "uu_pathchk" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2110,7 +2110,7 @@ dependencies = [ [[package]] name = "uu_pinky" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -2118,7 +2118,7 @@ dependencies = [ [[package]] name = "uu_printenv" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2127,7 +2127,7 @@ dependencies = [ [[package]] name = "uu_printf" -version = "0.0.5" +version = "0.0.6" dependencies = [ "itertools 0.8.2", "uucore", @@ -2136,7 +2136,7 @@ dependencies = [ [[package]] name = "uu_ptx" -version = "0.0.5" +version = "0.0.6" dependencies = [ "aho-corasick", "clap", @@ -2150,7 +2150,7 @@ dependencies = [ [[package]] name = "uu_pwd" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2159,7 +2159,7 @@ dependencies = [ [[package]] name = "uu_readlink" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2169,7 +2169,7 @@ dependencies = [ [[package]] name = "uu_realpath" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2178,7 +2178,7 @@ dependencies = [ [[package]] name = "uu_relpath" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2187,7 +2187,7 @@ dependencies = [ [[package]] name = "uu_rm" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "remove_dir_all", @@ -2198,7 +2198,7 @@ dependencies = [ [[package]] name = "uu_rmdir" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2207,7 +2207,7 @@ dependencies = [ [[package]] name = "uu_seq" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2216,7 +2216,7 @@ dependencies = [ [[package]] name = "uu_shred" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "filetime", @@ -2229,7 +2229,7 @@ dependencies = [ [[package]] name = "uu_shuf" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "rand 0.5.6", @@ -2239,7 +2239,7 @@ dependencies = [ [[package]] name = "uu_sleep" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2248,7 +2248,7 @@ dependencies = [ [[package]] name = "uu_sort" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "itertools 0.8.2", @@ -2261,7 +2261,7 @@ dependencies = [ [[package]] name = "uu_split" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2270,7 +2270,7 @@ dependencies = [ [[package]] name = "uu_stat" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "time", @@ -2280,7 +2280,7 @@ dependencies = [ [[package]] name = "uu_stdbuf" -version = "0.0.5" +version = "0.0.6" dependencies = [ "getopts", "tempfile", @@ -2291,7 +2291,7 @@ dependencies = [ [[package]] name = "uu_stdbuf_libstdbuf" -version = "0.0.5" +version = "0.0.6" dependencies = [ "cpp", "cpp_build", @@ -2302,7 +2302,7 @@ dependencies = [ [[package]] name = "uu_sum" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2311,7 +2311,7 @@ dependencies = [ [[package]] name = "uu_sync" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2322,7 +2322,7 @@ dependencies = [ [[package]] name = "uu_tac" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2331,7 +2331,7 @@ dependencies = [ [[package]] name = "uu_tail" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2343,7 +2343,7 @@ dependencies = [ [[package]] name = "uu_tee" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2354,7 +2354,7 @@ dependencies = [ [[package]] name = "uu_test" -version = "0.0.5" +version = "0.0.6" dependencies = [ "libc", "redox_syscall 0.1.57", @@ -2364,7 +2364,7 @@ dependencies = [ [[package]] name = "uu_timeout" -version = "0.0.5" +version = "0.0.6" dependencies = [ "getopts", "libc", @@ -2374,7 +2374,7 @@ dependencies = [ [[package]] name = "uu_touch" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "filetime", @@ -2385,7 +2385,7 @@ dependencies = [ [[package]] name = "uu_tr" -version = "0.0.5" +version = "0.0.6" dependencies = [ "bit-set", "clap", @@ -2396,7 +2396,7 @@ dependencies = [ [[package]] name = "uu_true" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -2404,7 +2404,7 @@ dependencies = [ [[package]] name = "uu_truncate" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2413,7 +2413,7 @@ dependencies = [ [[package]] name = "uu_tsort" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2422,7 +2422,7 @@ dependencies = [ [[package]] name = "uu_tty" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2432,7 +2432,7 @@ dependencies = [ [[package]] name = "uu_uname" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "platform-info", @@ -2442,7 +2442,7 @@ dependencies = [ [[package]] name = "uu_unexpand" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "unicode-width", @@ -2452,7 +2452,7 @@ dependencies = [ [[package]] name = "uu_uniq" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2461,7 +2461,7 @@ dependencies = [ [[package]] name = "uu_unlink" -version = "0.0.5" +version = "0.0.6" dependencies = [ "getopts", "libc", @@ -2471,7 +2471,7 @@ dependencies = [ [[package]] name = "uu_uptime" -version = "0.0.5" +version = "0.0.6" dependencies = [ "chrono", "clap", @@ -2481,7 +2481,7 @@ dependencies = [ [[package]] name = "uu_users" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", @@ -2490,7 +2490,7 @@ dependencies = [ [[package]] name = "uu_wc" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "libc", @@ -2502,7 +2502,7 @@ dependencies = [ [[package]] name = "uu_who" -version = "0.0.5" +version = "0.0.6" dependencies = [ "uucore", "uucore_procs", @@ -2510,7 +2510,7 @@ dependencies = [ [[package]] name = "uu_whoami" -version = "0.0.5" +version = "0.0.6" dependencies = [ "advapi32-sys", "clap", @@ -2521,7 +2521,7 @@ dependencies = [ [[package]] name = "uu_yes" -version = "0.0.5" +version = "0.0.6" dependencies = [ "clap", "uucore", diff --git a/Cargo.toml b/Cargo.toml index 398791ca9..7e3fb9139 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "coreutils" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "coreutils ~ GNU coreutils (updated); implemented as universal (cross-platform) utils, written in Rust" @@ -228,102 +228,102 @@ lazy_static = { version="1.3" } textwrap = { version="=0.11.0", features=["term_size"] } # !maint: [2020-05-10; rivy] unstable crate using undocumented features; pinned currently, will review uucore = { version=">=0.0.8", package="uucore", path="src/uucore" } # * uutils -uu_test = { optional=true, version="0.0.5", package="uu_test", path="src/uu/test" } +uu_test = { optional=true, version="0.0.6", package="uu_test", path="src/uu/test" } # -arch = { optional=true, version="0.0.5", package="uu_arch", path="src/uu/arch" } -base32 = { optional=true, version="0.0.5", package="uu_base32", path="src/uu/base32" } -base64 = { optional=true, version="0.0.5", package="uu_base64", path="src/uu/base64" } -basename = { optional=true, version="0.0.5", package="uu_basename", path="src/uu/basename" } -cat = { optional=true, version="0.0.5", package="uu_cat", path="src/uu/cat" } -chgrp = { optional=true, version="0.0.5", package="uu_chgrp", path="src/uu/chgrp" } -chmod = { optional=true, version="0.0.5", package="uu_chmod", path="src/uu/chmod" } -chown = { optional=true, version="0.0.5", package="uu_chown", path="src/uu/chown" } -chroot = { optional=true, version="0.0.5", package="uu_chroot", path="src/uu/chroot" } -cksum = { optional=true, version="0.0.5", package="uu_cksum", path="src/uu/cksum" } -comm = { optional=true, version="0.0.5", package="uu_comm", path="src/uu/comm" } -cp = { optional=true, version="0.0.5", package="uu_cp", path="src/uu/cp" } -csplit = { optional=true, version="0.0.5", package="uu_csplit", path="src/uu/csplit" } -cut = { optional=true, version="0.0.5", package="uu_cut", path="src/uu/cut" } -date = { optional=true, version="0.0.5", package="uu_date", path="src/uu/date" } -df = { optional=true, version="0.0.5", package="uu_df", path="src/uu/df" } -dircolors= { optional=true, version="0.0.5", package="uu_dircolors", path="src/uu/dircolors" } -dirname = { optional=true, version="0.0.5", package="uu_dirname", path="src/uu/dirname" } -du = { optional=true, version="0.0.5", package="uu_du", path="src/uu/du" } -echo = { optional=true, version="0.0.5", package="uu_echo", path="src/uu/echo" } -env = { optional=true, version="0.0.5", package="uu_env", path="src/uu/env" } -expand = { optional=true, version="0.0.5", package="uu_expand", path="src/uu/expand" } -expr = { optional=true, version="0.0.5", package="uu_expr", path="src/uu/expr" } -factor = { optional=true, version="0.0.5", package="uu_factor", path="src/uu/factor" } -false = { optional=true, version="0.0.5", package="uu_false", path="src/uu/false" } -fmt = { optional=true, version="0.0.5", package="uu_fmt", path="src/uu/fmt" } -fold = { optional=true, version="0.0.5", package="uu_fold", path="src/uu/fold" } -groups = { optional=true, version="0.0.5", package="uu_groups", path="src/uu/groups" } -hashsum = { optional=true, version="0.0.5", package="uu_hashsum", path="src/uu/hashsum" } -head = { optional=true, version="0.0.5", package="uu_head", path="src/uu/head" } -hostid = { optional=true, version="0.0.5", package="uu_hostid", path="src/uu/hostid" } -hostname = { optional=true, version="0.0.5", package="uu_hostname", path="src/uu/hostname" } -id = { optional=true, version="0.0.5", package="uu_id", path="src/uu/id" } -install = { optional=true, version="0.0.5", package="uu_install", path="src/uu/install" } -join = { optional=true, version="0.0.5", package="uu_join", path="src/uu/join" } -kill = { optional=true, version="0.0.5", package="uu_kill", path="src/uu/kill" } -link = { optional=true, version="0.0.5", package="uu_link", path="src/uu/link" } -ln = { optional=true, version="0.0.5", package="uu_ln", path="src/uu/ln" } -ls = { optional=true, version="0.0.5", package="uu_ls", path="src/uu/ls" } -logname = { optional=true, version="0.0.5", package="uu_logname", path="src/uu/logname" } -mkdir = { optional=true, version="0.0.5", package="uu_mkdir", path="src/uu/mkdir" } -mkfifo = { optional=true, version="0.0.5", package="uu_mkfifo", path="src/uu/mkfifo" } -mknod = { optional=true, version="0.0.5", package="uu_mknod", path="src/uu/mknod" } -mktemp = { optional=true, version="0.0.5", package="uu_mktemp", path="src/uu/mktemp" } -more = { optional=true, version="0.0.5", package="uu_more", path="src/uu/more" } -mv = { optional=true, version="0.0.5", package="uu_mv", path="src/uu/mv" } -nice = { optional=true, version="0.0.5", package="uu_nice", path="src/uu/nice" } -nl = { optional=true, version="0.0.5", package="uu_nl", path="src/uu/nl" } -nohup = { optional=true, version="0.0.5", package="uu_nohup", path="src/uu/nohup" } -nproc = { optional=true, version="0.0.5", package="uu_nproc", path="src/uu/nproc" } -numfmt = { optional=true, version="0.0.5", package="uu_numfmt", path="src/uu/numfmt" } -od = { optional=true, version="0.0.5", package="uu_od", path="src/uu/od" } -paste = { optional=true, version="0.0.5", package="uu_paste", path="src/uu/paste" } -pathchk = { optional=true, version="0.0.5", package="uu_pathchk", path="src/uu/pathchk" } -pinky = { optional=true, version="0.0.5", package="uu_pinky", path="src/uu/pinky" } -printenv = { optional=true, version="0.0.5", package="uu_printenv", path="src/uu/printenv" } -printf = { optional=true, version="0.0.5", package="uu_printf", path="src/uu/printf" } -ptx = { optional=true, version="0.0.5", package="uu_ptx", path="src/uu/ptx" } -pwd = { optional=true, version="0.0.5", package="uu_pwd", path="src/uu/pwd" } -readlink = { optional=true, version="0.0.5", package="uu_readlink", path="src/uu/readlink" } -realpath = { optional=true, version="0.0.5", package="uu_realpath", path="src/uu/realpath" } -relpath = { optional=true, version="0.0.5", package="uu_relpath", path="src/uu/relpath" } -rm = { optional=true, version="0.0.5", package="uu_rm", path="src/uu/rm" } -rmdir = { optional=true, version="0.0.5", package="uu_rmdir", path="src/uu/rmdir" } -seq = { optional=true, version="0.0.5", package="uu_seq", path="src/uu/seq" } -shred = { optional=true, version="0.0.5", package="uu_shred", path="src/uu/shred" } -shuf = { optional=true, version="0.0.5", package="uu_shuf", path="src/uu/shuf" } -sleep = { optional=true, version="0.0.5", package="uu_sleep", path="src/uu/sleep" } -sort = { optional=true, version="0.0.5", package="uu_sort", path="src/uu/sort" } -split = { optional=true, version="0.0.5", package="uu_split", path="src/uu/split" } -stat = { optional=true, version="0.0.5", package="uu_stat", path="src/uu/stat" } -stdbuf = { optional=true, version="0.0.5", package="uu_stdbuf", path="src/uu/stdbuf" } -sum = { optional=true, version="0.0.5", package="uu_sum", path="src/uu/sum" } -sync = { optional=true, version="0.0.5", package="uu_sync", path="src/uu/sync" } -tac = { optional=true, version="0.0.5", package="uu_tac", path="src/uu/tac" } -tail = { optional=true, version="0.0.5", package="uu_tail", path="src/uu/tail" } -tee = { optional=true, version="0.0.5", package="uu_tee", path="src/uu/tee" } -timeout = { optional=true, version="0.0.5", package="uu_timeout", path="src/uu/timeout" } -touch = { optional=true, version="0.0.5", package="uu_touch", path="src/uu/touch" } -tr = { optional=true, version="0.0.5", package="uu_tr", path="src/uu/tr" } -true = { optional=true, version="0.0.5", package="uu_true", path="src/uu/true" } -truncate = { optional=true, version="0.0.5", package="uu_truncate", path="src/uu/truncate" } -tsort = { optional=true, version="0.0.5", package="uu_tsort", path="src/uu/tsort" } -tty = { optional=true, version="0.0.5", package="uu_tty", path="src/uu/tty" } -uname = { optional=true, version="0.0.5", package="uu_uname", path="src/uu/uname" } -unexpand = { optional=true, version="0.0.5", package="uu_unexpand", path="src/uu/unexpand" } -uniq = { optional=true, version="0.0.5", package="uu_uniq", path="src/uu/uniq" } -unlink = { optional=true, version="0.0.5", package="uu_unlink", path="src/uu/unlink" } -uptime = { optional=true, version="0.0.5", package="uu_uptime", path="src/uu/uptime" } -users = { optional=true, version="0.0.5", package="uu_users", path="src/uu/users" } -wc = { optional=true, version="0.0.5", package="uu_wc", path="src/uu/wc" } -who = { optional=true, version="0.0.5", package="uu_who", path="src/uu/who" } -whoami = { optional=true, version="0.0.5", package="uu_whoami", path="src/uu/whoami" } -yes = { optional=true, version="0.0.5", package="uu_yes", path="src/uu/yes" } +arch = { optional=true, version="0.0.6", package="uu_arch", path="src/uu/arch" } +base32 = { optional=true, version="0.0.6", package="uu_base32", path="src/uu/base32" } +base64 = { optional=true, version="0.0.6", package="uu_base64", path="src/uu/base64" } +basename = { optional=true, version="0.0.6", package="uu_basename", path="src/uu/basename" } +cat = { optional=true, version="0.0.6", package="uu_cat", path="src/uu/cat" } +chgrp = { optional=true, version="0.0.6", package="uu_chgrp", path="src/uu/chgrp" } +chmod = { optional=true, version="0.0.6", package="uu_chmod", path="src/uu/chmod" } +chown = { optional=true, version="0.0.6", package="uu_chown", path="src/uu/chown" } +chroot = { optional=true, version="0.0.6", package="uu_chroot", path="src/uu/chroot" } +cksum = { optional=true, version="0.0.6", package="uu_cksum", path="src/uu/cksum" } +comm = { optional=true, version="0.0.6", package="uu_comm", path="src/uu/comm" } +cp = { optional=true, version="0.0.6", package="uu_cp", path="src/uu/cp" } +csplit = { optional=true, version="0.0.6", package="uu_csplit", path="src/uu/csplit" } +cut = { optional=true, version="0.0.6", package="uu_cut", path="src/uu/cut" } +date = { optional=true, version="0.0.6", package="uu_date", path="src/uu/date" } +df = { optional=true, version="0.0.6", package="uu_df", path="src/uu/df" } +dircolors= { optional=true, version="0.0.6", package="uu_dircolors", path="src/uu/dircolors" } +dirname = { optional=true, version="0.0.6", package="uu_dirname", path="src/uu/dirname" } +du = { optional=true, version="0.0.6", package="uu_du", path="src/uu/du" } +echo = { optional=true, version="0.0.6", package="uu_echo", path="src/uu/echo" } +env = { optional=true, version="0.0.6", package="uu_env", path="src/uu/env" } +expand = { optional=true, version="0.0.6", package="uu_expand", path="src/uu/expand" } +expr = { optional=true, version="0.0.6", package="uu_expr", path="src/uu/expr" } +factor = { optional=true, version="0.0.6", package="uu_factor", path="src/uu/factor" } +false = { optional=true, version="0.0.6", package="uu_false", path="src/uu/false" } +fmt = { optional=true, version="0.0.6", package="uu_fmt", path="src/uu/fmt" } +fold = { optional=true, version="0.0.6", package="uu_fold", path="src/uu/fold" } +groups = { optional=true, version="0.0.6", package="uu_groups", path="src/uu/groups" } +hashsum = { optional=true, version="0.0.6", package="uu_hashsum", path="src/uu/hashsum" } +head = { optional=true, version="0.0.6", package="uu_head", path="src/uu/head" } +hostid = { optional=true, version="0.0.6", package="uu_hostid", path="src/uu/hostid" } +hostname = { optional=true, version="0.0.6", package="uu_hostname", path="src/uu/hostname" } +id = { optional=true, version="0.0.6", package="uu_id", path="src/uu/id" } +install = { optional=true, version="0.0.6", package="uu_install", path="src/uu/install" } +join = { optional=true, version="0.0.6", package="uu_join", path="src/uu/join" } +kill = { optional=true, version="0.0.6", package="uu_kill", path="src/uu/kill" } +link = { optional=true, version="0.0.6", package="uu_link", path="src/uu/link" } +ln = { optional=true, version="0.0.6", package="uu_ln", path="src/uu/ln" } +ls = { optional=true, version="0.0.6", package="uu_ls", path="src/uu/ls" } +logname = { optional=true, version="0.0.6", package="uu_logname", path="src/uu/logname" } +mkdir = { optional=true, version="0.0.6", package="uu_mkdir", path="src/uu/mkdir" } +mkfifo = { optional=true, version="0.0.6", package="uu_mkfifo", path="src/uu/mkfifo" } +mknod = { optional=true, version="0.0.6", package="uu_mknod", path="src/uu/mknod" } +mktemp = { optional=true, version="0.0.6", package="uu_mktemp", path="src/uu/mktemp" } +more = { optional=true, version="0.0.6", package="uu_more", path="src/uu/more" } +mv = { optional=true, version="0.0.6", package="uu_mv", path="src/uu/mv" } +nice = { optional=true, version="0.0.6", package="uu_nice", path="src/uu/nice" } +nl = { optional=true, version="0.0.6", package="uu_nl", path="src/uu/nl" } +nohup = { optional=true, version="0.0.6", package="uu_nohup", path="src/uu/nohup" } +nproc = { optional=true, version="0.0.6", package="uu_nproc", path="src/uu/nproc" } +numfmt = { optional=true, version="0.0.6", package="uu_numfmt", path="src/uu/numfmt" } +od = { optional=true, version="0.0.6", package="uu_od", path="src/uu/od" } +paste = { optional=true, version="0.0.6", package="uu_paste", path="src/uu/paste" } +pathchk = { optional=true, version="0.0.6", package="uu_pathchk", path="src/uu/pathchk" } +pinky = { optional=true, version="0.0.6", package="uu_pinky", path="src/uu/pinky" } +printenv = { optional=true, version="0.0.6", package="uu_printenv", path="src/uu/printenv" } +printf = { optional=true, version="0.0.6", package="uu_printf", path="src/uu/printf" } +ptx = { optional=true, version="0.0.6", package="uu_ptx", path="src/uu/ptx" } +pwd = { optional=true, version="0.0.6", package="uu_pwd", path="src/uu/pwd" } +readlink = { optional=true, version="0.0.6", package="uu_readlink", path="src/uu/readlink" } +realpath = { optional=true, version="0.0.6", package="uu_realpath", path="src/uu/realpath" } +relpath = { optional=true, version="0.0.6", package="uu_relpath", path="src/uu/relpath" } +rm = { optional=true, version="0.0.6", package="uu_rm", path="src/uu/rm" } +rmdir = { optional=true, version="0.0.6", package="uu_rmdir", path="src/uu/rmdir" } +seq = { optional=true, version="0.0.6", package="uu_seq", path="src/uu/seq" } +shred = { optional=true, version="0.0.6", package="uu_shred", path="src/uu/shred" } +shuf = { optional=true, version="0.0.6", package="uu_shuf", path="src/uu/shuf" } +sleep = { optional=true, version="0.0.6", package="uu_sleep", path="src/uu/sleep" } +sort = { optional=true, version="0.0.6", package="uu_sort", path="src/uu/sort" } +split = { optional=true, version="0.0.6", package="uu_split", path="src/uu/split" } +stat = { optional=true, version="0.0.6", package="uu_stat", path="src/uu/stat" } +stdbuf = { optional=true, version="0.0.6", package="uu_stdbuf", path="src/uu/stdbuf" } +sum = { optional=true, version="0.0.6", package="uu_sum", path="src/uu/sum" } +sync = { optional=true, version="0.0.6", package="uu_sync", path="src/uu/sync" } +tac = { optional=true, version="0.0.6", package="uu_tac", path="src/uu/tac" } +tail = { optional=true, version="0.0.6", package="uu_tail", path="src/uu/tail" } +tee = { optional=true, version="0.0.6", package="uu_tee", path="src/uu/tee" } +timeout = { optional=true, version="0.0.6", package="uu_timeout", path="src/uu/timeout" } +touch = { optional=true, version="0.0.6", package="uu_touch", path="src/uu/touch" } +tr = { optional=true, version="0.0.6", package="uu_tr", path="src/uu/tr" } +true = { optional=true, version="0.0.6", package="uu_true", path="src/uu/true" } +truncate = { optional=true, version="0.0.6", package="uu_truncate", path="src/uu/truncate" } +tsort = { optional=true, version="0.0.6", package="uu_tsort", path="src/uu/tsort" } +tty = { optional=true, version="0.0.6", package="uu_tty", path="src/uu/tty" } +uname = { optional=true, version="0.0.6", package="uu_uname", path="src/uu/uname" } +unexpand = { optional=true, version="0.0.6", package="uu_unexpand", path="src/uu/unexpand" } +uniq = { optional=true, version="0.0.6", package="uu_uniq", path="src/uu/uniq" } +unlink = { optional=true, version="0.0.6", package="uu_unlink", path="src/uu/unlink" } +uptime = { optional=true, version="0.0.6", package="uu_uptime", path="src/uu/uptime" } +users = { optional=true, version="0.0.6", package="uu_users", path="src/uu/users" } +wc = { optional=true, version="0.0.6", package="uu_wc", path="src/uu/wc" } +who = { optional=true, version="0.0.6", package="uu_who", path="src/uu/who" } +whoami = { optional=true, version="0.0.6", package="uu_whoami", path="src/uu/whoami" } +yes = { optional=true, version="0.0.6", package="uu_yes", path="src/uu/yes" } # # * pinned transitive dependencies # Not needed for now. Keep as examples: diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index e23067788..0b4359620 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_arch" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "arch ~ (uutils) display machine architecture" diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index d4415dd8c..a1d7ba17e 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base32" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "base32 ~ (uutils) decode/encode input (base32-encoding)" diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index e893caf3a..841ab140c 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base64" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "base64 ~ (uutils) decode/encode input (base64-encoding)" diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index 681ccf1c4..92d0ca4cd 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_basename" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "basename ~ (uutils) display PATHNAME with leading directory components removed" diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 2176a5e0b..e44a874c1 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cat" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "cat ~ (uutils) concatenate and display input" diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index 2cefca4d8..9424ad35e 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chgrp" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "chgrp ~ (uutils) change the group ownership of FILE" diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index 71ded6d90..ac7030b62 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chmod" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "chmod ~ (uutils) change mode of FILE" diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index 27a30da17..74533af04 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chown" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "chown ~ (uutils) change the ownership of FILE" diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index 51fb9541d..bf1e0ef59 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chroot" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "chroot ~ (uutils) run COMMAND under a new root directory" diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index 2f589e877..0332efbf8 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cksum" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "cksum ~ (uutils) display CRC and size of input" diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index 9babe82ea..f02217790 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_comm" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "comm ~ (uutils) compare sorted inputs" diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index 53d27137f..9d582adae 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cp" -version = "0.0.5" +version = "0.0.6" authors = [ "Jordy Dickinson ", "Joshua S. Miller ", diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index a5eac1a02..7687991b0 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_csplit" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "csplit ~ (uutils) Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output" diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index 10a282ecf..9cc852d2e 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cut" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "cut ~ (uutils) display byte/field columns of input lines" diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index cacf29ff0..db6c077bd 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_date" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "date ~ (uutils) display or set the current time" diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index 049422ce5..4770cb557 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_df" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "df ~ (uutils) display file system information" diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index 9ed55d20d..5e822820e 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dircolors" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "dircolors ~ (uutils) display commands to set LS_COLORS" diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index 575aefd51..d3cd185e7 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dirname" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "dirname ~ (uutils) display parent directory of PATHNAME" diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index 01045f887..eb7b23f8b 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_du" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "du ~ (uutils) display disk usage" diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index 2ac09cd39..15f189030 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_echo" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "echo ~ (uutils) display TEXT" diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index fc5317184..ef0017e02 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_env" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "env ~ (uutils) set each NAME to VALUE in the environment and run COMMAND" diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index 09575254a..4931cf53c 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expand" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "expand ~ (uutils) convert input tabs to spaces" diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index 7e38103aa..c535df7ce 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expr" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "expr ~ (uutils) display the value of EXPRESSION" diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index 1d415a951..489c713be 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_factor" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "factor ~ (uutils) display the prime factors of each NUMBER" diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index 5651888d7..d7cbcd13a 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_false" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "false ~ (uutils) do nothing and fail" diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index 688967a5a..24ee13b35 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fmt" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "fmt ~ (uutils) reformat each paragraph of input" diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index de1aa2dd5..f99abc691 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fold" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "fold ~ (uutils) wrap each line of input" diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index d005599de..1a56bc2ab 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_groups" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "groups ~ (uutils) display group memberships for USERNAME" diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index b08b853ef..04a22cac7 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hashsum" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "hashsum ~ (uutils) display or check input digests" diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index 2f5d97d62..3c383cb6f 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_head" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "head ~ (uutils) display the first lines of input" diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index e872aff06..ab6954104 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostid" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "hostid ~ (uutils) display the numeric identifier of the current host" diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index bc4b10951..fb1d00682 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostname" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "hostname ~ (uutils) display or set the host name of the current host" diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index 6edb1d606..308d6089d 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_id" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "id ~ (uutils) display user and group information for USER" diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 16f78bb7b..91463199a 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_install" -version = "0.0.5" +version = "0.0.6" authors = [ "Ben Eills ", "uutils developers", diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index 5b18603ab..9371b7601 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_join" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "join ~ (uutils) merge lines from inputs with matching join fields" diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index 16a34de69..6b66806bc 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_kill" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "kill ~ (uutils) send a signal to a process" diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index 9c15d8682..13c3453cf 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_link" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "link ~ (uutils) create a hard (file system) link to FILE" diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index 2d7f39005..c19d8fb52 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ln" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "ln ~ (uutils) create a (file system) link to TARGET" diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index 896fd5eb7..416f817d7 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_logname" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "logname ~ (uutils) display the login name of the current user" diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index b1d44e485..e1d9b7990 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ls" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "ls ~ (uutils) display directory contents" diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index 44a7eb18b..a8d374bf9 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkdir" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "mkdir ~ (uutils) create DIRECTORY" diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index 8ff6694d6..d66003b10 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkfifo" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "mkfifo ~ (uutils) create FIFOs (named pipes)" diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index 9badb5f13..2c3ac8fb9 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mknod" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "mknod ~ (uutils) create special file NAME of TYPE" diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index 13685a586..c669f0acc 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mktemp" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "mktemp ~ (uutils) create and display a temporary file or directory from TEMPLATE" diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index c910d08b0..1f4bfed68 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_more" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "more ~ (uutils) input perusal filter" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index f84a68c3c..8f1e7b9ee 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mv" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "mv ~ (uutils) move (rename) SOURCE to DESTINATION" diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index 2106b2d24..279e79ae3 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nice" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "nice ~ (uutils) run PROGRAM with modified scheduling priority" diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index f64182475..a51a2555e 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nl" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "nl ~ (uutils) display input with added line numbers" diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index 604e1e9da..5bbbd9dff 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nohup" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "nohup ~ (uutils) run COMMAND, ignoring hangup signals" diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index 2541c5a3e..be9d8f2e3 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nproc" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "nproc ~ (uutils) display the number of processing units available" diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index bde97cacb..ac5266d68 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_numfmt" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "numfmt ~ (uutils) reformat NUMBER" diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index a939c6ee4..6f9a75318 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_od" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "od ~ (uutils) display formatted representation of input" diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index 2ac2074ed..4e9971368 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_paste" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "paste ~ (uutils) merge lines from inputs" diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index 63d00daac..8c4e61d2b 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pathchk" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "pathchk ~ (uutils) diagnose invalid or non-portable PATHNAME" diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index 96fb32e74..3f4a75241 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pinky" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "pinky ~ (uutils) display user information" diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index f81240d77..be95b8157 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printenv" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "printenv ~ (uutils) display value of environment VAR" diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index 7f54decb5..bc77d31be 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printf" -version = "0.0.5" +version = "0.0.6" authors = [ "Nathan Ross", "uutils developers", diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index 889b4fafa..eb4413cbd 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ptx" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "ptx ~ (uutils) display a permuted index of input" diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index 43ddeac2e..f4350d54c 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pwd" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "pwd ~ (uutils) display current working directory" diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index 5d69125ce..6e4be4dd8 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_readlink" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "readlink ~ (uutils) display resolved path of PATHNAME" diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index bd25d9980..327a875f8 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_realpath" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "realpath ~ (uutils) display resolved absolute path of PATHNAME" diff --git a/src/uu/relpath/Cargo.toml b/src/uu/relpath/Cargo.toml index 34d3dd067..7a316c29c 100644 --- a/src/uu/relpath/Cargo.toml +++ b/src/uu/relpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_relpath" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "relpath ~ (uutils) display relative path of PATHNAME_TO from PATHNAME_FROM" diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index bd3415faf..961a8036c 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rm" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "rm ~ (uutils) remove PATHNAME" diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index cfd8dd6b0..b6e04f71c 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rmdir" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "rmdir ~ (uutils) remove empty DIRECTORY" diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index 2e98a0bb8..96c629c68 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_seq" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "seq ~ (uutils) display a sequence of numbers" diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index 6157f3780..dda68b45b 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shred" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "shred ~ (uutils) hide former FILE contents with repeated overwrites" diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index 7f911c156..dbf559454 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shuf" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "shuf ~ (uutils) display random permutations of input lines" diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index 8ff8505e1..fe7ee2941 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sleep" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "sleep ~ (uutils) pause for DURATION" diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index e805d4fa2..7a6f95c41 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sort" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "sort ~ (uutils) sort input lines" diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index 6032c6351..056fbe034 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_split" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "split ~ (uutils) split input into output files" diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index bf19f95b7..96bf63ffe 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stat" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "stat ~ (uutils) display FILE status" diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index 3fde13f72..22ce4de6a 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "stdbuf ~ (uutils) run COMMAND with modified standard stream buffering" @@ -21,7 +21,7 @@ uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [build-dependencies] -libstdbuf = { version="0.0.5", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } +libstdbuf = { version="0.0.6", package="uu_stdbuf_libstdbuf", path="src/libstdbuf" } [[bin]] name = "stdbuf" diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index ba6e5ff42..86eb09d46 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf_libstdbuf" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "stdbuf/libstdbuf ~ (uutils); dynamic library required for stdbuf" diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index b5a6d5d91..64b6d3de9 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sum" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "sum ~ (uutils) display checksum and block counts for input" diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index 39c49736a..fcff6002e 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sync" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "sync ~ (uutils) synchronize cache writes to storage" diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index 18e9fa430..3a530d0ce 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tac" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "tac ~ (uutils) concatenate and display input lines in reverse order" diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index 715a214e2..d3f60e09b 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tail" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "tail ~ (uutils) display the last lines of input" diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index c1841ce0f..7ac81adc4 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tee" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "tee ~ (uutils) display input and copy to FILE" diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index c03b84ab4..e1f6e62e7 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_test" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "test ~ (uutils) evaluate comparison and file type expressions" diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index c32547559..51ac0bc0e 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_timeout" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "timeout ~ (uutils) run COMMAND with a DURATION time limit" diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index 6fa84cbdd..0608a7b7c 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_touch" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "touch ~ (uutils) change FILE timestamps" diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index 04c013659..a3d066bfb 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tr" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "tr ~ (uutils) translate characters within input and display" diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index 780288155..9f13318fd 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_true" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "true ~ (uutils) do nothing and succeed" diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index 19f0d2736..e2c0afadc 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_truncate" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "truncate ~ (uutils) truncate (or extend) FILE to SIZE" diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index 3f3d20170..37f543012 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tsort" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "tsort ~ (uutils) topologically sort input (partially ordered) pairs" diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index d2c5110b5..7be27a900 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tty" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "tty ~ (uutils) display the name of the terminal connected to standard input" diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index a0461e33f..9707d8444 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uname" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "uname ~ (uutils) display system information" diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index 6d1cad613..e39dd87ca 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unexpand" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "unexpand ~ (uutils) convert input spaces to tabs" diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index 53c2281c4..8c63455ec 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uniq" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "uniq ~ (uutils) filter identical adjacent lines from input" diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index ea18e2cbb..b193bd1b5 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unlink" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "unlink ~ (uutils) remove a (file system) link to FILE" diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index 823879954..1136e6420 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uptime" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "uptime ~ (uutils) display dynamic system information" diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index 087272a59..84da13020 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_users" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "users ~ (uutils) display names of currently logged-in users" diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index 3f44c1273..8ae79dc08 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_wc" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "wc ~ (uutils) display newline, word, and byte counts for input" diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index 928136b10..c0cd63795 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_who" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "who ~ (uutils) display information about currently logged-in users" diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index e843b2167..f8dc01440 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_whoami" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "whoami ~ (uutils) display user name of current effective user ID" diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index ab8a6faff..4a843ddd8 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_yes" -version = "0.0.5" +version = "0.0.6" authors = ["uutils developers"] license = "MIT" description = "yes ~ (uutils) repeatedly display a line with STRING (or 'y')" diff --git a/util/update-version.sh b/util/update-version.sh index f5b66fb8c..042d43b71 100644 --- a/util/update-version.sh +++ b/util/update-version.sh @@ -3,8 +3,8 @@ # So, it should be triple-checked -FROM="0.0.4" -TO="0.0.5" +FROM="0.0.5" +TO="0.0.6" UUCORE_FROM="0.0.7" UUCORE_TO="0.0.8" @@ -19,8 +19,8 @@ sed -i -e "s|libstdbuf = { version=\"$FROM\"|libstdbuf = { version=\"$TO\"|" src sed -i -e "s|= { optional=true, version=\"$FROM\", package=\"uu_|= { optional=true, version=\"$TO\", package=\"uu_|g" Cargo.toml # Update uucore itself -sed -i -e "s|version = \"$UUCORE_FROM\"|version = \"$UUCORE_TO\"|" src/uucore/Cargo.toml +#sed -i -e "s|version = \"$UUCORE_FROM\"|version = \"$UUCORE_TO\"|" src/uucore/Cargo.toml # Update crates using uucore -sed -i -e "s|uucore = { version=\">=$UUCORE_FROM\",|uucore = { version=\">=$UUCORE_TO\",|" $PROGS +#sed -i -e "s|uucore = { version=\">=$UUCORE_FROM\",|uucore = { version=\">=$UUCORE_TO\",|" $PROGS From 54e9cb09dac17cdabd9d254c1dfade833d628f1c Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 3 Apr 2021 16:42:29 +0200 Subject: [PATCH 583/606] ls: add tests for --hide-control-chars --- tests/by-util/test_ls.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index b49620eb1..835a40a5e 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1162,6 +1162,24 @@ fn test_ls_quoting_style() { assert_eq!(result.stdout, format!("{}\n", correct)); } + for (arg, correct) in &[ + ("--quoting-style=literal", "one?two"), + ("-N", "one?two"), + ("--literal", "one?two"), + ("--quoting-style=shell", "one?two"), + ("--quoting-style=shell-always", "'one?two'"), + ] { + let result = scene + .ucmd() + .arg(arg) + .arg("--hide-control-chars") + .arg("one\ntwo") + .run(); + println!("stderr = {:?}", result.stderr); + println!("stdout = {:?}", result.stdout); + assert_eq!(result.stdout, format!("{}\n", correct)); + } + for (arg, correct) in &[ ("--quoting-style=literal", "one\ntwo"), ("-N", "one\ntwo"), From b940b2d79c606baf027570d5d4b316ecfb9686f3 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci Date: Sat, 3 Apr 2021 18:24:29 +0300 Subject: [PATCH 584/606] dirname: move to clap, simplify code --- Cargo.lock | 1 + src/uu/dirname/Cargo.toml | 1 + src/uu/dirname/src/dirname.rs | 40 ++++++++++++++++++++++++++++------- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ea1ee53ae..47fa76428 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1720,6 +1720,7 @@ dependencies = [ name = "uu_dirname" version = "0.0.6" dependencies = [ + "clap", "libc", "uucore", "uucore_procs", diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index d3cd185e7..0975f33bb 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/dirname.rs" [dependencies] +clap = "2.33" libc = "0.2.42" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/dirname/src/dirname.rs b/src/uu/dirname/src/dirname.rs index 59f47ff01..1cf35d0c4 100644 --- a/src/uu/dirname/src/dirname.rs +++ b/src/uu/dirname/src/dirname.rs @@ -8,32 +8,57 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::path::Path; static NAME: &str = "dirname"; static SYNTAX: &str = "[OPTION] NAME..."; static SUMMARY: &str = "strip last component from file name"; +static VERSION: &str = env!("CARGO_PKG_VERSION"); static LONG_HELP: &str = " Output each NAME with its last non-slash component and trailing slashes removed; if NAME contains no /'s, output '.' (meaning the current directory). "; +mod options { + pub const ZERO: &str = "zero"; + pub const DIR: &str = "dir"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optflag("z", "zero", "separate output with NUL rather than newline") - .parse(args); + let matches = App::new(executable!()) + .name(NAME) + .usage(SYNTAX) + .about(SUMMARY) + .after_help(LONG_HELP) + .version(VERSION) + .arg( + Arg::with_name(options::ZERO) + .short(options::ZERO) + .short("z") + .takes_value(false) + .help("separate output with NUL rather than newline"), + ) + .arg(Arg::with_name(options::DIR).hidden(true).multiple(true)) + .get_matches_from(args); - let separator = if matches.opt_present("zero") { + let separator = if matches.is_present(options::ZERO) { "\0" } else { "\n" }; - if !matches.free.is_empty() { - for path in &matches.free { + let dirnames: Vec = matches + .values_of(options::DIR) + .unwrap_or_default() + .map(str::to_owned) + .collect(); + + if !dirnames.is_empty() { + for path in dirnames.iter() { let p = Path::new(path); match p.parent() { Some(d) => { @@ -54,8 +79,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { print!("{}", separator); } } else { - println!("{0}: missing operand", NAME); - println!("Try '{0} --help' for more information.", NAME); + show_usage_error!("missing operand"); return 1; } From cfc3d52be40958d7042c0f56368212a41c0e8dcf Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci Date: Sat, 3 Apr 2021 20:19:30 +0300 Subject: [PATCH 585/606] cut: move to clap --- Cargo.lock | 1 + src/uu/cut/Cargo.toml | 1 + src/uu/cut/src/cut.rs | 150 ++++++++++++++++++++++++++++++++++-------- 3 files changed, 124 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ea1ee53ae..15f1a606d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1679,6 +1679,7 @@ dependencies = [ name = "uu_cut" version = "0.0.6" dependencies = [ + "clap", "uucore", "uucore_procs", ] diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index 9cc852d2e..d892ddeb5 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -15,6 +15,7 @@ edition = "2018" path = "src/cut.rs" [dependencies] +clap = "2.33" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 95411e3fb..2b65a3347 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -10,6 +10,7 @@ #[macro_use] extern crate uucore; +use clap::{App, Arg}; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, Read, Stdout, Write}; use std::path::Path; @@ -20,6 +21,8 @@ use uucore::ranges::Range; mod buffer; mod searcher; +static NAME: &str = "cut"; +static VERSION: &str = env!("CARGO_PKG_VERSION"); static SYNTAX: &str = "[-d] [-s] [-z] [--output-delimiter] ((-f|-b|-c) {{sequence}}) {{sourcefile}}+"; static SUMMARY: &str = @@ -422,34 +425,119 @@ fn cut_files(mut filenames: Vec, mode: Mode) -> i32 { exit_code } +mod options { + pub const BYTES: &str = "bytes"; + pub const CHARACTERS: &str = "characters"; + pub const DELIMITER: &str = "delimiter"; + pub const FIELDS: &str = "fields"; + pub const LEGACY_OPTION: &str = "legacy-option"; + pub const ZERO_TERMINATED: &str = "zero-terminated"; + pub const ONLY_DELIMITED: &str = "only-delimited"; + pub const OUTPUT_DELIMITER: &str = "output-delimiter"; + pub const COMPLEMENT: &str = "complement"; + pub const FILE: &str = "file"; +} + pub fn uumain(args: impl uucore::Args) -> i32 { let args = args.collect_str(); - let matches = app!(SYNTAX, SUMMARY, LONG_HELP) - .optopt("b", "bytes", "filter byte columns from the input source", "sequence") - .optopt("c", "characters", "alias for character mode", "sequence") - .optopt("d", "delimiter", "specify the delimiter character that separates fields in the input source. Defaults to Tab.", "delimiter") - .optopt("f", "fields", "filter field columns from the input source", "sequence") - .optflag("n", "", "legacy option - has no effect.") - .optflag("", "complement", "invert the filter - instead of displaying only the filtered columns, display all but those columns") - .optflag("s", "only-delimited", "in field mode, only print lines which contain the delimiter") - .optflag("z", "zero-terminated", "instead of filtering columns based on line, filter columns based on \\0 (NULL character)") - .optopt("", "output-delimiter", "in field mode, replace the delimiter in output lines with this option's argument", "new delimiter") - .parse(args); - let complement = matches.opt_present("complement"); + let matches = App::new(executable!()) + .name(NAME) + .version(VERSION) + .usage(SYNTAX) + .about(SUMMARY) + .after_help(LONG_HELP) + .arg( + Arg::with_name(options::BYTES) + .short("b") + .long(options::BYTES) + .takes_value(true) + .help("filter byte columns from the input source") + .allow_hyphen_values(true) + .value_name("LIST"), + ) + .arg( + Arg::with_name(options::CHARACTERS) + .short("c") + .long(options::CHARACTERS) + .help("alias for character mode") + .takes_value(true) + .allow_hyphen_values(true) + .value_name("LIST"), + ) + .arg( + Arg::with_name(options::DELIMITER) + .short("d") + .long(options::DELIMITER) + .help("specify the delimiter character that separates fields in the input source. Defaults to Tab.") + .takes_value(true) + .value_name("DELIM"), + ) + .arg( + Arg::with_name(options::FIELDS) + .short("f") + .long(options::FIELDS) + .help("filter field columns from the input source") + .takes_value(true) + .allow_hyphen_values(true) + .value_name("LIST"), + ) + .arg( + Arg::with_name(options::LEGACY_OPTION) + .short("n") + .long(options::LEGACY_OPTION) + .help("legacy option - has no effect.") + .takes_value(false) + ) + .arg( + Arg::with_name(options::COMPLEMENT) + .long(options::COMPLEMENT) + .help("invert the filter - instead of displaying only the filtered columns, display all but those columns") + .takes_value(false) + + ) + .arg( + Arg::with_name(options::ONLY_DELIMITED) + .short("s") + .long(options::ONLY_DELIMITED) + .help("in field mode, only print lines which contain the delimiter") + .takes_value(false) + ) + .arg( + Arg::with_name(options::ZERO_TERMINATED) + .short("z") + .long(options::ZERO_TERMINATED) + .help("instead of filtering columns based on line, filter columns based on \\0 (NULL character)") + .takes_value(false) + ) + .arg( + Arg::with_name(options::OUTPUT_DELIMITER) + .long(options::OUTPUT_DELIMITER) + .help("in field mode, replace the delimiter in output lines with this option's argument") + .takes_value(true) + .value_name("NEW_DELIM") + ) + .arg( + Arg::with_name(options::FILE) + .hidden(true) + .multiple(true) + ) + .get_matches_from(args); + + let complement = matches.is_present("complement"); let mode_parse = match ( - matches.opt_str("bytes"), - matches.opt_str("characters"), - matches.opt_str("fields"), + matches.value_of(options::BYTES), + matches.value_of(options::CHARACTERS), + matches.value_of(options::FIELDS), ) { (Some(byte_ranges), None, None) => { list_to_ranges(&byte_ranges[..], complement).map(|ranges| { Mode::Bytes( ranges, Options { - out_delim: matches.opt_str("output-delimiter"), - zero_terminated: matches.opt_present("zero-terminated"), + out_delim: Some(matches.value_of(options::OUTPUT_DELIMITER).unwrap_or_default().to_owned()), + zero_terminated: matches.is_present(options::ZERO_TERMINATED), }, ) }) @@ -459,29 +547,29 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Mode::Characters( ranges, Options { - out_delim: matches.opt_str("output-delimiter"), - zero_terminated: matches.opt_present("zero-terminated"), + out_delim: Some(matches.value_of(options::OUTPUT_DELIMITER).unwrap_or_default().to_owned()), + zero_terminated: matches.is_present(options::ZERO_TERMINATED), }, ) }) } (None, None, Some(field_ranges)) => { list_to_ranges(&field_ranges[..], complement).and_then(|ranges| { - let out_delim = match matches.opt_str("output-delimiter") { + let out_delim = match matches.value_of(options::OUTPUT_DELIMITER) { Some(s) => { if s.is_empty() { Some("\0".to_owned()) } else { - Some(s) + Some(s.to_owned()) } } None => None, }; - let only_delimited = matches.opt_present("only-delimited"); - let zero_terminated = matches.opt_present("zero-terminated"); + let only_delimited = matches.is_present(options::ONLY_DELIMITED); + let zero_terminated = matches.is_present(options::ZERO_TERMINATED); - match matches.opt_str("delimiter") { + match matches.value_of(options::DELIMITER) { Some(delim) => { if delim.chars().count() > 1 { Err(msg_opt_invalid_should_be!( @@ -494,7 +582,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let delim = if delim.is_empty() { "\0".to_owned() } else { - delim + delim.to_owned() }; Ok(Mode::Fields( @@ -533,10 +621,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let mode_parse = match mode_parse { Err(_) => mode_parse, Ok(mode) => match mode { - Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.opt_present("delimiter") => Err( + Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.is_present("delimiter") => Err( msg_opt_only_usable_if!("printing a sequence of fields", "--delimiter", "-d"), ), - Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.opt_present("only-delimited") => { + Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.is_present("only-delimited") => { Err(msg_opt_only_usable_if!( "printing a sequence of fields", "--only-delimited", @@ -547,8 +635,14 @@ pub fn uumain(args: impl uucore::Args) -> i32 { }, }; + let files: Vec = matches + .values_of(options::FILE) + .unwrap_or_default() + .map(str::to_owned) + .collect(); + match mode_parse { - Ok(mode) => cut_files(matches.free, mode), + Ok(mode) => cut_files(files, mode), Err(err_msg) => { show_error!("{}", err_msg); 1 From 7e677b3e6c2b03203efe9039d05163434ac0cbcd Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci Date: Sat, 3 Apr 2021 20:21:57 +0300 Subject: [PATCH 586/606] cut: fix formatting, use constant values --- src/uu/cut/src/cut.rs | 33 +++++++++++++++++++++++++-------- src/uu/stdbuf/src/stdbuf.rs | 3 +-- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 2b65a3347..3781f0c9f 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -494,7 +494,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::COMPLEMENT) .help("invert the filter - instead of displaying only the filtered columns, display all but those columns") .takes_value(false) - ) .arg( Arg::with_name(options::ONLY_DELIMITED) @@ -524,7 +523,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .get_matches_from(args); - let complement = matches.is_present("complement"); + let complement = matches.is_present(options::COMPLEMENT); let mode_parse = match ( matches.value_of(options::BYTES), @@ -536,7 +535,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Mode::Bytes( ranges, Options { - out_delim: Some(matches.value_of(options::OUTPUT_DELIMITER).unwrap_or_default().to_owned()), + out_delim: Some( + matches + .value_of(options::OUTPUT_DELIMITER) + .unwrap_or_default() + .to_owned(), + ), zero_terminated: matches.is_present(options::ZERO_TERMINATED), }, ) @@ -547,7 +551,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Mode::Characters( ranges, Options { - out_delim: Some(matches.value_of(options::OUTPUT_DELIMITER).unwrap_or_default().to_owned()), + out_delim: Some( + matches + .value_of(options::OUTPUT_DELIMITER) + .unwrap_or_default() + .to_owned(), + ), zero_terminated: matches.is_present(options::ZERO_TERMINATED), }, ) @@ -621,10 +630,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let mode_parse = match mode_parse { Err(_) => mode_parse, Ok(mode) => match mode { - Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.is_present("delimiter") => Err( - msg_opt_only_usable_if!("printing a sequence of fields", "--delimiter", "-d"), - ), - Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.is_present("only-delimited") => { + Mode::Bytes(_, _) | Mode::Characters(_, _) + if matches.is_present(options::DELIMITER) => + { + Err(msg_opt_only_usable_if!( + "printing a sequence of fields", + "--delimiter", + "-d" + )) + } + Mode::Bytes(_, _) | Mode::Characters(_, _) + if matches.is_present(options::ONLY_DELIMITED) => + { Err(msg_opt_only_usable_if!( "printing a sequence of fields", "--only-delimited", diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index a61ba967b..67ed9a838 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -80,8 +80,7 @@ fn print_version() { fn print_usage(opts: &Options) { let brief = "Run COMMAND, with modified buffering operations for its standard streams\n \ Mandatory arguments to long options are mandatory for short options too."; - let explanation = - "If MODE is 'L' the corresponding stream will be line buffered.\n \ + let explanation = "If MODE is 'L' the corresponding stream will be line buffered.\n \ This option is invalid with standard input.\n\n \ If MODE is '0' the corresponding stream will be unbuffered.\n\n \ Otherwise MODE is a number which may be followed by one of the following:\n\n \ From e84b60b7d5464db90a727b432150d90324f2b000 Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci Date: Sat, 3 Apr 2021 20:30:28 +0300 Subject: [PATCH 587/606] cut: add display order --- src/uu/cut/src/cut.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 3781f0c9f..ddedc4727 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -430,7 +430,6 @@ mod options { pub const CHARACTERS: &str = "characters"; pub const DELIMITER: &str = "delimiter"; pub const FIELDS: &str = "fields"; - pub const LEGACY_OPTION: &str = "legacy-option"; pub const ZERO_TERMINATED: &str = "zero-terminated"; pub const ONLY_DELIMITED: &str = "only-delimited"; pub const OUTPUT_DELIMITER: &str = "output-delimiter"; @@ -454,7 +453,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .takes_value(true) .help("filter byte columns from the input source") .allow_hyphen_values(true) - .value_name("LIST"), + .value_name("LIST") + .display_order(1), ) .arg( Arg::with_name(options::CHARACTERS) @@ -463,7 +463,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("alias for character mode") .takes_value(true) .allow_hyphen_values(true) - .value_name("LIST"), + .value_name("LIST") + .display_order(2), ) .arg( Arg::with_name(options::DELIMITER) @@ -471,7 +472,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::DELIMITER) .help("specify the delimiter character that separates fields in the input source. Defaults to Tab.") .takes_value(true) - .value_name("DELIM"), + .value_name("DELIM") + .display_order(3), ) .arg( Arg::with_name(options::FIELDS) @@ -480,20 +482,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("filter field columns from the input source") .takes_value(true) .allow_hyphen_values(true) - .value_name("LIST"), - ) - .arg( - Arg::with_name(options::LEGACY_OPTION) - .short("n") - .long(options::LEGACY_OPTION) - .help("legacy option - has no effect.") - .takes_value(false) + .value_name("LIST") + .display_order(4), ) .arg( Arg::with_name(options::COMPLEMENT) .long(options::COMPLEMENT) .help("invert the filter - instead of displaying only the filtered columns, display all but those columns") .takes_value(false) + .display_order(5), ) .arg( Arg::with_name(options::ONLY_DELIMITED) @@ -501,6 +498,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::ONLY_DELIMITED) .help("in field mode, only print lines which contain the delimiter") .takes_value(false) + .display_order(6), ) .arg( Arg::with_name(options::ZERO_TERMINATED) @@ -508,6 +506,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .long(options::ZERO_TERMINATED) .help("instead of filtering columns based on line, filter columns based on \\0 (NULL character)") .takes_value(false) + .display_order(8), ) .arg( Arg::with_name(options::OUTPUT_DELIMITER) @@ -515,6 +514,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("in field mode, replace the delimiter in output lines with this option's argument") .takes_value(true) .value_name("NEW_DELIM") + .display_order(7), ) .arg( Arg::with_name(options::FILE) From f47345ec9bb452068eaa8bf2af51a1bae3a5148b Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci Date: Sat, 3 Apr 2021 20:55:10 +0300 Subject: [PATCH 588/606] cut: add gnu compatability to error messages --- src/uu/cut/src/cut.rs | 9 +++++++-- tests/by-util/test_cut.rs | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index ddedc4727..6b09b91d9 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -401,8 +401,13 @@ fn cut_files(mut filenames: Vec, mode: Mode) -> i32 { } else { let path = Path::new(&filename[..]); - if !path.exists() { - show_error!("{}", msg_args_nonexistent_file!(filename)); + if path.is_dir() { + show_error!("{}: Is a directory", filename); + continue; + } + + if !path.metadata().is_ok() { + show_error!("{}: No such file or directory", filename); continue; } diff --git a/tests/by-util/test_cut.rs b/tests/by-util/test_cut.rs index fc0f1b1f9..875317721 100644 --- a/tests/by-util/test_cut.rs +++ b/tests/by-util/test_cut.rs @@ -139,3 +139,21 @@ fn test_zero_terminated_only_delimited() { .succeeds() .stdout_only("82\n7\0"); } + +#[test] +fn test_directory_and_no_such_file() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.mkdir("some"); + + ucmd.arg("-b1") + .arg("some") + .run() + .stderr_is("cut: error: some: Is a directory\n"); + + new_ucmd!() + .arg("-b1") + .arg("some") + .run() + .stderr_is("cut: error: some: No such file or directory\n"); +} From bad1df9c1b9b31d26fc3e9f8de59094137b813fe Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Fri, 2 Apr 2021 08:47:04 -0400 Subject: [PATCH 589/606] fold: improve newline handling and test coverage - refactor implementation for readability - correct handling of files with no trailing newline and/or blank lines --- src/uu/fold/src/fold.rs | 263 +++++++++++++++++++++-------------- tests/by-util/test_fold.rs | 277 +++++++++++++++++++++++++++++++++++++ 2 files changed, 433 insertions(+), 107 deletions(-) diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index 27ab319d0..8cf95b82a 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -79,7 +79,6 @@ fn handle_obsolete(args: &[String]) -> (Vec, Option) { (args.to_vec(), None) } -#[inline] fn fold(filenames: Vec, bytes: bool, spaces: bool, width: usize) { for filename in &filenames { let filename: &str = &filename; @@ -92,123 +91,173 @@ fn fold(filenames: Vec, bytes: bool, spaces: bool, width: usize) { file_buf = safe_unwrap!(File::open(Path::new(filename))); &mut file_buf as &mut dyn Read }); - fold_file(buffer, bytes, spaces, width); + + if bytes { + fold_file_bytewise(buffer, spaces, width); + } else { + fold_file(buffer, spaces, width); + } } } -#[inline] -fn fold_file(file: BufReader, bytes: bool, spaces: bool, width: usize) { - for line_result in file.lines() { - let mut line = safe_unwrap!(line_result); +/// Fold `file` to fit `width` (number of columns), counting all characters as +/// one column. +/// +/// This function handles folding for the `-b`/`--bytes` option, counting +/// tab, backspace, and carriage return as occupying one column, identically +/// to all other characters in the stream. +/// +/// If `spaces` is `true`, attempt to break lines at whitespace boundaries. +fn fold_file_bytewise(mut file: BufReader, spaces: bool, width: usize) { + let mut line = String::new(); - if line.is_empty() { + loop { + if let Ok(0) = file.read_line(&mut line) { + break; + } + + if line == "\n" { println!(); - } else if bytes { - let len = line.len(); - let mut i = 0; - while i < len { - let width = if len - i >= width { width } else { len - i }; - let slice = { - let slice = &line[i..i + width]; - if spaces && i + width < len { - match slice.rfind(char::is_whitespace) { - Some(m) => &slice[..=m], - None => slice, - } - } else { - slice + line.truncate(0); + continue; + } + + let len = line.len(); + let mut i = 0; + + while i < len { + let width = if len - i >= width { width } else { len - i }; + let slice = { + let slice = &line[i..i + width]; + if spaces && i + width < len { + match slice.rfind(char::is_whitespace) { + Some(m) => &slice[..=m], + None => slice, } - }; - print!("{}", slice); - i += slice.len(); + } else { + slice + } + }; + + // Don't duplicate trailing newlines: if the slice is "\n", the + // previous iteration folded just before the end of the line and + // has already printed this newline. + if slice == "\n" { + break; } - } else { - let mut len = line.chars().count(); - let newline = line.ends_with('\n'); - if newline { - if len == 1 { - println!(); + + i += slice.len(); + + let at_eol = i >= len; + + if at_eol { + print!("{}", slice); + } else { + println!("{}", slice); + } + } + + line.truncate(0); + } +} + +/// Fold `file` to fit `width` (number of columns). +/// +/// By default `fold` treats tab, backspace, and carriage return specially: +/// tab characters count as 8 columns, backspace decreases the +/// column count, and carriage return resets the column count to 0. +/// +/// If `spaces` is `true`, attempt to break lines at whitespace boundaries. +#[allow(unused_assignments)] +fn fold_file(mut file: BufReader, spaces: bool, width: usize) { + let mut line = String::new(); + let mut output = String::new(); + let mut col_count = 0; + let mut char_count = 0; + let mut last_space = None; + + /// Print the output line, resetting the column and character counts. + /// + /// If `spaces` is `true`, print the output line up to the last + /// encountered whitespace character (inclusive) and set the remaining + /// characters as the start of the next line. + macro_rules! emit_output { + () => { + let consume = match last_space { + Some(i) => i + 1, + None => output.len(), + }; + + println!("{}", &output[..consume]); + output.replace_range(..consume, ""); + char_count = output.len(); + + // we know there are no tabs left in output, so each char counts + // as 1 column + col_count = char_count; + + last_space = None; + }; + } + + loop { + if let Ok(0) = file.read_line(&mut line) { + break; + } + + for ch in line.chars() { + if ch == '\n' { + // make sure to _not_ split output at whitespace, since we + // know the entire output will fit + last_space = None; + emit_output!(); + break; + } + + if col_count >= width { + emit_output!(); + } + + match ch { + '\t' => { + if col_count + 8 > width && !output.is_empty() { + emit_output!(); + } + col_count += 8; + last_space = Some(char_count); + } + '\x08' => { + // FIXME: does not match GNU's handling of backspace + if col_count > 0 { + col_count -= 1; + char_count -= 1; + output.truncate(char_count); + } continue; } - len -= 1; - line.truncate(len); - } - let mut output = String::new(); - let mut count = 0; - for (i, ch) in line.chars().enumerate() { - if count >= width { - let (val, ncount) = { - let slice = &output[..]; - let (out, val, ncount) = if spaces && i + 1 < len { - match rfind_whitespace(slice) { - Some(m) => { - let routput = &slice[m + 1..slice.chars().count()]; - let ncount = routput.chars().fold(0, |out, ch: char| { - out + match ch { - '\t' => 8, - '\x08' => { - if out > 0 { - !0 - } else { - 0 - } - } - '\r' => return 0, - _ => 1, - } - }); - (&slice[0..=m], routput, ncount) - } - None => (slice, "", 0), - } - } else { - (slice, "", 0) - }; - println!("{}", out); - (val.to_owned(), ncount) - }; - output = val; - count = ncount; + '\r' => { + // FIXME: does not match GNU's handling of carriage return + output.truncate(0); + col_count = 0; + char_count = 0; + continue; } - match ch { - '\t' => { - count += 8; - if count > width { - println!("{}", output); - output.truncate(0); - count = 8; - } - } - '\x08' => { - if count > 0 { - count -= 1; - let len = output.len() - 1; - output.truncate(len); - } - continue; - } - '\r' => { - output.truncate(0); - count = 0; - continue; - } - _ => count += 1, - }; - output.push(ch); - } - if count > 0 { - println!("{}", output); - } - } - } -} + _ if spaces && ch.is_whitespace() => { + last_space = Some(char_count); + col_count += 1 + } + _ => col_count += 1, + }; -#[inline] -fn rfind_whitespace(slice: &str) -> Option { - for (i, ch) in slice.chars().rev().enumerate() { - if ch.is_whitespace() { - return Some(slice.chars().count() - (i + 1)); + output.push(ch); + char_count += 1; } + + if col_count > 0 { + print!("{}", output); + output.truncate(0); + } + + line.truncate(0); } - None } diff --git a/tests/by-util/test_fold.rs b/tests/by-util/test_fold.rs index 64d77cd2b..52e630e5b 100644 --- a/tests/by-util/test_fold.rs +++ b/tests/by-util/test_fold.rs @@ -32,6 +32,24 @@ fn test_default_wrap_with_newlines() { .stdout_is_fixture("lorem_ipsum_new_line_80_column.expected"); } +#[test] +fn test_should_preserve_empty_line_without_final_newline() { + new_ucmd!() + .arg("-w2") + .pipe_in("12\n\n34") + .succeeds() + .stdout_is("12\n\n34"); +} + +#[test] +fn test_should_preserve_empty_line_and_final_newline() { + new_ucmd!() + .arg("-w2") + .pipe_in("12\n\n34\n") + .succeeds() + .stdout_is("12\n\n34\n"); +} + #[test] fn test_should_preserve_empty_lines() { new_ucmd!().pipe_in("\n").succeeds().stdout_is("\n"); @@ -57,3 +75,262 @@ fn test_word_boundary_split_should_preserve_empty_lines() { .succeeds() .stdout_is("0\n1\n\n2\n\n\n"); } + +#[test] +fn test_should_not_add_newline_when_line_less_than_fold() { + new_ucmd!().pipe_in("1234").succeeds().stdout_is("1234"); +} + +#[test] +fn test_should_not_add_newline_when_line_longer_than_fold() { + new_ucmd!() + .arg("-w2") + .pipe_in("1234") + .succeeds() + .stdout_is("12\n34"); +} + +#[test] +fn test_should_not_add_newline_when_line_equal_to_fold() { + new_ucmd!() + .arg("-w1") + .pipe_in(" ") + .succeeds() + .stdout_is(" "); +} + +#[test] +fn test_should_preserve_final_newline_when_line_less_than_fold() { + new_ucmd!().pipe_in("1234\n").succeeds().stdout_is("1234\n"); +} + +#[test] +fn test_should_preserve_final_newline_when_line_longer_than_fold() { + new_ucmd!() + .arg("-w2") + .pipe_in("1234\n") + .succeeds() + .stdout_is("12\n34\n"); +} + +#[test] +fn test_should_preserve_final_newline_when_line_equal_to_fold() { + new_ucmd!() + .arg("-w2") + .pipe_in("1\n") + .succeeds() + .stdout_is("1\n"); +} + +#[test] +fn test_single_tab_should_not_add_extra_newline() { + new_ucmd!() + .arg("-w1") + .pipe_in("\t") + .succeeds() + .stdout_is("\t"); +} + +#[test] +fn test_tab_counts_as_8_columns() { + new_ucmd!() + .arg("-w8") + .pipe_in("\t1") + .succeeds() + .stdout_is("\t\n1"); +} + +#[test] +fn test_fold_at_word_boundary() { + new_ucmd!() + .args(&["-w4", "-s"]) + .pipe_in("one two") + .succeeds() + .stdout_is("one \ntwo"); +} + +#[test] +fn test_fold_at_leading_word_boundary() { + new_ucmd!() + .args(&["-w3", "-s"]) + .pipe_in(" aaa") + .succeeds() + .stdout_is(" \naaa"); +} + +#[test] +fn test_fold_at_word_boundary_preserve_final_newline() { + new_ucmd!() + .args(&["-w4", "-s"]) + .pipe_in("one two\n") + .succeeds() + .stdout_is("one \ntwo\n"); +} + +#[test] +fn test_fold_at_tab_as_word_boundary() { + new_ucmd!() + .args(&["-w10", "-s"]) + .pipe_in("a\tbbb\n") + .succeeds() + .stdout_is("a\t\nbbb\n"); +} + +#[test] +fn test_fold_at_word_boundary_only_whitespace() { + new_ucmd!() + .args(&["-w2", "-s"]) + .pipe_in(" ") + .succeeds() + .stdout_is(" \n "); +} + +#[test] +fn test_fold_at_word_boundary_only_whitespace_preserve_final_newline() { + new_ucmd!() + .args(&["-w2", "-s"]) + .pipe_in(" \n") + .succeeds() + .stdout_is(" \n \n"); +} + +// +// bytewise tests + +#[test] +fn test_bytewise_should_preserve_empty_line_without_final_newline() { + new_ucmd!() + .args(&["-w2", "-b"]) + .pipe_in("123\n\n45") + .succeeds() + .stdout_is("12\n3\n\n45"); +} + +#[test] +fn test_bytewise_should_preserve_empty_line_and_final_newline() { + new_ucmd!() + .args(&["-w2", "-b"]) + .pipe_in("12\n\n34\n") + .succeeds() + .stdout_is("12\n\n34\n"); +} + +#[test] +fn test_bytewise_should_preserve_empty_lines() { + new_ucmd!() + .arg("-b") + .pipe_in("\n") + .succeeds() + .stdout_is("\n"); + + new_ucmd!() + .args(&["-w1", "-b"]) + .pipe_in("0\n1\n\n2\n\n\n") + .succeeds() + .stdout_is("0\n1\n\n2\n\n\n"); +} + +#[test] +fn test_bytewise_word_boundary_split_should_preserve_empty_lines() { + new_ucmd!() + .args(&["-s", "-b"]) + .pipe_in("\n") + .succeeds() + .stdout_is("\n"); + + new_ucmd!() + .args(&["-w1", "-s", "-b"]) + .pipe_in("0\n1\n\n2\n\n\n") + .succeeds() + .stdout_is("0\n1\n\n2\n\n\n"); +} + +#[test] +fn test_bytewise_should_not_add_newline_when_line_less_than_fold() { + new_ucmd!() + .arg("-b") + .pipe_in("1234") + .succeeds() + .stdout_is("1234"); +} + +#[test] +fn test_bytewise_should_not_add_newline_when_line_longer_than_fold() { + new_ucmd!() + .args(&["-w2", "-b"]) + .pipe_in("1234") + .succeeds() + .stdout_is("12\n34"); +} + +#[test] +fn test_bytewise_should_not_add_newline_when_line_equal_to_fold() { + new_ucmd!() + .args(&["-w1", "-b"]) + .pipe_in(" ") + .succeeds() + .stdout_is(" "); +} + +#[test] +fn test_bytewise_should_preserve_final_newline_when_line_less_than_fold() { + new_ucmd!() + .arg("-b") + .pipe_in("1234\n") + .succeeds() + .stdout_is("1234\n"); +} + +#[test] +fn test_bytewise_should_preserve_final_newline_when_line_longer_than_fold() { + new_ucmd!() + .args(&["-w2", "-b"]) + .pipe_in("1234\n") + .succeeds() + .stdout_is("12\n34\n"); +} + +#[test] +fn test_bytewise_should_preserve_final_newline_when_line_equal_to_fold() { + new_ucmd!() + .args(&["-w2", "-b"]) + .pipe_in("1\n") + .succeeds() + .stdout_is("1\n"); +} + +#[test] +fn test_bytewise_single_tab_should_not_add_extra_newline() { + new_ucmd!() + .args(&["-w1", "-b"]) + .pipe_in("\t") + .succeeds() + .stdout_is("\t"); +} + +#[test] +fn test_tab_counts_as_one_byte() { + new_ucmd!() + .args(&["-w2", "-b"]) + .pipe_in("1\t2\n") + .succeeds() + .stdout_is("1\t\n2\n"); +} + +#[test] +fn test_bytewise_fold_at_word_boundary_only_whitespace() { + new_ucmd!() + .args(&["-w2", "-s", "-b"]) + .pipe_in(" ") + .succeeds() + .stdout_is(" \n "); +} + +#[test] +fn test_bytewise_fold_at_word_boundary_only_whitespace_preserve_final_newline() { + new_ucmd!() + .args(&["-w2", "-s", "-b"]) + .pipe_in(" \n") + .succeeds() + .stdout_is(" \n \n"); +} From 19c6a42de550ca6dd0f4ffd0d8a546b3e4146cc9 Mon Sep 17 00:00:00 2001 From: Chirag Jadwani Date: Sun, 4 Apr 2021 15:07:29 +0530 Subject: [PATCH 590/606] uniq: implement group option --- Cargo.lock | 35 +++++++++ src/uu/uniq/Cargo.toml | 2 + src/uu/uniq/src/uniq.rs | 83 ++++++++++++++++------ tests/by-util/test_uniq.rs | 45 ++++++++++++ tests/fixtures/uniq/group-append.expected | 26 +++++++ tests/fixtures/uniq/group-both.expected | 27 +++++++ tests/fixtures/uniq/group-prepend.expected | 26 +++++++ tests/fixtures/uniq/group.expected | 25 +++++++ 8 files changed, 249 insertions(+), 20 deletions(-) create mode 100644 tests/fixtures/uniq/group-append.expected create mode 100644 tests/fixtures/uniq/group-both.expected create mode 100644 tests/fixtures/uniq/group-prepend.expected create mode 100644 tests/fixtures/uniq/group.expected diff --git a/Cargo.lock b/Cargo.lock index ea1ee53ae..97398b7a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -650,6 +650,15 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" +[[package]] +name = "heck" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "hermit-abi" version = "0.1.18" @@ -1352,6 +1361,24 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +[[package]] +name = "strum" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7318c509b5ba57f18533982607f24070a55d353e90d4cae30c467cdb2ad5ac5c" + +[[package]] +name = "strum_macros" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8bc6b87a5112aeeab1f4a9f7ab634fe6cbefc4850006df31267f4cfb9e3149" +dependencies = [ + "heck", + "proc-macro2", + "quote 1.0.9", + "syn", +] + [[package]] name = "syn" version = "1.0.68" @@ -1499,6 +1526,12 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +[[package]] +name = "unicode-segmentation" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" + [[package]] name = "unicode-width" version = "0.1.8" @@ -2455,6 +2488,8 @@ name = "uu_uniq" version = "0.0.6" dependencies = [ "clap", + "strum", + "strum_macros", "uucore", "uucore_procs", ] diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index 8c63455ec..3fe89b450 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -16,6 +16,8 @@ path = "src/uniq.rs" [dependencies] clap = "2.33" +strum = "0.20" +strum_macros = "0.20" uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/uniq/src/uniq.rs b/src/uu/uniq/src/uniq.rs index a1809f0f0..a61a78a61 100644 --- a/src/uu/uniq/src/uniq.rs +++ b/src/uu/uniq/src/uniq.rs @@ -13,6 +13,7 @@ use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Result, Write}; use std::path::Path; use std::str::FromStr; +use strum_macros::{AsRefStr, EnumString}; static ABOUT: &str = "Report or omit repeated lines."; static VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -26,14 +27,18 @@ pub mod options { pub static SKIP_CHARS: &str = "skip-chars"; pub static UNIQUE: &str = "unique"; pub static ZERO_TERMINATED: &str = "zero-terminated"; + pub static GROUP: &str = "group"; } static ARG_FILES: &str = "files"; -#[derive(PartialEq)] +#[derive(PartialEq, Clone, Copy, AsRefStr, EnumString)] +#[strum(serialize_all = "snake_case")] enum Delimiters { + Append, Prepend, Separate, + Both, None, } @@ -58,22 +63,33 @@ impl Uniq { ) { let mut lines: Vec = vec![]; let mut first_line_printed = false; - let delimiters = &self.delimiters; + let delimiters = self.delimiters; let line_terminator = self.get_line_terminator(); + // Don't print any delimiting lines before, after or between groups if delimiting method is 'none' + let no_delimiters = delimiters == Delimiters::None; + // The 'prepend' and 'both' delimit methods will cause output to start with delimiter line + let prepend_delimiter = delimiters == Delimiters::Prepend || delimiters == Delimiters::Both; + // The 'append' and 'both' delimit methods will cause output to end with delimiter line + let append_delimiter = delimiters == Delimiters::Append || delimiters == Delimiters::Both; for line in reader.split(line_terminator).map(get_line_string) { if !lines.is_empty() && self.cmp_keys(&lines[0], &line) { - let print_delimiter = delimiters == &Delimiters::Prepend - || (delimiters == &Delimiters::Separate && first_line_printed); + // Print delimiter if delimit method is not 'none' and any line has been output + // before or if we need to start output with delimiter + let print_delimiter = !no_delimiters && (prepend_delimiter || first_line_printed); first_line_printed |= self.print_lines(writer, &lines, print_delimiter); lines.truncate(0); } lines.push(line); } if !lines.is_empty() { - let print_delimiter = delimiters == &Delimiters::Prepend - || (delimiters == &Delimiters::Separate && first_line_printed); - self.print_lines(writer, &lines, print_delimiter); + // Print delimiter if delimit method is not 'none' and any line has been output + // before or if we need to start output with delimiter + let print_delimiter = !no_delimiters && (prepend_delimiter || first_line_printed); + first_line_printed |= self.print_lines(writer, &lines, print_delimiter); + } + if append_delimiter && first_line_printed { + crash_if_err!(1, writer.write_all(&[line_terminator])); } } @@ -233,10 +249,30 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(options::ALL_REPEATED) .short("D") .long(options::ALL_REPEATED) - .possible_values(&["none", "prepend", "separate"]) - .help("print all duplicate lines. Delimiting is done with blank lines") + .possible_values(&[ + Delimiters::None.as_ref(), Delimiters::Prepend.as_ref(), Delimiters::Separate.as_ref() + ]) + .help("print all duplicate lines. Delimiting is done with blank lines. [default: none]") .value_name("delimit-method") - .default_value("none"), + .min_values(0) + .max_values(1), + ) + .arg( + Arg::with_name(options::GROUP) + .long(options::GROUP) + .possible_values(&[ + Delimiters::Separate.as_ref(), Delimiters::Prepend.as_ref(), + Delimiters::Append.as_ref(), Delimiters::Both.as_ref() + ]) + .help("show all items, separating groups with an empty line. [default: separate]") + .value_name("group-method") + .min_values(0) + .max_values(1) + .conflicts_with_all(&[ + options::REPEATED, + options::ALL_REPEATED, + options::UNIQUE, + ]), ) .arg( Arg::with_name(options::CHECK_CHARS) @@ -314,17 +350,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 { let uniq = Uniq { repeats_only: matches.is_present(options::REPEATED) - || matches.occurrences_of(options::ALL_REPEATED) > 0, + || matches.is_present(options::ALL_REPEATED), uniques_only: matches.is_present(options::UNIQUE), - all_repeated: matches.occurrences_of(options::ALL_REPEATED) > 0, - delimiters: match matches.value_of(options::ALL_REPEATED).map(String::from) { - Some(ref opt_arg) if opt_arg != "none" => match &(*opt_arg.as_str()) { - "prepend" => Delimiters::Prepend, - "separate" => Delimiters::Separate, - _ => crash!(1, "Incorrect argument for all-repeated: {}", opt_arg), - }, - _ => Delimiters::None, - }, + all_repeated: matches.is_present(options::ALL_REPEATED) + || matches.is_present(options::GROUP), + delimiters: get_delimiter(&matches), show_counts: matches.is_present(options::COUNT), skip_fields: opt_parsed(options::SKIP_FIELDS, &matches), slice_start: opt_parsed(options::SKIP_CHARS, &matches), @@ -340,6 +370,19 @@ pub fn uumain(args: impl uucore::Args) -> i32 { 0 } +fn get_delimiter(matches: &ArgMatches) -> Delimiters { + let value = matches + .value_of(options::ALL_REPEATED) + .or_else(|| matches.value_of(options::GROUP)); + if let Some(delimiter_arg) = value { + crash_if_err!(1, Delimiters::from_str(delimiter_arg)) + } else if matches.is_present(options::GROUP) { + Delimiters::Separate + } else { + Delimiters::None + } +} + fn open_input_file(in_file_name: String) -> BufReader> { let in_file = if in_file_name == "-" { Box::new(stdin()) as Box diff --git a/tests/by-util/test_uniq.rs b/tests/by-util/test_uniq.rs index 22e67540e..c1e53faf3 100644 --- a/tests/by-util/test_uniq.rs +++ b/tests/by-util/test_uniq.rs @@ -147,3 +147,48 @@ fn test_invalid_utf8() { .failure() .stderr_only("uniq: error: invalid utf-8 sequence of 1 bytes from index 0"); } + +#[test] +fn test_group() { + new_ucmd!() + .args(&["--group"]) + .pipe_in_fixture(INPUT) + .run() + .stdout_is_fixture("group.expected"); +} + +#[test] +fn test_group_prepend() { + new_ucmd!() + .args(&["--group=prepend"]) + .pipe_in_fixture(INPUT) + .run() + .stdout_is_fixture("group-prepend.expected"); +} + +#[test] +fn test_group_append() { + new_ucmd!() + .args(&["--group=append"]) + .pipe_in_fixture(INPUT) + .run() + .stdout_is_fixture("group-append.expected"); +} + +#[test] +fn test_group_both() { + new_ucmd!() + .args(&["--group=both"]) + .pipe_in_fixture(INPUT) + .run() + .stdout_is_fixture("group-both.expected"); +} + +#[test] +fn test_group_separate() { + new_ucmd!() + .args(&["--group=separate"]) + .pipe_in_fixture(INPUT) + .run() + .stdout_is_fixture("group.expected"); +} diff --git a/tests/fixtures/uniq/group-append.expected b/tests/fixtures/uniq/group-append.expected new file mode 100644 index 000000000..62f53e69f --- /dev/null +++ b/tests/fixtures/uniq/group-append.expected @@ -0,0 +1,26 @@ + aaaaa ⅰ + + bbbbb ⅱ + bbbbb ⅱ + + ccccc ⅲ + ccccc ⅲ + ccccc ⅲ + + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + + eeeee ⅲ + + fffff ⅲ + fffff ⅲ + + ggggg ⅲ + ggggg ⅲ + ggggg ⅲ + + GGGGG ⅲ + GGGGG ⅲ + diff --git a/tests/fixtures/uniq/group-both.expected b/tests/fixtures/uniq/group-both.expected new file mode 100644 index 000000000..8a0f06bf2 --- /dev/null +++ b/tests/fixtures/uniq/group-both.expected @@ -0,0 +1,27 @@ + + aaaaa ⅰ + + bbbbb ⅱ + bbbbb ⅱ + + ccccc ⅲ + ccccc ⅲ + ccccc ⅲ + + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + + eeeee ⅲ + + fffff ⅲ + fffff ⅲ + + ggggg ⅲ + ggggg ⅲ + ggggg ⅲ + + GGGGG ⅲ + GGGGG ⅲ + diff --git a/tests/fixtures/uniq/group-prepend.expected b/tests/fixtures/uniq/group-prepend.expected new file mode 100644 index 000000000..5209f7fbe --- /dev/null +++ b/tests/fixtures/uniq/group-prepend.expected @@ -0,0 +1,26 @@ + + aaaaa ⅰ + + bbbbb ⅱ + bbbbb ⅱ + + ccccc ⅲ + ccccc ⅲ + ccccc ⅲ + + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + + eeeee ⅲ + + fffff ⅲ + fffff ⅲ + + ggggg ⅲ + ggggg ⅲ + ggggg ⅲ + + GGGGG ⅲ + GGGGG ⅲ diff --git a/tests/fixtures/uniq/group.expected b/tests/fixtures/uniq/group.expected new file mode 100644 index 000000000..145a78011 --- /dev/null +++ b/tests/fixtures/uniq/group.expected @@ -0,0 +1,25 @@ + aaaaa ⅰ + + bbbbb ⅱ + bbbbb ⅱ + + ccccc ⅲ + ccccc ⅲ + ccccc ⅲ + + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + ddddd ⅲ + + eeeee ⅲ + + fffff ⅲ + fffff ⅲ + + ggggg ⅲ + ggggg ⅲ + ggggg ⅲ + + GGGGG ⅲ + GGGGG ⅲ From fa4272a19be7c3d98c034a83ddf56b44732c61b7 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 4 Apr 2021 19:19:56 +0200 Subject: [PATCH 591/606] ls: --hide and --ignore --- src/uu/ls/Cargo.toml | 1 + src/uu/ls/src/ls.rs | 59 ++++++++++++++++++++++++----- tests/by-util/test_ls.rs | 80 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+), 9 deletions(-) diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index e1d9b7990..bf3860bf3 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -22,6 +22,7 @@ term_grid = "0.1.5" termsize = "0.1.6" time = "0.1.40" unicode-width = "0.1.5" +glob = "0.3.0" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index ece497bdb..e011b9e52 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -17,6 +17,7 @@ mod quoting_style; mod version_cmp; use clap::{App, Arg}; +use glob; use number_prefix::NumberPrefix; use quoting_style::{escape_name, QuotingStyle}; #[cfg(unix)] @@ -138,6 +139,8 @@ pub mod options { pub static COLOR: &str = "color"; pub static PATHS: &str = "paths"; pub static INDICATOR_STYLE: &str = "indicator-style"; + pub static HIDE: &str = "hide"; + pub static IGNORE: &str = "ignore"; } #[derive(PartialEq, Eq)] @@ -191,7 +194,7 @@ struct Config { recursive: bool, reverse: bool, dereference: bool, - ignore_backups: bool, + ignore_patterns: Vec, size_format: SizeFormat, directory: bool, time: Time, @@ -437,6 +440,28 @@ impl Config { IndicatorStyle::None }; + let mut ignore_patterns = Vec::new(); + if options.is_present(options::IGNORE_BACKUPS) { + ignore_patterns.push(glob::Pattern::new("*~").unwrap()); + ignore_patterns.push(glob::Pattern::new(".*~").unwrap()); + } + + for pattern in options.values_of(options::IGNORE).into_iter().flatten() { + match glob::Pattern::new(pattern) { + Ok(p) => ignore_patterns.push(p), + Err(e) => show_error!("{}", e), + } + } + + if files == Files::Normal { + for pattern in options.values_of(options::HIDE).into_iter().flatten() { + match glob::Pattern::new(pattern) { + Ok(p) => ignore_patterns.push(p), + Err(e) => show_error!("{}", e), + } + } + } + Config { format, files, @@ -444,7 +469,7 @@ impl Config { recursive: options.is_present(options::RECURSIVE), reverse: options.is_present(options::REVERSE), dereference: options.is_present(options::DEREFERENCE), - ignore_backups: options.is_present(options::IGNORE_BACKUPS), + ignore_patterns, size_format, directory: options.is_present(options::DIRECTORY), time, @@ -664,6 +689,26 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ]) ) + // Hide and ignore + .arg( + Arg::with_name(options::HIDE) + .long(options::HIDE) + .takes_value(true) + .multiple(true) + ) + .arg( + Arg::with_name(options::IGNORE) + .long(options::IGNORE) + .takes_value(true) + .multiple(true) + ) + .arg( + Arg::with_name(options::IGNORE_BACKUPS) + .short("B") + .long(options::IGNORE_BACKUPS) + .help("Ignore entries which end with ~."), + ) + // Sort arguments .arg( Arg::with_name(options::SORT) @@ -761,12 +806,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 { '.' and '..'.", ), ) - .arg( - Arg::with_name(options::IGNORE_BACKUPS) - .short("B") - .long(options::IGNORE_BACKUPS) - .help("Ignore entries which end with ~."), - ) .arg( Arg::with_name(options::DIRECTORY) .short("d") @@ -985,10 +1024,12 @@ fn is_hidden(file_path: &DirEntry) -> bool { fn should_display(entry: &DirEntry, config: &Config) -> bool { let ffi_name = entry.file_name(); let name = ffi_name.to_string_lossy(); + if config.files == Files::Normal && is_hidden(entry) { return false; } - if config.ignore_backups && name.ends_with('~') { + + if config.ignore_patterns.iter().any(|p| p.matches(&name)) { return false; } true diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index d403e5577..7d678acea 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1209,3 +1209,83 @@ fn test_ls_quoting_style() { assert_eq!(result.stdout, format!("{}\n", correct)); } } + +#[test] +fn test_ls_ignore_hide() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("README.md"); + at.touch("CONTRIBUTING.md"); + at.touch("some_other_file"); + at.touch("READMECAREFULLY.md"); + + scene.ucmd().arg("--hide").arg("*").succeeds().stdout_is(""); + + scene + .ucmd() + .arg("--ignore") + .arg("*") + .succeeds() + .stdout_is(""); + + scene + .ucmd() + .arg("--ignore") + .arg("irrelevant pattern") + .succeeds() + .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); + + scene + .ucmd() + .arg("--ignore") + .arg("README*.md") + .succeeds() + .stdout_is("CONTRIBUTING.md\nsome_other_file\n"); + + scene + .ucmd() + .arg("--hide") + .arg("README*.md") + .succeeds() + .stdout_is("CONTRIBUTING.md\nsome_other_file\n"); + + scene + .ucmd() + .arg("--ignore") + .arg("*.md") + .succeeds() + .stdout_is("some_other_file\n"); + + scene + .ucmd() + .arg("-a") + .arg("--ignore") + .arg("*.md") + .succeeds() + .stdout_is(".\n..\nsome_other_file\n"); + + scene + .ucmd() + .arg("-a") + .arg("--hide") + .arg("*.md") + .succeeds() + .stdout_is(".\n..\nCONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); + + scene + .ucmd() + .arg("-A") + .arg("--ignore") + .arg("*.md") + .succeeds() + .stdout_is("some_other_file\n"); + + scene + .ucmd() + .arg("-A") + .arg("--hide") + .arg("*.md") + .succeeds() + .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); +} From 76308dbec9f0538a17c443a01a241cf120c6177e Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 4 Apr 2021 22:35:22 +0200 Subject: [PATCH 592/606] ls: tests for invalid patterns for hide and ignore --- src/uu/ls/src/ls.rs | 4 ++-- tests/by-util/test_ls.rs | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index e011b9e52..1e6e300ff 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -449,7 +449,7 @@ impl Config { for pattern in options.values_of(options::IGNORE).into_iter().flatten() { match glob::Pattern::new(pattern) { Ok(p) => ignore_patterns.push(p), - Err(e) => show_error!("{}", e), + Err(_) => show_error!("Invalid pattern for ignore: '{}'", pattern), } } @@ -457,7 +457,7 @@ impl Config { for pattern in options.values_of(options::HIDE).into_iter().flatten() { match glob::Pattern::new(pattern) { Ok(p) => ignore_patterns.push(p), - Err(e) => show_error!("{}", e), + Err(_) => show_error!("Invalid pattern for hide: '{}'", pattern), } } } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 7d678acea..377e12f74 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1288,4 +1288,29 @@ fn test_ls_ignore_hide() { .arg("*.md") .succeeds() .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); + + // Stacking multiple patterns + scene + .ucmd() + .arg("--ignore") + .arg("README*") + .arg("--ignore") + .arg("CONTRIBUTING*") + .succeeds() + .stdout_is("some_other_file\n"); + + // Invalid patterns + scene + .ucmd() + .arg("--ignore") + .arg("READ[ME") + .succeeds() + .stderr_contains(&"Invalid pattern"); + + scene + .ucmd() + .arg("--ignore") + .arg("READ[ME") + .succeeds() + .stderr_contains(&"Invalid pattern"); } From 51770e6bee24431d104f6345e38648ecc3a34730 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 4 Apr 2021 22:40:36 +0200 Subject: [PATCH 593/606] ls: invalid pattern move from error to warning --- src/uu/ls/src/ls.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 1e6e300ff..4a0c52955 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -449,7 +449,7 @@ impl Config { for pattern in options.values_of(options::IGNORE).into_iter().flatten() { match glob::Pattern::new(pattern) { Ok(p) => ignore_patterns.push(p), - Err(_) => show_error!("Invalid pattern for ignore: '{}'", pattern), + Err(_) => show_warning!("Invalid pattern for ignore: '{}'", pattern), } } @@ -457,7 +457,7 @@ impl Config { for pattern in options.values_of(options::HIDE).into_iter().flatten() { match glob::Pattern::new(pattern) { Ok(p) => ignore_patterns.push(p), - Err(_) => show_error!("Invalid pattern for hide: '{}'", pattern), + Err(_) => show_warning!("Invalid pattern for hide: '{}'", pattern), } } } From bbb27800c91770a79efc28f29ab42c91d586c1bf Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 4 Apr 2021 23:14:55 +0200 Subject: [PATCH 594/606] ls: fix windows tests and commit lock --- Cargo.lock | 1 + tests/by-util/test_ls.rs | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index ea1ee53ae..034cb4304 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1949,6 +1949,7 @@ version = "0.0.6" dependencies = [ "atty", "clap", + "glob 0.3.0", "lazy_static", "number_prefix", "term_grid", diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 377e12f74..cde5a8b8a 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1220,12 +1220,19 @@ fn test_ls_ignore_hide() { at.touch("some_other_file"); at.touch("READMECAREFULLY.md"); - scene.ucmd().arg("--hide").arg("*").succeeds().stdout_is(""); + scene + .ucmd() + .arg("--hide") + .arg("*") + .arg("-1") + .succeeds() + .stdout_is(""); scene .ucmd() .arg("--ignore") .arg("*") + .arg("-1") .succeeds() .stdout_is(""); @@ -1233,6 +1240,7 @@ fn test_ls_ignore_hide() { .ucmd() .arg("--ignore") .arg("irrelevant pattern") + .arg("-1") .succeeds() .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); @@ -1240,6 +1248,7 @@ fn test_ls_ignore_hide() { .ucmd() .arg("--ignore") .arg("README*.md") + .arg("-1") .succeeds() .stdout_is("CONTRIBUTING.md\nsome_other_file\n"); @@ -1247,6 +1256,7 @@ fn test_ls_ignore_hide() { .ucmd() .arg("--hide") .arg("README*.md") + .arg("-1") .succeeds() .stdout_is("CONTRIBUTING.md\nsome_other_file\n"); @@ -1254,6 +1264,7 @@ fn test_ls_ignore_hide() { .ucmd() .arg("--ignore") .arg("*.md") + .arg("-1") .succeeds() .stdout_is("some_other_file\n"); @@ -1262,6 +1273,7 @@ fn test_ls_ignore_hide() { .arg("-a") .arg("--ignore") .arg("*.md") + .arg("-1") .succeeds() .stdout_is(".\n..\nsome_other_file\n"); @@ -1270,6 +1282,7 @@ fn test_ls_ignore_hide() { .arg("-a") .arg("--hide") .arg("*.md") + .arg("-1") .succeeds() .stdout_is(".\n..\nCONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); @@ -1278,6 +1291,7 @@ fn test_ls_ignore_hide() { .arg("-A") .arg("--ignore") .arg("*.md") + .arg("-1") .succeeds() .stdout_is("some_other_file\n"); @@ -1286,6 +1300,7 @@ fn test_ls_ignore_hide() { .arg("-A") .arg("--hide") .arg("*.md") + .arg("-1") .succeeds() .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); @@ -1296,6 +1311,7 @@ fn test_ls_ignore_hide() { .arg("README*") .arg("--ignore") .arg("CONTRIBUTING*") + .arg("-1") .succeeds() .stdout_is("some_other_file\n"); @@ -1304,6 +1320,7 @@ fn test_ls_ignore_hide() { .ucmd() .arg("--ignore") .arg("READ[ME") + .arg("-1") .succeeds() .stderr_contains(&"Invalid pattern"); @@ -1311,6 +1328,7 @@ fn test_ls_ignore_hide() { .ucmd() .arg("--ignore") .arg("READ[ME") + .arg("-1") .succeeds() .stderr_contains(&"Invalid pattern"); } From 5134348a117481bb257961d71ba4c206de973410 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 4 Apr 2021 23:39:11 +0200 Subject: [PATCH 595/606] ls: use globset instead of glob --- src/uu/ls/Cargo.toml | 2 +- src/uu/ls/src/ls.rs | 27 ++++++++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index bf3860bf3..dacdc7cd9 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -22,7 +22,7 @@ term_grid = "0.1.5" termsize = "0.1.6" time = "0.1.40" unicode-width = "0.1.5" -glob = "0.3.0" +globset = "0.4.6" uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["entries", "fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 4a0c52955..c4f9ae047 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -17,7 +17,7 @@ mod quoting_style; mod version_cmp; use clap::{App, Arg}; -use glob; +use globset::{self, Glob, GlobSet, GlobSetBuilder}; use number_prefix::NumberPrefix; use quoting_style::{escape_name, QuotingStyle}; #[cfg(unix)] @@ -194,7 +194,7 @@ struct Config { recursive: bool, reverse: bool, dereference: bool, - ignore_patterns: Vec, + ignore_patterns: GlobSet, size_format: SizeFormat, directory: bool, time: Time, @@ -440,28 +440,34 @@ impl Config { IndicatorStyle::None }; - let mut ignore_patterns = Vec::new(); + let mut ignore_patterns = GlobSetBuilder::new(); if options.is_present(options::IGNORE_BACKUPS) { - ignore_patterns.push(glob::Pattern::new("*~").unwrap()); - ignore_patterns.push(glob::Pattern::new(".*~").unwrap()); + ignore_patterns.add(Glob::new("*~").unwrap()); + ignore_patterns.add(Glob::new(".*~").unwrap()); } for pattern in options.values_of(options::IGNORE).into_iter().flatten() { - match glob::Pattern::new(pattern) { - Ok(p) => ignore_patterns.push(p), + match Glob::new(pattern) { + Ok(p) => { + ignore_patterns.add(p); + } Err(_) => show_warning!("Invalid pattern for ignore: '{}'", pattern), } } if files == Files::Normal { for pattern in options.values_of(options::HIDE).into_iter().flatten() { - match glob::Pattern::new(pattern) { - Ok(p) => ignore_patterns.push(p), + match Glob::new(pattern) { + Ok(p) => { + ignore_patterns.add(p); + } Err(_) => show_warning!("Invalid pattern for hide: '{}'", pattern), } } } + let ignore_patterns = ignore_patterns.build().unwrap(); + Config { format, files, @@ -1023,13 +1029,12 @@ fn is_hidden(file_path: &DirEntry) -> bool { fn should_display(entry: &DirEntry, config: &Config) -> bool { let ffi_name = entry.file_name(); - let name = ffi_name.to_string_lossy(); if config.files == Files::Normal && is_hidden(entry) { return false; } - if config.ignore_patterns.iter().any(|p| p.matches(&name)) { + if config.ignore_patterns.is_match(&ffi_name) { return false; } true From d68959d69683dbe3ad41f1205fa214ad5ccfe30d Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 5 Apr 2021 10:12:23 +0200 Subject: [PATCH 596/606] ls: update cargo.lock with globset --- Cargo.lock | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 034cb4304..f6dfc3246 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -644,6 +644,19 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +[[package]] +name = "globset" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c152169ef1e421390738366d2f796655fec62621dabbd0fd476f905934061e4a" +dependencies = [ + "aho-corasick", + "bstr", + "fnv", + "log", + "regex", +] + [[package]] name = "half" version = "1.7.1" @@ -1949,7 +1962,7 @@ version = "0.0.6" dependencies = [ "atty", "clap", - "glob 0.3.0", + "globset", "lazy_static", "number_prefix", "term_grid", From a50eae76a499699c0e2e47b4217db331c4a75b4d Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 5 Apr 2021 12:17:42 +0200 Subject: [PATCH 597/606] ls: some more tests for ignore & hide --- tests/by-util/test_ls.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index cde5a8b8a..0547560cc 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1315,6 +1315,26 @@ fn test_ls_ignore_hide() { .succeeds() .stdout_is("some_other_file\n"); + scene + .ucmd() + .arg("--hide") + .arg("README*") + .arg("--ignore") + .arg("CONTRIBUTING*") + .arg("-1") + .succeeds() + .stdout_is("some_other_file\n"); + + scene + .ucmd() + .arg("--hide") + .arg("README*") + .arg("--hide") + .arg("CONTRIBUTING*") + .arg("-1") + .succeeds() + .stdout_is("some_other_file\n"); + // Invalid patterns scene .ucmd() @@ -1326,7 +1346,7 @@ fn test_ls_ignore_hide() { scene .ucmd() - .arg("--ignore") + .arg("--hide") .arg("READ[ME") .arg("-1") .succeeds() From e5c61a28beb89d4c62b798663cbbbefc20d0e68e Mon Sep 17 00:00:00 2001 From: Daniel Rocco Date: Mon, 5 Apr 2021 00:16:21 -0400 Subject: [PATCH 598/606] fold: variable width tabs, guard treating tab as whitespace Treat tab chars as advancing to the next tab stop rather than having a fixed 8-column width. Also treat tab as a whitespace split target only when splitting on word boundaries. --- src/uu/fold/src/fold.rs | 11 +++- tests/by-util/test_fold.rs | 65 +++++++++++++++++++++- tests/fixtures/fold/tab_stops.input | 11 ++++ tests/fixtures/fold/tab_stops_w16.expected | 13 +++++ tests/fixtures/fold/tab_stops_w8.expected | 18 ++++++ 5 files changed, 114 insertions(+), 4 deletions(-) create mode 100644 tests/fixtures/fold/tab_stops.input create mode 100644 tests/fixtures/fold/tab_stops_w16.expected create mode 100644 tests/fixtures/fold/tab_stops_w8.expected diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index 8cf95b82a..fac0ff28e 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -14,6 +14,8 @@ use std::fs::File; use std::io::{stdin, BufRead, BufReader, Read}; use std::path::Path; +const TAB_WIDTH: usize = 8; + static SYNTAX: &str = "[OPTION]... [FILE]..."; static SUMMARY: &str = "Writes each file (or standard input if no files are given) to standard output whilst breaking long lines"; @@ -220,11 +222,14 @@ fn fold_file(mut file: BufReader, spaces: bool, width: usize) { match ch { '\t' => { - if col_count + 8 > width && !output.is_empty() { + let next_tab_stop = col_count + TAB_WIDTH - col_count % TAB_WIDTH; + + if next_tab_stop > width && !output.is_empty() { emit_output!(); } - col_count += 8; - last_space = Some(char_count); + + col_count = next_tab_stop; + last_space = if spaces { Some(char_count) } else { None }; } '\x08' => { // FIXME: does not match GNU's handling of backspace diff --git a/tests/by-util/test_fold.rs b/tests/by-util/test_fold.rs index 52e630e5b..cc92c8ff3 100644 --- a/tests/by-util/test_fold.rs +++ b/tests/by-util/test_fold.rs @@ -132,7 +132,7 @@ fn test_single_tab_should_not_add_extra_newline() { } #[test] -fn test_tab_counts_as_8_columns() { +fn test_initial_tab_counts_as_8_columns() { new_ucmd!() .arg("-w8") .pipe_in("\t1") @@ -140,6 +140,33 @@ fn test_tab_counts_as_8_columns() { .stdout_is("\t\n1"); } +#[test] +fn test_tab_should_advance_to_next_tab_stop() { + // tab advances the column count to the next tab stop, i.e. the width + // of the tab varies based on the leading text + new_ucmd!() + .args(&["-w8", "tab_stops.input"]) + .succeeds() + .stdout_is_fixture("tab_stops_w8.expected"); +} + +#[test] +fn test_all_tabs_should_advance_to_next_tab_stops() { + new_ucmd!() + .args(&["-w16", "tab_stops.input"]) + .succeeds() + .stdout_is_fixture("tab_stops_w16.expected"); +} + +#[test] +fn test_fold_before_tab_with_narrow_width() { + new_ucmd!() + .arg("-w7") + .pipe_in("a\t1") + .succeeds() + .stdout_is("a\n\t\n1"); +} + #[test] fn test_fold_at_word_boundary() { new_ucmd!() @@ -167,8 +194,35 @@ fn test_fold_at_word_boundary_preserve_final_newline() { .stdout_is("one \ntwo\n"); } +#[test] +fn test_fold_at_tab() { + new_ucmd!() + .arg("-w8") + .pipe_in("a\tbbb\n") + .succeeds() + .stdout_is("a\t\nbbb\n"); +} + +#[test] +fn test_fold_after_tab() { + new_ucmd!() + .arg("-w10") + .pipe_in("a\tbbb\n") + .succeeds() + .stdout_is("a\tbb\nb\n"); +} + #[test] fn test_fold_at_tab_as_word_boundary() { + new_ucmd!() + .args(&["-w8", "-s"]) + .pipe_in("a\tbbb\n") + .succeeds() + .stdout_is("a\t\nbbb\n"); +} + +#[test] +fn test_fold_after_tab_as_word_boundary() { new_ucmd!() .args(&["-w10", "-s"]) .pipe_in("a\tbbb\n") @@ -317,6 +371,15 @@ fn test_tab_counts_as_one_byte() { .stdout_is("1\t\n2\n"); } +#[test] +fn test_bytewise_fold_before_tab_with_narrow_width() { + new_ucmd!() + .args(&["-w7", "-b"]) + .pipe_in("a\t1") + .succeeds() + .stdout_is("a\t1"); +} + #[test] fn test_bytewise_fold_at_word_boundary_only_whitespace() { new_ucmd!() diff --git a/tests/fixtures/fold/tab_stops.input b/tests/fixtures/fold/tab_stops.input new file mode 100644 index 000000000..a96a378ea --- /dev/null +++ b/tests/fixtures/fold/tab_stops.input @@ -0,0 +1,11 @@ +1 +12 +123 +1234 +12345 +123456 +1234567 +12345678 +123456781 +12345678 2 +12345678 2 4 diff --git a/tests/fixtures/fold/tab_stops_w16.expected b/tests/fixtures/fold/tab_stops_w16.expected new file mode 100644 index 000000000..8122ac16d --- /dev/null +++ b/tests/fixtures/fold/tab_stops_w16.expected @@ -0,0 +1,13 @@ +1 +12 +123 +1234 +12345 +123456 +1234567 +12345678 +123456781 +12345678 +2 +12345678 +2 4 diff --git a/tests/fixtures/fold/tab_stops_w8.expected b/tests/fixtures/fold/tab_stops_w8.expected new file mode 100644 index 000000000..3173a4a22 --- /dev/null +++ b/tests/fixtures/fold/tab_stops_w8.expected @@ -0,0 +1,18 @@ +1 +12 +123 +1234 +12345 +123456 +1234567 +12345678 + +12345678 +1 +12345678 + +2 +12345678 + +2 +4 From 3bfb1afe5c84099c4ae22f12ec91d6f59944b8a7 Mon Sep 17 00:00:00 2001 From: ReggaeMuffin <644950+reggaemuffin@users.noreply.github.com> Date: Mon, 5 Apr 2021 16:16:00 +0100 Subject: [PATCH 599/606] uucore: Start testing uucore Before this change we never ran tests on uucore itself meaning that is was not possible to test functions of the shared core, only their usage in the different binaries This change adds running uucore to our ci, which will increase coverage for the few doctests that exist and is extracted from #1988 where first tests for uucore will be introduced --- .github/workflows/CICD.yml | 13 ++++++++++++- README.md | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index a1683ab83..cc0972bf9 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -150,7 +150,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: --features "feat_os_unix" + args: --features "feat_os_unix" -p uucore -p coreutils env: RUSTFLAGS: '-Awarnings' @@ -536,6 +536,17 @@ jobs: CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo "-puu_${u}"; done;)" echo set-output name=UTILITY_LIST::${UTILITY_LIST} echo ::set-output name=CARGO_UTILITY_LIST_OPTIONS::${CARGO_UTILITY_LIST_OPTIONS} + - name: Test uucore + uses: actions-rs/cargo@v1 + with: + command: test + args: ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --no-fail-fast -p uucore + env: + CARGO_INCREMENTAL: '0' + RUSTC_WRAPPER: '' + RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort' + RUSTDOCFLAGS: '-Cpanic=abort' + # RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }} - name: Test uses: actions-rs/cargo@v1 with: diff --git a/README.md b/README.md index b6d265278..b2257b3fd 100644 --- a/README.md +++ b/README.md @@ -226,6 +226,11 @@ If you would prefer to test a select few utilities: $ cargo test --features "chmod mv tail" --no-default-features ``` +If you also want to test the core utilities: +```bash +$ cargo test -p uucore -p coreutils +``` + To debug: ```bash $ gdb --args target/debug/coreutils ls From 196bfebc8ba6817a13e35628842315474d14eebf Mon Sep 17 00:00:00 2001 From: ReggaeMuffin <644950+reggaemuffin@users.noreply.github.com> Date: Mon, 5 Apr 2021 16:27:26 +0100 Subject: [PATCH 600/606] uucore: add uucore testing to travis and cirrus --- .cirrus.yml | 2 +- .travis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 3a34a933a..5d16dce92 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -11,4 +11,4 @@ task: - cargo build test_script: - . $HOME/.cargo/env - - cargo test + - cargo test -p uucore -p coreutils diff --git a/.travis.yml b/.travis.yml index 27525b5f2..389ba44b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,7 +56,7 @@ install: script: - cargo build $CARGO_ARGS --features "$FEATURES" - - if [ ! $REDOX ]; then cargo test $CARGO_ARGS --features "$FEATURES" --no-fail-fast; fi + - if [ ! $REDOX ]; then cargo test $CARGO_ARGS -p uucore -p coreutils --features "$FEATURES" --no-fail-fast; fi - if [ -n "$TEST_INSTALL" ]; then mkdir installdir_test; DESTDIR=installdir_test make install; [ `ls installdir_test/usr/local/bin | wc -l` -gt 0 ]; fi addons: From 9581fcf688c175673ebd4f51341469aead8bf949 Mon Sep 17 00:00:00 2001 From: Marvin Hofmann <644950+reggaemuffin@users.noreply.github.com> Date: Mon, 5 Apr 2021 21:18:47 +0100 Subject: [PATCH 601/606] rm: add verbose output and trim multiple slashes (#1988) * rm: add verbose output and trim multiple slashes Uses the normalize_path used in cargo to strip duplicate slashes With a link to a std rfc https://github.com/rust-lang/rfcs/issues/2208 This fixes https://github.com/uutils/coreutils/issues/1829 This also touches https://github.com/uutils/coreutils/issues/1768 but does not attempt to fully solve it --- src/uu/rm/Cargo.toml | 3 +- src/uu/rm/src/rm.rs | 16 ++++-- src/uucore/src/lib/features/fs.rs | 90 +++++++++++++++++++++++++++++++ tests/by-util/test_rm.rs | 29 ++++++++++ 4 files changed, 133 insertions(+), 5 deletions(-) diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index 961a8036c..9974111aa 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -18,7 +18,8 @@ path = "src/rm.rs" clap = "2.33" walkdir = "2.2" remove_dir_all = "0.5.1" -uucore = { version=">=0.0.8", package="uucore", path="../../uucore" } + +uucore = { version=">=0.0.8", package="uucore", path="../../uucore", features=["fs"] } uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" } [[bin]] diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 033a1a4aa..09671768b 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -16,7 +16,7 @@ use std::collections::VecDeque; use std::fs; use std::io::{stderr, stdin, BufRead, Write}; use std::ops::BitOr; -use std::path::Path; +use std::path::{Path, PathBuf}; use walkdir::{DirEntry, WalkDir}; #[derive(Eq, PartialEq, Clone, Copy)] @@ -251,7 +251,7 @@ fn handle_dir(path: &Path, options: &Options) -> bool { let is_root = path.has_root() && path.parent().is_none(); if options.recursive && (!is_root || !options.preserve_root) { - if options.interactive != InteractiveMode::Always { + if options.interactive != InteractiveMode::Always && !options.verbose { // we need the extra crate because apparently fs::remove_dir_all() does not function // correctly on Windows if let Err(e) = remove_dir_all(path) { @@ -311,7 +311,7 @@ fn remove_dir(path: &Path, options: &Options) -> bool { match fs::remove_dir(path) { Ok(_) => { if options.verbose { - println!("removed directory '{}'", path.display()); + println!("removed directory '{}'", normalize(path).display()); } } Err(e) => { @@ -349,7 +349,7 @@ fn remove_file(path: &Path, options: &Options) -> bool { match fs::remove_file(path) { Ok(_) => { if options.verbose { - println!("removed '{}'", path.display()); + println!("removed '{}'", normalize(path).display()); } } Err(e) => { @@ -370,6 +370,14 @@ fn prompt_file(path: &Path, is_dir: bool) -> bool { } } +fn normalize(path: &Path) -> PathBuf { + // copied from https://github.com/rust-lang/cargo/blob/2e4cfc2b7d43328b207879228a2ca7d427d188bb/src/cargo/util/paths.rs#L65-L90 + // both projects are MIT https://github.com/rust-lang/cargo/blob/master/LICENSE-MIT + // for std impl progress see rfc https://github.com/rust-lang/rfcs/issues/2208 + // TODO: replace this once that lands + uucore::fs::normalize_path(path) +} + fn prompt(msg: &str) -> bool { let _ = stderr().write_all(msg.as_bytes()); let _ = stderr().flush(); diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index adf4f6f82..a72d6ea82 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -60,6 +60,37 @@ pub enum CanonicalizeMode { Missing, } +// copied from https://github.com/rust-lang/cargo/blob/2e4cfc2b7d43328b207879228a2ca7d427d188bb/src/cargo/util/paths.rs#L65-L90 +// both projects are MIT https://github.com/rust-lang/cargo/blob/master/LICENSE-MIT +// for std impl progress see rfc https://github.com/rust-lang/rfcs/issues/2208 +// replace this once that lands +pub fn normalize_path(path: &Path) -> PathBuf { + let mut components = path.components().peekable(); + let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().cloned() { + components.next(); + PathBuf::from(c.as_os_str()) + } else { + PathBuf::new() + }; + + for component in components { + match component { + Component::Prefix(..) => unreachable!(), + Component::RootDir => { + ret.push(component.as_os_str()); + } + Component::CurDir => {} + Component::ParentDir => { + ret.pop(); + } + Component::Normal(c) => { + ret.push(c); + } + } + } + ret +} + fn resolve>(original: P) -> IOResult { const MAX_LINKS_FOLLOWED: u32 = 255; let mut followed = 0; @@ -266,3 +297,62 @@ pub fn display_permissions_unix(mode: u32) -> String { result } + +#[cfg(test)] +mod tests { + // Note this useful idiom: importing names from outer (for mod tests) scope. + use super::*; + + struct NormalizePathTestCase<'a> { + path: &'a str, + test: &'a str, + } + + const NORMALIZE_PATH_TESTS: [NormalizePathTestCase; 8] = [ + NormalizePathTestCase { + path: "./foo/bar.txt", + test: "foo/bar.txt", + }, + NormalizePathTestCase { + path: "bar/../foo/bar.txt", + test: "foo/bar.txt", + }, + NormalizePathTestCase { + path: "foo///bar.txt", + test: "foo/bar.txt", + }, + NormalizePathTestCase { + path: "foo///bar", + test: "foo/bar", + }, + NormalizePathTestCase { + path: "foo//./bar", + test: "foo/bar", + }, + NormalizePathTestCase { + path: "/foo//./bar", + test: "/foo/bar", + }, + NormalizePathTestCase { + path: r"C:/you/later/", + test: "C:/you/later", + }, + NormalizePathTestCase { + path: "\\networkshare/a//foo//./bar", + test: "\\networkshare/a/foo/bar", + }, + ]; + + #[test] + fn test_normalize_path() { + for test in NORMALIZE_PATH_TESTS.iter() { + let path = Path::new(test.path); + let normalized = normalize_path(path); + assert_eq!( + test.test + .replace("/", std::path::MAIN_SEPARATOR.to_string().as_str()), + normalized.to_str().expect("Path is not valid utf-8!") + ); + } + } +} diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 149d509c5..0d77d9b01 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -263,3 +263,32 @@ fn test_rm_no_operand() { ucmd.fails() .stderr_is("rm: error: missing an argument\nrm: error: for help, try 'rm --help'\n"); } + +#[test] +fn test_rm_verbose_slash() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir = "test_rm_verbose_slash_directory"; + let file_a = &format!("{}/test_rm_verbose_slash_file_a", dir); + + at.mkdir(dir); + at.touch(file_a); + + let file_a_normalized = &format!( + "{}{}test_rm_verbose_slash_file_a", + dir, + std::path::MAIN_SEPARATOR + ); + + ucmd.arg("-r") + .arg("-f") + .arg("-v") + .arg(&format!("{}///", dir)) + .succeeds() + .stdout_only(format!( + "removed '{}'\nremoved directory '{}'\n", + file_a_normalized, dir + )); + + assert!(!at.dir_exists(dir)); + assert!(!at.file_exists(file_a)); +} From cbe07c93c65c53437b17c6c7146c9044301b2c0d Mon Sep 17 00:00:00 2001 From: Yagiz Degirmenci <62724709+ycd@users.noreply.github.com> Date: Mon, 5 Apr 2021 23:21:21 +0300 Subject: [PATCH 602/606] cksum: add tests and fixtures (#1923) --- tests/by-util/test_cksum.rs | 76 +++++++++++++++++++ tests/fixtures/cksum/chars.txt | 1 + .../fixtures/cksum/larger_than_2056_bytes.txt | 1 + 3 files changed, 78 insertions(+) create mode 100644 tests/fixtures/cksum/chars.txt create mode 100644 tests/fixtures/cksum/larger_than_2056_bytes.txt diff --git a/tests/by-util/test_cksum.rs b/tests/by-util/test_cksum.rs index d0bf5ffc8..8c8a551a0 100644 --- a/tests/by-util/test_cksum.rs +++ b/tests/by-util/test_cksum.rs @@ -24,3 +24,79 @@ fn test_stdin() { .succeeds() .stdout_is_fixture("stdin.expected"); } + +#[test] +fn test_empty() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.touch("a"); + + ucmd.arg("a").succeeds().stdout.ends_with("0 a"); +} + +#[test] +fn test_arg_overrides_stdin() { + let (at, mut ucmd) = at_and_ucmd!(); + let input = "foobarfoobar"; + + at.touch("a"); + + let result = ucmd.arg("a").pipe_in(input.as_bytes()).run(); + + println!("{}, {}", result.stdout, result.stderr); + + assert!(result.stdout.ends_with("0 a\n")) +} + +#[test] +fn test_invalid_file() { + let (_, mut ucmd) = at_and_ucmd!(); + + let ls = TestScenario::new("ls"); + let files = ls.cmd("ls").arg("-l").run(); + println!("{:?}", files.stdout); + println!("{:?}", files.stderr); + + let folder_name = "asdf".to_string(); + + let result = ucmd.arg(&folder_name).run(); + + println!("stdout: {:?}", result.stdout); + println!("stderr: {:?}", result.stderr); + assert!(result.stderr.contains("cksum: error: 'asdf'")); + assert!(!result.success); +} + +// Make sure crc is correct for files larger than 32 bytes +// but <128 bytes (1 fold pclmul) +#[test] +fn test_crc_for_bigger_than_32_bytes() { + let (_, mut ucmd) = at_and_ucmd!(); + + let result = ucmd.arg("chars.txt").run(); + + let mut stdout_splitted = result.stdout.split(" "); + + let cksum: i64 = stdout_splitted.next().unwrap().parse().unwrap(); + let bytes_cnt: i64 = stdout_splitted.next().unwrap().parse().unwrap(); + + assert!(result.success); + assert_eq!(cksum, 586047089); + assert_eq!(bytes_cnt, 16); +} + +#[test] +fn test_stdin_larger_than_128_bytes() { + let (_, mut ucmd) = at_and_ucmd!(); + + let result = ucmd.arg("larger_than_2056_bytes.txt").run(); + + let mut stdout_splitted = result.stdout.split(" "); + + let cksum: i64 = stdout_splitted.next().unwrap().parse().unwrap(); + let bytes_cnt: i64 = stdout_splitted.next().unwrap().parse().unwrap(); + + assert!(result.success); + assert_eq!(cksum, 945881979); + assert_eq!(bytes_cnt, 2058); +} diff --git a/tests/fixtures/cksum/chars.txt b/tests/fixtures/cksum/chars.txt new file mode 100644 index 000000000..26eec03fe --- /dev/null +++ b/tests/fixtures/cksum/chars.txt @@ -0,0 +1 @@ +123456789:;<=>?@ \ No newline at end of file diff --git a/tests/fixtures/cksum/larger_than_2056_bytes.txt b/tests/fixtures/cksum/larger_than_2056_bytes.txt new file mode 100644 index 000000000..668de449a --- /dev/null +++ b/tests/fixtures/cksum/larger_than_2056_bytes.txt @@ -0,0 +1 @@ +\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\400\401\402\403\404\405\406\407\410\411\412\413\414\415\416\417\420\421\422\423\424\425\426\427\430\431\432\433\434\435\436\437\440\441\442\443\444\445\446\447\450\451\452\453\454\455\456\457\460\461\462\463\464\465\466\467\470\471\472\473\474\475\476\477\500\501\502\503\504\505\506\507\510\511\512\513\514\515\516\517\520\521\522\523\524\525\526\527\530\531\532\533\534\535\536\537\540\541\542\543\544\545\546\547\550\551\552\553\554\555\556\557\560\561\562\563\564\565\566\567\570\571\572\573\574\575\576\577\600\601\602\603\604\605\606\607\610\611\612\613\614\615\616\617\620\621\622\623\624\625\626\627\630\631\632\633\634\635\636\637\640\641\642\643\644\645\646\647\650\651\652\653\654\655\656\657\660\661\662\663\664\665\666\667\670\671\672\673\674\675\676\677\700\701\702\703\704\705\706\707\710\711\712\713\714\715\716\717\720\721\722\723\724\725\726\727\730\731\732\733\734\735\736\737\740\741\742\743\744\745\746\747\750\751\752\753\754\755\756\757\760\761\762\763\764\765\766\767\770\771\772\773\774\775\776\777\1000\1001 \ No newline at end of file From de757cb0251d52826b7e87bfbc4f56025efad17f Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 5 Apr 2021 23:05:07 +0200 Subject: [PATCH 603/606] tee: refactor tests for #1982 --- tests/by-util/test_tee.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/by-util/test_tee.rs b/tests/by-util/test_tee.rs index f01677ae7..f2587a11f 100644 --- a/tests/by-util/test_tee.rs +++ b/tests/by-util/test_tee.rs @@ -68,15 +68,14 @@ fn test_tee_no_more_writeable_1() { .collect::(); let file_out = "tee_file_out"; - let result = ucmd - .arg("/dev/full") + ucmd.arg("/dev/full") .arg(file_out) .pipe_in(&content[..]) - .fails(); + .fails() + .stdout_contains(&content) + .stderr_contains(&"No space left on device"); assert_eq!(at.read(file_out), content); - assert!(result.stdout.contains(&content)); - assert!(result.stderr.contains("No space left on device")); } #[test] From cbc5132981a099854e0c9fd1464214c9620db58f Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Mon, 5 Apr 2021 23:06:56 +0200 Subject: [PATCH 604/606] ls: add short option for ignore --- src/uu/ls/src/ls.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index c4f9ae047..09fb3a7ea 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -704,6 +704,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 { ) .arg( Arg::with_name(options::IGNORE) + .short("I") .long(options::IGNORE) .takes_value(true) .multiple(true) From cc30aead2241414d026b079e690afe1338fd3d74 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Mon, 5 Apr 2021 23:55:02 +0200 Subject: [PATCH 605/606] realpath: refactor tests for #1982 --- tests/by-util/test_realpath.rs | 98 +++++++++++++++++----------------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/tests/by-util/test_realpath.rs b/tests/by-util/test_realpath.rs index 750a8db01..e1384ac74 100644 --- a/tests/by-util/test_realpath.rs +++ b/tests/by-util/test_realpath.rs @@ -1,106 +1,108 @@ use crate::common::util::*; #[test] -fn test_current_directory() { +fn test_realpath_current_directory() { let (at, mut ucmd) = at_and_ucmd!(); - let actual = ucmd.arg(".").run().stdout; let expect = at.root_dir_resolved() + "\n"; - println!("actual: {:?}", actual); - println!("expect: {:?}", expect); - assert_eq!(actual, expect); + ucmd.arg(".").succeeds().stdout_is(expect); } #[test] -fn test_long_redirection_to_current_dir() { +fn test_realpath_long_redirection_to_current_dir() { let (at, mut ucmd) = at_and_ucmd!(); // Create a 256-character path to current directory let dir = path_concat!(".", ..128); - let actual = ucmd.arg(dir).run().stdout; let expect = at.root_dir_resolved() + "\n"; - println!("actual: {:?}", actual); - println!("expect: {:?}", expect); - assert_eq!(actual, expect); + ucmd.arg(dir).succeeds().stdout_is(expect); } #[test] -fn test_long_redirection_to_root() { +fn test_realpath_long_redirection_to_root() { // Create a 255-character path to root let dir = path_concat!("..", ..85); - let actual = new_ucmd!().arg(dir).run().stdout; let expect = get_root_path().to_owned() + "\n"; - println!("actual: {:?}", actual); - println!("expect: {:?}", expect); - assert_eq!(actual, expect); + new_ucmd!().arg(dir).succeeds().stdout_is(expect); } #[test] -fn test_file_and_links() { +fn test_realpath_file_and_links() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.touch("foo"); at.symlink_file("foo", "bar"); - let actual = scene.ucmd().arg("foo").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("foo\n")); - - let actual = scene.ucmd().arg("bar").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("foo\n")); + scene.ucmd().arg("foo").succeeds().stdout_contains("foo\n"); + scene.ucmd().arg("bar").succeeds().stdout_contains("foo\n"); } #[test] -fn test_file_and_links_zero() { +fn test_realpath_file_and_links_zero() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.touch("foo"); at.symlink_file("foo", "bar"); - let actual = scene.ucmd().arg("foo").arg("-z").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("foo")); - assert!(!actual.contains("\n")); + scene + .ucmd() + .arg("foo") + .arg("-z") + .succeeds() + .stdout_contains("foo\u{0}"); - let actual = scene.ucmd().arg("bar").arg("-z").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("foo")); - assert!(!actual.contains("\n")); + scene + .ucmd() + .arg("bar") + .arg("-z") + .succeeds() + .stdout_contains("foo\u{0}"); } #[test] -fn test_file_and_links_strip() { +fn test_realpath_file_and_links_strip() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.touch("foo"); at.symlink_file("foo", "bar"); - let actual = scene.ucmd().arg("foo").arg("-s").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("foo\n")); + scene + .ucmd() + .arg("foo") + .arg("-s") + .succeeds() + .stdout_contains("foo\n"); - let actual = scene.ucmd().arg("bar").arg("-s").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("bar\n")); + scene + .ucmd() + .arg("bar") + .arg("-s") + .succeeds() + .stdout_contains("bar\n"); } #[test] -fn test_file_and_links_strip_zero() { +fn test_realpath_file_and_links_strip_zero() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.touch("foo"); at.symlink_file("foo", "bar"); - let actual = scene.ucmd().arg("foo").arg("-s").arg("-z").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("foo")); - assert!(!actual.contains("\n")); + scene + .ucmd() + .arg("foo") + .arg("-s") + .arg("-z") + .succeeds() + .stdout_contains("foo\u{0}"); - let actual = scene.ucmd().arg("bar").arg("-s").arg("-z").run().stdout; - println!("actual: {:?}", actual); - assert!(actual.contains("bar")); - assert!(!actual.contains("\n")); + scene + .ucmd() + .arg("bar") + .arg("-s") + .arg("-z") + .succeeds() + .stdout_contains("bar\u{0}"); } From 057ceebdb032f049dd2905d87c78df8aea59ebc0 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Tue, 6 Apr 2021 00:04:49 +0200 Subject: [PATCH 606/606] rm: refactor tests for #1982 --- tests/by-util/test_rm.rs | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 0d77d9b01..9a068887c 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -15,14 +15,12 @@ fn test_rm_one_file() { #[test] fn test_rm_failed() { let (_at, mut ucmd) = at_and_ucmd!(); - let file = "test_rm_one_file"; + let file = "test_rm_one_file"; // Doesn't exist - let result = ucmd.arg(file).fails(); // Doesn't exist - - assert!(result.stderr.contains(&format!( + ucmd.arg(file).fails().stderr_contains(&format!( "cannot remove '{}': No such file or directory", file - ))); + )); } #[test] @@ -145,10 +143,10 @@ fn test_rm_non_empty_directory() { at.mkdir(dir); at.touch(file_a); - let result = ucmd.arg("-d").arg(dir).fails(); - assert!(result - .stderr - .contains(&format!("cannot remove '{}': Directory not empty", dir))); + ucmd.arg("-d") + .arg(dir) + .fails() + .stderr_contains(&format!("cannot remove '{}': Directory not empty", dir)); assert!(at.file_exists(file_a)); assert!(at.dir_exists(dir)); } @@ -178,11 +176,9 @@ fn test_rm_directory_without_flag() { at.mkdir(dir); - let result = ucmd.arg(dir).fails(); - println!("{}", result.stderr); - assert!(result - .stderr - .contains(&format!("cannot remove '{}': Is a directory", dir))); + ucmd.arg(dir) + .fails() + .stderr_contains(&format!("cannot remove '{}': Is a directory", dir)); } #[test] @@ -229,10 +225,11 @@ fn test_rm_symlink_dir() { at.mkdir(dir); at.symlink_dir(dir, link); - let result = scene.ucmd().arg(link).fails(); - assert!(result - .stderr - .contains(&format!("cannot remove '{}': Is a directory", link))); + scene + .ucmd() + .arg(link) + .fails() + .stderr_contains(&format!("cannot remove '{}': Is a directory", link)); assert!(at.dir_exists(link));