From: Jeff King Date: Mon, 02 Feb 2015 18:50:49 GMT Subject: Re: [PATCHv4] sha1_file: fix iterating loose alternate objects Message-ID: <20150202185049.GA27399@peff.net> In-Reply-To: <4727F1DC-2FC3-49BE-8C6D-0C4D7D8B107C@jonathonmah.com> On Mon, Feb 02, 2015 at 10:48:12AM -0800, Jonathon Mah wrote: > The string in 'base' contains a path suffix to a specific object; when > its value is used, the suffix must either be filled (as in > stat_sha1_file, open_sha1_file, check_and_freshen_nonlocal) or cleared > (as in prepare_packed_git) to avoid junk at the end. loose_from_alt_odb > (introduced in 660c889e46d185dc98ba78963528826728b0a55d) did neither and > treated 'base' as a complete path to the "base" object directory, > instead of a pointer to the "base" of the full path string. > > The trailing path after 'base' is still initialized to NUL, hiding the > bug in some common cases. Additionally the descendent > for_each_file_in_obj_subdir function swallows ENOENT, so an error only > shows if the alternate's path was last filled with a valid object > (where statting /path/to/existing/00/0bjectfile/00 fails). > > Signed-off-by: Jonathon Mah > --- > Squashed test and fix. Thanks, this version looks good to me. -Peff