Re: git: 24d5194306b5 - main - build: Emit a warning for build targets run as root

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Fri, 09 Oct 2026 15:21:48 UTC
On 9 Oct 2026, at 16:04, Ed Maste <emaste@FreeBSD.org> wrote:
> 
> The branch main has been updated by emaste:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=24d5194306b573bf3396858b4c0aa5d420c37c91
> 
> commit 24d5194306b573bf3396858b4c0aa5d420c37c91
> Author:     Ed Maste <emaste@FreeBSD.org>
> AuthorDate: 2025-05-14 15:23:42 +0000
> Commit:     Ed Maste <emaste@FreeBSD.org>
> CommitDate: 2026-10-09 15:02:30 +0000
> 
>    build: Emit a warning for build targets run as root
> 
>    Build targets should generally be run as an unprivileged user.  Even
>    though building as root is discouraged many users do so, so just start
>    with a warning.

Whilst this is surely where we eventually want to end up, as it is best
practice to only use root when necessary, I’m not sure this is
something we should be warning about just yet, especially given the
official updating-from-source instructions in the handbook [1] and
equivalent in-tree UPDATING instructions have you do everything as root
(well, they don’t say that explicitly, but there’s no mention of
switching users, the handbook uses make kernel which has to run
buildkernel as root like installkernel, and the buildworld is amongst
everything else (ditto buildkernel for UPDATING)).

I also suspect this interacts poorly with running etcupdate as root,
which has no separation of build and install responsibilities, at least
if you don’t use the (now default) -B, but possibly also even with that.

So I think we have a lot of things to get in order before we start
emitting this warning.

Jessica

[1] https://docs.freebsd.org/en/books/handbook/cutting-edge/#makeworld