Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-2.8 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id CE74D1F404 for ; Fri, 2 Feb 2018 18:50:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752890AbeBBSuB (ORCPT ); Fri, 2 Feb 2018 13:50:01 -0500 Received: from mout.web.de ([212.227.15.3]:56387 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752388AbeBBSt7 (ORCPT ); Fri, 2 Feb 2018 13:49:59 -0500 Received: from [192.168.178.36] ([91.20.50.7]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lj2Cs-1fIP4Z1a06-00dJTq; Fri, 02 Feb 2018 19:49:53 +0100 Subject: Re: [PATCH] cocci: simplify check for trivial format strings To: =?UTF-8?Q?SZEDER_G=c3=a1bor?= Cc: Git List , Junio C Hamano , Lars Schneider References: <376eb2e8-0a95-233b-743b-cdc1caa49015@web.de> From: =?UTF-8?Q?Ren=c3=a9_Scharfe?= Message-ID: <0df36d0a-6066-05c4-d471-f25a76ce301c@web.de> Date: Fri, 2 Feb 2018 19:49:51 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:ygIWcaPfLNb3mdEDsC8mIhC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qLXnIaKn5gtWH97xri7M1cosSM1weZIz7I= Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Am 02.02.2018 um 15:34 schrieb SZEDER Gábor: > On Thu, Feb 1, 2018 at 7:56 PM, René Scharfe wrote: >> 353d84c537 (coccicheck: make transformation for strbuf_addf(sb, "...") >> more precise) added a check to avoid transforming calls with format >> strings which contain percent signs, as that would change the result. >> It uses embedded Python code for that. Simplify this rule by using the >> regular expression matching operator instead. >> >> Signed-off-by: Rene Scharfe >> --- >> Inspired by the Coccinelle package in Debian experimental, which lost >> support for Python for some reason. Tested only with that version >> (1.0.6.deb-3) and Debian testing's 1.0.4.deb-3+b3. > > FWIW, it appears to be working fine with Coccinelle version > 1.0.0~rc19.deb-3 running on Travis CI. > Applied it on top of 'rs/strbuf-cocci-workaround' currently at cd9a4b6d9 > (cocci: use format keyword instead of a literal string, 2018-01-19) > along with an other patch to show the resulting suggestions in > '.../*.cocci.patch' files, and the results look fine: > > https://travis-ci.org/szeder/git/jobs/336573242#L1466 > > and are the same as without this patch: > > https://travis-ci.org/szeder/git/jobs/336257153#L1466 It's good to hear that it doesn't error out, but there is no code in master that would trigger a good or bad transformation. It should propose a patch for calls like this: strbuf_addf(sb, "just a string, better use strbuf_addstr"); ... but leave those examples here alone: strbuf_addf(sb, "200%% more percent signs"); strbuf_addf(sb, "error: %m"); René