From: Junio C Hamano Date: Fri, 17 Jan 2025 22:45:04 GMT Subject: Re: [PATCH 1/3] packfile: factor out --pack_header argument parsing Message-ID: In-Reply-To: <20250117125459.GA2893666@coredump.intra.peff.net> Jeff King writes: > } else if (starts_with(arg, "--pack_header=")) { > - struct pack_header *hdr; > - char *c; > - > - hdr = (struct pack_header *)input_buffer; > - hdr->hdr_signature = htonl(PACK_SIGNATURE); > - hdr->hdr_version = htonl(strtoul(arg + 14, &c, 10)); Interesting. So the file-scope static input_buffer[] sits in the BSS and happens to be well aligned not to cause the problem, but ... > @@ -645,18 +646,9 @@ int cmd_unpack_objects(int argc, > continue; > } > if (starts_with(arg, "--pack_header=")) { > - struct pack_header *hdr; > - char *c; > - > - hdr = (struct pack_header *)buffer; > - hdr->hdr_signature = htonl(PACK_SIGNATURE); > - hdr->hdr_version = htonl(strtoul(arg + 14, &c, 10)); ... the same file-scope static buffer[] that also sits in the BSS was not well aligned by chance? Otherwise these should be identical code. Very interesting. And of course the fix in the [2/3] is absolutely the right thing to do. Thanks.