From: Ben Peart Date: Mon, 15 Oct 2018 17:33:32 GMT Subject: Re: [PATCH v8 0/7] speed up index load through parallelization Message-ID: <3a7fb135-95e3-9dab-ca31-8daadc5cf80c@gmail.com> In-Reply-To: fixup! IEOT error messages Enable localizing new error messages and improve the error message for invalid IEOT extension sizes. Signed-off-by: Ben Peart --- read-cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/read-cache.c b/read-cache.c index 7acc2c86f4..f9fa6a7979 100644 --- a/read-cache.c +++ b/read-cache.c @@ -3480,7 +3480,7 @@ static struct index_entry_offset_table *read_ieot_extension(const char *mmap, si /* validate the version is IEOT_VERSION */ ext_version = get_be32(index); if (ext_version != IEOT_VERSION) { - error("invalid IEOT version %d", ext_version); + error(_("invalid IEOT version %d"), ext_version); return NULL; } index += sizeof(uint32_t); @@ -3488,7 +3488,7 @@ static struct index_entry_offset_table *read_ieot_extension(const char *mmap, si /* extension size - version bytes / bytes per entry */ nr = (extsize - sizeof(uint32_t)) / (sizeof(uint32_t) + sizeof(uint32_t)); if (!nr) { - error("invalid number of IEOT entries %d", nr); + error(_("invalid IEOT extension size %d"), extsize); return NULL; } ieot = xmalloc(sizeof(struct index_entry_offset_table) -- 2.18.0.windows.1 On 10/14/2018 8:28 AM, Duy Nguyen wrote: > On Wed, Oct 10, 2018 at 5:59 PM Ben Peart wrote: >> @@ -3460,14 +3479,18 @@ static struct index_entry_offset_table *read_ieot_extension(const char *mmap, si >> >> /* validate the version is IEOT_VERSION */ >> ext_version = get_be32(index); >> - if (ext_version != IEOT_VERSION) >> + if (ext_version != IEOT_VERSION) { >> + error("invalid IEOT version %d", ext_version); > > Please wrap this string in _() so that it can be translated. > >> return NULL; >> + } >> index += sizeof(uint32_t); >> >> /* extension size - version bytes / bytes per entry */ >> nr = (extsize - sizeof(uint32_t)) / (sizeof(uint32_t) + sizeof(uint32_t)); >> - if (!nr) >> + if (!nr) { >> + error("invalid number of IEOT entries %d", nr); > > Ditto. And reporting extsize may be more useful than nr, which we know > is zero, but we don't know why it's calculated zero unless we know > extsize. >