qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 60d3af: image-fuzzer: Open image files in bin


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 60d3af: image-fuzzer: Open image files in binary mode
Date: Wed, 06 Nov 2019 08:00:51 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 60d3af55da14982b8d1ee3ace7fc48246140721f
      
https://github.com/qemu/qemu/commit/60d3af55da14982b8d1ee3ace7fc48246140721f
  Author: Eduardo Habkost <address@hidden>
  Date:   2019-11-05 (Tue, 05 Nov 2019)

  Changed paths:
    M tests/image-fuzzer/qcow2/layout.py

  Log Message:
  -----------
  image-fuzzer: Open image files in binary mode

This probably never caused problems because on Linux there's no
actual newline conversion happening, but on Python 3 the
binary/text distinction is stronger and we must explicitly open
the image file in binary mode.

Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: c314e50b8ace8a66b732f3541d58b2592d4427a9
      
https://github.com/qemu/qemu/commit/c314e50b8ace8a66b732f3541d58b2592d4427a9
  Author: Eduardo Habkost <address@hidden>
  Date:   2019-11-05 (Tue, 05 Nov 2019)

  Changed paths:
    M tests/image-fuzzer/qcow2/layout.py

  Log Message:
  -----------
  image-fuzzer: Write bytes instead of string to image file

This is necessary for Python 3 compatibility.

Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: d974451c5bc9a0bdf07a8299edf75c0f66a86e04
      
https://github.com/qemu/qemu/commit/d974451c5bc9a0bdf07a8299edf75c0f66a86e04
  Author: Eduardo Habkost <address@hidden>
  Date:   2019-11-05 (Tue, 05 Nov 2019)

  Changed paths:
    M tests/image-fuzzer/qcow2/fuzz.py
    M tests/image-fuzzer/qcow2/layout.py

  Log Message:
  -----------
  image-fuzzer: Explicitly use integer division operator

Most of the division expressions in image-fuzzer assume integer
division.  Use the // operator to keep the same behavior when we
move to Python 3.

Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 8353546de54a6b1143ed23f62c976a986369fcf1
      
https://github.com/qemu/qemu/commit/8353546de54a6b1143ed23f62c976a986369fcf1
  Author: Eduardo Habkost <address@hidden>
  Date:   2019-11-05 (Tue, 05 Nov 2019)

  Changed paths:
    M tests/image-fuzzer/runner.py

  Log Message:
  -----------
  image-fuzzer: Use io.StringIO

StringIO.StringIO is not available on Python 3, but io.StringIO
is available on both Python 2 and 3.  io.StringIO is slightly
different from the Python 2 StringIO module, though, so we need
bytes coming from subprocess.Popen() to be explicitly decoded.

Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: c439143b7f853b8ecd4baff64ac41cf754db18e6
      
https://github.com/qemu/qemu/commit/c439143b7f853b8ecd4baff64ac41cf754db18e6
  Author: Eduardo Habkost <address@hidden>
  Date:   2019-11-05 (Tue, 05 Nov 2019)

  Changed paths:
    M tests/image-fuzzer/qcow2/layout.py

  Log Message:
  -----------
  image-fuzzer: Use %r for all fiels at Field.__repr__()

This makes the formatting code simpler, and safer if we change
the type of self.value from str to bytes.

Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 718584519771359b8517e4493e39cdf8744aa99c
      
https://github.com/qemu/qemu/commit/718584519771359b8517e4493e39cdf8744aa99c
  Author: Eduardo Habkost <address@hidden>
  Date:   2019-11-05 (Tue, 05 Nov 2019)

  Changed paths:
    M tests/image-fuzzer/qcow2/fuzz.py

  Log Message:
  -----------
  image-fuzzer: Return bytes objects on string fuzzing functions

No caller of fuzzer functions is interested in unicode string values,
so replace them with bytes sequences.

Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: ee1fde71a343b9311b39aa3f8d56ba0330abe449
      
https://github.com/qemu/qemu/commit/ee1fde71a343b9311b39aa3f8d56ba0330abe449
  Author: Eduardo Habkost <address@hidden>
  Date:   2019-11-05 (Tue, 05 Nov 2019)

  Changed paths:
    M tests/image-fuzzer/qcow2/layout.py

  Log Message:
  -----------
  image-fuzzer: Use bytes constant for field values

Field values are supposed to be bytes objects, not unicode
strings.  Change two constants that were declared as strings.

Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 58b818d5bdcb89e89e60b7b1f68d808882186ccc
      
https://github.com/qemu/qemu/commit/58b818d5bdcb89e89e60b7b1f68d808882186ccc
  Author: Eduardo Habkost <address@hidden>
  Date:   2019-11-05 (Tue, 05 Nov 2019)

  Changed paths:
    M tests/image-fuzzer/qcow2/layout.py

  Log Message:
  -----------
  image-fuzzer: Encode file name and file format to bytes

Callers of create_image() will pass strings as arguments, but the
Image class will expect bytes objects to be provided.  Encode
them inside create_image().

Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 73bdbb84ec710c53ca8318a2bff8640b6d7e31f2
      
https://github.com/qemu/qemu/commit/73bdbb84ec710c53ca8318a2bff8640b6d7e31f2
  Author: Eduardo Habkost <address@hidden>
  Date:   2019-11-05 (Tue, 05 Nov 2019)

  Changed paths:
    M tests/image-fuzzer/qcow2/__init__.py
    M tests/image-fuzzer/qcow2/layout.py
    M tests/image-fuzzer/runner.py

  Log Message:
  -----------
  image-fuzzer: Run using python3

image-fuzzer is now supposed to be ready to run using Python 3.
Remove the __future__ imports and change the interpreter line to
"#!/usr/bin/env python3".

Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: fca538a17124139d0270a5e2eb8da0dea50b4d5a
      
https://github.com/qemu/qemu/commit/fca538a17124139d0270a5e2eb8da0dea50b4d5a
  Author: Eduardo Habkost <address@hidden>
  Date:   2019-11-05 (Tue, 05 Nov 2019)

  Changed paths:
    M tests/image-fuzzer/runner.py

  Log Message:
  -----------
  image-fuzzer: Use errors parameter of subprocess.Popen()

Instead of manually encoding stderr and stdout output, use
`errors` parameter of subprocess.Popen().  This will make
process.communicate() return unicode strings instead of bytes
objects.

Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 9fdd7860adec188ed50d2530e9a819e8d953f9bb
      
https://github.com/qemu/qemu/commit/9fdd7860adec188ed50d2530e9a819e8d953f9bb
  Author: Eduardo Habkost <address@hidden>
  Date:   2019-11-05 (Tue, 05 Nov 2019)

  Changed paths:
    M tests/image-fuzzer/runner.py

  Log Message:
  -----------
  image-fuzzer: Use OSerror.strerror instead of tuple subscript

OSError can't be used like a tuple on Python 3, so change the
code to use `e.sterror` instead of `e[1]`.

Reported-by: John Snow <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: John Snow <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 2dd8fd6e96addda608900102987337068329ff68
      
https://github.com/qemu/qemu/commit/2dd8fd6e96addda608900102987337068329ff68
  Author: Peter Maydell <address@hidden>
  Date:   2019-11-06 (Wed, 06 Nov 2019)

  Changed paths:
    M tests/image-fuzzer/qcow2/__init__.py
    M tests/image-fuzzer/qcow2/fuzz.py
    M tests/image-fuzzer/qcow2/layout.py
    M tests/image-fuzzer/runner.py

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into 
staging

Pull request

Let's get the image fuzzer Python 3 changes merged in QEMU 4.2.

# gpg: Signature made Tue 05 Nov 2019 15:43:16 GMT
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <address@hidden>" [full]
# gpg:                 aka "Stefan Hajnoczi <address@hidden>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  image-fuzzer: Use OSerror.strerror instead of tuple subscript
  image-fuzzer: Use errors parameter of subprocess.Popen()
  image-fuzzer: Run using python3
  image-fuzzer: Encode file name and file format to bytes
  image-fuzzer: Use bytes constant for field values
  image-fuzzer: Return bytes objects on string fuzzing functions
  image-fuzzer: Use %r for all fiels at Field.__repr__()
  image-fuzzer: Use io.StringIO
  image-fuzzer: Explicitly use integer division operator
  image-fuzzer: Write bytes instead of string to image file
  image-fuzzer: Open image files in binary mode

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/50d2d550d75b...2dd8fd6e96ad



reply via email to

[Prev in Thread] Current Thread [Next in Thread]