Skip to contentSkip to conversation

scripts/git-submodule.sh: Don't rely on non-POSIX 'read' behaviour

PATCH In review Peter Maydell 3 participants 3 messages Jul 20, 2023 – Jul 21, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/git-submodule.sh: Don't rely on non-POSIX 'read' behaviour

The POSIX definition of the 'read' utility requires that you specify the variable name to set; omitting the name and having it default to 'REPLY' is a bashism. If your system sh is dash, then it will print an error message during build:

qemu/pc-bios/s390-ccw/../../scripts/git-submodule.sh: 106: read: arg count

Specify the variable name explicitly.

Fixes fdb8fd8cb915647b ("git-submodule: allow partial update of .git-submodule-status")
---
 scripts/git-submodule.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/git-submodule.sh +1 -1
index 335f7f5fdf8..bb1222c7727 100755
@@ -103,7 +103,7 @@ update)
         check_updated $module || echo Updated "$module"
     done
 
-    (while read -r; do
+    (while read -r REPLY; do
         for module in $modules; do
             case $REPLY in
                 *" $module "*) continue 2 ;;
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Peter Maydell

The POSIX definition of the 'read' utility requires that you specify the variable name to set; omitting the name and having it default to 'REPLY' is a bashism. If your system sh is dash, then it will print an error message during build:

qemu/pc-bios/s390-ccw/../../scripts/git-submodule.sh: 106: read: arg count

Quoted 7 lines

Specify the variable name explicitly.

Fixes fdb8fd8cb915647b ("git-submodule: allow partial update of .git-submodule-status")
---
 scripts/git-submodule.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Reviewed-by on v1 1/1
#2 lore raw
In reply to Peter Maydell
Quoted 7 lines · Peter Maydell

The POSIX definition of the 'read' utility requires that you specify the variable name to set; omitting the name and having it default to 'REPLY' is a bashism. If your system sh is dash, then it will print an error message during build:

qemu/pc-bios/s390-ccw/../../scripts/git-submodule.sh: 106: read: arg count

Quoted 7 lines

Specify the variable name explicitly.

Fixes fdb8fd8cb915647b ("git-submodule: allow partial update of .git-submodule-status")
---
  scripts/git-submodule.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)