🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #2669

Re: [PATCH v2 1/2] t: add "test-tool genbytes" to avoid slow tr(1) on macOS

#2669
From: Junio C Hamano
Date: Mon, 09 Nov 2026 01:39
40 lines
14180 bytes
"Kristofer Karlsson via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> diff --git a/t/helper/test-genbytes.c b/t/helper/test-genbytes.c
> new file mode 100644
> index 0000000000..b760326b24
> --- /dev/null
> +++ b/t/helper/test-genbytes.c
> @@ -0,0 +1,61 @@
> +#define DISABLE_SIGN_COMPARE_WARNINGS
> +
> +#include "test-tool.h"
> +#include "git-compat-util.h"
> +#include "hex-ll.h"
> +
> +/*
> + * Write "count" copies of "byte" to stdout, or an endless stream of them if
> + * "count" is negative.
> + */
> +static int generate_bytes(char byte, intmax_t count)
> +{
> +	char buf[256 * 1024];

Allocating 256kB on stack may not be a great practice, but this may
sufficiently work on most reasonable systems, as this is an internal
of a "run once and exit" test helper function.

Still, the stack memory for the primary thread of a process is
limited to 8MB or so on modern Linux systems, and I hear macOS also
uses 8MB.  I am not familiar with Windows, but some documentation
found on the Web seems to say that their linker gives 1MB to their
product by default, and among 1MB, 256kB is not an insignificant
fraction.

Again, this is an internal of a "run once and exit" test helper, so
declaring this as "static char buf[]" should not pose an issue; it is
not like you would need to have multiple simultaneous invocations of
this function, each of which needs to fill this buffer with
different values.
Technical Details
Message-ID: <xmqqeccu3hqq.fsf@gitster.g>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74856-linux-kernel-git=dewy.ru
References: <pull.2301.git.1794063565.gitgitgadget@gmail.com> <pull.2301.v2.git.1794165304.gitgitgadget@gmail.com> <54139a3a97127732e11fc5abbc9a3687542669f6.1794165304.git.gitgitgadget@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74856-linux-kernel-git=dewy.ru
From: gitster@pobox.com (Junio C Hamano)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v2 1/2] t: add "test-tool genbytes" to avoid slow tr(1)
 on macOS
Date: Sun, 08 Nov 2026 17:39:57 -0800
Organization: Usenet Network
Message-ID: <xmqqeccu3hqq.fsf@gitster.g>
References: <pull.2301.git.1794063565.gitgitgadget@gmail.com>
	<pull.2301.v2.git.1794165304.gitgitgadget@gmail.com>
	<54139a3a97127732e11fc5abbc9a3687542669f6.1794165304.git.gitgitgadget@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: usenet.network;
	logging-data="247916"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:XcVRZDSciYQn9SGsO9E7/wqmKz8= sha256:7XkOO4giXupINhMVBlg1nu7c1CuWMLkoHU8Rs6Trztw=
	sha1:7HRdE1YLVkjAfQEDznByaRkD8fk= sha256:sNl/In6cawlTurvPZ7QyDtibO5/RoeWkIB0GTUKwtks=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id A1E4111368C; Mon,  9 Nov 2026 04:53:54 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.951
