From patchwork Wed Apr 16 23:18:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14054578 Received: from avasout-ptp-003.plus.net (avasout-ptp-003.plus.net [84.93.230.244]) (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 52BF2241679 for ; Wed, 16 Apr 2025 23:19:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.244 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845558; cv=none; b=Fnf3eDUN+CarrbO1ujbN28PqqCNRb5u07gjZ+2W2QdUz+g/Us5s0W3bA10sTtsHnTMy5d94hnuHwcZ2iN7sUO1mKFMdWyTTXFfaVa9J7J3ugyb9vXZDyQGo8TI/8ppsZh3Waho6vj2pCfm6yWjh5w+e1dmPxI9CvCTxj/bZ/FAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845558; c=relaxed/simple; bh=f0adEdphm6D1w5sI1UDtvwg1RNgImY2wgWCLVqXF8x8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i5KHpC0gxMF0+8OxdsLt4QQQNhdAKCTH0V2xahFSwgZCNse65+/pqQsh4R06viZYdBGiFocGk/VpLIaxkWPhAKxVIF0MtR2rq4brhKVqmzVOt08tATTijTgpR03vJQOfZnGCNxOILdJGlMqju5KSko55yNu2nJxExD3xIckIOgA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com; spf=none smtp.mailfrom=ramsayjones.plus.com; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b=GGdJ7CSO; arc=none smtp.client-ip=84.93.230.244 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b="GGdJ7CSO" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 5C1quLy9hjZe55C2Fu8KP8; Thu, 17 Apr 2025 00:19:15 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1744845555; bh=6BLxwGhSTMyZVlMf52Y5aa7oCWJkI1NpAoiBUH1U3GY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GGdJ7CSOsQv2JCkY21KSgC6I1KwzoYXKeHWkLxNKFgsA9LM8sLl9cuFXPChTze000 munGA341sec43nOR0iA/VAU2Yl8k83ayv+xUly8EowrdgznrwsUAEM40bxF6cAMf5w Oeg+zOBecduUzjXMr3Kyz75uazDiQn9+Lg3cXk4lCVwGCbbu2a9DdAfKLhXX5dCSMF kX/VuVvqe9bOGCX7UE2J5VI7+AVGxd0OZaptOEuMcNcMNcgdZc7Xo/6NhIkeGKk1OU Rh4RG7aoFlRPQKca/+4cFRttYDuHN6A1sBxFHL6/NQ0WOvj5rPAKRKUcCuxOqFfNKZ VoOi9X4gPxj0A== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=UuDANPwB c=1 sm=1 tr=0 ts=68003af3 a=oM5NSl/Bl4BpjFr0C8iQlQ==:117 a=oM5NSl/Bl4BpjFr0C8iQlQ==:17 a=EBOSESyhAAAA:8 a=jTtcdIhh7rpG9tgoBZEA:9 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 From: Ramsay Jones To: GIT Mailing-list Cc: Junio C Hamano , Patrick Steinhardt , Adam Dinwoodie , Ramsay Jones Subject: [PATCH v3 01/13] meson.build: remove -DCURL_DISABLE_TYPECHECK Date: Thu, 17 Apr 2025 00:18:22 +0100 Message-ID: <20250416231835.2492562-2-ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> References: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CMAE-Envelope: MS4xfCkIDeVaHQH+ElRfKakhANtsj/jqof5Y7NluH3xX8TfyuUMvjYifuftdQZQie/UMlRC5qvRsXQIbxs3C+Ex6puNDa977P3/HwwHqZWsAynXLqKFfvtdn ogVlblcdz/gif79vsJR1LP+Yckqoxs8JcEKzeT6qxsJ7hSLoqL6VwQ41uSGlwzRJ5UYr7TrLud/zn/nChXGXhN9CGFdKGdiDVUU= Commit 9371322a60 ("sparse: suppress some \"using sizeof on a function\" warnings", 2013-10-06) used target-specific variable assignments to add -DCURL_DISABLE_TYPECHECK to SPARSE_FLAGS for each of the files affected by the "typecheck-gcc.h" warnings. (http-push.c, http.c, http-walker.c and remote-curl.c). These warnings are only issued by sparse, and not by gcc, so we do not want to disable the 'type checking' for non-sparse targets. The meson build does not provide any sparse targets, so there is no need to use the CURL_DISABLE_TYPECHECK preprocessor flag with the c compiler. In order to re-enable the curl 'type checking' in the meson build, remove the assignment of -DCURL_DISABLE_TYPECHECK to libgit_c_args. Signed-off-by: Ramsay Jones --- meson.build | 1 - 1 file changed, 1 deletion(-) diff --git a/meson.build b/meson.build index efe2871c9d..88a29fd043 100644 --- a/meson.build +++ b/meson.build @@ -966,7 +966,6 @@ if curl.found() # Most executables don't have to link against libcurl, but we still need its # include directories so that we can resolve LIBCURL_VERSION in "help.c". libgit_dependencies += curl.partial_dependency(includes: true) - libgit_c_args += '-DCURL_DISABLE_TYPECHECK' build_options_config.set('NO_CURL', '') else libgit_c_args += '-DNO_CURL' From patchwork Wed Apr 16 23:18:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14054579 Received: from avasout-ptp-003.plus.net (avasout-ptp-003.plus.net [84.93.230.244]) (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 6CAA924A067 for ; Wed, 16 Apr 2025 23:19:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.244 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845563; cv=none; b=GTunteb/4zLAsAy8nXaMJ3GPk2NtHY1N/ucjXVofO8krdD9HT2H0ROW5HNikyCD9V3qXv4l2A/YKDEapQhhTpMFYO/mAVZ05CdogUvvdZK/p71yVZfloP7NooFiGN8NCwMrqSqzI4MOZjVchZ2yEieKRasMWr3ImjP1d2sMLX14= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845563; c=relaxed/simple; bh=4oZtVPkKwwvl4/kG3Pcwo/gIn6elwSpnxPM52qbEXxg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JPk7842m+jBOlnkaedhzCtwNN1lVRG8rsyX9gziweqt8WEE8bfih5axgkiBTVNiyjGgFOgtPpDKd8X2d9derEgJ++YDMvaNXXrRlFhWEGgVA9G3VMwweMGYRRBnm/g7LChWY38d85WeaVgOBY6eZAJVIartk8OYvlsIyV43Li4M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com; spf=none smtp.mailfrom=ramsayjones.plus.com; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b=ExwAMtB8; arc=none smtp.client-ip=84.93.230.244 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b="ExwAMtB8" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 5C1quLy9hjZe55C2Ku8KPD; Thu, 17 Apr 2025 00:19:20 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1744845560; bh=mnSwRgfsuqwJWe3cxnQyOOlcRFjXhLi55yE0/tQoN7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ExwAMtB8v2Wf0tShyXsVEaLOYN3KCVIDVQrVRsefn20Z8/rdoFa5cawzVygSV2mXt 9ROdoRDXTcHOTm9/U/XS5LhQ2v4KyX3mvcoWEJpfY02yfvw8buN824RGe+RY9YcMH4 iLvYoRGNuyfg5dVmqzOSm9N/IDRm+4f9yqnob9lPgnihvSOw45cjWXtRk4Pzohjs3w rni+uA25uRQvaRGOvAr7q3UCB9ornCgJQXG+2rbq0t9ONUUrzokwNCRMbrNRWPvHqS eIR0kAhzi9IenYCBuWglhJ33IVtG1FHGuv4T7rMgAEDgMOd4aDN2puJK1T5GtpJZq5 5tTbgEXrBpjRw== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=UuDANPwB c=1 sm=1 tr=0 ts=68003af8 a=oM5NSl/Bl4BpjFr0C8iQlQ==:117 a=oM5NSl/Bl4BpjFr0C8iQlQ==:17 a=EBOSESyhAAAA:8 a=UssqkuoP40Gt3Q7oBg4A:9 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 From: Ramsay Jones To: GIT Mailing-list Cc: Junio C Hamano , Patrick Steinhardt , Adam Dinwoodie , Ramsay Jones Subject: [PATCH v3 02/13] Makefile: only set some BASIC_CFLAGS when RUNTIME_PREFIX is set Date: Thu, 17 Apr 2025 00:18:23 +0100 Message-ID: <20250416231835.2492562-3-ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> References: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CMAE-Envelope: MS4xfBVAVUe9R6cm6rFnbT9u7nSxogkiJ40lTbm9o+kpyDckxMfCDC5vItASLRzL+OO0oCkocv1ipB3MIjvviV1J49LUC+m3XcJvJTDkyKD7JKg+sZ3JrFQG MeUXSjNCYq5mZX7usnmHuEBpvlARGSExajiPCsSlrFX1lR8GBA81p21dyviKrJoaKCRX/M1KsEm2UahSFIDv1IGnZfurqggczNw= Several build variables only have any meaning when the RUNTIME_PREFIX variable has been set. In particular, the following build variables are otherwise ignored: HAVE_BSD_KERN_PROC_SYSCTL PROCFS_EXECUTABLE_PATH HAVE_NS_GET_EXECUTABLE_PATH HAVE_ZOS_GET_EXECUTABLE_PATH HAVE_WPGMPTR Make setting BASIC_CFLAGS, for each of these variables, conditional on the RUNTIME_PREFIX being defined. Signed-off-by: Ramsay Jones --- Makefile | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 7315507381..818dde32a9 100644 --- a/Makefile +++ b/Makefile @@ -2179,10 +2179,6 @@ ifdef HAVE_BSD_SYSCTL BASIC_CFLAGS += -DHAVE_BSD_SYSCTL endif -ifdef HAVE_BSD_KERN_PROC_SYSCTL - BASIC_CFLAGS += -DHAVE_BSD_KERN_PROC_SYSCTL -endif - ifdef HAVE_GETDELIM BASIC_CFLAGS += -DHAVE_GETDELIM endif @@ -2213,25 +2209,33 @@ ifneq ($(findstring openssl,$(CSPRNG_METHOD)),) EXTLIBS += -lcrypto -lssl endif -ifneq ($(PROCFS_EXECUTABLE_PATH),) - procfs_executable_path_SQ = $(subst ','\'',$(PROCFS_EXECUTABLE_PATH)) - BASIC_CFLAGS += '-DPROCFS_EXECUTABLE_PATH="$(procfs_executable_path_SQ)"' -endif - ifndef HAVE_PLATFORM_PROCINFO COMPAT_OBJS += compat/stub/procinfo.o endif -ifdef HAVE_NS_GET_EXECUTABLE_PATH - BASIC_CFLAGS += -DHAVE_NS_GET_EXECUTABLE_PATH -endif +ifdef RUNTIME_PREFIX -ifdef HAVE_ZOS_GET_EXECUTABLE_PATH - BASIC_CFLAGS += -DHAVE_ZOS_GET_EXECUTABLE_PATH -endif + ifdef HAVE_BSD_KERN_PROC_SYSCTL + BASIC_CFLAGS += -DHAVE_BSD_KERN_PROC_SYSCTL + endif + + ifneq ($(PROCFS_EXECUTABLE_PATH),) + pep_SQ = $(subst ','\'',$(PROCFS_EXECUTABLE_PATH)) + BASIC_CFLAGS += '-DPROCFS_EXECUTABLE_PATH="$(pep_SQ)"' + endif + + ifdef HAVE_NS_GET_EXECUTABLE_PATH + BASIC_CFLAGS += -DHAVE_NS_GET_EXECUTABLE_PATH + endif + + ifdef HAVE_ZOS_GET_EXECUTABLE_PATH + BASIC_CFLAGS += -DHAVE_ZOS_GET_EXECUTABLE_PATH + endif + + ifdef HAVE_WPGMPTR + BASIC_CFLAGS += -DHAVE_WPGMPTR + endif -ifdef HAVE_WPGMPTR - BASIC_CFLAGS += -DHAVE_WPGMPTR endif ifdef FILENO_IS_A_MACRO From patchwork Wed Apr 16 23:18:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14054580 Received: from avasout-ptp-003.plus.net (avasout-ptp-003.plus.net [84.93.230.244]) (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 AA4F324BD00 for ; Wed, 16 Apr 2025 23:19:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.244 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845569; cv=none; b=CYi5H2aLOOdG7DSwF0nH05g8kRtt9op2pR4eL7dOPfzQeNbgEWzRqrs6feB2bgsd1g7HS7DW3J91bilIcQYlDxP6RVxkyCKvAOnHWfqbbQS7q3aJ0+7hHLfxow8t6XbX1n8gyWBnLMxX6AQuUC3o0KCOmhvR3vHAewgdqLsZ51s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845569; c=relaxed/simple; bh=bW/j7rKgYhirA3eLLuJkFjLSgCAypFp8g5mp1rmzIgM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b454+MBvwdycoKz9jrSUZHZ6/fl54dbPXpyokzOMvCKKJr8l+bmLxcXAnJkmNsRviO+qajRvqL2qk6tFcLuMcLCeRO1uq5XgNdG1928R9Wpl70dGLLD2y7LNskSBkKELdEoXLKcYI8JOqR5GXQQf5iFVGJ3wLrYLcBUIOJbTgso= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com; spf=none smtp.mailfrom=ramsayjones.plus.com; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b=CrnPyyTL; arc=none smtp.client-ip=84.93.230.244 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b="CrnPyyTL" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 5C1quLy9hjZe55C2Qu8KPI; Thu, 17 Apr 2025 00:19:26 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1744845566; bh=3n50cZYJlZz6WMT7x1eU8mzOm0zp4CHQZUs4o4EFlfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CrnPyyTLbvdMafIMMEh7zeQKiKAmcH6/Ohr9EZ7VFfaQP+toXUeInvWVh4boh27L5 gi5p1oHnFhHZ8OsIwXIjddF08uStgnU9gRDIuUpClboLhzkG1LEHNIr5q9tgSEDRKw 4Gbg3M1PpEZv3+4/jMnVNnx5J8pldCZLavUYJnaqXFLRzsDGhf/a6WDK+1IQVX2DMT sX6WpiGx3RSc6bU7nbAWmv7nxUgn+9+s+0CWMc5tJpdpRavY6my0tTTfCIHWa8xqOd y4z1Eut/LvQKrXMWqrXEmQ6vcLsFmp5GBUA5wX4CbbdL6YKE7EUIxLIezaS5u346Kl rokYhIe8E5Avg== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=UuDANPwB c=1 sm=1 tr=0 ts=68003afe a=oM5NSl/Bl4BpjFr0C8iQlQ==:117 a=oM5NSl/Bl4BpjFr0C8iQlQ==:17 a=EBOSESyhAAAA:8 a=Vy2chUuRFShQgWdV_nEA:9 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 From: Ramsay Jones To: GIT Mailing-list Cc: Junio C Hamano , Patrick Steinhardt , Adam Dinwoodie , Ramsay Jones Subject: [PATCH v3 03/13] meson.build: only set build variables for non-default values Date: Thu, 17 Apr 2025 00:18:24 +0100 Message-ID: <20250416231835.2492562-4-ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> References: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CMAE-Envelope: MS4xfArNOIIO7kvRz8Upkmr4KdGpI3AELEIoaaG+9qPBlbiub28fQICX8Mo3mMlGtVe26wLQGQb6niPs/d0aXIi6BljStI+SD6zAUWVml+H5BhEDZ0g0pPV0 vFrYRkIhLCDU59Vz3ca7dqw6du83rLfr89IKgg1V0LAHpSH5krCFv59WNiMUX8q1FEqtincBiAo7KoplbR/dzNDOOLe3+McR3K0= Some preprocessor -Defines have defaults set in the source code when they have not been provided to the C compiler. In this case, there is no need to pass them on the command-line, unless the build requires a non-standard value. The build variables for DEFAULT_EDITOR and DEFAULT_PAGER have appropriate defaults ('vi' and 'less') set in the code. Add the preprocessor -Defines to the 'libgit_c_args' only if the values set with the corresponding 'options' are different to these standard values. Also, the 'git-var' documentation contains some conditional text which documents the chosen compiled in value, which would not read well for the standard values. Similar to the above, only add the corresponding '-a' attribute arguments to the 'asciidoc_common_options' variable, if the values set in the 'options' are different to these standard values. Signed-off-by: Ramsay Jones --- Documentation/meson.build | 20 ++++++++++++++++++++ meson.build | 13 +++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/Documentation/meson.build b/Documentation/meson.build index 594546d68b..1642b6e2a3 100644 --- a/Documentation/meson.build +++ b/Documentation/meson.build @@ -242,6 +242,16 @@ if docs_backend == 'asciidoc' '--attribute=build_dir=' + meson.current_build_dir(), ] + pager_opt = get_option('default_pager') + if pager_opt != '' and pager_opt != 'less' + asciidoc_common_options += '-agit-default-pager=' + pager_opt + endif + + editor_opt = get_option('default_editor') + if editor_opt != '' and editor_opt != 'vi' + asciidoc_common_options += '-agit-default-editor=' + editor_opt + endif + documentation_deps = [ asciidoc_conf, ] @@ -279,6 +289,16 @@ elif docs_backend == 'asciidoctor' '--require', 'asciidoctor-extensions', ] + pager_opt = get_option('default_pager') + if pager_opt != '' and pager_opt != 'less' + asciidoc_common_options += '-agit-default-pager=' + pager_opt + endif + + editor_opt = get_option('default_editor') + if editor_opt != '' and editor_opt != 'vi' + asciidoc_common_options += '-agit-default-editor=' + editor_opt + endif + documentation_deps = [ asciidoctor_extensions, ] diff --git a/meson.build b/meson.build index 88a29fd043..efd0bd3319 100644 --- a/meson.build +++ b/meson.build @@ -693,10 +693,8 @@ endif # These variables are used for building libgit.a. libgit_c_args = [ '-DBINDIR="' + get_option('bindir') + '"', - '-DDEFAULT_EDITOR="' + get_option('default_editor') + '"', '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"', '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"', - '-DDEFAULT_PAGER="' + get_option('default_pager') + '"', '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"', '-DETC_GITCONFIG="' + get_option('gitconfig') + '"', '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"', @@ -708,6 +706,17 @@ libgit_c_args = [ '-DPAGER_ENV="' + get_option('pager_environment') + '"', '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"', ] + +editor_opt = get_option('default_editor') +if editor_opt != '' and editor_opt != 'vi' + libgit_c_args += '-DDEFAULT_EDITOR="' + editor_opt + '"' +endif + +pager_opt = get_option('default_pager') +if pager_opt != '' and pager_opt != 'less' + libgit_c_args += '-DDEFAULT_PAGER="' + pager_opt + '"' +endif + libgit_include_directories = [ '.' ] libgit_dependencies = [ ] From patchwork Wed Apr 16 23:18:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14054581 Received: from avasout-ptp-003.plus.net (avasout-ptp-003.plus.net [84.93.230.244]) (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 C9DD324BD00 for ; Wed, 16 Apr 2025 23:19:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.244 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845573; cv=none; b=E58YZUA79jmBfkbF6xA3mxGAvfVfGLDEZl+fRgzDD0yWC9Ssm2F0MxMm47uYckq/HITmRttkkYu3bqNp4XSqdbTdmc389lMv9O4QwZ/+7vCnSsao96/q1jOH4P3N+7ONv22NISJf9zp+YQ0cPNyNNBjpbAyI+so3pTR6uUOfLcM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845573; c=relaxed/simple; bh=CPmYKMmTb9AXzVMVfvG7PCfEyENCM/NIr7hl6XLnyN4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u69XBIjENje43qCs4FBbXVJdZ8vk8nwqtRo2ccqieXYIobZBZXtRkyMJg2c2Hqk8mKT7Hz0B7lN9JvNsm4QCreS/jkD48iFv5EfDCFPbi5PSC+PVT8H/109I+5F6MZyqnbwsbYrP+k6z8qROGW8wRMVnePblp5yq+u8Qk8xjqYQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com; spf=none smtp.mailfrom=ramsayjones.plus.com; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b=TYRBQ3B/; arc=none smtp.client-ip=84.93.230.244 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b="TYRBQ3B/" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 5C1quLy9hjZe55C2Vu8KPO; Thu, 17 Apr 2025 00:19:31 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1744845571; bh=/kmbUB+q16OLoAX1Ktai3FPtuGvbh9wjvtuedrSTUbI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TYRBQ3B/qeemhr2FcGiGAGEqPpzpEQ/hiQrXwX7BZxpEkZuSchUsgkmMY6xPOK5B6 numQ6Msc0iLJUfGBhU7NSxuq4QHzvhGSD2NAQHhP5Si5OdUL92UM9qS2cj5IK6vrpv rqw0gpahUHE2NqcT4sfYCeeMd0+wM7NCJNpE9cq/9Ou+xNMJI3wNDrvnj4yMKipUR2 2O7vvglNndSxhnaFjE3O1Va45DT3jpxfjoRxN0MYkgsqNAu1MMwkgQVYBeD99fKas/ Pt5z12d5tywZDBMVgVQQeasoOCYNIMoAUoqhRJPIgnxHhZ5UzEGoZ4u9ZIB1c/6phL XAHfBOxVmJLAQ== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=UuDANPwB c=1 sm=1 tr=0 ts=68003b03 a=oM5NSl/Bl4BpjFr0C8iQlQ==:117 a=oM5NSl/Bl4BpjFr0C8iQlQ==:17 a=EBOSESyhAAAA:8 a=anev5XLoH9Hw9iYphZAA:9 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 From: Ramsay Jones To: GIT Mailing-list Cc: Junio C Hamano , Patrick Steinhardt , Adam Dinwoodie , Ramsay Jones Subject: [PATCH v3 04/13] meson.build: set default help format to html on windows Date: Thu, 17 Apr 2025 00:18:25 +0100 Message-ID: <20250416231835.2492562-5-ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> References: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CMAE-Envelope: MS4xfHa/7CXei91mTFPpZ5q0d0OegWpE+Z419sKa7lsB2bbBCqoTxVTaVFb0rHTlbb6AxaydKW5d6SEXowajKXxIdBGYc8Ic85RwOi3OhZXj0DIdxvba/MVV zMsOQq5XJwW8edNGrN+/kaSoBa9b7v7fUfSbdiWafMVlW2/Zv5sTeiONdx9dLdMc2WknT8FuVOTWxJn+G0n7o44TOMSUdz6Mq2k= The build variable DEFAULT_HELP_FORMAT has an appropriate default ('man') set in the code, so there is no need to pass the -Define on the compiler command-line, unless the build requires a non-standard value. In addition, on windows the make build overrides the default help format to 'html', rather than 'man', in the 'config.mak.uname' file. In order to suppress the -Define on the C compiler command-line, only add the -Define to the 'libgit_c_args' variable when the requested value is not the standard 'man'. In order to override the default value on windows, add a 'platform' value to the 'default_help_format' combo option and set it as the default choice. When this option is set to 'platform', use the 'host_machine.system()' method call to determine the appropriate default value for the host system. Signed-off-by: Ramsay Jones --- meson.build | 13 ++++++++++++- meson_options.txt | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index efd0bd3319..8f8a258064 100644 --- a/meson.build +++ b/meson.build @@ -694,7 +694,6 @@ endif libgit_c_args = [ '-DBINDIR="' + get_option('bindir') + '"', '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"', - '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"', '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"', '-DETC_GITCONFIG="' + get_option('gitconfig') + '"', '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"', @@ -717,6 +716,18 @@ if pager_opt != '' and pager_opt != 'less' libgit_c_args += '-DDEFAULT_PAGER="' + pager_opt + '"' endif +help_format_opt = get_option('default_help_format') +if help_format_opt == 'platform' + if host_machine.system() == 'windows' + help_format_opt = 'html' + else + help_format_opt = 'man' + endif +endif +if help_format_opt != 'man' + libgit_c_args += '-DDEFAULT_HELP_FORMAT="' + help_format_opt + '"' +endif + libgit_include_directories = [ '.' ] libgit_dependencies = [ ] diff --git a/meson_options.txt b/meson_options.txt index 78d172a740..8ac30a5223 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -95,7 +95,7 @@ option('highlight_bin', type: 'string', value: 'highlight') # Documentation. option('docs', type: 'array', choices: ['man', 'html'], value: [], description: 'Which documenattion formats to build and install.') -option('default_help_format', type: 'combo', choices: ['man', 'html'], value: 'man', +option('default_help_format', type: 'combo', choices: ['man', 'html', 'platform'], value: 'platform', description: 'Default format used when executing git-help(1).') option('docs_backend', type: 'combo', choices: ['asciidoc', 'asciidoctor', 'auto'], value: 'auto', description: 'Which backend to use to generate documentation.') From patchwork Wed Apr 16 23:18:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14054582 Received: from avasout-ptp-003.plus.net (avasout-ptp-003.plus.net [84.93.230.244]) (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 4900624A070 for ; Wed, 16 Apr 2025 23:19:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.244 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845578; cv=none; b=m6Ko4eLbybIQWL6hj/zwgZVL6ZXGaTycLI/JNbHQDC1htUK+MT9TNlKTYoKAclSuh3/aif1D9fvdTWpxSjwL4g3zvBqyvHbV9cRsTXT54ejMXp0O57VGrW+NNyz3/t9NC5wbG9waZerLMVbE8W7xBsxgdSJvxUfHkbB9mU5450w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845578; c=relaxed/simple; bh=tzPzckbvdUhXQEiO2ILe2extWUQisgdqfIyP/L4PGps=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W5h3UXekrad/VSs/EhA+BGD7sUEl2+PoNoUnUOaGjXGmKO0AQwJ5YvGvO54xPcDKKLzc1Rjvlke12vasz5pjzP6m1HCoxZuJCgKNpuoQKUnvkC47f2SoVW17KgqSh8KCn6RwG7ajCkocXv5sbhUpd0jF6yvNkg6Klgy44iHfBDo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com; spf=none smtp.mailfrom=ramsayjones.plus.com; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b=POiGDBLG; arc=none smtp.client-ip=84.93.230.244 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b="POiGDBLG" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 5C1quLy9hjZe55C2Zu8KPU; Thu, 17 Apr 2025 00:19:35 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1744845575; bh=bGD7ZGnPLY1NQoF0MwEgIdUtKb+sl6vNMUFMQlbU8Ys=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=POiGDBLGp4jaxjKuH8wPw9FnZ978VmiULQpayxQVoXEugGxutx6q1OgA10jJaEu9P O6u1RZuWSD9s1PW3lJdAI2k78IVvVfBBlmP7XhgwNJBeQcQyn45GoCP99gBUX2HWKM BLU0rqHHwqbrPTHZmKhhubckPzuYVvNng2Vvc4YoSny6gCZXREtufTjg4HYa7HK6cB hd2YKcQzNPJvQ7ZbZXi3qILup2Pfh/cFhuQAcCJnU6fPVzrSN52ifbYO9DOTkuqEUH jU3HT40LTEqicySPYcoDlmuFOo4JKQ/xJDmOyaCcYYOF9dxri+CwkexDCAyr8uFX89 enUSfy7E9ugZA== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=UuDANPwB c=1 sm=1 tr=0 ts=68003b07 a=oM5NSl/Bl4BpjFr0C8iQlQ==:117 a=oM5NSl/Bl4BpjFr0C8iQlQ==:17 a=EBOSESyhAAAA:8 a=MwKkaEpK1oP1WH10rxgA:9 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 From: Ramsay Jones To: GIT Mailing-list Cc: Junio C Hamano , Patrick Steinhardt , Adam Dinwoodie , Ramsay Jones Subject: [PATCH v3 05/13] Makefile: remove NEEDS_LIBRT build variable Date: Thu, 17 Apr 2025 00:18:26 +0100 Message-ID: <20250416231835.2492562-6-ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> References: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CMAE-Envelope: MS4xfKNN2ris+rTZKp3S14XZAmI1+DyRF6JVOnJcAVfhGxg+R9KXo3g6BjfFrw+nqVcN4j2HmdO/ubMBg4fSuv2eicVMUKcSc7vfYE9W8afVAMpjnyDHy/mo oZvEzDj8lgXCSFgXgHMTFAF7p+FyLootZHNEXco1Fqomfg66QQn5k4oGFWVFu9W2JAFxJJiuTIC9tR71CtSvJCqVJHSCjafkooA= Commit d19e3a5b21 ("Makefile: add NEEDS_LIBRT to optionally link with librt", 2016-07-07) introduced the NEEDS_LIBRT build variable to disassociate the HAVE_CLOCK_GETTIME variable with the unconditional linking of the librt library. At one time, the clock_gettime() function was not available as part of the libc library and (on some unix systems) required linking with librt. Commit 52fcec75ce ("config.mak.uname: define NEEDS_LIBRT under Linux, for now", 2016-07-10) set the NEEDS_LIBRT variable in the Linux section of the config.mak.uname file, since Debian 7 (wheezy) was one of the few remaining distributions, with glibc 2.13, that required linking with librt for clock_gettime(). Note that from glibc version 2.17, this is no longer necessary. Note that Debian 7.0 was released on May 4th, 2013 and benefited from long term support until May 2018 when it went end-of-life. Since that time, Linux distributions use a more up-to-date library, for example: Distribution version end of support Debian 8 2.19 30th June 2020 RHEL 8 2.28 31st May 2024 * Ubuntu 16.04 2.23 30th Apr 2021 * paid 'Maintenance support' ends 31st May 2029 Since it is no longer required, remove NEEDS_LIBRT from the Makefile and config.mak.uname. Signed-off-by: Ramsay Jones --- Makefile | 7 ------- config.mak.uname | 2 -- 2 files changed, 9 deletions(-) diff --git a/Makefile b/Makefile index 818dde32a9..8fa4d2664e 100644 --- a/Makefile +++ b/Makefile @@ -340,9 +340,6 @@ include shared.mak # # Define HAVE_SYNC_FILE_RANGE if your platform has sync_file_range. # -# Define NEEDS_LIBRT if your platform requires linking with librt (glibc version -# before 2.17) for clock_gettime and CLOCK_MONOTONIC. -# # Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function. # # Define HAVE_GETDELIM if your system has the getdelim() function. @@ -2171,10 +2168,6 @@ ifdef HAVE_SYNC_FILE_RANGE BASIC_CFLAGS += -DHAVE_SYNC_FILE_RANGE endif -ifdef NEEDS_LIBRT - EXTLIBS += -lrt -endif - ifdef HAVE_BSD_SYSCTL BASIC_CFLAGS += -DHAVE_BSD_SYSCTL endif diff --git a/config.mak.uname b/config.mak.uname index b12d4e168a..88007c4f13 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -54,8 +54,6 @@ ifeq ($(uname_S),Linux) HAVE_DEV_TTY = YesPlease HAVE_CLOCK_GETTIME = YesPlease HAVE_CLOCK_MONOTONIC = YesPlease - # -lrt is needed for clock_gettime on glibc <= 2.16 - NEEDS_LIBRT = YesPlease HAVE_SYNC_FILE_RANGE = YesPlease HAVE_GETDELIM = YesPlease FREAD_READS_DIRECTORIES = UnfortunatelyYes From patchwork Wed Apr 16 23:18:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14054583 Received: from avasout-ptp-003.plus.net (avasout-ptp-003.plus.net [84.93.230.244]) (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 9484C2459DE for ; Wed, 16 Apr 2025 23:19:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.244 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845583; cv=none; b=urQ59wfmqOaO5pNb+kdKUwNJ5i+e66mOYY1ZiLqdvdwCSbJpWslDJvUQqPtC3r2Ft6zeneQ1VdPPeP+LiYjcy0hayAgoWSpBShSA6RGXlFRAuOSEaY/1UaVHUqABvBbTs4yQnWj8lW3WJrUz6j/ptEepdQ/hGzhLt8EOdz55mRA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845583; c=relaxed/simple; bh=I/0VnMuucEZsmbE47irgCHluxlQ5+l7dYuOIAiYNO/w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UJGL9SnG+UvSjt5nLav7bI0k+wOTG3tCGBZkMQoZb5yHJ9fsk6B8YBm2i+818IxVedC1zN4QiNaAsTmiFGdg6qkCvmShH9qSHxauNRbdIaWR5EL8qL1NGrD226fmlKa/bqrDX+fKQslBq3iQhubdxONzxDwhxg8HmfJTuRn4NmY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com; spf=none smtp.mailfrom=ramsayjones.plus.com; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b=N3L3c5Aw; arc=none smtp.client-ip=84.93.230.244 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b="N3L3c5Aw" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 5C1quLy9hjZe55C2eu8KPZ; Thu, 17 Apr 2025 00:19:41 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1744845581; bh=pTOMTzddpb0+LQTrQeh3eQbPeIgu2b4ujjH0adO6eOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=N3L3c5AwSAImNlNqDWj1bt+jQLLI1HWSye7x1grcTVz8U4fXoxi58lD0NDtfXs9cz uYz+6E9P5xTVEfwmyzkGkmHqbnOQSVjHLgcZgyJHyaLFTflfCCPZRZPPj0xNYHgPvK GjAoN7KR23/PhkSNUS1uce7hBvS8VSlM89DFCmyDkIosfmswGoWD8nHknhyaGoOouF eFCS0fG44E1x7DsQlAbhPDjvK/JsgZYUMeCD2m1tYdlkq6bfDlXedilFjFF3RUi2sw iIzfLvSvbou99IVqIw6tQqQOs+zVhZSatb5WnmnbxjM9Mi4K6Hc+puLefQJrU8HrnN Bpcs000EaOr4Q== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=UuDANPwB c=1 sm=1 tr=0 ts=68003b0d a=oM5NSl/Bl4BpjFr0C8iQlQ==:117 a=oM5NSl/Bl4BpjFr0C8iQlQ==:17 a=EBOSESyhAAAA:8 a=fVsHCq2i0Zt6NT_ZDjwA:9 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 From: Ramsay Jones To: GIT Mailing-list Cc: Junio C Hamano , Patrick Steinhardt , Adam Dinwoodie , Ramsay Jones Subject: [PATCH v3 06/13] config.mak.uname: add a note about NO_STRLCPY for Linux Date: Thu, 17 Apr 2025 00:18:27 +0100 Message-ID: <20250416231835.2492562-7-ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> References: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CMAE-Envelope: MS4xfMUGwBMZYHzy7CYifTmjcwXRNPA6V6bPmo20ZpUGxMTR1L4yU27gGoF5M6v3pxjiSwCyiDK35UfjO2gFCYBG9FAtXiTLXeGAvkc8/h3CCCX9uPgH+Lyx YMunC5Sbag+/WUqX5fQWFhgJJj0FZd8d0kw98/byOZNmbBHD3FgrU5lukPe2zqby1ts7HMJ0d8EtpudeUGV12kjgyW7dHSz2ew0= Commit 817151e61a ("Rename safe_strncpy() to strlcpy().", 2006-06-24) added the NO_STRLCPY make variable to allow the conditional use of the gitstrlcpy() compat function on those platforms which didn't provide the 'standard' strlcpy() function. Recently, in the summer of 2023, the strlcpy() and strlcat() functions were added to the glibc library (v2.38), so some of the more up-to-date Linux distributions no longer need to set NO_STRLCPY. For example, both Ubuntu 24.04 LTS and RHEL 10 beta have glibc v2.39. However, several distributions, which are still within their support window, have an earlier version and must still use the 'compat' version of strlcpy(). If the meson or autoconf build systems are used on newer platforms, then they will be configured to to use strlcpy() from glibc, whereas the make build will always choose the 'compat' function instead. Add a note to the config.mak.uname file, in the Linux section, to prompt make users to override NO_STRLCPY in the config.mak file, if appropriate. Signed-off-by: Ramsay Jones --- config.mak.uname | 1 + 1 file changed, 1 insertion(+) diff --git a/config.mak.uname b/config.mak.uname index 88007c4f13..ae6ba15586 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -48,6 +48,7 @@ ifeq ($(uname_S),OSF1) endif ifeq ($(uname_S),Linux) HAVE_ALLOCA_H = YesPlease + # override in config.mak if you have glibc >= 2.38 NO_STRLCPY = YesPlease HAVE_PATHS_H = YesPlease LIBC_CONTAINS_LIBINTL = YesPlease From patchwork Wed Apr 16 23:18:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14054584 Received: from avasout-ptp-003.plus.net (avasout-ptp-003.plus.net [84.93.230.244]) (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 6C0542327AE for ; Wed, 16 Apr 2025 23:19:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.244 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845588; cv=none; b=M8K76f39ylj5xq/3BHAq/5GOVjwTcxv+YcrXvSgPRcnvuJQJudkfygaKrCjbvWXi3K8S8KmbeTv737yaj6PSVeUWQfUMWQq+yDRPpaU5AYbwphlmca7dg9wQ0JHjQ/BTeKWHQM0/ykwUWs3Ox50Z3icpuEMn+T8H2zUir7r2l1A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845588; c=relaxed/simple; bh=++VZgwa5yodMJ9h/fbxSWGLYPmGm0xnRJlXcFciQ8Zg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eD9OCJvhPOYlR1QChRd4U8VnD7+YSfdxg3iBZmrzOhX/1sCTFL7oZQFKVfpbE9UIN5P408Jh8TiyLQL81Lz0MrjFFL55Qx+M+oV3T0MfsnycgVhB7EKKY9Gljwbzghod+JUTIpdGeht/Fj+fOlMdQjp/14JBB7CPcgkcAtzsMjw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com; spf=none smtp.mailfrom=ramsayjones.plus.com; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b=GaFWYtTy; arc=none smtp.client-ip=84.93.230.244 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b="GaFWYtTy" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 5C1quLy9hjZe55C2ju8KPf; Thu, 17 Apr 2025 00:19:46 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1744845586; bh=sDV7FUwY2Wamm5gxYivbZ4pkl/sK/yvmuVnvrjPMzlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GaFWYtTyckuk8RtyCromVTYCANLOgaVd41Nzw/NS/rkeLJmTjGLh/YrGykHO/W8AC ZL/3XrL0p7cQGIucLCCg1vpB5eF3fHlwEN7Zt2B0EpnDkXXrydsIgVS+qSYMrSBaW7 rjuz9g7bWJc7xcqXAHFWvqu2H2QarlK3eLue+CvHKDn7THPgjFgByjvbZoJgvrzul8 ZEcTMvOKh3E4EE+vi445SrpAFZBoKyhWILM0a/ZVYzHprN5bdqergjjbQNhwXK+rde AMaxvX5QvBAVBn6B37F1WBSGdFsuT/izgVYbil5/GsbszlkL6JIuNPQp2LTq84zyHt 4GeT8/my3d7KQ== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=UuDANPwB c=1 sm=1 tr=0 ts=68003b12 a=oM5NSl/Bl4BpjFr0C8iQlQ==:117 a=oM5NSl/Bl4BpjFr0C8iQlQ==:17 a=EBOSESyhAAAA:8 a=ZO4WGqYwhwYn17qujKgA:9 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 From: Ramsay Jones To: GIT Mailing-list Cc: Junio C Hamano , Patrick Steinhardt , Adam Dinwoodie , Ramsay Jones Subject: [PATCH v3 07/13] config.mak.uname: only set NO_REGEX on cygwin for v1.7 Date: Thu, 17 Apr 2025 00:18:28 +0100 Message-ID: <20250416231835.2492562-8-ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> References: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CMAE-Envelope: MS4xfMqWpUcRXewHxwF/43I1F0OF/nXdXGfSMfRHoWDB4F6fp83XY8ZgVf85PF7dkU1nLvpDxQpAajZ40EfySrisqZ5rtYvtnKwAZk7d9CgBulF2sGgfXflX oEWIaQ9lajxrsdTBAV5Ylb6lBFql79bRhDONIYnVIODHKaWGl6YuiuGZr5lG01CSZGUVFekTNILlwElsBXdCz/2mPhPq30X3F9Y= Commit 92f63d2b05 ("Cygwin 1.7 needs compat/regex", 2013-07-19) set the NO_REGEX build variable because the platform regex library failed some of the tests (t4018 and t4034), which passed just fine with the compat library. After some time (maybe a year or two), the platform library had been updated (with an import from FreeBSD, I believe) and now passed the full test-suite. This would be about the time of the v1.7 -> v2.0 transition in 2015. I had a patch ready to send, but just didn't get around to submitting it to the list. At some point in the interim, the official cygwin git package used the autoconf build system, which sets the NO_REGEX variable to use the platform regex library functions. The new meson build system does likewise. The cygwin platform regex library, in addition to now passing the tests which formerly failed, now passes an 'test_expect_failure' test in the t7815-grep-binary test file. In particular, test #12 'git grep .fi a' which determines that the regex pattern '.' matches a NUL character. The commit f96e56733a ("grep: use REG_STARTEND for all matching if available", 2010-05-22) added the test in question, but it does not give any indication as to why the test was framed as an expected fail, rather than a 'positive' test that the 'git grep' command fails to match a NUL. Note that the previous test #11 was also originally marked in that commit as a 'test_expect_failure', but was flipped to an 'success' test in commit 7e36de5859 ("t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTEND", 2010-08-17). In order to produce the same NO_REGEX configuration from autoconf, meson and make, modify config.mak.uname to only set NO_REGEX for cygwin v1.7. In addition, skip test t7815.12 on cygwin, by adding the !CYGWIN pre- requisite to the test header, which (among other things) removes an '...; please update test(s)' comment. Signed-off-by: Ramsay Jones --- config.mak.uname | 4 +++- t/t7815-grep-binary.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config.mak.uname b/config.mak.uname index ae6ba15586..b6adce0bc4 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -245,7 +245,9 @@ ifeq ($(uname_O),Cygwin) # Try commenting this out if you suspect MMAP is more efficient NO_MMAP = YesPlease else - NO_REGEX = UnfortunatelyYes + ifeq ($(shell expr "$(uname_R)" : '1\.7\.'),4) + NO_REGEX = UnfortunatelyYes + endif endif HAVE_DEV_TTY = YesPlease HAVE_ALLOCA_H = YesPlease diff --git a/t/t7815-grep-binary.sh b/t/t7815-grep-binary.sh index 90ebb64f46..b7000dfa32 100755 --- a/t/t7815-grep-binary.sh +++ b/t/t7815-grep-binary.sh @@ -63,7 +63,7 @@ test_expect_success 'git grep ile a' ' git grep ile a ' -test_expect_failure 'git grep .fi a' ' +test_expect_failure !CYGWIN 'git grep .fi a' ' git grep .fi a ' From patchwork Wed Apr 16 23:18:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14054585 Received: from avasout-ptp-003.plus.net (avasout-ptp-003.plus.net [84.93.230.244]) (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 BFB9E24BC03 for ; Wed, 16 Apr 2025 23:19:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.244 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845592; cv=none; b=jnsPau1FEuGCDApEY2THJsPK0GV5i3txcBRPeWtZEyD9odwiByZATukDERRvaNMbxKqnjZ677qt5hr6zKvPj8CHRRuCm3eKCOhHxaVZ7FhXxzi60qDFtY1AIVrznrMxLc/xRC2YVRu5OzRzDh6bs048q5w0fndINIl3knzScWWQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845592; c=relaxed/simple; bh=UQXOXZFPKz32spLJMrN2Bvq1awCw+L/x7F4cSXtvx9I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HvFiayU66VSyTRu2jnUTIaPLnLbI2fb4uPkJBUfD4c3lmDjHfvoUIFymRy3Y7zmNDQC7ZsL/oiWYAFJF4whdOratAKrw0Qonwadj18+HbUfaLxlxwVGUdx4JhXGtkaLyqOB65Tj3v0GKY0cjXnvAKwtnUULrPMKosWT17u9dQ0U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com; spf=none smtp.mailfrom=ramsayjones.plus.com; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b=EsUB7bOB; arc=none smtp.client-ip=84.93.230.244 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b="EsUB7bOB" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 5C1quLy9hjZe55C2ou8KPk; Thu, 17 Apr 2025 00:19:50 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1744845590; bh=GDmQdgy1XrzzI8HxCxapwf+A7H6WsB9/218TGTVDW78=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EsUB7bOBKtPvBG0tyeqNXPsxu/qideBPMc7tnUX5M+8QDQixBg/j9Oc4Qo//k7e0R CKPezCLhvaVO4h49nmRzYOy/iJekcOg23FcZJr8X1PsdLuUVYSObOhBB1rOsfqTxFX S5PQE6HLO/28KajY+pRuqw7C/Cz140Afpn4v43JWSwX7EyKRlM5Lo6FQ1lYSpEYQom 1uf0Cx3VMXipDfjdKgcuH3Z0Ymr3IE4R2at78ZlfxVtrn1RLygwZM4AqUb2lACrIGR bw5W/qLo2qNukxAUHURH0raVLn9Qss3AgdOdzNCH8vVGv881+JXPbjr0zaLip5eexw YDyTsSMFC905w== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=UuDANPwB c=1 sm=1 tr=0 ts=68003b16 a=oM5NSl/Bl4BpjFr0C8iQlQ==:117 a=oM5NSl/Bl4BpjFr0C8iQlQ==:17 a=EBOSESyhAAAA:8 a=5XmO7F8k-BOE0I3eWfsA:9 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 From: Ramsay Jones To: GIT Mailing-list Cc: Junio C Hamano , Patrick Steinhardt , Adam Dinwoodie , Ramsay Jones Subject: [PATCH v3 08/13] config.mak.uname: add HAVE_GETDELIM to the cygwin section Date: Thu, 17 Apr 2025 00:18:29 +0100 Message-ID: <20250416231835.2492562-9-ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> References: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CMAE-Envelope: MS4xfN/JAUvEIpIOD9OUIUpSo2FU4E9+f+nhHUYrcIWBMuQULN9uglhVYyhsmzzX5hX33EtSoVxO+nRzv9d0hF+Utw2XWU5gO25SavRYM1SnP4veZOVreZJH 4M+ZaX/JlJlTBM++4IlnVKVC570SIyRlxqbI3/zHDrgRQcZOMwGGEf5h34s+bsDPgjAZfM+qrfcnJZw/A0a7KPFaAoEK0lhSgMo= Cygwin has provided the getdelim() function as far back as (at least) 2011. The autoconf and meson builds enable the use of this symbol. In order to have the same configuration for autoconf, meson and make, enable the HAVE_GETDELIM build variable in the cygwin section of the config.mak.uname file. Signed-off-by: Ramsay Jones --- config.mak.uname | 1 + 1 file changed, 1 insertion(+) diff --git a/config.mak.uname b/config.mak.uname index b6adce0bc4..1b3ba8a341 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -250,6 +250,7 @@ ifeq ($(uname_O),Cygwin) endif endif HAVE_DEV_TTY = YesPlease + HAVE_GETDELIM = YesPlease HAVE_ALLOCA_H = YesPlease NEEDS_LIBICONV = YesPlease NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes From patchwork Wed Apr 16 23:18:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14054586 Received: from avasout-ptp-003.plus.net (avasout-ptp-003.plus.net [84.93.230.244]) (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 822BB24BC18 for ; Wed, 16 Apr 2025 23:19:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.244 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845596; cv=none; b=kS6+65pEplLFj1/t/1q6lRWjKmnH9LecC2Z5jNeKiebaimJ8b209yi8ab+7SDmtHQ9ckj6qdmdCO4710pejYOrZNq1HSTHPJcffcyIVSG4Dlc4uHro6vCdo5ZEbPXa4xX0+cSTOz4LPY5WDVRtstwy4hpUANE0OxWCh8kOUd7YE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845596; c=relaxed/simple; bh=euBXHrZ42frDrvfa0/ise71IY1qZtBZMUPrwPv4lwZk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DGlZqIbDnlQ5mlYdlNB/ITVql8pRMdGzjHJWowaS9EhpMlzz1gn4NTirh23dTl80GKAmOE9imBDANotcaErXzupAIH42b6pmHCaJVa+ik4PIeylOxKKPP/jkqy41Rbik/ASb+NZPpP+v4HshKPIwdHxDxZNTVJQy5pk16IWwqF4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com; spf=none smtp.mailfrom=ramsayjones.plus.com; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b=eiGQXl1E; arc=none smtp.client-ip=84.93.230.244 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b="eiGQXl1E" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 5C1quLy9hjZe55C2ru8KPp; Thu, 17 Apr 2025 00:19:54 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1744845594; bh=U8zXOWGOj6xAnCUAvdpdKL+3RoTLT/w2xicatoD8QXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eiGQXl1EmkVn/x+mE3lpwPra5kCxIt11/q5pFr5KRwxKb+Aq000PXSWfZYMyu0Do9 8lPfdiYSemp8eQAXT3jqs/cAo1EiXLapQyutazScu+i8iCsJzQFyL4kNElhU0bhhBy XXx4CGCJf5g+TV2QKCMRPGaETisNzY411w77wxqqEaxlFP4Q6Zyf5AsKUGF1IosOMU Rg0qZsb6g9/ybeY8s9a5wGt2bxnuLLCPtaImaxelke0lm2ETTI3yOWtJSURhjZO03K qk7wt7vGojNbGXpzSCZLpU95m/V8OVZ72rspyclWVEw0kI71Yxt7XicjhkSnaYDwqe egkZJ7mk5PZ5w== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=UuDANPwB c=1 sm=1 tr=0 ts=68003b1a a=oM5NSl/Bl4BpjFr0C8iQlQ==:117 a=oM5NSl/Bl4BpjFr0C8iQlQ==:17 a=EBOSESyhAAAA:8 a=eTvDwwv87Y-7DfItWLMA:9 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 From: Ramsay Jones To: GIT Mailing-list Cc: Junio C Hamano , Patrick Steinhardt , Adam Dinwoodie , Ramsay Jones Subject: [PATCH v3 09/13] config.mak.uname: add clock_gettime() to the cygwin build Date: Thu, 17 Apr 2025 00:18:30 +0100 Message-ID: <20250416231835.2492562-10-ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> References: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CMAE-Envelope: MS4xfEQrb61MaiwmFyLVw0EH97BgDVeJhCmgZCA88cysnFBgdHrIhk5wBZLEvVe35KVM4mdmV0KvaZ3KHA3UdGRwQR8EX27R4M9WrriA8SObsTZAwV2Ex1O4 /rpF59xokaxd37ZPZeselplM/ah9FzhPOv3of+iCcghAnXIKNRCMsd1jYiQBDynoOHRKQA2aUbsiGxVGadsjuG+WFguMy/x7K0M= Cygwin supports the clock_gettime() function, along with the associated CLOCK_MONOTONIC preprocessor symbol. The autoconf and meson builds both enable the use of those symbols. In order to have the same configuration for the make builds, add the HAVE_CLOCK_GETTIME and HAVE_CLOCK_MONOTONIC build variables to the cygwin section of the config.mak.uname file. Signed-off-by: Ramsay Jones --- config.mak.uname | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config.mak.uname b/config.mak.uname index 1b3ba8a341..d058b34292 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -251,6 +251,8 @@ ifeq ($(uname_O),Cygwin) endif HAVE_DEV_TTY = YesPlease HAVE_GETDELIM = YesPlease + HAVE_CLOCK_GETTIME = YesPlease + HAVE_CLOCK_MONOTONIC = YesPlease HAVE_ALLOCA_H = YesPlease NEEDS_LIBICONV = YesPlease NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes From patchwork Wed Apr 16 23:18:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14054587 Received: from avasout-ptp-003.plus.net (avasout-ptp-003.plus.net [84.93.230.244]) (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 457D320FAA4 for ; Wed, 16 Apr 2025 23:19:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.244 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845600; cv=none; b=LLzAvsVUQYFtEtWoQOlwi+ot7O9wGw+A4WkzIRILWY8xJsdV5GJqShDWG+jKrhsYylHxW2K18n2nvLnkA3Pi0foOLQ8c+Uf85dYFxoB8CZ8oirlQhQ4IQiHY5rEGr9B03YIhGtN0O20xwubDbkAT0Bhn3bsMXlNvRYL9woEsUVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845600; c=relaxed/simple; bh=Xy3vqXP37uN4SoDdmWpy0RBdXf7YpCciWfo6zABuqWk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kM3n4EKhYGlIhEno5RQR0CFEA1YIAV9g4+RwkvjNJs4p7ev8EaThh5zBNSKaWPx1103gpVKxZxrZ/uvUtymcUTMYZHZlYqHm7fZVDO0PeibJ2gHH/TuIJj/IUiJ8bDaSE+AZFuZlcQZhPxIp4csJOnSgItzo5R51LmP2odrSp2M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com; spf=none smtp.mailfrom=ramsayjones.plus.com; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b=eMI6b7Nh; arc=none smtp.client-ip=84.93.230.244 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b="eMI6b7Nh" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 5C1quLy9hjZe55C2vu8KPu; Thu, 17 Apr 2025 00:19:57 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1744845597; bh=1FAl3cmC0P85NtdFo4zRYhpwyTCCCIfDtZ7HYzEpvls=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eMI6b7Nh9Til4x2nfVgekTC7DNz+W0A41Xu27MFSnNAZ1+w4PGK/pXH7wKa149zTJ MJXEsHqZ51vSWnn2V3v9xkfUgf3b4E+Glw/pRJpPYfHEakEwYIhyT88Wr8HzPpUryL kJ/ZVrna9kSWufWRrxim5hsypI5NPDcpJ4726xcC9FbOo2VDHyDJ68BCyzKSpjqvct VgrXB39jeL21kX4aCNwzUoab88ufpyPKAsXsasKoYRXcY1qbQw+e88UUrolilbtqae SaewPg9rX12FJACy1SFV0kBBgvMN9GcO8p/2PQf7jdC2dZqGJ0q4ztmNTdcvE2jdUB 3QBzT7nSdnEyg== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=UuDANPwB c=1 sm=1 tr=0 ts=68003b1d a=oM5NSl/Bl4BpjFr0C8iQlQ==:117 a=oM5NSl/Bl4BpjFr0C8iQlQ==:17 a=EBOSESyhAAAA:8 a=mCKABES6tY-doaLBvqoA:9 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 From: Ramsay Jones To: GIT Mailing-list Cc: Junio C Hamano , Patrick Steinhardt , Adam Dinwoodie , Ramsay Jones Subject: [PATCH v3 10/13] builtin/gc.c: correct RAM calculation when using sysinfo Date: Thu, 17 Apr 2025 00:18:31 +0100 Message-ID: <20250416231835.2492562-11-ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> References: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CMAE-Envelope: MS4xfM7sFFc965gPHMRwo1QRdBf1cV2LEpO5lTzSlORgOqa8MtELBJlNGP1exYar4NuhJEefZ6RSJgaKSl5PcjrtfaFQHRKdVlaijKSex6ODi9Qlf8QixGV/ pKno+EVoCgoSOUnoClux/ZYn/Y//okBIl9iboLcCks40DxzOW9XMlja/0pKb0ukmB99mAwQJuAhAgY9WNe7NA6IDAlK5RD1PbiI= The man page for sysinfo(2) on Linux states that (from v2.3.48) the sizes of the memory and swap fields, of the returned structure, are given as multiples of 'mem_unit' bytes. In earlier versions (prior to v2.3.23 on i386 in particular), the 'mem_unit' field was not part of the structure, and all sizes were measured in bytes. The man page does not discuss the motivation for this change, but it is possible that the change was intended for the, relatively rare, 32-bit platform with more than 4GB of memory. The total_ram() function makes the assumption that the 'totalram' field of the 'struct sysinfo' is measured in bytes, or alternatively that the 'mem_unit' field is always equal to one. Having writen a program to call the sysinfo() function and print the structure fields, it seems that, on Linux x84_64 and i686 anyway, the 'mem_unit' field is indeed set to one (note that the 32-bit system had only 2GB ram). However, cygwin also has an sysinfo() implementation, which gives the following values: $ ./sysinfo uptime: 21381 loads: 0, 0, 0 total ram: 2074637 free ram: 843237 shared ram: 0 buffer ram: 0 total swap: 327680 free swap: 306932 procs: 15 total high: 0 free high: 0 mem_unit: 4096 total ram: 8497713152 $ [This laptop has 8GB ram, so a little bit seems to be missing. ;) ] Modify the total_ram() function to allow for the possibility that the memory size is not specified in bytes (ie 'mem_unit' is greater than one). Signed-off-by: Ramsay Jones --- builtin/gc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/builtin/gc.c b/builtin/gc.c index 99431fd467..cdcf1dc6e7 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -373,8 +373,13 @@ static uint64_t total_ram(void) #if defined(HAVE_SYSINFO) struct sysinfo si; - if (!sysinfo(&si)) - return si.totalram; + if (!sysinfo(&si)) { + uint64_t total = si.totalram; + + if (si.mem_unit > 1) + total *= (uint64_t)si.mem_unit; + return total; + } #elif defined(HAVE_BSD_SYSCTL) && (defined(HW_MEMSIZE) || defined(HW_PHYSMEM)) int64_t physical_memory; int mib[2]; From patchwork Wed Apr 16 23:18:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14054588 Received: from avasout-ptp-003.plus.net (avasout-ptp-003.plus.net [84.93.230.244]) (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 368E024BCE8 for ; Wed, 16 Apr 2025 23:20:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.244 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845604; cv=none; b=XlIuZ3FyKhC91g3CnxLmPpGDx0ymRUN9CmQTZjRSx29i1RBIbNgWQ7DxIRc+I0cuA+sscTfEejATmmj5406oEJ3GOrSI7xZwHI+XX0AbZetsPGqfOy6mjaFmuvDISz4TGBM/7N/gWUGMU3VZViKKxGU2WByl1jbvgNg0b4aEZtM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845604; c=relaxed/simple; bh=zS7i86CmT3CrBtSa8OBiaADBDHOAqd7BzmJUnCWT9kI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L0U8KZuCTSPlLRtACxpTyoOsBWmI8yoAZdRE/oKddyGdmogdtRBGikV/e/dJuKyRWuL+xoyRf2HnP2AQsqNKvPzrl2eWEFuniCMwxKkG6xb1vERXTtLM1zfLrLmhLbGCxY+ja9GpCteJ+V+8aiA7ZbruNyZaMmCzEoPrcR6XOLQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com; spf=none smtp.mailfrom=ramsayjones.plus.com; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b=SMkN2EsG; arc=none smtp.client-ip=84.93.230.244 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b="SMkN2EsG" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 5C1quLy9hjZe55C2zu8KPz; Thu, 17 Apr 2025 00:20:01 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1744845601; bh=YQnwBgfsuMWRYXEKjgIozYJq96VlRTiTV1hgXsoxbu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SMkN2EsGzvLtNiMV7OpUOR8bUW+bRfEWjPn2b3eik07MtH3g3LJYEcCWK+Gs11v1L vOTzTVipYTrNScaJWTkE4MVacloHvElwIzTa0CWm/dlDmYmXYrmQily0S4JKwfMyco VzYEO2vEZLzHzSUPmeHPu+mch18XrneRuvOYt/pOfORxMMAFEXJ6IfP2Hb0DqY7Ti2 VGh5xWEgnAlY5dLojjs06CWRMw+MfNH19EsXxbWKZ6H6o/i6IGLnnBXYhXWYIok68V PeoM+7TdFp2Z/JHNzUciKGoLlmzXaOOfR2fuodaV771s4V1u6sGwRF+pzQoOFSz+yj VDugUbNU80N+Q== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=UuDANPwB c=1 sm=1 tr=0 ts=68003b21 a=oM5NSl/Bl4BpjFr0C8iQlQ==:117 a=oM5NSl/Bl4BpjFr0C8iQlQ==:17 a=EBOSESyhAAAA:8 a=BBq10iSe0tsV5BCVkB8A:9 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 From: Ramsay Jones To: GIT Mailing-list Cc: Junio C Hamano , Patrick Steinhardt , Adam Dinwoodie , Ramsay Jones Subject: [PATCH v3 11/13] config.mak.uname: add sysinfo() configuration for cygwin Date: Thu, 17 Apr 2025 00:18:32 +0100 Message-ID: <20250416231835.2492562-12-ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> References: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CMAE-Envelope: MS4xfKcQSoaBRpRU57rF/4tU/aB1wqIhe45Mrttr3jFYnwNBQiu1R6w5cW/094Jb7OqJKSk3fNyrNsdNUFJ//Inkx8lrY1EhAIjF1ifdO6z7S+6Il2jWuxsv GBBp3UgG0cUgVr5WApek8Ltn8rC0ggVC479hrMOFz2C6353f0SWpuLQ9JptI4HQCKP0MUx3Arohh2y8P9eZBidX+157ibG2o0fI= Although sysinfo() is a 'Linux only' function, cygwin provides an implementation which appears to be functional. The assumption that this function is Linux only is reflected in the way the HAVE_SYSINFO build variable is handled by the Makefile and config.mak.uname. Rework the setting of HAVE_SYSINFO in the Linux section of the system specific config file, along with the corresponding setting of the BASIC_CFLAGS in the Makefile. Add the setting of HAVE_SYSINFO to the cygwin section of 'config.mak.uname'. While here, add a test for the sysinfo() function to the autoconf build system. Signed-off-by: Ramsay Jones --- Makefile | 4 ++++ config.mak.uname | 3 ++- configure.ac | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8fa4d2664e..ff89f2b81f 100644 --- a/Makefile +++ b/Makefile @@ -2168,6 +2168,10 @@ ifdef HAVE_SYNC_FILE_RANGE BASIC_CFLAGS += -DHAVE_SYNC_FILE_RANGE endif +ifdef HAVE_SYSINFO + BASIC_CFLAGS += -DHAVE_SYSINFO +endif + ifdef HAVE_BSD_SYSCTL BASIC_CFLAGS += -DHAVE_BSD_SYSCTL endif diff --git a/config.mak.uname b/config.mak.uname index d058b34292..e7bd07cf6e 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -58,7 +58,7 @@ ifeq ($(uname_S),Linux) HAVE_SYNC_FILE_RANGE = YesPlease HAVE_GETDELIM = YesPlease FREAD_READS_DIRECTORIES = UnfortunatelyYes - BASIC_CFLAGS += -DHAVE_SYSINFO + HAVE_SYSINFO = YesPlease PROCFS_EXECUTABLE_PATH = /proc/self/exe HAVE_PLATFORM_PROCINFO = YesPlease COMPAT_OBJS += compat/linux/procinfo.o @@ -253,6 +253,7 @@ ifeq ($(uname_O),Cygwin) HAVE_GETDELIM = YesPlease HAVE_CLOCK_GETTIME = YesPlease HAVE_CLOCK_MONOTONIC = YesPlease + HAVE_SYSINFO = YesPlease HAVE_ALLOCA_H = YesPlease NEEDS_LIBICONV = YesPlease NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes diff --git a/configure.ac b/configure.ac index 5923edc44a..d7e0503f1e 100644 --- a/configure.ac +++ b/configure.ac @@ -1066,6 +1066,14 @@ AC_CHECK_LIB([iconv], [locale_charset], [AC_CHECK_LIB([charset], [locale_charset], [CHARSET_LIB=-lcharset])]) GIT_CONF_SUBST([CHARSET_LIB]) + +# +# Define HAVE_SYSINFO=YesPlease if sysinfo is available. +GIT_CHECK_FUNC(sysinfo, + [HAVE_SYSINFO=YesPlease], + [HAVE_SYSINFO=]) +GIT_CONF_SUBST([HAVE_SYSINFO]) + # # Define HAVE_CLOCK_GETTIME=YesPlease if clock_gettime is available. GIT_CHECK_FUNC(clock_gettime, From patchwork Wed Apr 16 23:18:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14054589 Received: from avasout-ptp-003.plus.net (avasout-ptp-003.plus.net [84.93.230.244]) (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 07C8120FAA4 for ; Wed, 16 Apr 2025 23:20:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.244 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845607; cv=none; b=ZR3J27LGwwT4AuP1zfznx75p9UdqDBg1/pV20d3Y+AR6YYc3aYrIenbNFWkag0ihK0/PJsalCGZtOB/1gBtiK1pr44e/Yfi/8ZF0TyIz3hh215GSJvFNSC/q4kBMXbjxXyu3mWrj0Zw3kPv9mzkFmITfrgNjAOpsn9MjSWAOfgs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845607; c=relaxed/simple; bh=HkNW7cuoDWl4XhklhRJwIxG6tOiKTr9ERcnjguDtIRI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TIVewwWNglK5Mj7aV54Yy1OTx1eRoOrnvUaADuj7q7lGY1Q6sHFltWcOzPmKnrHYSnpcWCcKrzEhYC+dM6E6nxKz82iXSjhtpPo7tyALQ+kV8jsYjZ9sEbRfGS72RMvo1ZSg1qKnpaFrBubPg+wPqksgyjLzkxTKL38+wRScS+8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com; spf=none smtp.mailfrom=ramsayjones.plus.com; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b=Y+zvOmcQ; arc=none smtp.client-ip=84.93.230.244 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b="Y+zvOmcQ" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 5C1quLy9hjZe55C33u8KQ5; Thu, 17 Apr 2025 00:20:05 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1744845605; bh=5lWh3o2+oYum279FiaEdzjvKc73v9eSC7ilp55a+Qj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Y+zvOmcQVl68VT/Egip+TPDFmCOPMipD8xje1t59+4K6ruVzSuHFYYlqqigqLxYHs HpFzN6EBOp3qO4VRfah0Qp3CxoKAmOp5f6BVDR4vwYCLputd4qdI7cP7Lqzzc8C3o3 UPpcwiJHN4pdO92iNTSP4//TV48K5SC9bpih82tQMa/nmkdyLZ+zpYuTT9XPXhbTlP cxxwJK8flvRfsfaQ37aKJJyocFyk2c1Qim5m8kc1gMqO55982MeW3nEuBL07zwOtwb zbhjXYicG5uAeZqo7qLqzxER3XoGBeE4cLH5mKGyoHU0XmH+pfezpbT0WxqypUdDQI eQKLyRztl6E6g== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=UuDANPwB c=1 sm=1 tr=0 ts=68003b25 a=oM5NSl/Bl4BpjFr0C8iQlQ==:117 a=oM5NSl/Bl4BpjFr0C8iQlQ==:17 a=EBOSESyhAAAA:8 a=CyMKNFq3l4KqDfjKpYsA:9 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 From: Ramsay Jones To: GIT Mailing-list Cc: Junio C Hamano , Patrick Steinhardt , Adam Dinwoodie , Ramsay Jones Subject: [PATCH v3 12/13] config.mak.uname: add arc4random to the cygwin build Date: Thu, 17 Apr 2025 00:18:33 +0100 Message-ID: <20250416231835.2492562-13-ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> References: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CMAE-Envelope: MS4xfKUr3KsZKM32kbWkt5meEngj4arj3/CEdWjuG5T3dTND8gTKYH11rFif/7bHOPzxXHmfp80SZZdUVkrlW7XRURV3liiKpba7Z6MXfcU+/twMumM54pLK 5smME/Mnad4kGsUZewo3AID8Cv0x9pzrRlemdUaZq1vVLJkgs77+4CBsBu/ByP6YZkWVhGymRWO2zMq/SgBa7wWLRJb6eNC9B1U= The arc4random_buf() function has been available in cygwin since about 2016 (somewhere in the v2.x branch). Set the CSPRNG_METHOD build variable to 'arc4random', in the cygwin section, to enable the use of this cryptographically-secure pseudorandom number function. Note that the autoconf and new meson builds also enable this function. Signed-off-by: Ramsay Jones --- config.mak.uname | 1 + 1 file changed, 1 insertion(+) diff --git a/config.mak.uname b/config.mak.uname index e7bd07cf6e..330741eb5a 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -254,6 +254,7 @@ ifeq ($(uname_O),Cygwin) HAVE_CLOCK_GETTIME = YesPlease HAVE_CLOCK_MONOTONIC = YesPlease HAVE_SYSINFO = YesPlease + CSPRNG_METHOD = arc4random HAVE_ALLOCA_H = YesPlease NEEDS_LIBICONV = YesPlease NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes From patchwork Wed Apr 16 23:18:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14054590 Received: from avasout-ptp-003.plus.net (avasout-ptp-003.plus.net [84.93.230.244]) (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 EBA3724CED5 for ; Wed, 16 Apr 2025 23:20:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.244 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845610; cv=none; b=YlHCs2C7HBRFcYpiilYd+SJ6odHggRVe7gmWn7qVLpR5L+bLEp/f8KS5dbwBmJdtm6YfL57Y4D61iUsaMW0+97HFKqc+lJi7ty6jow/icnIcEC9Px9t9HwGw42JFlzrsSM1T76F1LbW3wkhHiyb3w+NgucPnMPithurTGo/sz3c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744845610; c=relaxed/simple; bh=WtfZUAj+05DvD5rmKPASKOSXyMDIyw7o2p/P4nBP/9w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WK5YB8bKA2L0sA3QL3IANokfEeE2QUIZZtq4+GeQ+uOP3GLAKJTRjlzOV8t3g7Ew1t++RPKwqs2RkHRWhFLHggtroQ8xu1iAhSsD6iF1la0GE0cX7ijDIEUcHFIBePrqjVTaX/ao/BMqFKaHvr2jVioEL5V40dM7NpezdUUuv7A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com; spf=none smtp.mailfrom=ramsayjones.plus.com; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b=JP+ke39y; arc=none smtp.client-ip=84.93.230.244 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b="JP+ke39y" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 5C1quLy9hjZe55C36u8KQA; Thu, 17 Apr 2025 00:20:08 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1744845608; bh=+mCRD0/upb9ZPCU/tGKgYTAJjEOAhRNF7dsSOqIZYM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JP+ke39ydRod/2FG9XXE3qVsoTre08CGCsAkN4Kr6Ri2eWwzH13+O3NSaSRuqvTw3 aftVX7I+G27lMQzmxQ1wGr6FDRNUgMLsqCSW0T8AEV93GEy2jtOIrX0CY+IuNI7hV6 BkDK1CiW+iS+ahahPgmj/oboda9JJuTADPvg1kNMDLLCHLVHKgU5s9sLyHHLW3ln29 atPeDv3dvWPccHzybzm91jFm9mNuhZMT9R31gSfP2GSeOxmE2G7yH9AVB9N9bNHkVx qnbdr9Tnybsa8VlZ8NR9miSF4TBMXJND9DQ6Y5CXbR0np8zzwsZP1OopYqmnWrqCAs l2+XUJVp5zEGQ== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=UuDANPwB c=1 sm=1 tr=0 ts=68003b28 a=oM5NSl/Bl4BpjFr0C8iQlQ==:117 a=oM5NSl/Bl4BpjFr0C8iQlQ==:17 a=EBOSESyhAAAA:8 a=WBFf2OPKqg4umVxYW-kA:9 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 From: Ramsay Jones To: GIT Mailing-list Cc: Junio C Hamano , Patrick Steinhardt , Adam Dinwoodie , Ramsay Jones Subject: [PATCH v3 13/13] config.mak.uname: set CSPRNG_METHOD to getrandom on Linux Date: Thu, 17 Apr 2025 00:18:34 +0100 Message-ID: <20250416231835.2492562-14-ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> References: <20250416231835.2492562-1-ramsay@ramsayjones.plus.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CMAE-Envelope: MS4xfNQtwomiADszzSFy7LuF14g7VY+F7g+wcWCTHQNo8OHJOOpq48XN/19M1w4oZzkECOYkUaq8v7Zik28ZahQeF9Bpi7OcYlsIy1z08soho5IFXxMgzxuW AlWD2cPk8V6CpnwFTrD9mFonzXcb1MznXmVk/oT2RbMbAdxZHvd/NsLwqd06u/SI/I9AvCQgCKi3p1/oSbhHJ3D1Z5itCwPFvJs= Commit 05cd988dce ("wrapper: add a helper to generate numbers from a CSPRNG", 2022-01-17) added a csprng_bytes() function which used one of several interfaces to provide a source of cryptographically secure pseudorandom numbers. The CSPRNG_METHOD make variable was provided to determine the choice of available 'backends' for the source of random bytes. Commit 05cd988dce did not set CSPRNG_METHOD in the Linux section of the config.mak.uname file, so it defaults to using '/dev/urandom' as the source of random bytes. The 'backend' values which could be used on Linux are 'arc4random', 'getrandom' or 'getentropy' ('openssl' is an option, but seems to be discouraged). The arc4random routines (ar4random_buf() is the one actually used) were added to glibc in version 2.36, while both getrandom() and getentropy() were included in 2.25. So, some of the more up-to-date distributions of Linux (eg Debian 12, Ubuntu 24.04) would be able to use the 'arc4random' setting. All currently supported distributions have glibc 2.25 or later (RHEL 8 has v2.28) and, therefore, have support for the 'getrandom' and 'getentropy' settings. The arc4random routines on the *BSDs (along with cygwin) implement the ChaCha20 stream cipher algorithm (see RFC8439) in userspace, rather than as a system call, and are thus somewhat faster (having avoided a context switch to the kernel). In contrast, on Linux all three functions are simple wrappers around the same kernel CSPRNG syscall. If the meson build system is used on a newer platform, then they will be configured to use 'arc4random', whereas the make build will currently default to using '/dev/urandom' on Linux. Since there is no advantage, in terms of performance, to the 'arc4random' setting, the 'getrandom' setting should be preferred from an availability perspective. (Also, the current uses of csprng_bytes() are not in any hot path). In order to set an appropriate default, set the CSPRNG_METHOD build variable to 'getrandom' in the Linux section of the 'config.mak.uname' file. Signed-off-by: Ramsay Jones --- config.mak.uname | 1 + 1 file changed, 1 insertion(+) diff --git a/config.mak.uname b/config.mak.uname index 330741eb5a..db22a8fb31 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -50,6 +50,7 @@ ifeq ($(uname_S),Linux) HAVE_ALLOCA_H = YesPlease # override in config.mak if you have glibc >= 2.38 NO_STRLCPY = YesPlease + CSPRNG_METHOD = getrandom HAVE_PATHS_H = YesPlease LIBC_CONTAINS_LIBINTL = YesPlease HAVE_DEV_TTY = YesPlease