bugGNU GRUB - Bugs: bug #33144, [PATCH] Support * as field width...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #33144: [PATCH] Support * as field width or precision in printf

Submitter:  Josh Triplett <joshtriplett>
Submitted:  Fri 22 Apr 2011 07:52:51 AM UTC
   
 
Category:  None Severity:  Major
Priority:  5 - Normal Item Group:  Feature Request
Status:  Invalid Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Closed Release:  Bazaar - trunk
Release:  Reproducibility:  None
Planned Release:  None

Fri 22 Apr 2011 08:40:39 PM UTC, comment #3: 

a) I didn't realize that; I'll follow up to grub-devel@gnu.org.
b) I'll include a stronger justification in the followup. :)

Josh Triplett <joshtriplett>
Fri 22 Apr 2011 12:31:51 PM UTC, comment #2: 

a) This isn't a right place for posting feature patches. Please use -email is unavailable-
b) grub_printf is in size-critical part. So it has a strong anti-featuritus policy. Unless this new feature is really needed it's rejected. In your case I don't see enough uses of it to justify the inclusion. If you feel like I'm wrong present your argument on -email is unavailable-

Vladimir Serbinenko <phcoder>
Group administrator
Fri 22 Apr 2011 07:55:52 AM UTC, comment #1: 

Properly formatted ChangeLog entry, marked as verbatim text this time:


2011-04-21  Josh Triplett  <josh@joshtriplett.org>
2011-04-21  Burt Triplett  <burt@pbjtriplett.org>

        * grub-core/kern/misc.c (grub_vsnprintf_real): Add support for '*'
        as field width or precision.


Josh Triplett <joshtriplett>
Fri 22 Apr 2011 07:52:51 AM UTC, original submission:  

The attached patch implements support for * as the field width or precision in printf, which obtains that field width or precision from the next va_arg.  This proves particularly useful for modifying %s: %.*s allows printing a non-NUL-terminated string with a known length.

Tested with the following test cases, all of which worked:


grub_printf("|%*s|\n", -50, "left-aligned in 50");
grub_printf("|%*s|\n", 50, "right-aligned in 50");
grub_printf("|%.*s|\n", 5, "truncated");
grub_printf("|%.*s|\n", -5, "truncated");
grub_printf("|%*.*s|\n", 20, 5, "truncated");
grub_printf("|%*.*s|\n", -20, 5, "truncated");
grub_printf("|%50s|\n", "hardcoded 50");
grub_printf("|%-50s|\n", "hardcoded -50");
grub_printf("|%.5s|\n", "truncated");


ChangeLog entry:

2011-04-21  Josh Triplett  <josh@joshtriplett.org>
2011-04-21  Burt Triplett  <burt@pbjtriplett.org>

  • grub-core/kern/misc.c (grub_vsnprintf_real): Add support for '*'

as field width or precision.

Josh Triplett <joshtriplett>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by phcoder (Posted a comment)
  • -email is unavailable- added by joshtriplett (Submitted the item)
  • -email is unavailable- added by joshtriplett
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-04-22 phcoder StatusNone Invalid
        Open/ClosedOpen Closed
    2011-04-22 joshtriplett Attached File- Added grub-printf-star.patch, #23288
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code