Re: git: f3bd86ba1851 - main - freebsd-version(1): Disable pathname expansion in -j option

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Wed, 22 Apr 2026 21:23:46 UTC
On 22 Apr 2026, at 20:57, Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org> wrote:
> 
> The branch main has been updated by pouria:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=f3bd86ba18512aca7099af2d2d49da5e46708d17
> 
> commit f3bd86ba18512aca7099af2d2d49da5e46708d17
> Author:     Nami Arjmandi <namiarjmandi@gmail.com>
> AuthorDate: 2026-04-22 16:23:22 +0000
> Commit:     Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
> CommitDate: 2026-04-22 19:55:19 +0000
> 
>    freebsd-version(1): Disable pathname expansion in -j option
> 
>    Set the -f flag to sh(1) to disable pathname expansion.
>    Also, quote the jail variable to ensure correct behavior when passed
>    to jexec(8).
> 
>    Signed-off-by:  Nami Arjmandi <namiarjmandi@gmail.com>
>    Reviewed by:    pouria
>    Pull-Request:   https://github.com/freebsd/freebsd-src/pull/2158
> ---
> bin/freebsd-version/freebsd-version.sh.in | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/bin/freebsd-version/freebsd-version.sh.in b/bin/freebsd-version/freebsd-version.sh.in
> index 157294dfa582..42b555ccafd9 100644
> --- a/bin/freebsd-version/freebsd-version.sh.in
> +++ b/bin/freebsd-version/freebsd-version.sh.in
> @@ -26,7 +26,7 @@
> #
> #
> 
> -set -e
> +set -ef

This is a big hammer that could lead to quite surprising results. Is
there a reason we don’t just quote things appropriately? Or at least
limit the scope of set -f to be only around specific places.

Jessica

> USERLAND_VERSION="@@REVISION@@-@@BRANCH@@"
> 
> @@ -88,7 +88,7 @@ userland_version() {
> #
> jail_version() {
> for i in $jail; do
> - jexec -- $i freebsd-version
> + jexec -- "$i" freebsd-version
> done
> }
> 
>