Skip to contentSkip to conversation

ipset: Fix syntax error of bash completion in Debian environment

PATCH In review Neutron Soutmun 2 participants 4 messages May 12, 2013 – May 16, 2013 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipset: Fix syntax error of bash completion in Debian environment

Debian packaging tool (lintian) warns the syntax error of bash completion as it uses the extglob shell option that should be run in
the ** #!/usr/bin/env bash ** and the shell option set should be moved to global scope.

---
 utils/ipset_bash_completion/ipset_bash_completion |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
utils/ipset_bash_completion/ipset_bash_completion +3 -2
index cc7ea7b..8a0b91d 100644
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # -----------------------------------------------------------------
 # Programmable completion code for ipset (netfilter.org)
@@ -47,6 +47,8 @@
 #
 # -----------------------------------------------------------------
 
+shopt -s extglob
+
 # -----------------------------------------------------------------
 # Functions
 # -----------------------------------------------------------------
@@ -537,7 +539,6 @@ done < "${_IPSET_IPLIST_FILE}"
 # -----------------------------------------------------------------
 
 _ipset_complete() {
-shopt -s extglob
 local cur prev cword words ips_version
 local str_action str_setname str_type str_filename
 local str_glob str_regex str_prefix str_suffix
Signature · 1 line
1.7.10.4
#1 lore raw

Cc-d script's author

Quoted 40 lines · Neutron Soutmun

Debian packaging tool (lintian) warns the syntax error of bash completion as it uses the extglob shell option that should be run in
the ** #!/usr/bin/env bash ** and the shell option set should be moved to global scope.

---
 utils/ipset_bash_completion/ipset_bash_completion |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
utils/ipset_bash_completion/ipset_bash_completion +3 -3
index cc7ea7b..8a0b91d 100644
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # -----------------------------------------------------------------
 # Programmable completion code for ipset (netfilter.org)
@@ -47,6 +47,8 @@
 #
 # -----------------------------------------------------------------
 
+shopt -s extglob
+
 # -----------------------------------------------------------------
 # Functions
 # -----------------------------------------------------------------
@@ -537,7 +539,6 @@ done < "${_IPSET_IPLIST_FILE}"
 # -----------------------------------------------------------------
 
 _ipset_complete() {
-shopt -s extglob
 local cur prev cword words ips_version
 local str_action str_setname str_type str_filename
 local str_glob str_regex str_prefix str_suffix
--

1.7.10.4

#2 lore raw
Quoted 2 lines · Neutron Soutmun

Cc-d script's author

Hello,

thanks for reporting.

Quoted 11 lines · Neutron Soutmun
Quoted 10 lines

Debian packaging tool (lintian) warns the syntax error of bash completion as it uses the extglob shell option that should be run in
the ** #!/usr/bin/env bash ** and the shell option set should be moved to global scope.

---
  utils/ipset_bash_completion/ipset_bash_completion |    5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
Quoted 7 lines

utils/ipset_bash_completion/ipset_bash_completion line 1

Quoted 7 lines
utils/ipset_bash_completion/ipset_bash_completion +1 -1
index cc7ea7b..8a0b91d 100644
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

Actually I think the shebang isn't required at all. Does the debian tool just warn?

Quoted 9 lines

utils/ipset_bash_completion/ipset_bash_completion line 51

Quoted 9 lines
utils/ipset_bash_completion/ipset_bash_completion +2 -0
  # -----------------------------------------------------------------
  # Programmable completion code for ipset (netfilter.org)
@@ -47,6 +47,8 @@
  #
  # -----------------------------------------------------------------
 
+shopt -s extglob
+

updated this in the dev branch (github / sourceforge).

[...]

Best regards

#3 lore raw

Hello,

Quoted 23 lines · Bourne Without
Quoted 3 lines · Neutron Soutmun

Cc-d script's author

Hello,

thanks for reporting.

Quoted 13 lines
Quoted 11 lines · Neutron Soutmun

Debian packaging tool (lintian) warns the syntax error of bash completion as it uses the extglob shell option that should be run in
the ** #!/usr/bin/env bash ** and the shell option set should be moved to global scope.

---
  utils/ipset_bash_completion/ipset_bash_completion |    5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
Quoted 12 lines
Quoted 8 lines

utils/ipset_bash_completion/ipset_bash_completion line 1

Quoted 8 lines
utils/ipset_bash_completion/ipset_bash_completion +1 -1
index cc7ea7b..8a0b91d 100644
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash

Actually I think the shebang isn't required at all. Does the debian tool just warn?

Sorry for the noise, I just search the BTS and found this
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699410

It seems to be the false positive of lintian.
However, the #!/usr/bin/env bash is the workaround for this issue :)

Thanks for your kindness to review it.

Best regards,
Neutron Soutmun