From patchwork Sun Apr 6 19:38: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: 14039464 Received: from avasout-ptp-001.plus.net (avasout-ptp-001.plus.net [84.93.230.227]) (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 C306470814 for ; Sun, 6 Apr 2025 19:42:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968536; cv=none; b=CT4sCT8mf9zWY6jHNhCdXr4ONPLK0MOZQXlI6kE3WIAj4LR+/m8xI/TguG6gJo2MJuwbvkk0zKeg6p7iVA3VlCMG2OE23FXljRrfCJUKBYNxrpr7Wnj/jl5DW5GwuyP6JaIc0cuTBTHNuEpv5h1oLNHhUhULyN1X3/Xo4J0A6Ro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968536; c=relaxed/simple; bh=f0adEdphm6D1w5sI1UDtvwg1RNgImY2wgWCLVqXF8x8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oejJT8E2maP32Wo12dRmyWDjpQ3LiPNnzznE1mTWH8kxVDX483CijFozv9XO5UsWnaVV6G4agdOc2H+9RG3xVq/715A3xQOa+1UfZyX0J7ERimgDu4/vuS0T2QtiLgxw4Bqac8PiVhhoKTbtmR9SO6RDINm4Dh1mUugipqFp5UE= 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=cS+9yGUp; arc=none smtp.client-ip=84.93.230.227 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="cS+9yGUp" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 1VpUuYqwzbpaN1VpoupkL9; Sun, 06 Apr 2025 20:39:13 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1743968353; bh=6BLxwGhSTMyZVlMf52Y5aa7oCWJkI1NpAoiBUH1U3GY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cS+9yGUp7tm4Vf5wRasxXb10Rw7RIkAtABhM+x81/RZHlex7VLozQtVbVM+2GyQ6c TNnj3Xc3njWq5xC2g5JAyjpQ3VhF5a0T8d5fB7MDJA9iULnm61rzWUW128QEvu4zyG qstnrfypwNYr1hbL9IFKUkqyBZ2GwYokfu9FJ4DS4H41iUwDWBZL/5VFvw+0DpPPly Y/2YcUeIMO4KU7VEycv+bziyKu2gU9xBQgOg2cE0g1JJFjyqxriPNca6ULkSxDyKgW 8xNwPTlgviNGDCv2AG3EiP9Ph/dpvMJJsPDA2ljzEUa5OdpgP6glhhmdLvt58SD73M BcxUZyjPc77Ig== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=frZ/Z04f c=1 sm=1 tr=0 ts=67f2d861 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 v2 01/13] meson.build: remove -DCURL_DISABLE_TYPECHECK Date: Sun, 6 Apr 2025 20:38:27 +0100 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: <1c04882b-e518-4272-bd18-ab918774e424@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: MS4xfCSXxvdKedaPVwvcLEdpitgqWUqDiA4tkA0NA5kor0g5XOoyIJdSNddzS43VmgBpLkc92sWLTLZmatJZKQENnMFdl02v4tV8KfxqIkfZxRdOWPZjzrZI o2lpOvQp+a5wneQVDN8UJmbNd7Y8sV/CjymW7RzW99iTX516JIfM5zec/xO7yvnl9eDbSlRyULFVzL//HEl697ef0nfgUDPK/JM= 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 Sun Apr 6 19:38: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: 14039456 Received: from avasout-ptp-001.plus.net (avasout-ptp-001.plus.net [84.93.230.227]) (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 09E8D137E for ; Sun, 6 Apr 2025 19:39:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968389; cv=none; b=plLH0ocD1a4x3yD5oFqhZJhQT1q5HxDBXsRQUAJmc3nPcgQDTYGYtwg1CvrTIhXHGbixqsgi80/twCCENfx96/CFa57Wsg6LvQHL+oXejjwKFk1Kfoxf78xFVfGpR2zfQL7yRna/1TJxSNj++6bhWCrRIUQjYevkEYdluAnhZXc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968389; c=relaxed/simple; bh=I/0VnMuucEZsmbE47irgCHluxlQ5+l7dYuOIAiYNO/w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ilLxgd8dS8yQIJvTtxNRs1WsBrvhZZaKISXtTDWijWwkWvePO28k25/Id58upilBumRpbdmKUNFYd8awYTEnSRfg/KN48ZPCUa1Ag4a/kftIrFqDvMWqv+1oNjvyO0Vg6M6gkAKBAdoH0Poc77qzD267iFMvA6bAc17mGw2qbwI= 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=q36v0xbh; arc=none smtp.client-ip=84.93.230.227 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="q36v0xbh" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 1VpUuYqwzbpaN1VqJupkLh; Sun, 06 Apr 2025 20:39:43 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1743968383; bh=pTOMTzddpb0+LQTrQeh3eQbPeIgu2b4ujjH0adO6eOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=q36v0xbhfOSLFBayBxQZx3ObREKHt7dwpwaee7dL7nYIU1uNHQlOXJJyXTI1fodQT YOzTf5zmpObuIdA/tnHzhXx+ZvpYFM5b6RxeBrOsENFa6hx8oo6SPqedP5aTErr8dH hfJhTk2nEBGxkaX5KOc7JGaZiY1me7pa6k43FsYGUY1pqg2bRe1S7oGqbTG68WUCdh jk71JGL6Aes14jSp/yrhhaS4N9eHKTd8UUmEAlWDW6vIejox216DtOmEyy6YkcoD/I ELaSrXH91OfYiQYM0jQMED4p3incAy7duKZ5P/iJmoSigexnazCns1G713uPorluq5 eXHinqXsMRqsQ== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=frZ/Z04f c=1 sm=1 tr=0 ts=67f2d87f 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 v2 06/13] config.mak.uname: add a note about NO_STRLCPY for Linux Date: Sun, 6 Apr 2025 20:38:32 +0100 Message-ID: <8c76671f0e7dbfe2fba6a57b80bae974e75a7522.1743859985.git.ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: <1c04882b-e518-4272-bd18-ab918774e424@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: MS4xfIXNXLHSbZFCyie+sZJqmooRf8Be3Q2sbPqgx5+cES6N+YI27+iSA4j3sqiCv/duZOlkmBLNWJ7nucng5mNA4MGB36GkBd0nunLu8uzOngrszdiRoDVl txotfKRYm+DRJ2gqhuAhgwqxYusCKvHGPGPoBvNyajb2Xr7G8Ja33wVNJYXimELKze4eqSyLedsVXbE7BwJWUJczyBogVHziz20= 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 Sun Apr 6 19:38: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: 14039457 Received: from avasout-ptp-001.plus.net (avasout-ptp-001.plus.net [84.93.230.227]) (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 A5DE270814 for ; Sun, 6 Apr 2025 19:39:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968393; cv=none; b=fmX30fp3YMg7JkWEB7NlWuajGfPcwinilcLaNqz3nTeTK+s33cqvxeRx+dHEXT2UuRYSkJjHBn2Jf/JBBSVNm/o77JnyMJaekSoNnAxEzo7JhCTFDvMUmRJOpEYh6u/mbMHm9EXurKMgr0gOj2vmvIVGtQmqRbnQvRDo5cJB1pQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968393; c=relaxed/simple; bh=++VZgwa5yodMJ9h/fbxSWGLYPmGm0xnRJlXcFciQ8Zg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dYnTsdP6pDCI0Ru2x1jflP8/zfJTQHsPSoKSHmouxWsDxl048IRZq3DhanZ5HJ/a03KNDJ3fuE2+hbKZk5vL6JbI3T3t4t8WXm1dx006v6zCoVYwRVQ7rEBcYCRIt//vvK0JAM0AUjHtiZSbRPeHdZJC5X7EYXOLUzj2OoKyoeY= 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=ADTn4r+C; arc=none smtp.client-ip=84.93.230.227 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="ADTn4r+C" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 1VpUuYqwzbpaN1VqNupkLm; Sun, 06 Apr 2025 20:39:47 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1743968387; bh=sDV7FUwY2Wamm5gxYivbZ4pkl/sK/yvmuVnvrjPMzlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ADTn4r+CZwSeaUJlzRgv0Xszd7G+81VNTPRP5BTZcIVDz0/KMLkwgBF7RlGXXKruY VKZXyyAEO7G8mYkgnOkZshLPsKDG0uMB5RKuna2eaJAXhtELqUwUPOp914nMc7vNb0 8RJqB96oF9h8NgRJ0RpKYimKkUjeCxOFJg92O3OTJuJYlGVgrZKjs/2py4/0DfHjIK QecAnWyC7AvNQKfEqPnECi0btQdXTO4wMUvH4DUC4lH5R7gdNEAakD2i4ycWt3St90 A3Gag4Az6LpGl1LvWt2yuEwSh2y423NN1LEe6lziJjMg8buKLpIWBDgJm5WIlLiLLI nXNOT8DKy7RTA== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=frZ/Z04f c=1 sm=1 tr=0 ts=67f2d883 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 v2 07/13] config.mak.uname: only set NO_REGEX on cygwin for v1.7 Date: Sun, 6 Apr 2025 20:38:33 +0100 Message-ID: <324bb213426ffc9c1f9cd155de309bd0b63cdbc4.1743859985.git.ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: <1c04882b-e518-4272-bd18-ab918774e424@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: MS4xfObcks++MYbp+E6IovreqoqktdPVFM/StXIcc551YXAhVN09x/eSIWb9UtXVHgTvuiyb5e4Kwz6F4ewpHS5QAbx5DWXjgAPgm2RqDC3sOdo8186dpvL+ XfIP5DXaowKp5TUufsJdh7BGgO6sAyRc3wJw5osUyDBZ8cPdw7P0BuKBJN1keuvA8k0IZrfgTVnDOl0Q+mHwUIqOgboDOs2TGjE= 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 Sun Apr 6 19:38: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: 14039458 Received: from avasout-ptp-001.plus.net (avasout-ptp-001.plus.net [84.93.230.227]) (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 507DA137E for ; Sun, 6 Apr 2025 19:39:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968395; cv=none; b=uAbuM8w5I6PqGu88NKp9xg4PGk2pQaw9Dc12YvSzX21S9uxYr7YDFNjfQUqaODR2zC3brmSoaOYX+JH8umZ1BaMDY6EZBFiZqMzuaKROYo7GBqdT4SmuuL9fJFdOp+o7SsQunO2qBzzO/pgvtNAPvv9zui6S9xhDuIUGRAhdFVM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968395; c=relaxed/simple; bh=UQXOXZFPKz32spLJMrN2Bvq1awCw+L/x7F4cSXtvx9I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BqxihdNyOPkKLxDdO92ssl4w0LChwH9mY2Qw0U7SvuAw0z66cVxA6mR23C58GjpetyEDNkimiyliIgazCzwEhW8I769k26sKC6qLaf/jryFsGm55/x+wvkm7eapSQctFVHSl8HB3AAIhsfryIz58lA+RO37mE9I5dt5xKSaThiY= 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=H9B8EzqT; arc=none smtp.client-ip=84.93.230.227 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="H9B8EzqT" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 1VpUuYqwzbpaN1VqRupkLs; Sun, 06 Apr 2025 20:39:51 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1743968391; bh=GDmQdgy1XrzzI8HxCxapwf+A7H6WsB9/218TGTVDW78=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=H9B8EzqTbKKQZOyKnl4O0iJHPZZwofWz56OjTiPWYd4RdPcPjgvXbLOLWdtRYEI2l UPNu0QmqPKVQZnemGTvAlUeKHikG3YHjWqpjhoGoIvWY3pa6ycJ3lqtnMC7LQzErgh j0QruT9GdTqhcmDup1neLPgZ6X/9ojqBVzogoLpQYdUo7Jyvj7CnCXH2xFlERcPjyt DgGYjcITLHlS+EIZDcTnL0H0m9DBdyAD4HZfYMwQrVyV0TdJbe1aOMWAi8eTPkHgOy Yfpf/jbWku+tPtZsMf8FYVzc79cktFzFjkjr9A43I5ydj16Z6Yu3Uc2/YbTLm8e0ey 02J8TR/ASa4Ng== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=frZ/Z04f c=1 sm=1 tr=0 ts=67f2d887 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 v2 08/13] config.mak.uname: add HAVE_GETDELIM to the cygwin section Date: Sun, 6 Apr 2025 20:38:34 +0100 Message-ID: <0a3ce7e80abe4dd83ac5e6fe1579e8e559406acf.1743859985.git.ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: <1c04882b-e518-4272-bd18-ab918774e424@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: MS4xfC0ggZeylfbFT564Iarpq0VXG3GQZA12kC4iPzIRFbq6wHv3NO/WLMcCJV4PP960WMAtarWVucEAPGtjM4Ahr8Pp3GqMmm0kBy/YFby0tkVcGK4tF1cQ eJeGVgWhy8Siu8v4s7HSosqXsEDuJQmL//B8cfT2MgoPaLdkC3gwZkL4AjHPrIQkqZY8lCmPk0XP/iUA7jIYK072EWaC1Zr7DAA= 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 Sun Apr 6 19:38:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14039459 Received: from avasout-ptp-001.plus.net (avasout-ptp-001.plus.net [84.93.230.227]) (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 5A9B71A8F93 for ; Sun, 6 Apr 2025 19:39:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968398; cv=none; b=mOzYTuNGPiJhepesY7sxAcc967EFeHMRABkJGs6R4isjnVNC62CmFsumRgqxDeBdfPKSHybv8mTHVcu/4uPS2/r3SgvfagH4kt41CBDYwbPPxuR7zFBPdRoFA03rv5k4jH91G7/v/KYn7C1eYKPPRGQd/i/L5Bf4Sfk0BSv7AdY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968398; c=relaxed/simple; bh=d1lzhXChVRMo2b/QZHlmOuSSEiAB1iJRC2mh6ShXuWc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z/yt28xYJyCLqL4m1PtBzbcN5/NfFIn0Y5cMMsJ1FSNQe5jFFYp3aWeyFBhLdxoHGtyPY521LytUzsMQRGfffjpzUJ2Th6W4q/lthwe+Fm24WCMZFXCcGHr9g68+Bj3nwhEz5GUF8fYdjzijaivp7JpL5hdO/Z3aD4pYxPMw5cI= 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=cuiFi3vl; arc=none smtp.client-ip=84.93.230.227 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="cuiFi3vl" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 1VpUuYqwzbpaN1VqVupkLz; Sun, 06 Apr 2025 20:39:55 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1743968395; bh=LXwAM8I34ieECbM8PTWuYJb8slP8J5I8B7K85IHznxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cuiFi3vl+hcIx7sMrW2hhpDkXouiLmjYvraGZj5HaNv0F8Y+Gqnx56Ig2n9BaQ8gK 2cn8OumjJOm1Mhg4cBR4/VbDqEs9MCXfejcDmKthVr6eAW8lI9v5blDAleKCoJm2Ip IiVzx0ydS6NL3PE2zlSKRH8eS8GTurkUyQTQfgc3q1r1bicxBEs1ZCu/MO4spoJz/O a/56Kb+BqNGepGgRi42xBnzw8nu4m7GAIq67wFiJh4pUQyiXslXVmmD8FOneyk5yrp gXjQeQmBjiEiJxaOKeuZoN2tTuPGtKKWVhTqfnZPaoJlumODKlbMwW6BuCs+hJOD3s uybApXybGiqzg== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=frZ/Z04f c=1 sm=1 tr=0 ts=67f2d88b 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 v2 09/13] config.mak.uname: add clock_gettime() to the cygwin build Date: Sun, 6 Apr 2025 20:38:35 +0100 Message-ID: <3bd6e40cd23b07b86b5db146a00bfa01458f2e04.1743859985.git.ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: <1c04882b-e518-4272-bd18-ab918774e424@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: MS4xfOHIDJtdXQ+gScaCEKJKjkzWiz+4MQE91r+FPshhkaaEPCE7mxXxb9MgLkpbIXVke9wL0FXuhJKzE5ZseBUHAcDgzTjuMht0Z9RZeHprli6CiqDmwlA0 DN4+mqhi+xiYSdLKTTvAGkBP/g/PWmXAznLqXRGWxMd3W1gsjLb5iny93txhI9B3ZYnGs/UGIhGji5jq+T9+6/kCOaX9M5obFOs= 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..942550fb9e 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 Sun Apr 6 19:38:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14039460 Received: from avasout-ptp-001.plus.net (avasout-ptp-001.plus.net [84.93.230.227]) (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 913801A5B98 for ; Sun, 6 Apr 2025 19:40:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968402; cv=none; b=ioscCv2GJbItDN4rlX3INITeJUkDqsivBPPRBym9UWqIIvrb2FK30DX6lTq5az3Pm/tTOAx8c2rQpVp3JZK0hfpAlXM/oI6vKe5PE57vnui4dnctpjaeQcDF/b3hIJGi9pQzXl1jZ8awMg5pcVIB9Z3U1eNQEZ3jqDoJn2EeKIw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968402; c=relaxed/simple; bh=Xy3vqXP37uN4SoDdmWpy0RBdXf7YpCciWfo6zABuqWk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l8gdkWHCwWmu6iUP0yf4BEX/oYcGNV5MGbtk535YvuZPGV7/+rio8bjJ3FjTQzpF5rTV1U4v7TyG7qnjbESyp6IdxXo8gqRA4PT8M/v+Uci63JJ7XurLDmoqx2qq1qBmyaaFElCIalZV8mCNMk+jbiIF1reFMiRL3/UhG+v455g= 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=a43U8hL2; arc=none smtp.client-ip=84.93.230.227 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="a43U8hL2" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 1VpUuYqwzbpaN1VqZupkM8; Sun, 06 Apr 2025 20:40:00 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1743968400; bh=1FAl3cmC0P85NtdFo4zRYhpwyTCCCIfDtZ7HYzEpvls=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=a43U8hL2rajirH/PX7VClHaIE4cWHSz2315odsOlwuYjLjXLAj3v76sualTX1xrgm +pH8yOiBkahVR8Uzbb/JKv144PraUZfFyNDd9Ou2WblZnViGTvMliJ1uNwosEdtzbP OK+vMtDEQXI0pn/HrgAkiKj8Gu0UFvj4ITKcw26043QDiNAXVC/AJBifYiHOu5NIsy MOouaQxGy3vFSyExztDcLfmCSgw5WXMJWlj6sHe1P7E5tLviBPrDjzic8Z5mkT/uIS 4C8t9DpObbGUIa1W59pvPYUdJ1aWL1E3Fawim6od1WqFhiB3hoFPaMidT0bjJS90Tx SnyzgCXQxNEHQ== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=frZ/Z04f c=1 sm=1 tr=0 ts=67f2d890 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 v2 10/13] builtin/gc.c: correct RAM calculation when using sysinfo Date: Sun, 6 Apr 2025 20:38:36 +0100 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: <1c04882b-e518-4272-bd18-ab918774e424@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: MS4xfJu0g9RgNJBxGFBYM7eykHCQM3T+qrWMMoqwI+f8ZqHvU6fu1YntMPxF3ax8ejDQTuhIC5u/Wz/gMWT2cspVtJ/QbULFScavOWegXCQ5oe5XLRUaKRBa SR+SCkRPnyVxqtFDRvffhMQX8eszv1qz82jIfFLkn1i7pMFWXVLGGClBeUCwrsj9AoKGs0V+VJoxcf67DtHSWJ5ttY3GAjAy5jc= 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 Sun Apr 6 19:38:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14039461 Received: from avasout-ptp-001.plus.net (avasout-ptp-001.plus.net [84.93.230.227]) (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 19AAD191F68 for ; Sun, 6 Apr 2025 19:40:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968407; cv=none; b=Lp4/ow9rFLpnWEwc6RKyROEZa1paAt2wJoGEEFtnIZ2PrJ8F8kxl03VtgOX6GyimvleAC/etblOT93+SHQltypBt8UBpCJSOS3bI32NU95hUUBCfVwNmsnr7t+/XlkBFzvX+ZAYGKguKrVxnF7D1MUhadCrxqH5FBVRHAaUph94= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968407; c=relaxed/simple; bh=TjKhsMhJ1mexEcrV4NXpsRIo8NuJjR9DlutFZJ8egmg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KCXLmJwET7PQsyWNOXcGfKqH87qUNpu4HTqsO17qwvrM1klrft1jaTvMZFq1Yw9zyyXv/M5k/T7S1rzaSUV36WXZGYXGqFttPEypyMHT3m0MtgmeeOufar5C0uQOXMt2wSNGWcvz9/EuZhp6k3veZu6rDX35F/KDJFPxwIW/OTU= 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=ZAqqXoVP; arc=none smtp.client-ip=84.93.230.227 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="ZAqqXoVP" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 1VpUuYqwzbpaN1VqeupkMG; Sun, 06 Apr 2025 20:40:04 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1743968404; bh=fZqzkJ7jir9z0JVgHVQmrL/BwOPHWTAvL0dQT+xE1n4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ZAqqXoVP9pzr3wpen4ocgn3zOTZj1nUGou4muUrQBQyBOMR+2rCxV9VUJmuJJ9xQo xzp59AaN4ViOHSXjRGmJ+qVse0OkbWbiD1hNZPpf3g+ckkYYgiSf8RvnH0DQe885vS E7wWU0RukHNDYF7wANoe8XZMhsa2+7cArekkhfOe+nHPpeM/hhOf/zO6Hk8INh9y/+ XU4mkHhqcY4JD+XqSqDNdlq5prwdzaUa5d8s2Ej3ZCS/zVP3Et4vXw0doJ8R/gKpTj sD0/QeMnxiStLJpPn5hUcgJ82YrdrQzqgVVYV9mC5I9hxxi6SegNV+ClHdXBHY4Y85 sdhclk8No7o4w== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=frZ/Z04f c=1 sm=1 tr=0 ts=67f2d894 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 v2 11/13] config.mak.uname: add sysinfo() configuration for cygwin Date: Sun, 6 Apr 2025 20:38:37 +0100 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: <1c04882b-e518-4272-bd18-ab918774e424@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: MS4xfEz8tdwNfGRG8zvXNpNtG4Kcm9SjKt2HfQstFwgoiDYEuAESk8/2fi3SWuAYxmIUZWAXa62BWQQWhnFJQp7PtkYzHPBlCeA3eDA1YhQlPhSPdVRirnGx jMqVaYPVK1bQDxb35mkaO3U9y7rSn0N/Lazc1FDNt5DGKShAJ/hEcbNVRZD1dUCCq6Xh8+d3X0NaB+CJU2CoJJPbP5L25CPeh8I= 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 942550fb9e..0e29341056 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 Sun Apr 6 19:38:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14039462 Received: from avasout-ptp-001.plus.net (avasout-ptp-001.plus.net [84.93.230.227]) (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 B422E191F68 for ; Sun, 6 Apr 2025 19:40:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968410; cv=none; b=YzoLvat+7xnVpGrhRrg5H7B1QTb3mdSVkE8QzskDlnFov1u33jWki4V10v2VcHBZyZdtPC+NlS2a9nasbEtA45VkVTUV/SIfURw0XG9diZVtpKZsW/kJfpJ7uTQOIy81eO4QCSk4VC5+dqsaNkRclUY3mJJ7J+rubhKeLZLKc8Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968410; c=relaxed/simple; bh=kJZgKxp7Fy9KMGWRDLp5vqyevpJTW8A7qlgNvCp1IJU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YUzty+U2Ayex5P3mSh1vNHg3lsoYFMEpaDvV/JEnxcsg3G/H8FS/9fY6Ldxj/hRm81fQAuse2/FEe/dxwk8wxxbtLJhBOEGR/DNI1ubwaOqIEC9RYWePMziZ4Mgsi6Y93+J77eg7x77NZl1cVoVm+uBjIEwWY3Uj3bCcdADmIP8= 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=UjGihXTJ; arc=none smtp.client-ip=84.93.230.227 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="UjGihXTJ" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 1VpUuYqwzbpaN1VqiupkMO; Sun, 06 Apr 2025 20:40:08 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1743968408; bh=KHkUsw3IdorHcjR63aRIIyQzDIRE+3Cj9Isj1jUCdZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UjGihXTJ0JqkPdPH/I69XGwToG20N3nxg+LMrogutT6YmSqG7Rgw0LrOM3Nifd/E1 KDlpn2VskoSXBt4r+EixDGoNUJQHRPgegq3x5GvUufGSwwZTXVBGSPm9YwUHaI3bF0 leA8EdkwCjuc5q9tG+ip4tTXtFWZFJpgtL3dvqbBN2dnLqA3bB1Yy/ACeLPEH9hdCo cSKVM857hT9dMpVeJZfZknX60PWkD6yvG7dtM4+h+UCWoU5QXDl9XCDq6cl3GXmih3 A7XlpGmv/pWSdpq6a91rdmOr1u8nX/I1WNyvAWJuia7XC7DCmzo3wWtvp4Y0wlxBDC hXhy6Im/iLvzw== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=frZ/Z04f c=1 sm=1 tr=0 ts=67f2d898 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 v2 12/13] config.mak.uname: add arc4random to the cygwin build Date: Sun, 6 Apr 2025 20:38:38 +0100 Message-ID: <422d4b2571c718dd605dd0d924252c618b9e7e73.1743859985.git.ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: <1c04882b-e518-4272-bd18-ab918774e424@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: MS4xfPTvGPQhmRg9GmgWWDbCkwvMiOR5Sbz6sSLiPMMLkPglsAjpkJVxIwAiWxQ+sa4eL9sowWNXAnNuHlzsaodB4KqNpvbe4AvmSygfUusu3tmaCqzYKc3h EolSaHYJuiRBVGz2e7AAn615EuzUv3CNdFODWdWD5TIVhG+fxW9MP+1n18Q2LeXPhDZ5cyr3jwq87KAXPFPhgwGYmov0IX4Tk+A= 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 0e29341056..4f6770a5f4 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 Sun Apr 6 19:38:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 14039463 Received: from avasout-ptp-001.plus.net (avasout-ptp-001.plus.net [84.93.230.227]) (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 B736A1AAE13 for ; Sun, 6 Apr 2025 19:40:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968414; cv=none; b=SqqmD1YoUdYSZKlbidGdDKcZ5LgzITaZv999r4smyY1cclznR0IUOPSeFe89kZYHimUomV0A6Ev8eeetLbljMUb6OrGYPmJvBk6dmNy9IPcioBfWg92hd0N+YpqG9uFpfehEYB4Zwp+KCJYmNSCBwzzz9eWV2SdiG1awyzmYkaI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743968414; c=relaxed/simple; bh=RUi5p2l7h7cj9AXu04wpFk/bvRREK5ICo57ggyxEur0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GJyUxLma1oCJmws/ri7PJvf5kj9nVFWi+5Uh69VVVoR57ex9FL2mtGmXa9AjLwHKyAPdgw5vLbCZ15F2OcefHRO25vPXeNzmGRX5doYnncQYyZTqAR+O2TeJHMNDR/W0YUBX/KV5A/k93BB2oCPgZGa0Nsy+7AzFyiYsA6t76S4= 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=NlPGWFoL; arc=none smtp.client-ip=84.93.230.227 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="NlPGWFoL" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id 1VpUuYqwzbpaN1VqlupkMU; Sun, 06 Apr 2025 20:40:11 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1743968411; bh=sYctSVlYYrLFdg++eWYIQKaS3+U7IsdTHBPWNdOkzzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NlPGWFoLaQvaudsEjoDZ5MQltCqXMMZqxsDQpzONenWYqS656OZHYUPK1U2daglby a9QIqGPrcWL7m6KSe6R2QmwpbwXkwsEI/yrnHx6KvhAGctWl7gvRmt+T0b0zJU88q7 k1o3E40r7KrnERD5dv/XThEz0TmSthBgVGkunqOhcW0T2cV4NBjwq15JAxLVEOw+ZC oCv1VvZnXGX7P7ndg3lfKqKLdl5aonuzISTd5yFeS7GiuMzU/u9fBD0u+BOH4Kzudm 2mSlw569//shwzfk2yMRF76QgIGtgSqtyLO33VZYR30Dzc83USEHUmS5atG3LjDbDn qGiB85R7bgErA== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=frZ/Z04f c=1 sm=1 tr=0 ts=67f2d89b 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 v2 13/13] config.mak.uname: set CSPRNG_METHOD to getrandom on Linux Date: Sun, 6 Apr 2025 20:38:39 +0100 Message-ID: <7b133af24b472e343a19ddc0e89c31da80ade098.1743859985.git.ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: <1c04882b-e518-4272-bd18-ab918774e424@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: MS4xfE/43ByDBgd+hoN/AfaLN7EPKLBmLj1irIG1CggUPh67zzXHTSJNXUPlG0Utte7vBuJKGRPqj6z+MbjV4Gz0P1G+Rhj239Anm0BMt9/9Ai2YaFtQ9qE5 hvoX6KVGODBmfb8duURjXgo5LaJa/3D0aMszWtKwbOznju/8OsYjWV1xlhcuSsoqJ8zCiVgAF+cROf1UbJ+bTO4OJuNk2tQk1n0= 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 4f6770a5f4..6ebe6dcf37 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