Merge branch 'core-size' of https://github.com/shinhs0506/coreutils into core-size

This commit is contained in:
John Shin 2023-05-30 10:56:26 -07:00
commit a8219403a6
6 changed files with 181 additions and 86 deletions

216
Cargo.lock generated
View file

@ -66,42 +66,51 @@ dependencies = [
[[package]]
name = "anstream"
version = "0.2.6"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "342258dd14006105c2b75ab1bd7543a03bdf0cfc94383303ac212a04939dff6f"
checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"concolor-override",
"concolor-query",
"colorchoice",
"is-terminal",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "0.3.5"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23ea9e81bd02e310c216d080f6223c179012256e5151c41db88d12c88a1684d2"
checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d"
[[package]]
name = "anstyle-parse"
version = "0.1.1"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7d1bb534e9efed14f3e5f44e7dd1a4f709384023a4165199a4241e18dff0116"
checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-wincon"
version = "0.2.0"
name = "anstyle-query"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3127af6145b149f3287bb9a0d10ad9c5692dba8c53ad48285e5bec4063834fa"
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "anstyle-wincon"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188"
dependencies = [
"anstyle",
"windows-sys",
"windows-sys 0.48.0",
]
[[package]]
@ -280,18 +289,18 @@ dependencies = [
[[package]]
name = "clap"
version = "4.2.0"
version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6efb5f0a41b5ef5b50c5da28c07609c20091df0c1fc33d418fa2a7e693c2b624"
checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc"
dependencies = [
"clap_builder",
]
[[package]]
name = "clap_builder"
version = "4.2.0"
version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "671fcaa5debda4b9a84aa7fde49c907c8986c0e6ab927e04217c9cb74e7c8bc9"
checksum = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990"
dependencies = [
"anstream",
"anstyle",
@ -313,9 +322,9 @@ dependencies = [
[[package]]
name = "clap_lex"
version = "0.4.1"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1"
checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
[[package]]
name = "clap_mangen"
@ -337,27 +346,18 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "colorchoice"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "compare"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "120133d4db2ec47efe2e26502ee984747630c67f51974fca0b6c1340cf2368d3"
[[package]]
name = "concolor-override"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a855d4a1978dc52fb0536a04d384c2c0c1aa273597f08b77c8c4d3b2eec6037f"
[[package]]
name = "concolor-query"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88d11d52c3d7ca2e6d0040212be9e4dbbcd78b6447f535b6b561f449427944cf"
dependencies = [
"windows-sys",
]
[[package]]
name = "console"
version = "0.15.7"
@ -368,7 +368,7 @@ dependencies = [
"lazy_static",
"libc",
"unicode-width",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -712,7 +712,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbcf33c2a618cbe41ee43ae6e9f2e48368cd9f9db2896f10167d8d762679f639"
dependencies = [
"nix",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -816,14 +816,14 @@ checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"
[[package]]
name = "dns-lookup"
version = "1.0.8"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53ecafc952c4528d9b51a458d1a8904b81783feff9fde08ab6ed2545ff396872"
checksum = "8f332aa79f9e9de741ac013237294ef42ce2e9c6394dc7d766725812f1238812"
dependencies = [
"cfg-if",
"libc",
"socket2",
"winapi",
"windows-sys 0.48.0",
]
[[package]]
@ -862,7 +862,7 @@ checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0"
dependencies = [
"errno-dragonfly",
"libc",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -911,7 +911,7 @@ dependencies = [
"cfg-if",
"libc",
"redox_syscall 0.2.16",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -1231,19 +1231,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
dependencies = [
"libc",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
name = "is-terminal"
version = "0.4.6"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "256017f749ab3117e93acb91063009e1f1bb56d03965b14c2c8df4eb02c524d8"
checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
dependencies = [
"hermit-abi 0.3.1",
"io-lifetimes",
"rustix 0.37.7",
"windows-sys",
"windows-sys 0.48.0",
]
[[package]]
@ -1439,7 +1439,7 @@ dependencies = [
"libc",
"log",
"wasi",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -1479,7 +1479,7 @@ dependencies = [
"libc",
"mio",
"walkdir",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -1488,7 +1488,7 @@ version = "0.47.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1df031e117bca634c262e9bd3173776844b6c17a90b3741c9163663b4385af76"
dependencies = [
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -1645,7 +1645,7 @@ dependencies = [
"libc",
"redox_syscall 0.2.16",
"smallvec",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -2001,7 +2001,7 @@ dependencies = [
"io-lifetimes",
"libc",
"linux-raw-sys 0.1.4",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -2015,7 +2015,7 @@ dependencies = [
"io-lifetimes",
"libc",
"linux-raw-sys 0.3.0",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -2183,12 +2183,12 @@ checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043"
[[package]]
name = "socket2"
version = "0.4.7"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd"
checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877"
dependencies = [
"libc",
"winapi",
"windows-sys 0.48.0",
]
[[package]]
@ -2230,7 +2230,7 @@ dependencies = [
"fastrand",
"redox_syscall 0.3.5",
"rustix 0.37.7",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -2253,12 +2253,12 @@ dependencies = [
[[package]]
name = "terminal_size"
version = "0.2.5"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c9afddd2cec1c0909f06b00ef33f94ab2cc0578c4a610aa208ddfec8aa2b43a"
checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237"
dependencies = [
"rustix 0.36.14",
"windows-sys",
"rustix 0.37.7",
"windows-sys 0.48.0",
]
[[package]]
@ -2546,7 +2546,7 @@ dependencies = [
"libc",
"time",
"uucore",
"windows-sys",
"windows-sys 0.48.0",
]
[[package]]
@ -2603,7 +2603,7 @@ dependencies = [
"clap",
"glob",
"uucore",
"windows-sys",
"windows-sys 0.48.0",
]
[[package]]
@ -2726,7 +2726,7 @@ dependencies = [
"clap",
"hostname",
"uucore",
"windows-sys",
"windows-sys 0.48.0",
]
[[package]]
@ -3028,7 +3028,7 @@ dependencies = [
"libc",
"uucore",
"walkdir",
"windows-sys",
"windows-sys 0.48.0",
]
[[package]]
@ -3173,7 +3173,7 @@ dependencies = [
"libc",
"nix",
"uucore",
"windows-sys",
"windows-sys 0.48.0",
]
[[package]]
@ -3201,7 +3201,7 @@ dependencies = [
"same-file",
"uucore",
"winapi-util",
"windows-sys",
"windows-sys 0.48.0",
]
[[package]]
@ -3242,7 +3242,7 @@ dependencies = [
"humantime_to_duration",
"time",
"uucore",
"windows-sys",
"windows-sys 0.48.0",
]
[[package]]
@ -3376,7 +3376,7 @@ dependencies = [
"clap",
"libc",
"uucore",
"windows-sys",
"windows-sys 0.48.0",
]
[[package]]
@ -3421,7 +3421,7 @@ dependencies = [
"walkdir",
"wild",
"winapi-util",
"windows-sys",
"windows-sys 0.48.0",
"z85",
]
@ -3574,7 +3574,16 @@ version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
dependencies = [
"windows-targets",
"windows-targets 0.42.2",
]
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets 0.48.0",
]
[[package]]
@ -3583,13 +3592,28 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
"windows_aarch64_gnullvm 0.42.2",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm 0.42.2",
"windows_x86_64_msvc 0.42.2",
]
[[package]]
name = "windows-targets"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
dependencies = [
"windows_aarch64_gnullvm 0.48.0",
"windows_aarch64_msvc 0.48.0",
"windows_i686_gnu 0.48.0",
"windows_i686_msvc 0.48.0",
"windows_x86_64_gnu 0.48.0",
"windows_x86_64_gnullvm 0.48.0",
"windows_x86_64_msvc 0.48.0",
]
[[package]]
@ -3598,42 +3622,84 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
[[package]]
name = "windows_i686_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
[[package]]
name = "windows_i686_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
[[package]]
name = "windows_i686_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
[[package]]
name = "windows_i686_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
[[package]]
name = "xattr"
version = "1.0.0"

View file

@ -269,7 +269,7 @@ bstr = "1.5"
bytecount = "0.6.3"
byteorder = "1.4.3"
chrono = { version="^0.4.25", default-features=false, features=["std", "alloc", "clock"]}
clap = { version = "4.2", features = ["wrap_help", "cargo"] }
clap = { version = "4.3", features = ["wrap_help", "cargo"] }
clap_complete = "4.3"
clap_mangen = "0.2"
compare = "0.1.0"
@ -288,7 +288,7 @@ glob = "0.3.1"
half = "2.2"
humantime_to_duration = "0.2.1"
indicatif = "0.17"
is-terminal = "0.4.6"
is-terminal = "0.4.7"
itertools = "0.10.5"
libc = "0.2.144"
lscolors = { version = "0.14.0", default-features=false, features = ["nu-ansi-term"] }
@ -319,7 +319,7 @@ signal-hook = "0.3.15"
smallvec = { version = "1.10", features = ["union"] }
tempfile = "3.5.0"
term_grid = "0.1.5"
terminal_size = "0.2.5"
terminal_size = "0.2.6"
textwrap = { version="0.16.0", features=["terminal_size"] }
thiserror = "1.0"
time = { version="0.3" }
@ -328,7 +328,7 @@ unicode-width = "0.1.10"
utf-8 = "0.7.6"
walkdir = "2.3"
winapi-util = "0.1.5"
windows-sys = { version="0.45.0", default-features=false }
windows-sys = { version="0.48.0", default-features=false }
xattr = "1.0.0"
zip = { version = "0.6.6", default_features=false, features=["deflate"] }

View file

@ -440,13 +440,19 @@ fn rename(
match b.overwrite {
OverwriteMode::NoClobber => {
return Err(io::Error::new(
io::ErrorKind::Other,
format!("not replacing {}", to.quote()),
));
let err_msg = if b.verbose {
println!("skipped {}", to.quote());
String::new()
} else {
format!("not replacing {}", to.quote())
};
return Err(io::Error::new(io::ErrorKind::Other, err_msg));
}
OverwriteMode::Interactive => {
if !prompt_yes!("overwrite {}?", to.quote()) {
if b.verbose {
println!("skipped {}", to.quote());
}
return Err(io::Error::new(io::ErrorKind::Other, ""));
}
}

View file

@ -20,7 +20,7 @@ path="src/lib/lib.rs"
[dependencies]
clap = { workspace=true }
uucore_procs = { workspace=true }
dns-lookup = { version="1.0.8", optional=true }
dns-lookup = { version="2.0.2", optional=true }
dunce = "1.0.4"
wild = "2.1"
glob = "0.3.1"
@ -58,7 +58,7 @@ tempfile = { workspace=true }
[target.'cfg(target_os = "windows")'.dependencies]
winapi-util = { version= "0.1.5", optional=true }
windows-sys = { version = "0.45.0", optional = true, default-features = false, features = ["Win32_Storage_FileSystem", "Win32_Foundation", "Win32_System_WindowsProgramming"] }
windows-sys = { version = "0.48.0", optional = true, default-features = false, features = ["Win32_Storage_FileSystem", "Win32_Foundation", "Win32_System_WindowsProgramming"] }
[features]
default = []

View file

@ -3,7 +3,7 @@
// * For the full copyright and license information, please view the LICENSE
// * file that was distributed with this source code.
// spell-checker:ignore (ToDO) hdsf ghead gtail
// spell-checker:ignore (ToDO) hdsf ghead gtail ACDBK hexdigit
use std::error::Error;
use std::fmt;

View file

@ -1243,6 +1243,29 @@ fn test_mv_info_self() {
.stderr_contains("mv: cannot move 'dir2' to a subdirectory of itself, 'dir2/dir2'");
}
#[test]
fn test_mv_arg_interactive_skipped() {
let (at, mut ucmd) = at_and_ucmd!();
at.touch("a");
at.touch("b");
ucmd.args(&["-vi", "a", "b"])
.pipe_in("N\n")
.ignore_stdin_write_error()
.fails()
.stderr_is("mv: overwrite 'b'? ")
.stdout_is("skipped 'b'\n");
}
#[test]
fn test_mv_arg_interactive_skipped_vin() {
let (at, mut ucmd) = at_and_ucmd!();
at.touch("a");
at.touch("b");
ucmd.args(&["-vin", "a", "b"])
.fails()
.stdout_is("skipped 'b'\n");
}
#[test]
fn test_mv_into_self_data() {
let scene = TestScenario::new(util_name!());