Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2649131pxb; Fri, 8 Oct 2021 12:02:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+tcWvZv6F/LZl6ysvK7tPGuh0x7DRdmvnAajARXZFBZo6DbTLcFDISwo6vVI2dpKeQkuU X-Received: by 2002:a63:a80c:: with SMTP id o12mr6108616pgf.422.1633719763792; Fri, 08 Oct 2021 12:02:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633719763; cv=none; d=google.com; s=arc-20160816; b=NYcCqdJQAUp6CYY+p+m2nKXjcs8VrrBmC2BbJ6G+g8aA5jztPUJ5amQKgOZb2jEtyN 6xakck0G5IAv6yIFAR9GbS+h5UZu9uqXzQt5v5wm+NV2uGchTnDYutuTu4KYZYW7avRa 8oX9TLjwteQVVpzTX1MFEYGOL5Y2f6orjtFRR81J0ZH1UXPG/9zC8OZAwdudNpVtx4P3 f0/FAiHX28zDGVvmXI/ihACNL+7VQk2I6VVzwaNaPa2N3hDQT1Z6GzRKBn7tdGMkaiS4 pzqhQD7GuROesPzltOPSGbjNrkHo+K0LoIQcvhJSs3w2SqRnvsP+iuTtw8YiuDQ4gmb+ j4Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=33WJXbss0dZbynFOspxV+7bQ/85miDnDBCHFHnnRj1E=; b=seZa+lcWZfnUEB+TAextK5QpAPdb1FMrxrGQNqbqxMDhuTc2GkQvVoF2tN3+bu1KDl dkB98ljiaF5CNaGdWNOQUWqkJ/4hWocDwIL4DpV4QtrAaO2Dne/Fbv2WZUL/5WFvUxxU 0GydzR9TrrquY5ocC5YX/wKx4qt3DyvS5KULw+EF9wI7KnR0NN3XrxhN+5nPrDgUFJFn 4nQ+iqrUvJMIX9WNo3sVHam7qpSZRP96N0sqanaD7+owRlTk4nJI02gb5D/Af9oOS67n vXcoFpPVYhiY2yXXehmblBMukei5Nhe7EhJDecrwPLiL2wALe7TjJatdYK9nmJekv/Id DDrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UIYry73e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r2si86631pga.96.2021.10.08.12.02.30; Fri, 08 Oct 2021 12:02:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UIYry73e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240180AbhJHTDI (ORCPT + 99 others); Fri, 8 Oct 2021 15:03:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:46346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231312AbhJHTDG (ORCPT ); Fri, 8 Oct 2021 15:03:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0C74B60F38; Fri, 8 Oct 2021 19:01:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633719671; bh=v0J0hrryQl9l8zn56qmUobmgZDPPAhWnEmX3U/IK40E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UIYry73eJ/dteuVV0PWU5rwIxpgOnSHEHPT6SrXdgt0yDzv+UQCSkzenSaw38//p6 taa94lwmP4NK0kOZPiHaJdn+b30iKAgVzNVWp/Z0O3tnn/qKb29p7JPsvRCHy7JiPA it1PcXxZnJ2F8rppevd3VTy1Omh19tn3FTHpuo/6LDi/BVEJRWPVAg56ZHH//d/cHC 5lW69Hn5skPcCOG2ESGunx8Rv0TEwKV6gvrK4urrtT6bAS8RiDyMDwwyQQKPJXCf15 jhtlJ0xZUzrToPVe0AUE9z+/04xBNHp9gfOok2joY/2T1ES1gEsGmu6Nh/YoTakt+M LFgxLHmzodAfg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 90346410A1; Fri, 8 Oct 2021 16:01:08 -0300 (-03) Date: Fri, 8 Oct 2021 16:01:08 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: James Clark , john.garry@huawei.com, ak@linux.intel.com, linux-perf-users@vger.kernel.org, Nick.Forrington@arm.com, Andrew.Kilroy@arm.com, Will Deacon , Mathieu Poirier , Leo Yan , Mark Rutland , Alexander Shishkin , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] perf tools: Make the JSON parser more conformant when in strict mode Message-ID: References: <20211007110543.564963-1-james.clark@arm.com> <20211007110543.564963-3-james.clark@arm.com> <2e14963b-cb98-f508-7067-255fdbd36bdb@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, Oct 08, 2021 at 03:56:26PM -0300, Arnaldo Carvalho de Melo escreveu: > Em Fri, Oct 08, 2021 at 03:12:03PM +0200, Jiri Olsa escreveu: > > On Fri, Oct 08, 2021 at 11:08:25AM +0100, James Clark wrote: > > > > > > > > > On 07/10/2021 18:52, Jiri Olsa wrote: > > > > On Thu, Oct 07, 2021 at 12:05:41PM +0100, James Clark wrote: > > > >> Return an error when a trailing comma is found or a new item is > > > >> encountered before a comma or an opening brace. This ensures that the > > > >> perf json files conform more closely to the spec at https://www.json.org > > > >> > > > >> Signed-off-by: James Clark > > > >> --- > > > >> tools/perf/pmu-events/jsmn.c | 42 ++++++++++++++++++++++++++++++++++-- > > > >> 1 file changed, 40 insertions(+), 2 deletions(-) > > > >> > > > >> diff --git a/tools/perf/pmu-events/jsmn.c b/tools/perf/pmu-events/jsmn.c > > > >> index 11d1fa18bfa5..8124d2d3ff0c 100644 > > > >> --- a/tools/perf/pmu-events/jsmn.c > > > >> +++ b/tools/perf/pmu-events/jsmn.c > > > >> @@ -176,6 +176,14 @@ jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, size_t len, > > > >> jsmnerr_t r; > > > >> int i; > > > >> jsmntok_t *token; > > > >> +#ifdef JSMN_STRICT > > > > > > > > I might have missed some discussion on this, but do we need the > > > > JSMN_STRICT define, if you enable it in the next patch? > > > > why can't we be more strict by default.. do you plan to disable > > > > it in future? > > > > > > I didn't plan on disabling it, I was just trying to keep to the existing style of the > > > jsmn project. > > > > > > I could have added the trailing comma detection by default and not inside any > > > #ifdef JSMN_STRICT blocks, but I would like to enable JSMN_STRICT anyway, because it > > > enables some additional built in checking that was already there. So I thought it > > > made sense to put my new strict stuff inside the existing strict option. > > > > > > One option would be to remove all (including the existing) #ifdef JSMN_STRICT blocks > > > and have everything strict by default. But it would be a further deviation from jsmn. > > > > ok, I think it makes sense to have JSMN_STRICT then.. > > thanks for explanation > > > > Acked-by: Jiri Olsa > > So, is this for the whole patchset? b4 picked it just for this message. Got it from IRC, thanks, - Arnaldo