From patchwork Tue Jan 14 11:57:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13938696 Received: from fout-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.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 9A7E82361C4 for ; Tue, 14 Jan 2025 11:57:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855869; cv=none; b=pUc0HTe3udsIT+S0P9lUXm+3ei+E8eIEQ98eIIGf3HGQwXs5iFkmoNzeNq0cu3hSqTpKV2JPHOYOgbD5w8Rq12JbJXjDDxOtgshfz8567Dgf2Iqxbgss613qMlvwWijbwVt9HWyMv86rFTPsev6KapJGHdkZSGkXsA/5NuWwuOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855869; c=relaxed/simple; bh=O9wBplcsGjYpOZAj8EXLvvHoAmjCt2iDNdkuG//elDc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ESc8Q+XOIcBHzqii4c6GW7Lpc7ZDWk9APrqwaoO+U6LqhgKTp1YP/qozFeg9koZuu32mJF8BR5CjBOK/NtYLb7Mpwq4B0ygKmthx6ckBg0h6ur2O2uAjGoDNxOv1eyJA1oPvBJyXvYrBjttFFVeTwudnhS0V/bscwBKtGZ+EaYI= 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=a2nL9Bi9; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=QXDGXaM/; arc=none smtp.client-ip=103.168.172.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="a2nL9Bi9"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="QXDGXaM/" Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id F36B11380389; Tue, 14 Jan 2025 06:57:46 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Tue, 14 Jan 2025 06:57:46 -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=1736855866; x=1736942266; bh=ccYcGhLEFZBML8r4AynsdEC+8DsJVP/81xdkLk/3OyQ=; b= a2nL9Bi97aNXAWOemw/78vXqjuoQzjhX5lzNp8Q1R/Vt/2qH+QILMPShOdG5W0fq 1BWPdp/bLGy4LEPSkjojVhl7lBip1PE/U5O8V9nx5f+u+x3wERbSjZCyr/JkA30Q gjIZOCv8ClUJ6rG3xLz0jtI9kKRDNNV56SUfer06NZXt531hicHq2DUyv4Fkdjbo sC4K4e4/DSnos8H6aY0jh+Lc0KcdiYCfJOsWrO0w9S1AWP5pOgytwbIk0bBO8kGe FDRnAUgKMh1cHS1Rna1MG5VauEicSLkOR108YR6f/DpqQ0jvjiQ5I+TiGPuczc42 wV6O9+NKSc0UITE7QxLi+w== 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=1736855866; x= 1736942266; bh=ccYcGhLEFZBML8r4AynsdEC+8DsJVP/81xdkLk/3OyQ=; b=Q XDGXaM/obm1X4HMGKuKdSOk9s5U9Ps49UztSMof+QXMagwb1+Pg0peFGd3BtZjXO YteQ+BWaaS4p+ykG72xbkhTS6IhEn9BHtKpQ00GTE4silDwWyeCoCi2DoIT6yh+z 7pOQRa9xpnIEYtW2VX21eLoeHBwnIY5VOzg0YGWMJw/NLODXEHgi08AshhIZZFvo qCMF+pHuvWv+rqIaxglIuUcbbVKW41TvsgPTO9eVyT6PXkZvkpSZRqHaRsi81r55 IYDL/BkLSqPPolqfsGGrW6Bk93FcRru58Pinlf0B/qVq5wF83NMtSIgNd3qZnkKo BAvY0hrw6RyDsGjB9/98Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehiedgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgepfeenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithes vhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehmvgesthhtrgihlhhorhhrrd gtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Jan 2025 06:57:46 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 6d423209 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 14 Jan 2025 11:57:45 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 14 Jan 2025 12:57:42 +0100 Subject: [PATCH v2 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: <20250114-b4-pks-compat-drop-uncompress2-v2-1-614a2158e34e@pks.im> References: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> In-Reply-To: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> To: git@vger.kernel.org Cc: Taylor Blau X-Mailer: b4 0.14.2 Our compat library has an implementation of zlib's `uncompress2()` function that gets used when linking against an old version of zlib that doesn't yet have it. The last user of `uncompress2()` got removed in 15a60b747e (reftable/block: open-code call to `uncompress2()`, 2024-04-08), so the compatibility code is not required anymore. Drop it. Signed-off-by: Patrick Steinhardt --- Makefile | 1 - compat/zlib-uncompress2.c | 96 ----------------------------------------------- git-compat-util.h | 9 ----- meson.build | 1 - 4 files changed, 107 deletions(-) diff --git a/Makefile b/Makefile index 97e8385b6643b963c54affb3ae621fc93fad28b5..86c6c3d7adfb8b0b52afeaafa3cc3c2a141e2f63 100644 --- a/Makefile +++ b/Makefile @@ -984,7 +984,6 @@ LIB_OBJS += commit.o LIB_OBJS += compat/nonblock.o LIB_OBJS += compat/obstack.o LIB_OBJS += compat/terminal.o -LIB_OBJS += compat/zlib-uncompress2.o LIB_OBJS += config.o LIB_OBJS += connect.o LIB_OBJS += connected.o diff --git a/compat/zlib-uncompress2.c b/compat/zlib-uncompress2.c deleted file mode 100644 index 77a1b08048463da25ba8d6b36031ccb7e8cce7b5..0000000000000000000000000000000000000000 --- a/compat/zlib-uncompress2.c +++ /dev/null @@ -1,96 +0,0 @@ -#include "git-compat-util.h" - -#if ZLIB_VERNUM < 0x1290 -/* taken from zlib's uncompr.c - - commit cacf7f1d4e3d44d871b605da3b647f07d718623f - Author: Mark Adler - Date: Sun Jan 15 09:18:46 2017 -0800 - - zlib 1.2.11 - -*/ - -/* - * Copyright (C) 1995-2003, 2010, 2014, 2016 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* clang-format off */ - -/* =========================================================================== - Decompresses the source buffer into the destination buffer. *sourceLen is - the byte length of the source buffer. Upon entry, *destLen is the total size - of the destination buffer, which must be large enough to hold the entire - uncompressed data. (The size of the uncompressed data must have been saved - previously by the compressor and transmitted to the decompressor by some - mechanism outside the scope of this compression library.) Upon exit, - *destLen is the size of the decompressed data and *sourceLen is the number - of source bytes consumed. Upon return, source + *sourceLen points to the - first unused input byte. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, or - Z_DATA_ERROR if the input data was corrupted, including if the input data is - an incomplete zlib stream. -*/ -int ZEXPORT uncompress2 ( - Bytef *dest, - uLongf *destLen, - const Bytef *source, - uLong *sourceLen) { - z_stream stream; - int err; - const uInt max = (uInt)-1; - uLong len, left; - Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */ - - len = *sourceLen; - if (*destLen) { - left = *destLen; - *destLen = 0; - } - else { - left = 1; - dest = buf; - } - - stream.next_in = (z_const Bytef *)source; - stream.avail_in = 0; - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - stream.opaque = (voidpf)0; - - err = inflateInit(&stream); - if (err != Z_OK) return err; - - stream.next_out = dest; - stream.avail_out = 0; - - do { - if (stream.avail_out == 0) { - stream.avail_out = left > (uLong)max ? max : (uInt)left; - left -= stream.avail_out; - } - if (stream.avail_in == 0) { - stream.avail_in = len > (uLong)max ? max : (uInt)len; - len -= stream.avail_in; - } - err = inflate(&stream, Z_NO_FLUSH); - } while (err == Z_OK); - - *sourceLen -= len + stream.avail_in; - if (dest != buf) - *destLen = stream.total_out; - else if (stream.total_out && err == Z_BUF_ERROR) - left = 1; - - inflateEnd(&stream); - return err == Z_STREAM_END ? Z_OK : - err == Z_NEED_DICT ? Z_DATA_ERROR : - err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR : - err; -} -#else -static void *dummy_variable = &dummy_variable; -#endif diff --git a/git-compat-util.h b/git-compat-util.h index e283c46c6fa06e4079851296a55c9bd5472a65b4..d50f487c00d7958e871bb9a98419e55f866cdd1d 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -1540,15 +1540,6 @@ int common_exit(const char *file, int line, int code); #define z_const #include -#if ZLIB_VERNUM < 0x1290 -/* - * This is uncompress2, which is only available in zlib >= 1.2.9 - * (released as of early 2017). See compat/zlib-uncompress2.c. - */ -int uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source, - uLong *sourceLen); -#endif - /* * This include must come after system headers, since it introduces macros that * replace system names. diff --git a/meson.build b/meson.build index 831da1d43cafe85a8c9ac872e141476adbc08188..e6a0397c25db5875526f8723d5630584b2c2cf8e 100644 --- a/meson.build +++ b/meson.build @@ -256,7 +256,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 14 11:57:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13938697 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (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 A03652361C8 for ; Tue, 14 Jan 2025 11:57:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855870; cv=none; b=RjTTrrizwmElkqyN7a+qK0UwdtDJlQYhd8VDGYW9Ne1FalhutLZa7Zvag+IpBRUe8CM2MWtXqNysQawH776B6NJI9rJCdGoOg2BER3Q/aBBguS2ItwmwImkr2Syzry5IbQ6WK6EEHxZy3LFHKNH+ckelJsbqS6tQDPdX4pSx2KQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855870; c=relaxed/simple; bh=zmo6BVZ1CYKNXz3Rwdif4bODMzIk6Rrwkla9swhhwkc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Hk2rfmMNr8H5lCX/qw8JHcnneqhkvfa0RpiTlJvcWCJDm1APCodxS+wyYO6St9Irn1J25fLm2MtBcDOZb6KQMEtwIHC7gND9WHG7LjWf/35H1Kbjjj3HjMuCVHHQenwfL3/CaWHdX/2y5QCiPY9Z9vIqmP4btfypiZwQbdBFeug= 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=Do4eM8e0; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=FPrpA45Q; arc=none smtp.client-ip=103.168.172.159 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="Do4eM8e0"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="FPrpA45Q" Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id 0D864114012E; Tue, 14 Jan 2025 06:57:48 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Tue, 14 Jan 2025 06:57:48 -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=1736855868; x=1736942268; bh=G09U1odGoU23BD8i38JKusb6NDdpZEv4ha72RO1CYyA=; b= Do4eM8e0WAKOhqKSUlVzQuutqldyr5HeebZkfUIiBVxm0yoxGLBKjNY6hccmIwIN xsZFwj/kg7x6rmmWNwaLu2Y122v7qrrwDmjx5nehyE9zAhm+QVJCMv1BIHa/X7KV Eet6krP/vFR/3MC6M8scoCeKzvdt17sf6ntqFjM5e2PlXLA2khPzM+fbK+AmUanx Bj7dpcyIX4otBx8XlPzPHUBBm5+0OxdcHiIgsEYan2YU8/KiQngcHyR9eqwwnqy8 4NoRe9fPvXdVNw0KJeqCbVEvFipBv7Hr40+HYO3LCSBqpdq/yVkRhte3v6yNTkky 42eZ9xxGJRIxEY9D3vVHrw== 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=1736855868; x= 1736942268; bh=G09U1odGoU23BD8i38JKusb6NDdpZEv4ha72RO1CYyA=; b=F PrpA45QHk1KrV1yfNDo+rNeMHtg725YYzcS0753UJVejGjYUomdePlxgvE1Q3G68 hQSn5Ze/cw2qA4msx6tLeH7gD05nc9D8k0XLLidN0CBENbTC6M5wRP+avKiO103u U8Kuulsu0H+jFcGryaQfHLAxe/XbDe2vFab4TzbNnYA+9CK/3EcPJivU3CEn3V0K Vn7anBn2Ec4rzwRnpb4WldkSpDhLIYpqS+5cPubkzXtti7boTtjWXS2csKzgSvFA 20U8lFxAevzdbnVcfU0qwZPcBqMrnDFFT4l8rxTEKPZUx3GzyROiy8iQzsblUiEx BfG/L2ZLoVyJDAdehqyjQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehiedgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgepfeenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhgvseht thgrhihlohhrrhdrtghomhdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrd horhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Jan 2025 06:57:47 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 93958383 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 14 Jan 2025 11:57:45 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 14 Jan 2025 12:57:43 +0100 Subject: [PATCH v2 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: <20250114-b4-pks-compat-drop-uncompress2-v2-2-614a2158e34e@pks.im> References: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> In-Reply-To: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> To: git@vger.kernel.org Cc: Taylor Blau X-Mailer: b4 0.14.2 Before including we explicitly define `z_const` to an empty value. This has the effect that the `z_const` macro in "zconf.h" itself will remain empty instead of being defined as `const`, which effectively adapts a couple of APIs so that their parameters are not marked as being constants. It is dubious though whether this is something we actually want: not marking a parameter as a constant doesn't make it any less constant than it was. The define was added via 07564773c2 (compat: auto-detect if zlib has uncompress2(), 2022-01-24), where it was seemingly carried over from our internal compatibility shim for `uncompress2()` that was removed in the preceding commit. The commit message doesn't mention why we carry over the define and make it public, either, and I cannot think of any reason for why we would want to have it. Drop the define. Signed-off-by: Patrick Steinhardt --- git-compat-util.h | 1 - 1 file changed, 1 deletion(-) diff --git a/git-compat-util.h b/git-compat-util.h index d50f487c00d7958e871bb9a98419e55f866cdd1d..c4b4b372b473ca0af2a4f5f60554f6d3df74f112 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -1537,7 +1537,6 @@ int cmd_main(int, const char **); int common_exit(const char *file, int line, int code); #define exit(code) exit(common_exit(__FILE__, __LINE__, (code))) -#define z_const #include /* From patchwork Tue Jan 14 11:57:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13938698 Received: from fout-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.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 D0DCF2361D3 for ; Tue, 14 Jan 2025 11:57:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855871; cv=none; b=U8LfTHBIZ8cRCO9L5VlJ0iqLuM1W35wkdU2xml/fXacvunAGx9jV/czCM7GLJjQUkZpmC5lN5TNtKFgQcOWLn5qpLB3n/m5ewMQPyN8L0aPpwX/cFiewkWG0Uv4zxM1GyrcOXGeMHR1eCEnbjnb/YC5mP2E2iO7hou8YGQYgS68= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855871; c=relaxed/simple; bh=Honndp/eeZ32t7YgFoeOv9ULDC+oqWhFX5Ywk6Wp97k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ojx/SaO0aodaxYwfyVnHh0PDUbqoShgL2N72p5F93eTy9v7e+tR9aa6O1qHEo7EF561TjVDzWDZc1KGeNTonzBt4oQDoEVJtiK+zGe5mT2vgCk5IYUe9ZEuyNgjZ2BO8HrDmPqdiN3HPGiy31vSbwbxuYgrDnXavb3XqAj33dSc= 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=UmDgkJZb; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=hyCOJQ4J; arc=none smtp.client-ip=103.168.172.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="UmDgkJZb"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="hyCOJQ4J" Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfout.phl.internal (Postfix) with ESMTP id 034DB1380214; Tue, 14 Jan 2025 06:57:49 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Tue, 14 Jan 2025 06:57:49 -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=1736855868; x=1736942268; bh=yB3pGjx4Z2CVx2VaIL0yNkR09ZINvj+4TSPy2pjvZfk=; b= UmDgkJZbS5megWSMiYq/vsbi087yDTCKEFr9J5lTICsFIBcPdZF9AMgll1DPYOvj Gyy1NU2pIkxeBW7BHuK3jGJdLddY4R3qtRdi9gLK8yNzPQDZsjZfvdRTSSBA7o86 T52gEHE8nGe8nW+2WWiIMBqEizvfiwQm8pqWPGfLgLHKSh1ztP7MRovsuDG7Q5A+ OQoMYhpiTfqBYaNojPHYkWkRWmkTqbYWGGUTDfC3Y0Vgu14Mwkp/87BJ09l2ddsj fBTHrcoFDJXKGFcZS1H2L6GnCj8/FLQYVJkSj0hw8HLxmGaIoCad5H+sTd+yDG9b EDFA+uA0/Y6llBhEjvIJGg== 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=1736855868; x= 1736942268; bh=yB3pGjx4Z2CVx2VaIL0yNkR09ZINvj+4TSPy2pjvZfk=; b=h yCOJQ4JS3N9uLl/EUQuk3wu+EOJf28OBHfRrWQQHiwBjz+UXcuefo8vD7uU6ghgT tJ5Y1t0gZai1MOVuqPo8h5/7mqeSTPykxCxJ022IMLGxhipa2AP4L1E5dlegjNWu QNpF1OEHItGXD/cPJy1ZZ40Xf/CKII6TlSeBu7gEN692wCIx8Rxu6hYY7RaVWSBL QuHz7zCNzJDhHmHqKl3BPiJ6JC8VCNF5vOsPKegq8lfXOxz6+CnwTCPWBpP8pjcY 3vSrfRQlDfKKjn+Luc6er+QI5n+tHrJfZxwIA9wOTzJK3rbVAtzGBR/n7//DByEB EmU2ZiEAtli/lzEyI2RfA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehiedgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithes vhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehmvgesthhtrgihlhhorhhrrd gtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Jan 2025 06:57:48 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 14c6cf18 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 14 Jan 2025 11:57:46 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 14 Jan 2025 12:57:44 +0100 Subject: [PATCH v2 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: <20250114-b4-pks-compat-drop-uncompress2-v2-3-614a2158e34e@pks.im> References: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> In-Reply-To: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> To: git@vger.kernel.org Cc: Taylor Blau X-Mailer: b4 0.14.2 Introduce a new "compat/zlib-compat.h" header that we include instead of including directly. This will allow us to wire up zlib-ng as an alternative backend for zlib compression in a subsequent commit. Note that we cannot just call the file "compat/zlib.h", as that may otherwise cause us to include that file instead of . Signed-off-by: Patrick Steinhardt --- compat/zlib-compat.h | 6 ++++++ git-compat-util.h | 2 +- reftable/block.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/compat/zlib-compat.h b/compat/zlib-compat.h new file mode 100644 index 0000000000000000000000000000000000000000..bc20b884efab72028d5f696923e9800e39b08ce3 --- /dev/null +++ b/compat/zlib-compat.h @@ -0,0 +1,6 @@ +#ifndef COMPAT_ZLIB_H +#define COMPAT_ZLIB_H + +#include + +#endif /* COMPAT_ZLIB_H */ diff --git a/git-compat-util.h b/git-compat-util.h index c4b4b372b473ca0af2a4f5f60554f6d3df74f112..1ca26713221ba0270818ac61b6940f03cdf8b460 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -1537,7 +1537,7 @@ int cmd_main(int, const char **); int common_exit(const char *file, int line, int code); #define exit(code) exit(common_exit(__FILE__, __LINE__, (code))) -#include +#include "compat/zlib-compat.h" /* * This include must come after system headers, since it introduces macros that diff --git a/reftable/block.c b/reftable/block.c index 9858bbc7c5f7aa63fbcaf1acf9f4b5738e0b6d27..bc9b07963448e613ae14d2c4194b48764718290d 100644 --- a/reftable/block.c +++ b/reftable/block.c @@ -13,7 +13,7 @@ license that can be found in the LICENSE file or at #include "record.h" #include "reftable-error.h" #include "system.h" -#include +#include "compat/zlib-compat.h" int header_size(int version) { From patchwork Tue Jan 14 11:57:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13938699 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (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 CE4932361E3 for ; Tue, 14 Jan 2025 11:57:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855872; cv=none; b=jJUiim8AB0kujfjZGjrXK0jNF1QOoYfGzHhNP5EfGaLulKSA96kmiVO1gwqDsaEyQmgL5Fdf7QQWhTE16dWSYuz6Lvh0rC49Vy3WrSsPn6XDPNVvq7Y5KeZVhP/Z8PyqZgoAzBDJBs38/ELIf+FisiICdYu9m+TEVW6/BBHWg7A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855872; c=relaxed/simple; bh=Ha5e/dTFNkSMcQSb8w56kvawCoRLH5O/wFZYPJYCzu0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JHMtY8JYj5allgpz31cZj1xq5iTh2RN2BSBTxeeZ5oC8SlolussQEOMF3g+eIWKE1yKq9O7NyFNdELUUqPNMmOmVMxyRB2GnqiPyXIBkQO63UKZ4ZNoZcncQtZpQpymRs3MII+jLbVFYNmMgCag7VJgloV2vFWZSa17FAUzGU9I= 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=VIzcI/5m; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ao22GT5Z; arc=none smtp.client-ip=103.168.172.159 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="VIzcI/5m"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ao22GT5Z" Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.phl.internal (Postfix) with ESMTP id E3CF611400A6; Tue, 14 Jan 2025 06:57:49 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Tue, 14 Jan 2025 06:57:49 -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=1736855869; x=1736942269; bh=nORK9R0VMdldsjdRCziJsbI70I1ZsEJ6XpjBBL9oh6A=; b= VIzcI/5mlrIy++sBEw/na5KPdwJ/SJMLlP+e8mRbggY/LJ5ZQ1iGSK3DaZvihrMQ 93KUzck0r6dKQy7PEgHX617MKgn3PVlDs15vD6XpqrVjKif7JdOzWioMQWSL+Kl0 El7QKvTHicIMacvcp60kk1axdurhPo3LNP+6TwpexiwBFkcyWQY/4hSw3YaXAoxS GPoXutLw7qkY8cSz4izCrJvh1G4sPWRaYATNbJp1WjOAVXoi9Wy+0Z9igFrUEKCk C6V1nZFCcNKGlymA4qoeTlOhpgkAP/3e6rrwszBq0i4odWVfWTFwzJYVP/40POf8 yia2FNfxC43ZVDVqabrWhQ== 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=1736855869; x= 1736942269; bh=nORK9R0VMdldsjdRCziJsbI70I1ZsEJ6XpjBBL9oh6A=; b=a o22GT5ZbreuKDLVV+0swK51r9wF1QBhGs+xgMEkFn/82WugLMbPs3uUHlGR22UAJ u7Mup7PQJY4HMPgJKJyySols66UIDNRA9D/GiLfntKt8BTx7kdgEEDXnonbl+Q0X VSl3SMDkjBV0gF/nsa0tGX9Ih8FMCV7zMliuXvrqbpDVQNNGECMllFOmQqmV+wtm Eh8t7hTOvyQLs3ECO/B2EsOFlItpevOwtg3vgngIVqUAE7xUxYdObX53zJbEOGI9 S9CZ3niLCu5PeMNw1Vcf678t7OP6CRncwjuwiRVc9iqRagOT99a3BemEEgqo8Szf dMWu47z8N4eGw6boZmNqw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehiedgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhgvseht thgrhihlohhrrhdrtghomhdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrd horhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Jan 2025 06:57:49 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 400b9ef8 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 14 Jan 2025 11:57:47 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 14 Jan 2025 12:57:45 +0100 Subject: [PATCH v2 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: <20250114-b4-pks-compat-drop-uncompress2-v2-4-614a2158e34e@pks.im> References: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> In-Reply-To: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> To: git@vger.kernel.org Cc: Taylor Blau X-Mailer: b4 0.14.2 We include "compat/zlib.h" in "git-compat-util.h", which is unnecessarily broad given that we only have a small handful of files that use the zlib library. Move the header into "git-zlib.h" instead and adapt users of zlib to include that header. One exception is the reftable library, as we don't want to use the Git-specific wrapper of zlib there, so we include "compat/zlib.h" instead. Furthermore, we move the include into "reftable/system.h" so that users of the library other than Git can wire up zlib themselves. Signed-off-by: Patrick Steinhardt --- archive.c | 1 + config.c | 1 + csum-file.c | 3 ++- environment.c | 1 + git-compat-util.h | 2 -- git-zlib.h | 2 ++ reftable/block.c | 1 - reftable/system.h | 1 + 8 files changed, 8 insertions(+), 4 deletions(-) diff --git a/archive.c b/archive.c index b9c200cba618ebc642859f2b3c58731157ed0eba..8be4e7ac8db50c7ae019ad12099362d9d392e194 100644 --- a/archive.c +++ b/archive.c @@ -7,6 +7,7 @@ #include "convert.h" #include "environment.h" #include "gettext.h" +#include "git-zlib.h" #include "hex.h" #include "object-name.h" #include "path.h" diff --git a/config.c b/config.c index 50f2d17b39944626172953475a07a56a9d618740..36f76fafe53ee755c4f18d9ea398b5dbe9a614fe 100644 --- a/config.c +++ b/config.c @@ -19,6 +19,7 @@ #include "convert.h" #include "environment.h" #include "gettext.h" +#include "git-zlib.h" #include "ident.h" #include "repository.h" #include "lockfile.h" diff --git a/csum-file.c b/csum-file.c index 5716016e12eec8c35f6495141fb2fcc250732803..78e04356d3ae9eb592f580fff204b28961934c0b 100644 --- a/csum-file.c +++ b/csum-file.c @@ -11,9 +11,10 @@ #define USE_THE_REPOSITORY_VARIABLE #include "git-compat-util.h" -#include "progress.h" #include "csum-file.h" +#include "git-zlib.h" #include "hash.h" +#include "progress.h" static void verify_buffer_or_die(struct hashfile *f, const void *buf, diff --git a/environment.c b/environment.c index 8389a272700eac7e07710b6899eb045c7df4f69a..e5b361bb5de4c69246098d0d458b567836d174f4 100644 --- a/environment.c +++ b/environment.c @@ -16,6 +16,7 @@ #include "convert.h" #include "environment.h" #include "gettext.h" +#include "git-zlib.h" #include "repository.h" #include "config.h" #include "refs.h" diff --git a/git-compat-util.h b/git-compat-util.h index 1ca26713221ba0270818ac61b6940f03cdf8b460..fb25fbf503cd3e4cfc9bf14c30dcc66951175c4e 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -1537,8 +1537,6 @@ int cmd_main(int, const char **); int common_exit(const char *file, int line, int code); #define exit(code) exit(common_exit(__FILE__, __LINE__, (code))) -#include "compat/zlib-compat.h" - /* * This include must come after system headers, since it introduces macros that * replace system names. diff --git a/git-zlib.h b/git-zlib.h index d8a670aff9fbc476b37e6848a178aec98325d19d..1e8d9aabcb4cb239bdf529926be60b56496e0d4f 100644 --- a/git-zlib.h +++ b/git-zlib.h @@ -1,6 +1,8 @@ #ifndef GIT_ZLIB_H #define GIT_ZLIB_H +#include "compat/zlib-compat.h" + typedef struct git_zstream { z_stream z; unsigned long avail_in; diff --git a/reftable/block.c b/reftable/block.c index bc9b07963448e613ae14d2c4194b48764718290d..38e3081c614ab2240ce0d988db26f2f4f12b17a1 100644 --- a/reftable/block.c +++ b/reftable/block.c @@ -13,7 +13,6 @@ license that can be found in the LICENSE file or at #include "record.h" #include "reftable-error.h" #include "system.h" -#include "compat/zlib-compat.h" int header_size(int version) { diff --git a/reftable/system.h b/reftable/system.h index 5274eca1d05b18bdadef9f991ff79fa83f3363e4..f194a3868634ce7806a85518ebe561a50f5a3ac0 100644 --- a/reftable/system.h +++ b/reftable/system.h @@ -14,6 +14,7 @@ license that can be found in the LICENSE file or at #define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" +#include "compat/zlib-compat.h" /* * An implementation-specific temporary file. By making this specific to the From patchwork Tue Jan 14 11:57:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13938700 Received: from fout-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.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 BCFCD2361EC for ; Tue, 14 Jan 2025 11:57:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855873; cv=none; b=nMkibrRhfi/qWoEXwXGQUIkCr9U0ukArQDX/HW7qxEaZzNmOjagMpN6p/iW5L+wk+ly+LHdiwtE5iqsW3UIwdtLxsTyAE5mZJiBces6+J0Rm7bj2xno31YOWEofOJ/m07NAEDPdXrcejb4fXPL1Xw82P2fKRBBnPMN7aWSb8BiY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855873; c=relaxed/simple; bh=r92l7z9HmELnrzTDskMleuZv0HTmrO8UpFxH8Wf/duI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tPl51mVruMyVDoOwbZEvLBvYCe+tFDcInqrywyUfqioK+fu8xpnXvwUXk7XjMiDtuE7BrDzt31KBkkr2c60jvssaXTEBDbQY75RLICNCspbkgAon/pMRDSzRTRfdtmBg0Q6NnciLuH471iG45ujYEZPR6CKdhqRdzFGrZ1dWzJI= 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=QL81PNIB; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=VFyVVfy1; arc=none smtp.client-ip=103.168.172.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="QL81PNIB"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="VFyVVfy1" Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id E36751380389; Tue, 14 Jan 2025 06:57:50 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Tue, 14 Jan 2025 06:57:50 -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=1736855870; x=1736942270; bh=4thj8EZ6nvc4ZWyvEIc0Ju5Ukod5vB9FH/XIBmTHlS0=; b= QL81PNIByg++rwOT30LJMo2krzT1zsmjbc0UdQ7OLx24moIPV1F3L+hoEDLfaaFk 8E3QBIxUYfmLXXKRlZp26WHqvIjLQaaYzntbDxgFi6dc1iQwDknEyQofi/GSepO1 X1qOGqgg3vZP/lysb5fonNLyqaRhksTQ/I/cQi2l7AFugzbe5k/dBqrB/k4jIruM MRS/x6oAHA07TMSTPiPP36ZauZglJ1s3xwTNXDQMgXG4mGhaRK4w9EvWCyTYMa6R t2xUfGF4/pB99Kr7Y7mupfknt/qPwihuArjopBdqs3nE+re6hyigo8bFN9VhICCx DxMolh7W+RiHFjLISnVUSA== 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=1736855870; x= 1736942270; bh=4thj8EZ6nvc4ZWyvEIc0Ju5Ukod5vB9FH/XIBmTHlS0=; b=V FyVVfy1DtFUXn9TyIm7fSMBRfPcU6bY7M5h2ueYDY3EtQoEhBjEaaOl/PKXmOLSd uCqRpNSSxUbjG2zemv7qBWMu2/qTxcuH4XuZ99POFRTnC8PuVPuELojlS6RQFqfH I+lYN1xFje1VSOUjNyg5Kh6BD2hQs0zQL8pH+XpRiYHfzoeHisXS3GKNlxOpJB6W ASwN/fukmvz8t9UKdrrnLkERswV0XzPM0TY59Vx9cAYUIdEwf5OBId+FqmTUCZ4W YLKJfg9iYVbCShG0PW2Pyjs+r4v68T21aylIrCckEzPvUXHMrCdMa2SzDxx62XgW RFeK8a3ZwrlOa1mqj+3kA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehiedgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhgvseht thgrhihlohhrrhdrtghomhdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrd horhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Jan 2025 06:57:50 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 8273091f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 14 Jan 2025 11:57:48 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 14 Jan 2025 12:57:46 +0100 Subject: [PATCH v2 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: <20250114-b4-pks-compat-drop-uncompress2-v2-5-614a2158e34e@pks.im> References: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> In-Reply-To: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> To: git@vger.kernel.org Cc: Taylor Blau X-Mailer: b4 0.14.2 The `deflateBound()` function has only been introduced with zlib 1.2.0. When linking against a zlib version older than that we thus provide our own compatibility shim. Move this shim into "compat/zlib.h" so that we can adapt it based on whether or not we use zlib-ng in a subsequent commit. Signed-off-by: Patrick Steinhardt --- compat/zlib-compat.h | 4 ++++ git-zlib.c | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compat/zlib-compat.h b/compat/zlib-compat.h index bc20b884efab72028d5f696923e9800e39b08ce3..96a08811a98ff7fa057f5682a5303a06cef40cd1 100644 --- a/compat/zlib-compat.h +++ b/compat/zlib-compat.h @@ -3,4 +3,8 @@ #include +#if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200 +# define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11) +#endif + #endif /* COMPAT_ZLIB_H */ diff --git a/git-zlib.c b/git-zlib.c index d43bbeb6daa4c195048f7012e0bccff8c5b4b5f1..2e973320c232438cce7c83e25cc60a6b773670fc 100644 --- a/git-zlib.c +++ b/git-zlib.c @@ -147,10 +147,6 @@ int git_inflate(git_zstream *strm, int flush) return status; } -#if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200 -#define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11) -#endif - unsigned long git_deflate_bound(git_zstream *strm, unsigned long size) { return deflateBound(&strm->z, size); From patchwork Tue Jan 14 11:57:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13938701 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (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 8D6882361F0 for ; Tue, 14 Jan 2025 11:57:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855874; cv=none; b=lzyri1o2/EqmRx1zZGpoagPApcPcgvwwUqcxPYzf9zSDTELtTe1u9fCOsrY7qRG/2ezzfMQqDiQ0gzsK02NuqO33UZL9EfcQA4MNHhpxmuHWrTByXmZIT9Vac6KZogd1OitTU+jR3peLmPRhE6Sq0iotPWTsynxlYIiGZokrysU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855874; c=relaxed/simple; bh=aqFHJXMkjlrM8Twj/OTcQSu5Yt/IoRdTlVwzdUtEZes=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=drGzoUWMiidM93S7OfvYwBEGi3IHOLcyIz431qdKDOodYrgM/y8kA2XyAErg1mF+JvrEGYs+VYuw3JRZph2/oCCHGm1XiKzYga095ygt8Dh4+AK5m0lgTx/SPcBEMP+itygArmbIMFHWkNwjUmC+o7Q5wrZ3Z2b8iGpR9yZjt2g= 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=OuXXxqsz; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=xko78L2H; arc=none smtp.client-ip=103.168.172.159 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="OuXXxqsz"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="xko78L2H" Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfhigh.phl.internal (Postfix) with ESMTP id E3661114015B; Tue, 14 Jan 2025 06:57:51 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-08.internal (MEProxy); Tue, 14 Jan 2025 06:57:51 -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=1736855871; x=1736942271; bh=C1W54oH/p25izrks45XyLJln+GrQXmp+BITNVC9/j2c=; b= OuXXxqszFWsBtEKJ0sdK94qbB0s9aHDCRgGGX9bcbpOPybykFbKRFSEO3cjo7zUt tyPAJy8Tfk24v0KYneG8Ax/JaEItrhNi14t/DcMBR3wbuuKulQaDSxEUkvbbS4as 69u4Y2dHG8K2txezBfy8DlyNuee6kFGkptgJgzJG7i9FMs1cPjGtBxYmrzyuIZ9t 9keBK1d10wKPtC57ub6KmNwqjF+FRR2uCUlnj/H3jrla4Af8luNHLSCXtoXh2j5n c5qQh+/BSsXZzvg8dIaKBBr7hrHLRBMySo9wEM2Uook2ZxDCFVVIB6NmRH/+V9Wv YYV2HyO+dEbaOrz1TsMQkg== 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=1736855871; x= 1736942271; bh=C1W54oH/p25izrks45XyLJln+GrQXmp+BITNVC9/j2c=; b=x ko78L2HaE7hijZUoENAlZsVU5dAyhhYH0NdUsN0Ob2VJgYZ06FmpmNdvL3zZyYeJ 9X/51qtkxZBiPpuck++F8PCT3Q4g1vfQPe+Kpl2Xj1o3m5NBTxy2YP7FpBlDmrlU Cz1HMzZHMxDLzdMwmZySYSLflJAOpTeTKBn+B6op1nHIM4BGXmMjkKl3YFRNpp18 lX6JZ5lTzJjQNRHTh0BYxvB3FLrh4OIvkuQ4CySngtlHMkV6H2cZxIbzvem1rFhs f0Tm2yd9OcNSehsB737YXYoN7eCKfyzBNuIuM3Z0BELlkSbhRj2p4bNLKcTwiU8x OJ2HadKVzIUMdBMrDqV6w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehiedgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithes vhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehmvgesthhtrgihlhhorhhrrd gtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Jan 2025 06:57:51 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 5777c9e8 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 14 Jan 2025 11:57:49 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 14 Jan 2025 12:57:47 +0100 Subject: [PATCH v2 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: <20250114-b4-pks-compat-drop-uncompress2-v2-6-614a2158e34e@pks.im> References: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> In-Reply-To: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> To: git@vger.kernel.org Cc: Taylor Blau X-Mailer: b4 0.14.2 The function `deflateSetHeader()` has been introduce with zlib v1.2.2.1, so we don't use it when linking against an older version of it. Refactor the code to instead provide a central stub via "compat/zlib.h" so that we can adapt it based on whether or not we use zlib-ng in a subsequent commit. Signed-off-by: Patrick Steinhardt --- archive-tar.c | 4 ---- compat/zlib-compat.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/archive-tar.c b/archive-tar.c index e7b3489e1e6c826d8128cddb0c5be04042a65cec..0edf13fba7568b3950978a05a2f50299bb9b2f18 100644 --- a/archive-tar.c +++ b/archive-tar.c @@ -473,9 +473,7 @@ static const char internal_gzip_command[] = "git archive gzip"; static int write_tar_filter_archive(const struct archiver *ar, struct archiver_args *args) { -#if ZLIB_VERNUM >= 0x1221 struct gz_header_s gzhead = { .os = 3 }; /* Unix, for reproducibility */ -#endif struct strbuf cmd = STRBUF_INIT; struct child_process filter = CHILD_PROCESS_INIT; int r; @@ -486,10 +484,8 @@ static int write_tar_filter_archive(const struct archiver *ar, if (!strcmp(ar->filter_command, internal_gzip_command)) { write_block = tgz_write_block; git_deflate_init_gzip(&gzstream, args->compression_level); -#if ZLIB_VERNUM >= 0x1221 if (deflateSetHeader(&gzstream.z, &gzhead) != Z_OK) BUG("deflateSetHeader() called too late"); -#endif gzstream.next_out = outbuf; gzstream.avail_out = sizeof(outbuf); diff --git a/compat/zlib-compat.h b/compat/zlib-compat.h index 96a08811a98ff7fa057f5682a5303a06cef40cd1..2690bfce41caab2e9af7a09663d620f0ee5136a0 100644 --- a/compat/zlib-compat.h +++ b/compat/zlib-compat.h @@ -7,4 +7,17 @@ # define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11) #endif +#if ZLIB_VERNUM < 0x1221 +struct gz_header_s { + int os; +}; + +static int deflateSetHeader(z_streamp strm, struct gz_header_s *head) +{ + (void)(strm); + (void)(head); + return Z_OK; +} +#endif + #endif /* COMPAT_ZLIB_H */ From patchwork Tue Jan 14 11:57:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13938702 Received: from fout-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.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 6B9932361FE for ; Tue, 14 Jan 2025 11:57:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855875; cv=none; b=jv8/geBDd7/nPxpD+M2ZdQoLS7cn3BNBKCRY///Z060/OAbCbzxAII9U25zf49edsBH8VbvyZCdkeVi80YsQ69dh5FerjNl2Hm+fJD6CKNByHnraZS1m6QEal16X5f94T57kR2usJL/AYogsWUtH9awtVlB0xfCTHAJWcjwmBXQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855875; c=relaxed/simple; bh=pamU+jdlpLJBLc3lM+fpeFvXtzgjojwSm5VYyYQKPPc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ceeZ0bLkQX12RRMyx98LvR878d12/yT83YTSACvOmNunAqhoKyNDS+dZJr3JY5SE/raaoQEW02/M9yfMII61ybTiTZ1Cgwh59+Qt+HMrDS2Uy6GPCnnkuWMe4MsGWWLukv4b/TBE5PEKYQO1g9OXZ8LfMi2/xNC0DRtzjmdJY8o= 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=pHgkYjr9; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=gW4w1ybR; arc=none smtp.client-ip=103.168.172.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="pHgkYjr9"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="gW4w1ybR" Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.phl.internal (Postfix) with ESMTP id CEDAB1380214; Tue, 14 Jan 2025 06:57:52 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Tue, 14 Jan 2025 06:57:52 -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=1736855872; x=1736942272; bh=FzoirsCuTMVAtJ3tU0FqSdLHfmBIVZmFYB8c/2m+0Ok=; b= pHgkYjr9XG4Y5O5/Jy/t2aXcHqhon7yFoVOBVd8HQhL/vcVWYaQ4owV4/c55W7i3 L44g/FL4Wn8r0P/R5mK67c/YgbMlHmcm4N5x/V/TI9s0Z8r+SAL+Gq849Ap7D2+2 obC3G23ZmPyYHpl6g/qUTbsoH2wIROPR1Q8UVZFA6OUoKsz68yY6tFc8XQzijNfh a9TzApxh/ghhgoJlvflXGSmYW3c5XpJH/8UmCvlq/D72H/khCIKWAhRvq+7NVktl mgDKPcwKyi9hemyLL+Ny/ZiuOrf2nHq+1YTIf2sIjgvdHz002meGUYHQCnZezNGz 7RI0Ary6x8Mlxff+ztgSvA== 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=1736855872; x= 1736942272; bh=FzoirsCuTMVAtJ3tU0FqSdLHfmBIVZmFYB8c/2m+0Ok=; b=g W4w1ybRu5IUKCPYyD5ivOIcC4Vf6G2it8WsfgKifV+7v6iU4TmaTFdQ6szJc6wgY zeQLa0ERqtmItGAfA9eUkRRHbnN3O6kMT9QRYwR4PRdkfa8Mnpg9js6WTlpDF6VZ kOW174jPVngdb6ee4mbEUTUlWeLIzijIBmpzex9KOMHDGAqlvDeWanpRV6w3XN+E JAPwT3byLVrQVxFj24nRPjjW4fuREkGM7f5UnmVSiQNdBZay+oClVDrwZw72wkqA jMHfSQsAUpADKWX7xT7oxX3jHzy5YbizhOCPnHtq2yq/0i9UJeLFCFVOldwop0br yTR10nxe33eyQUkNe7Fcg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehiedgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithes vhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehmvgesthhtrgihlhhorhhrrd gtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Jan 2025 06:57:52 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 6d764818 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 14 Jan 2025 11:57:50 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 14 Jan 2025 12:57:48 +0100 Subject: [PATCH v2 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: <20250114-b4-pks-compat-drop-uncompress2-v2-7-614a2158e34e@pks.im> References: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> In-Reply-To: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> To: git@vger.kernel.org Cc: Taylor Blau X-Mailer: b4 0.14.2 The `struct git_zstream::next_in` variable points to the input data that and is used in combination with `struct z_stream::next_in`. While that latter field is not marked as a constant in zlib, it is marked as such in zlib-ng. This causes a couple of compiler errors when we try to assign these fields to one another due to mismatching constness. Fix the issue by casting away the potential constness of `next_in`. Signed-off-by: Patrick Steinhardt --- git-zlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-zlib.c b/git-zlib.c index 2e973320c232438cce7c83e25cc60a6b773670fc..519b3647ac8c55e66b00f46242a6e17fe6b600a1 100644 --- a/git-zlib.c +++ b/git-zlib.c @@ -59,7 +59,7 @@ static void zlib_post_call(git_zstream *s) s->total_out = s->z.total_out; s->total_in = s->z.total_in; - s->next_in = s->z.next_in; + s->next_in = (unsigned char *) s->z.next_in; s->next_out = s->z.next_out; s->avail_in -= bytes_consumed; s->avail_out -= bytes_produced; From patchwork Tue Jan 14 11:57:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13938703 Received: from fout-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.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 9F7F822DC3A for ; Tue, 14 Jan 2025 11:57:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855876; cv=none; b=NksbjK/DcBH7lU75YsdnX4jO7llyTDXwLEL20R+6MFGphRUaN94PtKg1hyxERx3tK1bHRTNOVjtFquTBPNtcfgsKVTL8pdRRL1AsUv9wxkUXyxpLhVoBtCwanuqbX/evj8QjzfOZeIHQtgogK5hk8d/jn2XmElAfcAbt9eGKbSg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855876; c=relaxed/simple; bh=9kXh41K8vHLxMwYVdpVOrZ+vOP7TBScaCvP8Pwb1J1U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WFad4lMxNF5RKjmGlWgujDQLOlbpOGk3mxx5ynClkJd5EQmqQrIxRa9Gq1+3Pw2y/pRgkSXdOcUma+Tpg3A82dvXHUGlnT6bQnDLPeGL9wnhDUP0W2peSA5P4skfXIs58/HrEKAaOjmP9C0qZDK1GLZoml8tzASD8RvkFVUiiRM= 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=sestsnVy; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=s1klN+fO; arc=none smtp.client-ip=103.168.172.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="sestsnVy"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="s1klN+fO" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id C9A8B1380389; Tue, 14 Jan 2025 06:57:53 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Tue, 14 Jan 2025 06:57:53 -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=1736855873; x=1736942273; bh=mEuKSjOU/EtBgynUAotbDS4ov/HmmmHnplOMBXaMYag=; b= sestsnVys8RL0x+kIuwsCRdf3ugQNZ4vLCXPJV2JjctMsNPX5H5greKj4qcqxoVZ XS+d6XoBMVrcjZ/t1/YWpEH9A3Fqxv7YyD7/CxYDJ8R3w5toYjYy+TUmqnjwYCTm 8XmBDWyFOtqTs6eqAREthQu95SftwZLRgvPgG8kMpN6k+LTvYp1aMwIR55fQDEBv zvlUp2pQ+3l5CAUDARjr+GPOmmSaOBd3WJFdxq4rcpJBIjk4l6gr74jnzTHsT1BT hxJInzPxBdRRTY5dvHj2ccA2ORPn+zk9+FhISD0Q37BkQrBs3MGpOY5QEz4lHfBs KqvtvLkR4+0EVXUYOM3BIg== 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=1736855873; x= 1736942273; bh=mEuKSjOU/EtBgynUAotbDS4ov/HmmmHnplOMBXaMYag=; b=s 1klN+fOw7OdT7ST3Fjd+mm7BQV9l0bqoQdGwt1HR9FD+HJnHePR2llDusnuAtQSn B83vl65B6Suvhq+GXFrrXBxoqaaalCOmSy6hgDKik9AnfGVBQK+V0OcdcakP/0vR 4ViLGFpYjaQwb/UB3+xuSLfNcQhHI8jStkp2bryJUNMjwpwkC7rDZrYZ4MVXY/CF u0vzyo+KJGk3c4P6JFK0/4Y1qMJEAD9tacny6eRD2D8Ts2hmZkCbucZb3Z40h45F ubGLMvaDxYS2covQW6wN5nPA1xsYkxfeMnUg64CpnpV1jIH3BlvkEIUhfn9/X20J g9KM3CHcK8cpFt9XtzT2w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehiedgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthekredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepjeffleelfe etvdffgeetgeelhfetjeduuefhhfeviedvgfejvdetleegleehgfefnecuffhomhgrihhn pehgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhht phhouhhtpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtph htthhopehmvgesthhtrgihlhhorhhrrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Jan 2025 06:57:52 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 583ec1e7 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 14 Jan 2025 11:57:50 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 14 Jan 2025 12:57:49 +0100 Subject: [PATCH v2 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: <20250114-b4-pks-compat-drop-uncompress2-v2-8-614a2158e34e@pks.im> References: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> In-Reply-To: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> To: git@vger.kernel.org Cc: Taylor Blau 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 86c6c3d7adfb8b0b52afeaafa3cc3c2a141e2f63..1853e6ddfafbc243d449b62410c003d00f555e0e 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 2690bfce41caab2e9af7a09663d620f0ee5136a0..58e53927b227f8368c73a48f5e5dc84a223f0af5 100644 --- a/compat/zlib-compat.h +++ b/compat/zlib-compat.h @@ -1,13 +1,36 @@ #ifndef COMPAT_ZLIB_H #define COMPAT_ZLIB_H -#include +#ifdef HAVE_ZLIB_NG +# include -#if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200 -# define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11) -#endif +# define z_stream zng_stream +#define gz_header_s zng_gz_header_s -#if ZLIB_VERNUM < 0x1221 +# define crc32(crc, buf, len) zng_crc32(crc, buf, len) + +# define inflate(strm, bits) zng_inflate(strm, bits) +# define inflateEnd(strm) zng_inflateEnd(strm) +# define inflateInit(strm) zng_inflateInit(strm) +# define inflateInit2(strm, bits) zng_inflateInit2(strm, bits) +# define inflateReset(strm) zng_inflateReset(strm) + +# define deflate(strm, flush) zng_deflate(strm, flush) +# define deflateBound(strm, source_len) zng_deflateBound(strm, source_len) +# define deflateEnd(strm) zng_deflateEnd(strm) +# define deflateInit(strm, level) zng_deflateInit(strm, level) +# define deflateInit2(stream, level, method, window_bits, mem_level, strategy) zng_deflateInit2(stream, level, method, window_bits, mem_level, strategy) +# define deflateReset(strm) zng_deflateReset(strm) +# define deflateSetHeader(strm, head) zng_deflateSetHeader(strm, head) + +#else +# include + +# if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200 +# define deflateBound(c,s) ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11) +# endif + +# if ZLIB_VERNUM < 0x1221 struct gz_header_s { int os; }; @@ -18,6 +41,7 @@ static int deflateSetHeader(z_streamp strm, struct gz_header_s *head) (void)(head); return Z_OK; } -#endif +# endif +#endif /* HAVE_ZLIB_NG */ #endif /* COMPAT_ZLIB_H */ diff --git a/meson.build b/meson.build index e6a0397c25db5875526f8723d5630584b2c2cf8e..3e31648dc171d7149c296941591eb94516ca6c93 100644 --- a/meson.build +++ b/meson.build @@ -785,11 +785,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() @@ -1992,4 +2004,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 5429022f30621105cd6974e4260cca60e5f24324..c962c0a676172ed478333b9e56d1430ff9cf0af0 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 14 11:57:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13938704 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (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 72110234CE1 for ; Tue, 14 Jan 2025 11:57:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855877; cv=none; b=ADw0zF5ArEATdRByxH2B2i7QsKTBy/Hi5nRKj02sWMOg7BGb3D3EulD+BAkucbWWyG29wdCDaGpTXYTZJPATUUCTzEypXNBsy+K1vAo0gsUP8pmJEdfbs7Ph3wNn4G3wCGk54jgtmct4F9fXOPqpKdUxQ+PWFHgSGxQNQMHqpWQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855877; c=relaxed/simple; bh=EEdAPCE3r4ALi0QR7iuoKOy0IsrWtJF0in86h86z9kE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uQtMDYHaydsfsWqztrK6ByewdbwN/eeUkQMw772ePqfZBFSeGDKo8bPlC9OW85N7VmTPMrWHm0gRUmIe4vf5V+oMJs++U1Bi/PlFItO08FeBV640hgWw47/ERjksZ+t6L9ZQOQLRsZMPoTjy0573OKMaw9EZ1JZlUlCgmW3mkSM= 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=jIVLnrce; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=HbEm1h4Y; arc=none smtp.client-ip=103.168.172.159 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="jIVLnrce"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="HbEm1h4Y" Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id B7DC51140141; Tue, 14 Jan 2025 06:57:54 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Tue, 14 Jan 2025 06:57:54 -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=1736855874; x=1736942274; bh=MI4hu3GHj3d7JayYXZT+VUBPRnsNKflwzpJqzkbo5ZI=; b= jIVLnrceMQFK3x+iif4PUktiU/3Hi3xm7vKkGdEdQvOODgCzcDciSDL/1dnsAm0O ZydUiN6PZnV48goYYrFWx+rNQjdile5jwwaJEee5y5l7RIUUlNfMgbI8+ZPeXTZg sN3M6tBhFP4+Qt52yT1Otb6CeUC6Z0LwIK8buuAR0oHxHF/o8Px3gvgDPwTzldU5 id5B+s6ExKMMfcm949TK6Vc2jPVd1mYln4+ZrSxht1SuGY332Yz/TUNCkzgnZgrZ cKWwWUr9FanGoS+gemQ3i9PRDK/Uufh/zae+XgxcKhnAzz7c+sJHMsI120sEm0zH CIU1WZVXYEhs8fMEmy+YRw== 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=1736855874; x= 1736942274; bh=MI4hu3GHj3d7JayYXZT+VUBPRnsNKflwzpJqzkbo5ZI=; b=H bEm1h4YI4ABtGbNXzoiubpDSPNyTDmCb6YF2zDPh0vaMI74ZJUmu+9oCbR7zljpZ ug+kfI5cdY/rZCAPH8JokJ0xD8fCwDxMsLY/yV4JInM1otdISP9tZ9+lk//oWF+U OE/enTT3Hn886KgeRtm+gd/xsj1LACxnu+zpRCGz3Gk8e9682I8eAW+0kCl5wccy ynR7Esz/3yUSRWThrE338Vncw16xBtzZUEAEfrw4vLtPFv80qjWgc250IoflktmK NQXAMOCG1SSSZhpb3mVcP2zzJQTlA56qQlz9ZVicc/BbobaBRPcxZ3usClbAWKeW BZpT0+cgq+2hYfpiyKJTA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehiedgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgepgeenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepghhithes vhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehmvgesthhtrgihlhhorhhrrd gtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Jan 2025 06:57:53 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 8ba91226 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 14 Jan 2025 11:57:51 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 14 Jan 2025 12:57:50 +0100 Subject: [PATCH v2 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: <20250114-b4-pks-compat-drop-uncompress2-v2-9-614a2158e34e@pks.im> References: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> In-Reply-To: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> To: git@vger.kernel.org Cc: Taylor Blau 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. 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 7f55f8b3a91d6caf95934af308a2bd35a19a62f1..83bf9b918ba1b90c778d1a72cdbfa9a97ef86bdf 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 4976e18a0503298f38230f5ba7348675baf48664..f737e4177c24d21f08dfa5c2fba8aa082c4cf6b1 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 d1cb9fa8785388b3674fcea4dd682abc0725c968..5ae80b0486c65833825352019b2873498e801db0 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 8885ee3c3f86c62e8783d27756b8779bd491e7e6..71d85ae85a02e5a4389e133ed53f45a5042af36e 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 6c828c3b755153dab179f73346e7124bda49c90e..8f79ccf53e1e92f344e0e0117e93113e5610c3a2 100755 --- a/ci/run-build-and-tests.sh +++ b/ci/run-build-and-tests.sh @@ -54,7 +54,8 @@ case "$jobname" in group "Configure" meson setup build . \ --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 3e31648dc171d7149c296941591eb94516ca6c93..eadd8a99a3f2e65deb20c36945d0abb8106cf083 100644 --- a/meson.build +++ b/meson.build @@ -657,7 +657,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 c962c0a676172ed478333b9e56d1430ff9cf0af0..e9f8e990e3e88de5baea652825b4745c230473c4 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 14 11:57:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13938705 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (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 5C7D8234D06 for ; Tue, 14 Jan 2025 11:57:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855877; cv=none; b=YRQ9odnsEEY3u7Knv/1ryS4obEIXrtzh+J+ETB93CfXJlsdc07EuHYok4eT7LtNyr8qxCBDqcRoLZ+WAiy3m3+kVeirqMnpHWscPF524f37Viy0A13l99JffYJ3MCz10k5HP1BuN1ew2/Dn0ioDMSdHCORiPfjt0U82zyrTxXzg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736855877; c=relaxed/simple; bh=r4rwZyzZHLIWtYqLqD8MmQnB266kRxTp1Mwa8mZapz8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YSd7NpTMr9cFVSJYn3WjYXvjSWIRnZG0v8eaHm3eos22oj/wiAJkolXcfTMsGcVX8IlF5mt57duT5FB2riU8i25nDstCkG3choEdP0f9Es3PuTRt+ha+amRADn3CzFt5d84+bkxNc94cL4B5neJqs/xvcic9rl24kiHH6DUUK20= 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=BPWnTLjZ; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=N/+8IsPW; arc=none smtp.client-ip=103.168.172.159 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="BPWnTLjZ"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="N/+8IsPW" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id A9A38114015B; Tue, 14 Jan 2025 06:57:55 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Tue, 14 Jan 2025 06:57:55 -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=1736855875; x=1736942275; bh=0qFE4We6SZ7pOyiT7RV1pzTcJVkIzCTQdsce9iHa2pI=; b= BPWnTLjZ/jxvMjgCEsWMB3GM2mG0xjxlsL7J/G/4Oc/norTkJ00iTyitqTZXnHVO 7XISqB6WHH9o93kNDlY4NtZxSEqBfvM2fCJ/jba5S5iM5+ohejiCYR0Rs49MLKbN jT6uuYFVOKRKs+h2ZDFrQHzUgXunrr3HLeeLSVNKAERvzTCvIhywvagJTxqlmIXs D96xjP0UZUZihy6CMuSA43FfhQFR7z4MTUpOXBLfrCQrBoM/frbHJYvWiofUSfun WhOMqd6DGmAuLxOEPidY1sluQFXRKDMX3ZPXmX6S87f/OYVU0qsf2Jwti0gSR6Hy 6RHjeDJLkrsSxeJ50w+Gyg== 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=1736855875; x= 1736942275; bh=0qFE4We6SZ7pOyiT7RV1pzTcJVkIzCTQdsce9iHa2pI=; b=N /+8IsPW5zxOj5ZetU+N0kJJafRWEQHEoA57FvFlCfgDq9na9QMLatj5cqHrC26yN e8omnNbvERxI4DUgv/mTJb61b7mlUO6/LDvKTlV39vy8/58ihVlsUFUSCEpS/SMH 0lDQvNPecfkWnkBgiibzoiD6u2DHBO4K1JC+H7LOOCnQBQTyBQQW3jM7I8WaL5UM ZvLEmK4aGKAb0Pwwiz9VSBLep5BuZQsstf6bv/bEs/SwNXr5TVkb2PdxfAtUZEcx E/Ppguwz/1tBTCTKMk4BP2QpKrIEFkBmuWhOZeeXH2sQCIucbmwLpcFLGm1+iTEm hMYunCPxZuwreEVxUzz+A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehiedgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhfffugg gtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheprfgrthhrihgtkhcuufhtvghi nhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvghrnhepffeuieduje dvkeehuedvkeefffeivdeuleetkeduheejteekgedvudfgtdfgieelnecuvehluhhsthgv rhfuihiivgepvdenucfrrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimhdpnh gspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhgvseht thgrhihlohhrrhdrtghomhdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrd horhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Jan 2025 06:57:54 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id cc37a002 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 14 Jan 2025 11:57:52 +0000 (UTC) From: Patrick Steinhardt Date: Tue, 14 Jan 2025 12:57:51 +0100 Subject: [PATCH v2 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: <20250114-b4-pks-compat-drop-uncompress2-v2-10-614a2158e34e@pks.im> References: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> In-Reply-To: <20250114-b4-pks-compat-drop-uncompress2-v2-0-614a2158e34e@pks.im> To: git@vger.kernel.org Cc: Taylor Blau 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 5ae80b0486c65833825352019b2873498e801db0..be7ab4b1bfe972f4b5437c8372c0b9935f4e638d 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 ;;