[Crash-utility] "char-mapper"
Bruce Korb
bruce.korb at gmail.com
Tue Feb 21 22:17:17 UTC 2012
On Tue, Feb 21, 2012 at 2:09 PM, Dave Anderson <anderson at redhat.com> wrote:
>
>
> ----- Original Message -----
>> Hi Dave,
>>
>> Just to throw another wrench into the mix, you might find customized character
>> classifications useful. First, you'd specify an interesting
>> category:
>>
>> redirection "|!>"
>>
>> then you generate a table and some macros and then:
>>
>> p1 = BRK_REDIRECTION_CHARS(p2);
>> if (*p1 != NUL) {
>> fp = handle_redirection(p1);
>> *p1 = NUL;
>> }
>>
>> To play with it, install gperf and autogen, git-clone the autogen sources,
>> go into autogen/add-on/char-mapper and type "make".
>>
>> If you use it, I recommend checking the generated source into git/svn.
>> The git repo is on both sourceforge and savannah.gnu.org
>>
>> Anyway, thanks for the patch, though I think there may still be a problem.
>> Anything after the first pipe character can be arbitrary shell. viz:
>> crash-command ! cat | sed s/// > file
>> which is why I recommended the char classifier stuff.
>> The BRK macro stops the scan on the first match of a character from
>> the REDIRECTION class of characters.
>
> Right - a combined ! and | would also be a problem. But that's easy
> enough to fix.
With strbrk(). You cannot use a sequence of strchr's, unless you gather
the results and look for the min address of them. That's why my
recommendation.
http://www.gnu.org/software/autogen/addon.html#char-mapper
It makes this stuff _much_ easier and does not require recomputing
map tables every time a SPN/BRK gets called.
More information about the Crash-utility
mailing list