From patchwork Mon Aug 19 07:47:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13768030 Received: from fout2-smtp.messagingengine.com (fout2-smtp.messagingengine.com [103.168.172.145]) (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 1371214B959 for ; Mon, 19 Aug 2024 07:48:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724053685; cv=none; b=sCF4x04GHaCcGQUAeWuO3nB0JQcODfbMfYEI0Zh9IJr83ce8PSXHi200KmbluVrW5uObMFp6GzI3m6p0udIiJEn73kRyIzjmwjnSmz5fpn/nwxw5Pt7wJ2Y5B5N5bM9+HCmbqjKjiLUG55VgJTSI3RPoqftf0CPdjQFHjBYgrxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724053685; c=relaxed/simple; bh=qNIcjvoC9TrFsmbVFtosMVuP0YxPoE2nI6D39GW8qJU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OYOdCu065QMNtM5K/Al67njKEKtXKg1IVOSq+hXX5eWvprjjG+1Azr4ZzG1mgkC52IhmjmIFph7PjuxWYkklGh9h15/ubv5HGBwkhnfZJNMTRfnjyEMz6mWgamLDlVO3BcGebxAVQOy6iWYsBrxzEj+NXaOzKLP2sODJcBx2Pac= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=dcb5oSAN; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=MXFO4II6; arc=none smtp.client-ip=103.168.172.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="dcb5oSAN"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="MXFO4II6" Received: from phl-compute-02.internal (phl-compute-02.nyi.internal [10.202.2.42]) by mailfout.nyi.internal (Postfix) with ESMTP id 2A561138FF5E; Mon, 19 Aug 2024 03:48:03 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Mon, 19 Aug 2024 03:48:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; 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=fm1; t=1724053683; x=1724140083; bh=J72QfK6UFm DdMiKbORGRia/Rorg7EwlLE4xRZVyXSBY=; b=dcb5oSANERiIvvP8ypsImD0Y1u cHQzhnMHi0BQtV/zWxoDX5XRqg5SsmuqEsV1dBLr111qESB2rq0tYxRFestyq+g1 MDMISINbPUZN1QwSg51ojQpfGwDeGoa+nk90I3S3LNa0NqHm/eLYA9ZI2eB84+Fs MJ2Yigp838tspDmq48R7pxWHKpdCfYQMl5N604eVVuS6gzw1q+HpAkoRmjQwuZAh bxDLvIE2yvQyTGcAM7b1J3K4pNgQ++DKJr9e/ASBj4HX1ru8QwfNsCZzVfNU6pni syhjH3GwHoVa4crZ4LrbBP4Bh1Dxgo6OkE+LOia8deiASSn6dkjgOUDlj0eQ== 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-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1724053683; x=1724140083; bh=J72QfK6UFmDdMiKbORGRia/Rorg7 EwlLE4xRZVyXSBY=; b=MXFO4II6Yj4AmnxqA9MGxLLacHWjqhKtVwHntxyJnFey oXGBmKe4eI2fHbmAwki7Hn/HhMnsRQ2uddpATUoTnu6Lq9PLAslSeoN90/rGm8YG hjuYlZyDiq0DEzOHruz/5Z7VBPdK3lGR1mpBohtEeZefqYSF+7sgh8NinKHB92NL jyPmn54JJoEZOJXlhvQtYFXNg8pX2bgUgjNHoAu0KunU8zrmEZActOeqOCrMEnGi CSPXX/W56ZKvH6g7IAbWmgydTyYmTpMUwYlEC7evGye33WUnqEUbonoy2GqQf+BW Fm0nvlXQYyKYlnQAXTQin51vtlp5OfeTmGJbFAJwgg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddufedguddviecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddv necuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrih hmqeenucggtffrrghtthgvrhhnpeelueffgeegheevtdetkeeiffdttdehteekuedtkeeg iedtvdfhueevudelkeeghfenucffohhmrghinheplhhoohhsvgdqohgsjhgvtghtshdrrg huthhonecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep phhssehpkhhsrdhimhdpnhgspghrtghpthhtohepiedpmhhouggvpehsmhhtphhouhhtpd hrtghpthhtohepjhgrmhgvshesjhgrmhgvshhlihhurdhiohdprhgtphhtthhopehgihht sehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhtohhlvggvsehgmhgrih hlrdgtohhmpdhrtghpthhtohepphhhihhllhhiphdrfihoohguuddvfeesghhmrghilhdr tghomhdprhgtphhtthhopehgihhtshhtvghrsehpohgsohigrdgtohhmpdhrtghpthhtoh epphhhihhllhhiphdrfihoohguseguuhhnvghlmhdrohhrghdruhhk X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 19 Aug 2024 03:48:01 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id fc95f052 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 19 Aug 2024 07:47:32 +0000 (UTC) Date: Mon, 19 Aug 2024 09:47:59 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Phillip Wood , phillip.wood@dunelm.org.uk, James Liu , Derrick Stolee , Junio C Hamano Subject: [PATCH 1/3] t7900: fix flaky test due to leaking background job Message-ID: <4805bb6f6c2c96a2c40d1d8359b63b8c7045e0b6.1724053639.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: One of the recently-added tests in t7900 exercises git-maintanance(1) with the `--detach` flag, which causes it to perform maintenance in the background. We do not wait for the backgrounded process to exit though, which causes the process to leak outside of the test, leading to racy behaviour. Fix this by synchronizing with the process via a separate file descriptor. This is the same workaround as we use in t6500, see the function `run_and_wait_for_auto_gc ()`. Signed-off-by: Patrick Steinhardt --- t/t7900-maintenance.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index 06ab43cfb5..074eadcd1c 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -967,8 +967,13 @@ test_expect_success '--detach causes maintenance to run in background' ' git config set maintenance.loose-objects.auto 1 && git config set maintenance.incremental-repack.enabled true && - git maintenance run --detach >out 2>&1 && - test_must_be_empty out + # The extra file descriptor gets inherited to the child + # process, and by reading stdout we thus essentially wait for + # that descriptor to get closed, which indicates that the child + # is done, too. + output=$(git maintenance run --detach 2>&1 9>&1) && + printf "%s" "$output" >output && + test_must_be_empty output ) ' From patchwork Mon Aug 19 07:48:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13768031 Received: from fhigh5-smtp.messagingengine.com (fhigh5-smtp.messagingengine.com [103.168.172.156]) (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 C11D91586FE for ; Mon, 19 Aug 2024 07:48:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.156 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724053688; cv=none; b=FC60n1LwM+lZmKwwH5OI0RlLTf8pzbemmDxXeSY+UyekWPfKQxgdMNUeJP6yhGfjYX2jpOxJqbPpBP+4OUo5tZzZ+f3S1qS4N0+ZNYZgxOMOPDkZaiWLj8LgpUue/f0H1TxnIYGdsk8RW6+FzmFFp1PyoUmOul+CYGkI4ZTAgcE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724053688; c=relaxed/simple; bh=Y3zh4INfgRD7AaEHM5q2krUJLVPuIgUSbWYA4kV2PAc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qFjoduDdB/uD7wXgEBa5bnm2y9LDHeVjgn+sVjsU/Pufx084Zd61IrooUnj3fVOdmtoZMEMZTW+fazihjdm8reywSgeMs+XsByeK/LDh9exJ0hwx1VdOSdmFTCooIkOylJYnD3Ex1FcL/3zRMPyFfJzgEe5sQQMBjtEhUM/9lss= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=bl+b7dwi; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=HB1pkw37; arc=none smtp.client-ip=103.168.172.156 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="bl+b7dwi"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="HB1pkw37" Received: from phl-compute-05.internal (phl-compute-05.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id CD9E6114EA13; Mon, 19 Aug 2024 03:48:05 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Mon, 19 Aug 2024 03:48:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; 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=fm1; t=1724053685; x=1724140085; bh=3lTmmucJap XvslgIbw0siAZSJ3YNihy/MgWWBJ7hJy8=; b=bl+b7dwiaMoyO/4qplGfzbH20I 3tXmxTGmqehgm0qDWYLT9un7w0YautbJRVirYf48UgeIL5bi/znLqywJc5Tt79o3 9v6t7hZm55ZkT484v/5gKH6iSSRjTympexuWJaS5IWZj57jB8gJPugWcapbv3aBN I6V2Uf/kBnp9EoCmHKTZHNq6EX9PZykBWCjC2qCLxM81sz8tl1X9FvAJWS8nemOi m8p14pqxmKmNxJ00JvV34WPLoCtwWH+evksGQEiZfuOBv7745NttYArx0RzpWc3N Aamv66czDgZkMhwcXgtdgYKHkJszCxFvOYKhKkyNOO/vM+Cogdj50ZJCwGpg== 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-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1724053685; x=1724140085; bh=3lTmmucJapXvslgIbw0siAZSJ3YN ihy/MgWWBJ7hJy8=; b=HB1pkw377XGkiHV6sqBOxre2fEn/Ui5OCCo3LbO/Im/e s4xn9uzvT3NHPrVqOJqFhx2CWySioYiUdZPeDSFp3FZ4dKNTFfa2XP7QnC1uKU/d 7423LXMiewmjy8tdowfMHka/nzHLECWe1hC1rTmIKrJnb0eQWpj00ERvK291qIr+ pcdowiY1xHr3bcGVJinqAYzZPsZcUHaI4pC1AUY7OFuAIThSqQ0p4KmD5sQY+dz9 3TRfebxWdNQkUJp2UcjgSizTLlV/+yU3Nh7htN8pPELRIltT5j7VyJnHrcQeLV2C JkMOEkRrsUYcXaq1T6ctGPiAWBejAvcDarjmylOFSA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddufedguddviecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddv necuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrih hmqeenucggtffrrghtthgvrhhnpeevkeekfffhiedtleduiefgjedttedvledvudehgfeu gedugffhueekhfejvdektdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeeipdhmohguvgep shhmthhpohhuthdprhgtphhtthhopehphhhilhhlihhprdifohhougesughunhgvlhhmrd horhhgrdhukhdprhgtphhtthhopehjrghmvghssehjrghmvghslhhiuhdrihhopdhrtghp thhtohepphhhihhllhhiphdrfihoohguuddvfeesghhmrghilhdrtghomhdprhgtphhtth hopehsthholhgvvgesghhmrghilhdrtghomhdprhgtphhtthhopehgihhtsehvghgvrhdr khgvrhhnvghlrdhorhhgpdhrtghpthhtohepghhithhsthgvrhesphhosghogidrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 19 Aug 2024 03:48:04 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 09323586 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 19 Aug 2024 07:47:34 +0000 (UTC) Date: Mon, 19 Aug 2024 09:48:02 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Phillip Wood , phillip.wood@dunelm.org.uk, James Liu , Derrick Stolee , Junio C Hamano Subject: [PATCH 2/3] t7900: exercise detaching via trace2 regions Message-ID: <9712aae82bcb51dd94fdc10f4156e9c78e4b6d8c.1724053639.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: In t7900, we exercise the `--detach` logic by checking whether the command ended up writing anything to its output or not. This supposedly works because we close stdin, stdout and stderr when daemonizing. But one, it breaks on platforms where daemonize is a no-op, like Windows. And second, that git-maintenance(1) outputs anything at all in these tests is a bug in the first place that we'll fix in a subsequent commit. Introduce a new trace2 region around the detach which allows us to more explicitly check whether the detaching logic was executed. This is a much more direct way to exercise the logic, provides a potentially useful signal to tracing logs and also works alright on platforms which do not have the ability to daemonize. Signed-off-by: Patrick Steinhardt --- builtin/gc.c | 5 ++++- t/t7900-maintenance.sh | 11 ++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/builtin/gc.c b/builtin/gc.c index bafee330a2..13bc0572a3 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -1428,8 +1428,11 @@ static int maintenance_run_tasks(struct maintenance_run_opts *opts, free(lock_path); /* Failure to daemonize is ok, we'll continue in foreground. */ - if (opts->detach > 0) + if (opts->detach > 0) { + trace2_region_enter("maintenance", "detach", the_repository); daemonize(); + trace2_region_leave("maintenance", "detach", the_repository); + } for (i = 0; !found_selected && i < TASK__COUNT; i++) found_selected = tasks[i].selected_order >= 0; diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index 074eadcd1c..46a61d66fb 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -950,8 +950,9 @@ test_expect_success '--no-detach causes maintenance to not run in background' ' # We have no better way to check whether or not the task ran in # the background than to verify whether it output anything. The # next testcase checks the reverse, making this somewhat safer. - git maintenance run --no-detach >out 2>&1 && - test_line_count = 1 out + GIT_TRACE2_EVENT="$(pwd)/trace.txt" \ + git maintenance run --no-detach >out 2>&1 && + ! test_region maintenance detach trace.txt ) ' @@ -971,9 +972,9 @@ test_expect_success '--detach causes maintenance to run in background' ' # process, and by reading stdout we thus essentially wait for # that descriptor to get closed, which indicates that the child # is done, too. - output=$(git maintenance run --detach 2>&1 9>&1) && - printf "%s" "$output" >output && - test_must_be_empty output + does_not_matter=$(GIT_TRACE2_EVENT="$(pwd)/trace.txt" \ + git maintenance run --detach 9>&1) && + test_region maintenance detach trace.txt ) ' From patchwork Mon Aug 19 07:48:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13768032 Received: from fhigh5-smtp.messagingengine.com (fhigh5-smtp.messagingengine.com [103.168.172.156]) (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 6E387158A12 for ; Mon, 19 Aug 2024 07:48:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.156 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724053690; cv=none; b=q7Lof8Mgt3wW4kshVoUVBjletuSeJc/EBlTDWqVvEciPX00BVM9R200pPL1xLVLEO+ORGYa5NQSugIIobTpP50jh/tA1yQW5+bg6zUgh+OhX/7cNgfQDpGtIjJwItCsrfcWzsJF5NFyx559NxBq/3OAexU7N08+7DWdu01c+Rqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724053690; c=relaxed/simple; bh=BWWJzr9s6TcKs+eIdtXCn7fIDSRQhzmOLvRW7jBgSAk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZBBN5Macy8IjUbwIjCSvSbHoJtoGQ/w0vHljqW7AbJ4DqFuViJ+V8XbXGzT33E2y2rPVaEFTWuz62CZ3inTrIXP0oe1ptRGaHxhE45Fb0heN2ofQRj7SqLA/JLnzMcpwK1qULGxHw5aS6NV8UFodTlHmx9VcMrimJGpPx724C/Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=ad1FP0Yu; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=kAasmAFe; arc=none smtp.client-ip=103.168.172.156 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="ad1FP0Yu"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="kAasmAFe" Received: from phl-compute-01.internal (phl-compute-01.nyi.internal [10.202.2.41]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 8C9FF1151237; Mon, 19 Aug 2024 03:48:08 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Mon, 19 Aug 2024 03:48:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; 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=fm1; t=1724053688; x=1724140088; bh=VA/r0WjGhP Vfq5rtkOi58z2f2A8F1uXOWgFrpn6xXLQ=; b=ad1FP0YuAT2c7U5fp468SsZ7YV 18sepMB9GqBxYeZroVWsRkLebmAkzeXdsyd9MKqc01e61kP4lYWMf432POnI2kHF 4WXETzJ6atGk9zoBzbVPbVr//Fou1t7KTab0lAsMIBmn7VcXpdOiQTgMiFYtLpT/ /OpmR5way+jvrpk3xQTvdgnwUl+RBQX1X17LJBkb7wq2Hao31Bl5+Sh0+WLeGEtm OJ4yWhZFRV1oooyZJHK2ssbL1OyC2oQDiIIb8eLYnFuXoMjjMiaY6XZPAdnxYNdD tCgz+s8jRcDmSrhJol7za7qPb41gI24s/xYveDfjKcPP83TT5zA3O5v7wAgA== 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-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1724053688; x=1724140088; bh=VA/r0WjGhPVfq5rtkOi58z2f2A8F 1uXOWgFrpn6xXLQ=; b=kAasmAFewq22lpAwjKHwXgSn6Kz/YrvubDSqVt3fjhR3 aN17qF3iQVK9eVDnQM+28p0nvEH6GZKquJF9xM9LHiyI3SgEk5ZfLZKewfY2OsD3 kKK1Yd6crBGWArDLOxMUmDKbY201Dfgqw+/w/L5T6UVvTIdD35scz5qN62xy1/8J JGkzt982cf/W81B2bHrfoOjhCrIyDKkf2aWhLRbSr/VpDWBA6qQGRMufPJnlNxNf fB38t7FpHhTiauJw673il00PFr6wh5UIZO1pb1RKrZDA7DdZqJh55lDqxXeHlY6M LkNzsUI0bk978XqeSuJUZU1Ygd7m3RZ591XvfoLMRg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddufedguddviecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddv necuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrih hmqeenucggtffrrghtthgvrhhnpeelueffgeegheevtdetkeeiffdttdehteekuedtkeeg iedtvdfhueevudelkeeghfenucffohhmrghinheplhhoohhsvgdqohgsjhgvtghtshdrrg huthhonecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep phhssehpkhhsrdhimhdpnhgspghrtghpthhtohepiedpmhhouggvpehsmhhtphhouhhtpd hrtghpthhtohepjhgrmhgvshesjhgrmhgvshhlihhurdhiohdprhgtphhtthhopehphhhi lhhlihhprdifohhougduvdefsehgmhgrihhlrdgtohhmpdhrtghpthhtohepghhithesvh hgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehsthholhgvvgesghhmrghilhdr tghomhdprhgtphhtthhopehphhhilhhlihhprdifohhougesughunhgvlhhmrdhorhhgrd hukhdprhgtphhtthhopehgihhtshhtvghrsehpohgsohigrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 19 Aug 2024 03:48:06 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 5e40e5d3 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 19 Aug 2024 07:47:37 +0000 (UTC) Date: Mon, 19 Aug 2024 09:48:05 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Phillip Wood , phillip.wood@dunelm.org.uk, James Liu , Derrick Stolee , Junio C Hamano Subject: [PATCH 3/3] builtin/maintenance: fix loose objects task emitting pack hash Message-ID: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The "loose-objects" maintenance tasks executes git-pack-objects(1) to pack all loose objects into a new packfile. This command ends up printing the hash of the packfile to stdout though, which clutters the output of `git maintenance run`. Fix this issue by disabling stdout of the child process. Signed-off-by: Patrick Steinhardt --- builtin/gc.c | 6 ++++++ t/t7900-maintenance.sh | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/builtin/gc.c b/builtin/gc.c index 13bc0572a3..be75efa17a 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -1159,6 +1159,12 @@ static int pack_loose(struct maintenance_run_opts *opts) pack_proc.in = -1; + /* + * git-pack-objects(1) ends up writing the pack hash to stdout, which + * we do not care for. + */ + pack_proc.out = -1; + if (start_command(&pack_proc)) { error(_("failed to start 'git pack-objects' process")); return 1; diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index 46a61d66fb..7cc4eb262c 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -978,4 +978,20 @@ test_expect_success '--detach causes maintenance to run in background' ' ) ' +test_expect_success 'repacking loose objects is quiet' ' + test_when_finished "rm -rf repo" && + git init repo && + ( + cd repo && + + test_commit something && + git config set maintenance.gc.enabled false && + git config set maintenance.loose-objects.enabled true && + git config set maintenance.loose-objects.auto 1 && + + git maintenance run --quiet >out 2>&1 && + test_must_be_empty out + ) +' + test_done