Skip to contentSkip to conversation

write-to-stdout failure not detected

DISCUSSION Jim Meyering 2 participants 2 messages Aug 6, 2007

lore
Share & tools
lore
#0 lore raw

Last week I spotted a problem with all LVM stdout-writing tools: e.g., vgs > /dev/full mistakenly exits successfully (should exit nonzero with a diagnostic reflecting the write that fails with ENOSPC). Unfortunately, it's not easy to fix. The offending unchecked "fflush" is buried in a "void" function (in lib/log/log.c), so fixing it properly would require interface changes.

On one hand, there are probably scripts out there that write lvm-related output to a file, and then read the file, parsing the result, so it'd be good to fix this. Currently, when writing to a full disk or getting an I/O error, lvm tools will simply produce empty or corrupted output and exit successfully, so there's no way for a script to detect the failure.

On the other hand, failure is pretty unlikely (ENOSPC and EIO are the usual culprits), so it may not be worth much effort. But since this is LVM, the cost of failure may be quite high...

#1 lore raw
Quoted 2 lines · Jim Meyering

Last week I spotted a problem with all LVM stdout-writing tools: e.g., vgs > /dev/full mistakenly exits successfully (should exit nonzero

Needs some thought - and probably needs to be customisable - stdout from 'pvs' vs. nice-to-have log file etc.

Alasdair

Signature · 1 line
agk at redhat.com