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

comm: implement the ordering check #7144

Merged
merged 1 commit into from
Jan 18, 2025
Merged

comm: implement the ordering check #7144

merged 1 commit into from
Jan 18, 2025

Conversation

sylvestre
Copy link
Contributor

A few comments:

  • skip if the two args are pointing to the same file
  • skip if the same content in the two files
  • implement --check-order
  • implement --nocheck-order
  • output the right things on stderr

Should pass: tests/misc/comm

Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/misc/comm is no longer failing!

@sylvestre sylvestre force-pushed the comm2 branch 3 times, most recently from df0ed16 to 9499902 Compare January 16, 2025 08:11
Copy link

GNU testsuite comparison:

GNU test failed: tests/misc/stdbuf. tests/misc/stdbuf is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/misc/comm is no longer failing!

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/misc/comm is no longer failing!

Copy link
Contributor

@cakebaker cakebaker Jan 16, 2025

Choose a reason for hiding this comment

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

Are the tests check_order, defaultcheck_order, and nocheck_order still needed? They are currently marked as "ignore".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I missed them
ok if I fix that in a following PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

yep :)

@@ -404,7 +409,7 @@ fn unintuitive_default_behavior_1() {
scene
.ucmd()
.args(&["defaultcheck_unintuitive_1", "defaultcheck_unintuitive_2"])
.succeeds()
.fails()
Copy link
Contributor

Choose a reason for hiding this comment

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

Here it might be useful to have a comment that the behavior differs from GNU comm, which doesn't fail.

Copy link
Contributor Author

@sylvestre sylvestre Jan 17, 2025

Choose a reason for hiding this comment

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

are you sure? it fails for me

$ echo "m\nh\nn\no\nc\np\n" > defaultcheck_unintuitive_1
$ echo "m\nh\nn\no\np\n" > defaultcheck_unintuitive_2
$ /usr/bin/comm defaultcheck_unintuitive_1 defaultcheck_unintuitive_2
$ echo $?
1 

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 the reason it fails for you is that echo adds a trailing newline by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, right. Comment added :)

src/uu/comm/src/comm.rs Outdated Show resolved Hide resolved
}

self.last_line = current_line.to_vec();
is_ordered || !self.check_order
Copy link
Contributor

@cakebaker cakebaker Jan 17, 2025

Choose a reason for hiding this comment

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

I'm struggling with the || !self.check_order part. I think this functionality should be somewhere else. It feels illogical that something that's not ordered suddenly can become ordered ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure how to fix that?! sorry

src/uu/comm/src/comm.rs Outdated Show resolved Hide resolved
@sylvestre sylvestre force-pushed the comm2 branch 2 times, most recently from 166b120 to 85f2604 Compare January 17, 2025 21:46
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/misc/comm is no longer failing!

A few comments:
* skip if the two args are pointing to the same file
* skip if the same content in the two files
* implement --check-order
* implement --nocheck-order
* output the right things on stderr

Should pass: tests/misc/comm
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/misc/comm is no longer failing!

@cakebaker cakebaker merged commit 64dad0c into uutils:main Jan 18, 2025
65 checks passed
@cakebaker
Copy link
Contributor

Congrats! The gnu test tests/misc/comm is no longer failing!

Well done :)

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