Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp347770ybk; Wed, 20 May 2020 00:55:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIMZRWZlkpZw8FX2+I7UOKcCEQAiFpT31cXNThG/kOlB+hsah5uE9rDIJNFniANLPV2pjx X-Received: by 2002:a50:d715:: with SMTP id t21mr2200181edi.194.1589961334200; Wed, 20 May 2020 00:55:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589961334; cv=none; d=google.com; s=arc-20160816; b=ubfB7QGXq6j6GbIZMTDd3kjWqysYt5NjIVDiWJyoB85bZbDNa10VaX7U1j0TrQNKF9 Hu4EVZk40wBRt5sUNn5tG51ynnzpeyDYYhgjpAiIUEalzxHamFxdgNWg8nRAmRLHxS5J Gb3dLjyNhoj5sAH5U+I8gbjHrE3D+EUEksqc0MJ6DfcR9jpeAnTBJJmrDoQlY8CrKdAu Ahh/KO1xoyIFsRzkCgDvkoYgayfaMaIxsaZLv9o2Z1Vig6/Ely3H3mayI3Qv+8t7QSLR bIMZAjcQamN8SfVFft4hbed3DsZJvZTGl/eXAzj3CamPCzfT758oJTmY7WGku3Zn+AY0 UD9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ms3aI/Ojt3aIz9YtHAH0CURmofegVxafgWmwlFS7hp4=; b=GtEuZtNJJ053/07u6lSQN6pebQBbN80Dbdnhgoe1tphcKUgxBlneyxFPpFjXyuwbQU bscDY+bAO6gRZFyXw4i/pamX6PVnu8fiiRBB+cIAIq1R8WdZniCC6UM9AYG8QkffOC28 vEATko8ZijtHIvTsfK7d3ny2vDEsJMeEhscRk0v9Uw+jdIAKcrdDF4Com6oMvYbMHfKw S8T4pNogE4e+bIX8Le8JUsazQhGJpzwz2LMzR0sDd4gJNMNjtqPlgRaUrvDYEfufe5ZE hdfMpDDAn5fd/dkUp2jcPZ8OWSn0zEGRruL9X3cAWsAD0FdUuTqrTrGGrBKJLMABJmjE MokQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="BpqLqZ/J"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jr11si538822ejb.602.2020.05.20.00.55.11; Wed, 20 May 2020 00:55:34 -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=@google.com header.s=20161025 header.b="BpqLqZ/J"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726691AbgETHvh (ORCPT + 99 others); Wed, 20 May 2020 03:51:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726403AbgETHvg (ORCPT ); Wed, 20 May 2020 03:51:36 -0400 Received: from mail-yb1-xb41.google.com (mail-yb1-xb41.google.com [IPv6:2607:f8b0:4864:20::b41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1963BC061A0E for ; Wed, 20 May 2020 00:51:36 -0700 (PDT) Received: by mail-yb1-xb41.google.com with SMTP id 67so480322ybn.11 for ; Wed, 20 May 2020 00:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ms3aI/Ojt3aIz9YtHAH0CURmofegVxafgWmwlFS7hp4=; b=BpqLqZ/JEZCTbUqN7bGO5U/U5s0UtJjQ2D28oGz4gezSupEDNyovta/R0dtLlpnDI5 dWBugc/yi4ltPuQscJt+ptTX+o4kcuBd57C7TOQVlKZxnk11jFY8FUVQ3s0YcfjIF9KN +TNtAudXmymMFhx6GZXlDQ29e/xkd8WsP6P+V7BbCKwK83IDcCWhjFGio1sOXTBLo33p DLE2kyT8Lymr34ziHZqmpp00Jy7psuYq8gpBfQvjlpaMUSIG0gTo6iyE2L4QTUtWm9yC gYX5wyXb6QogoipfllZOArxj5YYYCqx96aMgfVrQfMBcYXbTW2WMWfo4YZl452czLPUu MVNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ms3aI/Ojt3aIz9YtHAH0CURmofegVxafgWmwlFS7hp4=; b=aQK328CLUxZtM8FIY+mO2RFVOaXmfgDQhyRv+YGiQUdGoCewOYZROoc8a1s90IQpy6 0y+PU2/IN5slKdFgh+2p1EXRQjWpC4yW74Q4HGUiAmaIyj5Hoe3JbNlmgV9yWgak3ATp l6RbvZKuYYhf6SBiyDSJblmGE2Bdc8HiOaHbjzLQ1Gdi2wWYf/nrXttDIxfdJpLXIP2p NXzOg/AYz5J2uvk9T80+XO8nz2LWVlL4lKwqUN6dBeMaRDeBitHpvvVWIQWKPCJzGdf0 GPHAg8JlCjWM/WQ2PyEs90lTmBTKsztBKoivy6neTrIDKXrzRR53WGvO0jyk67WPL7kD x73A== X-Gm-Message-State: AOAM530EhUUvyb1MfK//cmi7pmVwOOV7e1qnrfhwoXRgpo/JWO93KZAc IM7gKf4T/gJ9RFqyR9ukHWkehOjw95msvNxXyhVxuQ== X-Received: by 2002:a25:d450:: with SMTP id m77mr5143898ybf.177.1589961094983; Wed, 20 May 2020 00:51:34 -0700 (PDT) MIME-Version: 1.0 References: <20200520074050.156988-1-jolsa@kernel.org> In-Reply-To: <20200520074050.156988-1-jolsa@kernel.org> From: Ian Rogers Date: Wed, 20 May 2020 00:51:24 -0700 Message-ID: Subject: Re: [PATCH] perf stat: Fail on extra comma while parsing events To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 20, 2020 at 12:41 AM Jiri Olsa wrote: > > Ian reported that we allow to parse following: > > $ perf stat -e ,cycles true > > which is wrong and we should fail, like we do with this fix: > > $ perf stat -e ,cycles true > event syntax error: ',cycles' > \___ parser error > > The reason is that we don't have rule for ',' in 'event' > start condition and it's matched and accepted by default > rule. > > Adding scanner debug support (that Ian already added for > expr code), which was really useful for finding this. It's > enabled together with bison debug via 'make PARSER_DEBUG=1'. > > Reported-by: Ian Rogers > Signed-off-by: Jiri Olsa Acked-by: Ian Rogers Thanks! Ian Ian > --- > tools/perf/util/parse-events.c | 1 + > tools/perf/util/parse-events.l | 4 +++- > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c > index e37a6a3e6217..d251c8a778b8 100644 > --- a/tools/perf/util/parse-events.c > +++ b/tools/perf/util/parse-events.c > @@ -2014,6 +2014,7 @@ static int parse_events__scanner(const char *str, void *parse_state, int start_t > > #ifdef PARSER_DEBUG > parse_events_debug = 1; > + parse_events_set_debug(1, scanner); > #endif > ret = parse_events_parse(parse_state, scanner); > > diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l > index c589fc42f058..394132254447 100644 > --- a/tools/perf/util/parse-events.l > +++ b/tools/perf/util/parse-events.l > @@ -252,7 +252,9 @@ modifier_bp [rwx]{1,3} > BEGIN(INITIAL); > REWIND(0); > } > - > +, { > + return ','; > + } > } > > { > -- > 2.25.4 >