Bug 87841

Summary: Bashisms in qmi-network script
Product: libqmi Reporter: marius
Component: libqmiAssignee: Dan Williams <dcbw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: aleksander, marius
Version: unspecified   
Hardware: Other   
OS: All   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=87093
http://bugs.debian.org/772328
Whiteboard:
i915 platform: i915 features:
Attachments: Patch for the issue

Description marius 2014-12-29 21:20:19 UTC
From Debian (Bug#772328):

I've ran checkbashisms (from the 'devscripts' package) over the whole
archive and I found that your package has a /bin/sh script that uses a
"bashism".

checkbashisms' output:
> possible bashism in ./usr/bin/qmi-network line 50 (should be 'b = a'):
>     if [ $1 == "--help" ]; then
> possible bashism in ./usr/bin/qmi-network line 53 (should be 'b = a'):
>     elif [ $1 == "--version" ]; then
Comment 1 marius 2014-12-29 21:32:32 UTC
Created attachment 111490 [details] [review]
Patch for the issue

Added a proposed patch for the issue. Also see bug #87093.
Comment 2 marius 2014-12-29 21:57:45 UTC
I just saw a fix for this was committed:

commit 739fc4f183c18d7d8b3158a0843046ad2d2edd4f
Author: Aleksander Morgado <aleksander@aleksander.es>
Date:   Mon Dec 8 13:58:39 2014 +0100

    qmi-network: fix bashisms
    
    Equivalent to the fix done in mbim-network, see:
    https://bugs.freedesktop.org/show_bug.cgi?id=87093

diff --git a/utils/qmi-network.in b/utils/qmi-network.in
index 1470f38..84a46ae 100755
--- a/utils/qmi-network.in
+++ b/utils/qmi-network.in
@@ -47,10 +47,10 @@ version ()
 }
 
 if [ $# -ne 2 ]; then
-    if [ $1 == "--help" ]; then
+    if [ "$1" == "--help" ]; then
         help
         exit 0
-    elif [ $1 == "--version" ]; then
+    elif [ "$1" == "--version" ]; then

but it is not sufficient, as the important here is to replace "==" with "=".
Comment 3 marius 2014-12-30 09:31:43 UTC
Btw, a 1.10.x release containing these two commits would be nice, as "--help"/"--version" is now completely broken in Debian and Ubuntu.
Comment 4 Aleksander Morgado 2014-12-30 09:48:45 UTC
(In reply to marius from comment #2)
> I just saw a fix for this was committed:
> 
> commit 739fc4f183c18d7d8b3158a0843046ad2d2edd4f
> Author: Aleksander Morgado <aleksander@aleksander.es>
> Date:   Mon Dec 8 13:58:39 2014 +0100
> 
>     qmi-network: fix bashisms
>     
>     Equivalent to the fix done in mbim-network, see:
>     https://bugs.freedesktop.org/show_bug.cgi?id=87093
> 
> diff --git a/utils/qmi-network.in b/utils/qmi-network.in
> index 1470f38..84a46ae 100755
> --- a/utils/qmi-network.in
> +++ b/utils/qmi-network.in
> @@ -47,10 +47,10 @@ version ()
>  }
>  
>  if [ $# -ne 2 ]; then
> -    if [ $1 == "--help" ]; then
> +    if [ "$1" == "--help" ]; then
>          help
>          exit 0
> -    elif [ $1 == "--version" ]; then
> +    elif [ "$1" == "--version" ]; then
> 
> but it is not sufficient, as the important here is to replace "==" with "=".

Merged to git master, thanks.
Comment 5 Aleksander Morgado 2014-12-30 09:50:18 UTC
(In reply to marius from comment #3)
> Btw, a 1.10.x release containing these two commits would be nice, as
> "--help"/"--version" is now completely broken in Debian and Ubuntu.

I'm releasing 1.12.0 stable soon, this week or next week. I may also release a 1.10.x though, not sure.
Comment 6 marius 2014-12-30 09:53:56 UTC
Thanks.
Comment 8 Aleksander Morgado 2014-12-30 12:18:58 UTC
(In reply to marius from comment #7)
> The patch at
> https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=12;filename=0001-Fix-
> bashism-as-the-script-uses-sh-not-bash.patch;att=2;bug=772328
> 
> should apply to the 1.10 branch.

See http://lists.freedesktop.org/archives/libqmi-devel/2014-December/001060.html

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.