Bug 758432

Summary: Allow me to pipe in input to crash specific commands
Product: [Fedora] Fedora Reporter: Josef Bacik <jbacik>
Component: crashAssignee: Dave Anderson <anderson>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: anderson
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: crash-6.0.2-1.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-01-15 20:04:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Josef Bacik 2011-11-29 19:26:12 UTC
I do a lot of file system related vmcore analysis, which means that I sometimes do things like want to walk the entire list of buffers in a transaction and get specific info out of all of them because I'm looking for one particular attribute.  This leads me to do stuff like this in a recent case

crash> list journal_head.b_tnext 0xffff810095780370 -s journal_head.b_bh | grep b_bh | awk '{ print $3 }' > buffers.txt

and then in bash do

for i in $(cat buffers.txt); do echo "struct buffer_head.b_private $i" >> cmd.txt; done

and then back in crash do

crash> < cmd.txt

and so on and so on.  It would be nice if I could just do

struct buffer_head.b_private < buffers.txt

or something similar and not have to create a different file to get the right commands.

Comment 1 Dave Anderson 2011-11-29 19:54:01 UTC
> or something similar and not have to create a different file to get the right
> commands.

Yeah, I understand...

Although I would just vi the buffers.txt file and enter:

:1,$s/^/struct buffer_head.b_private /

Anyway, using the suggested "<" input construct would be extremely
difficult to implement given that "<" is already a pseudo-command.

I'm thinking maybe something like this could be do-able:

 $ struct buffer_head.b_private --args buffers.txt

where for each line in buffers.txt, an instance of the struct command
would be kicked off with the arguments in the line. 

Would that be acceptable?

Comment 2 Josef Bacik 2011-11-29 20:08:13 UTC
Yup that works.  I usually do vi, but in this case buffers.txt is like 100meg, so it's kind of an extreme case but it happens more often than I like.  Thanks.

Comment 3 Dave Anderson 2011-11-29 20:23:59 UTC
OK good, lemme look into it.

And you're right -- what I've found myself doing is creating an input file
such as in your example, but then wanting to dump two members, or maybe a
different member entirely, and so on.  Instead of having to edit the
file each time, it would be kind of nice to leave the address-list file
alone, and just have to adjust the command line.

Comment 4 Dave Anderson 2012-01-04 19:45:47 UTC
> I'm thinking maybe something like this could be do-able:
>
>  $ struct buffer_head.b_private --args buffers.txt
>
> where for each line in buffers.txt, an instance of the struct command
> would be kicked off with the arguments in the line. 
>
> Would that be acceptable?

As it turns out, your original suggestion was a much better idea:

 Information for build crash-6.0.2-1.fc17
 http://koji.fedoraproject.org/koji/buildinfo?buildID=281105

Details here in the upstream changelog:

 http://people.redhat.com/anderson/crash.changelog.html#6_0_2

And thanks again for coming up with this suggestion -- it's really
a pretty nifty addition...

Comment 5 Fedora Update System 2012-01-04 20:19:46 UTC
crash-6.0.2-1.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/crash-6.0.2-1.fc16

Comment 6 Fedora Update System 2012-01-05 20:55:53 UTC
crash-6.0.2-1.fc16 has been pushed to the Fedora 16 testing repository.

Comment 7 Fedora Update System 2012-01-15 20:04:38 UTC
crash-6.0.2-1.fc16 has been pushed to the Fedora 16 stable repository.