Article View: linux.kernel.git
Article #360Re: [PATCH 2/3] t6500: get hostname from "git var"
From: Junio C Hamano
Date: Mon, 12 Oct 2026 19:20
Date: Mon, 12 Oct 2026 19:20
45 lines
11591 bytes
11591 bytes
Isabella Caselli <bellacaselli20@gmail.com> writes: > The test "background auto gc respects lock for all operations" simulates > a concurrent gc by writing our shell's pid and hostname to "gc.pid". > It gets the hostname from the "hostname" command, falling back to > "unknown" if the command fails. > > "git gc" gets its hostname from the system and only checks whether the > pid is alive if the two hostnames match. Otherwise, it assumes the > lock belongs to a gc running on another machine. Since the test passes > in either case, a missing "hostname" command or a mismatch between > its output and the system hostname can cause the test to silently > exercise the wrong case. "exercise the wrong case", meaning... where hostname(1) output is different from "git var GIT_HOSTNAME" (aka xgethostname()), we would have written bogus name in .git/gc.pid file, simulating the case where gc.pid was written by a process running on a different machine. What is the implications of doing so? > > Use "git var GIT_HOSTNAME" to get the same hostname as "git gc". > Keep the "unknown" fallback, which is also used by "git gc" when it > cannot determine the hostname. > > Helped-by: Jeff King <peff@peff.net> > Signed-off-by: Isabella Caselli <bellacaselli20@gmail.com> > --- > t/t6500-gc.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh > index a7142ab815..f928089bf0 100755 > --- a/t/t6500-gc.sh > +++ b/t/t6500-gc.sh > @@ -413,7 +413,7 @@ test_expect_success 'background auto gc respects lock for all operations' ' > > # now fake a concurrent gc that holds the lock; we can use our > # shell pid so that it looks valid. > - hostname=$(hostname || echo unknown) && > + hostname=$(git var GIT_HOSTNAME || echo unknown) && > shell_pid=$$ && > if test_have_prereq MINGW && test -f /proc/$shell_pid/winpid > then
Technical Details
Message-ID:
<xmqqecdu67zq.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-71788-linux-kernel-git=dewy.ruReferences:
<CAK4AdTSnaAOk649a0GLe1M9C+cYuDa0Nwo54=HT47R53Q4ZdWw@mail.gmail.com> <20261012015846.2649843-1-bellacaselli20@gmail.com> <20261012015846.2649843-3-bellacaselli20@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-71788-linux-kernel-git=dewy.ru
From: gitster@pobox.com (Junio C Hamano)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH 2/3] t6500: get hostname from "git var"
Date: Mon, 12 Oct 2026 12:20:41 -0700
Organization: Usenet Network
Message-ID: <xmqqecdu67zq.fsf@gitster.g>
References: <CAK4AdTSnaAOk649a0GLe1M9C+cYuDa0Nwo54=HT47R53Q4ZdWw@mail.gmail.com>
<20261012015846.2649843-1-bellacaselli20@gmail.com>
<20261012015846.2649843-3-bellacaselli20@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: usenet.network;
logging-data="1869925"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:UZmLKQK2S3lpGz5yNmT+15ramU8= sha256:cLHOaVAtCZrkvNrvNcUO7xKstbd/0wFY9M3nth2cns4=
sha1:sGIh4Qw6NKfg0VAGKyqTThZ+1rA= sha256:ScWZvX+D9Ih4La2/hS3g6YtREZLktdU1KZ0kH5BVPdg=
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 28E2510FCCA; Mon, 12 Oct 2026 22:51:07 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: 0.349
X-Spam-Status: No, score=0.349 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,
SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=no autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=pobox.com header.b=oOTseVpD; dkim=pass (2048-bit key)
header.d=messagingengine.com header.b=ZuXngjq7
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 8vL5GPe2S_3s;
Mon, 12 Oct 2026 22:51:02 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-71788-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 2A43F10FC95; Mon, 12 Oct 2026 22:50:43 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by sea.lore.kernel.org (Postfix) with ESMTP id 3C16843456; Mon, 12 Oct 2026 19:20:48 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id ACDA54D5973;
Mon, 12 Oct 2026 19:20:46 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="oOTseVpD";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ZuXngjq7"
X-Received: from fout-a1-smtp.messagingengine.com (fout-a1-smtp.messagingengine.com [103.168.172.144])
(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 113FD47A88E
for <git@vger.kernel.org>; Mon, 12 Oct 2026 19:20:43 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.144
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1791832845; cv=none; b=qMy6Y2Jr1jSYhIT1qqvr+ZGpOch3nFpqTwXHcvTbCOFggs93z93qXyTNYsxCIyeaTI4oJcdjkaRisjJrxVx2Zz/VINxxyTLRAVLwoN0KWFi9iOEA/gHf0qj66tEPDb77Piv0pOufu/o6KAGfIEE3PmJkLv9QuSIn/eXT/TCaNco=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1791832845; c=relaxed/simple;
bh=rg6PRDGFvpSbu1YRY177iQ57A4tDFZtdbLotI+zG+Cw=;
h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
MIME-Version:Content-Type; b=fb6exov8sdTxj1Ir0hVqYgYJteK/ADOqxucu4hDsZ6MrJVexlZkEyxkUNEvy+MiVwOg554TucHaaJiRjkgWalt8zbAEkNCGe9am/ZCpgDQnfAFfITmo/TLtO/GATU11FnSC4yPlBZMvjEIYHG1Oc4poqPhPkCuS/i+Kc255MW48=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=oOTseVpD; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ZuXngjq7; arc=none smtp.client-ip=103.168.172.144
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-05.internal (phl-compute-05.internal [10.202.2.45])
by mailfout.phl.internal (Postfix) with ESMTP id 536AFEC080D
for <git@vger.kernel.org>; Mon, 12 Oct 2026 15:20:43 -0400 (EDT)
X-Received: from phl-frontend-01 ([10.202.2.160])
by phl-compute-05.internal (MEProxy); Mon, 12 Oct 2026 15:20:43 -0400
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=fm1; t=1791832843; x=1791919243; bh=9IZccoZIFV
0v5hYCQSlxKrBUyOThQKuEImAP/nZWCAc=; b=oOTseVpDM3nlGSxDRVYZQDz03Q
HaCMv/F7/mKrCUuUE/Z+Rvos5fDneEmp0tHuRqU0OIvJcAbwApgQ6aPlmc50DYZw
iuOtwRBl0z9RWX62EragzYV2n3aY2VQUZct1WgGUDtYAjq+n5XwwYPaROYJ+Wd2C
Qi5/+ppXnUeHR6a9TUh5CtDan1nJg52FTZJ8okt9AtQUXDuZTRdBjqP7RE05XMdK
27yaIV75Rd8keH/32ornuAc1xJ5ucH990dQ32tliXnL0a1Lgyg/1GvP6DRNaC4i/
gphGvtBiDiLNDkF+pPuWqt4EOAO1WNZfldFJbnkTINzi0s9G8I4f/cf5inkg==
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=fm2; t=
1791832843; x=1791919243; bh=9IZccoZIFV0v5hYCQSlxKrBUyOThQKuEImA
P/nZWCAc=; b=ZuXngjq7AAHn1uGEXzOsyrGHMJ4UV7Duz5OBfR4WIXgBN6PzIct
tGpOF5iaEET6tddKBAnjiA29i1uBaoumvgG7lVLdNoqaSrM22zw9tIIt34VbmuGT
no/aXvOLb7TTEbdKlKdKyrahB3k6O3K7pSQiGNU9em//db+BzjlF03AFGaCn9DvN
fqSixcuv+r+5/ouQaLRdpLj/rvM3YvHV+4k5otm3Uo2rcYybQMvbQRPkMsfqeTM1
zMUfDEaE16TOl2wVUB3IJvJxLqNAAWyWMCXnxRgjfK/rzma0qyaZwRsR9XmfxdMd
tE8fDj6TvemALEBnebCBW9hjOud3LnxD/RQ==
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-06;
repo=github.com/dkim2wg/interop; date=2026-10-04; sw=lmtpprox;
action=sign d=pobox.com a=rsa-sha256;
X-DKIM2-Signature: i=1; m=1; t=1791832843; d=pobox.com;
mf=PGdpdHN0ZXJAcG9ib3guY29tPg==;
rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+;
s=fm1:rsa-sha256:pa02KVIZm2HAITcO019e/WEWUSriO40ad1b5hMKLajOGctY
PJQUI6Oh/6zBML8hZviu/GQN/VQPKyJTlFVLK0lBXkCDuYX0Vd5UQ42R0YLuGmDj
BJ5LCn386PxRhQNwu6gePaI7p6A73lGvGMCAGoAWZjsxT3y6fhvtPuIUSNu/qYhr
OYBY7USGlYqJ7WBfcW7o09TnXIJiAVXsSxNs69cnY7R08vH0xvbP8CVoNlsW4Rco
s1gTwFMYfBanXdeNvXayVw1T6l36cC4GM15/CwBoZd5uz9bc5Zm8mlZfpiN2QuwG
X2WCSiZIkI5QRUBtqJ2OPw8ZxdMaFahNRyJiv/w==;
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-06;
repo=github.com/dkim2wg/interop; date=2026-10-04; 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:nyRkoM50BpkdSRRbdNHhno9kLhvjk+ngJLtY76A42GA=:rg6PRDGFvpSbu1YRY177iQ57A4tDFZtdbLotI+zG+Cw=;
X-ME-Sender: <xms:CzPNapbvtlaaV4GYGJvwfdkU52EM9_FfMcPerXc1QPowJRaD6Ruumg>
<xme:CzPNakEI3jDD4W9BP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aowLcLgq750k8oj65BW9EmY-exApiKc0gOn5sD5Jb2IAbATa0g>
<xmx:CzPNajopLU31hrNqGz7G0__wCVF-Le9Itoh_Isk_urwa0Vg3K3athg>
<xmx:CzPNajG1R1ubwT7uE2ROsb9fcQEMBnz2plpTeySLrIUerRkyOqDDV3hI>
X-Feedback-ID: if26b431b:Fastmail
X-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon,
12 Oct 2026 15:20:42 -0400 (EDT)
X-Cc: git@vger.kernel.org, Jeff King <peff@peff.net>, Eric Sunshine
<sunshine@sunshineco.com>, Ignacio Encinas <ignacio@iencinas.com>
X-In-Reply-To: <20261012015846.2649843-3-bellacaselli20@gmail.com> (Isabella
Caselli's message of "Sun, 11 Oct 2026 22:58:45 -0300")
X-User-Agent: Gnus/5.13 (Gnus v5.13)
X-Precedence: bulk
X-Mailing-List: git@vger.kernel.org
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>