From patchwork Fri Jan 10 12:55:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13934510 Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C617420B7E9 for ; Fri, 10 Jan 2025 12:55:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513740; cv=none; b=N36zUI0dfFtMBZPJr9J8xOJ86UU/i20PU8/0PqQTCsfdf8wBZrwct01FSfYctrOJEKuUYhK/fmCF/lm+9Hdiu7n+XRY0KsyKHN2kAgoodqFN9LdsLskM/EZ2gCg5j3uxlZGBhgAYLAtJqs2zbvk7sAml0tJGXlzwclnL2Ko6JNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513740; c=relaxed/simple; bh=KYsVG/etjHY+CGnUdDs8p6eCX14cw71Ff7Y4OS1HlVg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=o6DcU2nQAD6I9mKko5cbCSXxGXGxBSo+W8kje7vH/jj2VaZxyaWweWqv0oXI29iV7dUJtSUXipPxMu5SVCQJXYh/n+wLmNBTVnjrjUuMpdnpYYeBoKjxDzyAmZhEYZjQ8roPAPmt86c7joknMGKC+xawgIcWDehGccIevItZOHU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=UkqB+knb; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=c1yYJGnm; arc=none smtp.client-ip=202.12.124.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="UkqB+knb"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="c1yYJGnm" Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.stl.internal (Postfix) with ESMTP id F08FF25401BF for ; Fri, 10 Jan 2025 07:55:36 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-10.internal (MEProxy); Fri, 10 Jan 2025 07:55:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1736513736; x=1736600136; bh=vOAVEC6ZTd1faQmUzBbwN12hDr4m82woou+52DsTFWI=; b= UkqB+knblOSIL4RW9Vtlq11xhKVgtACYyxKyO5IqXYtjH+qwT0dJvj9qO7FDBBoQ a6IfqonhrmlnEQ14hTSsowItIrU1wq5HU6MlShXErlO4QsJjpSW9IXczlDGJOz1K JkkWHs8KHRUgbdLVTarNxcnAFa4RkR3aGI0M+VAhwQ6xy8Zxv3B3ZKYbtQ59ROkF kElAa4hJ5Tmjas4TukyBO5xfULgrk1lWYE5QYpfkiQHoKj+WX+1jff+mNVdoMJAS Vaz96xDpKP3XimY6ztCZWWRbGeB1TG+O7WgaNKHt/ygOibUF1FMVlrdHptPz3wPD yh6+sfwyx6Eq/elrDF+2ng== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1736513736; x= 1736600136; bh=vOAVEC6ZTd1faQmUzBbwN12hDr4m82woou+52DsTFWI=; b=c 1yYJGnmfx5jAsFAhU4zqBL7gsr5u6LeO6Mn0T12rQlAn6rKQXUH5LBFECydXHmFI LOdEOTVkNWh5jyUUvWGIH4YsdT/xtsf9pWGZWX5hmNCOwiokErvuZ/M4BTutepPC AqGhbu+1+6UCMZ3fGO5a17klOPSlLODHu/JXDZJKxUN2SNSH6Aq34jICzLz3ALUl 6K1QA4qBAZ+jyKFNu0xw9l6Shb1TuBHSONprdOSwQKAmsRXmemezrEBHg+73bNbx u0WjH7MCLftAnYC26iyikBE2kkx9UAha/A2Cu8pSIfWfFc5ULBd08d4r0QrgNZLJ 5Ab/xg8UCuYQQDRkS+IpA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudegkedggeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithes vhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 10 Jan 2025 07:55:36 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id cbcd618d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 10 Jan 2025 12:55:32 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 10 Jan 2025 13:55:28 +0100 Subject: [PATCH 1/8] compat: drop `uncompress2()` compatibility shim Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-b4-pks-compat-drop-uncompress2-v1-1-965d0022a74d@pks.im> References: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> In-Reply-To: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> To: git@vger.kernel.org Cc: X-Mailer: b4 0.14.2 Our compat library has an implementation of zlib's `uncompress2()` function that gets used when linking against an old version of zlib that doesn't yet have it. The last user of `uncompress2()` got removed in 15a60b747e (reftable/block: open-code call to `uncompress2()`, 2024-04-08), so the compatibility code is not required anymore. Drop it. Signed-off-by: Patrick Steinhardt --- Makefile | 1 - compat/zlib-uncompress2.c | 96 ----------------------------------------------- git-compat-util.h | 9 ----- meson.build | 1 - 4 files changed, 107 deletions(-) diff --git a/Makefile b/Makefile index 97e8385b6643b963c54affb3ae621fc93fad28b5..86c6c3d7adfb8b0b52afeaafa3cc3c2a141e2f63 100644 --- a/Makefile +++ b/Makefile @@ -984,7 +984,6 @@ LIB_OBJS += commit.o LIB_OBJS += compat/nonblock.o LIB_OBJS += compat/obstack.o LIB_OBJS += compat/terminal.o -LIB_OBJS += compat/zlib-uncompress2.o LIB_OBJS += config.o LIB_OBJS += connect.o LIB_OBJS += connected.o diff --git a/compat/zlib-uncompress2.c b/compat/zlib-uncompress2.c deleted file mode 100644 index 77a1b08048463da25ba8d6b36031ccb7e8cce7b5..0000000000000000000000000000000000000000 --- a/compat/zlib-uncompress2.c +++ /dev/null @@ -1,96 +0,0 @@ -#include "git-compat-util.h" - -#if ZLIB_VERNUM < 0x1290 -/* taken from zlib's uncompr.c - - commit cacf7f1d4e3d44d871b605da3b647f07d718623f - Author: Mark Adler - Date: Sun Jan 15 09:18:46 2017 -0800 - - zlib 1.2.11 - -*/ - -/* - * Copyright (C) 1995-2003, 2010, 2014, 2016 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* clang-format off */ - -/* =========================================================================== - Decompresses the source buffer into the destination buffer. *sourceLen is - the byte length of the source buffer. Upon entry, *destLen is the total size - of the destination buffer, which must be large enough to hold the entire - uncompressed data. (The size of the uncompressed data must have been saved - previously by the compressor and transmitted to the decompressor by some - mechanism outside the scope of this compression library.) Upon exit, - *destLen is the size of the decompressed data and *sourceLen is the number - of source bytes consumed. Upon return, source + *sourceLen points to the - first unused input byte. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, or - Z_DATA_ERROR if the input data was corrupted, including if the input data is - an incomplete zlib stream. -*/ -int ZEXPORT uncompress2 ( - Bytef *dest, - uLongf *destLen, - const Bytef *source, - uLong *sourceLen) { - z_stream stream; - int err; - const uInt max = (uInt)-1; - uLong len, left; - Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */ - - len = *sourceLen; - if (*destLen) { - left = *destLen; - *destLen = 0; - } - else { - left = 1; - dest = buf; - } - - stream.next_in = (z_const Bytef *)source; - stream.avail_in = 0; - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - stream.opaque = (voidpf)0; - - err = inflateInit(&stream); - if (err != Z_OK) return err; - - stream.next_out = dest; - stream.avail_out = 0; - - do { - if (stream.avail_out == 0) { - stream.avail_out = left > (uLong)max ? max : (uInt)left; - left -= stream.avail_out; - } - if (stream.avail_in == 0) { - stream.avail_in = len > (uLong)max ? max : (uInt)len; - len -= stream.avail_in; - } - err = inflate(&stream, Z_NO_FLUSH); - } while (err == Z_OK); - - *sourceLen -= len + stream.avail_in; - if (dest != buf) - *destLen = stream.total_out; - else if (stream.total_out && err == Z_BUF_ERROR) - left = 1; - - inflateEnd(&stream); - return err == Z_STREAM_END ? Z_OK : - err == Z_NEED_DICT ? Z_DATA_ERROR : - err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR : - err; -} -#else -static void *dummy_variable = &dummy_variable; -#endif diff --git a/git-compat-util.h b/git-compat-util.h index e283c46c6fa06e4079851296a55c9bd5472a65b4..d50f487c00d7958e871bb9a98419e55f866cdd1d 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -1540,15 +1540,6 @@ int common_exit(const char *file, int line, int code); #define z_const #include -#if ZLIB_VERNUM < 0x1290 -/* - * This is uncompress2, which is only available in zlib >= 1.2.9 - * (released as of early 2017). See compat/zlib-uncompress2.c. - */ -int uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source, - uLong *sourceLen); -#endif - /* * This include must come after system headers, since it introduces macros that * replace system names. diff --git a/meson.build b/meson.build index 7361eb2eaad422e7a6c6ed95d275615836c21cdb..f1aac01f729efaf19e25b1f11505de49443d5326 100644 --- a/meson.build +++ b/meson.build @@ -248,7 +248,6 @@ libgit_sources = [ 'compat/nonblock.c', 'compat/obstack.c', 'compat/terminal.c', - 'compat/zlib-uncompress2.c', 'config.c', 'connect.c', 'connected.c', From patchwork Fri Jan 10 12:55:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13934511 Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2DD520B7FA for ; Fri, 10 Jan 2025 12:55:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513740; cv=none; b=joCoBjbHGKZwbcWxHbpvoXhl9ybCJYwpR8fkER9U1QQANzYlGzYCyl38pfZZ2P/zzh61/AF3VJoU6R7bD3LPwJ+8zp85ukYpBEAzJyzjhZaSmo2ETO0jk8tg1IWLP0ltGrxQuXMNEKPJzTV1Kdq0tmee88ghc3EnvvYFA5XaHx4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513740; c=relaxed/simple; bh=CN47lfkQEGh/MIFggTTeVWfInfTVJyw/mqnUcHuvQuU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WRsfytw+k7i3AMEzI9CYczPi0G29E1I7MT22wNfm87fU+4mY7GE6UvETT1XH4a7goPdxkBowkuOiAYNO8WEvIjZId6R/iKUGNw12/LQTlAYoGcQ0muh6HcSJoTJ/DgZj9BT8VrtjsPqA6uwxUVCD34S8FU00aS/rtxWrHV4BmUs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=gHoNol8g; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=gdfpZSaR; arc=none smtp.client-ip=202.12.124.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="gHoNol8g"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="gdfpZSaR" Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id C300B25401C2 for ; Fri, 10 Jan 2025 07:55:37 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Fri, 10 Jan 2025 07:55:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1736513737; x=1736600137; bh=K/19v4XSfaZ5z1ldSZGdR/9m8JSOwJ1YEr4m4Ff9vts=; b= gHoNol8g5Z0O8lU9iCzmilOIKB0Kiz12d50WxcjXkW++yih0BcjN7MrvUr6DW+Yv DAdGlP9xtt7U3yI6d80sH3G0MAp6gMVW/ebc0c4w9PVXB/EtTZB8Gdt94Cq3Dj3C 41BeY1qRiC1HpWXE8Lehb7umnn8IJB/GzMHFdeAw0CU99TYwLwnrKYm86eJOriud BZ2bPMCW8vUF75ZXMC/mjTQLrXPoshmzK2dySu7ZibomqnUB0u2kStaXFNLoD8Jl 8pd5TVXmz3CrGfl1IfPljmYsPp05JL9kdyqScAf4mqqQdH6qiNjo8pKi7UMevxLu eIiw1CmRqTIbfhjLPvl5xw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1736513737; x= 1736600137; bh=K/19v4XSfaZ5z1ldSZGdR/9m8JSOwJ1YEr4m4Ff9vts=; b=g dfpZSaRDhdWOC9zvDoxqmKCATED7k4WtKIfj6BhqCFaYLk4KYmzK0OeMKxuzshm2 KE0t98IaH3MrXay0lFwR0qpRE+RqE9Z/pSjo6kGhs+KrVa2P3UhumNRZwO+t1JpG U1+nZ0KEgamhNLQpTb1vi6wUgDimOHb/NXebbEOFye7XKmN6Nn3zsLGZPOobReXl wFTq/2LWojfaYhUbA6o0SPu4cWV3KjepS/PIIUhIiEFR6VOlgg6MyAN4+SKLTu+J 3krbXcpa+TNTPgSAXyLzJA3Cht3JWLCsLsCLvv/f01/93KyAtk29md4PJQ6WTRQb vBxii4QhEjgBrZ1+vtFbg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudegkedggeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithes vhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 10 Jan 2025 07:55:36 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 062f9dc6 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 10 Jan 2025 12:55:33 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 10 Jan 2025 13:55:29 +0100 Subject: [PATCH 2/8] git-compat-util: drop `z_const` define Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-b4-pks-compat-drop-uncompress2-v1-2-965d0022a74d@pks.im> References: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> In-Reply-To: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> To: git@vger.kernel.org Cc: X-Mailer: b4 0.14.2 Before including we explicitly define `z_const` to an empty value. This has the effect that the `z_const` macro in "zconf.h" itself will remain empty instead of being defined as `const`, which effectively adapts a couple of APIs so that their parameters are not marked as being constants. It is dubious though whether this is something we actually want: not marking a parameter as a constant doesn't make it any less constant than it was. The define was added via 07564773c2 (compat: auto-detect if zlib has uncompress2(), 2022-01-24), where it was seemingly carried over from our internal compatibility shim for `uncompress2()` that was removed in the preceding commit. The commit message doesn't mention why we carry over the define and make it public, either, and I cannot think of any reason for why we would want to have it. Drop the define. Signed-off-by: Patrick Steinhardt --- git-compat-util.h | 1 - 1 file changed, 1 deletion(-) diff --git a/git-compat-util.h b/git-compat-util.h index d50f487c00d7958e871bb9a98419e55f866cdd1d..c4b4b372b473ca0af2a4f5f60554f6d3df74f112 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -1537,7 +1537,6 @@ int cmd_main(int, const char **); int common_exit(const char *file, int line, int code); #define exit(code) exit(common_exit(__FILE__, __LINE__, (code))) -#define z_const #include /* From patchwork Fri Jan 10 12:55:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13934512 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F168C20B807 for ; Fri, 10 Jan 2025 12:55:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513740; cv=none; b=CRIEd26e5Eww4mHQgETBHsEf2NT/AkNiA4GUpuPfBkFp0mu5NqgUPGtU8UcLGCNsW41aeot9YtEUt/IREs7GizxNQNDobeZOfnvJ9OxG9QUyACTR/zg2t8VNGywxUrDdYL8it1mc1hxE2TWyLDP2Gy6TsBuBcbkba3kLovkCXDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513740; c=relaxed/simple; bh=ciX7aY43v6sJVeqZ+FkNqjijossx0TtIXYZX99yoT4Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CWJ58H3XVocpfA6fe5XdWB27NjHMuPab5iR3Fym9S9FFJ48Tp1GbYVEqnJQlaquWSiAu6QdybBszmZe5UXwcQxCuWLw16505/dabo3P6+GesZpI6cZdByZfbp/sdkb1OrGk91q6TaUXVygHStTnigf3I9WHWBc+gfrU/SZ8/QrI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=DnbWsZqq; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=M3vl/GgI; arc=none smtp.client-ip=202.12.124.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="DnbWsZqq"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="M3vl/GgI" Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfout.stl.internal (Postfix) with ESMTP id 28F231140142 for ; Fri, 10 Jan 2025 07:55:38 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Fri, 10 Jan 2025 07:55:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1736513738; x=1736600138; bh=DL22ZPvvEe1Q+IuGdTS3fKJrHcsZLwmU+kxE223BvuU=; b= DnbWsZqq0eRVSAalKhbBNgIllW/5dLh020cEdyZrEyM1mL9VBbZJ7JyU6t4DGrGW fG3eOk23eysyF2F0hq1sF8LrrH39r1Bu8Stpehlg6vpIxyfo9IsAZACC8cQZVVU9 /xUheb0ri8Km06QIsXXMNc8afsp8M6e0/WJ50jdnBEMrlQ2qVpN6Roxu4x4cTMty +V8vVwTE+JJG1feYRrg3vIs06/Bn/R3b2ky7so93/U++T+CbG9pn/g+1MKEdOP/K wCKvhbvbLTTkgfVw1b04Yy8dxIHM7/nJAkvGy+9JaolzBbv/Lqi5Dfneaw6YkbZe OUb66pUgBxFUy6AmwWaZpA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1736513738; x= 1736600138; bh=DL22ZPvvEe1Q+IuGdTS3fKJrHcsZLwmU+kxE223BvuU=; b=M 3vl/GgIY0aqma2Sye8EJ7ifY3nqpmavfzM65c35qSJuRL7tVFkKRXdndp+1x1xZV wUDKP4Oig7A8A3sQ3618+qgo8fZwmlx0Iy63aSJ2zIWjMD0YfMcumpbjB581BYyz ccnGy/laPhQnvRe1rBYPKORw9+lhqL0OFemDhhNpFZEebOaMftSVlPASau8EbY9I Sj55/ZabyvMDwtjdVu9vyqYU9obnJqEYWB6NIqcSBR4mz/FW+A56NkJp6oeGDquQ QfCFs5aKtF4KTkrcFH/HCCSPpS9En+ncJ9Ssrix3Z2mFRH0rIk9mIEtViGwHWrAx NlmYjtdVTWmWQyKCuFxrQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudegkedggeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithes vhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 10 Jan 2025 07:55:37 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id e932d1da (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 10 Jan 2025 12:55:34 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 10 Jan 2025 13:55:30 +0100 Subject: [PATCH 3/8] compat: introduce new "zlib.h" header Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-b4-pks-compat-drop-uncompress2-v1-3-965d0022a74d@pks.im> References: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> In-Reply-To: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> To: git@vger.kernel.org Cc: X-Mailer: b4 0.14.2 Introduce a new "compat/zlib-compat.h" header that we include instead of including directly. This will allow us to wire up zlib-ng as an alternative backend for zlib compression in a subsequent commit. Note that we cannot just call the file "compat/zlib.h", as that may otherwise cause us to include that file instead of . Signed-off-by: Patrick Steinhardt --- compat/zlib-compat.h | 6 ++++++ git-compat-util.h | 2 +- reftable/block.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/compat/zlib-compat.h b/compat/zlib-compat.h new file mode 100644 index 0000000000000000000000000000000000000000..bc20b884efab72028d5f696923e9800e39b08ce3 --- /dev/null +++ b/compat/zlib-compat.h @@ -0,0 +1,6 @@ +#ifndef COMPAT_ZLIB_H +#define COMPAT_ZLIB_H + +#include + +#endif /* COMPAT_ZLIB_H */ diff --git a/git-compat-util.h b/git-compat-util.h index c4b4b372b473ca0af2a4f5f60554f6d3df74f112..1ca26713221ba0270818ac61b6940f03cdf8b460 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -1537,7 +1537,7 @@ int cmd_main(int, const char **); int common_exit(const char *file, int line, int code); #define exit(code) exit(common_exit(__FILE__, __LINE__, (code))) -#include +#include "compat/zlib-compat.h" /* * This include must come after system headers, since it introduces macros that diff --git a/reftable/block.c b/reftable/block.c index 9858bbc7c5f7aa63fbcaf1acf9f4b5738e0b6d27..bc9b07963448e613ae14d2c4194b48764718290d 100644 --- a/reftable/block.c +++ b/reftable/block.c @@ -13,7 +13,7 @@ license that can be found in the LICENSE file or at #include "record.h" #include "reftable-error.h" #include "system.h" -#include +#include "compat/zlib-compat.h" int header_size(int version) { From patchwork Fri Jan 10 12:55:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13934513 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE6F720C00B for ; Fri, 10 Jan 2025 12:55:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513741; cv=none; b=Nq7lklwUlYiqtt4mlNTiuTsuu+SVcedQw2OyT8oaYlr9keyUyL/wNbDjPWiafxNvUTCUHlkGijMECx5eOkSFp8NO3uKCYi0sIpeJ4S+UAknE40P15jk1+6DQw2KRoG6LRxWK7WLXWpsp2Pr02WpJ2X2iJ00bE0ue9TQNjNbo+pg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513741; c=relaxed/simple; bh=ZKoAARlGqTTa3Geh02WFYRu9+tPh4zTOpwLaVCnZUuo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EOnmP4HmIP5Fq5d20ZQbAYvmn9h12dFaZpM75c3YAWTZGH2Kb00PFXpLqumJy2OjZyySkWPCPkrpKDomk4/01fILT7S47n29XjRVOP+/KAt20ttId2bY32oDZ1Ok0+VLW9Zj10KETgDAXbTRh64TJWEaZcN6TRQsbeC40C3whWE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=B2VUsIOP; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=q4npGs4R; arc=none smtp.client-ip=202.12.124.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="B2VUsIOP"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="q4npGs4R" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id D4076114010F for ; Fri, 10 Jan 2025 07:55:38 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Fri, 10 Jan 2025 07:55:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1736513738; x=1736600138; bh=GArF/TpaGZi8GjUM+pfLQTu50KO+CmZ1avlaPg2TWfg=; b= B2VUsIOPa3HlkWjwMe1LPrE542NXSqOZqxQU4ZS4j5zDHUK7uypt0H2AxjFBkzOu oZDNb0wxmJ3aIQTggdJWUaNSQaUqnyHOp0c43MDKVIWZLxia8qCROlqY89bY2sl7 3oiqx/ZuzYDi47+hnjLE0TbuObXlD07cyL944GDRkTJgwTU1+PK25slhHM8eDZp8 RfI+5pJ/x+d26Z2DnQfmZE6VQJ22pPFiWE7y7K12B/4xDYwBD+HLnFEQYQ2kIAqC i/8rVjveIQ+y3BpoUQVWrc6ESUJ3ov62JtUgqCd2+5Lu3vkWYNpWCUvQTFTrVOAN 6R5q1r6b7RqZJ+vlQSkpSA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1736513738; x= 1736600138; bh=GArF/TpaGZi8GjUM+pfLQTu50KO+CmZ1avlaPg2TWfg=; b=q 4npGs4ReEScRE5qYL1bAT9l2ZEOSDaHDeLC8ifeESLkofh6vAP+ZOBHM3grCjwhD +jv5WeIoFrTQnL52GLfMxWa9DGY5ZUpYxl0mSj9nd2liO7UvQHqYQU2XUmU4GTb/ 3IittvJ2cCRcTZfa1VRhyMHiBFzPDE2nn3s5y5Pov0TXQEa4wQoFuTdWxDubo+/e GhGNhkBCArCmKXHYLLOTfYylmMHlKjseatjCDwdCAhcyB02nl+Cq58N+ahvJSKT5 +Y6coqNbDst+brMwwnjhky1TKXBT9qldIqXKz9A+D8JH+ha2wIdewyEX7Lx3GeWA W3xxFBa43OGoL1v7EcZpQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudegkedggeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithes vhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 10 Jan 2025 07:55:38 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 25771f78 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 10 Jan 2025 12:55:35 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 10 Jan 2025 13:55:31 +0100 Subject: [PATCH 4/8] git-compat-util: move include of "compat/zlib.h" into "git-zlib.h" Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-b4-pks-compat-drop-uncompress2-v1-4-965d0022a74d@pks.im> References: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> In-Reply-To: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> To: git@vger.kernel.org Cc: X-Mailer: b4 0.14.2 We include "compat/zlib.h" in "git-compat-util.h", which is unnecessarily broad given that we only have a small handful of files that use the zlib library. Move the header into "git-zlib.h" instead and adapt users of zlib to include that header. One exception is the reftable library, as we don't want to use the Git-specific wrapper of zlib there, so we include "compat/zlib.h" instead. Furthermore, we move the include into "reftable/system.h" so that users of the library other than Git can wire up zlib themselves. Signed-off-by: Patrick Steinhardt --- archive.c | 1 + config.c | 1 + csum-file.c | 3 ++- environment.c | 1 + git-compat-util.h | 2 -- git-zlib.h | 2 ++ reftable/block.c | 1 - reftable/system.h | 1 + 8 files changed, 8 insertions(+), 4 deletions(-) diff --git a/archive.c b/archive.c index b9c200cba618ebc642859f2b3c58731157ed0eba..8be4e7ac8db50c7ae019ad12099362d9d392e194 100644 --- a/archive.c +++ b/archive.c @@ -7,6 +7,7 @@ #include "convert.h" #include "environment.h" #include "gettext.h" +#include "git-zlib.h" #include "hex.h" #include "object-name.h" #include "path.h" diff --git a/config.c b/config.c index 50f2d17b39944626172953475a07a56a9d618740..36f76fafe53ee755c4f18d9ea398b5dbe9a614fe 100644 --- a/config.c +++ b/config.c @@ -19,6 +19,7 @@ #include "convert.h" #include "environment.h" #include "gettext.h" +#include "git-zlib.h" #include "ident.h" #include "repository.h" #include "lockfile.h" diff --git a/csum-file.c b/csum-file.c index 5716016e12eec8c35f6495141fb2fcc250732803..78e04356d3ae9eb592f580fff204b28961934c0b 100644 --- a/csum-file.c +++ b/csum-file.c @@ -11,9 +11,10 @@ #define USE_THE_REPOSITORY_VARIABLE #include "git-compat-util.h" -#include "progress.h" #include "csum-file.h" +#include "git-zlib.h" #include "hash.h" +#include "progress.h" static void verify_buffer_or_die(struct hashfile *f, const void *buf, diff --git a/environment.c b/environment.c index 8389a272700eac7e07710b6899eb045c7df4f69a..e5b361bb5de4c69246098d0d458b567836d174f4 100644 --- a/environment.c +++ b/environment.c @@ -16,6 +16,7 @@ #include "convert.h" #include "environment.h" #include "gettext.h" +#include "git-zlib.h" #include "repository.h" #include "config.h" #include "refs.h" diff --git a/git-compat-util.h b/git-compat-util.h index 1ca26713221ba0270818ac61b6940f03cdf8b460..fb25fbf503cd3e4cfc9bf14c30dcc66951175c4e 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -1537,8 +1537,6 @@ int cmd_main(int, const char **); int common_exit(const char *file, int line, int code); #define exit(code) exit(common_exit(__FILE__, __LINE__, (code))) -#include "compat/zlib-compat.h" - /* * This include must come after system headers, since it introduces macros that * replace system names. diff --git a/git-zlib.h b/git-zlib.h index d8a670aff9fbc476b37e6848a178aec98325d19d..1e8d9aabcb4cb239bdf529926be60b56496e0d4f 100644 --- a/git-zlib.h +++ b/git-zlib.h @@ -1,6 +1,8 @@ #ifndef GIT_ZLIB_H #define GIT_ZLIB_H +#include "compat/zlib-compat.h" + typedef struct git_zstream { z_stream z; unsigned long avail_in; diff --git a/reftable/block.c b/reftable/block.c index bc9b07963448e613ae14d2c4194b48764718290d..38e3081c614ab2240ce0d988db26f2f4f12b17a1 100644 --- a/reftable/block.c +++ b/reftable/block.c @@ -13,7 +13,6 @@ license that can be found in the LICENSE file or at #include "record.h" #include "reftable-error.h" #include "system.h" -#include "compat/zlib-compat.h" int header_size(int version) { diff --git a/reftable/system.h b/reftable/system.h index 5274eca1d05b18bdadef9f991ff79fa83f3363e4..f194a3868634ce7806a85518ebe561a50f5a3ac0 100644 --- a/reftable/system.h +++ b/reftable/system.h @@ -14,6 +14,7 @@ license that can be found in the LICENSE file or at #define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" +#include "compat/zlib-compat.h" /* * An implementation-specific temporary file. By making this specific to the From patchwork Fri Jan 10 12:55:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13934514 Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A43920D513 for ; Fri, 10 Jan 2025 12:55:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513741; cv=none; b=VPdRDN3CpqGCrmnYL7HNINroz5Dvr+c5B8xzc0883brOd2I22qHJyA8zHChhIVQHAjtCA9v9b2LpiSkEXt1QGtKLSsOdPyDPh/m5+Sx8g1GcSFRoztcMxAM0ZPVpPqfJaKboSzA5AcgEenr1c3d3LfkpGS2+yae/GMYjqYviHiQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513741; c=relaxed/simple; bh=Q0h0B1eQLzPg3FS/SYy/yUjKoiSjCUXIe0N3gKmMQQc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HJbYHIJgoWGrRvKTIExkcvUZSbFr8KMvBcQnjKf/TzW2kxuAtub2Jl2PDiVhAPoP++FVykrgfOzvdHG1e9MjUY9te1UzsgEtypPPwGwcQWp5HwztpN5shdjhLnyu6AGF9VBV8BmOSx7UMU0fNi5d98604cCiLNYeWq5j1c2I2XY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=QDgkKoS7; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=nb1Byjj/; arc=none smtp.client-ip=202.12.124.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="QDgkKoS7"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="nb1Byjj/" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 2C5B025401C9 for ; Fri, 10 Jan 2025 07:55:39 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Fri, 10 Jan 2025 07:55:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1736513739; x=1736600139; bh=5c3/jgr6TZ6fysBpKn2EcqsI1qK6O8cOoLraz4vEcWw=; b= QDgkKoS7TYDnY0HwpHjMee24eC3JXy0xK9Kw48rQlC4ICRMlH8jGe20WJFdeP9RI m71XysFwBY1d/8Og6YymQcZfbHUeiemRXQfo079OJY9DVBOHw9OBgQEU4ZvztsXj qBHcKd3KKFdR0mm9fM7KJSpqp62FLH4Zyuz/RDsY8mfGQ57SRNKaU8qnuxRHBGXa XNXBIWiyZbU3d7CrUgJHnqlzjRV+CjfYqUAoSwNJAFeiIpziXYGKxG3k266IEnUd ic5mqRWAH3mhBP5U8Aw7t7X7X5CIUDZPtkXpuTOMb3Ux3WdpAVb3yCOMqbCI2Zws Hm/0VdOfWhDuG9g34t4HdA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1736513739; x= 1736600139; bh=5c3/jgr6TZ6fysBpKn2EcqsI1qK6O8cOoLraz4vEcWw=; b=n b1Byjj/LCeHK8+yXHSM2baFysDYZeDqlbcpzjx+5yja06ZAkjXVdM0rhWMSgEHsS qlDYzxRclOFKUU7kpZvYdpsywVx2KgZfxdSxhaoUvXFLDmQB381wTdUhCaI7h5Lw 9auW1+VYam9odOz22giSh88i20+yMeJy/zMTqyQmTsMwLqptJzSm4OBVIcLRCCLC LnAOWw13JAeARAgziBhGCi+p0IicfFOiXojEgqW06QjeuWe2MOnbip3cqVqTa/l4 diQKUzYM/JLGjoqTC47aQ0H+Gq2OqauNnBJHsvzux0VmdkxNG4lwLjy7bimXpW/v UYviy+HIQFOFLtWK3aURA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudegkedggeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithes vhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 10 Jan 2025 07:55:38 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 85c06b72 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 10 Jan 2025 12:55:36 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 10 Jan 2025 13:55:32 +0100 Subject: [PATCH 5/8] compat/zlib: provide `deflateBound()` shim centrally Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-b4-pks-compat-drop-uncompress2-v1-5-965d0022a74d@pks.im> References: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> In-Reply-To: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> To: git@vger.kernel.org Cc: X-Mailer: b4 0.14.2 The `deflateBound()` function has only been introduced with zlib 1.2.0. When linking against a zlib version older than that we thus provide our own compatibility shim. Move this shim into "compat/zlib.h" so that we can adapt it based on whether or not we use zlib-ng in a subsequent commit. Signed-off-by: Patrick Steinhardt --- compat/zlib-compat.h | 4 ++++ git-zlib.c | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compat/zlib-compat.h b/compat/zlib-compat.h index bc20b884efab72028d5f696923e9800e39b08ce3..96a08811a98ff7fa057f5682a5303a06cef40cd1 100644 --- a/compat/zlib-compat.h +++ b/compat/zlib-compat.h @@ -3,4 +3,8 @@ #include +#if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200 +# define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11) +#endif + #endif /* COMPAT_ZLIB_H */ diff --git a/git-zlib.c b/git-zlib.c index d43bbeb6daa4c195048f7012e0bccff8c5b4b5f1..2e973320c232438cce7c83e25cc60a6b773670fc 100644 --- a/git-zlib.c +++ b/git-zlib.c @@ -147,10 +147,6 @@ int git_inflate(git_zstream *strm, int flush) return status; } -#if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200 -#define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11) -#endif - unsigned long git_deflate_bound(git_zstream *strm, unsigned long size) { return deflateBound(&strm->z, size); From patchwork Fri Jan 10 12:55:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13934516 Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC26220DD56 for ; Fri, 10 Jan 2025 12:55:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513742; cv=none; b=aOSmaZdHjiO9GyzAXn9wbsGET5l/BN8H23MPhJYUBz4oNCFA31QipRGFU1c043Hbh8gEfyWEekZK7+5qXkvAUcOerco76r2rfXCzsGNY7EtxVHbgtK3UtEfyje8smkoNvoLKM/z+cTD2H/Qrpt/m4kT04HGKepzIKYSTkcylwlU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513742; c=relaxed/simple; bh=t3rXlukrqj2em5eWQKW5H7YJ5rXDWwY49IjLGu9i9G8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NKliVXvSYlbqE73hgTT+jXJNBGC5PW129waZEUbX6gCV7felNo+GY3X7xB3yHU9nHpuko9ideVqVaKM2a4FXXWtf2YRY4NM9HGGMWSDnZGfDqLByXVTRkFCW5hn4GdD0Mn9BbLgrkmO3Oifi9lAITCYt6u5WMZiqncsHyx90sDk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=Z62Zz7Uy; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=X9x9H5Nx; arc=none smtp.client-ip=202.12.124.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="Z62Zz7Uy"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="X9x9H5Nx" Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.stl.internal (Postfix) with ESMTP id D356025400FB for ; Fri, 10 Jan 2025 07:55:39 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Fri, 10 Jan 2025 07:55:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1736513739; x=1736600139; bh=t2Jpe0awu+ZIZKWpUqQCnRdosV+xZOpH4iGO/bo3MD0=; b= Z62Zz7Uy2cURkv+Q3bHsdJYrfQXSCAYRPZ5Qm7naFleGfIdfueKiZoq+bRdNHVy/ 8uJlOLttoG1oqumC2Mg2kIZ1SGS6kbQmKZkIQZWj6r7pG/uY25ShUXbtMVKuk6ca nb07ZxQAxBpVSFSUHEsKSb9JzG5cCi2cqNSQYGqD8iuC5eZVvrEjwR0MMWAyJwHP PtQADOsmwlnpfISCqPjK8kc884DVhCvHLJI2KP9fNhL6JZ2FQRZ84ROLUw6rjzBl MrMMgxo9ZZuwPxHhGkUS5XwG+bBVcJilYf/hE8n2UuMM4Ha127rBi1Jsz7D+89lT lyGPrIw42jiKLsQfjdMQPA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1736513739; x= 1736600139; bh=t2Jpe0awu+ZIZKWpUqQCnRdosV+xZOpH4iGO/bo3MD0=; b=X 9x9H5Nxl+ntM1Jn9geXbmIUTMZM+xuQvvK1TIu+FzVtO1uRl30Y9j86MZM+aruqF FDODB6ek2mQYB7NsB+uR6YqKloIZFbYlC9MKVOFbF/EGnwbC7EWjP+kKzNKoSinX w9ZtZzBUZkdtccQlbCMXFyFAz/LgiPU1CN80zDxv59gN0yvfwIGAwOCcVOXKmHyr SVpnA8ltbPsxKiP+aUElsHCONiadWmfVL8564CUIPsP5RCYBlqKpY8i9/XVhTpef 0rFJeP8wVBwgVJ/5P8l1kA2hILVu5qaE0Ds7bPt2SfVsOpbBxLQm1vXgMRFMIPVp Cz58RopRqKn0l93JVIzoQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudegkedggeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithes vhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 10 Jan 2025 07:55:38 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 4b795d64 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 10 Jan 2025 12:55:37 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 10 Jan 2025 13:55:33 +0100 Subject: [PATCH 6/8] compat/zlib: provide stubs for `deflateSetHeader()` Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-b4-pks-compat-drop-uncompress2-v1-6-965d0022a74d@pks.im> References: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> In-Reply-To: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> To: git@vger.kernel.org Cc: X-Mailer: b4 0.14.2 The function `deflateSetHeader()` has been introduce with zlib v1.2.2.1, so we don't use it when linking against an older version of it. Refactor the code to instead provide a central stub via "compat/zlib.h" so that we can adapt it based on whether or not we use zlib-ng in a subsequent commit. Signed-off-by: Patrick Steinhardt --- archive-tar.c | 4 ---- compat/zlib-compat.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/archive-tar.c b/archive-tar.c index e7b3489e1e6c826d8128cddb0c5be04042a65cec..0edf13fba7568b3950978a05a2f50299bb9b2f18 100644 --- a/archive-tar.c +++ b/archive-tar.c @@ -473,9 +473,7 @@ static const char internal_gzip_command[] = "git archive gzip"; static int write_tar_filter_archive(const struct archiver *ar, struct archiver_args *args) { -#if ZLIB_VERNUM >= 0x1221 struct gz_header_s gzhead = { .os = 3 }; /* Unix, for reproducibility */ -#endif struct strbuf cmd = STRBUF_INIT; struct child_process filter = CHILD_PROCESS_INIT; int r; @@ -486,10 +484,8 @@ static int write_tar_filter_archive(const struct archiver *ar, if (!strcmp(ar->filter_command, internal_gzip_command)) { write_block = tgz_write_block; git_deflate_init_gzip(&gzstream, args->compression_level); -#if ZLIB_VERNUM >= 0x1221 if (deflateSetHeader(&gzstream.z, &gzhead) != Z_OK) BUG("deflateSetHeader() called too late"); -#endif gzstream.next_out = outbuf; gzstream.avail_out = sizeof(outbuf); diff --git a/compat/zlib-compat.h b/compat/zlib-compat.h index 96a08811a98ff7fa057f5682a5303a06cef40cd1..2690bfce41caab2e9af7a09663d620f0ee5136a0 100644 --- a/compat/zlib-compat.h +++ b/compat/zlib-compat.h @@ -7,4 +7,17 @@ # define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11) #endif +#if ZLIB_VERNUM < 0x1221 +struct gz_header_s { + int os; +}; + +static int deflateSetHeader(z_streamp strm, struct gz_header_s *head) +{ + (void)(strm); + (void)(head); + return Z_OK; +} +#endif + #endif /* COMPAT_ZLIB_H */ From patchwork Fri Jan 10 12:55:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13934515 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA52D20DD53 for ; Fri, 10 Jan 2025 12:55:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513742; cv=none; b=ONt3hdn4Y08ZsK5qbBl/tvGYbUt1v7p7lTC0OOIrRQzveKaYRQyFO5C/v1gJKZDHM1NjlHt9MVq5YatEvohNV0REZWrbuTs9ckFZwtmV2XXsjpvyA2IBtMvtJeZdomw+nyFFD7LhMHI7xWPJwqFhyte+tbFOO0LR2AqxbGqR15g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513742; c=relaxed/simple; bh=VkGmP6dtna8AcsPGfi4wX9oGLHnNGeVUKdAxBiXayN8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T6gBfQhYXLfHcWSGct6/VxpZHUnKFLmZpTCnEePu+9BCdp+6Hp8ky+PWkqXFWdOUjD/3k/msy7ulcLjQgNITLoP5b8xYPtsYEES6UZ20Ot9NgyEnZL98z5lkaCnM+vkIUgtJjpUyyeT2jqwlChfob8W0DrPnYe0vHPge/gFOfn4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=GmcUSqoV; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=EmdTO16/; arc=none smtp.client-ip=202.12.124.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="GmcUSqoV"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="EmdTO16/" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id D9CAB1140114 for ; Fri, 10 Jan 2025 07:55:39 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Fri, 10 Jan 2025 07:55:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1736513739; x=1736600139; bh=ScrNkVQUeuyxBdib3D1Kk/Ec/D4iPbHuoTN7kjIx73c=; b= GmcUSqoVFONUODtFUAwp1R2UNymJ5rmP7n+lx+d50YfOoI0IkWBZ20CaZfEi9BP/ wB1ia1DVEmO9vJf8RHGFKlrsfEq+jO6FQAn8YqJZPs5ZdCiQHxPDbOxCIVrmSQT1 UZ57yK5V5iC/+ExnC0S8sPYnkGG21f2jYuW4WDfU0P4QUDiAfaqd727EmWqhIJfB +E5cpAgvow+/KR6QJcAl56VaaIZaVNQGLIn2vMWFIRzwV5YUBlZiQmhxitVpPH87 qj40rJRjwRo93Nqbhm5J+5jP0QwYnZmdqSnpFMxTrB809gcOFvVNjfLbhc8ubqRB wf7OEUBrAeSqneuwTJ2GcA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1736513739; x= 1736600139; bh=ScrNkVQUeuyxBdib3D1Kk/Ec/D4iPbHuoTN7kjIx73c=; b=E mdTO16/WYUczfKwHnnZKVge1ZORHDcgccU7rNhB30e8Fc/irhxmeIpDHSjg5bstw vC0VO9Bd7CVbqMHg23mtnFEDEE7gLF+PaF4TuyO2q91sChn4RuzibOr9gpFt8UWm 3p2jHvCDchO3TZUKeTjsADYg4VDc0b1GiubG2pGLUwkSUjAhsWdq3DyYHsuDPfgj 7SaUYrZZFLTkPsVuB9cmCzD+7WBFGVCSlQpYh6BJ+JzX7nN4cL0w+1XPpsbqsYhG lgXwnXkKrcUGOjOWPXgVdUF9ICHtzwYqHAvbMlwH4DZVj9vhqFObPF8PtgHdTJYG ouk/gMw5YjU01x0CVBLRw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudegkedggeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithes vhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 10 Jan 2025 07:55:39 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 2146b095 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 10 Jan 2025 12:55:38 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 10 Jan 2025 13:55:34 +0100 Subject: [PATCH 7/8] git-zlib: cast away potential constness of `next_in` pointer Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-b4-pks-compat-drop-uncompress2-v1-7-965d0022a74d@pks.im> References: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> In-Reply-To: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> To: git@vger.kernel.org Cc: X-Mailer: b4 0.14.2 The `struct git_zstream::next_in` variable points to the input data that and is used in combination with `struct z_stream::next_in`. While that latter field is not marked as a constant in zlib, it is marked as such in zlib-ng. This causes a couple of compiler errors when we try to assign these fields to one another due to mismatching constness. Fix the issue by casting away the potential constness of `next_in`. Signed-off-by: Patrick Steinhardt --- git-zlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-zlib.c b/git-zlib.c index 2e973320c232438cce7c83e25cc60a6b773670fc..519b3647ac8c55e66b00f46242a6e17fe6b600a1 100644 --- a/git-zlib.c +++ b/git-zlib.c @@ -59,7 +59,7 @@ static void zlib_post_call(git_zstream *s) s->total_out = s->z.total_out; s->total_in = s->z.total_in; - s->next_in = s->z.next_in; + s->next_in = (unsigned char *) s->z.next_in; s->next_out = s->z.next_out; s->avail_in -= bytes_consumed; s->avail_out -= bytes_produced; From patchwork Fri Jan 10 12:55:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13934517 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CAC920DD6D for ; Fri, 10 Jan 2025 12:55:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513742; cv=none; b=uqk11S8cMoNyKIo3k/7IJCwjg+s5dZvOv+yQvckKOfqmy5JwVyHgR8c5YF379TfwtoJY3yIw+hHtyw/7RcfD3GODt+iK3Dz4Tw4nqQQRSYkzgu9339PmxxpfvNdVfT13zRa2jpeSg5eaukcYUFFmf+StM0JXQczOJByuyzTCvoM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736513742; c=relaxed/simple; bh=ktRXCLekCxmku6R6y+zcQ445wnIchyEm4JWknCEM8ao=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kcChgW8vQ99NW/0l8TWs21wyA8xYtSzmXtdvlTMaJL7QHFEbetqzDrQBC66WlHibgrk/w4rj/jI25/1/3ZAIE3xyDdXMz5EaXWt+jeTXvm6989YSNXXR0BazDAEvLWEqyAG4XdU6//1WyMOTcrMi48T/uh4cKOH+uvnPNOJuNCM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=PAylcr2T; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=N+KFv9pj; arc=none smtp.client-ip=202.12.124.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="PAylcr2T"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="N+KFv9pj" Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.stl.internal (Postfix) with ESMTP id 39A901140155 for ; Fri, 10 Jan 2025 07:55:40 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Fri, 10 Jan 2025 07:55:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1736513740; x=1736600140; bh=4FceCZ6i+H4mPWHUWqPArosKyJBgfOP6t3/XXDsJtfg=; b= PAylcr2T3XbdSDUsIT8loluhIpv/z9vN17CnWTth+312W3AvQ1WS0GeX+gBZTc6n bLhzyDEoZRGR8p0+jMmY8qlyM3gEiukQsdAIwF73d953vknR61ubFJOUk12SpXa6 rF1rWeo0CgG4oR7zV3ljvGwqPL4wffoR9KvJrGbKrwkaVHH+qCYxHANOpd0mMHT8 M+XVx7lbDvFoiEWudIWK3idJnpu1rZRvPOloSXKusrSSPsA+1lOFoNR/sR3/Mhw/ mH7bLpLEyj5dVDhSuvCNXbhuoNdKRgf8wtZ9owUpVQUkMS0lSt4D6cJJmHTbSx7P 8awBcex3SxSmGUs8zMl4tA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1736513740; x= 1736600140; bh=4FceCZ6i+H4mPWHUWqPArosKyJBgfOP6t3/XXDsJtfg=; b=N +KFv9pjmdUSHfSWTr4OOjg9c7TUXXmKovfqbIHxFNgOELneMUOC6VMJ/QCx8XBxw ZjrGJfzixdyU9xbP1Ye8E2Uqx6jiicqOG8/Wv40nDmNlA0SsW1vmtHe85hNIHN1B pC64AvdmRLUGdUMzfzUJ0o960tBz76salo3kNH581Bx2096MBZ41j4nx/ux9LMmw 25wTLScaxFOCOIM3DL5KaNyn+67W84W3Q8Nw6FByJDuIftcK027yuuMvyODAaHhL S8kU8J76YMP5W0JMtn2cPV6C7NgyQH5Erm3zUIqH1jLjFG7k8lt7eLa2C2oRTcPs xCFma4TlfZeEr8W9UNX4Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudegkedggeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthekredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepfefhueegle ehfeejkedtffehvdfhvdetfefgtdduffduveevteegueeutdekhfegnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithes vhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 10 Jan 2025 07:55:39 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id c3ad25ec (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 10 Jan 2025 12:55:39 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 10 Jan 2025 13:55:35 +0100 Subject: [PATCH 8/8] compat/zlib: allow use of zlib-ng as backend Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-b4-pks-compat-drop-uncompress2-v1-8-965d0022a74d@pks.im> References: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> In-Reply-To: <20250110-b4-pks-compat-drop-uncompress2-v1-0-965d0022a74d@pks.im> To: git@vger.kernel.org Cc: X-Mailer: b4 0.14.2 The zlib-ng library is a hard fork of the old and venerable zlib library. It describes itself as zlib replacement with optimizations for "next generation" systems. As such, it contains several implementations of central algorithms using for example SSE2, AVX2 and other vectorized CPU intrinsics that supposedly speed up in- and deflating data. And indeed, compiling Git against zlib-ng leads to a significant speedup when reading objects. The following benchmark uses git-cat-file(1) with `--batch --batch-all-objects` in the Git repository: Benchmark 1: zlib Time (mean ± σ): 52.085 s ± 0.141 s [User: 51.500 s, System: 0.456 s] Range (min … max): 52.004 s … 52.335 s 5 runs Benchmark 2: zlib-ng Time (mean ± σ): 40.324 s ± 0.134 s [User: 39.731 s, System: 0.490 s] Range (min … max): 40.135 s … 40.484 s 5 runs Summary zlib-ng ran 1.29 ± 0.01 times faster than zlib So we're looking at a ~25% speedup compared to zlib. This is of course an extreme example, as it makes us read through all objects in the repository. But regardless, it should be possible to see some sort of speedup in most commands that end up accessing the object database. The zlib-ng library provides a compatibility layer that makes it a proper drop-in replacement for zlib: nothing needs to change in the build system to support it. Unfortunately though, this mode isn't easy to use on most systems because distributions do not allow you to install zlib-ng in that way, as that would mean that the zlib library would be globally replaced. Instead, many distributions provide a package that installs zlib-ng without the compatibility layer. This version does provide effectively the same APIs like zlib does, but all of the symbols are prefixed with `zng_` to avoid symbol collisions. Implement a new build option that allows us to link against zlib-ng directly. If set, we redefine zlib symbols so that we use the `zng_` prefixed versions thereof provided by that library. Like this, it becomes possible to install both zlib and zlib-ng (without the compat layer) and then pick whichever library one wants to link against for Git. Signed-off-by: Patrick Steinhardt --- compat/zlib-compat.h | 36 ++++++++++++++++++++++++++++++------ meson.build | 21 +++++++++++++++++---- meson_options.txt | 2 ++ 3 files changed, 49 insertions(+), 10 deletions(-) diff --git a/compat/zlib-compat.h b/compat/zlib-compat.h index 2690bfce41caab2e9af7a09663d620f0ee5136a0..58e53927b227f8368c73a48f5e5dc84a223f0af5 100644 --- a/compat/zlib-compat.h +++ b/compat/zlib-compat.h @@ -1,13 +1,36 @@ #ifndef COMPAT_ZLIB_H #define COMPAT_ZLIB_H -#include +#ifdef HAVE_ZLIB_NG +# include -#if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200 -# define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11) -#endif +# define z_stream zng_stream +#define gz_header_s zng_gz_header_s -#if ZLIB_VERNUM < 0x1221 +# define crc32(crc, buf, len) zng_crc32(crc, buf, len) + +# define inflate(strm, bits) zng_inflate(strm, bits) +# define inflateEnd(strm) zng_inflateEnd(strm) +# define inflateInit(strm) zng_inflateInit(strm) +# define inflateInit2(strm, bits) zng_inflateInit2(strm, bits) +# define inflateReset(strm) zng_inflateReset(strm) + +# define deflate(strm, flush) zng_deflate(strm, flush) +# define deflateBound(strm, source_len) zng_deflateBound(strm, source_len) +# define deflateEnd(strm) zng_deflateEnd(strm) +# define deflateInit(strm, level) zng_deflateInit(strm, level) +# define deflateInit2(stream, level, method, window_bits, mem_level, strategy) zng_deflateInit2(stream, level, method, window_bits, mem_level, strategy) +# define deflateReset(strm) zng_deflateReset(strm) +# define deflateSetHeader(strm, head) zng_deflateSetHeader(strm, head) + +#else +# include + +# if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200 +# define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11) +# endif + +# if ZLIB_VERNUM < 0x1221 struct gz_header_s { int os; }; @@ -18,6 +41,7 @@ static int deflateSetHeader(z_streamp strm, struct gz_header_s *head) (void)(head); return Z_OK; } -#endif +# endif +#endif /* HAVE_ZLIB_NG */ #endif /* COMPAT_ZLIB_H */ diff --git a/meson.build b/meson.build index f1aac01f729efaf19e25b1f11505de49443d5326..aeb41c6c684a411c4bdcfa476d6a67e5c9bba371 100644 --- a/meson.build +++ b/meson.build @@ -777,11 +777,23 @@ else build_options_config.set('NO_PERL_CPAN_FALLBACKS', '') endif -zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled']) -if zlib.version().version_compare('<1.2.0') - libgit_c_args += '-DNO_DEFLATE_BOUND' +zlib_backend = get_option('zlib_backend') +if zlib_backend in ['auto', 'zlib-ng'] + zlib_ng = dependency('zlib-ng', required: zlib_backend == 'zlib-ng') + if zlib_ng.found() + zlib_backend = 'zlib-ng' + libgit_c_args += '-DHAVE_ZLIB_NG' + libgit_dependencies += zlib_ng + endif +endif +if zlib_backend in ['auto', 'zlib'] + zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled']) + if zlib.version().version_compare('<1.2.0') + libgit_c_args += '-DNO_DEFLATE_BOUND' + endif + zlib_backend = 'zlib' + libgit_dependencies += zlib endif -libgit_dependencies += zlib threads = dependency('threads', required: false) if threads.found() @@ -1948,4 +1960,5 @@ summary({ 'sha1': sha1_backend, 'sha1_unsafe': sha1_unsafe_backend, 'sha256': sha256_backend, + 'zlib': zlib_backend, }, section: 'Backends') diff --git a/meson_options.txt b/meson_options.txt index 89b01bad042b533b23e0e2b4b780ce152ee688c8..585cef0ab2a1061e16e05a2252e37adeb48025f6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -55,6 +55,8 @@ option('sha1_unsafe_backend', type: 'combo', choices: ['openssl', 'block', 'Comm description: 'The backend used for hashing data with the SHA1 object format in case no cryptographic security is needed.') option('sha256_backend', type: 'combo', choices: ['openssl', 'nettle', 'gcrypt', 'block'], value: 'block', description: 'The backend used for hashing objects with the SHA256 object format.') +option('zlib_backend', type: 'combo', choices: ['auto', 'zlib', 'zlib-ng'], value: 'auto', + description: 'The backend used for compressing objects and other data.') # Build tweaks. option('macos_use_homebrew_gettext', type: 'boolean', value: true,