]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fix(SC2162): add `-r` to `read`
authorEisuke Kawashima <e-kwsm@users.noreply.github.com>
Mon, 14 Jul 2025 07:08:09 +0000 (16:08 +0900)
committerEisuke Kawashima <e-kwsm@users.noreply.github.com>
Mon, 14 Jul 2025 11:24:26 +0000 (20:24 +0900)
20 files changed:
shell-completion/bash/busctl
shell-completion/bash/homectl
shell-completion/bash/hostnamectl
shell-completion/bash/importctl
shell-completion/bash/journalctl
shell-completion/bash/kernel-install
shell-completion/bash/loginctl
shell-completion/bash/machinectl
shell-completion/bash/portablectl
shell-completion/bash/run0
shell-completion/bash/systemctl.in
shell-completion/bash/systemd-analyze
shell-completion/bash/systemd-cgls
shell-completion/bash/systemd-cgtop
shell-completion/bash/systemd-nspawn
shell-completion/bash/timedatectl
shell-completion/zsh/_bootctl
shell-completion/zsh/_busctl
shell-completion/zsh/_kernel-install
shell-completion/zsh/_sd_machines

index 4527b5bdbe8b0274fd75447216b6f4ffccf52373..e09603972559638abc9b77626a3b2b74568340c4 100644 (file)
@@ -27,7 +27,7 @@ __contains_word () {
 __get_machines() {
     local a b
     { machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
-        { while read a b; do echo " $a"; done; } |
+        { while read -r a b; do echo " $a"; done; } |
         sort -u
 }
 
@@ -35,7 +35,7 @@ __get_busnames() {
     local mode=$1
     local a b
     busctl $mode list --no-legend --no-pager --full 2>/dev/null |
-        { while read a b; do echo " $a"; done; }
+        { while read -r a b; do echo " $a"; done; }
 }
 
 __get_objects() {
@@ -43,7 +43,7 @@ __get_objects() {
     local busname=$2
     local a b
     busctl $mode tree --list --no-legend --no-pager $busname 2>/dev/null |
-        { while read a b; do echo " $a"; done; }
+        { while read -r a b; do echo " $a"; done; }
 }
 
 __get_interfaces() {
@@ -52,7 +52,7 @@ __get_interfaces() {
     local path=$3
     local a b c
     busctl $mode introspect --list --no-legend --no-pager $busname $path 2>/dev/null |
-        { while read a b c; do [[ "$b" == "interface" ]] && echo " $a"; done; }
+        { while read -r a b c; do [[ "$b" == "interface" ]] && echo " $a"; done; }
 }
 
 __get_members() {
@@ -65,7 +65,7 @@ __get_members() {
     local a b c d e
     busctl $mode introspect --list --no-legend --no-pager $busname $path $interface 2>/dev/null |
         sed -e 's/^\.//' |
-        { while read a b c d e; do [[ "$b" == "$type" && ( -z $flags || "$e" == "$flags" ) ]] && echo " $a"; done; }
+        { while read -r a b c d e; do [[ "$b" == "$type" && ( -z $flags || "$e" == "$flags" ) ]] && echo " $a"; done; }
 }
 
 __get_signature() {
@@ -76,7 +76,7 @@ __get_signature() {
     local member=$5
     local a b c d
     busctl $mode introspect --list --no-legend --no-pager $busname $path $interface 2>/dev/null |
-        sed -e 's/^\.//' | { while read a b c d; do [[ "$a" == "$member" && "$c" != '-' ]] && echo " \"$c\""; done; }
+        sed -e 's/^\.//' | { while read -r a b c d; do [[ "$a" == "$member" && "$c" != '-' ]] && echo " \"$c\""; done; }
 }
 
 _busctl() {
index 6d7e23ef7184b6919e7ed3783b4850657f657728..8976245fda0378ea120f4bb11357fcb4bef5d150 100644 (file)
@@ -27,7 +27,7 @@ __contains_word () {
 __get_machines() {
     local a b
     machinectl list --full --no-legend --no-pager 2>/dev/null |
-        { while read a b; do echo " $a"; done; }
+        { while read -r a b; do echo " $a"; done; }
 }
 
 __get_homes() {
index 8d1922eb2e0806c9d69335e142988c5b57dfbb56..0baffeed9c14addbafd8f8556d01966738e39f20 100644 (file)
@@ -29,7 +29,7 @@ __contains_word () {
 __get_machines() {
     local a b
     machinectl list --full --no-legend --no-pager 2>/dev/null |
-        { while read a b; do echo " $a"; done; }
+        { while read -r a b; do echo " $a"; done; }
 }
 
 _hostnamectl() {
index 0eed6defd8dc0c26de2fd01d09a0e8b85a420eec..779e66cbf2a317357a2e92e84479795622582a4d 100644 (file)
@@ -26,8 +26,12 @@ __contains_word() {
 
 __get_machines() {
     local a b
-    { machinectl list-images --full --no-legend --no-pager 2>/dev/null; machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
-        { while read a b; do echo " $a"; done; } |
+    {
+        machinectl list-images --full --no-legend --no-pager 2>/dev/null
+        machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null
+        echo ".host"
+    } |
+        { while read -r a b; do echo " $a"; done; } |
         sort -u
 }
 
index 2c4ffffe07e947f6dc012f4e6b7fbd4653d22e9d..31e8e0d935b27a0acf994f40f0615513f96e5f02 100644 (file)
@@ -29,7 +29,7 @@ __contains_word () {
 __get_machines() {
     local a b
     { machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
-        { while read a b; do echo " $a"; done; } |
+        { while read -r a b; do echo " $a"; done; } |
         sort -u
 }
 
index a7714ad1880318990525e4fa14ecb5ca1f11229e..9d20b2fd055db163d25a9baf21b84bc8a33f391e 100644 (file)
@@ -38,7 +38,7 @@ _kernel_install() {
         2)
             comps=$(cd /lib/modules; echo [0-9]*)
             if [[ ${COMP_WORDS[1]} == "remove" ]] && [[ -f /etc/machine-id ]]; then
-                read MACHINE_ID < /etc/machine-id
+                read -r MACHINE_ID < /etc/machine-id
                 if [[ $MACHINE_ID ]] && ( [[ -d /boot/$MACHINE_ID ]] || [[ -L /boot/$MACHINE_ID ]] ); then
                     comps=$(cd "/boot/$MACHINE_ID"; echo [0-9]*)
                 fi
index 9085d2dd5f5c2a75a9c68c1a05f83f86a3d40bca..f0e1196e6156407b9e1b903211057dd813b99f53 100644 (file)
@@ -33,7 +33,7 @@ __get_all_seats    () { loginctl --no-legend list-seats    | { while read -r a b
 __get_machines() {
     local a b
     { machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
-        { while read a b; do echo " $a"; done; } |
+        { while read -r a b; do echo " $a"; done; } |
         sort -u
 }
 
index 7e83736114153fd845baa50ed9d35234953c2dd9..eda11f5590478b19bc572bf4fa7e43cbcadc73fc 100644 (file)
@@ -27,7 +27,7 @@ __contains_word() {
 __get_machines() {
     local a b
     { machinectl list-images --full --no-legend --no-pager 2>/dev/null; machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
-        { while read a b; do echo " $a"; done; } |
+        { while read -r a b; do echo " $a"; done; } |
         sort -u
 }
 
index 87c4a5ee4f7c469d11958d747c950bbb88c88cf2..824510bbcae4538ebd09df4f98105f115205d53f 100644 (file)
@@ -27,7 +27,7 @@ __contains_word () {
 __get_machines() {
     local a b
     { machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
-        { while read a b; do echo " $a"; done; } |
+        { while read -r a b; do echo " $a"; done; } |
         sort -u
 }
 
index 80300cd9ab1e7fc5badd3fb3cdf88ac5b0afdbe8..fe2efedd309b116511e0c461480689b242fe0ea8 100644 (file)
@@ -27,7 +27,7 @@ __get_slice_units () { __systemctl list-units --all -t slice |
 __get_machines() {
     local a b
     { machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
-        { while read a b; do echo " $a"; done; } |
+        { while read -r a b; do echo " $a"; done; } |
         sort -u
 }
 
index 7bc5ddb87721214702448c1f11fc1d8de4f8698c..1004ac60431d42decc5f5350edbc25922a3e2d41 100644 (file)
@@ -120,7 +120,7 @@ __get_all_unit_files() { __systemctl $1 list-unit-files "$2*" | while read -r a
 __get_machines() {
     local a
 
-    while read a _; do
+    while read -r a _; do
         echo " $a"
     done < <(machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null | sort -u; echo ".host")
 }
index d98618488480bc3485eda5da3f6ecbd09b76afd4..24478dd3bf8a5d6a182755a665e634940d1ebd96 100644 (file)
@@ -29,7 +29,7 @@ __contains_word () {
 __get_machines() {
     local a b
     { machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
-        { while read a b; do echo " $a"; done; } |
+        { while read -r a b; do echo " $a"; done; } |
         sort -u
 }
 
index 9c0393d045e7e1e0e20617d821c917ca629fe0ad..2ec843f04647b0c32b197602fcd61e31a020315c 100644 (file)
@@ -27,7 +27,7 @@ __contains_word() {
 __get_machines() {
     local a b
     { machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
-        { while read a b; do echo " $a"; done; } |
+        { while read -r a b; do echo " $a"; done; } |
         sort -u
 }
 
index 41381bd24c38613b217d10c7f3e741b11e9d84ad..a444b6506438e551004cf4c22ff0334592f44f1e 100644 (file)
@@ -27,7 +27,7 @@ __contains_word() {
 __get_machines() {
     local a b
     { machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
-        { while read a b; do echo " $a"; done; } |
+        { while read -r a b; do echo " $a"; done; } |
         sort -u
 }
 
index 2a826204014e518da68e1e6ec2d847b1ab080e2a..597c1b681d251ae5e31f5b334fa81fb49680bfd3 100644 (file)
@@ -26,24 +26,24 @@ __contains_word() {
 
 __get_users() {
     local a b
-    loginctl list-users --no-legend --no-pager | { while read a b; do echo " $b"; done; }
+    loginctl list-users --no-legend --no-pager | { while read -r a b; do echo " $b"; done; }
 }
 
 __get_slices() {
     local a b
-    systemctl list-units -t slice --no-legend --no-pager --plain | { while read a b; do echo " $a"; done; }
+    systemctl list-units -t slice --no-legend --no-pager --plain | { while read -r a b; do echo " $a"; done; }
 }
 
 __get_machines() {
     local a b
     { machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
-        { while read a b; do echo " $a"; done; } |
+        { while read -r a b; do echo " $a"; done; } |
         sort -u
 }
 
 __get_env() {
     local a
-    env | { while read a; do echo " ${a%%=*}"; done; }
+    env | { while read -r a; do echo " ${a%%=*}"; done; }
 }
 
 __get_interfaces(){
index 14628822f6111c565b2c572d5126a4ee5cf39c65..2690907f9ee47c1e263075015ad5567df6960873 100644 (file)
@@ -29,7 +29,7 @@ __contains_word () {
 __get_machines() {
     local a b
     { machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
-        { while read a b; do echo " $a"; done; } |
+        { while read -r a b; do echo " $a"; done; } |
         sort -u
 }
 
index 79f9f45fa017af90484abec34cc15bf1a66d8233..3f7f4b5c86c050f86ec0c80b034b543356e47ce7 100644 (file)
@@ -8,7 +8,7 @@ __bootctl() {
 _bootctl_comp_ids() {
     local expl
     local -a ids
-    __bootctl list | while read a b; do
+    __bootctl list | while read -r a b; do
         if [[ "$a" == "id:" ]]; then
             ids+="$b"
         fi
index 296afd1e24d43797d0ab08949f5d25580b5137d0..6fea1bf1b1967b3f9fd11f2be7187a6c9db7d1c9 100644 (file)
@@ -87,7 +87,7 @@ __dbus_matchspec() {
     local -a bus_names
     local NAME OTHER
     __busctl --unique list |
-    while read NAME OTHER; do
+    while read -r NAME OTHER; do
         echo $NAME
     done
 }
@@ -104,7 +104,7 @@ __dbus_matchspec() {
 {
     local NAME TYPE OTHER
     __busctl introspect "$1" "$2" |
-    while read NAME TYPE OTHER; do
+    while read -r NAME TYPE OTHER; do
         if [[ ${TYPE} == "interface" ]]; then
             echo ${NAME}
         fi
@@ -117,7 +117,7 @@ __dbus_matchspec() {
     local required="$5"
     local NAME TYPE SIGNATURE VALUE FLAGS
     __busctl introspect "$1" "$2" "$3" |
-    while read NAME TYPE SIGNATURE VALUE FLAGS; do
+    while read -r NAME TYPE SIGNATURE VALUE FLAGS; do
         [[ -z "$member" || ${TYPE} == "$member" ]] &&
         [[ -z "$required" || "${${(os: :)FLAGS}}" == $~required ]] &&
         echo ${NAME#.}
@@ -128,7 +128,7 @@ __dbus_matchspec() {
 {
     local NAME TYPE SIGNATURE VALUE FLAGS
     __busctl introspect "$1" "$2" "$3" |
-    while read NAME TYPE SIGNATURE VALUE FLAGS; do
+    while read -r NAME TYPE SIGNATURE VALUE FLAGS; do
         if [[ ${NAME#.} == "$4" ]]; then
             [[ ${SIGNATURE} != "-" ]] && echo ${SIGNATURE}
         fi
index 0e786e36f095d05dcd511cefe60e420dd6b09dae..b581281c26ef2d7c37498feff0b94906076245cd 100644 (file)
@@ -12,7 +12,7 @@ _kernel-install_images(){
 
 (( $+functions[_kernel-install_kernels] )) ||
 _kernel-install_kernels(){
-    read _MACHINE_ID < /etc/machine-id
+    read -r _MACHINE_ID < /etc/machine-id
     _kernel=( /lib/modules/[0-9]* )
     if [[ "$cmd" == "remove" && -n "$_MACHINE_ID" ]]; then
         _kernel=( "/boot/$_MACHINE_ID"/[0-9]* )
index a1c7de1b2c7f5db3b7719dcdb0b85f504d619dfc..7e859f5fd327b6a3fb2cfbf7cdda83baf2817522 100644 (file)
@@ -4,7 +4,7 @@
 (( $+functions[__sd_machines_get_machines] )) ||
     __sd_machines_get_machines () {
         { machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } |
-            { while read a b; do echo "$a"; done; } |
+            { while read -r a b; do echo "$a"; done; } |
             sort -u
     }