Page MenuHomeClusterLabs Projects

Don't assert on vfprintf() error at tool exit
Closed (Merged)Public

Assigned To
Authored By
kgaillot
Wed, Oct 2, 5:24 PM
Tags
  • Restricted Project
  • Restricted Project
  • Restricted Project
  • Restricted Project
  • Restricted Project
Referenced Files
None
Subscribers

Description

text_err() does:

len = vfprintf(stderr, format, ap);
pcmk__assert(len >= 0);

That shouldn't be an assertion, because it's reasonable for the caller of a command-line tool to have closed stderr (possibly because it died). Instead, we should just crm_err() the message if vfprintf() returns a negative result (which likely won't be seen either, but we might as well give some chance).

Reported seen in pcmk__output_and_clear_error() as a tool exits:

Event Timeline

kgaillot changed the task status from Open to WIP.Wed, Oct 2, 5:24 PM
kgaillot triaged this task as High priority.
kgaillot created this task.
kgaillot created this object with edit policy "Restricted Project (Project)".
kgaillot moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Wed, Oct 2, 5:27 PM

Easily reproducible from the source tree:

$ tools/crm_mon -1 2>&-
zsh: IOT instruction  tools/crm_mon -1 2>&-