[Crash-utility] [PATCH v2] Output prompt when stdin is not a TTY

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Mon Jun 5 04:51:30 UTC 2023


On 2023/06/02 18:41, lijiang wrote:
> On Wed, May 31, 2023 at 2:07 PM <crash-utility-request at redhat.com> wrote:
> 
>> Date: Wed, 31 May 2023 14:01:36 +0800
>> From: Hsin-Yi Wang <hsinyi at chromium.org>
>> To: crash-utility at redhat.com,   k-hagio-ab at nec.com
>> Subject: [Crash-utility] [PATCH v2] Output prompt when stdin is not a
>>          TTY.
>> Message-ID: <20230531060349.711886-1-hsinyi at chromium.org>
>> Content-Type: text/plain; charset="US-ASCII"; x-default=true
>>
>> When stdin is not a TTY, prompt ("crash> ") won't be displayed. If
>> another process interact with crash with piped stdin/stdout, it will not
>> get the prompt as a delimiter.
>>
>> Compared to other debugger like gdb, crash seems intended to give a
>> prompt in this case in the beginning of process_command_line(). It
>> checks if pc->flags does NOT have any of
>> READLINE|SILENT|CMDLINE_IFILE|RCHOME_IFILE|RCLOCAL_IFILE, a
>> prompt should be printed. The check will never be true since READLINE is
>> set in setup_environment() unconditionally.
>>
>> It makes more sense to change the READLINE flag in the check to TTY
>> instead. Besides this change, the prompt in process_command_line() should
>> only be print when it's not in the middle of processing the input file
>> recovering from a previous FATAL command, because the prompt will be
>> displayed by the exec_input_file().
>>
>> Additionally, when stdin is not TTY, repeat the command line from user
>> after prompt, which can give more context.
>>
>> The prompt and command line can be opt out by using the silent (-s) flag.
>>
>>
> Thank you for the fix, Hsin-Yi.
> 
> For v2, I have no other issues, so: Ack.

Applied.  Let's see if no problem.
https://github.com/crash-utility/crash/commit/8527bbff71cbdfd90a67d5cec4a1d94156e6bf13

Thanks,
Kazu



More information about the Crash-utility mailing list