-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
rm
: r4_gnu_test
#6621
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
: r4_gnu_test
#6621
Conversation
GNU testsuite comparison:
|
e345a5b
to
7864683
Compare
GNU testsuite comparison:
|
1 similar comment
GNU testsuite comparison:
|
8b80b2f
to
f69dd02
Compare
Why not make it work on Windows as well? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs some updates
Sorry for the lack of communication, had some assignment deadlines to fulfill. I will push out updates today. |
fec794f
to
17391e3
Compare
GNU testsuite comparison:
|
17391e3
to
21cfb9c
Compare
GNU testsuite comparison:
|
3e4b765
to
8164ea8
Compare
GNU testsuite comparison:
|
@sylvestre This should be ready for a review now |
GNU testsuite comparison:
|
Is the utf-8 crate from Also, for your
Lastly, for your tests, I think you could save yourself 30ish lines and just use the conditional variable assignments for *nix/Windows ( EDIT: I realize your function is for trailing slashes, not necessarily double. You could always turn it into a more general cleaning function with the replace that I mentioned, and remove trailing, but I just misread it, my apologies. But instead of a loop at line 633, wouldn't you be able to use a built-in method for the path to get the first index and use that directly in the path slice? |
I believe my PR does remove it.
The helper functions get called only when the stat() call yields a directory. So your file example won't really trigger the code. There is no point in doing
We usually just add new tests instead of changing old tests unless it asserts wrong behavior and therefore fail, the test would be caught in the CI if people forget to change anyway.
We only care about cleaning the end of the string from slashes to print to stderr. There is no point cleaning the middle, doing a stat() call on something like Actually I was under the idea that converting windows utf-16 OsStr to rust str type might fail that's why the I was very hesitant to use strings. |
My apologies, I just saw it an my mind went to add. But yeah, I see you're actually removing it
Yeeaah, I remember that now. However, on Linux, I can also make a directory that's named
Would work just as well. But I think we need to go through the extra hassle of ensuring that's the 'entire' name of the program. There might be other ways to do that, like see if it ends with
Yeah, that's a good point. It may not cover the case of someone making a test stricter and forgetting the other one, but I think it's valid enough. And like I said, the test looks clean enough, doing a bunch of formats may make it look not so pretty.
I have no clue about that, so I'll just say that sounds good if so and leave it to you and Sylvestre. |
Good catch, i will push a fix for that. |
It seems like there is some niche behavior with GNU which does seem like a bug.
It seems like gnu converts the path into Linux allows both files and directories to be named
@sylvestre Need some advice on how to handle this . Do we just do the same and read the path as overlapping instances of |
What setup are you on? I just made files and directories with a bunch of '.'s, and couldn't replicate it. For GNU, I mean. I'm on Mint 20.1, x86 |
Have you checked the hidden files to see if they exist ? Doing |
GNU testsuite comparison:
|
1 similar comment
GNU testsuite comparison:
|
23c0da6
to
fd9df17
Compare
GNU testsuite comparison:
|
fd9df17
to
1ba9c88
Compare
GNU testsuite comparison:
|
1ba9c88
to
ef42649
Compare
GNU testsuite comparison:
|
ef42649
to
56b6a42
Compare
GNU testsuite comparison:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR now touches --no-preserve-root
, and I'm not yet convinced that the code is correct. Are you sure you want to handle this in the same PR?
56b6a42
to
5a3d9de
Compare
GNU testsuite comparison:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, only one minor thing:
- You'll need to rebase due to fix(deps): update rust crate tempfile to v3.12.0 #6647. This also raises the question why you need to touch Cargo.lock at all – you probably have a good reason, I just don't understand it yet.
(The other two nitpicks are optional.)
I'm clicking on "Approve" so that you don't have to wait so long for a response again.
Cargo.toml
Outdated
@@ -337,7 +337,6 @@ thiserror = "1.0.59" | |||
time = { version = "0.3.36" } | |||
unicode-segmentation = "1.11.0" | |||
unicode-width = "0.1.12" | |||
utf-8 = "0.7.6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't yet see why this PR needs to touch windows-sys and utf-8. There's probably a good reason that I just don't see. Could you fill me in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably removed it after running udeps. Looking back at it now, we need both of them for windows specific function and i definitely ignored it since the CI passed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BenWiederhake I was wondering, would basically updating my master and then merging to my feature branch be okay to do ? I kinda need some help on how to rebase this, can't seem to figure it out.
@@ -611,3 +679,17 @@ fn is_symlink_dir(metadata: &Metadata) -> bool { | |||
metadata.file_type().is_symlink() | |||
&& ((metadata.file_attributes() & FILE_ATTRIBUTE_DIRECTORY) != 0) | |||
} | |||
|
|||
mod tests { | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use super::*; |
This way, you don't have to use crate::foo_bar;
everything in each test again and again.
d254369
to
03e5316
Compare
404f5ce
to
80693c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's merge this! (After rebasing and fixing conflicts.)
Sorry for waiting an entire month, I got side-tracked.
I still suggest doing use super::*;
in the tests in rm.rs
, to simplify imports in the submodule. However, that doesn't affect correctness.
GNU testsuite comparison:
|
GNU testsuite comparison:
|
Added regex detection to various combination of ".." and "." followed by slashes .