Re: [PATCH] ls-files: use correct format string
- From
Jeff King <peff@peff.net>
- Date
- Apr 11, 2019, 04:18 UTC
- Message-ID
- <20190411041823.GA17699@sigill.intra.peff.net>
- In-Reply-To
- <20190407184751.28027-1-t.gummerer@gmail.com>
On Sun, Apr 07, 2019 at 07:47:51PM +0100, Thomas Gummerer wrote:
Show 9 quoted lines
> struct stat_data and struct cache_time both use unsigned ints for all
> their members. However the format string for 'git ls-files --debug'
> currently uses %d for formatting these numbers. This means that we
> potentially print these values incorrectly if they are greater than
> INT_MAX.
>
> This has been the case since the --debug option was introduced in 'git
> ls-files' in 8497421715 ("ls-files: learn a debugging dump format",
> 2010-07-31).I didn't see any comment on this, but it seems like it must be obviously correct, since as you note we do define those fields as unsigned. I'm really surprised that -Wformat doesn't catch this, though. I wonder why.
-Peff