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: add verbose output and trim multiple slashes #1988

Merged
merged 16 commits into from
Apr 5, 2021

Conversation

marvin-bitterlich
Copy link
Contributor

Fixes #1829

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, as I rather have that be a separate pr

The fix to enable any output was to use the recursive version whenever we want to be verbose. #1768 (comment) suggests to anyway run remove_dir_all after we do the recursive delete but I feel more tests are needed

I also updated the test proposed in #1829 to account for windows having a different normalized path using \\

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
This is ambiguous as we have no precedent for how windows paths should be formatted
So I picked the canonical form
@marvin-bitterlich
Copy link
Contributor Author

I noticed that running the test suite on windows that there are unrelated tests failing, but they were failing before my change and since ci is happy I'm assuming its fine.

There are also unrelated rustfmt changes that I did not commit because they are not relevant to the change at hand

Let me know if there is anything I can do to improve the change as I can test on both platforms

tests/by-util/test_rm.rs Outdated Show resolved Hide resolved
src/uu/rm/src/rm.rs Outdated Show resolved Hide resolved
@marvin-bitterlich
Copy link
Contributor Author

Should be ready to review now :)

  • extracted utility function into uucore
  • enabled tests for uucore with full coverage of diff

@marvin-bitterlich
Copy link
Contributor Author

@sylvestre let me know if anything is still missing :)

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove this

Suggested change
args: --features "feat_os_unix" -p uucore -p coreutils
args: --features "feat_os_unix"

please create a separate PR for this with the rational

Copy link
Contributor Author

Choose a reason for hiding this comment

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

created #2030 which now blocks this pr :)

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

@@ -226,6 +226,11 @@ If you would prefer to test a select few utilities:
$ cargo test --features "chmod mv tail" --no-default-features
```

Copy link
Contributor

Choose a reason for hiding this comment

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

same

src/uu/rm/Cargo.toml Outdated Show resolved Hide resolved
marvin-bitterlich added a commit to marvin-bitterlich/coreutils that referenced this pull request Apr 5, 2021
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 uutils#1988 where first tests for uucore will be introduced
@sylvestre sylvestre merged commit 9581fcf into uutils:master Apr 5, 2021
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.

rm: should match GNU's output if multiple slashes in argument
3 participants