Skip to content

timeout: Duration parsing does not support all float formats (e.g. hex) #7475

Closed

Description

@drinkcat

GNU coreutils supports things like hex formatting, and arbitrary case for infinity parsing:

timeout 0x1.1 cat
timeout 0x1.1p-1 cat
timeout -k 0x10.1 1 cat
timeout INF cat
timeout InF cat

Not a huge deal, probably a pretty rare edge case that I doubt anybody cares about, but it seems worth it to use generic float parsing functions in uucore/format after they are fixed.

Activity

  1. drinkcat commented on Apr 4, 2025

    @drinkcat
    CollaboratorAuthor

    One interesting thing is that GNU coreutils rounds down very small values to 0, which has a totally different meaning (0 means no timeout, a small value should be a... very short timeout).

    Those 3 exit immediately:

    timeout 0.0001 cat
    timeout 1e-100 cat
    timeout 1e-300 cat
    

    But this never exits:

    timeout 1e-3000 cat
    

    As if we had typed:

    timeout 0 cat
    

    Similarly to the discussion in #7641, I wouldn't find it shocking if we treated 1e-3000 as a very short timeout (and not 0).

  2. cakebaker commented on Apr 4, 2025

    @cakebaker
    Contributor

    Closed by mistake, reopen it.

  3. tertsdiepraam commented on Apr 4, 2025

    @tertsdiepraam
    Collaborator

    But this never exits:

    timeout 1e-3000 cat
    

    Might be worth sending a bug report about! I can't find anything about it on their mailing lists.

  4. drinkcat commented on Apr 4, 2025

    @drinkcat
    CollaboratorAuthor

    But this never exits:

    timeout 1e-3000 cat
    

    Might be worth sending a bug report about! I can't find anything about it on their mailing lists.

    Good point. https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77535

    Also interesting to see those arguments about 0 meaning never: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=9102 (it would be better to use inf IMHO...)

  5. drinkcat commented on Apr 4, 2025

    @drinkcat
    CollaboratorAuthor

    But this never exits:

    timeout 1e-3000 cat
    

    Might be worth sending a bug report about! I can't find anything about it on their mailing lists.

    Good point. https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77535

    That was worth it, already fixed!

  6. drinkcat commented on Apr 5, 2025

    @drinkcat
    CollaboratorAuthor

    Fixed by #7648.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions