From patchwork Thu Jan 16 09:17:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13941526 Received: from fout-b4-smtp.messagingengine.com (fout-b4-smtp.messagingengine.com [202.12.124.147]) (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 99E2D1D6DDA for ; Thu, 16 Jan 2025 09:17:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019047; cv=none; b=le9+iWaBV5mZCGb3tc1rxe2qe58kzuxA31YMeZUZb6abXRiNPPPKmbw3SZnGWyTt64E8GaeiDnO0Lz9aYSDQWq4sZQz7r+YMECJDak6fWCUILAlAaVrcEQWi4e9npHZhDlbCdnhqssyDMABzFf0Bw8+oeIXJKWz6DooI+0uDN9s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019047; c=relaxed/simple; bh=esEaf/q+o9XwasAExyiFX+mr9F3WleAhPq5gvFHL9Cs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Re/ERwuHmvhjHODoyT9rHnFtJE/Lik4i4YP/P6aBp4PNAP57k4xPf6/31DW8SmEjx966SIt42AKVY/RgsnrJekFyAjKatD15h8r49A8lTcCk/PLOY+Ga9KIko6KR0r/WCwcKGgrwAbtLXzvGCqv9UVKMqckRw/cE0X4iYIaeaNE= 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=I1ZpdRRd; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=VjqLZ8no; arc=none smtp.client-ip=202.12.124.147 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="I1ZpdRRd"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="VjqLZ8no" Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.stl.internal (Postfix) with ESMTP id BACC4114015E; Thu, 16 Jan 2025 04:17:24 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Thu, 16 Jan 2025 04:17:24 -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=1737019044; x=1737105444; bh=fU4l3uAIHnABq4v1/s6QUiOA8WQCv8+UE+YzpnliHV4=; b= I1ZpdRRdbhKckA47Z8F6nRFB5CQPD8XwzLdghQDhzLBLZSOIrGWGcE/QDWLlT3vQ XFHbnPi3xsH+pJT8nZxbRsI42CXik23Soqx7GOVRB0F1TdbRqTUIBYTig50TYaL0 HhouY53ZofFUNK9eI/iCWK11DqQO98Imll9FfWPq9eGAYNVeunGuWyQKW1hQrNqZ I05506hAMJBk+/Tumz+NzyaRcQmWUAEOSQ7h3TYGi8RV1p/porPdU/2BNYsikpmD 1Knzm53/s1zL8iOGl5cl6TYlrw4u9Ef7bowP9vAaP71hlkvDqIK3hxSpCAZX7lPK itPb9RLH5kt/OatLzVtFTw== 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=1737019044; x= 1737105444; bh=fU4l3uAIHnABq4v1/s6QUiOA8WQCv8+UE+YzpnliHV4=; b=V jqLZ8nowInTFIl379AJ+XQkC9LkIWNbMOG4W+0xl86Icd9E+J6rRtXMvNgk0k+Ez tyhpe2t+qMLo0uJH7P+nGPBaGLziYz2m0YGuI5mM4649aTZ7KIqGfYd3ZdzkoMOl MV8kTNqnNUNFhGG2kT64zSwODAiXHkdRvrGzlb7efaznU8uyHRZqmM1fiv9U33f7 lEbqJ8QJAUQFrFwYK6wyIps9eUJHHVmbRCXvzLRGw5RSZAYyJ88fl9fVIQPgdXwQ 5zPX44f73PT5KdwCVsPHks4XwXyrNnGJvYExncNLqEWRhBMCj+5Nw8BlHv0b7khk erv4pabEJyYwBRudZOL+Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeiudcutefuodetggdotefrodftvfcurf hrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffrtefo kffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsuc dlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfh rhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqne cuggftrfgrthhtvghrnhepffeuiedujedvkeehuedvkeefffeivdeuleetkeduheejteek gedvudfgtdfgieelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhht phhouhhtpdhrtghpthhtohepmhgvsehtthgrhihlohhrrhdrtghomhdprhgtphhtthhope hkrghrthhhihhkrddukeeksehgmhgrihhlrdgtohhmpdhrtghpthhtohepghhithesvhhg vghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Jan 2025 04:17:23 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 3e677e04 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 16 Jan 2025 09:17:20 +0000 (UTC) From: Patrick Steinhardt Date: Thu, 16 Jan 2025 10:17:14 +0100 Subject: [PATCH v3 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: <20250116-b4-pks-compat-drop-uncompress2-v3-1-f2af1f5c4a06@pks.im> References: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@pks.im> In-Reply-To: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@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 Thu Jan 16 09:17:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13941525 Received: from fout-b4-smtp.messagingengine.com (fout-b4-smtp.messagingengine.com [202.12.124.147]) (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 99DD81D5CE0 for ; Thu, 16 Jan 2025 09:17:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019047; cv=none; b=B9/Dq956bDI02Few9keCb88ZW+mFaK3L7iW8gsPtKMRs8n6z9OoZjE381xO34UCjYfPwe//t8KJK/cWxSfuUcaKWsh7Jc+pPO7fXZdGV8B+RFRcE6Ga9I4Dw0pqz34WsXYjDg3DtycZJFS88f9/QMUMNQmpnXv0PxQc+8tAVdPo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019047; c=relaxed/simple; bh=qQkpGLqkHX/I72hlZOnoPvqU/16AcM0CdT8XC/Y3uuA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r2DayB9I24IwhT8/4zasR2zJqHD49IP6kE/PeguLvcHxY12PXZpFMzJZOrPK3UNHLCvQZaTi2XYU/Dea6fTKjS/+EgW4oHgZTutzJn+l+i7avEXRdW3lwq73/olzBp46dzjqN3//0HtjnLxclWlsOP+pCUS5ZPMwfSqsyuaeaYI= 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=H9LV5W7o; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=hUOwk+lS; arc=none smtp.client-ip=202.12.124.147 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="H9LV5W7o"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="hUOwk+lS" Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id CE5011140113; Thu, 16 Jan 2025 04:17:24 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Thu, 16 Jan 2025 04:17:24 -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=1737019044; x=1737105444; bh=6lKpjSyhoqC27wG2Um1223BPm9jmWKzVimHofBia4co=; b= H9LV5W7otE7HpLNb9qJ51/GhcyjdULNW/WXzZb2KQbkW68hsj30szb40YeD+B22o UJvDslYMwwubKexu23Iwc4Dzmq0d6QyGQTJ2jKb2AK91iRVV2RgjJhHbrBdCv1WN PbE96/ssMOUa9eZ7jKqVicuiiUkJmxKgNDkl6he95M2tX3yqEt8hrJLZHPAvv+Ry Fc74Nc2uQMTglVVX/cGuMWfHD83v/4Nyarmxdz8DgPM8QXDD0jdJeL2eY3iXrfut GnGvqgF4XKe0SSaAsuLXvBxJsEy5OkoIE5NjLo7VdAjLKZ0WrXhFKxNVySWIxrEG MK0W6iyAGAUoRji4CAj13A== 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=1737019044; x= 1737105444; bh=6lKpjSyhoqC27wG2Um1223BPm9jmWKzVimHofBia4co=; b=h UOwk+lSgJa1bt+hZskAITneW+tYxr76PIw4VXok62sr6mQaS3z14oab46nZFXNhV TAahoz/5LP03Zn3WAE15R/BaoWMLg9xg/YXy6z3TzgTQgSjF7uEkUJPXOzo8Q/D5 EgBlWpgjR2PTX5mMv2Q6nzJRsNcPg2m6eN1Epms01wiA4k5Bx+5YRoaRChA4p7gi smbeGx1ApfanGACIsngWJufIb/5oFOUntR3yY9vLmnwAChfXXCffQOepE4iq/0vb Fwvppk3/b5vKAuGGrXUNC/486LK60bwXbFtmT6nbXlbts0h9sfHVQ30fELLHZGhS p6UBqxtpQmAX61m8NKyAg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeiuddgtdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdej necuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrih hmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteekudeh jeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohguvgep shhmthhpohhuthdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpd hrtghpthhtohepkhgrrhhthhhikhdrudekkeesghhmrghilhdrtghomhdprhgtphhtthho pehmvgesthhtrgihlhhorhhrrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Jan 2025 04:17:23 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 41fcdfd1 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 16 Jan 2025 09:17:21 +0000 (UTC) From: Patrick Steinhardt Date: Thu, 16 Jan 2025 10:17:15 +0100 Subject: [PATCH v3 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: <20250116-b4-pks-compat-drop-uncompress2-v3-2-f2af1f5c4a06@pks.im> References: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@pks.im> In-Reply-To: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@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 Thu Jan 16 09:17:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13941527 Received: from fhigh-b4-smtp.messagingengine.com (fhigh-b4-smtp.messagingengine.com [202.12.124.155]) (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 8153E1D88D7 for ; Thu, 16 Jan 2025 09:17:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.155 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019049; cv=none; b=eBmVN5ydgSq+E93UolmxpRZo3hRCS3Z9DW4sIQy+7Vqql+WHoZJ55GrIUsiJ4koY7E2Vy/9teRHiTOEBbPYMdE89vhz4eMvvcCora/1ckVuKQCMdUSM9OcrJVqsU219GuEi0xzHfZnTCakmav/O0jm0bOljyOSFCK+htmbsgldg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019049; c=relaxed/simple; bh=HDDNaLjWql+wxMeQWtRrf3ZJfly5TaBMOZ3OB5rCjho=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BeVoE0FTxS2SPubMqVyVkOfWZm7fF5jIJR/mW8HkPWPssnOVD6SykcSdd9cHjEuy2urvaSeU1aF/pZ6fRN3nbR8u6L9Lza2us6YRouu+4sRg8mt5aXk0FSd43+trcA7xQ37LjgGULCUzJWNyga7cGGdfsi0Kmk5GaNLfwbpZrzU= 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=Eug8hEI3; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ML3W2RJz; arc=none smtp.client-ip=202.12.124.155 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="Eug8hEI3"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ML3W2RJz" Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.stl.internal (Postfix) with ESMTP id 42255254017F; Thu, 16 Jan 2025 04:17:26 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Thu, 16 Jan 2025 04:17:26 -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=1737019046; x=1737105446; bh=Sm+dUne1jN6ypiwjhDc7tPDEUoLGYFi2/iXFk3/FZIk=; b= Eug8hEI3ybIKaLlsW0yZhfmGuJwsu8vp2uWWQGaXNZHuGQOmIf21ipOgdzlKK+GK /IVPqUw/YwMYISuL5ZLtUJGyxip1Yc20JnawCfffTSqWbOr+OW6OZ43HiiRw3Fm3 YIJtZRMS6ceRljJWZjC0bD0f03cBPcG0x07XwWjeV9vUvZ7w3HKa7TsBiGWAloFk 4VAXLLG1TYotPodrWIKxWbI9ZQ2uJU5bOWOb1XKgrZKE1ykSn7k0JMRGJQcV0oLa /Q+CKWXMRrWS23K6gOhwvwHKUBTWT0jfwY7HT99hnnjddAnJ0J+5uxlRNDp2GBOJ Z/GFPGn/R4FzeeXdRnNRLw== 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=1737019046; x= 1737105446; bh=Sm+dUne1jN6ypiwjhDc7tPDEUoLGYFi2/iXFk3/FZIk=; b=M L3W2RJzGH5afP4br8+ZIRkJaU8Gk+A+FHT5WsEkbWUDQVRHPfQ6SYT0qDd0oDaKj rRggyJkT+jjtxCY1uWgXoxGT2TKc1biW3hhoKd0Xi9NWNU/K2tC0nGestp1biDTQ 5fKfhxjs4TaLIjkcLTq2qrXa5magX/6SvSbAJh8JkiofxzHOJop9cukfXd6D7DBA exQ/d+qykpCPBQXFbgaiv5zINCAy2tqe3+PmoqCm3xd12p63B9Qhume4WK+Y7b9B s4R0ea14TCh2TZB/QlMOD5nIctdppJyktUgxqmnPXFsgF8hExiSX+r9wl9Sk/12C A7rwDa6sS/IEZkhw0Hi1A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeiuddgtdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdej necuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrih hmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteekudeh jeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohguvgep shhmthhpohhuthdprhgtphhtthhopehmvgesthhtrgihlhhorhhrrdgtohhmpdhrtghpth htohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehkrghrthhh ihhkrddukeeksehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Jan 2025 04:17:25 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 36b7eec9 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 16 Jan 2025 09:17:22 +0000 (UTC) From: Patrick Steinhardt Date: Thu, 16 Jan 2025 10:17:16 +0100 Subject: [PATCH v3 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: <20250116-b4-pks-compat-drop-uncompress2-v3-3-f2af1f5c4a06@pks.im> References: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@pks.im> In-Reply-To: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@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 Thu Jan 16 09:17:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13941528 Received: from fhigh-b4-smtp.messagingengine.com (fhigh-b4-smtp.messagingengine.com [202.12.124.155]) (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 815961D90B9 for ; Thu, 16 Jan 2025 09:17:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.155 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019050; cv=none; b=KDV2YeZ3gbCFFkGMzzC47czBffRbtj/apmXlmo1Ig30JRJksIwvhyY8fm1JOuhSq5lnITmCYjHEkTqfqW4rQ45ht04gRrkuiFrZ1kKKW6w+8G4UDcNhUjGMXtXFoFfktVGht4C0RvfOQu6jBAdqQtZ2stZVIIYfHLnS+atQwHjU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019050; c=relaxed/simple; bh=CjD4JYvNfbtl50C7gX0wpUR8oYrzDqvXvYaHjl3guyY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XgrrC7OQJ5Z9C3I+LuWkIJ43ljbaYdLUCmahNuKv+elXFHgBjbOsRUAJSbaWNMBLFqjdIre7t2DNKc+i1xAyMeWytO/g3C8KAdp1iNPKnrOAN+EAhL4DhP5ELa1YufcXtYXwIMYHk6JkvLicKqCmFlNOPCGZ/Og4LM9KZnCMLoo= 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=JrNaTNj4; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=iV+/XZ/Z; arc=none smtp.client-ip=202.12.124.155 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="JrNaTNj4"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="iV+/XZ/Z" Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.stl.internal (Postfix) with ESMTP id 3A5FB2540178; Thu, 16 Jan 2025 04:17:26 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Thu, 16 Jan 2025 04:17:26 -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=1737019046; x=1737105446; bh=fSuuTx9zUmmyP0zK0xaqXvV3Tbcp2Ba/VN6U99rSX+E=; b= JrNaTNj4d9TNbbznoNcNYtV9yQuIm60Qg520zeTv4dkExG4tE3IvOfKVNYnJE6Jw QVUE6UpeIE6pT2Y+xYaE05eBsJepthAm88xd8qZeeLJBzOzYgM06KyjAsHMhkP1B 0WWND0/ympJrpKLbZPGa7hpcuE2WvhwPY3JJB0kA8w/phJbfbOnPdfvahjdVXZip ES822THM1Str4BV1hBAEG1j5KV+T0DhR7MiUFfmE/3ZQ5M4FIjPDy24gbaU4Il+a hh/P99ESTEXhqwld+Qb9zVSUNWWxKggUaUOQagfJ+88CI2ORe6ZaNBpP0xtOKsNV DW3Tm5SIJ/AvWRRmC5m9mw== 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=1737019046; x= 1737105446; bh=fSuuTx9zUmmyP0zK0xaqXvV3Tbcp2Ba/VN6U99rSX+E=; b=i V+/XZ/ZCAPLCBATupI2KLH76Ms75zg3FYFpCNzqjrGrSyJi5YvA4ZSFeaW7dQsrX dZUWyt4WPztizSAp3k47VG9pJRszBaGSOWCd/uW9MsHonQpfaddjN5bPBlRvClF0 JT9LQtGFBbokmbJb3Ycz/04ebH8RCkqGMjJbREtQC92ikp1UFDaKPY9BxwSzZcrg Bbvq37mwhCMTJ6pihaZnyzfhEBCCQlZpwh+Gbtm/1iaB/wS3eqL4LZEE3xrfiEYM u4KNy3iCFsohYTQORXkUP+ziMrkALKU3o4eXf7PueJ8XISwOlMs8rwjAE95Rgdln B7ks3AHi+Rqe7r+5cwVdA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeiuddgtdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdej necuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrih hmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteekudeh jeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohguvgep shhmthhpohhuthdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpd hrtghpthhtohepmhgvsehtthgrhihlohhrrhdrtghomhdprhgtphhtthhopehkrghrthhh ihhkrddukeeksehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Jan 2025 04:17:25 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id ddcd7034 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 16 Jan 2025 09:17:23 +0000 (UTC) From: Patrick Steinhardt Date: Thu, 16 Jan 2025 10:17:17 +0100 Subject: [PATCH v3 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: <20250116-b4-pks-compat-drop-uncompress2-v3-4-f2af1f5c4a06@pks.im> References: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@pks.im> In-Reply-To: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@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 Thu Jan 16 09:17:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13941532 Received: from fhigh-b4-smtp.messagingengine.com (fhigh-b4-smtp.messagingengine.com [202.12.124.155]) (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 AB1251DB346 for ; Thu, 16 Jan 2025 09:17:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.155 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019053; cv=none; b=biC9DHsGFFM/RlYPkeVtuiv7sHPDdkc0zA6iN4703nnBBwpeBKmmN64n/akdf+bDSgYZMDChgmMsJqIArHO5WJeEhpp16sInT9yD/QLq5uXuB7BmGjqC/su1Xv5aaka4/aN+mnrd4PlMwFrvb7SvReX3bmnRY4tHMHfPRALdX48= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019053; c=relaxed/simple; bh=oGsYQLpCFUDWhhgxk1gEsdwBA7ZC2vGKFCXlNH39QUM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C9crgrgEyQZh9TZLfENw8VkkrfCY2WmqgvFTm2lGJU4m/Jnnh3ixbXLiY3dysOANKPKFAcemEo+5TE4l2nEnfL5gQ2KfTMv+2G3sgLU0qbZkfULJPFOk8ihZG4QVRIN6s8a+8439HjP5v5vBEkI//t9jgAsGHXvr/oE0KbntYag= 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=YlmG7WJC; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Ojny3gLd; arc=none smtp.client-ip=202.12.124.155 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="YlmG7WJC"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Ojny3gLd" Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.stl.internal (Postfix) with ESMTP id AB1402540185; Thu, 16 Jan 2025 04:17:26 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Thu, 16 Jan 2025 04:17:26 -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=1737019046; x=1737105446; bh=/CtZPM9QeryLRLvwkwAyg0cieLHfEGypsKcLGjTDKXY=; b= YlmG7WJC/EgKq2mngswuTlOGEuWz2uzIRloaGuZg3hMddcngOenUb7TXYqgi4V4+ 3ebjUbzgKkrBjmakJ7uWlqfdnJUzF5QKaCqrVrLxUI/Uo5xPjeh+5KNq86J7WfzB 2zRVlgooI0KI/eX3/loISMYLLhEQC6pDJfNvb9HAr+alydjX7f4RxPZc+ivy5q5I JcNBdYvut1EnVo2uBOTBg4MdOFDcLttiRh8Wb4Wp+bSN74A/sMp+0D/Ty7w8Y+DM F8Iay8gcPW34JVgroE+0iE3OsvcU21J8Hmm2Af0zGPSxak/inbXjwZSnwPKgGbmP /8c6clVX10HH96ER2Oh6XQ== 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=1737019046; x= 1737105446; bh=/CtZPM9QeryLRLvwkwAyg0cieLHfEGypsKcLGjTDKXY=; b=O jny3gLd2AuMzIlBI490uDls9tTKRznIonGOHzQmvEcksWvgnwFBTJRQd1BPdFCw+ GI/nbCZEhx5u4rfPyaxzRcZ2JJz7CuHQ1fHA1qG/GHhMDofMtuv9R5Q+00BequQf DoeHQZ/slSQLPKfeUQy3DpiJaS0cI+Z26YONJU8LbDQ1e/dREwYoKNCAn1MSoxjT 7+W6Xou6yUkRPdHqSPOsllOKDkaWixnmZHzwofqECaXWVdykcQICihaYl4z0FpFQ tqdUYHyzG1y3PVteUgY0FLnFTNQHM5GY3Uvd4xENkdtjfk5Fn+yQ2PORwiEYfSuk Uny0Ms4WiDdnMdV0C5XYw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeiuddgtdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdej necuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrih hmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteekudeh jeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohguvgep shhmthhpohhuthdprhgtphhtthhopehmvgesthhtrgihlhhorhhrrdgtohhmpdhrtghpth htohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehkrghrthhh ihhkrddukeeksehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Jan 2025 04:17:25 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 63d1978b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 16 Jan 2025 09:17:24 +0000 (UTC) From: Patrick Steinhardt Date: Thu, 16 Jan 2025 10:17:18 +0100 Subject: [PATCH v3 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: <20250116-b4-pks-compat-drop-uncompress2-v3-5-f2af1f5c4a06@pks.im> References: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@pks.im> In-Reply-To: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@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 Thu Jan 16 09:17:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13941529 Received: from fhigh-b4-smtp.messagingengine.com (fhigh-b4-smtp.messagingengine.com [202.12.124.155]) (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 AB0CB1DB15F for ; Thu, 16 Jan 2025 09:17:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.155 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019050; cv=none; b=UotU/w9C6SRgQDRT8Wx0P7iTDurLn028673sR0MtKsAU22qaMzRT37jvSjsJlys4hyvdQVR7patMoHlY+nWVMToozKEFNRnFzDSlm+Rvh4vOPIcPXx8nk0oBLbWUerwihuvK3AiiIEY8tBYxIuMP8bgEAznyyxeUuo8/vR6AQws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019050; c=relaxed/simple; bh=0UHocXob8T7CMPqijn149+Awo7oIJehey5wf2+d7ZOg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Vb/xHQ64rCy7FJOMh8ZJZgDYXWYON59QgYTW82KsC5bPlx87Ri0J/QEXqCFpVClJ3wYoMAXIwhoHJBNQwW0WdVAvb70yZSeerliRbjJHAw5bOdJKj8CkhuQ6LmniUsJ3rQII5xFtNpeaRnnbTFGKYxriWN6KnUhUo9Wc8ifIfLU= 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=e/ZjRVQL; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=qCGuNuHg; arc=none smtp.client-ip=202.12.124.155 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="e/ZjRVQL"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="qCGuNuHg" Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfhigh.stl.internal (Postfix) with ESMTP id AF5E9254018F; Thu, 16 Jan 2025 04:17:27 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Thu, 16 Jan 2025 04:17:27 -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=1737019047; x=1737105447; bh=Zexu90/MTvgq5znGNBMgC/ZTbCf0BMOQJTUXf7bhuqc=; b= e/ZjRVQLCecRpLq7QIULOry1CeokaMlExrlvNZ1lzMl6fPDPesWDIUN4R0EYyTuV Is0/WIAwWbgzp7uF7kMROHn3hItxIPg7+i8NbDFudfT1YfRGrGgo6Z8C3HIrQIsp dLbwOg0fGPENvDkillBcUnQQBuurIr6D0H+3DTacpmaRIu9+/EoaNJpKRY+fgRcc hDX5dZN5MP87dpbYGHmByy60SpT/Sw9kViVrV4DmcWyoLAPlMoHefaAv2b33EYfH 4winSpYaoHDKeL+AtLEWalWJeZwqjYtqiMM1D1vDz/317W0CKE0iLdxWMyRyH3Ht Lckvb5zeLffq4pDGRfqlYw== 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=1737019047; x= 1737105447; bh=Zexu90/MTvgq5znGNBMgC/ZTbCf0BMOQJTUXf7bhuqc=; b=q CGuNuHg5hLspAJkKKPJs4OCYc7jQBx/3lqAcdXS552gHZ2oLHip5G/wW+ojQutRV 9/foLA+Ta8FaKGBrVyxuJMhJRPA3MIYGlm4JWoYIhLVVKHVkR0ttCJrjudi10Zmy fDkbR/LBcbv2w809hXZo3JdCpr9FOSu7E0KUvubZbUdLdP917tnBE//4M/D+ofFI agt2MwUWV56/pEQ8TnlgltP+EmJ1hkDGgHemfPWiwL2XcRwcnvtXGG07+GSVxcks IAkJnSDq96lAoQBnoOThyb/sggSr3dcBPrtpWIHkt7jVSsBa2vSUmwYCeHO9JYTY OvvZq+SpdVlM/XVoKz7yQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeiudcutefuodetggdotefrodftvfcurf hrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffrtefo kffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsuc dlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfh rhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqne cuggftrfgrthhtvghrnhepffeuiedujedvkeehuedvkeefffeivdeuleetkeduheejteek gedvudfgtdfgieelnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilh hfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhht phhouhhtpdhrtghpthhtohepkhgrrhhthhhikhdrudekkeesghhmrghilhdrtghomhdprh gtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhgv sehtthgrhihlohhrrhdrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Jan 2025 04:17:26 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 2a02a20e (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 16 Jan 2025 09:17:25 +0000 (UTC) From: Patrick Steinhardt Date: Thu, 16 Jan 2025 10:17:19 +0100 Subject: [PATCH v3 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: <20250116-b4-pks-compat-drop-uncompress2-v3-6-f2af1f5c4a06@pks.im> References: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@pks.im> In-Reply-To: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@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 | 13 +++++++++++++ 2 files changed, 13 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..2690bfce41 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 Thu Jan 16 09:17:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13941530 Received: from fout-b4-smtp.messagingengine.com (fout-b4-smtp.messagingengine.com [202.12.124.147]) (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 AC0601DBB13 for ; Thu, 16 Jan 2025 09:17:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019050; cv=none; b=ODUyOhQRs3jZp1QT7ubcMplVO4SdSHJXvyCJPOn5rAN259HedSrNX1o6uV4/tuZBrmIGEhv3NXQLzmCY34JOyFCn+HEOpuj+rEfsXgtPbC3Yf6+kus270XlJ/a7M80LQpFxoWtKoEt5saEPjeOe8b1PavUH/CRwuqWPl4L2wfTo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019050; c=relaxed/simple; bh=cH4Sv/OVLRYMiFagRjQkXaEcVVVd0aBrLzw6++IbwrM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hngkUeV8XGG+fNMXq9xhd4An2b08+2z9ZRAmKka01WKI/l1aI7zkgnz/l0uzGa6UfpegsbphZ7RIzLTejhEi9uxCi3IV02Ya0CWVrxOW3Zh5Es91FXSPkLBz0xNxAedQLGqDOHHoldU2UuJv/4TwcSXqNpyaPyL9j0BqSButn8I= 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=ruLTCueo; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=qgXcPF7Z; arc=none smtp.client-ip=202.12.124.147 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="ruLTCueo"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="qgXcPF7Z" Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.stl.internal (Postfix) with ESMTP id CDC781140113; Thu, 16 Jan 2025 04:17:27 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Thu, 16 Jan 2025 04:17:27 -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=1737019047; x=1737105447; bh=7pywyglqqnX+PIKerGMq1M27gsgga5P9iOJeOmdB8bQ=; b= ruLTCueopsyzhf7r1gvBXzRIb98K7CI1SECiT8I3vZXtR3yByHHU/MQmLF67cMDk StE6WhxKvd0KBXtlOI/m/edUQVGPphbTitSEtjXrEU79EqeLI3AdhaIW9i03/BX7 lAK82BLz4txje3Ohjr+0s0B2uoma2hAuORCwtbceQc4A6qobqPJ3kXRu2BqVdY6U lbytS93cJVygWeyh0JIZlzsAeVOVO3fpGmIdIovP68FCo5Z9vq+lL3Eped0a9/dO YKLfc9AAw7GBkbBua7HcTz2Jp5nw6mDXEB4j1ROwALURtoJIlDlKXCQSpjspVtob Rqh9w4IAWQgstPMp+LpiYw== 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=1737019047; x= 1737105447; bh=7pywyglqqnX+PIKerGMq1M27gsgga5P9iOJeOmdB8bQ=; b=q gXcPF7Z0qRjzX+csKfgnyJFkRAOte/Rr8axEiCTd+JwjM3VfMX3ouYO+U417eQrd YvN8yc/pRIB5CUixSYMjpolbYPluHaFsPI1VfitDpBXrFKfU5jYIaUgItC5CMOXv dBFZofVmzoNdTkPumfLeud4H25UYmJGnBGNb7P6qwaafOWONaXF5YyFRsqusnz77 g9PBiD5DIP7WLS5b0rj2j2eBAyv2W03G+AeSbXcZQ10KiFVhgvRr4/evQoWUT7aO aD/EmkG/c3FSnjCpMD3wspDESv7MLM6dLHHP39cv7XrI+sM/IVyDtBDKgLTgDPnJ u4fU2K7CjjDe93sbRT+ug== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeiuddgtdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdej necuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrih hmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteekudeh jeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmh grihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohguvgep shhmthhpohhuthdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpd hrtghpthhtohepmhgvsehtthgrhihlohhrrhdrtghomhdprhgtphhtthhopehkrghrthhh ihhkrddukeeksehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Jan 2025 04:17:26 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 27633606 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 16 Jan 2025 09:17:26 +0000 (UTC) From: Patrick Steinhardt Date: Thu, 16 Jan 2025 10:17:20 +0100 Subject: [PATCH v3 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: <20250116-b4-pks-compat-drop-uncompress2-v3-7-f2af1f5c4a06@pks.im> References: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@pks.im> In-Reply-To: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-zlib.c b/git-zlib.c index 2e973320c2..519b3647ac 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 Thu Jan 16 09:17:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13941531 Received: from fhigh-b4-smtp.messagingengine.com (fhigh-b4-smtp.messagingengine.com [202.12.124.155]) (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 102F21DB362 for ; Thu, 16 Jan 2025 09:17:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.155 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019051; cv=none; b=MjcONApdJXqTFyoE5K54JfWKEUFaaDRhT3VUcLgrJHal+94owzjNRJ9FYs+rvN/fSJi9pxDJMD3IDmEP4lEZEhxBXZm7zmfHpOkbKrel0W/0lIrfsoBqQDnh/+tvTp4g58R2Yqv/brApHW1wKbeW2f6KdCRt1ZJSAQP76t3ubc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019051; c=relaxed/simple; bh=2jkIW9mhfaJCiWQ7tE3T3XTKuymJPazqdtK3UQxShH0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=U71waybeD3AsUlEDIdwHKO22RZUIhjvXHWlpPzgDtbdINGY8/Ql2Js+H1S6a+AvSHL1MBC3nke3VGn02EXMfuQGq78M5wCopwXmUBLYVVF4o/mw4dZEJWiv/1ed853O8FqSbQtkcj0OQpN2SkVjFslWfiaRJCN0EeLINgUj5UXg= 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=oHIxq83S; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Xjk5JzX3; arc=none smtp.client-ip=202.12.124.155 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="oHIxq83S"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Xjk5JzX3" Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.stl.internal (Postfix) with ESMTP id 1F7E72540175; Thu, 16 Jan 2025 04:17:29 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Thu, 16 Jan 2025 04:17:29 -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=1737019048; x=1737105448; bh=N6vZuPRuRlvg2mH4nO4m1fHCXA66INLNBUg54sv0f+g=; b= oHIxq83SOtqsVoCEvtQh316uy19gM7uuXh2U86F1yTvqO9gQqLcFNTWpOSUGnQwR oLQvrdeqrf17JaNO2F0kHnuQWA9hbz/PDk0aVnpfGmLfkAPxaZhB2FMRKR7fDm4u IkUgnbE4vtSQxxhorFwqGf4m7tkCVS7aWU//Pqb5ee1f5jTUKthAoyDi+WCXTkyr y9Na/oMQWqq7ICL1+2QaE7yO4kQe6/7aIzFZ5cWB1/zAPn/EFQDTfTU05CIuNPzN qz8mLdayaiAEu7uJluH5g/EIvUnObXvxxQdWuL/415x0USRwStRbK5EscUHr3ipv Uvj3Z4yAPDcijYyZZp2siw== 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=1737019048; x= 1737105448; bh=N6vZuPRuRlvg2mH4nO4m1fHCXA66INLNBUg54sv0f+g=; b=X jk5JzX3pzoZ+z2ZwRqzhRwb940zvI/HxSh57gNreRzkkKfPfhcurBRsrLYCesZ8v 9+DNld+h4OLMX7ge+dS3MoQnZSa3uBJlFinTvCa9PogEuuESso5lZjrIqfoXilsq r8Vx/xwhHnxXXkKgbAW9M4IR5gu895V7MDWlpjmK4f0FQDCqvaMd2XiMpdRc/5bG +MSWSgKFhE7DPTmz7XG90wNF5I+A9aD6LEd7zoRKFyxXDccPz73W+wSczi9ojug7 HP6Q23C22pFmt+a14KouH5hdbsV8LkpFZRLGjR5KMtcTlSSVdI+1T7HssvF0skEL Ml4lMGTg5KePiC7Zmx9LA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeiuddgtdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdej necuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrih hmqeenucggtffrrghtthgvrhhnpeejffelleeftedvffegteeglefhteejudeuhffhveei vdfgjedvteelgeelhefgfeenucffohhmrghinhepghhnuhdrohhrghenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhn sggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehkrghrth hhihhkrddukeeksehgmhgrihhlrdgtohhmpdhrtghpthhtohepghhithesvhhgvghrrdhk vghrnhgvlhdrohhrghdprhgtphhtthhopehmvgesthhtrgihlhhorhhrrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Jan 2025 04:17:27 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 4441dd47 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 16 Jan 2025 09:17:27 +0000 (UTC) From: Patrick Steinhardt Date: Thu, 16 Jan 2025 10:17:21 +0100 Subject: [PATCH v3 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: <20250116-b4-pks-compat-drop-uncompress2-v3-8-f2af1f5c4a06@pks.im> References: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@pks.im> In-Reply-To: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@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 2690bfce41..58e53927b2 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 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 Thu Jan 16 09:17:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13941533 Received: from fout-b4-smtp.messagingengine.com (fout-b4-smtp.messagingengine.com [202.12.124.147]) (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 64F8D1DDA14 for ; Thu, 16 Jan 2025 09:17:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019054; cv=none; b=k0V+Cmkla5nOKaQGS/CI9QUxj62SOouhY8N3Ww9sfTlM0LH0Tu9M44XpvgPXczLD6fGfneTlu0YR2Y7PzsxBW06c60J0Bo9SPZFxK6+gjbt0p1d9dmc8wisqMkQM7ySfB+IxL7A3PPLSju01EzMtNLMlcSwkvQ4+mZJpjcQu7wc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019054; c=relaxed/simple; bh=Jq7bRZnrmGVKTQRmFkmGcWet/89CJsgYJ9vRn6ZK1K8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FqRfX1ZUdAILGVLV6qLHY+s+NaeQbQY+AfWXCXrOPGzx88hml5eCQkOU8xcmnnCXDY07xVNZKUBOnpWjvWT1NvOMbMmXzyAajtt1I+U/2IccqTHrM7L/kVTdETWYWsLQN6eiRUh/upE4//nd8zCZa7i8nsFVcNCGLM/48yx0Iss= 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=SkR1WBM7; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=p/Eot3dB; arc=none smtp.client-ip=202.12.124.147 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="SkR1WBM7"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="p/Eot3dB" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 799B21140158; Thu, 16 Jan 2025 04:17:30 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Thu, 16 Jan 2025 04:17:30 -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=1737019050; x=1737105450; bh=z3C/vgZ10dW1DRUKWukLqo3OgMq1u5pRScbzP5uXm0o=; b= SkR1WBM7b2eQIlF1s1tkhO8S9n/DsiD20vXsNHDDJZAxb6zx2q9KcslsnFdPVWXF /hzJDTsFe7lC1CSSYbxZEpoP+sv4+vEE6zthxGUP5FfhxHflNXnN2+VM2W/niG2c 0pSaGQFjyM4PcZ/6kCaGwmm52HF3m8bTXQtZED0twdjcV0eD86gJ4Mw6noTYku0f HQfc+Sh6FFmbo5unJp4hxc6r62SXNpFtCVo0Lj3AMWAcVy9dnU3WTonG/EkBHX/a x9YdL6aL6au0RLAxXSs+qGd1+T9U7/NIxrYOC9AiRjmL5I2Rn+vE8+FXUhrMieYn hPMB7uPa3/XAiltATafYEg== 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=1737019050; x= 1737105450; bh=z3C/vgZ10dW1DRUKWukLqo3OgMq1u5pRScbzP5uXm0o=; b=p /Eot3dBtOikitZF7GuLnuyvv3FxeAnnR0jd4Hds48cvWDwUY6edem+i2aWIY6e5r znybyUXy5aOAWISE4QI8ugfVvM9BuX+Od0p4uKwgm8yHrhF8eFm0fFvdMaqN0xTC uvNgrEFeBR7UvmLJMsNSDvLqhs+IaCwpLoL1SXlxjX6mFXavR8ubziNI1k3Heqw7 YJ7iyBTjrXBkGvkAIBM6e9ajkdNHthSG8+w5oKzgShzf5Mx/qcHWYBtXqcj3dH7D MU+xs/DqW58jy0iLQHJlXLkPoDc/vNX8DoFHSznd+0ZQJbDOdYeF4HX//JwQHRXR rPNSNkg9AGL3/Ls8SHjeA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeiuddgtdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdej necuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrih hmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteekudeh jeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohguvgep shhmthhpohhuthdprhgtphhtthhopehkrghrthhhihhkrddukeeksehgmhgrihhlrdgtoh hmpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthho pehmvgesthhtrgihlhhorhhrrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Jan 2025 04:17:29 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 46883c11 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 16 Jan 2025 09:17:28 +0000 (UTC) From: Patrick Steinhardt Date: Thu, 16 Jan 2025 10:17:22 +0100 Subject: [PATCH v3 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: <20250116-b4-pks-compat-drop-uncompress2-v3-9-f2af1f5c4a06@pks.im> References: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@pks.im> In-Reply-To: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@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 Thu Jan 16 09:17:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13941534 Received: from fout-b4-smtp.messagingengine.com (fout-b4-smtp.messagingengine.com [202.12.124.147]) (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 BFE011DDA20 for ; Thu, 16 Jan 2025 09:17:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019054; cv=none; b=cd76Bh/DOOIP+2CBkoaRkqz2joUgyl3Rl4W7JXHM9tnZAqPXUBZeRHkePr5uvBijft08v4KwkQSGS1k5kY8ZOYaTIchIilqyysfXTx9GGK/a63fQF1ZyACfB5eIFxP858oMfA99paf+R9mXY2x7nCwJNEq/ysEYNnNsGKwQ9ypk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737019054; c=relaxed/simple; bh=kuwOEBHAu5oIijm2zXaGkHG40Gytyox0w5FbxN1zcDc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UAmR44pgb6ZoDjAE5CZlzcBwyeeN8Ci3m/XIVJ2yWZ4C6BCvTKS+26wnvL+S55stEz6TQb1o5ID9Vi6J2z5WfNA+dHbfKqfqlVmC61n8AQDs3cVqAGK9NYMBcq1wyBzUnkSkuibs+LURPL8fcXdT/SVB8qb02mqUq/lKFuNxjgA= 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=jKIjDhvT; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=tMFrHR4V; arc=none smtp.client-ip=202.12.124.147 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="jKIjDhvT"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="tMFrHR4V" Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id D768A1140113; Thu, 16 Jan 2025 04:17:31 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Thu, 16 Jan 2025 04:17:31 -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=1737019051; x=1737105451; bh=5OOx+LgiZX3sg/PMtTijS0s2Wx8x92Z73aPPRqot1/4=; b= jKIjDhvTRhI/Kt6eorIBj8/kIAfG4l1Ms1p7LGH7HHTyz1s6aUEncJzzg5OXqppL 4jhvCzWi+DEJ14srOlb/HjodVEaLzJ09ZWISQVVg12F+LiwBcvZODoto3QebTgeK uJhNecbISkgGVORCdohxTGVczbZv1TcvJSpcrmzB+dD+TTo+5gJlRAOz3Ptn70GK RtoWwfrLaWN/8MKO8YE5SptCkGp17Tb9IJ/8YUV2EV8Tu+0d74IJ+VUtYxRpgrqK rm0u6j+dDMwUQbxCi+GR1YeUOeS71t1H69VFH3ZSWPPYlfXvRgSKsmVbv1oyaqvA hsAKqGHoTt8mF7QVNaBtnw== 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=1737019051; x= 1737105451; bh=5OOx+LgiZX3sg/PMtTijS0s2Wx8x92Z73aPPRqot1/4=; b=t MFrHR4V9NqjZceejp3ZVI2M9YzJpLlBSYa74IlEZOqrYJ4XygSN0PQRFiSqmeOgI jshSemCgwcLBkM3GxjgTTxmZFDIm5TaxZqKvGlYFCOZpvxXblfLfHXa4vmwH4JtO A1WXKyj8GAm912CKHlFn8TnuBS4AXVcc9p7K3hTE2lWIlFR+nMWhBSIrGz44yckK Pn1PeTpyfEbqVWeoy6cQg6ZMqXVPYwzUYJX8B1YKlKQgYdpswr1bvosNGKGPuBVm Hob0+1/AqQ5Mdyr7I4uD+hMRuVMqqXf91qwwOOSLX2PGuQdI8+ZJXyj280ihTR9Z zSAyoq08veBLUkDujYO1w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeiuddgtdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdej necuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrih hmqeenucggtffrrghtthgvrhhnpeffueeiudejvdekheeuvdekfeffiedvueelteekudeh jeetkeegvddugfdtgfeileenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeefpdhmohguvgep shhmthhpohhuthdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpd hrtghpthhtohepmhgvsehtthgrhihlohhrrhdrtghomhdprhgtphhtthhopehkrghrthhh ihhkrddukeeksehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Jan 2025 04:17:30 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id de8aa1ed (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 16 Jan 2025 09:17:29 +0000 (UTC) From: Patrick Steinhardt Date: Thu, 16 Jan 2025 10:17:23 +0100 Subject: [PATCH v3 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: <20250116-b4-pks-compat-drop-uncompress2-v3-10-f2af1f5c4a06@pks.im> References: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@pks.im> In-Reply-To: <20250116-b4-pks-compat-drop-uncompress2-v3-0-f2af1f5c4a06@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 ;;