From nobody Thu Dec 19 17:37:13 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 4YDd661Cf5z5hVrS; Thu, 19 Dec 2024 17:37:18 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YDd656J9Lz46rp; Thu, 19 Dec 2024 17:37:17 +0000 (UTC) (envelope-from rpokala@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734629837; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kbxqxTXKz9f2kgnQ/r0fq6glLa0gDQl6bagCOa3E4hc=; b=gOlTK0XQ2hyHJwZ+PTqhw9bKDZA8vaOS2YrTCfBay6cfhw3FSyeYlS1FaWWzKa3+uj6TEk GC2HXO44jv+/81iplQqJyfTvcQxDgFY5BABOUEfBTRur9GlZeayiXur2DpBi5ONfTiXAbR zS9dcyTQuF90QNmV5DFE579eu0L/QCyb2icJXBmlYKQJOTMuHRu4xpoBXGQJeca3Jf3Knj 4nBEevTbEWW/b0iS+0k+TMIN790+zPz+TnnN8FV36H9sYeuLQUZ5aBt54Ty7ly9o0gyfkJ NmSMgaey+WWfx4RTfzNShMra8FsN+0wiUe8G+qh68Xn94LQ9nfnUmbvkyZeFCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734629837; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kbxqxTXKz9f2kgnQ/r0fq6glLa0gDQl6bagCOa3E4hc=; b=vteBHKJd747kQm9vQT2o3Mh2RMcw2y5aFzY2wU1k5E8lUDAyoWYyG3a1XkTYJbDD1FlUH6 ftfN05oFPknaHnrY3DBUkbt7OALaL+18qJ5wn1YxV4xfPlTu9nQ3QxoTaUN2qNuhSrFue9 GZRXpKPGGwF6pzvrmwQrob3Ydn3u8Q6YCxvFb9Ck7vojOC3yZpalwRXmjKzeqSl/4wUtcE JagDv9wFigR4Y4fGLtDP33/V0AXdmOIsZjeaNEh0hEaWzKtK1QSzyapZX7aEP3kXqJp2GT iJT2FY1w2PkkVSto6OnpSmAZ+d8P/KJDRgYjJC4CA3IlgjBMkTf9fuOvpOtp9w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734629837; a=rsa-sha256; cv=none; b=hxwlhrr20B2ViJ6oD7VzSP19+90/7muy07xqQjmwVhNI0XopVbaSV0eT3u7JyJfcSpHdbL z/OSDIhiUkznrAT9q8fvFsOljGOF0XjgIYWQhkWxou+zg0Ax2WVa5NHrZHWXRnjHq3LCOF GAZ+A0P94a/8UzeHfyvFN9Ia9pLxRRoCaQYLzLNnP3CrjIEhk1eHxZ/zqICFwTv/fHcYrI XKhVfYg79Kx5AMRRLTl5oPW3BaXdfNDYrmJClwUk5X76+6icNfBM1IPqviP6iyHPljZzTF ftbspEYq6zeI1QUpOsr0iEJ12yFXJtGnA2tUHKzVq549pgo9ZKm2tFyDNmAgUQ== Received: from [192.168.1.54] (c-73-231-46-254.hsd1.ca.comcast.net [73.231.46.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 4YDd645tlNzYcn; Thu, 19 Dec 2024 17:37:16 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.92.24120731 Date: Thu, 19 Dec 2024 09:37:13 -0800 Subject: Re: a1097094c4c5 - main - newvers: Set explicit git revision length From: Ravi Pokala To: John Baldwin , Gleb Smirnoff , Ed Maste CC: , , Message-ID: <58382B1B-DE05-4C46-997E-175F74B5A018@panasas.com> Thread-Topic: a1097094c4c5 - main - newvers: Set explicit git revision length References: <202412131306.4BDD6bxu011253@gitrepo.freebsd.org> <9afbf270-0cc0-4fd0-8975-6b88aadd3903@FreeBSD.org> In-Reply-To: <9afbf270-0cc0-4fd0-8975-6b88aadd3903@FreeBSD.org> 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 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable It occurred to me to see what Linux distros do. I spot-checked several dist= ros that we have in our lab (several versions of Debian, RHEL, Rocky, SLES, = OpenSuSE, Ubuntu), and it looks like only SLES and OpenSuSE embed a Git hash= in their 'uname -a' output. For both those distros, it uses just seven char= acters. -Ravi (rpokala@) =EF=BB=BF-----Original Message----- From: > on behalf of John Baldwin > Date: Thursday, December 19, 2024 at 07:03 To: Gleb Smirnoff >, Ed Ma= ste > Cc: >, >, > Subject: Re: git: a1097094c4c5 - main - newvers: Set explicit git revision = length On 12/18/24 12:12, Gleb Smirnoff wrote: > On Wed, Dec 18, 2024 at 10:22:24AM -0500, Ed Maste wrote: > E> That said, it doesn't matter what Git's algorithm chooses as the short > E> hash length; specifying --short bypasses that algorithm. `git > E> rev-parse --verify --short=3D12 HEAD` will give us a 12-character short > E> hash as long as that hash is unique. The reproducibility concern is > E> thus: what is the probability that the 12-character short hash is > E> unique at the time and in a repo from which an image is built, but is > E> not unique for the attempt to reproduce it, or vice-versa. This > E> probability is rather small. > E> > E> If you look at arbitrary commits 6 or 7 characters are usually > E> sufficient for a unique hash today. For instance, some latest -pX from > E> recent releng/ branches: > E> > E> 13.3: 72aa3d > E> 13.4: 3f40d5 > E> 14.0: f10e32 > E> 14.1: 74b6c98 > E> 14.2: c8918d6 > E> > E> The status quo of --short=3D12 should be fine for quite some time. >=20 > AFAIU John's concern is that you can't guarantee a reproducible build fro= m a > "dirty" repository. A repository that has more branches than just the off= icial > ones. I just make a quick check on Netflix repo, that has both the curren= t > FreeBSD history and the before-the-official-git history together, as well= as > splitted ports subdirectories and of course our own stuff. For short hash= es > there are roughly 2x more ambiguities than for a "clean" repo. Apparently > chance of collision on a long hash is also doubled. >=20 > We can of course say that we don't provide reproducible builds from a "di= rty" > repo. But would be a real limitation. That would cancel a legitimate > scenario: >=20 > git subtree add FreeBSD && cd FreeBSD && make a reproducible build In particular, the dirty repository scenario I imagine is FreeBSD's officia= l repository at some point in the future. A question though is how far in the future would it have to be to matter. If we would need 100+ years at our current commit rate to matter, then this is probably moot. The other point I guess is that how many other user git settings can affect the build? Shou= ld we not require an empty global git config as a prereq for someone who wants= a reproducible build (and use the same setup for our official builds) and say that if you adjust your user config to impact the build that's kind of your problem? --=20 John Baldwin