Re: git: 566cc005812b - main - safe_set treat ':' and '#' differently
- In reply to: Simon J. Gerraty : "git: 566cc005812b - main - safe_set treat ':' and '#' differently"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 27 Apr 2026 00:07:32 UTC
Hi!
Do you have unit tests for these?
Have a nice day,
op
On Wednesday, April 22, 2026, Simon J. Gerraty <sjg@freebsd.org> wrote:
> The branch main has been updated by sjg:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=
> 566cc005812b72a4ba236764651dd8e82c94a166
>
> commit 566cc005812b72a4ba236764651dd8e82c94a166
> Author: Simon J. Gerraty <sjg@FreeBSD.org>
> AuthorDate: 2026-04-22 16:37:35 +0000
> Commit: Simon J. Gerraty <sjg@FreeBSD.org>
> CommitDate: 2026-04-22 16:37:35 +0000
>
> safe_set treat ':' and '#' differently
>
> Treat '#' as a comment anywhere,
> but ':' only at start of line.
> ---
> libexec/rc/safe_eval.sh | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libexec/rc/safe_eval.sh b/libexec/rc/safe_eval.sh
> index f96c34dda936..3b3241ae821d 100644
> --- a/libexec/rc/safe_eval.sh
> +++ b/libexec/rc/safe_eval.sh
> @@ -1,6 +1,6 @@
> :
> # RCSid:
> -# $Id: safe_eval.sh,v 1.27 2026/04/22 16:11:57 sjg Exp $
> +# $Id: safe_eval.sh,v 1.28 2026/04/22 16:36:32 sjg Exp $
> #
> # @(#) Copyright (c) 2023-2026 Simon J. Gerraty
> #
> @@ -32,7 +32,7 @@ fi
> # "xtras" should be used with caution and cannot include ';'
> #
> safe_set() {
> - ${SED:-sed} 's/^[ ]*//;s/^[:#].*//;/^[A-Za-z_][
> A-Za-z0-9_]*=/!d;s;[^A-Za-z0-9_. "'"$1"'$,/=:+-];_;g'
> + ${SED:-sed} 's/^[ ]*//;s/[ ]*#.*//;s/^:.*//;/^[A-Za-z_][
> A-Za-z0-9_]*=/!d;s;[^A-Za-z0-9_. "'"$1"'$,/=:+-];_;g'
> }
>
> ##
>
>