git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Han-Wen Nienhuys <hanwen@google.com>,
	Han-Wen Nienhuys <hanwenn@gmail.com>
Subject: [PATCH v2 0/7] reftable: avoid reading and writing empty keys
Date: Thu, 17 Feb 2022 13:55:17 +0000	[thread overview]
Message-ID: <pull.1185.v2.git.git.1645106124.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1185.git.git.1642010868.gitgitgadget@gmail.com>

this series makes sure that the object record does not have to consider
empty keys (and therefore, a NULL memcpy destination)

while we're at it add some more tests, and fix a naming mistake.

Han-Wen Nienhuys (7):
  Documentation: object_id_len goes up to 31
  reftable: reject 0 object_id_len
  reftable: add a test that verifies that writing empty keys fails
  reftable: avoid writing empty keys at the block layer
  reftable: ensure that obj_id_len is >= 2 on writing
  reftable: add test for length of disambiguating prefix
  reftable: rename writer_stats to reftable_writer_stats

 Documentation/technical/reftable.txt |   2 +-
 reftable/block.c                     |  27 ++++---
 reftable/block_test.c                |   5 ++
 reftable/reader.c                    |   5 ++
 reftable/readwrite_test.c            | 105 ++++++++++++++++++++++++++-
 reftable/reftable-writer.h           |   2 +-
 reftable/writer.c                    |   9 ++-
 7 files changed, 136 insertions(+), 19 deletions(-)


base-commit: 45fe28c951c3e70666ee4ef8379772851a8e4d32
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1185%2Fhanwen%2Fobj-id-len-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1185/hanwen/obj-id-len-v2
Pull-Request: https://github.com/git/git/pull/1185

