[ since our'master' branch will suffer the same fate ]
[ this was ported from a patch created for 'newlib'. ]
-------------------------- original newlib commit text
-------------------------- (showing our master commit)
The commit shown below broke the aix behavior that Dr.
Fink recently reported. However, in the proposed patch
the old behavior, showing garbage when '%cpu' was used
with an invalid formatting option, would appear again.
So this patch, based on Werner's patch, goes the extra
distance to prevent that. Along the way we'll disallow
commas in the aix format str to prevent their display.
Reference(s):
https://www.freelists.org/post/procps/Procpsng-400-released-with-newlib,2
. Mar, 2022 - where aix bug was introduced
commit
05187e4f17fec226ca60595a7558f9a34750efb0
Prototyped-by: Dr. Werner Fink <werner@suse.de>
Signed-off-by: Jim Warner <james.warner@comcast.net>
c = *walk++;
if(c=='%') goto get_desc;
if(!c) goto looks_ok;
+ if(c==',') goto aix_oops;
/* get_text: */
items++;
- get_more_text:
+ get_more:
c = *walk++;
if(c=='%') goto get_desc;
- if(c) goto get_more_text;
+ if(c==' ') goto get_more;
+ if(c) goto aix_oops;
goto looks_ok;
get_desc:
items++;
c = *walk++;
if(c) goto initial;
+ aix_oops:
return _("improper AIX field descriptor");
looks_ok:
;
if(0) improper: err=_("improper format list");
if(0) badwidth: err=_("column widths must be unsigned decimal numbers");
if(0) notmacro: err=_("can not set width for a macro (multi-column) format specifier");
- if (!err)
- if(strchr(sfn->sf,'%')) err = aix_format_parse(sfn);
+ if(strchr(sfn->sf,'%')) err = aix_format_parse(sfn);
return err;
}