Skip to content

fix(seq): handle 0e... scientific notation without padding #6934

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

Merged
merged 3 commits into from
Dec 7, 2024

Conversation

aimerlief
Copy link
Contributor

Fix: #6926

This pull request fixes the issue where seq mishandles scientific notation in the form of 0e... by treating it as zero.

Note;
While testing with bash util/run-gnu-test.sh, I discovered another bug unrelated to this fix. I will file a new issue.

cargo run -q seq 0x1p-1 2
seq: invalid hexadecimal argument: '0x1p-1'

@aimerlief aimerlief force-pushed the bugfix/seq-scientific-zero-padding branch from e8b1ce7 to ea2469e Compare December 7, 2024 10:48
Copy link

github-actions bot commented Dec 7, 2024

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

- Updated the parse_exponent_no_decimal function to treat 0e... as zero.
- Added test cases to verify correct behavior for 0e15 and -w 0e15.

Fix: uutils#6926
@aimerlief aimerlief force-pushed the bugfix/seq-scientific-zero-padding branch from ea2469e to 3126e4a Compare December 7, 2024 11:04
Copy link

github-actions bot commented Dec 7, 2024

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@cakebaker
Copy link
Contributor

I don't know if you have seen it: the changes break numberparse::tests::test_parse_big_int:

---- numberparse::tests::test_parse_big_int stdout ----
thread 'numberparse::tests::test_parse_big_int' panicked at src/uu/seq/src/numberparse.rs:402:9:
assertion `left == right` failed
  left: BigDecimal(BigDecimal(sign=NoSign, scale=0, digits=[]))
 right: BigDecimal(BigDecimal(sign=Plus, scale=0, digits=[1]))

@aimerlief
Copy link
Contributor Author

Sorry. I was looking at the integration test, but I must have missed the unit test. I fixed it.

@cakebaker
Copy link
Contributor

Sorry. I was looking at the integration test, but I must have missed the unit test. I fixed it.

No problem :) Can you please run cargo fmt?

@aimerlief
Copy link
Contributor Author

Thank you for the attention. I seem to have gotten impatient, I didn't follow the DEVELOPMENT.md procedure.

Copy link

github-actions bot commented Dec 7, 2024

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@cakebaker cakebaker merged commit 367cc19 into uutils:main Dec 7, 2024
60 of 62 checks passed
@cakebaker
Copy link
Contributor

Thanks for your PR!

@aimerlief aimerlief deleted the bugfix/seq-scientific-zero-padding branch December 7, 2024 15:44
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.

seq: zero gets padded if specified with scientific notation
2 participants