Range-diff vs v1:

 1:  2d2e1177ff7 = 1:  80d29e8f269 Documentation: object_id_len goes up to 31
 2:  747c9e9a4c8 = 2:  4c1a19fc4ae reftable: reject 0 object_id_len
 3:  4eefedb0d07 = 3:  600b115f8b1 reftable: add a test that verifies that writing empty keys fails
 4:  e4c1cc58265 ! 4:  ba036ee8543 reftable: avoid writing empty keys at the block layer
     @@ reftable/block.c: int block_reader_first_key(struct block_reader *br, struct str
      
       ## reftable/block_test.c ##
      @@ reftable/block_test.c: static void test_block_read_write(void)
     + 	block_writer_init(&bw, BLOCK_TYPE_REF, block.data, block_size,
       			  header_off, hash_size(GIT_SHA1_FORMAT_ID));
     - 	reftable_record_from_ref(&rec, &ref);
       
     -+	ref.refname = "";
     -+	ref.value_type = REFTABLE_REF_DELETION;
     ++	rec.u.ref.refname = "";
     ++	rec.u.ref.value_type = REFTABLE_REF_DELETION;
      +	n = block_writer_add(&bw, &rec);
      +	EXPECT(n == REFTABLE_API_ERROR);
      +
 5:  3a72aba447c = 5:  2bd3d44ba57 reftable: ensure that obj_id_len is >= 2 on writing
 6:  a5dfa048884 = 6:  82d36ee0e0d reftable: add test for length of disambiguating prefix
 7:  37aa7744c84 ! 7:  c6ffdb3471c reftable: rename writer_stats to reftable_writer_stats
     @@ reftable/readwrite_test.c: static void test_log_write_read(void)
       	n = reftable_writer_close(w);
       	EXPECT(n == 0);
       
     +-	stats = writer_stats(w);
     ++	stats = reftable_writer_stats(w);
     + 	EXPECT(stats->log_stats.blocks > 0);
     + 	reftable_writer_free(w);
     + 	w = NULL;
     +@@ reftable/readwrite_test.c: static void test_log_zlib_corruption(void)
     + 	n = reftable_writer_close(w);
     + 	EXPECT(n == 0);
     + 
      -	stats = writer_stats(w);
      +	stats = reftable_writer_stats(w);
       	EXPECT(stats->log_stats.blocks > 0);

-- 
gitgitgadget

  parent reply	other threads:[~2022-02-17 13:56 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-12 18:07 [PATCH 0/7] reftable: avoid reading and writing empty keys Han-Wen Nienhuys via GitGitGadget
2022-01-12 18:07 ` [PATCH 1/7] Documentation: object_id_len goes up to 31 Han-Wen Nienhuys via GitGitGadget
2022-01-12 18:07 ` [PATCH 2/7] reftable: reject 0 object_id_len Han-Wen Nienhuys via GitGitGadget
2022-01-12 18:07 ` [PATCH 3/7] reftable: add a test that verifies that writing empty keys fails Han-Wen Nienhuys via GitGitGadget
2022-01-12 18:07 ` [PATCH 4/7] reftable: avoid writing empty keys at the block layer Han-Wen Nienhuys via GitGitGadget
2022-01-14  1:26   ` Junio C Hamano
2022-01-17 13:10     ` Han-Wen Nienhuys
2022-01-17 19:11       ` Junio C Hamano
2022-01-12 18:07 ` [PATCH 5/7] reftable: ensure that obj_id_len is >= 2 on writing Han-Wen Nienhuys via GitGitGadget
2022-01-12 18:07 ` [PATCH 6/7] reftable: add test for length of disambiguating prefix Han-Wen Nienhuys via GitGitGadget
2022-01-12 18:07 ` [PATCH 7/7] reftable: rename writer_stats to reftable_writer_stats Han-Wen Nienhuys via GitGitGadget
2022-02-17 13:55 ` Han-Wen Nienhuys via GitGitGadget [this message]
2022-02-17 13:55   ` [PATCH v2 1/7] Documentation: object_id_len goes up to 31 Han-Wen Nienhuys via GitGitGadget
2022-02-17 13:55   ` [PATCH v2 2/7] reftable: reject 0 object_id_len Han-Wen Nienhuys via GitGitGadget
2022-02-18  0:32     ` Junio C Hamano
2022-02-17 13:55   ` [PATCH v2 3/7] reftable: add a test that verifies that writing empty keys fails Han-Wen Nienhuys via GitGitGadget
2022-02-17 13:55   ` [PATCH v2 4/7] reftable: avoid writing empty keys at the block layer Han-Wen Nienhuys via GitGitGadget
2022-02-17 23:55     ` Junio C Hamano
2022-02-21 14:32       ` Han-Wen Nienhuys
2022-02-17 13:55   ` [PATCH v2 5/7] reftable: ensure that obj_id_len is >= 2 on writing Han-Wen Nienhuys via GitGitGadget
2022-02-18  0:01     ` Junio C Hamano
2022-02-17 13:55   ` [PATCH v2 6/7] reftable: add test for length of disambiguating prefix Han-Wen Nienhuys via GitGitGadget
2022-02-17 13:55   ` [PATCH v2 7/7] reftable: rename writer_stats to reftable_writer_stats Han-Wen Nienhuys via GitGitGadget
2022-02-18  0:02   ` [PATCH v2 0/7] reftable: avoid reading and writing empty keys Junio C Hamano
2022-02-21 18:46   ` [PATCH v3 " Han-Wen Nienhuys via GitGitGadget
2022-02-21 18:46     ` [PATCH v3 1/7] Documentation: object_id_len goes up to 31 Han-Wen Nienhuys via GitGitGadget
2022-02-21 18:46     ` [PATCH v3 2/7] reftable: reject 0 object_id_len Han-Wen Nienhuys via GitGitGadget
2022-02-21 18:46     ` [PATCH v3 3/7] reftable: add a test that verifies that writing empty keys fails Han-Wen Nienhuys via GitGitGadget
2022-02-21 18:46     ` [PATCH v3 4/7] reftable: avoid writing empty keys at the block layer Han-Wen Nienhuys via GitGitGadget
2022-02-21 18:46     ` [PATCH v3 5/7] reftable: ensure that obj_id_len is >= 2 on writing Han-Wen Nienhuys via GitGitGadget
2022-02-21 18:46     ` [PATCH v3 6/7] reftable: add test for length of disambiguating prefix Han-Wen Nienhuys via GitGitGadget
2022-02-21 18:46     ` [PATCH v3 7/7] reftable: rename writer_stats to reftable_writer_stats Han-Wen Nienhuys via GitGitGadget
2022-02-23 21:37     ` [PATCH v3 0/7] reftable: avoid reading and writing empty keys Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1185.v2.git.git.1645106124.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=hanwen@google.com \
    --cc=hanwenn@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).