Re: ps and AIX field descriptors
Reco <recoverym4n@enotuniq.net> writes:
> Hi.
>
> On Fri, Feb 17, 2023 at 07:46:23AM +0100, Andreas Leha wrote:
>> Now my question: How can I restore the previous behaviour that allowed
>> other than whitespace separators between fields?
>
> diff -purw procps-3.3.17/ps/sortformat.c procps-4.0.2/src/ps/sortformat.c
> shows me that:
>
> @@ -128,22 +127,24 @@ static const char *aix_format_parse(sf_n
> items = 0;
> walk = sfn->sf;
> /* state machine */ {
> - int c;
> + int c = *walk++;
> initial:
> - c = *walk++;
> if(c=='%') goto get_desc;
> if(!c) goto looks_ok;
> /* 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;
> + if(c&&c!=' ') goto initial;
> + return _("missing AIX field descriptor");
> + aix_oops:
> return _("improper AIX field descriptor");
> looks_ok:
> ;
>
> If you look at "get_more" label, you'll notice that "old" version of
> procps (bullseye's) checked for any character after "%<char>" block.
> "New" one (bookworm's) explicitly checks for space, and goes to
> "aix_oops" in any other case.
>
> And there is no #ifdefs, no environment variable checks, no options
> etc.
>
>
> So, to answer your question - currently the only way to restore the
> behaviour you want is to patch procps and rebuild it.
>
> Reco
Dear Reco,
Thanks for the fast and accurate answer! What a shame for this change...
Best,
Andreas
Reply to: