[Bug 267282] strfmon: Attempt to fix some strfmon(3) bugs

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 23 Oct 2022 03:49:26 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267282

            Bug ID: 267282
           Summary: strfmon: Attempt to fix some strfmon(3) bugs
           Product: Base System
           Version: CURRENT
          Hardware: Any
               URL: https://github.com/freebsd/freebsd-src/pull/619
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: standards
          Assignee: standards@FreeBSD.org
          Reporter: jlduran@gmail.com

Created attachment 237546
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=237546&action=edit
MWE

Attached is a simple MWE that reproduces a few bugs in the current strfmon(3)
code.

I have created a GitHub pull request (#619), which attempts to fix them:
https://github.com/freebsd/freebsd-src/pull/619

$ ./strfmon_bugs
  Format: [%8n] [%8n]
Expected: [ $123.45] [ $123.45]
  Actual: [ $123.45] [       $123.45]

  Format: [%(#5n]
Expected: [ $   123.45 ] [($   123.45)] [ $ 3,456.78 ]
  Actual: [$   123.45] [($   123.45)] [$ 3,456.78]

  Format: [%!(#5n]
Expected: [    123.45 ] [(   123.45)] [  3,456.78 ]
  Actual: [   123.45] [(   123.45)] [ 3,456.78]

  Format: [%n] (n_cs_precedes = 0, n_sep_by_space = 2, n_sign_posn = 1)
Expected: [- 123.45$]
  Actual: [-123.45$]

  Format: [%i]
Expected: [USD123.45]
  Actual: [USD 123.45]

  Format: [%i]
Expected: [123,45 EUR]
  Actual: [123,45 EUR ]

Posting it here fore visibility and tracking.

-- 
You are receiving this mail because:
You are the assignee for the bug.