prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  subprocess.CalledProcessError: Command '['/usr/local/bin/checksec', '--file', '/tmp/xxx']' returned non-zero exit status 2.
  ```
  pwndbg> checksec 
  Traceback (most recent call last):
    File "/root/pwndbg/pwndbg/commands/__init__.py", line 109, in __call__
      return self.function(*args, **kwargs)
    File "/root/pwndbg/pwndbg/commands/__init__.py", line 189, in _OnlyWithFile
      return function(*a, **kw)
    File "/root/pwndbg/pwndbg/commands/checksec.py", line 16, in checksec
      print(pwndbg.wrappers.checksec.get_raw_out())
    File "/root/pwndbg/pwndbg/commands/__init__.py", line 189, in _OnlyWithFile
      return function(*a, **kw)
    File "/root/pwndbg/pwndbg/wrappers/__init__.py", line 28, in _OnlyWithCommand
      return function(*a, **kw)
    File "/root/pwndbg/pwndbg/memoize.py", line 48, in __call__
      value = self.func(*args, **kwargs)
    File "/root/pwndbg/pwndbg/wrappers/checksec.py", line 20, in get_raw_out
      return pwndbg.wrappers.call_cmd(cmd)
    File "/root/pwndbg/pwndbg/wrappers/__init__.py", line 35, in call_cmd
      return subprocess.check_output(cmd, stderr=STDOUT).decode('utf-8')
    File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
      **kwargs).stdout
    File "/usr/lib/python3.7/subprocess.py", line 487, in run
      output=stdout, stderr=stderr)
  subprocess.CalledProcessError: Command '['/usr/local/bin/checksec', '--file', '/tmp/forgot']' returned non-zero exit status 2.
  ```
  
  when checksec running in python3 pwntools environment, raise a failure. Here's the reason:
  ```
  root@kali:/tmp# checksec --file forgot
  usage: checksec [-h] elf [elf ...]
  checksec: error: unrecognized arguments: --file
  ```
  
  
  So modify pwndbg/pwndbg/wrappers/checksec.py: 19 with:
  `cmd = [get_raw_out.cmd_path, local_path]`
  
  Then it will be solved
  
  </issue>
  <code>
  [start of pwndbg/wrappers/checksec.py]
  1 #!/usr/bin/env python
  2 # -*- coding: utf-8 -*-
  3 from __future__ import absolute_import
  4 from __future__ import division
  5 from __future__ import print_function
  6 from __future__ import unicode_literals
  7 
  8 import pwndbg.commands
  9 import pwndbg.memoize
  10 import pwndbg.wrappers
  11 
  12 cmd_name = "checksec"
  13 
  14 @pwndbg.wrappers.OnlyWithCommand(cmd_name)
  15 @pwndbg.memoize.reset_on_objfile
  16 def get_raw_out():
  17 
  18     local_path = pwndbg.file.get_file(pwndbg.proc.exe)
  19     cmd = [get_raw_out.cmd_path, "--file", local_path]
  20     return pwndbg.wrappers.call_cmd(cmd)
  21 
  22 @pwndbg.wrappers.OnlyWithCommand(cmd_name)
  23 def relro_status():
  24     relro = "No RELRO"
  25     out = get_raw_out()
  26 
  27     if "Full RELRO" in out:
  28         relro = "Full RELRO"
  29     elif "Partial RELRO" in out:
  30         relro = "Partial RELRO"
  31 
  32     return relro
  33 
  34 @pwndbg.wrappers.OnlyWithCommand(cmd_name)
  35 def pie_status():
  36     pie = "No PIE"
  37     out = get_raw_out()
  38 
  39     if "PIE enabled" in out:
  40         pie = "PIE enabled"
  41 
  42     return pie
  43
  [end of pwndbg/wrappers/checksec.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/pwndbg/wrappers/checksec.py b/pwndbg/wrappers/checksec.py
  --- a/pwndbg/wrappers/checksec.py
  +++ b/pwndbg/wrappers/checksec.py
  @@ -5,6 +5,10 @@
   from __future__ import print_function
   from __future__ import unicode_literals
   
  +import subprocess
  +from re import search
  +from subprocess import STDOUT
  +
   import pwndbg.commands
   import pwndbg.memoize
   import pwndbg.wrappers
  @@ -14,10 +18,17 @@
   @pwndbg.wrappers.OnlyWithCommand(cmd_name)
   @pwndbg.memoize.reset_on_objfile
   def get_raw_out():
  -
       local_path = pwndbg.file.get_file(pwndbg.proc.exe)
  -    cmd = [get_raw_out.cmd_path, "--file", local_path]
  -    return pwndbg.wrappers.call_cmd(cmd)
  +    try:
  +        version_output = subprocess.check_output([get_raw_out.cmd_path, "--version"], stderr=STDOUT).decode('utf-8')
  +        match = search('checksec v([\\w.]+),', version_output)
  +        if match:
  +            version = tuple(map(int, (match.group(1).split("."))))
  +            if version >= (2, 0):
  +                return pwndbg.wrappers.call_cmd([get_raw_out.cmd_path, "--file=" + local_path])
  +    except Exception:
  +        pass
  +    return pwndbg.wrappers.call_cmd([get_raw_out.cmd_path, "--file", local_path])
   
   @pwndbg.wrappers.OnlyWithCommand(cmd_name)
   def relro_status():
  
verification_info: {"golden_diff": "diff --git a/pwndbg/wrappers/checksec.py b/pwndbg/wrappers/checksec.py\n--- a/pwndbg/wrappers/checksec.py\n+++ b/pwndbg/wrappers/checksec.py\n@@ -5,6 +5,10 @@\n from __future__ import print_function\n from __future__ import unicode_literals\n \n+import subprocess\n+from re import search\n+from subprocess import STDOUT\n+\n import pwndbg.commands\n import pwndbg.memoize\n import pwndbg.wrappers\n@@ -14,10 +18,17 @@\n @pwndbg.wrappers.OnlyWithCommand(cmd_name)\n @pwndbg.memoize.reset_on_objfile\n def get_raw_out():\n-\n     local_path = pwndbg.file.get_file(pwndbg.proc.exe)\n-    cmd = [get_raw_out.cmd_path, \"--file\", local_path]\n-    return pwndbg.wrappers.call_cmd(cmd)\n+    try:\n+        version_output = subprocess.check_output([get_raw_out.cmd_path, \"--version\"], stderr=STDOUT).decode('utf-8')\n+        match = search('checksec v([\\\\w.]+),', version_output)\n+        if match:\n+            version = tuple(map(int, (match.group(1).split(\".\"))))\n+            if version >= (2, 0):\n+                return pwndbg.wrappers.call_cmd([get_raw_out.cmd_path, \"--file=\" + local_path])\n+    except Exception:\n+        pass\n+    return pwndbg.wrappers.call_cmd([get_raw_out.cmd_path, \"--file\", local_path])\n \n @pwndbg.wrappers.OnlyWithCommand(cmd_name)\n def relro_status():\n", "issue": "subprocess.CalledProcessError: Command '['/usr/local/bin/checksec', '--file', '/tmp/xxx']' returned non-zero exit status 2.\n```\r\npwndbg> checksec \r\nTraceback (most recent call last):\r\n  File \"/root/pwndbg/pwndbg/commands/__init__.py\", line 109, in __call__\r\n    return self.function(*args, **kwargs)\r\n  File \"/root/pwndbg/pwndbg/commands/__init__.py\", line 189, in _OnlyWithFile\r\n    return function(*a, **kw)\r\n  File \"/root/pwndbg/pwndbg/commands/checksec.py\", line 16, in checksec\r\n    print(pwndbg.wrappers.checksec.get_raw_out())\r\n  File \"/root/pwndbg/pwndbg/commands/__init__.py\", line 189, in _OnlyWithFile\r\n    return function(*a, **kw)\r\n  File \"/root/pwndbg/pwndbg/wrappers/__init__.py\", line 28, in _OnlyWithCommand\r\n    return function(*a, **kw)\r\n  File \"/root/pwndbg/pwndbg/memoize.py\", line 48, in __call__\r\n    value = self.func(*args, **kwargs)\r\n  File \"/root/pwndbg/pwndbg/wrappers/checksec.py\", line 20, in get_raw_out\r\n    return pwndbg.wrappers.call_cmd(cmd)\r\n  File \"/root/pwndbg/pwndbg/wrappers/__init__.py\", line 35, in call_cmd\r\n    return subprocess.check_output(cmd, stderr=STDOUT).decode('utf-8')\r\n  File \"/usr/lib/python3.7/subprocess.py\", line 395, in check_output\r\n    **kwargs).stdout\r\n  File \"/usr/lib/python3.7/subprocess.py\", line 487, in run\r\n    output=stdout, stderr=stderr)\r\nsubprocess.CalledProcessError: Command '['/usr/local/bin/checksec', '--file', '/tmp/forgot']' returned non-zero exit status 2.\r\n```\r\n\r\nwhen checksec running in python3 pwntools environment, raise a failure. Here's the reason:\r\n```\r\nroot@kali:/tmp# checksec --file forgot\r\nusage: checksec [-h] elf [elf ...]\r\nchecksec: error: unrecognized arguments: --file\r\n```\r\n\r\n\r\nSo modify pwndbg/pwndbg/wrappers/checksec.py: 19 with:\r\n`cmd = [get_raw_out.cmd_path, local_path]`\r\n\r\nThen it will be solved\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport pwndbg.commands\nimport pwndbg.memoize\nimport pwndbg.wrappers\n\ncmd_name = \"checksec\"\n\n@pwndbg.wrappers.OnlyWithCommand(cmd_name)\n@pwndbg.memoize.reset_on_objfile\ndef get_raw_out():\n\n    local_path = pwndbg.file.get_file(pwndbg.proc.exe)\n    cmd = [get_raw_out.cmd_path, \"--file\", local_path]\n    return pwndbg.wrappers.call_cmd(cmd)\n\n@pwndbg.wrappers.OnlyWithCommand(cmd_name)\ndef relro_status():\n    relro = \"No RELRO\"\n    out = get_raw_out()\n\n    if \"Full RELRO\" in out:\n        relro = \"Full RELRO\"\n    elif \"Partial RELRO\" in out:\n        relro = \"Partial RELRO\"\n\n    return relro\n\n@pwndbg.wrappers.OnlyWithCommand(cmd_name)\ndef pie_status():\n    pie = \"No PIE\"\n    out = get_raw_out()\n\n    if \"PIE enabled\" in out:\n        pie = \"PIE enabled\"\n\n    return pie\n", "path": "pwndbg/wrappers/checksec.py"}]}