[Crash-utility] Question on prompt behavior

Hsin-Yi Wang hsinyi at chromium.org
Sat May 27 20:17:33 UTC 2023


hi crash-utility community,

When stdin is not a TTY, but all the other flags remain the same,
prompt ("crash> ") won't be displayed. An example use case is, the
stdin of crash is replaced by a piped fd connected to another process.

In process_command_line(), it checks if pc->flags does NOT have any of
the flag: READLINE|SILENT|CMDLINE_IFILE|RCHOME_IFILE|RCLOCAL_IFILE, a
prompt should be printed.

But in setup_environment(), pc->flags is set to have READLINE flag[2],
the above check will not be true at all.

Should READLINE be set for all cases in setup_environment()?
- If true, should the check in process_command_line() look for TTY
instead of READLINE? Since if pc->flags has TTY, [2] won't be true and
the prompt will be printed later in TTY's case[3].
- If false, where should be a proper place and conditions to set READLINE?

Or is the current behavior intended? I may not fully understand the
design logic. Any explanations are appreciated.

Thanks!

[1] https://github.com/crash-utility/crash/blob/05a3a328fcd8920e49926b6d1c9c81ce0b6acbca/cmdline.c#L67
[2] https://github.com/crash-utility/crash/blob/8246dce99dd23457e8c7a3fe9609c706694d1959/main.c#L1182
[3] https://github.com/crash-utility/crash/blob/05a3a328fcd8920e49926b6d1c9c81ce0b6acbca/cmdline.c#L120



More information about the Crash-utility mailing list