From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id DB8D01F4B4 for ; Wed, 9 Sep 2020 19:58:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729779AbgIIT6F (ORCPT ); Wed, 9 Sep 2020 15:58:05 -0400 Received: from cloud.peff.net ([104.130.231.41]:52600 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726801AbgIIT6E (ORCPT ); Wed, 9 Sep 2020 15:58:04 -0400 Received: (qmail 7230 invoked by uid 109); 9 Sep 2020 19:58:04 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Wed, 09 Sep 2020 19:58:04 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 5178 invoked by uid 111); 9 Sep 2020 19:58:04 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Wed, 09 Sep 2020 15:58:04 -0400 Authentication-Results: peff.net; auth=none Date: Wed, 9 Sep 2020 15:58:03 -0400 From: Jeff King To: =?utf-8?B?UmVuw6k=?= Scharfe Cc: Edmundo Carmona Antoranz , Derrick Stolee , whydoubt@gmail.com, Git List Subject: Re: [PATCH] blame.c: replace instance of !oidcmp for oideq Message-ID: <20200909195803.GA2515827@coredump.intra.peff.net> References: <20200907171639.766547-1-eantoranz@gmail.com> <20200909091149.GB2496536@coredump.intra.peff.net> <20200909191345.GA2511547@coredump.intra.peff.net> <20200909191746.GA2514794@coredump.intra.peff.net> <0773b560-b456-fc88-42d7-f214246ddd1b@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0773b560-b456-fc88-42d7-f214246ddd1b@web.de> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Wed, Sep 09, 2020 at 09:54:55PM +0200, René Scharfe wrote: > > diff -u -p a/packfile.c b/packfile.c > > --- a/packfile.c > > +++ b/packfile.c > > @@ -735,7 +735,7 @@ struct packed_git *add_packed_git(const > > p->mtime = st.st_mtime; > > if (path_len < the_hash_algo->hexsz || > > get_sha1_hex(path + path_len - the_hash_algo->hexsz, p->hash)) > > - hashclr(p->hash); > > + oidclr(p); > > return p; > > } > > > > > > Maybe it's worth being looser in our cocci patch definitions. I'm having > > trouble thinking of a downside... > > For transformations that change the type as in the example above we > should insist on getting the right one, otherwise we might introduce > bugs -- like in the example above. p points to a struct packed_git and > not to a struct object_id, so this introduces a type mismatch. Heh. You'd think that I would have applied that patch and run "make". Or even read it carefully. Thanks for pointing that out. I guess now we have a real example of a downside (the compiler _would_ still catch it, but it means "make coccicheck" is useless if it's repeatedly suggesting a bad transformation). -Peff