]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fix(shell-completion): strictly parse env output
authorEisuke Kawashima <e-kwsm@users.noreply.github.com>
Mon, 14 Jul 2025 07:48:25 +0000 (16:48 +0900)
committerEisuke Kawashima <e-kwsm@users.noreply.github.com>
Mon, 14 Jul 2025 11:24:26 +0000 (20:24 +0900)
shell functions may be exported, when env prints their body in multiple
lines

shell-completion/bash/systemd-nspawn

index 597c1b681d251ae5e31f5b334fa81fb49680bfd3..49164fb90c3c8dbc0c138ea9d98ab1a9c9ca0d9a 100644 (file)
@@ -43,7 +43,7 @@ __get_machines() {
 
 __get_env() {
     local a
-    env | { while read -r a; do echo " ${a%%=*}"; done; }
+    env | { while read -r a; do [[ $a =~ ^[A-Za-z0-9_]+= ]] && echo " ${a%%=*}"; done; }
 }
 
 __get_interfaces(){