Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm: should match GNU's output if multiple slashes in argument #1829

Closed
jhscheer opened this issue Mar 15, 2021 · 1 comment · Fixed by #1988
Closed

rm: should match GNU's output if multiple slashes in argument #1829

jhscheer opened this issue Mar 15, 2021 · 1 comment · Fixed by #1988
Labels
good first issue For newcomers!

Comments

@jhscheer
Copy link
Contributor

rm fails this test: https://github.com/coreutils/coreutils/blob/master/tests/rm/v-slash.sh
The directory and the file are removed, but the stdout doesn't match GNU's stdout.

If ported to rust:

#[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);

    ucmd.arg("-r")
        .arg("-f")
        .arg("-v")
        .arg(&format!("{}///", dir))
        .succeeds()
        .stdout_only(format!(
            "removed '{}'\nremoved directory '{}'\n",
            file_a, dir
        ));

    assert!(!at.dir_exists(dir));
    assert!(!at.file_exists(file_a));
}

the output is:

'test_rm::test_rm_verbose_slash' panicked at 'assertion failed: `(left == right)`
  left: `"removed directory \'test_rm_verbose_slash_directory///\'\n"`,
 right: `"removed \'test_rm_verbose_slash_directory/test_rm_verbose_slash_file_a\'\nremoved directory \'test_rm_verbose_slash_directory\'\n"`'

Related #1768

@sylvestre sylvestre added the good first issue For newcomers! label Mar 20, 2021
marvin-bitterlich added a commit to marvin-bitterlich/coreutils that referenced this issue Mar 31, 2021
Uses the normalize_path used in cargo to strip duplicate slashes
With a link to a std rfc rust-lang/rfcs#2208

This fixes uutils#1829

This also touches uutils#1768 
but does not attempt to fully solve it
@marvin-bitterlich
Copy link
Contributor

I took a stab at this in #1988 as a first contribution to this project :)

sylvestre pushed a commit that referenced this issue Apr 5, 2021
* 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 rust-lang/rfcs#2208

This fixes #1829

This also touches #1768 
but does not attempt to fully solve it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue For newcomers!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants