[PATCH for-8.1] scripts/git-submodule.sh: Don't rely on non-POSIX 'read' behaviour

Peter Maydell posted 1 patch 9 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230720153038.1587196-1-peter.maydell@linaro.org
Maintainers: "Daniel P. Berrangé" <berrange@redhat.com>
scripts/git-submodule.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH for-8.1] scripts/git-submodule.sh: Don't rely on non-POSIX 'read' behaviour
Posted by Peter Maydell 9 months, 2 weeks ago
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")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 scripts/git-submodule.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/git-submodule.sh b/scripts/git-submodule.sh
index 335f7f5fdf8..bb1222c7727 100755
--- a/scripts/git-submodule.sh
+++ b/scripts/git-submodule.sh
@@ -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 ;;
-- 
2.34.1
Re: [PATCH for-8.1] scripts/git-submodule.sh: Don't rely on non-POSIX 'read' behaviour
Posted by Philippe Mathieu-Daudé 9 months, 2 weeks ago
On 20/7/23 17:30, Peter Maydell wrote:
> 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")
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   scripts/git-submodule.sh | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



Re: [PATCH for-8.1] scripts/git-submodule.sh: Don't rely on non-POSIX 'read' behaviour
Posted by Daniel P. Berrangé 9 months, 2 weeks ago
On Thu, Jul 20, 2023 at 04:30:38PM +0100, Peter Maydell wrote:
> 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")
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  scripts/git-submodule.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: 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 :|