qemu-io: Exit with error when a command failed
Status from this message: Applied to my block branch.
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest5 patches 1 replyApplied
- v15 patches 6 repliesSuperseded
Changes in v2 from the cover letter
- Patch 2: Added a comment on the interface of command functions (their parameters and their return value) [Eric]
- (Decided against replacing 0/1 by EXIT_SUCCESS/EXIT_FAILURE, because although I personally would prefer them slightly, neither are ever used in qemu-io so far.)
Patches in v2 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | qemu-io: Drop command functions' return valuesinclude/ qemu-io-cmds.c qemu-io.c | +157 | 0 replies | |
| 2/5 | qemu-io: Let command functions return error codeinclude/ qemu-io-cmds.c qemu-io.c | +232 | 0 replies | |
| 3/5 | qemu-io: Exit with error when a command failedqemu-io.c | +22 | 0 replies | |
| 4/5 | iotests.py: Add qemu_io_silenttests/ | +9 | 0 replies | |
| 5/5 | iotests: Let 216 make use of qemu-io's exit codetests/ tests/ | +14 | 0 replies |
Reviews trailers per patch
All 5 patches have a Reviewed-by or Acked-by.
| Patch | Eric Blake |
|---|---|
| 1/5 | R-b |
| 2/5 | R-b |
| 3/5 | R-b |
| 4/5 | R-b |
| 5/5 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [Qemu-devel] [PATCH v2 0/5] qemu-io: Exit with error when a command failed
Right now, qemu-io's exit code is rather useless as it is usually 0. Except sometimes, then it's 1 in case of an error (mostly when you specify a filename as an argument and it cannot open that).
At the same time, most command functions' return values are rather useless as they are usually 0 (meaning "continue execution"). There is only a single function that breaks that pattern, which is "quit". On one hand, this is pointless because "quit" is in qemu-io.c, so it can easily signal that fact through a global (yet static) variable. On the other, it breaks the usual pattern of I/O functions returning error codes.
This series resolves the overlap between both issues by making the command functions' return error values instead of whether to continue execution or not, and thus makes qemu-io return 1 if any of the commands executed has failed and 0 only if all of them have succeeded.
Patch 5 showcases how that may be useful for iotests.
See also: https://bugzilla.redhat.com/show_bug.cgi?id=1519617
v2:
- Patch 2: Added a comment on the interface of command functions (their parameters and their return value) [Eric]
- (Decided against replacing 0/1 by EXIT_SUCCESS/EXIT_FAILURE, because although I personally would prefer them slightly, neither are ever used in qemu-io so far.)
git-backport-diff against v1:
Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch [down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively
001/5:[----] [-C] 'qemu-io: Drop command functions' return values' 002/5:[0005] [FC] 'qemu-io: Let command functions return error code' 003/5:[----] [--] 'qemu-io: Exit with error when a command failed' 004/5:[----] [--] 'iotests.py: Add qemu_io_silent' 005/5:[----] [-C] 'iotests: Let 216 make use of qemu-io's exit code'
Max Reitz (5):
qemu-io: Drop command functions' return values
qemu-io: Let command functions return error code
qemu-io: Exit with error when a command failed iotests.py: Add qemu_io_silent
iotests: Let 216 make use of qemu-io's exit code
include/qemu-io.h | 9 +- qemu-io-cmds.c | 276 ++++++++++++++++++++++++------------------ qemu-io.c | 62 +++++++--- tests/qemu-iotests/216 | 23 ++-- tests/qemu-iotests/216.out | 17 +-- tests/qemu-iotests/iotests.py | 9 ++ 6 files changed, 231 insertions(+), 165 deletions(-)
Signature · 1 line
2.14.3