-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
comm: fix comparison when reading from pipes #9545
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: fix comparison when reading from pipes #9545
Conversation
bd3c2e3 to
2ebd3da
Compare
|
GNU testsuite comparison: |
2ebd3da to
5c944e5
Compare
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
93d9b01 to
a9a638c
Compare
|
GNU testsuite comparison: |
|
could you please add a test to make sure we don't regress? thanks |
3dd232a to
f9720dd
Compare
|
Tried to add a test. On my machine (Linux, WSL2, devcontainer) the test fails if the fix is not applied: and passes with the applied fix in comm.rs. |
|
GNU testsuite comparison: |
Merging this PR will improve performance by 7.93%
Performance Changes
Comparing Footnotes
|
f9720dd to
dfc195d
Compare
|
GNU testsuite comparison: |
dfc195d to
519cb19
Compare
|
GNU testsuite comparison: |
|
@sylvestre : test added. please re-review. Failure in CI (windows-latest) is most likely independent of my changes. Could you please retrigger the job to be sure? |
Use case is that two files are piped into comm, i.e. in bash comm <(cat file1) <(cat file2) Before the fix, comm reads from the pipes twice. Once in "fn comm" and once in "fn are_files_identical". As such, part of the data is skipped in comparison which leads to wrong output. This is fixed by skipping the file comparison in case one of the files is not a regular file.
519cb19 to
4adb9f4
Compare
|
GNU testsuite comparison: |
|
@sylvestre : resolved merged conflicts, ready to be reviewed. |
Use case is that two files are piped into comm, i.e. in bash
see also full example in #9537
Before the fix, comm reads from the pipes twice. Once in "fn comm" and
once in "fn are_files_identical". As such, part of the data is skipped
in comparison which leads to wrong output.
This is fixed by skipping the file comparison in case one of the files is not a regular file.
This fixes #9537