X-Spam-Status: No, score=-1.951 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=pobox.com header.b=g9Gp5wmV; dkim=pass (2048-bit key)
	header.d=messagingengine.com header.b=AwkqUc0C
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id c3NR9tciNCQW;
	Mon,  9 Nov 2026 04:53:46 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=git+bounces-74856-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=pobox.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 419EE113646; Mon,  9 Nov 2026 04:53:31 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 25C3E3FAB1; Mon,  9 Nov 2026 01:40:04 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794188401;
	b=nJSaB5GqDCTA9XEds0p86WQ5x49qCWaXdQusiVnmmVpdw6etet3weShirQmTvdcsq/4v
	 lydIa6MxY2PHr5X+nrqZJqLakvUU3KdJrDRx+C6VSwhYKpln3O95dU4ECSUm1fAdcMZd/
	 qr89FFlhjXxD/rUC47QoG/fNhE+yw7F0TtXOi+TyX0pKXzDF3ULS+JAZC+DsWxnTffQey
	 Qj1luMSPfC8g+MAkK2RczAL2Jz+OswNFZWJFM/2h+uoWdvFAwNibozaWy1gfQmYAWTxN7
	 kcgSUhyP+myuP3XuCjWMbzmJkSrc4TpmVeq9JXKIukBorSYOXSfCg23Nn6FP3P+moVw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794188401;
	h=X-Original-To:Received:DMARC-Filter:Received:Received:DKIM-Signature:
	 DKIM-Signature:X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:
	 Message-Instance:X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:
	 X-ME-Proxy:Feedback-ID:Received:From:To:Cc:Subject:In-Reply-To:
	 References:Date:Message-ID:User-Agent:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type;
	bh=2w5Do5y1BRiQt/Avu1LZO1NjmCiwWf8sOHF7lqg8PMo=;
	b=wpcZytU4yqrAAYL+eBxpLJNp1LZ3qUQSKK8xcJAz0n/N+2mnv7HTSBqbwrwNosJgD2Z+
	 bKN/QCsoW0FCimTtfMe6ID3nEGzWjXsHXM7DRJR8Z09nVc9BzvaNRKahzd6DnwjpTuXRH
	 IJcymE9ULMIfnS5+6/sAaGoNq1mt49MAGujeP1JQ67UrAO/sVIVXkD+ileZ1ohXzEWs7j
	 vCgpMhYTLHNhLhjajatMHPZYcAM4nHXN/jWexj9aZ8QIzIXohmr7v4Ul65YKtp0LCEJfG
	 ItXfOjOtLlPtNXrCuWVNPqyMJNp3Uk9aHHqe20mDstJN31MEE5zjcYgJaxpA6XceR3A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=g9Gp5wmV;
	dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=AwkqUc0C;
	dmarc=pass header.from=pobox.com;
	spf=pass smtp.mailfrom=pobox.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E680606A325;
	Mon,  9 Nov 2026 01:40:01 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=g9Gp5wmV;
	dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=AwkqUc0C
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=103.168.172.144
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794188400;
	b=pBSJGGquKqfTOA6tf1nYI2+RTiABpXCKIvhn00HDWvkmGbbWfH35UlegkY+k2luSO84Z
	 XY1LUnHa9Qq8JiCaYeil4MsOxS870Y9MF0WW/P5EE/7ma52sCK/xZbhnSIpj5mpqT41Mw
	 oN1nyj7A512EA+adnDFVkDyS5EJfCe7oXl6nLstazjmvja5WEt49YU0tdIWzCOzKFXbVE
	 Rp7gjOl98YTlRp31d9wa+s2FRrP8cS+HrUBZT/naaB9VUnavWOgf57YOGDaNBiJm5Tfiq
	 rS0o+IWCh/P3Ds771lnhulfI+7h9Zl8zfEeWetcVtbcGPPWY0o48979k7uWz8ZgFXiw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794188400;
	h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature:
	 X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance:
	 X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:
	 Received:From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
	 User-Agent:MIME-Version:Content-Type;
	bh=2w5Do5y1BRiQt/Avu1LZO1NjmCiwWf8sOHF7lqg8PMo=;
	b=sPuZ7Hg9QSzQv2sK7Xz+cueMdT26ekr8zsrNDuzA0/573BrKAQEhbqHluTY1lMMlgJ0A
	 idNeZDLhnpGf4+XGcsdyTnMdXHHotCGMQtA0c4BewKcaEiuwCcL16caoS8naQ47CRVhVL
	 4TONbBD71cVW1PhSrtAkwxvlC0v2BXU1aZtLb8Mh0lOORbT17G/C0ca4JHjgItIRVI+26
	 7xUxnx7jGK90ISbH66bM2alFAsy7qtFdfTyAFcPgWPcBYGRn3PhpgnrVdfR3PLsTDZNzs
	 QqapwC07CRpA0Ka3+wACO2RDufqvb4SrdRYlLA9sEMrKUE8+OZJ0RaI56QGMx1d9ASw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=pobox.com;
	spf=pass smtp.mailfrom=pobox.com;
	dkim=pass header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=g9Gp5wmV;
	dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=AwkqUc0C;
	arc=none smtp.remote-ip=103.168.172.144
X-Received: from fout-a1-smtp.messagingengine.com (fout-a1-smtp.messagingengine.com [103.168.172.144])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8BD1606A321
	for <git@vger.kernel.org>; Mon,  9 Nov 2026 01:39:59 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C8BD1606A321
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com
X-Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51])
	by mailfout.phl.internal (Postfix) with ESMTP id 1BA16EC0309
	for <git@vger.kernel.org>; Sun,  8 Nov 2026 20:39:59 -0500 (EST)
