]> sourceware.org Git - lvm2.git/commit
libdm: report: fix invalid JSON if using DM_REPORT_OUTPUT_MULTIPLE_TIMES and selection 1046171620
authorPeter Rajnoha <prajnoha@redhat.com>
Mon, 23 Oct 2023 11:56:55 +0000 (13:56 +0200)
committerPeter Rajnoha <prajnoha@redhat.com>
Mon, 23 Oct 2023 12:18:21 +0000 (14:18 +0200)
commitc36e0129267befe90a4116f1d9c5d92fac0128fa
tree0582e46f3163369197c18a35555a79bcf0c0c2b2
parentd019c41f7aa6676842bff4cafc1e47e6905d31fc
libdm: report: fix invalid JSON if using DM_REPORT_OUTPUT_MULTIPLE_TIMES and selection

When reporting in JSON format, we need to be able to find the 'last
displayed row', not just 'last row' as we did before. This is used
to decide whether to put the JSON_SEPARATOR (the ',' character)
between the lines when reporting in JSON format.

This is mainly important in case we use a combination of JSON format
and a report marked with DM_REPORT_OUTPUT_MULTIPLE_TIMES flag.
Such report may be reused several times with different selection
criteria each time. In that case, the report always contains all lines
in memory, even though some of them do not need to pass the selection
criteria that are currently used.

Without DM_REPORT_OUTPUT_MULTIPLE_TIMES flag, the report only contains
the lines that have passed the selection criteria, so the this wasn't
an issue in this case.

Fix suggested by Lars Ellenberg and reported here: https://github.com/lvmteam/lvm2/issues/130
WHATS_NEW_DM
device_mapper/libdm-report.c
libdm/libdm-report.c
This page took 0.035564 seconds and 5 git commands to generate.