From nobody Sun Oct 5 17:34:19 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521492748953351.064743278828; Mon, 19 Mar 2018 13:52:28 -0700 (PDT) Received: from localhost ([::1]:43854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey1lc-0000Yg-7Z for importer@patchew.org; Mon, 19 Mar 2018 16:52:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey1k0-00084m-4h for qemu-devel@nongnu.org; Mon, 19 Mar 2018 16:50:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ey1jx-0003GD-Hm for qemu-devel@nongnu.org; Mon, 19 Mar 2018 16:50:48 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41330 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ey1jx-0003Fj-Ax for qemu-devel@nongnu.org; Mon, 19 Mar 2018 16:50:45 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A2D8D406805B; Mon, 19 Mar 2018 20:50:44 +0000 (UTC) Received: from red.redhat.com (ovpn-121-135.rdu2.redhat.com [10.10.121.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 477A82022C00; Mon, 19 Mar 2018 20:50:44 +0000 (UTC) From: Eric Blake To: qemu-devel@nongnu.org Date: Mon, 19 Mar 2018 15:50:40 -0500 Message-Id: <20180319205040.1113423-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 19 Mar 2018 20:50:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 19 Mar 2018 20:50:44 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eblake@redhat.com' RCPT:'' 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: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-2.12] qapi: Force UTF8 encoding when parsing qapi files X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit d4e5ec877 already fixed things to work around Python 3's lame bug of having LC_ALL=3DC not be 8-bit clean, when parsing the main QMP qapi files; but failed to do likewise in the tests directory. As a result, running 'LC_ALL=3DC make check' fails on escape-too-big and unicode-str when using python 3 with a nasty stack trace instead of the intended graceful error message that QAPI doesn't yet support 8-bit data (the two tests contain Unicode =C3=A9, when parsed in UTF-8; they represent something different when parsed in a proper single-byte C locale, but that doesn't matter to the error message printed out, provided that brain-dead Python hasn't first choked on the input instead of being 8-bit clean). Ideally, we'd teach the qapi generator scripts to automatically slurp things in using UTF-8 regardless of locale, and to honor content that is not limited to 7 bit data rather than gracefully erroring out; but until then, since our graceful error depends on python parsing 8-bit data (even if nothing we generate uses 8-bit data), our quick fix is to use the right locale when running these tests. Reported-by: Peter Maydell Signed-off-by: Eric Blake Reviewed-by: Daniel P. Berrang=C3=A9 --- Will go through my QAPI tree for post-freeze bug fixes tests/Makefile.include | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 412aed1737f..ea1f1bf0965 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -668,13 +668,13 @@ tests/test-qapi-events.c tests/test-qapi-events.h \ tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \ tests/test-qapi-gen-timestamp ; tests/test-qapi-gen-timestamp: $(SRC_PATH)/tests/qapi-schema/qapi-schema-t= est.json $(qapi-py) - $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \ + $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \ -o tests -p "test-" $<, \ "GEN","$(@:%-timestamp=3D%)") @>$@ tests/qapi-schema/doc-good.test.texi: $(SRC_PATH)/tests/qapi-schema/doc-go= od.json $(qapi-py) - $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \ + $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \ -o tests/qapi-schema -p "doc-good-" $<, \ "GEN","$@") @mv tests/qapi-schema/doc-good-qapi-doc.texi $@ @@ -925,7 +925,7 @@ check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-q= uick.sh qemu-img$(EXESUF) .PHONY: $(patsubst %, check-%, $(check-qapi-schema-y)) $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/= %.json $(call quiet-command, PYTHONPATH=3D$(SRC_PATH)/scripts \ - $(PYTHON) $(SRC_PATH)/tests/qapi-schema/test-qapi.py \ + $(PYTHON_UTF8) $(SRC_PATH)/tests/qapi-schema/test-qapi.py \ $^ >$*.test.out 2>$*.test.err; \ echo $$? >$*.test.exit, \ "TEST","$*.out") --=20 2.14.3