From nobody Mon Apr 29 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572968769; cv=none; d=zoho.com; s=zohoarc; b=YI+8OWi+nSrUdeXeCf7mv2w1WemvfxRvVcB8tEH5UE337OaCiaGnkV8uNDTCjK5IQ5QQ1KwWTWZ84KR4TuTBGIswx0Y/CNXhqNatF+lq2LVpFmtIp0LlxIgqWuArYCNiOQOQ5AV3vqB83R1RK2r4S/6Y45bcyN2bDbj2i5ZjcSU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572968769; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FaBWrX7aOOP5YexwWB+qHmz9YQZs0OVGYtkJ7dC5MZ8=; b=RNtqH1T+uF/jnBkxkZpr/ofM4S0f2PPgYMsLSRhy+ndcCDzPs63yISjaWEWKD877+bVbkw3lmW2TjUA3xLDDsWId14jHiDEaQ+Obto50Lne5qYwH0HTzbhZg8XW01RnZnVr0b/TmNyf26giCGRnLOWbmrCgdBV64SB4YVQojSLs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572968769363798.2002556748708; Tue, 5 Nov 2019 07:46:09 -0800 (PST) Received: from localhost ([::1]:45396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS11z-0005ty-1N for importer@patchew.org; Tue, 05 Nov 2019 10:46:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42109) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS0zr-00049Y-Qe for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:43:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS0zq-0002Kr-5p for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:43:55 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:40945 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iS0zp-0002FQ-NC for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:43:53 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-89-JgGW_7NXMtOXmWnHlKIKkA-1; Tue, 05 Nov 2019 10:43:51 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8E50A1800D4A; Tue, 5 Nov 2019 15:43:50 +0000 (UTC) Received: from localhost (ovpn-116-232.ams2.redhat.com [10.36.116.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7181608AC; Tue, 5 Nov 2019 15:43:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572968633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FaBWrX7aOOP5YexwWB+qHmz9YQZs0OVGYtkJ7dC5MZ8=; b=hC/k02ZtQkJhkuMdAsvahIx4BhfD+ffxmDicqouQO+hSkDuYFseWVTQ5jM2lX1UAhm/2oe 8frYFuMQSM0LwWwW1uHU4A32YMAGXz/PwLhZPblgqTCzwNvohfYkxOSuDqT7cC00xTyrF/ 3Gu3PBPN8WXM50OMssyJSm41mnhLKmE= From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 01/11] image-fuzzer: Open image files in binary mode Date: Tue, 5 Nov 2019 16:43:22 +0100 Message-Id: <20191105154332.181417-2-stefanha@redhat.com> In-Reply-To: <20191105154332.181417-1-stefanha@redhat.com> References: <20191105154332.181417-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: JgGW_7NXMtOXmWnHlKIKkA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , qemu-block@nongnu.org, John Snow , Stefan Hajnoczi , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost 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 Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20191016192430.25098-2-ehabkost@redhat.com Message-Id: <20191016192430.25098-2-ehabkost@redhat.com> Signed-off-by: Stefan Hajnoczi --- tests/image-fuzzer/qcow2/layout.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/image-fuzzer/qcow2/layout.py b/tests/image-fuzzer/qcow2/= layout.py index 675877da96..c57418fa15 100644 --- a/tests/image-fuzzer/qcow2/layout.py +++ b/tests/image-fuzzer/qcow2/layout.py @@ -503,7 +503,7 @@ class Image(object): =20 def write(self, filename): """Write an entire image to the file.""" - image_file =3D open(filename, 'w') + image_file =3D open(filename, 'wb') for field in self: image_file.seek(field.offset) image_file.write(struct.pack(field.fmt, field.value)) --=20 2.23.0 From nobody Mon Apr 29 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572968820; cv=none; d=zoho.com; s=zohoarc; b=BVPwhBZCgRv1UYsnCUA1hxqYyFWM2Yd5gYU6e1tE1p3aFn7kx+gTi73hGoeXSnpATZoGBvjg1QmipBj9SIGbRVc5tLrk1STfnUympwpYE18lCQoHgxeUpC+Upm/CL3/nOl4stW9L37RcgjVgrDD3P+ubpe+hxY8SvFmbd0S+zUo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572968820; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ghXHSt2wQDU1/F9XO6CyAfwFu9GIMkCeh9USSijcSwU=; b=ShLhWcFN+6MbAKjX0879f6VlkQVSseIopIu7+eyOJLWGL8bgZzE3R7v/NO6UjKmB+tVDYCJnpJo3TYLtFZB4nIWkxx8iuXonsCeu8RiFLqiDzGNguz5sfFeup0LtDwZ/K/9CAq0zSdm28fxJupX1/wwoqb8OsegntgfHqUYc7Ss= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572968820482306.45849616156954; Tue, 5 Nov 2019 07:47:00 -0800 (PST) Received: from localhost ([::1]:45406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS12n-0006om-UH for importer@patchew.org; Tue, 05 Nov 2019 10:46:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42166) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS0zx-0004EI-VY for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS0zw-0002PE-NR for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:01 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:33541 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iS0zv-0002Nv-Uu for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:00 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-296-38V1Nny6MxOh_N1xbFCLmA-1; Tue, 05 Nov 2019 10:43:54 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D84B477; Tue, 5 Nov 2019 15:43:53 +0000 (UTC) Received: from localhost (ovpn-116-232.ams2.redhat.com [10.36.116.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6DAE4608AC; Tue, 5 Nov 2019 15:43:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572968638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ghXHSt2wQDU1/F9XO6CyAfwFu9GIMkCeh9USSijcSwU=; b=JlF85fh00bWgJRQ9Xo+YTeDFR3y9stFdk5JkZxORK+8+vb5L4MHgJugFx22UPk5QB2l17Y kBcC7ve7QCD0UoPWNeUFb5tnyj2g98OysIG7wUIwu0pB9qcjVTXqCH/X9kUi7ADXcZhYFS V4qKIVJIesRk+YGaXHrpTCfarYLJSIo= From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 02/11] image-fuzzer: Write bytes instead of string to image file Date: Tue, 5 Nov 2019 16:43:23 +0100 Message-Id: <20191105154332.181417-3-stefanha@redhat.com> In-Reply-To: <20191105154332.181417-1-stefanha@redhat.com> References: <20191105154332.181417-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: 38V1Nny6MxOh_N1xbFCLmA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , qemu-block@nongnu.org, John Snow , Stefan Hajnoczi , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost This is necessary for Python 3 compatibility. Signed-off-by: Eduardo Habkost Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20191016192430.25098-3-ehabkost@redhat.com Message-Id: <20191016192430.25098-3-ehabkost@redhat.com> Signed-off-by: Stefan Hajnoczi --- tests/image-fuzzer/qcow2/layout.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/image-fuzzer/qcow2/layout.py b/tests/image-fuzzer/qcow2/= layout.py index c57418fa15..fe273d4143 100644 --- a/tests/image-fuzzer/qcow2/layout.py +++ b/tests/image-fuzzer/qcow2/layout.py @@ -518,7 +518,7 @@ class Image(object): rounded =3D (size + self.cluster_size - 1) & ~(self.cluster_size -= 1) if rounded > size: image_file.seek(rounded - 1) - image_file.write("\0") + image_file.write(b'\x00') image_file.close() =20 @staticmethod --=20 2.23.0 From nobody Mon Apr 29 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572968970; cv=none; d=zoho.com; s=zohoarc; b=HwleU/7eSiBCH+3DHpLXPEOHN7MYl/ZeItnS/zSeTxBVnZ6QTo65Z3Ks8s3vEojYcZbJF0AnEas1USYKsTxlLQoe8yZJCLrCPslB9i2O7OegsmZA1Tmj660glTDb3jFaN0aa9/WxXlsg6bF0eCKTbKTu6t+dHVfi9zZuC2hv3zQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572968970; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=V+YArILCMhXG24AbA68Zfhwsbzb9vDjrJoEpzRpU8rg=; b=gPKZeusWXdthexyWy6CMilYLMXfIJT8sjam18hYwI8w8T+ct+v0SlYFYHdw3j86509Ubcrlrr3ZxfRsBg1Z69Vd8S5YyZhndiH2E0G6W+oTjPXPO3uz+ZuEYmNVifpy1xAXvAseDEdoHn4ZNqdJ+FKyTQJIYBaNmTgesqAl+sSM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15729689704961003.4409837818597; Tue, 5 Nov 2019 07:49:30 -0800 (PST) Received: from localhost ([::1]:45450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS15F-0001CK-1t for importer@patchew.org; Tue, 05 Nov 2019 10:49:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42241) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS101-0004HT-W9 for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS0zz-0002Th-Ra for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:05 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:50224 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iS0zx-0002P8-UA for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:02 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-275-LqB_iqlmO5GVr09wEGFCpQ-1; Tue, 05 Nov 2019 10:43:57 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0280C2A3; Tue, 5 Nov 2019 15:43:56 +0000 (UTC) Received: from localhost (ovpn-116-232.ams2.redhat.com [10.36.116.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50E1D608AC; Tue, 5 Nov 2019 15:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572968640; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V+YArILCMhXG24AbA68Zfhwsbzb9vDjrJoEpzRpU8rg=; b=SaJ4q8mRcA2yI8T5av4EAxFgQ4QYWTGGH3Nyt+E/DU2bnI0qr5u6xjx5/6uUXeEOiWzEnI QdLZ7hAFPmDWeUyJMahYQV8VaD6iocA16Q2rp1/N7FJt0lbEJnFPrUSnK73Cw0Kic78gCC gmBsQs28mpDClQ2s6e/S9MxrCSmMQAg= From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 03/11] image-fuzzer: Explicitly use integer division operator Date: Tue, 5 Nov 2019 16:43:24 +0100 Message-Id: <20191105154332.181417-4-stefanha@redhat.com> In-Reply-To: <20191105154332.181417-1-stefanha@redhat.com> References: <20191105154332.181417-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: LqB_iqlmO5GVr09wEGFCpQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , qemu-block@nongnu.org, John Snow , Stefan Hajnoczi , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost 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 Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20191016192430.25098-4-ehabkost@redhat.com Message-Id: <20191016192430.25098-4-ehabkost@redhat.com> Signed-off-by: Stefan Hajnoczi --- tests/image-fuzzer/qcow2/fuzz.py | 12 ++++----- tests/image-fuzzer/qcow2/layout.py | 40 +++++++++++++++--------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tests/image-fuzzer/qcow2/fuzz.py b/tests/image-fuzzer/qcow2/fu= zz.py index abc4f0635d..154dc06cc0 100644 --- a/tests/image-fuzzer/qcow2/fuzz.py +++ b/tests/image-fuzzer/qcow2/fuzz.py @@ -27,14 +27,14 @@ UINT64 =3D 0xffffffffffffffff UINT32_M =3D 31 UINT64_M =3D 63 # Fuzz vectors -UINT8_V =3D [0, 0x10, UINT8/4, UINT8/2 - 1, UINT8/2, UINT8/2 + 1, UINT8 - = 1, +UINT8_V =3D [0, 0x10, UINT8//4, UINT8//2 - 1, UINT8//2, UINT8//2 + 1, UINT= 8 - 1, UINT8] -UINT16_V =3D [0, 0x100, 0x1000, UINT16/4, UINT16/2 - 1, UINT16/2, UINT16/2= + 1, +UINT16_V =3D [0, 0x100, 0x1000, UINT16//4, UINT16//2 - 1, UINT16//2, UINT1= 6//2 + 1, UINT16 - 1, UINT16] -UINT32_V =3D [0, 0x100, 0x1000, 0x10000, 0x100000, UINT32/4, UINT32/2 - 1, - UINT32/2, UINT32/2 + 1, UINT32 - 1, UINT32] -UINT64_V =3D UINT32_V + [0x1000000, 0x10000000, 0x100000000, UINT64/4, - UINT64/2 - 1, UINT64/2, UINT64/2 + 1, UINT64 - 1, +UINT32_V =3D [0, 0x100, 0x1000, 0x10000, 0x100000, UINT32//4, UINT32//2 - = 1, + UINT32//2, UINT32//2 + 1, UINT32 - 1, UINT32] +UINT64_V =3D UINT32_V + [0x1000000, 0x10000000, 0x100000000, UINT64//4, + UINT64//2 - 1, UINT64//2, UINT64//2 + 1, UINT64 - 1, UINT64] STRING_V =3D ['%s%p%x%d', '.1024d', '%.2049d', '%p%p%p%p', '%x%x%x%x', '%d%d%d%d', '%s%s%s%s', '%99999999999s', '%08x', '%%20d', '%%2= 0n', diff --git a/tests/image-fuzzer/qcow2/layout.py b/tests/image-fuzzer/qcow2/= layout.py index fe273d4143..6501c9fd4b 100644 --- a/tests/image-fuzzer/qcow2/layout.py +++ b/tests/image-fuzzer/qcow2/layout.py @@ -253,7 +253,7 @@ class Image(object): ['>I', self.ext_offset, 0x6803f857, 'ext_magic'], # One feature table contains 3 fields and takes 48 bytes ['>I', self.ext_offset + UINT32_S, - len(feature_tables) / 3 * 48, 'ext_length'] + len(feature_tables) // 3 * 48, 'ext_length'] ] + feature_tables) self.ext_offset =3D inner_offset =20 @@ -271,7 +271,7 @@ class Image(object): def create_l2_entry(host, guest, l2_cluster): """Generate one L2 entry.""" offset =3D l2_cluster * self.cluster_size - l2_size =3D self.cluster_size / UINT64_S + l2_size =3D self.cluster_size // UINT64_S entry_offset =3D offset + UINT64_S * (guest % l2_size) cluster_descriptor =3D host * self.cluster_size if not self.header['version'][0].value =3D=3D 2: @@ -283,8 +283,8 @@ class Image(object): =20 def create_l1_entry(l2_cluster, l1_offset, guest): """Generate one L1 entry.""" - l2_size =3D self.cluster_size / UINT64_S - entry_offset =3D l1_offset + UINT64_S * (guest / l2_size) + l2_size =3D self.cluster_size // UINT64_S + entry_offset =3D l1_offset + UINT64_S * (guest // l2_size) # While snapshots are not supported bit #63 =3D 1 entry_val =3D (1 << 63) + l2_cluster * self.cluster_size return ['>Q', entry_offset, entry_val, 'l1_entry'] @@ -298,11 +298,11 @@ class Image(object): l2 =3D [] else: meta_data =3D self._get_metadata() - guest_clusters =3D random.sample(range(self.image_size / + guest_clusters =3D random.sample(range(self.image_size // self.cluster_size), len(self.data_clusters)) # Number of entries in a L1/L2 table - l_size =3D self.cluster_size / UINT64_S + l_size =3D self.cluster_size // UINT64_S # Number of clusters necessary for L1 table l1_size =3D int(ceil((max(guest_clusters) + 1) / float(l_size*= *2))) l1_start =3D self._get_adjacent_clusters(self.data_clusters | @@ -318,7 +318,7 @@ class Image(object): # L2 entries l2 =3D [] for host, guest in zip(self.data_clusters, guest_clusters): - l2_id =3D guest / l_size + l2_id =3D guest // l_size if l2_id not in l2_ids: l2_ids.append(l2_id) l2_clusters.append(self._get_adjacent_clusters( @@ -339,14 +339,14 @@ class Image(object): def allocate_rfc_blocks(data, size): """Return indices of clusters allocated for refcount blocks.""" cluster_ids =3D set() - diff =3D block_ids =3D set([x / size for x in data]) + diff =3D block_ids =3D set([x // size for x in data]) while len(diff) !=3D 0: # Allocate all yet not allocated clusters new =3D self._get_available_clusters(data | cluster_ids, len(diff)) # Indices of new refcount blocks necessary to cover cluste= rs # in 'new' - diff =3D set([x / size for x in new]) - block_ids + diff =3D set([x // size for x in new]) - block_ids cluster_ids |=3D new block_ids |=3D diff return cluster_ids, block_ids @@ -359,7 +359,7 @@ class Image(object): blocks =3D set(init_blocks) clusters =3D set() # Number of entries in one cluster of the refcount table - size =3D self.cluster_size / UINT64_S + size =3D self.cluster_size // UINT64_S # Number of clusters necessary for the refcount table based on # the current number of refcount blocks table_size =3D int(ceil((max(blocks) + 1) / float(size))) @@ -373,7 +373,7 @@ class Image(object): table_size + 1)) # New refcount blocks necessary for clusters occupied by the # refcount table - diff =3D set([c / block_size for c in table_clusters]) - blocks + diff =3D set([c // block_size for c in table_clusters]) - bloc= ks blocks |=3D diff while len(diff) !=3D 0: # Allocate clusters for new refcount blocks @@ -382,12 +382,12 @@ class Image(object): len(diff)) # Indices of new refcount blocks necessary to cover # clusters in 'new' - diff =3D set([x / block_size for x in new]) - blocks + diff =3D set([x // block_size for x in new]) - blocks clusters |=3D new blocks |=3D diff # Check if the refcount table needs one more cluster if int(ceil((max(blocks) + 1) / float(size))) > table_size: - new_block_id =3D (table_start + table_size) / block_si= ze + new_block_id =3D (table_start + table_size) // block_s= ize # Check if the additional table cluster needs # one more refcount block if new_block_id not in blocks: @@ -399,13 +399,13 @@ class Image(object): def create_table_entry(table_offset, block_cluster, block_size, cluster): """Generate a refcount table entry.""" - offset =3D table_offset + UINT64_S * (cluster / block_size) + offset =3D table_offset + UINT64_S * (cluster // block_size) return ['>Q', offset, block_cluster * self.cluster_size, 'refcount_table_entry'] =20 def create_block_entry(block_cluster, block_size, cluster): """Generate a list of entries for the current block.""" - entry_size =3D self.cluster_size / block_size + entry_size =3D self.cluster_size // block_size offset =3D block_cluster * self.cluster_size entry_offset =3D offset + entry_size * (cluster % block_size) # While snapshots are not supported all refcounts are set to 1 @@ -415,7 +415,7 @@ class Image(object): # Number of refcount entries per refcount block # Convert self.cluster_size from bytes to bits to have the same # base for the numerator and denominator - block_size =3D self.cluster_size * 8 / refcount_bits + block_size =3D self.cluster_size * 8 // refcount_bits meta_data =3D self._get_metadata() if len(self.data_clusters) =3D=3D 0: # All metadata for an empty guest image needs 4 clusters: @@ -452,8 +452,8 @@ class Image(object): rfc_blocks =3D [] =20 for cluster in sorted(self.data_clusters | meta_data): - if cluster / block_size !=3D block_id: - block_id =3D cluster / block_size + if cluster // block_size !=3D block_id: + block_id =3D cluster // block_size block_cluster =3D block_clusters[block_ids.index(block_id)] rfc_table.append(create_table_entry(table_offset, block_cluster, @@ -587,7 +587,7 @@ class Image(object): def _alloc_data(img_size, cluster_size): """Return a set of random indices of clusters allocated for guest = data. """ - num_of_cls =3D img_size/cluster_size + num_of_cls =3D img_size // cluster_size return set(random.sample(range(1, num_of_cls + 1), random.randint(0, num_of_cls))) =20 @@ -595,7 +595,7 @@ class Image(object): """Return indices of clusters allocated for image metadata.""" ids =3D set() for x in self: - ids.add(x.offset/self.cluster_size) + ids.add(x.offset // self.cluster_size) return ids =20 =20 --=20 2.23.0 From nobody Mon Apr 29 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572969127; cv=none; d=zoho.com; s=zohoarc; b=fG/4MDiEGlwriDnd+D9be3baksu8QwhU4in+qJUSvzuAvRk+MaBvrxljSMhGr540F2Y7QM+jWBbTK5jS2dgrSTWZf2c5UKWXl1fcT5WZbaWasMByMkJJDCDZ40ugUws4ROPKwMvDHETl4JQNVCjSe5Q8WGqPL3NS3wfBOh+34O8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572969127; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xqVtcEw030cWBKi4G/oHb1MwhDbny8Z9CDgObjufLLo=; b=WQR31AjwIhjRzQlnvVZFALdfiTsRVO/DGcA8TxECwaWzxzXNp1HBiDb3j4NaQyXfDf+IlaWuGpe3IeOkBctDc9qIq3FRZEJP9J+Kqehpw8q9JOvezfattQPKfwJLZMTpblLFuPQ7JRlqxLkppiz8aA5b5rNRMTsGPLb/aYYexRQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572969127014350.49805500252546; Tue, 5 Nov 2019 07:52:07 -0800 (PST) Received: from localhost ([::1]:45476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS17i-0003x5-4F for importer@patchew.org; Tue, 05 Nov 2019 10:52:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42331) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS106-0004QE-Tp for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS105-0002ZM-Qk for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:10 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:22972 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iS105-0002Yv-Mj for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:09 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-338--CFLquhaO-6qMugWq-lGQA-1; Tue, 05 Nov 2019 10:44:07 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 06A048017DE; Tue, 5 Nov 2019 15:44:06 +0000 (UTC) Received: from localhost (ovpn-116-232.ams2.redhat.com [10.36.116.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id D82C53C1D; Tue, 5 Nov 2019 15:43:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572968649; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xqVtcEw030cWBKi4G/oHb1MwhDbny8Z9CDgObjufLLo=; b=Xd61tXURkuXPiEbbf9FXTjB/mkNIMBB5IF3XM+reVfAF4QQ+90FyLo878djr3vYa7V3t5l y9JvwBhn2IQVFEyqlOPOS/tv9PBdebwsesvhO38Wkz0i+3mcFjZszrrsYdtQDs3sa9TAgB fE8uUGP0U1RrC/+yVATZ+qj5TWH9jw4= From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 04/11] image-fuzzer: Use io.StringIO Date: Tue, 5 Nov 2019 16:43:25 +0100 Message-Id: <20191105154332.181417-5-stefanha@redhat.com> In-Reply-To: <20191105154332.181417-1-stefanha@redhat.com> References: <20191105154332.181417-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: -CFLquhaO-6qMugWq-lGQA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , qemu-block@nongnu.org, John Snow , Stefan Hajnoczi , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost 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 Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20191016192430.25098-5-ehabkost@redhat.com Message-Id: <20191016192430.25098-5-ehabkost@redhat.com> Signed-off-by: Stefan Hajnoczi --- tests/image-fuzzer/runner.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/image-fuzzer/runner.py b/tests/image-fuzzer/runner.py index 95d84f38f3..94cab5bd93 100755 --- a/tests/image-fuzzer/runner.py +++ b/tests/image-fuzzer/runner.py @@ -28,7 +28,7 @@ import shutil from itertools import count import time import getopt -import StringIO +import io import resource =20 try: @@ -84,8 +84,12 @@ def run_app(fd, q_args): try: out, err =3D process.communicate() signal.alarm(0) - fd.write(out) - fd.write(err) + # fd is a text file, so we need to decode the process output before + # writing to it. + # We could be simply using the `errors` parameter of subprocess.Po= pen(), + # but this will be possible only after migrating to Python 3 + fd.write(out.decode(errors=3D'replace')) + fd.write(err.decode(errors=3D'replace')) fd.flush() return process.returncode =20 @@ -183,7 +187,7 @@ class TestEnv(object): MAX_BACKING_FILE_SIZE) * (1 << = 20) cmd =3D self.qemu_img + ['create', '-f', backing_file_fmt, backing_file_name, str(backing_file_size)] - temp_log =3D StringIO.StringIO() + temp_log =3D io.StringIO() retcode =3D run_app(temp_log, cmd) if retcode =3D=3D 0: temp_log.close() @@ -240,7 +244,7 @@ class TestEnv(object): "Backing file: %s\n" \ % (self.seed, " ".join(current_cmd), self.current_dir, backing_file_name) - temp_log =3D StringIO.StringIO() + temp_log =3D io.StringIO() try: retcode =3D run_app(temp_log, current_cmd) except OSError as e: --=20 2.23.0 From nobody Mon Apr 29 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572968820; cv=none; d=zoho.com; s=zohoarc; b=TN3Ls11wis4pB51HgskAMzaOAEWqOazwgQa4U1plBMlTyZzrYWlArwt433txKFJ8OhJY8ZPdrIq+nQfU7mqADiKdmUmCOQ+vqDJPmyKGIAHMnLb7+KihwvKIIc6kzcXjV0YHAGNR4i/0SvJh5hmdsvad/dluu8owEV6D1I3lLng= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572968820; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bEt00lAv8Ep2d6X5VSzu2CCmcWEUpHQPvLXXBfTH6WI=; b=Sx7RfFFryfxDTdOZNjYt7Qt1umYb+txsGpWD+n6jchSuXKhI2sBQtw80Ar7oXWibyf9aax5GpLnbTZvL41TNGNJ+YjKHvBQlrERXJcK18Q7Kf65a1NjypGLhFrNVYsS4NiM5nehQ1xwAHc7RGdiwwO5BaeCKVME4YTPYPuoC8vY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572968820481145.0249278493535; Tue, 5 Nov 2019 07:47:00 -0800 (PST) Received: from localhost ([::1]:45408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS12o-0006qS-GT for importer@patchew.org; Tue, 05 Nov 2019 10:46:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42439) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS10I-0004iO-Kt for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS10H-0002m5-K8 for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:22 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:60563 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iS10H-0002lq-BC for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:21 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-328-NwlKOxqCP6qpIx7djAC_3Q-1; Tue, 05 Nov 2019 10:44:17 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A43061800D4A; Tue, 5 Nov 2019 15:44:16 +0000 (UTC) Received: from localhost (ovpn-116-232.ams2.redhat.com [10.36.116.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51DE260CC0; Tue, 5 Nov 2019 15:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572968661; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bEt00lAv8Ep2d6X5VSzu2CCmcWEUpHQPvLXXBfTH6WI=; b=JZ7DE9mKqVKlkVin2Qr9RvQzoe8jpsNXUWnxzPsEnX+dPbsFJjAOQYK6cflJ5ViHQMwBVK IbgFtjw8BDpjOI5E1A+JohG/3HR0eJFRrrBOLbl5sDexkVcRlGU1hjbMRAITWRYcbooW6t rc78AllcyNTTIRXIYuKY2v7uZA4AypQ= From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 05/11] image-fuzzer: Use %r for all fiels at Field.__repr__() Date: Tue, 5 Nov 2019 16:43:26 +0100 Message-Id: <20191105154332.181417-6-stefanha@redhat.com> In-Reply-To: <20191105154332.181417-1-stefanha@redhat.com> References: <20191105154332.181417-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: NwlKOxqCP6qpIx7djAC_3Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , qemu-block@nongnu.org, John Snow , Stefan Hajnoczi , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost 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 Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20191016192430.25098-6-ehabkost@redhat.com Message-Id: <20191016192430.25098-6-ehabkost@redhat.com> Signed-off-by: Stefan Hajnoczi --- tests/image-fuzzer/qcow2/layout.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/image-fuzzer/qcow2/layout.py b/tests/image-fuzzer/qcow2/= layout.py index 6501c9fd4b..0adcbd448d 100644 --- a/tests/image-fuzzer/qcow2/layout.py +++ b/tests/image-fuzzer/qcow2/layout.py @@ -53,8 +53,8 @@ class Field(object): return iter([self.fmt, self.offset, self.value, self.name]) =20 def __repr__(self): - return "Field(fmt=3D'%s', offset=3D%d, value=3D%s, name=3D%s)" % \ - (self.fmt, self.offset, str(self.value), self.name) + return "Field(fmt=3D%r, offset=3D%r, value=3D%r, name=3D%r)" % \ + (self.fmt, self.offset, self.value, self.name) =20 =20 class FieldsList(object): --=20 2.23.0 From nobody Mon Apr 29 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572969223; cv=none; d=zoho.com; s=zohoarc; b=crMTbSmkMLWSLYussau0LfVh8v//RK3nIu6qZn7U3boh+Ar4V7PVhWZZr59TUV9pOOTOVPS2fE2qmDtZ9zM8TlKsV5O8bmSe7HNDqHI2vhHS7cu82s3EvL5Ux3/xEDzsPwWFRu5g4E5NbKWJrbRzssCq9ExLHGahVpLHfKaVX5Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572969223; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2peWpe8yZjTvWvIo/qzdltRAb37JmLexvToJHFRtHNQ=; b=VksYIIiuMadoEK20xy8iPP7mP58FX4P2js530ASpazUiU9oeniAvXtLfJjyRQ692Wpblwv8CLTEluhHCrSNskk2gS3NIgwtSqmlF+Ev0//zqe+I9NLu+CH1IcSO/WJ08VU/xM/arqk0bLW2vDdIAlkoY0XglpOM8Et2Oi/d11Fs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572969223941149.8435390634777; Tue, 5 Nov 2019 07:53:43 -0800 (PST) Received: from localhost ([::1]:45500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS19K-00061f-MA for importer@patchew.org; Tue, 05 Nov 2019 10:53:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42481) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS10W-0004u8-JN for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS10V-0002vQ-A5 for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:36 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:32474 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iS10U-0002tj-4w for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:35 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-345-B1FV7bHLN7OUwDKsXRwspQ-1; Tue, 05 Nov 2019 10:44:28 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 685531800D4A; Tue, 5 Nov 2019 15:44:27 +0000 (UTC) Received: from localhost (ovpn-116-232.ams2.redhat.com [10.36.116.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17469608AC; Tue, 5 Nov 2019 15:44:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572968672; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2peWpe8yZjTvWvIo/qzdltRAb37JmLexvToJHFRtHNQ=; b=e0aEcBU1fWRIZBlr4CRHezzDDmW0ZPbZpUKbzOBjO3sBBN56ySza6/FIemd9r4dAD94a/x vnLSCBTEyrj2OBQF/DKElPrywLwtvJoNdolh+4r0ZUcCJVneb9Q4Qebrd8OUCf1+4vXk3C v3wsVQzsq03trdSUKQ+yQVTeJn049tI= From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 06/11] image-fuzzer: Return bytes objects on string fuzzing functions Date: Tue, 5 Nov 2019 16:43:27 +0100 Message-Id: <20191105154332.181417-7-stefanha@redhat.com> In-Reply-To: <20191105154332.181417-1-stefanha@redhat.com> References: <20191105154332.181417-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: B1FV7bHLN7OUwDKsXRwspQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , qemu-block@nongnu.org, John Snow , Stefan Hajnoczi , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost No caller of fuzzer functions is interested in unicode string values, so replace them with bytes sequences. Signed-off-by: Eduardo Habkost Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20191016192430.25098-7-ehabkost@redhat.com Message-Id: <20191016192430.25098-7-ehabkost@redhat.com> Signed-off-by: Stefan Hajnoczi --- tests/image-fuzzer/qcow2/fuzz.py | 42 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/image-fuzzer/qcow2/fuzz.py b/tests/image-fuzzer/qcow2/fu= zz.py index 154dc06cc0..c58bf11005 100644 --- a/tests/image-fuzzer/qcow2/fuzz.py +++ b/tests/image-fuzzer/qcow2/fuzz.py @@ -36,11 +36,11 @@ UINT32_V =3D [0, 0x100, 0x1000, 0x10000, 0x100000, UINT= 32//4, UINT32//2 - 1, UINT64_V =3D UINT32_V + [0x1000000, 0x10000000, 0x100000000, UINT64//4, UINT64//2 - 1, UINT64//2, UINT64//2 + 1, UINT64 - 1, UINT64] -STRING_V =3D ['%s%p%x%d', '.1024d', '%.2049d', '%p%p%p%p', '%x%x%x%x', - '%d%d%d%d', '%s%s%s%s', '%99999999999s', '%08x', '%%20d', '%%2= 0n', - '%%20x', '%%20s', '%s%s%s%s%s%s%s%s%s%s', '%p%p%p%p%p%p%p%p%p%= p', - '%#0123456x%08x%x%s%p%d%n%o%u%c%h%l%q%j%z%Z%t%i%e%g%f%a%C%S%08= x%%', - '%s x 129', '%x x 257'] +BYTES_V =3D [b'%s%p%x%d', b'.1024d', b'%.2049d', b'%p%p%p%p', b'%x%x%x%x', + b'%d%d%d%d', b'%s%s%s%s', b'%99999999999s', b'%08x', b'%%20d', = b'%%20n', + b'%%20x', b'%%20s', b'%s%s%s%s%s%s%s%s%s%s', b'%p%p%p%p%p%p%p%p= %p%p', + b'%#0123456x%08x%x%s%p%d%n%o%u%c%h%l%q%j%z%Z%t%i%e%g%f%a%C%S%08= x%%', + b'%s x 129', b'%x x 257'] =20 =20 def random_from_intervals(intervals): @@ -76,12 +76,12 @@ def random_bits(bit_ranges): return val =20 =20 -def truncate_string(strings, length): - """Return strings truncated to specified length.""" - if type(strings) =3D=3D list: - return [s[:length] for s in strings] +def truncate_bytes(sequences, length): + """Return sequences truncated to specified length.""" + if type(sequences) =3D=3D list: + return [s[:length] for s in sequences] else: - return strings[:length] + return sequences[:length] =20 =20 def validator(current, pick, choices): @@ -110,12 +110,12 @@ def bit_validator(current, bit_ranges): return validator(current, random_bits, bit_ranges) =20 =20 -def string_validator(current, strings): - """Return a random string value from the list not equal to the current. +def bytes_validator(current, sequences): + """Return a random bytes value from the list not equal to the current. =20 This function is useful for selection from valid values except current= one. """ - return validator(current, random.choice, strings) + return validator(current, random.choice, sequences) =20 =20 def selector(current, constraints, validate=3Dint_validator): @@ -283,9 +283,9 @@ def header_length(current): def bf_name(current): """Fuzz the backing file name.""" constraints =3D [ - truncate_string(STRING_V, len(current)) + truncate_bytes(BYTES_V, len(current)) ] - return selector(current, constraints, string_validator) + return selector(current, constraints, bytes_validator) =20 =20 def ext_magic(current): @@ -303,10 +303,10 @@ def ext_length(current): def bf_format(current): """Fuzz backing file format in the corresponding header extension.""" constraints =3D [ - truncate_string(STRING_V, len(current)), - truncate_string(STRING_V, (len(current) + 7) & ~7) # Fuzz padding + truncate_bytes(BYTES_V, len(current)), + truncate_bytes(BYTES_V, (len(current) + 7) & ~7) # Fuzz padding ] - return selector(current, constraints, string_validator) + return selector(current, constraints, bytes_validator) =20 =20 def feature_type(current): @@ -324,10 +324,10 @@ def feature_bit_number(current): def feature_name(current): """Fuzz feature name field of a feature name table header extension.""" constraints =3D [ - truncate_string(STRING_V, len(current)), - truncate_string(STRING_V, 46) # Fuzz padding (field length =3D 46) + truncate_bytes(BYTES_V, len(current)), + truncate_bytes(BYTES_V, 46) # Fuzz padding (field length =3D 46) ] - return selector(current, constraints, string_validator) + return selector(current, constraints, bytes_validator) =20 =20 def l1_entry(current): --=20 2.23.0 From nobody Mon Apr 29 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572969128; cv=none; d=zoho.com; s=zohoarc; b=CXYD2kqZGLXnOtC3a+jFLPOuigRQH9EodMkMhppX+GOyvFXV+qgQGpmLQHn5wmgFSZ5DZs/sdeZmqK2cuM6csopsQLxlt1Y+zopIwVPi8BQgfFdu1MaHwau2W80j6XRc97GVD/IfZto/9HRIYEcII+7oTh3WZCF3ck253NgQqP4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572969128; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cydLyk85Sj0wvc752K2r6gUg4BKM93PS+YG8bQ6GRsw=; b=h9+cyNLVqQ3RpsgRsA22NIAH4E4H6PgBnbMO8YaGe7c1ZpiGv62WmfP+97DrghdB/xFw2Ya3AIfgtUu8nDFdP2vCGIAf+utPdmBN4asAnMAOfS0RM3ArFd133g/jMQgZgUHnMI6lT1280gAhxl9QIvkU6ocHNG0uF/ymePhuDx8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572969128433578.9059842690285; Tue, 5 Nov 2019 07:52:08 -0800 (PST) Received: from localhost ([::1]:45478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS17m-00045A-EA for importer@patchew.org; Tue, 05 Nov 2019 10:52:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42538) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS10i-0005F1-93 for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS10g-00030G-6k for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:48 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:45073) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iS10g-00030A-3v for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:46 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-17-NQCZm5i7OUCbbnV_Gjb65g-1; Tue, 05 Nov 2019 10:44:40 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B96491005500; Tue, 5 Nov 2019 15:44:39 +0000 (UTC) Received: from localhost (ovpn-116-232.ams2.redhat.com [10.36.116.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id A96F010018FF; Tue, 5 Nov 2019 15:44:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572968685; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cydLyk85Sj0wvc752K2r6gUg4BKM93PS+YG8bQ6GRsw=; b=Vx+k2dBlQ3oV/pf6KJJC99IHbi5CP064hfAOj/ZyRiBxeOv0m6WwdIF5vUJCCKS1R/mn6y IUcLrEeIBLbHF90jAa2BKFoiYWulms69CSQR/ZirIoGo9nsaP1rJw7XJsWW9D42Zfyupkq Wq6nBaPZg+3ni0cSz6xDSTDrHoI0qHo= From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 07/11] image-fuzzer: Use bytes constant for field values Date: Tue, 5 Nov 2019 16:43:28 +0100 Message-Id: <20191105154332.181417-8-stefanha@redhat.com> In-Reply-To: <20191105154332.181417-1-stefanha@redhat.com> References: <20191105154332.181417-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: NQCZm5i7OUCbbnV_Gjb65g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , qemu-block@nongnu.org, John Snow , Stefan Hajnoczi , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost Field values are supposed to be bytes objects, not unicode strings. Change two constants that were declared as strings. Signed-off-by: Eduardo Habkost Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20191016192430.25098-8-ehabkost@redhat.com Message-Id: <20191016192430.25098-8-ehabkost@redhat.com> Signed-off-by: Stefan Hajnoczi --- tests/image-fuzzer/qcow2/layout.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/image-fuzzer/qcow2/layout.py b/tests/image-fuzzer/qcow2/= layout.py index 0adcbd448d..a0fd53c7ad 100644 --- a/tests/image-fuzzer/qcow2/layout.py +++ b/tests/image-fuzzer/qcow2/layout.py @@ -122,7 +122,7 @@ class Image(object): def create_header(self, cluster_bits, backing_file_name=3DNone): """Generate a random valid header.""" meta_header =3D [ - ['>4s', 0, "QFI\xfb", 'magic'], + ['>4s', 0, b"QFI\xfb", 'magic'], ['>I', 4, random.randint(2, 3), 'version'], ['>Q', 8, 0, 'backing_file_offset'], ['>I', 16, 0, 'backing_file_size'], @@ -231,7 +231,7 @@ class Image(object): feature_tables =3D [] feature_ids =3D [] inner_offset =3D self.ext_offset + ext_header_len - feat_name =3D 'some cool feature' + feat_name =3D b'some cool feature' while len(feature_tables) < num_fnt_entries * 3: feat_type, feat_bit =3D gen_feat_ids() # Remove duplicates --=20 2.23.0 From nobody Mon Apr 29 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572968982; cv=none; d=zoho.com; s=zohoarc; b=V1cTXbUIhYEPLN706FpyNDiIUbzRTLhHhHccFUPXDDsdhr5FurGWcTXZCblkaDtJOsuQwQ5RadQEwI5N56mPqnvXRri55wOn2qmpzSIqcDZY/sAkWdwS0oD9ZjqzhoBNY9ouwnwNdTvqgjMAfDigHqh0b41w87/dCt4WMVibnrQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572968982; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3DKPxdw6qHaFVawTqd0tHOb4vypfDV7Nb+1FQkqRD54=; b=Qb9XkkTq/rqReDukrJHL2kI96RCu8DY8zNoXY+yyvJKHp9FNUSOKT7klkcFCD8mFJeY1jg6bpNIii1EwxOBts4Ds3Zq4whthpo1ULtC8gO4pd32QPeGpdOPfziagaxpX9v4e1EsjO2Iecfuq5Qo/K0xdHq2OKUn+udSS2tlL9Rc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572968982486669.2214191398236; Tue, 5 Nov 2019 07:49:42 -0800 (PST) Received: from localhost ([::1]:45452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS15R-0001KS-9V for importer@patchew.org; Tue, 05 Nov 2019 10:49:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42577) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS10r-0005Th-2P for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS10q-00033z-0q for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:56 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:40947 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iS10p-00033r-U0 for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:44:55 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-284-j2qc4dGrME6DkcoU4-v1Xw-1; Tue, 05 Nov 2019 10:44:51 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E38E91005500; Tue, 5 Nov 2019 15:44:49 +0000 (UTC) Received: from localhost (ovpn-116-232.ams2.redhat.com [10.36.116.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2207D600C4; Tue, 5 Nov 2019 15:44:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572968695; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3DKPxdw6qHaFVawTqd0tHOb4vypfDV7Nb+1FQkqRD54=; b=O+BTyNFSxl5G3IpMLOcFyLFfHVsuLPFZJw9BKneddx0of2GuDSMWJ0IslHN1P+8uvhg29h Qm240EfODnkpJGJ8xZ9Ydz7JfebeVJhLw1fFDVKQ7XLToQ0NPx2qnnJykGWK1YYH95wjFF Wd/TfEzWmlnAiZF2hR92XqOALC4EYIk= From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 08/11] image-fuzzer: Encode file name and file format to bytes Date: Tue, 5 Nov 2019 16:43:29 +0100 Message-Id: <20191105154332.181417-9-stefanha@redhat.com> In-Reply-To: <20191105154332.181417-1-stefanha@redhat.com> References: <20191105154332.181417-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: j2qc4dGrME6DkcoU4-v1Xw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , qemu-block@nongnu.org, John Snow , Stefan Hajnoczi , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost 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 Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20191016192430.25098-9-ehabkost@redhat.com Message-Id: <20191016192430.25098-9-ehabkost@redhat.com> Signed-off-by: Stefan Hajnoczi --- tests/image-fuzzer/qcow2/layout.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/image-fuzzer/qcow2/layout.py b/tests/image-fuzzer/qcow2/= layout.py index a0fd53c7ad..01bff4d05e 100644 --- a/tests/image-fuzzer/qcow2/layout.py +++ b/tests/image-fuzzer/qcow2/layout.py @@ -602,8 +602,8 @@ class Image(object): def create_image(test_img_path, backing_file_name=3DNone, backing_file_fmt= =3DNone, fields_to_fuzz=3DNone): """Create a fuzzed image and write it to the specified file.""" - image =3D Image(backing_file_name) - image.set_backing_file_format(backing_file_fmt) + image =3D Image(backing_file_name.encode()) + image.set_backing_file_format(backing_file_fmt.encode()) image.create_feature_name_table() image.set_end_of_extension_area() image.create_l_structures() --=20 2.23.0 From nobody Mon Apr 29 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572969392; cv=none; d=zoho.com; s=zohoarc; b=hTHxJ+Hy3wiWb6wmCJnk9EAwNuMBOXoedPs/l0Ihf5CH15HkwpEp0L5w4SofwUp0/e+LJS2irrO8lBtcY1pX2KxJK5kx58Z9ydt6CKPGGRox72DET7bVipdlKdqTTtysiI+kMZpm1mUsnhA3mfTe1bCSH9EfsfOOCyq5lWC8DCk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572969392; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=of2jOjGBNqbSHc+4D9qC9W0BhVuS1WGPzMhVsgmwVQg=; b=KzPyElllbMSAFDqKmf4A4rHza4YdrKmtOXubKg33Q7k7jirKDhnWD/vgPTiTNRENUQ/TczAMoyeJX+hT+lNMxFmB7CQEZGU6kXPkGAh9xK+6GFUbOj9q61zG2YCSQX229uHWhl4DNFy6sC5SUuKUz3/SUowSwqNkFnTR/8i1gzs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572969392557701.1879374624133; Tue, 5 Nov 2019 07:56:32 -0800 (PST) Received: from localhost ([::1]:45550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS1C3-0000qT-IH for importer@patchew.org; Tue, 05 Nov 2019 10:56:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42643) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS111-0005iv-3s for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:45:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS10z-00039i-TH for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:45:06 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:30930 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iS10z-000399-Pd for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:45:05 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-312-i9zF3yJ3OGawer8ccnookw-1; Tue, 05 Nov 2019 10:45:01 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A3D8E800C73; Tue, 5 Nov 2019 15:45:00 +0000 (UTC) Received: from localhost (ovpn-116-232.ams2.redhat.com [10.36.116.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 479725C240; Tue, 5 Nov 2019 15:44:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572968705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=of2jOjGBNqbSHc+4D9qC9W0BhVuS1WGPzMhVsgmwVQg=; b=DYL+DwFM1/Ov4D/UiZe0gwZxQHVRysK9CnnXdk9YuVT6qI9raACbxSTAjEpoTKNG71UL+5 fRWaYD75gLrZc2joecosfpKidCtmbnPESY3PP5O+mPS5rBGCO370azD0uSHgOY6Gg7/RsX OCNS98uMbjdvVaxkWeHuevY+ufh3cww= From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 09/11] image-fuzzer: Run using python3 Date: Tue, 5 Nov 2019 16:43:30 +0100 Message-Id: <20191105154332.181417-10-stefanha@redhat.com> In-Reply-To: <20191105154332.181417-1-stefanha@redhat.com> References: <20191105154332.181417-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: i9zF3yJ3OGawer8ccnookw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , qemu-block@nongnu.org, John Snow , Stefan Hajnoczi , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost 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 Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20191016192430.25098-10-ehabkost@redhat.com Message-Id: <20191016192430.25098-10-ehabkost@redhat.com> Signed-off-by: Stefan Hajnoczi --- tests/image-fuzzer/qcow2/__init__.py | 1 - tests/image-fuzzer/qcow2/layout.py | 1 - tests/image-fuzzer/runner.py | 3 +-- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/image-fuzzer/qcow2/__init__.py b/tests/image-fuzzer/qcow= 2/__init__.py index 09ef59821b..ed3af5da86 100644 --- a/tests/image-fuzzer/qcow2/__init__.py +++ b/tests/image-fuzzer/qcow2/__init__.py @@ -1,2 +1 @@ -from __future__ import absolute_import from .layout import create_image diff --git a/tests/image-fuzzer/qcow2/layout.py b/tests/image-fuzzer/qcow2/= layout.py index 01bff4d05e..57ebe86e9a 100644 --- a/tests/image-fuzzer/qcow2/layout.py +++ b/tests/image-fuzzer/qcow2/layout.py @@ -16,7 +16,6 @@ # along with this program. If not, see . # =20 -from __future__ import absolute_import import random import struct from . import fuzz diff --git a/tests/image-fuzzer/runner.py b/tests/image-fuzzer/runner.py index 94cab5bd93..0793234815 100755 --- a/tests/image-fuzzer/runner.py +++ b/tests/image-fuzzer/runner.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 =20 # Tool for running fuzz tests # @@ -18,7 +18,6 @@ # along with this program. If not, see . # =20 -from __future__ import print_function import sys import os import signal --=20 2.23.0 From nobody Mon Apr 29 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572969527; cv=none; d=zoho.com; s=zohoarc; b=EZPGvcZBpZsaBpp2gFXINhBLz2U+kBvzuSDaPh1ScyEj3NHeZHSAgxHxivYvXlsLt7rvmhlb70h7DQe+1tPZNCStvBe17jyjSQbgg7RFaoMqltzzvX1aFKEk2r3Lbq77NMp0HRB3bwZCuTWEBExPsMaLg0pO3+j/TGIXsY0hFXg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572969527; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XYd+75Vh0I232tRLHYDQp9fs9znMgSMu5CD/SE4v7qE=; b=Jp22NsLdfYOyafprDtADz1IeZ3bzVUeW2jmIPSykvNyVg3W/5qucFKRusBbM+nxl2JN7Zm3M0n9MEczYYPYielSNf6LBUr9eIybtAW4KSvhKXcbSvEB+DbGke8HNrjVHpslsyza0wcc80eK7pK+AgDwYi1JKh9eA/S/4tjBuUIE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572969527138669.1649945034351; Tue, 5 Nov 2019 07:58:47 -0800 (PST) Received: from localhost ([::1]:45570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS1EB-0002AC-BT for importer@patchew.org; Tue, 05 Nov 2019 10:58:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42727) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS11L-00060k-E1 for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:45:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS11F-0003dX-D8 for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:45:27 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:24293 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iS11D-0003c7-FV for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:45:21 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-262-nD2KBzB7MliR3hgUDDpJmw-1; Tue, 05 Nov 2019 10:45:15 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 14A72477; Tue, 5 Nov 2019 15:45:14 +0000 (UTC) Received: from localhost (ovpn-116-232.ams2.redhat.com [10.36.116.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B80F5D9CD; Tue, 5 Nov 2019 15:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572968718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XYd+75Vh0I232tRLHYDQp9fs9znMgSMu5CD/SE4v7qE=; b=iIcfbYeenKzxAvWD24OA1j+SR5CAa3+xLSPcP4CUutOaG/BTzBMNsfliRBuobxCBK6mHVh UdJFEqW/6DbncaJtbcu3xLkxz9NrZP31AK98VnFd4rBLAAZ+4qykplp7M4koS86RKW3aMZ MrLQgtfm/clUQ075oSfNi+D+DkOh0O8= From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 10/11] image-fuzzer: Use errors parameter of subprocess.Popen() Date: Tue, 5 Nov 2019 16:43:31 +0100 Message-Id: <20191105154332.181417-11-stefanha@redhat.com> In-Reply-To: <20191105154332.181417-1-stefanha@redhat.com> References: <20191105154332.181417-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: nD2KBzB7MliR3hgUDDpJmw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , qemu-block@nongnu.org, John Snow , Stefan Hajnoczi , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost 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 Reviewed-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20191016192430.25098-11-ehabkost@redhat.com Message-Id: <20191016192430.25098-11-ehabkost@redhat.com> Signed-off-by: Stefan Hajnoczi --- tests/image-fuzzer/runner.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/image-fuzzer/runner.py b/tests/image-fuzzer/runner.py index 0793234815..4ba5c79e13 100755 --- a/tests/image-fuzzer/runner.py +++ b/tests/image-fuzzer/runner.py @@ -79,16 +79,13 @@ def run_app(fd, q_args): devnull =3D open('/dev/null', 'r+') process =3D subprocess.Popen(q_args, stdin=3Ddevnull, stdout=3Dsubprocess.PIPE, - stderr=3Dsubprocess.PIPE) + stderr=3Dsubprocess.PIPE, + errors=3D'replace') try: out, err =3D process.communicate() signal.alarm(0) - # fd is a text file, so we need to decode the process output before - # writing to it. - # We could be simply using the `errors` parameter of subprocess.Po= pen(), - # but this will be possible only after migrating to Python 3 - fd.write(out.decode(errors=3D'replace')) - fd.write(err.decode(errors=3D'replace')) + fd.write(out) + fd.write(err) fd.flush() return process.returncode =20 --=20 2.23.0 From nobody Mon Apr 29 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572969585; cv=none; d=zoho.com; s=zohoarc; b=BuoTO8V+LVri+Q7GwwvPMIEjFks3DKHelsw6bwkATh3gjLMwaNHG4kHUBjyM6KBjM0bgUffWc/q2JykZIxi2eKVDMv8xAYKXYg7HUgxnZFhLJMea8wI2xsDeMmUb71KzTv3O83xBjHUAgY15QBURXsnOWhKVywRjIFSsqYdniY4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572969585; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AKM8W1QDhe+Ko7FQWFoET2okeRRcRxdf0Ap8y4ZAO3M=; b=ZARXpffuvO53Qr+TKNOwKx8zwM4iABP1SS5ZDo7Q78wMdQL97+wz6S9M+PFJzsi6Iva0wWdtkkJO78b6QfnZD/8Wi7qIeVyzJ4KBCzPZNi7G07gNSElIVeobihx1NhoCqlZNvDRCe/jDJOHnG4nTPgsx14GDn3gK4cWkTiP/VIY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572969585761770.0880502464695; Tue, 5 Nov 2019 07:59:45 -0800 (PST) Received: from localhost ([::1]:45576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS1F9-00034T-Rj for importer@patchew.org; Tue, 05 Nov 2019 10:59:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42740) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS11N-00062J-Dp for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:45:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS11L-0003gP-Ak for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:45:29 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:57461 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iS11J-0003f7-Bc for qemu-devel@nongnu.org; Tue, 05 Nov 2019 10:45:25 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-46-BVsuxyaEPd2lYgZ2pWlSdA-1; Tue, 05 Nov 2019 10:45:22 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB8A8107ACC4; Tue, 5 Nov 2019 15:45:21 +0000 (UTC) Received: from localhost (ovpn-116-232.ams2.redhat.com [10.36.116.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B251600C6; Tue, 5 Nov 2019 15:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572968724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AKM8W1QDhe+Ko7FQWFoET2okeRRcRxdf0Ap8y4ZAO3M=; b=Ql2/y39KE+OWVJXUiKpA9oz9l9XTtKeFH8c4AP9Tho/iakky1n8FY3DScLts1LXMP8pfEA PCNcU6i0etg/isiwRUMr58b/uLpq0ePfv/DHMAaHNZyRBbYvjt3pB95FPlx7L4v8fVsfZO pkJHHDc8t54EnyZEHHPq4qBzXEdizyI= From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 11/11] image-fuzzer: Use OSerror.strerror instead of tuple subscript Date: Tue, 5 Nov 2019 16:43:32 +0100 Message-Id: <20191105154332.181417-12-stefanha@redhat.com> In-Reply-To: <20191105154332.181417-1-stefanha@redhat.com> References: <20191105154332.181417-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: BVsuxyaEPd2lYgZ2pWlSdA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , John Snow , qemu-block@nongnu.org, Stefan Hajnoczi , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost 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 Signed-off-by: Eduardo Habkost Reviewed-by: John Snow Message-id: 20191021214117.18091-1-ehabkost@redhat.com Message-Id: <20191021214117.18091-1-ehabkost@redhat.com> Signed-off-by: Stefan Hajnoczi --- tests/image-fuzzer/runner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/image-fuzzer/runner.py b/tests/image-fuzzer/runner.py index 4ba5c79e13..2fc010fd9d 100755 --- a/tests/image-fuzzer/runner.py +++ b/tests/image-fuzzer/runner.py @@ -159,7 +159,7 @@ class TestEnv(object): os.makedirs(self.current_dir) except OSError as e: print("Error: The working directory '%s' cannot be used. Reaso= n: %s"\ - % (self.work_dir, e[1]), file=3Dsys.stderr) + % (self.work_dir, e.strerror), file=3Dsys.stderr) raise TestException self.log =3D open(os.path.join(self.current_dir, "test.log"), "w") self.parent_log =3D open(run_log, "a") @@ -246,7 +246,7 @@ class TestEnv(object): except OSError as e: multilog("%sError: Start of '%s' failed. Reason: %s\n\n" % (test_summary, os.path.basename(current_cmd[0]), - e[1]), + e.strerror), sys.stderr, self.log, self.parent_log) raise TestException =20 --=20 2.23.0