FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Crash Utility

 
 
LinkBack Thread Tools
 
Old 02-21-2012, 09:09 PM
Dave Anderson
 
Default "char-mapper"

----- 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.

Thanks again,
Dave


--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 02-21-2012, 09:17 PM
Bruce Korb
 
Default "char-mapper"

On Tue, Feb 21, 2012 at 2:09 PM, Dave Anderson <anderson@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.

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 02-21-2012, 09:30 PM
Dave Anderson
 
Default "char-mapper"

----- Original Message -----
> >
> > 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.

Right, I understand, and since strpbrk() fits the bill perfectly for this
situation, that's where I going...



--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 

Thread Tools




All times are GMT. The time now is 08:05 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org