mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +00:00
Merge branch 'main' into hotfix-mktemp
This commit is contained in:
commit
5c3bb90df2
3 changed files with 14 additions and 3 deletions
|
@ -93,7 +93,7 @@ impl<'a> Context<'a> {
|
||||||
fn new(root: &'a Path, target: &'a Path) -> std::io::Result<Self> {
|
fn new(root: &'a Path, target: &'a Path) -> std::io::Result<Self> {
|
||||||
let current_dir = env::current_dir()?;
|
let current_dir = env::current_dir()?;
|
||||||
let root_path = current_dir.join(root);
|
let root_path = current_dir.join(root);
|
||||||
let root_parent = if target.exists() {
|
let root_parent = if target.exists() && !root.to_str().unwrap().ends_with("/.") {
|
||||||
root_path.parent().map(|p| p.to_path_buf())
|
root_path.parent().map(|p| p.to_path_buf())
|
||||||
} else {
|
} else {
|
||||||
Some(root_path)
|
Some(root_path)
|
||||||
|
|
|
@ -115,8 +115,8 @@ fn process_utmpx() -> (Option<time_t>, usize) {
|
||||||
USER_PROCESS => nusers += 1,
|
USER_PROCESS => nusers += 1,
|
||||||
BOOT_TIME => {
|
BOOT_TIME => {
|
||||||
let dt = line.login_time();
|
let dt = line.login_time();
|
||||||
if dt.second() > 0 {
|
if dt.unix_timestamp() > 0 {
|
||||||
boot_time = Some(dt.second() as time_t);
|
boot_time = Some(dt.unix_timestamp() as time_t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => continue,
|
_ => continue,
|
||||||
|
|
|
@ -2535,3 +2535,14 @@ fn test_src_base_dot() {
|
||||||
.no_stdout();
|
.no_stdout();
|
||||||
assert!(!at.dir_exists("y/x"));
|
assert!(!at.dir_exists("y/x"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
fn test_cp_archive_on_directory_ending_dot() {
|
||||||
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
at.mkdir("dir1");
|
||||||
|
at.mkdir("dir2");
|
||||||
|
at.touch("dir1/file");
|
||||||
|
ucmd.args(&["-a", "dir1/.", "dir2"]).succeeds();
|
||||||
|
assert!(at.file_exists("dir2/file"));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue