[{"id":1765187,"web_url":"http://patchwork.ozlabs.org/comment/1765187/","msgid":"<87377xilxw.fsf@dusky.pond.sub.org>","list_archive_url":null,"date":"2017-09-08T09:22:51","subject":"Re: [Qemu-devel] [PATCH v3 7/7] Convert remaining single line\n\tfprintf() to warn_report()","submitter":{"id":2645,"url":"http://patchwork.ozlabs.org/api/people/2645/","name":"Markus Armbruster","email":"armbru@redhat.com"},"content":"Alistair Francis <alistair.francis@xilinx.com> writes:\n\n> Convert any remaining uses of fprintf(stderr, \"warning:\"...\n> to use warn_report() instead. This helps standardise on a single\n> method of printing warnings to the user.\n>\n> All of the warnings were changed using this command:\n>   find ./* -type f -exec sed -i 's|fprintf(.*\".*warning[,:] |warn_report(\"|Ig' {} +\n>\n> The #include line and the chagne to the test Makefile were manually\n\ns/chagne/change/\n\n> updated to allow the code to compile.\n>\n> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>\n> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n> ---\n>\n> This pattern matches any case of fprintf(stderr, \"warning:\"... and is\n> the most open pattern match in the series.\n>\n>\n>  tests/Makefile.include | 2 +-\n>  util/cutils.c          | 3 ++-\n>  2 files changed, 3 insertions(+), 2 deletions(-)\n>\n> diff --git a/tests/Makefile.include b/tests/Makefile.include\n> index 80527a8763..91d5a4544f 100644\n> --- a/tests/Makefile.include\n> +++ b/tests/Makefile.include\n> @@ -584,7 +584,7 @@ tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y)\n>  tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y) $(test-crypto-obj-y)\n>  tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o\n>  tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-util-obj-y)\n> -tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o\n> +tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o $(test-util-obj-y)\n>  tests/test-int128$(EXESUF): tests/test-int128.o\n>  tests/rcutorture$(EXESUF): tests/rcutorture.o $(test-util-obj-y)\n>  tests/test-rcu-list$(EXESUF): tests/test-rcu-list.o $(test-util-obj-y)\n> diff --git a/util/cutils.c b/util/cutils.c\n> index 1534682083..b33ede83d1 100644\n> --- a/util/cutils.c\n> +++ b/util/cutils.c\n> @@ -30,6 +30,7 @@\n>  #include \"qemu/iov.h\"\n>  #include \"net/net.h\"\n>  #include \"qemu/cutils.h\"\n> +#include \"qemu/error-report.h\"\n>  \n>  void strpadcpy(char *buf, int buf_size, const char *str, char pad)\n>  {\n> @@ -601,7 +602,7 @@ int parse_debug_env(const char *name, int max, int initial)\n>          return initial;\n>      }\n>      if (debug < 0 || debug > max || errno != 0) {\n> -        fprintf(stderr, \"warning: %s not in [0, %d]\", name, max);\n> +        warn_report(\"%s not in [0, %d]\", name, max);\n>          return initial;\n>      }\n>      return debug;\n\nJust one?  That's a bit of an anti-climax after the commit message :)\n\nI don't understand why this can't be in PATCH 3 (of course PATCH 6 has\nto go before 3 then).  Not important.\n\nWith the commit message typo fixed:\nReviewed-by: Markus Armbruster <armbru@redhat.com>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=armbru@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xpX3F4GG1z9rxm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Sep 2017 19:24:57 +1000 (AEST)","from localhost ([::1]:44069 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dqFWx-0003Ru-Iv\n\tfor incoming@patchwork.ozlabs.org; Fri, 08 Sep 2017 05:24:55 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:55203)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <armbru@redhat.com>) id 1dqFV5-0002T4-97\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 05:23:04 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <armbru@redhat.com>) id 1dqFV0-0006Ff-Ch\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 05:22:59 -0400","from mx1.redhat.com ([209.132.183.28]:38196)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <armbru@redhat.com>) id 1dqFV0-0006Ey-4v\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 05:22:54 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 2E5A3806A2;\n\tFri,  8 Sep 2017 09:22:53 +0000 (UTC)","from blackfin.pond.sub.org (ovpn-116-75.ams2.redhat.com\n\t[10.36.116.75])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id E4C2B600C0;\n\tFri,  8 Sep 2017 09:22:52 +0000 (UTC)","by blackfin.pond.sub.org (Postfix, from userid 1000)\n\tid 6D6951138645; Fri,  8 Sep 2017 11:22:51 +0200 (CEST)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 2E5A3806A2","From":"Markus Armbruster <armbru@redhat.com>","To":"Alistair Francis <alistair.francis@xilinx.com>","References":"<cover.1504228916.git.alistair.francis@xilinx.com>\n\t<852ce10cbd36276fe5207539cd2dcd77aac6c938.1504228916.git.alistair.francis@xilinx.com>","Date":"Fri, 08 Sep 2017 11:22:51 +0200","In-Reply-To":"<852ce10cbd36276fe5207539cd2dcd77aac6c938.1504228916.git.alistair.francis@xilinx.com>\n\t(Alistair Francis's message of \"Fri, 1 Sep 2017 09:51:27 -0700\")","Message-ID":"<87377xilxw.fsf@dusky.pond.sub.org>","User-Agent":"Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.26]);\n\tFri, 08 Sep 2017 09:22:53 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v3 7/7] Convert remaining single line\n\tfprintf() to warn_report()","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"alistair23@gmail.com, qemu-devel@nongnu.org, pbonzini@redhat.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1765504,"web_url":"http://patchwork.ozlabs.org/comment/1765504/","msgid":"<CAKmqyKO8=xFjPPOk29ChBXrQYpFw_Q7f1xLbdEJf8ZO7NC1uAQ@mail.gmail.com>","list_archive_url":null,"date":"2017-09-08T16:38:49","subject":"Re: [Qemu-devel] [PATCH v3 7/7] Convert remaining single line\n\tfprintf() to warn_report()","submitter":{"id":47878,"url":"http://patchwork.ozlabs.org/api/people/47878/","name":"Alistair Francis","email":"alistair.francis@xilinx.com"},"content":"On Fri, Sep 8, 2017 at 2:22 AM, Markus Armbruster <armbru@redhat.com> wrote:\n> Alistair Francis <alistair.francis@xilinx.com> writes:\n>\n>> Convert any remaining uses of fprintf(stderr, \"warning:\"...\n>> to use warn_report() instead. This helps standardise on a single\n>> method of printing warnings to the user.\n>>\n>> All of the warnings were changed using this command:\n>>   find ./* -type f -exec sed -i 's|fprintf(.*\".*warning[,:] |warn_report(\"|Ig' {} +\n>>\n>> The #include line and the chagne to the test Makefile were manually\n>\n> s/chagne/change/\n>\n>> updated to allow the code to compile.\n>>\n>> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>\n>> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n>> ---\n>>\n>> This pattern matches any case of fprintf(stderr, \"warning:\"... and is\n>> the most open pattern match in the series.\n>>\n>>\n>>  tests/Makefile.include | 2 +-\n>>  util/cutils.c          | 3 ++-\n>>  2 files changed, 3 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/tests/Makefile.include b/tests/Makefile.include\n>> index 80527a8763..91d5a4544f 100644\n>> --- a/tests/Makefile.include\n>> +++ b/tests/Makefile.include\n>> @@ -584,7 +584,7 @@ tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y)\n>>  tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y) $(test-crypto-obj-y)\n>>  tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o\n>>  tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-util-obj-y)\n>> -tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o\n>> +tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o $(test-util-obj-y)\n>>  tests/test-int128$(EXESUF): tests/test-int128.o\n>>  tests/rcutorture$(EXESUF): tests/rcutorture.o $(test-util-obj-y)\n>>  tests/test-rcu-list$(EXESUF): tests/test-rcu-list.o $(test-util-obj-y)\n>> diff --git a/util/cutils.c b/util/cutils.c\n>> index 1534682083..b33ede83d1 100644\n>> --- a/util/cutils.c\n>> +++ b/util/cutils.c\n>> @@ -30,6 +30,7 @@\n>>  #include \"qemu/iov.h\"\n>>  #include \"net/net.h\"\n>>  #include \"qemu/cutils.h\"\n>> +#include \"qemu/error-report.h\"\n>>\n>>  void strpadcpy(char *buf, int buf_size, const char *str, char pad)\n>>  {\n>> @@ -601,7 +602,7 @@ int parse_debug_env(const char *name, int max, int initial)\n>>          return initial;\n>>      }\n>>      if (debug < 0 || debug > max || errno != 0) {\n>> -        fprintf(stderr, \"warning: %s not in [0, %d]\", name, max);\n>> +        warn_report(\"%s not in [0, %d]\", name, max);\n>>          return initial;\n>>      }\n>>      return debug;\n>\n> Just one?  That's a bit of an anti-climax after the commit message :)\n>\n> I don't understand why this can't be in PATCH 3 (of course PATCH 6 has\n> to go before 3 then).  Not important.\n\nPatch 3 was replacing the original fprintf(...\\n) by removing the\nnewline as error_report() shouldn't have a new line. This case there\nwas no existing newline in the print so the regex expression was just\nlooking for any fprintf(.... Apparently there is only one case of\nthat.\n\nThanks,\nAlistair\n\n>\n> With the commit message typo fixed:\n> Reviewed-by: Markus Armbruster <armbru@redhat.com>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"cNcP9oCk\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xpjjx0hh0z9s76\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  9 Sep 2017 02:40:37 +1000 (AEST)","from localhost ([::1]:46431 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dqMKZ-0005tf-7b\n\tfor incoming@patchwork.ozlabs.org; Fri, 08 Sep 2017 12:40:35 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:46231)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <alistair23@gmail.com>) id 1dqMJO-0005LV-Qy\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 12:39:28 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <alistair23@gmail.com>) id 1dqMJN-0006BQ-PO\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 12:39:22 -0400","from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:34789)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <alistair23@gmail.com>)\n\tid 1dqMJN-0006AJ-I2\n\tfor qemu-devel@nongnu.org; Fri, 08 Sep 2017 12:39:21 -0400","by mail-wm0-x243.google.com with SMTP id l19so2091935wmi.1\n\tfor <qemu-devel@nongnu.org>; Fri, 08 Sep 2017 09:39:21 -0700 (PDT)","by 10.28.191.130 with HTTP; Fri, 8 Sep 2017 09:38:49 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-transfer-encoding;\n\tbh=lTnbIPorzVCQKSQ9PYEL9/fwvt5TE8nUZma55N+I6VY=;\n\tb=cNcP9oCkO1GhSR58TMmuz8MIbcUWb3cc1DJ4jgJFZt+DIpkfS20nMVZMIDba5Ietax\n\tPBBWaW72KeS0aIAgwjlkBar2ujuVWF/SWgCFhMuTBuQPWY4MPTZ+x9k3EU4KjVR1wB17\n\tZkb5XZ6p4Du9Z7kEz5TM5kV1sZoAUZSyV6kUC2W/QbO6Y9DaahEe5fmx36gnA+MRAO6f\n\tvhIgQVN3U4Ht/0IkPpQXDkCM+6SrhLgquJo4y1w5R9GZpCtzPLNSZfVUKeVlcowyKY8w\n\tdpDdOhGZi1GDoVWP1HQ0eLi0gHBPo3cp6Mhik7hEgFvFkyFJgMjvZAUnOmKrxkqQ3cYq\n\tC42w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=lTnbIPorzVCQKSQ9PYEL9/fwvt5TE8nUZma55N+I6VY=;\n\tb=csVp4+N53VwHbVEDe8372dznyPKyU/vRlgrsUXwnzmY897xyTzLE8Z4S1b84mGyS7z\n\ttgap+gEJSwRlEVkVMuhLuP5kz+lzps4UkC+oEnDL5MpSzWXFd1AkDT4sVDshkCs6toFN\n\tEldwWto4zgMhZpHRGTvjIgTYa4GRMfboCliMU0XGxcdgPXAvbobCgxaKUfIBgo2A6X9O\n\tMnpAl3rZkU3xm5y6BM42FIkTuRAS+3Y5hFtnoSSd5IszMyZ3kOJ9hHZMi5UxpgBP69b5\n\t/kjz2aCmvFu460zk0xNRpc/KxD9E6IhSu1/fR43HyqCNimecSaaHox1k/EGHTfA9zLF5\n\twp1w==","X-Gm-Message-State":"AHPjjUiP3b7O7YVc9VGAJQQvv//qhOPqJLEWgqHOU1g9+BeupQOtgzgK\n\ttTbbLDkumLSBzWyQjeVJ0dHC/yrahC/Q5jV85T/3Kg==","X-Google-Smtp-Source":"ADKCNb7qratPhWDcb86Fk7YdBnCwlyZF/cbDmM2HAIznqcGxtuhabIdmT+xBfTr119QE/kohmpPUP6jsR+u8kbYydoE=","X-Received":"by 10.28.104.7 with SMTP id d7mr2001338wmc.6.1504888760204; Fri,\n\t08 Sep 2017 09:39:20 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<87377xilxw.fsf@dusky.pond.sub.org>","References":"<cover.1504228916.git.alistair.francis@xilinx.com>\n\t<852ce10cbd36276fe5207539cd2dcd77aac6c938.1504228916.git.alistair.francis@xilinx.com>\n\t<87377xilxw.fsf@dusky.pond.sub.org>","From":"Alistair Francis <alistair.francis@xilinx.com>","Date":"Fri, 8 Sep 2017 09:38:49 -0700","X-Google-Sender-Auth":"b1QngDHfTN3ANZ5f5JVFCYZ_FJc","Message-ID":"<CAKmqyKO8=xFjPPOk29ChBXrQYpFw_Q7f1xLbdEJf8ZO7NC1uAQ@mail.gmail.com>","To":"Markus Armbruster <armbru@redhat.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2a00:1450:400c:c09::243","Subject":"Re: [Qemu-devel] [PATCH v3 7/7] Convert remaining single line\n\tfprintf() to warn_report()","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Paolo Bonzini <pbonzini@redhat.com>,\n\t\"qemu-devel@nongnu.org Developers\" <qemu-devel@nongnu.org>,\n\tAlistair Francis <alistair.francis@xilinx.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]