From patchwork Tue Jan 28 08:41:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13952291 Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) (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 F145F18C91F for ; Tue, 28 Jan 2025 08:41:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053696; cv=none; b=E3OBlUlQOMIdeYA5KeH4pIf+Nwd6ma4XTrRKIKSqr2Q/z4UBskPthDcVE74qbkTtPUplAOTTzVbHeCRBXYC/qztd9vWJLUKXWG4k7p7Vnl+aRsg/0sojgCKq/YBCVQ1fOObgncpH1KFGTN5XfpLP4/MqmlJ3rmTseEl+tNucD+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053696; c=relaxed/simple; bh=FsQFbJtOec+Wgk/wib68HyD5Czlb5D6fbTZywVQ8GpY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P5wCXwY28aqThG3vTnhmR1cthJGa+vbq7dkxgouWlklwkXtWDbM8FRmsOc811mX7xSs4PWjq8EVd/HAv3KEpayJkuaeSwuGsltCypPwcVzG+Usp//saELiKm3d2oP3H4Udx8ndJhsBtB+8h4BnygZzuL7wGXgUQ7kSkepay7ILc= 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=AgaZOp0K; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=NKhfNsmI; arc=none smtp.client-ip=202.12.124.148 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="AgaZOp0K"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="NKhfNsmI" Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.stl.internal (Postfix) with ESMTP id D7C631140147; Tue, 28 Jan 2025 03:41:33 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-10.internal (MEProxy); Tue, 28 Jan 2025 03:41:34 -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=fm3; t=1738053693; x=1738140093; bh=ye8uSdYa2vZ5CKQbHevM5cNBg5UZo3j8hfxI5hgXlLI=; b= AgaZOp0K5rTbYZt2HhekN881mXIt3dKUlk47BRBWI0IJr+n/1x+nhh2hBMQzGAIv Yyea+lxF7ZYuZi159Xj8kY/RLGcpkc7uz9lWCNUDxsYpdNBbyvYHy2fqYh14qjBs WKYAJ9kBxrpvR8sEaM9/Gr7MjtBmKFWQOXT0i4twWBQMieHX8RHF1yB0nnEq+gVO vG04PzJ3TfDHOabHVoqYxnWDnAv/0sDFOMxHhJ6yQ1GfpX8I3BYNgtuINmqjkPYv VBrYlQnM9wcXWe9vSgewwlq0gctZK+q04X34aFzt1hWbmHdOYE5vJGvMSh81lqnj pCmmmHBw0blAT9A1Lh4IaA== 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=fm3; t=1738053693; x= 1738140093; bh=ye8uSdYa2vZ5CKQbHevM5cNBg5UZo3j8hfxI5hgXlLI=; b=N KhfNsmIFgvLlZhKwVz6m19T4z/hqy5P5DvSg/IEawVFrG3Y2wgIE4XQ4XP+IdIss lw2dwuvvUS/VPqFFOD6O/geK5kuBAVmvue2q2DStAjnyceam1bRP0My8bE7HeDYx 7+o8fNWmDrCgdLSCSBOBjGquOEutV4v0jVlHkqpgLnA3qdk6Hq3oRC3g0UfKWcTm fz+fk9qheYHXPMU+6kerhBZcRV1R10aiR8MCi5AdllBR1OZI0luUjOOcmNegCFZ8 vg4muvPVR9ehrmo8Sx/lHHcrUcmfqYAasLNj6JDpJnKZzPBtc0l1Uln02VMTp87I aUoy7hsPaIjSKxDuz7vCQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgudehieehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertder tdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhksh drihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteek udehjeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohgu vgepshhmthhpohhuthdprhgtphhtthhopehmvgesthhtrgihlhhorhhrrdgtohhmpdhrtg hpthhtohepkhgrrhhthhhikhdrudekkeesghhmrghilhdrtghomhdprhgtphhtthhopehg ihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Jan 2025 03:41:32 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 2daea82e (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 28 Jan 2025 08:41:30 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 28 Jan 2025 09:41:27 +0100 Subject: [PATCH v4 01/10] 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: <20250128-b4-pks-compat-drop-uncompress2-v4-1-129bc36ae8f5@pks.im> References: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> In-Reply-To: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> To: git@vger.kernel.org Cc: Taylor Blau , Karthik Nayak 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 97e8385b66..86c6c3d7ad 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 77a1b08048..0000000000 --- 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 e283c46c6f..d50f487c00 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 30d7a89490..12129a8b95 100644 --- a/meson.build +++ b/meson.build @@ -263,7 +263,6 @@ libgit_sources = [ 'compat/nonblock.c', 'compat/obstack.c', 'compat/terminal.c', - 'compat/zlib-uncompress2.c', 'config.c', 'connect.c', 'connected.c', From patchwork Tue Jan 28 08:41: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: 13952293 Received: from fhigh-b5-smtp.messagingengine.com (fhigh-b5-smtp.messagingengine.com [202.12.124.156]) (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 1B2431DDA09 for ; Tue, 28 Jan 2025 08:41:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.156 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053697; cv=none; b=FGbPL6QEoEtLhtTH6kKdiDO/VvIJqOfEz7zruvCgK7E1V3KLDxLqKSHfbKFMf/kcA4Tb9M7wxkFb7fSi0fDkMkiwhpG/XHMe2SSkdW7k7Zraa2Ugp5ItauQmKnHhzF1J16IJq612P6L8uSGW7aqnLZVsf4MB2YgeSXeaL8142Rc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053697; c=relaxed/simple; bh=bcERtp5CTujJnCyv2osmDwvtIWIgD37QpbVNEKQtW8Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M9T/Bmb+IOFILn6fJYC3GRp8LV3VVdHr7BHGWERUI9uVo/QjJXzlMBlXW+DckLczXyQUowfJjPiDjoxGufwcA86rYWld5dANanot5o/rWsRUbcI2fiyLIIhmxpBhGdvEWh8vBXVJgMr3IzoPwEeie4f7/Ob5mazmTjHx7+CLYks= 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=kPEeJnj7; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=FQLBNea1; arc=none smtp.client-ip=202.12.124.156 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="kPEeJnj7"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="FQLBNea1" Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.stl.internal (Postfix) with ESMTP id 2AEC02540225; Tue, 28 Jan 2025 03:41:35 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Tue, 28 Jan 2025 03:41:35 -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=fm3; t=1738053695; x=1738140095; bh=+q5iTlbbkTNZleju2hevzSbZuMfU/guOc2bXjkrp0tA=; b= kPEeJnj7Se3oyTYBHjlKTLdCqndENrdVYbjzBjnDgtLzeqknTVI8grbD3au2iInc DoI+3Q0RJmh1tKmTU9B0LcFn6LAJr0k0Y4mh0VaBAHojSB8ocZQZliQQ0JeJqp/k 33viJlsuRvZr35DhOiPStQbAYP5eYWvFe491X2Akg+sCJB5KZmn+U3bRA7ws0BhB s2c40oiFgih2+CZSC9Gg5HAPbAAfNwyuDD9km60AIAqveAfWSJY1GHWid3ndHtOG qNbS7X6iycLYYwyUdoqlRXIb/XvkqAgeVMVex0RdiovsjIkw/B5IxodN6mKWsbbZ G4VwnCsuv4gkYOUAqUzbgw== 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=fm3; t=1738053695; x= 1738140095; bh=+q5iTlbbkTNZleju2hevzSbZuMfU/guOc2bXjkrp0tA=; b=F QLBNea1jHDaUwM/BHHJ2tMbv3jKHSY4HxuVBoWOWkKyp+1WDH1no4xPKXSOa9Ywo n5PDYW7FM/Dw5S4+O3Yg8saHUhwq2iFiBRblZq+rDxuyjsUT0ON3BlEH+NoAhnNR x9KzTecGgGQ3V55a2zG7YBFVg5qdjzHs4FIMkcU41Rj/QPZJCNVZtM0SEDKQYsZv dKdimext/tx/x22MsA4eVzGs0FjSbXq7f/0cnF+eIUPOeqlP0nbRzC8rLe7GtY89 +qVtVXTt25Imtj6W3qyIXxoTX6w+lGX076sfnbj+1gCnKTbu7d8idiMdyi59GI7M opDASMkLuzb8m//yODvWg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgudehieehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertder tdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhksh drihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteek udehjeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohgu vgepshhmthhpohhuthdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorh hgpdhrtghpthhtohepkhgrrhhthhhikhdrudekkeesghhmrghilhdrtghomhdprhgtphht thhopehmvgesthhtrgihlhhorhhrrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Jan 2025 03:41:34 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id cab73eac (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 28 Jan 2025 08:41:31 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 28 Jan 2025 09:41:28 +0100 Subject: [PATCH v4 02/10] 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: <20250128-b4-pks-compat-drop-uncompress2-v4-2-129bc36ae8f5@pks.im> References: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> In-Reply-To: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> To: git@vger.kernel.org Cc: Taylor Blau , Karthik Nayak 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 d50f487c00..c4b4b372b4 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 Tue Jan 28 08:41: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: 13952294 Received: from fhigh-b5-smtp.messagingengine.com (fhigh-b5-smtp.messagingengine.com [202.12.124.156]) (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 820F81DDA36 for ; Tue, 28 Jan 2025 08:41:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.156 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053698; cv=none; b=lw+pcutYPQX9JrQL8bHWi7lcZQ0PnhL8DwrGMgVBSawcpVgqbagc/aR7uWYgf1VlsYCNwDKypGtFmqCdqt9Whqg/+xNm540cuzJ7VALnqj//93Dj3IzfBdWlo0QJ/7Gs4p8OsoEK4q/tX8rbCPqPUa+rdcm1rDKQPkfKzwHFWXA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053698; c=relaxed/simple; bh=0ESeJ/clcUxsa1/WrgwCxMxks+IRMjLX5BpUfAJluJU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oBssTRg642usrrR8wVt9b1Pr5KKFPoUr0do7hEAGddx9hEmWQt0gM7cZVmBvNGpyUuROZTKMYfrFf9YrLoxR8YIXztmyBIZyWygTb0vU3Fx7WvBWexuKoIaXfJFZSoPoxLFwun9VyEb05mgUDAXOVtjxJXODDVPHcPV/SjnUj88= 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=QrMUtx79; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=SM0I6RWS; arc=none smtp.client-ip=202.12.124.156 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="QrMUtx79"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="SM0I6RWS" Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.stl.internal (Postfix) with ESMTP id 94318254022F; Tue, 28 Jan 2025 03:41:35 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Tue, 28 Jan 2025 03:41:35 -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=fm3; t=1738053695; x=1738140095; bh=dU3Nw17EkYC+I6bOmnksW6voTrbRYNVUBehKMUaRJtg=; b= QrMUtx79ouPn4ht3ueDEuU8tzpixqOBe82H6Z9J5DWP4rtR3o40k/k/dmzNk3Hgs rtbRIZvg/SdSS1JF9movVWu0Xiu1zu+UWamSvhAYWcakzbztM+1T5yH5AIs5Jvv3 Zw5n76yx3d7rlpPugJsqJ16mFbq1GYX7B0RxdU7rQ0WqRkj/jGbr7R0MpCibvfXJ uJarrJMRdZI55GhfbwRL9DvahAkNX+oOOn01UJ3Z0nUjM53OnFkLJQFnqEa5rePM P1XqRDVWTJBp3NqAb9Y2LlYtcmZMNm/6kdlNlKwpmw96JVYfBdxl0JBKdKovY+V+ qE+o4JKIcylGAXOJRUyArw== 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=fm3; t=1738053695; x= 1738140095; bh=dU3Nw17EkYC+I6bOmnksW6voTrbRYNVUBehKMUaRJtg=; b=S M0I6RWSEbTBhQE4Z6OBQrArMoNnMdYxTyFvo2hlFihCgsGc+u5gPFvgQXX4GceNc Lae/2Uev1psSiBSOttdhldVtwQEqP6Jwx1VvomMtCV/fOV/8OHiVd57+b4HqHjLO i6KTrtxH9435+CYmL69/WIMRcBHfgnXnoZeaQPvKnLEBnLL2gyGEW8lErN2ORoL8 /DP2hGCecFUe9U2Vp8ulKKbwn+sZmetkXt58gBE9VmG2PFvMlnz8WX9hC6d+fq1v 0EmKlnKdB0PnFD4vOh2ZXiXARMUloi1gXtapbHvYg6QqQX2gR1PP9ThGly34ev2d KkU/n84FN+FhTK/+5YlPA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgudehieegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertder tdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhksh drihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteek udehjeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohgu vgepshhmthhpohhuthdprhgtphhtthhopehmvgesthhtrgihlhhorhhrrdgtohhmpdhrtg hpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehkrghr thhhihhkrddukeeksehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Jan 2025 03:41:34 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 424396f2 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 28 Jan 2025 08:41:32 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 28 Jan 2025 09:41:29 +0100 Subject: [PATCH v4 03/10] 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: <20250128-b4-pks-compat-drop-uncompress2-v4-3-129bc36ae8f5@pks.im> References: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> In-Reply-To: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> To: git@vger.kernel.org Cc: Taylor Blau , Karthik Nayak 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 0000000000..bc20b884ef --- /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 c4b4b372b4..1ca2671322 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 9858bbc7c5..bc9b079634 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 Tue Jan 28 08:41: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: 13952295 Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) (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 68F6C1DED6B for ; Tue, 28 Jan 2025 08:41:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053698; cv=none; b=fOPRz/O0V812BNqyP8ZS2QsgLTc8XVhydg+rdzr4O8iOvwF37v765re93Qi+idZ+Im6ecvLIUBxya3w+MeO5qoAPDIOkg36dJxzmmbc32LDEat5e1EW/KW8LRhjwCfwzkqIVqXwQxLiNRTPq56zKZvkYpXksAlJmvoDNrXJvfI0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053698; c=relaxed/simple; bh=ypt6qw+kA612FMG6906YUMzDrT0P0OkgVB2an3FEa7U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GkFIAchnYxxMlwD6cC7w2CWugVL/sCVbmnsXzMCxoUPDm/LRCKjFA82SQMBM9YtJgMwIA7hTk/mSTXDweAdaqIJu8OlhQ4o+CdaCvzVoxdjzC4/w0Rbut57rP0xnH4tC+2NrW92mKd9izQXL/TaQ8J6fihQn3BxYqnVOUcysa9g= 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=JdduHQcK; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=alzrN8kQ; arc=none smtp.client-ip=202.12.124.148 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="JdduHQcK"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="alzrN8kQ" Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfout.stl.internal (Postfix) with ESMTP id 8191F1140169; Tue, 28 Jan 2025 03:41:36 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Tue, 28 Jan 2025 03:41:36 -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=fm3; t=1738053696; x=1738140096; bh=uCwQBjTHtgJvAUT5JP82ZNSh0Ha7tkiM3vo5jrq4WPg=; b= JdduHQcKAqxYx5JqanzEaLTB1QfoWWzdwXu/cLuFiaAUmGCU+yEJzsCive9t+8I9 FeWWjkbLhp63iyFdq7I8ZRN8eRJa+Uacets5YDQEMc4DIhKUx+nq+7UfrP/Ikaeq /Or6Upmd+Mnjyp/lnKOGqgwGiSb6S7jsj7j5DiOHai5AH4N7K08BwmoCqE1RMzbU eyv4AIr4NBkOhIaDB7SKjjXaJsk7aCyOgiMFrZ9udwxl8jYqgMJKfsGuUWz44pnP PyuyOKit03l406sx+UgxDShflpdaGpmFrFL87lUnM9LtZwSmD/OqprP0CCIj1WIU t2f8rIz9I0TVeWzBB9nNTg== 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=fm3; t=1738053696; x= 1738140096; bh=uCwQBjTHtgJvAUT5JP82ZNSh0Ha7tkiM3vo5jrq4WPg=; b=a lzrN8kQzysQfFHBBLsKiY1q7qWASnj+ScA5AEjSGAxrGASzNxMxlfH2XOCetNEz3 4A3Z3sqzfUuNHSYMQg+sGne2bM3iLEi+Czz0TJbjV1kogPh7ChF8KK4ZJPH5BcSn CCrdcRvhf1sruNZS6fZXv6XGMBdGDDwKg96ffXnt0nbiW3Thu5KLoBouj7hZTrb4 AJaIQYlGGdqq4yfysuwmKKd6oh1ZBrpnCgQmodtXTH0SmM1QLOsvp1kIUreWC7Wx w9NgS3W3d+X0YwehPtfmg2X2kcuAqs+LoY2W367GUxkiN2kUsJYdALsw92yNsJ1G XynRbbP33wtWj/Qc9scHw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgudehieegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertder tdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhksh drihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteek udehjeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohgu vgepshhmthhpohhuthdprhgtphhtthhopehmvgesthhtrgihlhhorhhrrdgtohhmpdhrtg hpthhtohepkhgrrhhthhhikhdrudekkeesghhmrghilhdrtghomhdprhgtphhtthhopehg ihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Jan 2025 03:41:35 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id d43129ad (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 28 Jan 2025 08:41:33 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 28 Jan 2025 09:41:30 +0100 Subject: [PATCH v4 04/10] 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: <20250128-b4-pks-compat-drop-uncompress2-v4-4-129bc36ae8f5@pks.im> References: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> In-Reply-To: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> To: git@vger.kernel.org Cc: Taylor Blau , Karthik Nayak 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 b9c200cba6..8be4e7ac8d 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 50f2d17b39..36f76fafe5 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 5716016e12..78e04356d3 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 8389a27270..e5b361bb5d 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 1ca2671322..fb25fbf503 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 d8a670aff9..1e8d9aabcb 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 bc9b079634..38e3081c61 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 5274eca1d0..f194a38686 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 Tue Jan 28 08:41: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: 13952296 Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) (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 E35561DEFF3 for ; Tue, 28 Jan 2025 08:41:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053699; cv=none; b=ZuIau9pmooHzMYx4fRgYJNhLR+HY9LcSWuvgl3xotq+4IPRhvHX4Ku8+sIahkHfRUOnajSsX6FM3JevOWUjLvOK7gx/2Cer7/y/1ktxrp6qjvqz2C4L6qSNwRQrfUV+ZylphIWDAl0/ZhQ+gTBWdXp3s0Gx9cxHixONiv0p+OY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053699; c=relaxed/simple; bh=WkNRQ5OP8InFmb7RaZ1AgZ9Am+mQ+ESi1PLWumZBAEo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RC1o71hpchXF8hPQO20c00b/P/0a6iSL1D6Mx5Hx0H2QeYL7JqydhWrRph9hhP+684P0xPiUq73Wk7cQOh8JGHVgtLDnOmIQnwDX9MSLAKEUjhnEUDMjB56vRciTWSzP30p5T4gp5tFCYOh75Y71Ogp7yZ6MM8NdiU0W3Ie/+7c= 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=eIvzLDtB; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=gWeaGHot; arc=none smtp.client-ip=202.12.124.148 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="eIvzLDtB"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="gWeaGHot" Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 0EDD11140147; Tue, 28 Jan 2025 03:41:37 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Tue, 28 Jan 2025 03:41: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=fm3; t=1738053696; x=1738140096; bh=EOpwSWjj8DXYLilpD/esfIidbFB2onV3Kcr5xCru00o=; b= eIvzLDtB/f4WgaUwPCUIThkVW5OVSuVbdcdcH6cPwbP0VaVaaPpUTqws6JRQmUkF URockx5/W8v7J3wo7WIiaHkCBK2C8EbkyxMsL8gKfI0m8nu+C1cAyw2hiets4Kxy 5gS8kCcwPP5fYhoYIMMYnM+yb1tTeNIHWlZ1IA44rxOedHMN+AF/FR46vMfvins3 wVabCsO0QR+xY499Xa4dZU8nc8KOBxAL6xH2pKkuEL4iGhqCwK4Jcb3sfBT5MRUq nL8367OAHKLYYsOtm8UEfUJvd5HoyK4jxwUi8c1RISXuL52wdJMEe4wgRL4d4AKB BT6DMrEYtW6hPn4KPxywWQ== 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=fm3; t=1738053696; x= 1738140096; bh=EOpwSWjj8DXYLilpD/esfIidbFB2onV3Kcr5xCru00o=; b=g WeaGHotGN7H0ZVeQRxGXm1IRjamPHHvJyV6DLhsiIeuCRHH+4F+NevqlrVJmymPH /h9tpNIxQR/ABKUCHR0qtDDFcBRVjzZSlDaeCUhxIRAIkMD6+3S510u6AUyfU8gh 5oQ4jPsoRDjBoXdQLCCNvsOcuxyYUYzG2uyublStrD++JXaeNwhwOtqAg9PYxSdl wvFViS/gUBCdtehTwac6Z93j1ss7a7HZ/O6zuX0yQCzZVspTvVDYKE49qIvXua40 uCAlSlSjLas5TVLhBK09SifZXswSBswFrbjC+SgU/d3C3jSMbt3KXuZxfFptQ7/C GDBJwF3qLqGafDX1FjvlA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgudehieehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertder tdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhksh drihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteek udehjeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohgu vgepshhmthhpohhuthdprhgtphhtthhopehkrghrthhhihhkrddukeeksehgmhgrihhlrd gtohhmpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehmvgesthhtrgihlhhorhhrrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Jan 2025 03:41:35 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 6676bfcf (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 28 Jan 2025 08:41:34 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 28 Jan 2025 09:41:31 +0100 Subject: [PATCH v4 05/10] 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: <20250128-b4-pks-compat-drop-uncompress2-v4-5-129bc36ae8f5@pks.im> References: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> In-Reply-To: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> To: git@vger.kernel.org Cc: Taylor Blau , Karthik Nayak 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 bc20b884ef..96a08811a9 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 d43bbeb6da..2e973320c2 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 Tue Jan 28 08:41: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: 13952297 Received: from fhigh-b5-smtp.messagingengine.com (fhigh-b5-smtp.messagingengine.com [202.12.124.156]) (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 86CD81DF726 for ; Tue, 28 Jan 2025 08:41:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.156 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053700; cv=none; b=nfFYh6kw2NfszyV8xUkpVDLb7oP1yoeXNJMNTDPrxGCNpWlbpovBeYeLdAm0yIyScjO4yBJdOOP9plvPXXG/MIb6es3Ha0xZEkx1xcDGcwlrwCslW3ohgkahEUzGWB2p9E1otMpx0YbqYDzpP+cwI30OgcjKqYOwQBR+/HNCkfE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053700; c=relaxed/simple; bh=zZGXGDizTU3E9EbJ+rPAfP9sgckuNAVodGZ+YTvJKQQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b8Gio7kVDSxQrnROQTbzSM/4SVG4qtK7q2LjEkncwopckbArS4n5AotI7Qf5TE9X40MBZmRh87mVsh98euLMEzY33egTCgFafXrdmvY3Qu1JKnRoFoHJ32ovuyDUcBrg880p3JbFdFetcBkER1O3BHoJ8i9YtA+LnJPDI8wndc8= 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=hV0fdO5t; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=HtkEVvDP; arc=none smtp.client-ip=202.12.124.156 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="hV0fdO5t"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="HtkEVvDP" Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.stl.internal (Postfix) with ESMTP id DBB162540232; Tue, 28 Jan 2025 03:41:37 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Tue, 28 Jan 2025 03:41: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=fm3; t=1738053697; x=1738140097; bh=6wAnyBP8fE54KLvjAXJrtArARqhzZAYDfe0IH5trm/Y=; b= hV0fdO5tdNCNjKIxTc5UBtFzsKAr2AylQwJbW5s8n8ladNnBI4XhfKotqChvLE6n 3TnP3mRO1rez+3KDpuU4zWHfV/csuB2sLAAN9eFuczcZITRovPD1eZEmnRl2w3wR Ko1+iSdNhNKY4QNgEwHCa9OS7RqH40mpXiKFGMOv/lZu2NMDdoX6Y7mv1R2Qxnp9 T698tAjLiwjHkPyqh9IVSLHMB1dkcym2dIhHpPqWyTzC1/tLSb7I0KAqVwf2Hxgk 3BdoNZjoLJd49DKpa4zdbSklTo10rxqfiO0EZgEmp1xFVFM0aukhG50poPn4AC4l rdlrk0HwCQW4m7ImlQjolw== 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=fm3; t=1738053697; x= 1738140097; bh=6wAnyBP8fE54KLvjAXJrtArARqhzZAYDfe0IH5trm/Y=; b=H tkEVvDP29R3sNtdYAn0iJF1QTbY0pSU6x0uCDJ00T+0hoJWL7fvXGLe8vcVas3Hq Ptxj9RAu7LPPlFfA0v5lmwm5M3q6vc1XvEMhS9cWMr6E/o1mxP7O2HtzaWgW+gfn 5xReVqI9cvq5Dg39gi1tjM2zzPNpq1D2IAcYGHLhtsaXCY0WIiMlvoACwZRt6kKD WBKvxmdihO755aWDro4fwAHngkdHxIBoikgDqr6H6JAYbn11TBW35kTNfkks5sbv FarFIUHccNsXxG3nYrFb391cKjBmtKcKdBAa0tKXy6o4gUVWNUZv08AS+wSa6O5u N2+DgKLl8VHUnIUx2uXyw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgudehieegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertder tdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhksh drihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteek udehjeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohgu vgepshhmthhpohhuthdprhgtphhtthhopehmvgesthhtrgihlhhorhhrrdgtohhmpdhrtg hpthhtohepkhgrrhhthhhikhdrudekkeesghhmrghilhdrtghomhdprhgtphhtthhopehg ihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Jan 2025 03:41:36 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 50aed50d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 28 Jan 2025 08:41:35 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 28 Jan 2025 09:41:32 +0100 Subject: [PATCH v4 06/10] 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: <20250128-b4-pks-compat-drop-uncompress2-v4-6-129bc36ae8f5@pks.im> References: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> In-Reply-To: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> To: git@vger.kernel.org Cc: Taylor Blau , Karthik Nayak X-Mailer: b4 0.14.2 The function `deflateSetHeader()` has been introduced 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 | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/archive-tar.c b/archive-tar.c index e7b3489e1e..0edf13fba7 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 96a08811a9..6226b30c0c 100644 --- a/compat/zlib-compat.h +++ b/compat/zlib-compat.h @@ -7,4 +7,23 @@ # define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11) #endif +/* + * zlib only gained support for setting up the gzip header in v1.2.2.1. In + * Git we only set the header to make archives reproducible across different + * operating systems, so it's fine to simply make this a no-op when using a + * zlib version that doesn't support this yet. + */ +#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 Tue Jan 28 08:41: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: 13952298 Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) (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 6D0851DF74B for ; Tue, 28 Jan 2025 08:41:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053700; cv=none; b=YVhfDyqydaSCH0zb/dg+7rNxYsWGkpQ424veKvgQzb8mlckwWsJiqQgZ1pGiOQOAboSFNCfHvwktidKdMw1YgRp17jUOeJOciftn7O2tthCMnd1ToPV5mYtbJx4wCgoSIAsfmwkaZotvzN8iADGH2a3F0rFFACSeX6b7B6D1/9g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053700; c=relaxed/simple; bh=121J9JWOr5jf0VhEvcgwA57p85egwHpHhICEV7Ps618=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XUw1N1qdI+nhMHw+EXx/LaSh3gWWdiCrdRV9APuHAfeBPB3mG9cQXAK/3W3hV7qYmucziKYgzux+7V7yQxtDvhd3Mqn8LMXUMsUBqB9bCF40iP9nncxIW68rvUIOa/FWpyH6AocQrJOXhlRN7qsWtirPUKtSydPOwEjh+PzDFjA= 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=pGeTXwjS; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=HIFn/9lS; arc=none smtp.client-ip=202.12.124.148 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="pGeTXwjS"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="HIFn/9lS" Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.stl.internal (Postfix) with ESMTP id 7CCD111401E3; Tue, 28 Jan 2025 03:41:38 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Tue, 28 Jan 2025 03:41: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=fm3; t=1738053698; x=1738140098; bh=/TKmkuRQ8fCGfId8LqblSiLznYgf6b2p18zJFiaqnJA=; b= pGeTXwjS/pVZVFNLZnPEWZgEeK96QUZcZJ0qRZ1eq+aVUPsQSYDBLcvF4ByrSn+e 26c/sQ2snyTR51vS0islWoeWhO66OC/7lT14fgNkcHfq6lO2AvFGcFlSQgKdTvj2 ciD13/sR3Q87thg1MhTUGVThgRhaSBtV70osch0IEfKFfyVBj4cfEcfHWk9bCKV6 nTBRawTOhRjPDqu5z6UZ1ptypzwGbFtPhma41IYvCq5lSc/nRiw8PZ3iq8/Pxl1s wN9G4glYqUvRQNhvM3OlANeX6TORMq26HGfbS9Esyq5kieWbRxUV5kcXsatDZQtU g/mg+7JYoKwljB8srUR4Jg== 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=fm3; t=1738053698; x= 1738140098; bh=/TKmkuRQ8fCGfId8LqblSiLznYgf6b2p18zJFiaqnJA=; b=H IFn/9lSD0oo4VoWGGmhnnpJUeyrgIm2AQTU6dIqgrzbxExeODLLLk//LIdd5jYo+ PRTnLMRtcTmsV+wEv7qC8LbgnSvnt4q5HryCcxz+Bjw1eQT0oeVNzCnhMb1BqfEp L4jPulUqjIbgBUuud8sbjPjQl9zRs8+FOQq+sHGkb/8fVfT1zyvoRmsKY6sah15h b1ir3N6/9BaQkHh3qAuAXwRaoMQHS/v2Cew8FxvNSUNFEG41yXJaOdoMA/9ukn4D lCUGwLxAKVnQEp/LAv/L4mPOnq2jDe7HUitFxcJDGkPFeU+U5A+W3a2FCq7m4L/P ReMzPecNgJjicMV3LwNgQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgudehieehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertder tdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhksh drihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteek udehjeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohgu vgepshhmthhpohhuthdprhgtphhtthhopehmvgesthhtrgihlhhorhhrrdgtohhmpdhrtg hpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehkrghr thhhihhkrddukeeksehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Jan 2025 03:41:37 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id e90ea057 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 28 Jan 2025 08:41:36 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 28 Jan 2025 09:41:33 +0100 Subject: [PATCH v4 07/10] 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: <20250128-b4-pks-compat-drop-uncompress2-v4-7-129bc36ae8f5@pks.im> References: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> In-Reply-To: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> To: git@vger.kernel.org Cc: Taylor Blau , Karthik Nayak X-Mailer: b4 0.14.2 The `struct git_zstream::next_in` variable points to the input data 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git-zlib.c b/git-zlib.c index 2e973320c2..651dd9e07c 100644 --- a/git-zlib.c +++ b/git-zlib.c @@ -59,7 +59,8 @@ 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; + /* zlib-ng marks `next_in` as `const`, so we have to cast it away. */ + 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 Tue Jan 28 08:41:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13952299 Received: from fhigh-b5-smtp.messagingengine.com (fhigh-b5-smtp.messagingengine.com [202.12.124.156]) (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 3A9741DF971 for ; Tue, 28 Jan 2025 08:41:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.156 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053701; cv=none; b=SjAo/KBvtEzEo2r5aWNlxgvY40hj1vkZIJzZ+nJ415iR1KWzyitZosKvLMtgovgsI+UZaCyAXBVvrstFvUAd40JuJA7WuwQAdKAtaj6I9wlqKHkcg//gYOsvco8U4JRF+ImhYUtw9ANjyIR9+hz0a0HOYO79mXarg8AVkgGB2M4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053701; c=relaxed/simple; bh=0sQvRDOnxc4CAbN2nOgc5ogwgdxthBo+EgFsxuXdG1U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TXA/5KzQZ1TOAokv6JST7QlmsuYyR5ax+apM6MpoOH58Qya3Eu2EWunozJY42PVZoQl2o4xX4HCgV4rTOCvDu7heKYGmvQK/kVKwMICjv+88XhsCGItq134e5xAj1+gefDBaIken129FZFpGk0w1MbtsGqdlGbgKRzCsXPnXI68= 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=fXBBqdWP; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=iTmDAlrl; arc=none smtp.client-ip=202.12.124.156 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="fXBBqdWP"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="iTmDAlrl" Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfhigh.stl.internal (Postfix) with ESMTP id 4F8252540088; Tue, 28 Jan 2025 03:41:39 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Tue, 28 Jan 2025 03:41: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=fm3; t=1738053699; x=1738140099; bh=QSLZg8fjtFHeULyURPF/B73qmCEuppLbEBN08YOOJds=; b= fXBBqdWPQl1z53+8GfMDqCEgJDTyHPGgicnwh3WuhNbHtx9YdjYsGOD3ektrFyIK ThoJB0SJU4K6NtfnxRPw8RTR9UCDngnAnndnoLKHj5WDmnNNk/uGlkRqVwMU4b4X rO0hQ4ib0BliRfPLAMPcFffbOEa5hRxfTICNqaqQo7HPVJxC0rt1ePY7ovyHkN7n 7FAQ/1/2KTtFhyNJPuv3cpBJEmehfYEK35dNyuR25x1sWEiPKHtlsloetsV2pYDo ZX9dbsFCVQyY/WIR2Rj4AqFC//NpvHSahWckofCVtWmqCQDn2I9EfGsSe9y4HMjH ucp2Y3QpbhsFceeku5xvXQ== 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=fm3; t=1738053699; x= 1738140099; bh=QSLZg8fjtFHeULyURPF/B73qmCEuppLbEBN08YOOJds=; b=i TmDAlrlfWTueafdHURDbA7guGTeIcbj25KF5cUYcFHSqxI7fjjfeaxE4QtsgxIqg kZilC+T4g9bmNphX+e1uGs4xAZDfjRDhboZO9jth1Hz4P3Me5yR+3FRNfmIlKjrI Xx0x3Fyj3B5W173d1ljmOwjUE+auG+9cTC3wrFPnno/pEUedSDUHhAJua7sgi7Ms uWYfKbykPHfFugmesp9oyZ2o/Hn0jLGpEopggx2kD6UXE8sgfn6qPwXYaWsA9p8P 5rPzBdpmSk7KGROsLMTILOrnwFOV8n/m0gYEAveUupPfL8ZN347jNvQ+IW2W/IWj 34RhMZ/PdCSHX1ZFA+G2A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgudehieehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertder tdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhksh drihhmqeenucggtffrrghtthgvrhhnpeejffelleeftedvffegteeglefhteejudeuhffh veeivdfgjedvteelgeelhefgfeenucffohhmrghinhepghhnuhdrohhrghenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhm pdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehgih htsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhgvsehtthgrhihlohhr rhdrtghomhdprhgtphhtthhopehkrghrthhhihhkrddukeeksehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Jan 2025 03:41:38 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id adcc4ffb (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 28 Jan 2025 08:41:37 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 28 Jan 2025 09:41:34 +0100 Subject: [PATCH v4 08/10] 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: <20250128-b4-pks-compat-drop-uncompress2-v4-8-129bc36ae8f5@pks.im> References: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> In-Reply-To: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> To: git@vger.kernel.org Cc: Taylor Blau , Karthik Nayak 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 --- Makefile | 20 +++++++++++++++----- compat/zlib-compat.h | 36 ++++++++++++++++++++++++++++++------ meson.build | 21 +++++++++++++++++---- meson_options.txt | 2 ++ 4 files changed, 64 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 86c6c3d7ad..1853e6ddfa 100644 --- a/Makefile +++ b/Makefile @@ -183,7 +183,8 @@ include shared.mak # byte-order mark (BOM) when writing UTF-16 or UTF-32 and always writes in # big-endian format. # -# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound. +# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound. Define +# ZLIB_NG if you want to use zlib-ng instead of zlib. # # Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback, # as the compiler can crash (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299) @@ -1687,11 +1688,20 @@ else endif IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO) -ifdef ZLIB_PATH - BASIC_CFLAGS += -I$(ZLIB_PATH)/include - EXTLIBS += $(call libpath_template,$(ZLIB_PATH)/$(lib)) +ifdef ZLIB_NG + BASIC_CFLAGS += -DHAVE_ZLIB_NG + ifdef ZLIB_NG_PATH + BASIC_CFLAGS += -I$(ZLIB_NG_PATH)/include + EXTLIBS += $(call libpath_template,$(ZLIB_NG_PATH)/$(lib)) + endif + EXTLIBS += -lz-ng +else + ifdef ZLIB_PATH + BASIC_CFLAGS += -I$(ZLIB_PATH)/include + EXTLIBS += $(call libpath_template,$(ZLIB_PATH)/$(lib)) + endif + EXTLIBS += -lz endif -EXTLIBS += -lz ifndef NO_OPENSSL OPENSSL_LIBSSL = -lssl diff --git a/compat/zlib-compat.h b/compat/zlib-compat.h index 6226b30c0c..0c60e3af33 100644 --- a/compat/zlib-compat.h +++ b/compat/zlib-compat.h @@ -1,11 +1,34 @@ #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 + +# 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 /* * zlib only gained support for setting up the gzip header in v1.2.2.1. In @@ -13,7 +36,7 @@ * operating systems, so it's fine to simply make this a no-op when using a * zlib version that doesn't support this yet. */ -#if ZLIB_VERNUM < 0x1221 +# if ZLIB_VERNUM < 0x1221 struct gz_header_s { int os; }; @@ -24,6 +47,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 12129a8b95..f9e6a051e0 100644 --- a/meson.build +++ b/meson.build @@ -792,11 +792,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() @@ -2001,4 +2013,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 5429022f30..c962c0a676 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -57,6 +57,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, From patchwork Tue Jan 28 08:41:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13952300 Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) (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 E11841DE4D6 for ; Tue, 28 Jan 2025 08:41:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053702; cv=none; b=uvBVDON0vV0SaYWjD72dzuoJBRBtuxjWQ2lcK/U2JsaKUd8X2FlD60EpULFMQ6JFvRhEfno7YLiMMp0RPdN5cPhjRykuA/B4wpYH9B19i7BYne5t9i+tI5qJnZDNtB2oA24R3x+W32eZWTqGJE+OTZaqklKnwhw8R2aqbE71lgk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053702; c=relaxed/simple; bh=pDVeIUOp8RhsvXDDwNaHQn5xHR5ZrDvGFX4F10o7/7g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JORCZsW2Ra/r1jqV7r19ZZslBULe4u1EFQXJKlAWqU3daQrGHHxbqkADgn0ZzaR0mYA790VmGVRZ79lJ7adiVdvlU6/zNauJqgsol98TLsKGgLWmzsfVuUlDz40yaB8Nep5pq4Ah5EKcaE8kJrJn5K3go7BAUC+lGGN3jnRz+Fs= 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=RtcLIsmF; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=idD1F5l/; arc=none smtp.client-ip=202.12.124.148 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="RtcLIsmF"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="idD1F5l/" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id E675411401E8; Tue, 28 Jan 2025 03:41:39 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Tue, 28 Jan 2025 03:41: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=fm3; t=1738053699; x=1738140099; bh=pqmoFcF7JhWM5WQL7oNJTmdZpvbSHk1K7Q4V+gnomUg=; b= RtcLIsmFshee6NpQBQ3WOdcLdP41+6H7y3SoIgzo+xLpNZ+eUVxofnvX5UJeBD/F IysoVOgR7Ql2OfegQAXWBo5KPCVwReP8p79axFneHNBxBeLCF9cTvEWj2HZ32ffO k52vIsTwp6cKBFjrRue4mCYI9LrlA+FEpYX8kDO01qNkUk8tHvs44mlihXR/28wW SuFPRlaEct6FfpPushCEkOMWzxQfkXW9z+N+7tHlWvxF1J27INrKnfGuRjTZgNYz 0u9PZYGCGs1EnCbhf17CgjUk1oTMTL9IXcNKzz5Iffrow+4MgYV8EyKeYDSyTOcv q02t540yfQsMDqMXWa1+bA== 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=fm3; t=1738053699; x= 1738140099; bh=pqmoFcF7JhWM5WQL7oNJTmdZpvbSHk1K7Q4V+gnomUg=; b=i dD1F5l/lM6sPtRXDGykP4ry93e3t4hKLSpLexKowTkDPVxqQf7lzM3M4Yo8PDqWJ 2vWVt60DzaGczUpG7i5dUeaNTRiBO5IyuRRPvLmAVetL8zZamHvbiSaxnsFXRPpU XdfIa4f7P6vh3d/Br1ft/rHkouhK226q6qGDaUIpa/rprS9pTAsYJk71p+PkmXaA KgooOoZdNKJ0kAG7RmrRIOyV03kuVe99nbmdJpIxGiyShBr1Nv9tLAVeNERbdJHC 5TBs6fW9e97PzflrenKlJXcEXgcRIroTxqINqN4o3K9iYj2QTvA68bNHJO3d7ysn yNU+JT/rnajB4TE4unJxg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgudehieehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertder tdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhksh drihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteek udehjeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohgu vgepshhmthhpohhuthdprhgtphhtthhopehkrghrthhhihhkrddukeeksehgmhgrihhlrd gtohhmpdhrtghpthhtohepmhgvsehtthgrhihlohhrrhdrtghomhdprhgtphhtthhopehg ihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Jan 2025 03:41:38 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 64a9be1c (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 28 Jan 2025 08:41:38 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 28 Jan 2025 09:41:35 +0100 Subject: [PATCH v4 09/10] ci: switch linux-musl to use Meson Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250128-b4-pks-compat-drop-uncompress2-v4-9-129bc36ae8f5@pks.im> References: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> In-Reply-To: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> To: git@vger.kernel.org Cc: Taylor Blau , Karthik Nayak X-Mailer: b4 0.14.2 Switch over the "linux-musl" job to use Meson instead of Makefiles. This is done due to multiple reasons: - It simplifies our CI infrastructure a bit as we don't have to manually specify a couple of build options anymore. - It verifies that Meson detects and sets those build options automatically. - It makes it easier for us to wire up a new CI job using zlib-ng as backend. One platform compatibility that Meson cannot easily detect automatically is the `GIT_TEST_UTF8_LOCALE` variable used in tests. Wire up a build option for it, which we set via a new "MESONFLAGS" environment variable. Note that we also drop the CC variable, which is set to "gcc". We already default to GCC when CC is unset in "ci/lib.sh", so this is not needed. Signed-off-by: Patrick Steinhardt --- .github/workflows/main.yml | 2 +- .gitlab-ci.yml | 2 +- ci/install-dependencies.sh | 2 +- ci/lib.sh | 5 +---- ci/run-build-and-tests.sh | 3 ++- meson.build | 2 +- meson_options.txt | 2 ++ 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7f55f8b3a9..83bf9b918b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -394,7 +394,7 @@ jobs: fail-fast: false matrix: vector: - - jobname: linux-musl + - jobname: linux-musl-meson image: alpine distro: alpine-latest # Supported until 2025-04-02. diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4976e18a05..f737e4177c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -67,7 +67,7 @@ test:linux: CC: clang - jobname: pedantic image: fedora:latest - - jobname: linux-musl + - jobname: linux-musl-meson image: alpine:latest - jobname: linux-meson image: ubuntu:latest diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh index d1cb9fa878..5ae80b0486 100755 --- a/ci/install-dependencies.sh +++ b/ci/install-dependencies.sh @@ -24,7 +24,7 @@ fi case "$distro" in alpine-*) - apk add --update shadow sudo build-base curl-dev openssl-dev expat-dev gettext \ + apk add --update shadow sudo meson ninja-build gcc libc-dev curl-dev openssl-dev expat-dev gettext \ pcre2-dev python3 musl-libintl perl-utils ncurses \ apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \ bash cvs gnupg perl-cgi perl-dbd-sqlite perl-io-tty >/dev/null diff --git a/ci/lib.sh b/ci/lib.sh index 8885ee3c3f..71d85ae85a 100755 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -378,10 +378,7 @@ linux32) CC=gcc ;; linux-musl) - CC=gcc - MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python3 USE_LIBPCRE2=Yes" - MAKEFLAGS="$MAKEFLAGS NO_REGEX=Yes ICONV_OMITS_BOM=Yes" - MAKEFLAGS="$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8" + MESONFLAGS="$MESONFLAGS -DGIT_TEST_UTF8_LOCALE=C.UTF-8" ;; linux-leaks|linux-reftable-leaks) export SANITIZE=leak diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh index 964322055f..643c6a9dcc 100755 --- a/ci/run-build-and-tests.sh +++ b/ci/run-build-and-tests.sh @@ -55,7 +55,8 @@ case "$jobname" in --fatal-meson-warnings \ --warnlevel 2 --werror \ --wrap-mode nofallback \ - -Dfuzzers=true + -Dfuzzers=true \ + $MESONFLAGS group "Build" meson compile -C build -- if test -n "$run_tests" then diff --git a/meson.build b/meson.build index f9e6a051e0..35b3c51fb1 100644 --- a/meson.build +++ b/meson.build @@ -664,7 +664,7 @@ build_options_config.set('GIT_TEST_CMP_USE_COPIED_CONTEXT', '') build_options_config.set('GIT_TEST_INDEX_VERSION', '') build_options_config.set('GIT_TEST_OPTS', '') build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '') -build_options_config.set('GIT_TEST_UTF8_LOCALE', '') +build_options_config.set_quoted('GIT_TEST_UTF8_LOCALE', get_option('test_utf8_locale')) build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir'))) build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb')) diff --git a/meson_options.txt b/meson_options.txt index c962c0a676..e9f8e990e3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -99,5 +99,7 @@ option('tests', type: 'boolean', value: true, description: 'Enable building tests. This requires Perl, but is separate from the "perl" option such that you can build tests without Perl features enabled.') option('test_output_directory', type: 'string', description: 'Path to the directory used to store test outputs') +option('test_utf8_locale', type: 'string', + description: 'Name of a UTF-8 locale used for testing.') option('fuzzers', type: 'boolean', value: false, description: 'Enable building fuzzers.') From patchwork Tue Jan 28 08:41:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13952301 Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) (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 5C1411DFD95 for ; Tue, 28 Jan 2025 08:41:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053702; cv=none; b=aDBv+O0z+544YokURL36Htw/86L0+1cH56mspR5HnNifNrziVwdbuBhZl7FJLGBkt4dnW4wK++xs7h7RvF0P8X7JeUXqK0SXjR/iNw4bAJXwFUlumgVsD/BRpYJdbH8B3wbxcStwGjm4NThrHD7hmQdNHYvRk+9XgHRXh5Y4N38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738053702; c=relaxed/simple; bh=wea3ymJk0/i//MLq1BgjUAkYzo3NBCJNoCmcTAGPYMk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IxdZ7z8lQEk2LdWo0N4d+m5eB73d6sXz2ouFj1nWNqpRo4YcT4+W+QM/ABAIcL8tciN/ErICN3MWTI/mW9jvvGrm2qQiSe31tXTts81+L0K+MqxA1rgyuKb3BzV1X93hRR7Bed3Fv8JXJQRkIzMB1jKAcJ7v5n9AiaAHA3MSV4E= 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=fJG6zkYR; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Mn4rA8+t; arc=none smtp.client-ip=202.12.124.148 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="fJG6zkYR"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Mn4rA8+t" Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.stl.internal (Postfix) with ESMTP id A6E6E1140169; Tue, 28 Jan 2025 03:41:40 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Tue, 28 Jan 2025 03:41: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=fm3; t=1738053700; x=1738140100; bh=MNmhqm5MzuHL8mwArKnuUyGInnqN8BoBPuKdduYohy4=; b= fJG6zkYRkDklhb5gm+dNi72aJmOnIe/lEGxtiZIQDN7vkBHZKDjxfO5BfhWTbw5E 8tYq9ZMhSB+GQF2xkM+T7PkTvqSa2SB0pEZQb16K79+8X42UM63jgjlf3Ib7e1ci PgEyh8Et3VdsSRh4AUcIoXjv97FEsFFpZ4qJsxj4ZtvCeqjgBE0IFKgdRDlAOVAx wiTjvlr8bFAmgL8E2t8YZ+D8KjZeBaIbfr6vSxOXFnW3s54m2h+qtccXCo3Nc+P/ W6w6cJ30TBM8z9NWaoMAuXBslpdQYyeXkkbO7aIrfs2SEQ9hXxSfMP5tSeb28yfM BX+nU4wTIg/iNcbj2mEGoQ== 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=fm3; t=1738053700; x= 1738140100; bh=MNmhqm5MzuHL8mwArKnuUyGInnqN8BoBPuKdduYohy4=; b=M n4rA8+tl2IdKDJGSuuXsAB0TgSPtfXSAVe3raT7XwUrsaLwPlfkyTjDbUW6Pgmus LqMTcHPj/MHpvJHKyzMBzjF7RN45HcoBPiGAcl5PF6vNLrNAc82hmF2FPuMKa6r/ NJo94Tx1Fj6+mt791wjQ6YAU6vWUu33Bi1GM6tGaNOn8KNSfrWgsLmc3MdgzfkuY 3wfL7UvjvioHZ/tBTbRE5inso0J62dbPz3xpfxebyxN5oczu6qQjsZT/LKhQzLbq zKYzInY27dQy3yhrtmolray9uWizWkl75CkNQ9yUAMDtcqGGiLLomel1NhUbLuLV CDBLQdM+Dj7kX2QEq4OTQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgudehieegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertder tdejnecuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhksh drihhmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteek udehjeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmh epmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohgu vgepshhmthhpohhuthdprhgtphhtthhopehkrghrthhhihhkrddukeeksehgmhgrihhlrd gtohhmpdhrtghpthhtohepmhgvsehtthgrhihlohhrrhdrtghomhdprhgtphhtthhopehg ihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Jan 2025 03:41:39 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 760e2178 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 28 Jan 2025 08:41:39 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 28 Jan 2025 09:41:36 +0100 Subject: [PATCH v4 10/10] ci: make "linux-musl" job use zlib-ng Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250128-b4-pks-compat-drop-uncompress2-v4-10-129bc36ae8f5@pks.im> References: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> In-Reply-To: <20250128-b4-pks-compat-drop-uncompress2-v4-0-129bc36ae8f5@pks.im> To: git@vger.kernel.org Cc: Taylor Blau , Karthik Nayak X-Mailer: b4 0.14.2 We don't yet have any test coverage for the new zlib-ng backend as part of our CI. Add it by installing zlib-ng in Alpine Linux, which causes Meson to pick it up automatically. Note that we are somewhat limited with regards to where we run that job: Debian-based distributions don't have zlib-ng in their repositories, Fedora has it but doesn't run tests, and Alma Linux doesn't have the package either. Alpine Linux does have it available and is running our test suite, which is why it was picked. Signed-off-by: Patrick Steinhardt --- ci/install-dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh index 5ae80b0486..be7ab4b1bf 100755 --- a/ci/install-dependencies.sh +++ b/ci/install-dependencies.sh @@ -25,7 +25,7 @@ fi case "$distro" in alpine-*) apk add --update shadow sudo meson ninja-build gcc libc-dev curl-dev openssl-dev expat-dev gettext \ - pcre2-dev python3 musl-libintl perl-utils ncurses \ + zlib-ng-dev pcre2-dev python3 musl-libintl perl-utils ncurses \ apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \ bash cvs gnupg perl-cgi perl-dbd-sqlite perl-io-tty >/dev/null ;;