From nobody Wed Dec 18 15:22:24 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YCy9B3dVcz5hTlg; Wed, 18 Dec 2024 15:22:38 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YCy994FG1z4QrS; Wed, 18 Dec 2024 15:22:37 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.41 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=freebsd.org (policy=none) Received: by mail-io1-f41.google.com with SMTP id ca18e2360f4ac-844df397754so219529739f.2; Wed, 18 Dec 2024 07:22:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734535356; x=1735140156; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kioRMvKtILYE9eczSQIk7qymVN+/2UyxIA4FpZHLUkQ=; b=PZ80uKHYrFqAit0JTwX2n8XQ4u2uf4hgi3sKrTjx5JnAkLLFdPHM4K+zGovMs2m4ub RjtRzcQ7lKQ1rYyF0A4A56N33e+71DJofmRW+qqKBbkKuN/h/8BYu8i+YgFITGWKl7oB DZSo5ZAa1Ez72JRGO2+7i2SRtR8QIGYR5rT57AYpVGMk/BH927we1Ges8K8ISf9Y/Xhg gu2c9pkBMCeunX9RJufNRBsgN2wR68w4+4OCyGzZ2EvioZ+LZKybUY/9uSV9hDxY29mA mRnwANVE7A9B4WpDvvcTMbcmhippE/0ieXMZF57Osnq1D6caRxTURCOMSkFBvbvjZ85G v9gg== X-Forwarded-Encrypted: i=1; AJvYcCWdEkLbfkqSJVRTnEVl8y310AQXXwXklOA/dkDQL2s8AlZpKjePYwgz8VZ3hwHI3WxYge73VY4ABKnIKEioZcPMS36qiqE=@freebsd.org, AJvYcCWeQxu5Rza9JzNdhxepGEUOwLV5Z53YxwwywoCzyeblI26tjfUT0Ep5Y6A/AS0L9QPy95vhcSepbZkCvuH5gwkKflBt@freebsd.org X-Gm-Message-State: AOJu0YyDQ5VVdMUqbQ1hyOAsaXOJngS62I3+/YpN3KbQt59QhKUJl3rI f7f74aua+FSZMuYWXTBmwZMtcI1PMRH4I1zk8n9lfkpVymhRilUgtDNwUTJUDpdHKyNe3zLgdwr GOPrA+/8n5qrKcWz6HsP2+aZm1xdHH4CF X-Gm-Gg: ASbGnctm1PDZ1yUzaAZ/Z6lvwg128S+b9MLVLHwWr9J9gYFKlFQ0aMO23hGfCRh9uU2 nxFs8x+VVunriEgvb93BHr2njQMo1+4txxoox1w== X-Google-Smtp-Source: AGHT+IHdMJNf4JrxnM4DBmAlg+FsRDmfgQYRmLZD1SgYNeEmsVH8t3oLMDhMPhkOFsAqT/SMm4hFExxQQU87OPgARGo= X-Received: by 2002:a05:6e02:1565:b0:3a7:708b:da28 with SMTP id e9e14a558f8ab-3bdc4e21d72mr27253395ab.21.1734535355946; Wed, 18 Dec 2024 07:22:35 -0800 (PST) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 References: <202412131306.4BDD6bxu011253@gitrepo.freebsd.org> In-Reply-To: From: Ed Maste Date: Wed, 18 Dec 2024 10:22:24 -0500 Message-ID: Subject: Re: git: a1097094c4c5 - main - newvers: Set explicit git revision length To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Spamd-Result: default: False [-2.37 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; NEURAL_HAM_SHORT(-0.82)[-0.823]; NEURAL_HAM_LONG(-0.65)[-0.650]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : SPF not aligned (relaxed), No valid DKIM,none]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FREEFALL_USER(0.00)[carpeddiem]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_COUNT_ONE(0.00)[1]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.166.41:from]; RCVD_IN_DNSWL_NONE(0.00)[209.85.166.41:from]; R_DKIM_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; FROM_HAS_DN(0.00)[]; MISSING_XM_UA(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org]; RCPT_COUNT_THREE(0.00)[4] X-Rspamd-Queue-Id: 4YCy994FG1z4QrS X-Spamd-Bar: -- On Mon, 16 Dec 2024 at 18:16, John Baldwin wrote: > > Well, the default --short length is not based on when Git detects a conflict, > it's a function of the total number of objects in a repository. This means > it may be different if you just fetch some other remote with many revisions > in the same clone for example. The thing I don't know is what formula git > uses and how close we are/aren't to rolling over to 13 just with src.git > alone. It seems to me that the most fool-proof thing though if we really > want reproduciblility is to drop --short entirely. Short of that, if > you can tell git to run in a mode where it ignores user configuration (though > I don't see a way to do that). I believe the algorithm can be found in repo_find_unique_abbrev_r: unsigned long count = repo_approximate_object_count(r); /* * Add one because the MSB only tells us the highest bit set, * not including the value of all the _other_ bits (so "15" * is only one off of 2^4, but the MSB is the 3rd bit. */ len = msb(count) + 1; /* * We now know we have on the order of 2^len objects, which * expects a collision at 2^(len/2). But we also care about hex * chars, not bits, and there are 4 bits per hex. So all * together we need to divide by 2 and round up. */ len = DIV_ROUND_UP(len, 2); /* * For very small repos, we stick with our regular fallback. */ if (len < FALLBACK_DEFAULT_ABBREV) len = FALLBACK_DEFAULT_ABBREV; Regardless of the algorithm, 12 is in fact the minimum to avoid short conflicts in our tree now. Both 296adaa5766 and 13c64df775c are conflicting 11-character short hashes. Certainly putting the full hash into uname would guarantee reproducibility, although IMO it makes uname unwieldy. That said, it doesn't matter what Git's algorithm chooses as the short hash length; specifying --short bypasses that algorithm. `git rev-parse --verify --short=12 HEAD` will give us a 12-character short hash as long as that hash is unique. The reproducibility concern is thus: what is the probability that the 12-character short hash is unique at the time and in a repo from which an image is built, but is not unique for the attempt to reproduce it, or vice-versa. This probability is rather small. If you look at arbitrary commits 6 or 7 characters are usually sufficient for a unique hash today. For instance, some latest -pX from recent releng/ branches: 13.3: 72aa3d 13.4: 3f40d5 14.0: f10e32 14.1: 74b6c98 14.2: c8918d6 The status quo of --short=12 should be fine for quite some time.