Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Aug 2025 11:59:52 +0200
From:      Kristof Provost <kp@FreeBSD.org>
To:        =?utf-8?q?Dag-Erling_Sm=C3=B8rgrav?= <des@FreeBSD.org>
Cc:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: git: 81d8827ad875 - main - certctl: Reimplement in C
Message-ID:  <5331736E-B67F-4B3C-A04A-54E7A5F88B07@FreeBSD.org>
In-Reply-To: <202508132225.57DMPlLZ083341@gitrepo.freebsd.org>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On 14 Aug 2025, at 0:25, Dag-Erling Smørgrav wrote:
> The branch main has been updated by des:
>
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=81d8827ad8752e35411204541f1f09df1481e417
>
> commit 81d8827ad8752e35411204541f1f09df1481e417
> Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
> AuthorDate: 2025-08-13 22:25:27 +0000
> Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
> CommitDate: 2025-08-13 22:25:27 +0000
>
>     certctl: Reimplement in C
>
>     Notable changes include:
>
>     * We no longer forget manually untrusted certificates when 
> rehashing.
>
>     * Rehash will now scan the existing directory and progressively 
> replace
>       its contents with those of the new trust store.  The trust store 
> as a
>       whole is not replaced atomically, but each file within it is.
>
>     * We no longer attempt to link to the original files, but we don't 
> copy
>       them either.  Instead, we write each certificate out in its 
> minimal
>       form.
>
>     * We now generate a trust bundle in addition to the hashed 
> diretory.
>       This also contains only the minimal DER form of each 
> certificate.
>
>     * The C version is approximately two orders of magnitude faster 
> than the
>       sh version, with rehash taking ~100 ms vs ~5-25 s depending on 
> whether
>       ca_root_nss is installed.
>
>     * The DISTBASE concept has been dropped; the same effect can be 
> achieved
>       by adjusting DESTDIR.
>
>     * We now also have rudimentary tests.
>
>     Reviewed by:    kevans
>     Differential Revision:  https://reviews.freebsd.org/D42320

I’m seeing errors like this during bricoler test runs now:

> /usr/home/kp/bricoler/freebsd-src-regression-suite-vm-image/image.amd64.amd64-METALOG.mtree:38358: 
> error: word too long to fit buffer (max 10 characters)

