From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ar5fs-0001cM-VE for qemu-devel@nongnu.org; Fri, 15 Apr 2016 11:28:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ar5fr-00018P-H5 for qemu-devel@nongnu.org; Fri, 15 Apr 2016 11:28:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ar5fr-00018L-BM for qemu-devel@nongnu.org; Fri, 15 Apr 2016 11:28:47 -0400 From: Markus Armbruster References: <1460131992-32278-1-git-send-email-eblake@redhat.com> <1460131992-32278-7-git-send-email-eblake@redhat.com> <87twj5jxxf.fsf@dusky.pond.sub.org> <570E7737.2040306@redhat.com> Date: Fri, 15 Apr 2016 17:28:44 +0200 In-Reply-To: <570E7737.2040306@redhat.com> (Eric Blake's message of "Wed, 13 Apr 2016 10:43:35 -0600") Message-ID: <87wpnynb6b.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v14 06/19] qmp-input: Don't consume input when checking has_member List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, Michael Roth Eric Blake writes: > On 04/13/2016 10:06 AM, Markus Armbruster wrote: >> Eric Blake writes: >> >>> Commit e8316d7 mistakenly passed consume=true >> >> in qmp_input_optional(), right? > > yes > >> >>> when checking if >>> an optional member was present, but the mistake was silently >>> ignored since the code happily let us extract a member more than >>> once. Tighten up the input visitor to ensure that a member is >>> consumed exactly once. > > [1] by fixing qmp_input_optional() to pass consume=false > >>> To keep the testsuite happy in the case >>> of incomplete input, we have to check whether a member exists >>> in the dictionary before trying to remove it. >> >> Sure this is only for the testsuite's benefit? > > The testsuite was the only client that failed under the tighter > semantics; but the better semantics allow later patches to further > improve the code while guaranteeing that clients remain sane. Do we know that non-testsuite code can't fail for some input? >> >> You fix commit e8316d7's incorrect consume=true, don't you? Recommend >> to mention that explicitly. > > I thought I did, but I can add wording [1] along those lines.