Skip to content

Conversation

sylvestre
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Jul 1, 2025

GNU testsuite comparison:

GNU test failed: tests/mv/dup-source. tests/mv/dup-source is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/mv/hard-link-1 is no longer failing!
Congrats! The gnu test tests/mv/part-fail is no longer failing!
Congrats! The gnu test tests/mv/part-hardlink is no longer failing!

@cakebaker
Copy link
Contributor

Congrats! The gnu test tests/mv/hard-link-1 is no longer failing!
Congrats! The gnu test tests/mv/part-fail is no longer failing!
Congrats! The gnu test tests/mv/part-hardlink is no longer failing!

Kudos, three passing GNU tests :) Unfortunately, there is also a regression:

GNU test failed: tests/mv/dup-source. tests/mv/dup-source is passing on 'main'. Maybe you have to rebase?

Comment on lines +2086 to +2087
at.write("f", "file content");
at.hard_link("f", "g");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You already test moving a file and a hard link in test_mv_preserves_hardlinks_across_partitions and thus I wouldn't do it again in this test function.

Comment on lines +2146 to +2149
let moved_dir_a_file = other_fs_tempdir.path().join("a/1");
let moved_dir_second_file = other_fs_tempdir.path().join("b/1");
let moved_dir_a_file_metadata = metadata(&moved_dir_a_file).unwrap();
let moved_dir_second_file_metadata = metadata(&moved_dir_second_file).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming with "a_file" and "second_file" feels a bit odd. Maybe it would be better to use names that contain "a1" and "b1", similar to the naming on lines 2096/2097?

Comment on lines 2362 to 2375
#[test]
fn test_mv_error_handling_graceful_fallback() {
let (at, mut ucmd) = at_and_ucmd!();

at.write("file1", "test content");

at.mkdir("target");

// Move with verbose output to test error handling messages
ucmd.arg("--verbose").arg("file1").arg("target").succeeds();

assert!(at.file_exists("target/file1"));
assert!(!at.file_exists("file1"));
}
Copy link
Contributor

@cakebaker cakebaker Jul 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what the purpose of this test is: the function name and the comment indicate the test is related to some error handling, but there is no error. Currently, it looks like the test function is a duplicate of test_mv_move_file_into_dir.

Comment on lines 2377 to 2393
#[test]
#[cfg(unix)]
fn test_mv_hardlink_scanning_with_permissions() {
let (at, mut ucmd) = at_and_ucmd!();

// Create files that we can control permissions on
at.write("accessible_file", "content");
at.mkdir("target");

// Test with verbose mode to ensure graceful error handling
ucmd.arg("--verbose")
.arg("accessible_file")
.arg("target")
.succeeds();

assert!(at.file_exists("target/accessible_file"));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test function also looks like a duplicate of test_mv_move_file_into_dir.

Comment on lines 2421 to 2439
#[test]
#[cfg(unix)]
fn test_mv_empty_hardlink_groups() {
let (at, mut ucmd) = at_and_ucmd!();

at.write("single1", "content1");
at.write("single2", "content2");
at.mkdir("target");

// Test with files that have no hardlinks
ucmd.arg("--verbose")
.arg("single1")
.arg("single2")
.arg("target")
.succeeds();

assert!(at.file_exists("target/single1"));
assert!(at.file_exists("target/single2"));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test function also looks like a duplicate of test_mv_move_file_into_dir.

Comment on lines 364 to 396
#[cfg(unix)]
{
let (mut hardlink_tracker, hardlink_scanner) = create_hardlink_context();
rename(
source,
target,
opts,
None,
Some(&mut hardlink_tracker),
Some(&hardlink_scanner),
)
})
.map_err_context(|| {
get_message_with_args(
"mv-error-cannot-move",
HashMap::from([
("source".to_string(), source.quote().to_string()),
("target".to_string(), target.quote().to_string()),
]),
)
})
}
#[cfg(not(unix))]
{
rename(source, target, opts, None, None, None).map_err_context(|| {
get_message_with_args(
"mv-error-cannot-move",
HashMap::from([
("source".to_string(), source.quote().to_string()),
("target".to_string(), target.quote().to_string()),
]),
)
})
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could use a similar approach as on lines 659 - 662 and use the same call of rename for both unix and non-unix.

Comment on lines 425 to 442
#[cfg(unix)]
{
let (mut hardlink_tracker, hardlink_scanner) = create_hardlink_context();
rename(
source,
target,
opts,
None,
Some(&mut hardlink_tracker),
Some(&hardlink_scanner),
)
.map_err(|e| USimpleError::new(1, format!("{e}")))
}
#[cfg(not(unix))]
{
rename(source, target, opts, None, None, None)
.map_err(|e| USimpleError::new(1, format!("{e}")))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Copy link

github-actions bot commented Jul 3, 2025

GNU testsuite comparison:

GNU test failed: tests/mv/dup-source. tests/mv/dup-source is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/mv/hard-link-1 is no longer failing!
Congrats! The gnu test tests/mv/part-fail is no longer failing!
Congrats! The gnu test tests/mv/part-hardlink is no longer failing!

sylvestre and others added 3 commits July 3, 2025 15:31
Should fix GNU tests/mv/part-hardlink.sh tests/mv/hard-link-1.sh

Co-authored-by: Daniel Hofstetter <[email protected]>
Copy link

github-actions bot commented Jul 3, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/mv/hard-link-1 is no longer failing!
Congrats! The gnu test tests/mv/part-fail is no longer failing!
Congrats! The gnu test tests/mv/part-hardlink is no longer failing!

@cakebaker cakebaker merged commit e9b24b4 into uutils:main Jul 3, 2025
76 checks passed
@sylvestre sylvestre deleted the mv-part-hardlink branch July 3, 2025 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants