[Crash-utility] bug in cmdline.c

Bruce Korb bruce.korb at gmail.com
Thu Feb 16 18:08:20 UTC 2012


$ cat > test-in <<_EOF_
+ mod | cat > test-out
+ _EOF_
$ crash [....]
crash> < test-in
crash> quit
$ cat test-out
crash> mod | cat > test-out
     MODULE       NAME            SIZE  OBJECT FILE
[....]

That first line does not belong in "test-out".
It is very noticeable if "cat" were trying to parse the "mod" output.
WRT printf, you can always add another global:   trace_fp
and let that one be the fp for writing trace logs.  But it should
always be stdout.  (Well, "stderr", actually, but you are already
printing your command traces to stdout.)

On Thu, Feb 16, 2012 at 7:59 AM, Dave Anderson <anderson at redhat.com> wrote:
>
> I'm not sure I agree...
>
>> $ diff -u *~ cmdline.c
>> --- cmdline.c~  2012-02-03 11:22:33.000000000 -0800
>> +++ cmdline.c   2012-02-15 16:51:07.209524248 -0800
>> @@ -1372,10 +1372,8 @@
>>                  if (!(argcnt = parse_line(pc->command_line, args)))
>>                          continue;
>>
>> -                if (!(pc->flags & SILENT)) {
>> -                        fprintf(fp, "%s%s", pc->prompt, buf);
>> -                        fflush(fp);
>> -                }
>> +                if (!(pc->flags & SILENT))
>> +                        printf("%s%s", pc->prompt, buf);
>>
>>                   exec_command();
>>           }
>
> Can you show an example of the problem that you're trying
> to handle?
>
> Also, printf() is never used by the crash utility. (well, except
> by some dead va_server.c code, some dead remote.c debug code,
> and a couple places in s390dbf.c which I don't control...)
>
> Dave




More information about the Crash-utility mailing list