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

seq: fails to parse hexadecimal floating-point arguments like 0x1p-1 #6935

Open
aimerlief opened this issue Dec 7, 2024 · 5 comments
Open
Labels

Comments

@aimerlief
Copy link
Contributor

While running bash util/run-gnu-test.sh, I encountered a bug where seq fails to handle hexadecimal arguments correctly. Specifically, the following command does not behave as expected:

$ cargo run -q seq 0x1p-1 2
seq: invalid hexadecimal argument: '0x1p-1'
$ seq 0x1p-1 2
0.5
1.5
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 14, 2024
Initial version of a hexadecimal float parser. This implementation is
intended for preview and further discussion.

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 14, 2024
Turn on the float parser. Now it's possible to use hexadecimal floats as
parameters. For example,

    cargo run -- 0x1p-1 3
    0.5
    1.5
    2.5

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 14, 2024
@alexs-sh
Copy link
Contributor

@aimerlief Thx

@alexs-sh
Copy link
Contributor

Hello, I'd like to work on this issue

@alexs-sh
Copy link
Contributor

#6959 - here is an early PR draft, which introduces support for hexadecimal floating points. Mainly to kick off the review process and gather feedback. Any comments or suggestions are welcome

alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 14, 2024
This change fixes fuzz build and simplifies f64 / BigDecimal
conversions.

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 14, 2024
Now test_parse_float_from_invalid_values checks the error code.

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 14, 2024
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 14, 2024
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 14, 2024
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 15, 2024
Initial version of a hexadecimal float parser. This implementation is
intended for preview and further discussion.

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 15, 2024
Turn on the float parser. Now it's possible to use hexadecimal floats as
parameters. For example,

    cargo run -- 0x1p-1 3
    0.5
    1.5
    2.5

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 15, 2024
Fix the test that fails after the implementation of the floating-point
format. The expected output now matches the GNU seq output.

    seq 0xlmnop
    seq: invalid floating point argument: ‘0xlmnop’

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 15, 2024
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 15, 2024
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 15, 2024
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 15, 2024
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 15, 2024
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 16, 2024
Initial version of a hexadecimal float parser. This implementation is
intended for preview and further discussion.

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 16, 2024
Turn on the float parser. Now it's possible to use hexadecimal floats as
parameters. For example,

    cargo run -- 0x1p-1 3
    0.5
    1.5
    2.5

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 16, 2024
Fix the test that fails after the implementation of the floating-point
format. The expected output now matches the GNU seq output.

    seq 0xlmnop
    seq: invalid floating point argument: ‘0xlmnop’

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 16, 2024
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 16, 2024
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 16, 2024
Initial version of a hexadecimal float parser. This implementation is
intended for preview and further discussion.

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 16, 2024
Turn on the float parser. Now it's possible to use hexadecimal floats as
parameters. For example,

    cargo run -- 0x1p-1 3
    0.5
    1.5
    2.5

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 16, 2024
Fix the test that fails after the implementation of the floating-point
format. The expected output now matches the GNU seq output.

    seq 0xlmnop
    seq: invalid floating point argument: ‘0xlmnop’

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 16, 2024
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 16, 2024
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 17, 2024
Initial version of a hexadecimal float parser. This implementation is
intended for preview and further discussion.

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 17, 2024
Turn on the float parser. Now it's possible to use hexadecimal floats as
parameters. For example,

    cargo run -- 0x1p-1 3
    0.5
    1.5
    2.5

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 17, 2024
Fix the test that fails after the implementation of the floating-point
format. The expected output now matches the GNU seq output.

    seq 0xlmnop
    seq: invalid floating point argument: ‘0xlmnop’

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 17, 2024
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 17, 2024
@gim913
Copy link
Contributor

gim913 commented Dec 22, 2024

Is this the same issue as #2660 ? (I guess the answer is yes)

@alexs-sh
Copy link
Contributor

Hello @gim913. Thank you for the information.

Yes, this is the same issue related to the missing support for hexadecimal floating-point numbers. I tested the text input from #2660 with the fixes from #6959, and the output is close to the expected result. However, additional work is required to reach 100% compatibility with the original seq output.

cargo run -- -0x.ep-3 -0x.1p-3 -0x.fp-3
-0.1093750
-0.1171875

vs

seq -0x.ep-3 -0x.1p-3 -0x.fp-3
-0.109375
-0.117188

alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 26, 2024
Initial version of a hexadecimal float parser. This implementation is
intended for preview and further discussion.

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 26, 2024
Turn on the float parser. Now it's possible to use hexadecimal floats as
parameters. For example,

    cargo run -- 0x1p-1 3
    0.5
    1.5
    2.5

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 26, 2024
Fix the test that fails after the implementation of the floating-point
format. The expected output now matches the GNU seq output.

    seq 0xlmnop
    seq: invalid floating point argument: ‘0xlmnop’

Issue uutils#6935
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 26, 2024
alexs-sh added a commit to alexs-sh/coreutils that referenced this issue Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants