Skip to content

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

Merged
cakebaker merged 3 commits intouutils:mainfrom
karanabe:bugfix/seq-scientific-zero-padding
Dec 7, 2024
Merged

fix(seq): handle 0e... scientific notation without padding#6934
cakebaker merged 3 commits intouutils:mainfrom
karanabe:bugfix/seq-scientific-zero-padding

Conversation

@karanabe
Copy link
Contributor

@karanabe karanabe commented Dec 7, 2024

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'

@github-actions
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: #6926
@github-actions
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]))

@karanabe
Copy link
Contributor Author

karanabe commented Dec 7, 2024

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?

@karanabe
Copy link
Contributor Author

karanabe commented Dec 7, 2024

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

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

Thanks for your PR!

@karanabe karanabe 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