Those are all lines with absolute paths (e.g. /etc/ssl/cert.pem rather 
than ./etc/ssl/cert.pem).
This hack seems to fix things for me, but I’m nowhere near familiar 
enough with the relevant build bits to say for sure if that’s right or 
not:

	diff --git a/usr.sbin/certctl/certctl.c b/usr.sbin/certctl/certctl.c
	index 365870167aeb..336a49830a3d 100644
	--- a/usr.sbin/certctl/certctl.c
	+++ b/usr.sbin/certctl/certctl.c
	@@ -490,7 +490,7 @@ write_certs(const char *dir, struct cert_tree 
*tree)
	                }
	                /* emit metalog */
	                if (mlf != NULL) {
	-                       fprintf(mlf, "%s/%s type=file "
	+                       fprintf(mlf, "./%s/%s type=file "
	                            "uname=%s gname=%s mode=%#o size=%ld\n",
	                            unexpand_path(dir), path,
	                            uname, gname, mode, ftell(f));
	@@ -561,7 +561,7 @@ write_bundle(const char *dir, const char *file, 
struct cert_tree *tree)
	        }
	        if (ret == 0 && mlf != NULL) {
	                fprintf(mlf,
	-                   "%s/%s type=file uname=%s gname=%s mode=%#o 
size=%ld\n",
	+                   "./%s/%s type=file uname=%s gname=%s mode=%#o 
size=%ld\n",
	                    unexpand_path(dir), file, uname, gname, mode, 
ftell(f));
	        }
	        fclose(f);

—
Kristof
[-- Attachment #2 --]
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body><div style="font-family: sans-serif;"><div class="markdown" style="white-space: normal;">
<p dir="auto">On 14 Aug 2025, at 0:25, Dag-Erling Smørgrav wrote:</p>
<blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #136BCE; color: #136BCE;">
<p dir="auto">The branch main has been updated by des:</p>
<p dir="auto">URL: <a href="https://cgit.FreeBSD.org/src/commit/?id=81d8827ad8752e35411204541f1f09df1481e417">https://cgit.FreeBSD.org/src/commit/?id=81d8827ad8752e35411204541f1f09df1481e417</a></p>;
<p dir="auto">commit 81d8827ad8752e35411204541f1f09df1481e417<br>
Author:     Dag-Erling Smørgrav <a href="mailto:des@FreeBSD.org">des@FreeBSD.org</a><br>
AuthorDate: 2025-08-13 22:25:27 +0000<br>
Commit:     Dag-Erling Smørgrav <a href="mailto:des@FreeBSD.org">des@FreeBSD.org</a><br>
CommitDate: 2025-08-13 22:25:27 +0000</p>
<pre style="margin-left: 15px; margin-right: 15px; padding: 5px; border: thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #E4E4E4;"><code style="padding: 0 0.25em; background-color: #E4E4E4;">certctl: Reimplement in C

Notable changes include:

* We no longer forget manually untrusted certificates when rehashing.

* Rehash will now scan the existing directory and progressively replace
  its contents with those of the new trust store.  The trust store as a
  whole is not replaced atomically, but each file within it is.

* We no longer attempt to link to the original files, but we don't copy
  them either.  Instead, we write each certificate out in its minimal
  form.

* We now generate a trust bundle in addition to the hashed diretory.
  This also contains only the minimal DER form of each certificate.

* The C version is approximately two orders of magnitude faster than the
  sh version, with rehash taking ~100 ms vs ~5-25 s depending on whether
  ca_root_nss is installed.

* The DISTBASE concept has been dropped; the same effect can be achieved
  by adjusting DESTDIR.

* We now also have rudimentary tests.

Reviewed by:    kevans
Differential Revision:  https://reviews.freebsd.org/D42320
</code></pre>
</blockquote>
<p dir="auto">I’m seeing errors like this during bricoler test runs now:</p>
<blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #136BCE; color: #136BCE;">
<p dir="auto">/usr/home/kp/bricoler/freebsd-src-regression-suite-vm-image/image.amd64.amd64-METALOG.mtree:38358: error: word too long to fit buffer (max 10 characters)</p>
</blockquote>
<p dir="auto">Those are all lines with absolute paths (e.g. /etc/ssl/cert.pem rather than ./etc/ssl/cert.pem).<br>
This hack seems to fix things for me, but I’m nowhere near familiar enough with the relevant build bits to say for sure if that’s right or not:</p>
<pre style="margin-left: 15px; margin-right: 15px; padding: 5px; border: thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #E4E4E4;"><code style="padding: 0 0.25em; background-color: #E4E4E4;">diff --git a/usr.sbin/certctl/certctl.c b/usr.sbin/certctl/certctl.c
index 365870167aeb..336a49830a3d 100644
--- a/usr.sbin/certctl/certctl.c
+++ b/usr.sbin/certctl/certctl.c
@@ -490,7 +490,7 @@ write_certs(const char *dir, struct cert_tree *tree)
                }
                /* emit metalog */
                if (mlf != NULL) {
-                       fprintf(mlf, &quot;%s/%s type=file &quot;
+                       fprintf(mlf, &quot;./%s/%s type=file &quot;
                            &quot;uname=%s gname=%s mode=%#o size=%ld\n&quot;,
                            unexpand_path(dir), path,
                            uname, gname, mode, ftell(f));
@@ -561,7 +561,7 @@ write_bundle(const char *dir, const char *file, struct cert_tree *tree)
        }
        if (ret == 0 &amp;&amp; mlf != NULL) {
                fprintf(mlf,
-                   &quot;%s/%s type=file uname=%s gname=%s mode=%#o size=%ld\n&quot;,
+                   &quot;./%s/%s type=file uname=%s gname=%s mode=%#o size=%ld\n&quot;,
                    unexpand_path(dir), file, uname, gname, mode, ftell(f));
        }
        fclose(f);
</code></pre>
<p dir="auto">—<br>
Kristof</p>

</div>
</div>
</body>

</html>
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5331736E-B67F-4B3C-A04A-54E7A5F88B07>