[ovs-dev,v3] ovs-tcpdump: add dump_cmd checker before _doexec()
diff mbox series

Message ID 3ee81795-5dbb-496a-a26b-eb8e142d381a.txfh2007@aliyun.com
State New
Headers show
Series
  • [ovs-dev,v3] ovs-tcpdump: add dump_cmd checker before _doexec()
Related show

Commit Message

Sriram Vatala via dev March 8, 2019, 7:32 a.m. UTC
Hi Aaron:
    Thanks for your kinkdly suggession. I have tried your proposol and test in my repository. This is the new version.

    Add dump_cmd executable checker in ovs-tcpdump

    Signed-off-by: Liu Chang <txfh2007@aliyun.com>

Comments

0-day Robot March 8, 2019, 7:59 a.m. UTC | #1
Bleep bloop.  Greetings txfh2007 via dev, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
ERROR: Author should not be mailing list.
Lines checked: 45, Warnings: 0, Errors: 1


Please check this out.  If you feel there has been an error, please email aconole@bytheb.org

Thanks,
0-day Robot
Ben Pfaff April 16, 2019, 10:43 p.m. UTC | #2
On Fri, Mar 08, 2019 at 03:32:29PM +0800, txfh2007 via dev wrote:
> Hi Aaron:
>     Thanks for your kinkdly suggession. I have tried your proposol and test in my repository. This is the new version.
> 
>     Add dump_cmd executable checker in ovs-tcpdump
> 
>     Signed-off-by: Liu Chang <txfh2007@aliyun.com>

Thanks, I applied this patch to the OVS master branch.

Patch
diff mbox series

diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in
index 269c252..911c608 100755
--- a/utilities/ovs-tcpdump.in
+++ b/utilities/ovs-tcpdump.in
@@ -371,6 +371,9 @@  def argv_tuples(lst):
     except StopIteration:
         pass

+def py_which(executable):
+        return any(os.access(os.path.join(path,executable),os.X_OK)
+                for path in os.environ["PATH"].split(os.pathsep))

 def main():
     db_sock = 'unix:@RUNDIR@/db.sock'
@@ -416,6 +419,10 @@  def main():
         print("Error: must at least specify an interface with '-i' option")
         sys.exit(1)

+    if not py_which(dump_cmd):
+        print("Error: unable to execute '%s' (check PATH)"%dump_cmd)
+        sys.exit(1)
+
     if '-l' not in tcpdargs:
         tcpdargs.insert(0, '-l')