X-Received: from phl-frontend-02 ([10.202.2.161])
  by phl-compute-11.internal (MEProxy); Sun, 08 Nov 2026 20:39:59 -0500
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc
	:cc:content-type:content-type:date:date:from:from:in-reply-to
	:in-reply-to:message-id:mime-version:references:reply-to:subject
	:subject:to:to; s=fm2; t=1794188399; x=1794274799; bh=2w5Do5y1BR
	iQt/Avu1LZO1NjmCiwWf8sOHF7lqg8PMo=; b=g9Gp5wmVWbagoKfTsqW0eccguW
	PbZHnrO9mP0b8twt1PMXuL/lbmwa34wC2NfAAZAkm1+UjSSJN280lmhDoTd9VQeu
	7qorL67jjT1V14sEpiB9urmbtKcr91ZXfCIiBy5AL8eJJZ/M47LKs1fbJpUFJL5x
	rzZ0fER8YLszavbYJd4PpyeDAxECYhCViSVTjKdm0Y2EYOtXMo6kAEGrpfJHGBtU
	YpEBFs1dO/yzzbEfmKOG3DzziEjYlbq/ER92eVFDIHKQT8ltGj7FZAFowvDAvpsa
	orwy6UtFUahsoXYmqUG/ur3qYfxbLJDw3yFvbnO/TjDpSU1NpnTl9wNa+UnQ==
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
	messagingengine.com; h=cc:cc:content-type:content-type:date:date
	:feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
	:message-id:mime-version:references:reply-to:subject:subject:to
	:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=
	1794188399; x=1794274799; bh=2w5Do5y1BRiQt/Avu1LZO1NjmCiwWf8sOHF
	7lqg8PMo=; b=AwkqUc0CJhu0k6XJVI0QFkvFqIkMPrGt1zHqSrE7Qw4KA/qS/N8
	IH6lc1wOGnbBS67LieZLcYlUiDQQurCWtmbp/ZjW+LsI5XBXN9bkkivSQxSufcDW
	QI2DOutYaTKDs9OMF4SIG3xYejhbERXeV5tkIXsLE+hTlW9Hg3GFuYoguvI4xgZ7
	Pp3FeVX8gGnAT1o7pH3J4UypXp5q8y/Iznaf6j2sc9ytFBDOJSt9qGOBbfq6OX27
	WiRBCImjq6k6kaqy6j+aRvdG0MXk3j7lxia/+bVQNvpFCcQwFATn5N7kpq1cX0ay
	uRCu9Ue9TVrGnCb3xN4FfXgtq37H5VZUE/A==
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09;
	repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox;
	action=sign d=pobox.com a=rsa-sha256;
X-DKIM2-Signature: i=1; m=1; t=1794188399; d=pobox.com;
	mf=PGdpdHN0ZXJAcG9ib3guY29tPg==;
	rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+;
	s=fm2:rsa-sha256:ArVhmF0CEnX23i7jzLAqRAH+mCvoaoCzwK67A8Pz2CAETVI
	u++uxz8PGLkgl+FMCfGXFdyJF2K5PwizOwbO+HRmwxMXgu8/xxF2odBEP8lW46C3
	RdRMKKig9fhI6OlHDJVwMbd7fD86xY04B+tJZOgJh5VxVT8OeTZkrmJG7dizU0d2
	b6qCTXdP6V8fF+k2jzITgSIVeX/reKDYMj5C7K9umq/Ujemn1y6hbaFzI4HGqlAv
	1B7dBT/YfwoUVvr/Z4P9zrew4MIY0rsN8kr/t5cLKg2B8fCBocnvmVInVkdl/j8B
	w1UQQTL0qhdcCE2imemvsFSPNKhW4gOQ4p8mGFg==;
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09;
	repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox;
	action=mi-m=1; hc=12;
	hn=cc,content-type,date,feedback-id,from,in-reply-to,message-id,
	mime-version,references,subject,to,user-agent;
X-Message-Instance: m=1; h=sha256:WnE7eK9sUbk0hzBf5vaNCbkUrkYRUSxAgtYqMoO07PY=:E1bullE15Q76cjL0TlwpB7gi6Yd4JXXt5qYznV7Q8bw=;
X-ME-Sender: <xms:biTxavgkjli6kNrz6LzSwovVmB_jbTQUtU4qkCF8PxJ2dDWlNv8buw>
    <xme:biTxavvOzYXiS78XXYR-4aia3ca0k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TxauZDE_Ws00eXaxvXQ7ezKesRYyi2gzo4d4ek6V0WVReI3_P2AA>
    <xmx:biTxaowDRcKZiseNX3EGekXYzF3wunTG5nJwKu8LW2yWBURnqz53ug>
    <xmx:byTxav1TjaHqlKa7aYk-dTOkjuphWHtdURjpjzy5bGNca36sv4cSLeGi>
X-Feedback-ID: if26b431b:Fastmail
X-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun,
 8 Nov 2026 20:39:58 -0500 (EST)
X-Cc: git@vger.kernel.org,  Patrick Steinhardt <ps@pks.im>,  Johannes Sixt
 <j6t@kdbg.org>,  Kristofer Karlsson <krka@spotify.com>
X-In-Reply-To: <54139a3a97127732e11fc5abbc9a3687542669f6.1794165304.git.gitgitgadget@gmail.com>
	(Kristofer Karlsson via GitGitGadget's message of "Sun, 08 Nov 2026
	19:15:03 +0000")
X-User-Agent: Gnus/5.13 (Gnus v5.13)
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list