From patchwork Sat Aug 17 21:51:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mischa POSLAWSKY X-Patchwork-Id: 11099317 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B5E9214DB for ; Sat, 17 Aug 2019 21:51:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99F9A2842D for ; Sat, 17 Aug 2019 21:51:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87CE028862; Sat, 17 Aug 2019 21:51:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5AF02842D for ; Sat, 17 Aug 2019 21:51:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726397AbfHQVvK (ORCPT ); Sat, 17 Aug 2019 17:51:10 -0400 Received: from lb2-smtp-cloud9.xs4all.net ([194.109.24.26]:34133 "EHLO lb2-smtp-cloud9.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbfHQVvK (ORCPT ); Sat, 17 Aug 2019 17:51:10 -0400 Received: from xeops.shiar.net ([83.161.198.138]) by smtp-cloud9.xs4all.net with ESMTP id z6bLh9HtCzaKOz6bMhoPMV; Sat, 17 Aug 2019 23:51:08 +0200 Received: by xeops.shiar.net (Postfix, from userid 1000) id 64E4A6E649E; Sat, 17 Aug 2019 23:51:07 +0200 (CEST) From: Mischa POSLAWSKY To: git@vger.kernel.org, =?utf-8?b?0J7Qu9GPINCi0LXQu9C10LbQvdCw0Y8=?= Cc: Junio C Hamano Subject: [PATCH] ref-filter: initialize empty name or email fields Date: Sat, 17 Aug 2019 23:51:07 +0200 Message-Id: <20190817215107.13733-1-git@shiar.nl> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-CMAE-Envelope: MS4wfOsj5bC0mvljmMnYntuSzfj7+Gk0HNiiXYnS10kNMcce1AKHfwGqFowHmEVrTg5C/LfnBHkg2XSTNGrRx1k8f3yFxAsm4kU2zk6ysFsU8OFTi8THOG2a 3rjDpHpeI2v4iS4e6xbElvis2RZVyD/xbWnrHWepGWhqXgR4W26JpfgHcxBcx8lpLOKlwBc4gtEzQes3/L0Ei+fQ+BGgQpOkgjY8ZUeDwGAjfD7HEKps3JPT pvrazmC2c/VEPvxgKc+nbyG1OZ2GgFdzbCr2/VG+q4k= Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Formatting $(taggername) on headerless tags such as v0.99 in Git causes a SIGABRT with error "munmap_chunk(): invalid pointer", because of an oversight in commit f0062d3b74 (ref-filter: free item->value and item->value->s, 2018-10-19). Signed-off-by: Mischa POSLAWSKY --- If I understand correctly, such tags cannot be produced normally anymore. Therefore I'm unsure how to make tests, and if that is even warranted. ref-filter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ref-filter.c b/ref-filter.c index f27cfc8c3e..7338cfc671 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -1028,7 +1028,7 @@ static const char *copy_name(const char *buf) if (!strncmp(cp, " <", 2)) return xmemdupz(buf, cp - buf); } - return ""; + return xstrdup(""); } static const char *copy_email(const char *buf) @@ -1036,10 +1036,10 @@ static const char *copy_email(const char *buf) const char *email = strchr(buf, '<'); const char *eoemail; if (!email) - return ""; + return xstrdup(""); eoemail = strchr(email, '>'); if (!eoemail) - return ""; + return xstrdup(""); return xmemdupz(email, eoemail + 1 - email); } From patchwork Thu Aug 22 13:55:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mischa POSLAWSKY X-Patchwork-Id: 11109343 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C7C914DB for ; Thu, 22 Aug 2019 13:55:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 54408233FC for ; Thu, 22 Aug 2019 13:55:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731811AbfHVNzc (ORCPT ); Thu, 22 Aug 2019 09:55:32 -0400 Received: from lb2-smtp-cloud8.xs4all.net ([194.109.24.25]:41063 "EHLO lb2-smtp-cloud8.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726687AbfHVNzc (ORCPT ); Thu, 22 Aug 2019 09:55:32 -0400 Received: from tri.shiar.net ([83.161.198.138]) by smtp-cloud8.xs4all.net with ESMTP id 0nYmiiD1jDqPe0nYni1iBp; Thu, 22 Aug 2019 15:55:29 +0200 Received: by tri.shiar.net (Postfix, from userid 1000) id B724229735B; Thu, 22 Aug 2019 15:55:28 +0200 (CEST) Date: Thu, 22 Aug 2019 15:55:28 +0200 From: Mischa POSLAWSKY To: Junio C Hamano Cc: git@vger.kernel.org, =?utf-8?b?0J7Qu9GPINCi0LXQu9C10LbQvdCw0Y8=?= Subject: [PATCH 2/1] t6300: format missing tagger Message-ID: <20190822135528.GB28725@shiar.net> References: <20190817215107.13733-1-git@shiar.nl> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt 1.10.1 + Vim 8.1 (Debian 10.0 GNU/Linux 4.9.0-6-amd64) X-URL: http://shiar.nl/ X-Accept-Language: nl, eo, en X-CMAE-Envelope: MS4wfC6WzFXU0s83JgwEIbicNnvysIjutz41PPPsfCgSjwggfjL2vMedUYyzOqMiG8gBhDDkX8YJwlgGsIfqSxHVDwbBFovPCK/Ql24jHzS/z93+okCgQtSl hK2ymyEoFXR9X3C91VQZHhEAVe5bIdI+q6B5HTgyd+7BHM+3bZ7XbIb06BB8vcMOZI8Nt6lcNPVkeyaRdP2FwjOENTN1oKXw9zdYhhJ9LwRrm+QkPaW7Ox0/ Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Junio wrote: > Junio C Hamano writes: > > > Mischa POSLAWSKY writes: > > > >> If I understand correctly, such tags cannot be produced normally anymore. > >> Therefore I'm unsure how to make tests, and if that is even warranted. > > > > Thanks for spotting. > > A quick trial to recreate a tag object seems to succeed: > > $ git cat-file tag v0.99 | > > sed -e '/-----BEGIN/,$d' | > > git hash-object --stdin -w -t tag > 667d141b478eee5e53d2ee05acd61bb1f640249a > $ git cat-file tag 667d141b47 > object a3eb250f996bf5e12376ec88622c4ccaabf20ea8 > type commit > tag v0.99 > > Test-release for wider distribution. > > I'll make the first public RPM's etc, thus the tag. > > So we should be able to do something along the above line. Here is > my quick-n-dirty one. > > t/t6300-for-each-ref.sh | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh > index ab69aa176d..b3a6b336fa 100755 > --- a/t/t6300-for-each-ref.sh > +++ b/t/t6300-for-each-ref.sh > @@ -869,4 +869,16 @@ test_expect_success 'for-each-ref --ignore-case ignores case' ' > test_cmp expect actual > ' > > +test_expect_success 'show a taggerless tag' ' > + test_commit tagged && > + git tag -a -m "a normal tag" to-be-shown-0 HEAD && > + another=$(git cat-file tag to-be-shown-0 | > + sed -e "/^tagger /d" \ > + -e "/^tag to-be-shown/s/0/1/" \ > + -e "s/a normal tag/a broken tag/" | > + git hash-object --stdin -w -t tag) && > + git tag to-be-shown-1 $another && > + git for-each-ref --format="%(refname:short) %(taggername)" refs/tags/to-be-shown\* > +' > + > test_done > Alright, thanks for the pointer. Here's a batch of tests on all pertaining atoms. -- >8 -- Strip an annotated tag of its tagger header and verify it's ignored correctly in all cases, as fixed in commit e2a81276e8 (ref-filter: initialize empty name or email fields, 2019-08-19). Signed-off-by: Mischa POSLAWSKY --- t/t6300-for-each-ref.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index ab69aa176d..9c910ce746 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -526,6 +526,25 @@ test_expect_success 'Check ambiguous head and tag refs II (loose)' ' test_cmp expected actual ' +test_expect_success 'create tag without tagger' ' + git tag -a -m "Broken tag" taggerless && + git tag -f taggerless $(git cat-file tag taggerless | + sed -e "/^tagger /d" | + git hash-object --stdin -w -t tag) +' + +test_atom refs/tags/taggerless type 'commit' +test_atom refs/tags/taggerless tag 'taggerless' +test_atom refs/tags/taggerless tagger '' +test_atom refs/tags/taggerless taggername '' +test_atom refs/tags/taggerless taggeremail '' +test_atom refs/tags/taggerless taggerdate '' +test_atom refs/tags/taggerless committer '' +test_atom refs/tags/taggerless committername '' +test_atom refs/tags/taggerless committeremail '' +test_atom refs/tags/taggerless committerdate '' +test_atom refs/tags/taggerless subject 'Broken tag' + test_expect_success 'an unusual tag with an incomplete line' ' git tag -m "bogo" bogo &&