From patchwork Tue Jun 11 11:58:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13693589 Received: from wfhigh6-smtp.messagingengine.com (wfhigh6-smtp.messagingengine.com [64.147.123.157]) (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 43295176AD4 for ; Tue, 11 Jun 2024 11:58:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718107133; cv=none; b=jpLgBcDC1rnaRr+U4jCj8iwvvjhLx/1YfCOuWlzMDJnf/xIpFAFbMDjnlBkjhV2ClCr5zjfvX0veK/X745uX+4FXYnilDX1yvFtV6ZALelNOEXPp2my4y3L8b6nVY0I9ZvyADbP3RSxOFkJavMY2duCkXBKMrSV3CYkZ4vFfHYk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718107133; c=relaxed/simple; bh=34rHzqYBbh60jEbfBfujiU92Y4dYNmMTgx09Ovpq/ZA=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=l002sFE7+Jpvhsv037BOjvBLhaoAT1P1Pk0Cipk4VJUYFMSgUGaHHBOW9kG6Q8KYFGqMPrP/jDasZ7MoL1xLNcM4S0nB9wPEdUEM8ZMGRu3LhnFoGSsls5EOjEpRlkGd7JNWlqUTwlD6l/b/R41HBJmFE+Q0wTMC0SpD9jPS1TE= 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=F8/e5tP1; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Uf9VVQ3b; arc=none smtp.client-ip=64.147.123.157 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="F8/e5tP1"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Uf9VVQ3b" Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.west.internal (Postfix) with ESMTP id 9AD2A18000B9 for ; Tue, 11 Jun 2024 07:58:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 11 Jun 2024 07:58:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=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=1718107131; x=1718193531; bh=5RyAq2z45q fKj8PdG1NZpZ8nIidOU6GFuzTgAd3wW2Y=; b=F8/e5tP17aaOjoN/92Z5iS4UMl AHqsAM4+XJS809GGsLhtR6iGmJtrWgiy6awLYhbL8o9NpN/ipJiPOAnu3gLlloXe fIVgmFw3H2hvteIa0XU8N0+tugr0jTI5yixQbSqPrXscRDb+033YE5gzwegfzkaM c3wbButKrS2FmaElfhP6CoDbKGmB+E5O3NW4LmoW71D47bKPqQpe6iIoSWHmZRRS A7/OKAfEs7HXCiF8ccPJkrPNsN6fR4QbOKGFytXy/ntUeFUSYlqnt6HCy2bsFBER Cj1fan2M+DWEJUqHiJS6nEegyVh+R2zWlQivTO9EdXi/+4bbs7bMrCXOGDJw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=1718107131; x=1718193531; bh=5RyAq2z45qfKj8PdG1NZpZ8nIidO U6GFuzTgAd3wW2Y=; b=Uf9VVQ3butZnLdUHkN5B4dvHub+/3Sso1DUKDV7rf2hH CUy0YZ0a6V/A7PIBnCvjpGhi+af8P/dHdBe57M9VoDmZieCv6qP7yl1skyBnsj/M Rr0UGa8j+uh/m7MLdoqJE1fsOuPPs8VP5KiF7SMju14Q+3tLQgokSbCaC+zV2iaU Hi0h9ISCf+yYvmRrCo9SMo64Uky/XNJpER9FNXEv6FaFWtacSCAzGTc4me1z4Qah 2nkmfYbY4rPlPcfqsVXz6GzcrdZb9hCsKvNr7vvYEBlvFSW8UT117cVidnEUXzEW 6dst1yhVIFcuzTilLcxUewL+BMsmspbErEZdaxIeSg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfeduvddggeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkfhggtggujgesghdtre ertddtvdenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehp khhsrdhimheqnecuggftrfgrthhtvghrnhepheeghfdtfeeuffehkefgffduleffjedthf dvjeektdfhhedvlefgtefgvdettdfhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 11 Jun 2024 07:58:50 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id c1919028 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Tue, 11 Jun 2024 11:58:40 +0000 (UTC) Date: Tue, 11 Jun 2024 13:58:47 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Subject: [PATCH 16/21] compat/fsmonitor: remove dependency on `the_repository` in Darwin IPC 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 IPC socket used by the fsmonitor on Darwin is usually contained in the Git repository itself. When the repository is hosted on a networked filesystem though, we instead create the socket path in the user's home directory or the socket directory. In that case, we derive the path by hashing the repository path. The hashing implicitly depends on `the_repository` though via `hash_to_hex()`. For one, this is wrong because we really should be using the passed-in repository. But arguably, it is not sensible to derive the path hash from the repository's object hash in the first place -- they don't have anything to do with each other, and a repository that is hosted in the same path should always derive the same IPC socket path. Fix this by unconditionally using SHA1 to derive the path. Signed-off-by: Patrick Steinhardt --- compat/fsmonitor/fsm-ipc-darwin.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c index 6f3a95410c..b4d21d6dc2 100644 --- a/compat/fsmonitor/fsm-ipc-darwin.c +++ b/compat/fsmonitor/fsm-ipc-darwin.c @@ -41,9 +41,10 @@ const char *fsmonitor_ipc__get_path(struct repository *r) /* Create the socket file in either socketDir or $HOME */ if (sock_dir && *sock_dir) { strbuf_addf(&ipc_file, "%s/.git-fsmonitor-%s", - sock_dir, hash_to_hex(hash)); + sock_dir, hash_to_hex_algop(hash, &hash_algos[GIT_HASH_SHA1])); } else { - strbuf_addf(&ipc_file, "~/.git-fsmonitor-%s", hash_to_hex(hash)); + strbuf_addf(&ipc_file, "~/.git-fsmonitor-%s", + hash_to_hex_algop(hash, &hash_algos[GIT_HASH_SHA1])); } free(sock_dir);