qemu-binfmt-conf.sh: enforce style consistency

umarcor posted 1 patch 2 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/next-importer-push tags/patchew/20210620201509.GA9@c22643ce596e
Maintainers: Laurent Vivier <laurent@vivier.eu>
scripts/qemu-binfmt-conf.sh | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
qemu-binfmt-conf.sh: enforce style consistency
Posted by umarcor 2 years, 10 months ago
Spaces are removed before '; then', for consistency with other scripts
in the project.

Signed-off-by: umarcor <unai.martinezcorral@ehu.eus>
---
 scripts/qemu-binfmt-conf.sh | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index 7de996d536..13bff41b47 100755
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -221,7 +221,7 @@ EOF
 }

 qemu_check_access() {
-    if [ ! -w "$1" ] ; then
+    if [ ! -w "$1" ]; then
         echo "ERROR: cannot write to $1" 1>&2
         exit 1
     fi
@@ -230,12 +230,12 @@ qemu_check_access() {
 qemu_check_bintfmt_misc() {
     # load the binfmt_misc module
     if [ ! -d /proc/sys/fs/binfmt_misc ]; then
-      if ! /sbin/modprobe binfmt_misc ; then
+      if ! /sbin/modprobe binfmt_misc; then
           exit 1
       fi
     fi
     if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
-      if ! mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc ; then
+      if ! mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc; then
           exit 1
       fi
     fi
@@ -248,16 +248,16 @@ installed_dpkg() {
 }

 qemu_check_debian() {
-    if [ ! -e /etc/debian_version ] ; then
+    if [ ! -e /etc/debian_version ]; then
         echo "WARNING: your system is not a Debian based distro" 1>&2
-    elif ! installed_dpkg binfmt-support ; then
+    elif ! installed_dpkg binfmt-support; then
         echo "WARNING: package binfmt-support is needed" 1>&2
     fi
     qemu_check_access "$EXPORTDIR"
 }

 qemu_check_systemd() {
-    if ! systemctl -q is-enabled systemd-binfmt.service ; then
+    if ! systemctl -q is-enabled systemd-binfmt.service; then
         echo "WARNING: systemd-binfmt.service is missing or disabled" 1>&2
     fi
     qemu_check_access "$EXPORTDIR"
@@ -265,13 +265,13 @@ qemu_check_systemd() {

 qemu_generate_register() {
     flags=""
-    if [ "$CREDENTIAL" = "yes" ] ; then
+    if [ "$CREDENTIAL" = "yes" ]; then
         flags="OC"
     fi
-    if [ "$PERSISTENT" = "yes" ] ; then
+    if [ "$PERSISTENT" = "yes" ]; then
         flags="${flags}F"
     fi
-    if [ "$PRESERVE_ARG0" = "yes" ] ; then
+    if [ "$PRESERVE_ARG0" = "yes" ]; then
         flags="${flags}P"
     fi

@@ -306,23 +306,23 @@ qemu_set_binfmts() {

     # register the interpreter for each cpu except for the native one

-    for cpu in ${qemu_target_list} ; do
+    for cpu in ${qemu_target_list}; do
         magic=$(eval echo \$${cpu}_magic)
         mask=$(eval echo \$${cpu}_mask)
         family=$(eval echo \$${cpu}_family)

-        if [ "$magic" = "" ] || [ "$mask" = "" ] || [ "$family" = "" ] ; then
+        if [ "$magic" = "" ] || [ "$mask" = "" ] || [ "$family" = "" ]; then
             echo "INTERNAL ERROR: unknown cpu $cpu" 1>&2
             continue
         fi

         qemu="$QEMU_PATH/qemu-$cpu"
-        if [ "$cpu" = "i486" ] ; then
+        if [ "$cpu" = "i486" ]; then
             qemu="$QEMU_PATH/qemu-i386"
         fi

         qemu="$qemu$QEMU_SUFFIX"
-        if [ "$host_family" != "$family" ] ; then
+        if [ "$host_family" != "$family" ]; then
             $BINFMT_SET
         fi
     done
@@ -343,7 +343,7 @@ QEMU_SUFFIX=""
 options=$(getopt -o ds:Q:S:e:hc:p:g: -l debian,systemd:,qemu-path:,qemu-suffix:,exportdir:,help,credential:,persistent:,preserve-argv0: -- "$@")
 eval set -- "$options"

-while true ; do
+while true; do
     case "$1" in
     -d|--debian)
         CHECK=qemu_check_debian
@@ -356,14 +356,14 @@ while true ; do
         EXPORTDIR=${EXPORTDIR:-$SYSTEMDDIR}
         shift
         # check given cpu is in the supported CPU list
-        if [ "$1" != "ALL" ] ; then
-            for cpu in ${qemu_target_list} ; do
-                if [ "$cpu" = "$1" ] ; then
+        if [ "$1" != "ALL" ]; then
+            for cpu in ${qemu_target_list}; do
+                if [ "$cpu" = "$1" ]; then
                     break
                 fi
             done

-            if [ "$cpu" = "$1" ] ; then
+            if [ "$cpu" = "$1" ]; then
                 qemu_target_list="$1"
             else
                 echo "ERROR: unknown CPU \"$1\"" 1>&2
--
2.32.0


Re: qemu-binfmt-conf.sh: enforce style consistency
Posted by Laurent Vivier 2 years, 10 months ago
Le 20/06/2021 à 22:15, umarcor a écrit :
> Spaces are removed before '; then', for consistency with other scripts
> in the project.

Well, I'm not sure there is a real consistency with this in the other scripts...

> Signed-off-by: umarcor <unai.martinezcorral@ehu.eus>

Please use your real name, not a nickname.

Changes look good, but can someone confirm this is the style we want to use everywhere?

Peter?

Thanks,
Laurent

> ---
>  scripts/qemu-binfmt-conf.sh | 36 ++++++++++++++++++------------------
>  1 file changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
> index 7de996d536..13bff41b47 100755
> --- a/scripts/qemu-binfmt-conf.sh
> +++ b/scripts/qemu-binfmt-conf.sh
> @@ -221,7 +221,7 @@ EOF
>  }
> 
>  qemu_check_access() {
> -    if [ ! -w "$1" ] ; then
> +    if [ ! -w "$1" ]; then
>          echo "ERROR: cannot write to $1" 1>&2
>          exit 1
>      fi
> @@ -230,12 +230,12 @@ qemu_check_access() {
>  qemu_check_bintfmt_misc() {
>      # load the binfmt_misc module
>      if [ ! -d /proc/sys/fs/binfmt_misc ]; then
> -      if ! /sbin/modprobe binfmt_misc ; then
> +      if ! /sbin/modprobe binfmt_misc; then
>            exit 1
>        fi
>      fi
>      if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
> -      if ! mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc ; then
> +      if ! mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc; then
>            exit 1
>        fi
>      fi
> @@ -248,16 +248,16 @@ installed_dpkg() {
>  }
> 
>  qemu_check_debian() {
> -    if [ ! -e /etc/debian_version ] ; then
> +    if [ ! -e /etc/debian_version ]; then
>          echo "WARNING: your system is not a Debian based distro" 1>&2
> -    elif ! installed_dpkg binfmt-support ; then
> +    elif ! installed_dpkg binfmt-support; then
>          echo "WARNING: package binfmt-support is needed" 1>&2
>      fi
>      qemu_check_access "$EXPORTDIR"
>  }
> 
>  qemu_check_systemd() {
> -    if ! systemctl -q is-enabled systemd-binfmt.service ; then
> +    if ! systemctl -q is-enabled systemd-binfmt.service; then
>          echo "WARNING: systemd-binfmt.service is missing or disabled" 1>&2
>      fi
>      qemu_check_access "$EXPORTDIR"
> @@ -265,13 +265,13 @@ qemu_check_systemd() {
> 
>  qemu_generate_register() {
>      flags=""
> -    if [ "$CREDENTIAL" = "yes" ] ; then
> +    if [ "$CREDENTIAL" = "yes" ]; then
>          flags="OC"
>      fi
> -    if [ "$PERSISTENT" = "yes" ] ; then
> +    if [ "$PERSISTENT" = "yes" ]; then
>          flags="${flags}F"
>      fi
> -    if [ "$PRESERVE_ARG0" = "yes" ] ; then
> +    if [ "$PRESERVE_ARG0" = "yes" ]; then
>          flags="${flags}P"
>      fi
> 
> @@ -306,23 +306,23 @@ qemu_set_binfmts() {
> 
>      # register the interpreter for each cpu except for the native one
> 
> -    for cpu in ${qemu_target_list} ; do
> +    for cpu in ${qemu_target_list}; do
>          magic=$(eval echo \$${cpu}_magic)
>          mask=$(eval echo \$${cpu}_mask)
>          family=$(eval echo \$${cpu}_family)
> 
> -        if [ "$magic" = "" ] || [ "$mask" = "" ] || [ "$family" = "" ] ; then
> +        if [ "$magic" = "" ] || [ "$mask" = "" ] || [ "$family" = "" ]; then
>              echo "INTERNAL ERROR: unknown cpu $cpu" 1>&2
>              continue
>          fi
> 
>          qemu="$QEMU_PATH/qemu-$cpu"
> -        if [ "$cpu" = "i486" ] ; then
> +        if [ "$cpu" = "i486" ]; then
>              qemu="$QEMU_PATH/qemu-i386"
>          fi
> 
>          qemu="$qemu$QEMU_SUFFIX"
> -        if [ "$host_family" != "$family" ] ; then
> +        if [ "$host_family" != "$family" ]; then
>              $BINFMT_SET
>          fi
>      done
> @@ -343,7 +343,7 @@ QEMU_SUFFIX=""
>  options=$(getopt -o ds:Q:S:e:hc:p:g: -l debian,systemd:,qemu-path:,qemu-suffix:,exportdir:,help,credential:,persistent:,preserve-argv0: -- "$@")
>  eval set -- "$options"
> 
> -while true ; do
> +while true; do
>      case "$1" in
>      -d|--debian)
>          CHECK=qemu_check_debian
> @@ -356,14 +356,14 @@ while true ; do
>          EXPORTDIR=${EXPORTDIR:-$SYSTEMDDIR}
>          shift
>          # check given cpu is in the supported CPU list
> -        if [ "$1" != "ALL" ] ; then
> -            for cpu in ${qemu_target_list} ; do
> -                if [ "$cpu" = "$1" ] ; then
> +        if [ "$1" != "ALL" ]; then
> +            for cpu in ${qemu_target_list}; do
> +                if [ "$cpu" = "$1" ]; then
>                      break
>                  fi
>              done
> 
> -            if [ "$cpu" = "$1" ] ; then
> +            if [ "$cpu" = "$1" ]; then
>                  qemu_target_list="$1"
>              else
>                  echo "ERROR: unknown CPU \"$1\"" 1>&2
> --
> 2.32.0
> 


Re: qemu-binfmt-conf.sh: enforce style consistency
Posted by Unai Martinez Corral 2 years, 10 months ago
Hi Laurent,

Well, I'm not sure there is a real consistency with this in the other
> scripts...
>

Changes look good, but can someone confirm this is the style we want to use
> everywhere?
>
> Peter?
>

Please, see
https://lists.gnu.org/archive/html/qemu-devel/2020-03/msg02267.html


> Please use your real name, not a nickname.
>

Sorry about that. It's 'Unai Martinez-Corral'.
Shall I resend the patch?

Cheers

Unai
Re: qemu-binfmt-conf.sh: enforce style consistency
Posted by Laurent Vivier 2 years, 10 months ago
Le 20/06/2021 à 23:22, Unai Martinez Corral a écrit :
> Hi Laurent,
> 
>     Well, I'm not sure there is a real consistency with this in the other scripts...
> 
> 
>     Changes look good, but can someone confirm this is the style we want to use everywhere?
> 
>     Peter? 
> 
> 
> Please, see https://lists.gnu.org/archive/html/qemu-devel/2020-03/msg02267.html
> <https://lists.gnu.org/archive/html/qemu-devel/2020-03/msg02267.html>

OK, so if Eric adds his R-b, I will put the patch in my linux-user branch.

> 
>     Please use your real name, not a nickname.
> 
> 
> Sorry about that. It's 'Unai Martinez-Corral'.
> Shall I resend the patch?

No, I'll update the patch.

Thanks,
Laurent