git: 69cc351c4c91 - main - safe_set ignore leading white-space

From: Simon J. Gerraty <sjg_at_FreeBSD.org>
Date: Wed, 22 Apr 2026 16:15:21 UTC
The branch main has been updated by sjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=69cc351c4c911cfeda1851f3c18a4b61281708cb

commit 69cc351c4c911cfeda1851f3c18a4b61281708cb
Author:     Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2026-04-22 16:15:13 +0000
Commit:     Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2026-04-22 16:15:13 +0000

    safe_set ignore leading white-space
    
    Also treate ':' at the start of a line as for '#'
    ie. a comment.
---
 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 e12b17c787d2..f96c34dda936 100644
--- a/libexec/rc/safe_eval.sh
+++ b/libexec/rc/safe_eval.sh
@@ -1,6 +1,6 @@
 :
 # RCSid:
-#	$Id: safe_eval.sh,v 1.26 2026/04/10 16:03:39 sjg Exp $
+#	$Id: safe_eval.sh,v 1.27 2026/04/22 16:11:57 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/[ 	]*#.*//;/^[A-Za-z_][A-Za-z0-9_]*=/!d;s;[^A-Za-z0-9_. 	"'"$1"'$,/=:+-];_;g'
+    ${SED:-sed} 's/^[ 	]*//;s/^[:#].*//;/^[A-Za-z_][A-Za-z0-9_]*=/!d;s;[^A-Za-z0-9_. 	"'"$1"'$,/=:+-];_;g'
 }
 
 ##