[Bug 1060192] Re: needless shell=True in a subprocess.Popen call

Robert Roth evfool at gmail.com
Wed Feb 13 15:07:06 UTC 2013


** Changed in: software-properties (Ubuntu)
       Status: New => Confirmed

** Changed in: software-properties (Ubuntu)
   Importance: Undecided => Low

** Changed in: software-properties (Ubuntu)
     Assignee: (unassigned) => Robert Roth (evfool)

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to software-properties in Ubuntu.
https://bugs.launchpad.net/bugs/1060192

Title:
  needless shell=True in a subprocess.Popen call

Status in “software-properties” package in Ubuntu:
  In Progress

Bug description:
  Whilst there is no issue with the following use of subprocess.Popen
  with shell=True today there is no reason to use it with shell=True in
  this instance.

  
  In softwareproperties/MirrorTest.py on line 29 (through to line 34) under the PingWorker the following code is found:

                     host = mirror.hostname

                      self.parent.report_action("Pinging %s..." % host)
                      commando = subprocess.Popen("ping -q -c 2 -W 1 -i 0.5 %s" % host,
                                                  shell=True, stdout=subprocess.PIPE,
                                                  stderr=subprocess.STDOUT).stdout

  
  The code should be changed to something like the following:

                      commando = subprocess.Popen(["ping", "-q", "-c 2", "-W 1",  "-i 0.5", host]
                                                  , stdout=subprocess.PIPE,
                                                  stderr=subprocess.STDOUT).stdout

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/1060192/+subscriptions




More information about the foundations-bugs mailing list