prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  [block] Don't use parted human readable output - rhbz #1183770
  Changed the parted command to return data in sectors units
  instead of human readable form.
  
  Signed-off-by: Shane Bradley sbradley@redhat.com
  
  
  </issue>
  <code>
  [start of sos/plugins/block.py]
  1 # This program is free software; you can redistribute it and/or modify
  2 # it under the terms of the GNU General Public License as published by
  3 # the Free Software Foundation; either version 2 of the License, or
  4 # (at your option) any later version.
  5 
  6 # This program is distributed in the hope that it will be useful,
  7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
  8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  9 # GNU General Public License for more details.
  10 
  11 # You should have received a copy of the GNU General Public License
  12 # along with this program; if not, write to the Free Software
  13 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14 
  15 import os
  16 from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
  17 
  18 
  19 class Block(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
  20     """Block device information
  21     """
  22 
  23     plugin_name = 'block'
  24     profiles = ('storage', 'hardware')
  25 
  26     def setup(self):
  27         self.add_cmd_output([
  28             "lsblk",
  29             "blkid -c /dev/null",
  30             "ls -lanR /dev",
  31             "ls -lanR /sys/block"
  32         ])
  33 
  34         # legacy location for non-/run distributions
  35         self.add_copy_spec([
  36             "/etc/blkid.tab",
  37             "/run/blkid/blkid.tab",
  38             "/proc/partitions",
  39             "/proc/diskstats"
  40         ])
  41 
  42         if os.path.isdir("/sys/block"):
  43             for disk in os.listdir("/sys/block"):
  44                 if disk in [".",  ".."] or disk.startswith("ram"):
  45                     continue
  46                 disk_path = os.path.join('/dev/', disk)
  47                 self.add_cmd_output([
  48                     "udevadm info -ap /sys/block/%s" % (disk),
  49                     "parted -s %s print" % (disk_path),
  50                     "fdisk -l %s" % disk_path
  51                 ])
  52 
  53 # vim: et ts=4 sw=4
  54
  [end of sos/plugins/block.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/sos/plugins/block.py b/sos/plugins/block.py
  --- a/sos/plugins/block.py
  +++ b/sos/plugins/block.py
  @@ -46,7 +46,7 @@
                   disk_path = os.path.join('/dev/', disk)
                   self.add_cmd_output([
                       "udevadm info -ap /sys/block/%s" % (disk),
  -                    "parted -s %s print" % (disk_path),
  +                    "parted -s %s unit s print" % (disk_path),
                       "fdisk -l %s" % disk_path
                   ])
  
verification_info: {"golden_diff": "diff --git a/sos/plugins/block.py b/sos/plugins/block.py\n--- a/sos/plugins/block.py\n+++ b/sos/plugins/block.py\n@@ -46,7 +46,7 @@\n                 disk_path = os.path.join('/dev/', disk)\n                 self.add_cmd_output([\n                     \"udevadm info -ap /sys/block/%s\" % (disk),\n-                    \"parted -s %s print\" % (disk_path),\n+                    \"parted -s %s unit s print\" % (disk_path),\n                     \"fdisk -l %s\" % disk_path\n                 ])\n", "issue": "[block] Don't use parted human readable output - rhbz #1183770\nChanged the parted command to return data in sectors units\ninstead of human readable form.\n\nSigned-off-by: Shane Bradley sbradley@redhat.com\n\n", "before_files": [{"content": "# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\nimport os\nfrom sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin\n\n\nclass Block(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):\n    \"\"\"Block device information\n    \"\"\"\n\n    plugin_name = 'block'\n    profiles = ('storage', 'hardware')\n\n    def setup(self):\n        self.add_cmd_output([\n            \"lsblk\",\n            \"blkid -c /dev/null\",\n            \"ls -lanR /dev\",\n            \"ls -lanR /sys/block\"\n        ])\n\n        # legacy location for non-/run distributions\n        self.add_copy_spec([\n            \"/etc/blkid.tab\",\n            \"/run/blkid/blkid.tab\",\n            \"/proc/partitions\",\n            \"/proc/diskstats\"\n        ])\n\n        if os.path.isdir(\"/sys/block\"):\n            for disk in os.listdir(\"/sys/block\"):\n                if disk in [\".\",  \"..\"] or disk.startswith(\"ram\"):\n                    continue\n                disk_path = os.path.join('/dev/', disk)\n                self.add_cmd_output([\n                    \"udevadm info -ap /sys/block/%s\" % (disk),\n                    \"parted -s %s print\" % (disk_path),\n                    \"fdisk -l %s\" % disk_path\n                ])\n\n# vim: et ts=4 sw=4\n", "path": "sos/plugins/block.py"}]}