From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3DF2C38A02 for ; Wed, 26 Oct 2022 00:49:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1onUXM-0003wi-Rj; Tue, 25 Oct 2022 20:44:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1onUXI-0003jV-JL for qemu-devel@nongnu.org; Tue, 25 Oct 2022 20:44:48 -0400 Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1onUXG-0002lN-Uc for qemu-devel@nongnu.org; Tue, 25 Oct 2022 20:44:48 -0400 Received: by mail-qk1-x735.google.com with SMTP id s17so9476531qkj.12 for ; Tue, 25 Oct 2022 17:44:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=B6T+Nl7cyBwXv0OViZ4jdzNNLcQzTEArslmFKclrTZQ=; b=GvroCbMGSwnYzb8OpSXsYX2S/Z5dx7OQttj37kEPg6qfWHLlKS/YNBS38Mnot2nVNX Hiwtqi3Zm+IVxUZ624AmADjF10bWkZZvCdHYCn8OmZ+Us6AsSymdGYn+gGjIT/nuzVvM LGD2KWQQJVGaUKHmsKJtRbNra1FEoZ45ZFpAJj1ZiPysoff4ItU3luYy3G203/zEOY+h u/IV9VY6zngLpv07c+Zos+uld8RVQ7Ki6XerxWfCOMxulLTUCcyI0mRVHTLkEKNwj8xN cf6XN4disgkp4RRLK1CEWDacoYZf6AJEFUFauZoT8foN8ptvdWO6PsLRpxeVIBrOwgx3 DEjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B6T+Nl7cyBwXv0OViZ4jdzNNLcQzTEArslmFKclrTZQ=; b=dG7nTpLepMHzKc4xKuw9wunz/xxkaSRBRlMJJxv0iEVfbUftl+olLtRP8AR1Xb05IO yNQf+QnojtYEvam6jvs8XkF2yMIpNzuH3hpAALMZcDyy0ewMcnt8vE9ycUKKGbwz3j7/ 0lR4D5k5XHszK+3saT3NOMQMdG4/3vwS6WiBblnBYhIdkOeaW/BjuawonT3lm35yjimW Vjy4ecUeZqomHWTPiZQUU13rZ2qmg1NFI3kBs35mcMXMQQmllTV7rbOoXzscc+Lxauss ok0dlnBCqpvLnUUgwtxIwPvi2yRkYXL843efx0EAtCEtBvpW9WKt5S0w6vq5LSm/FTMU voGQ== X-Gm-Message-State: ACrzQf0hIgfIiptjIS8xfrC2HTGxyoRUQkwFtSE6TslZPutsWsE8mPmk YUplqxlN/YBEVp2gOZqOCnDbZoSpDFR6jEmvMDQ= X-Google-Smtp-Source: AMsMyM4vHz+qcvwGEgfY4agO0S2J6eU+BuUrwEmBhHbOQWiNIjp92j97Mv/lA0MPoqIEXgkanNi9He6WzRfwXdl59IA= X-Received: by 2002:a05:620a:19a6:b0:6ee:d3d6:6b03 with SMTP id bm38-20020a05620a19a600b006eed3d66b03mr28353103qkb.376.1666745086076; Tue, 25 Oct 2022 17:44:46 -0700 (PDT) MIME-Version: 1.0 References: <20221006151927.2079583-1-bmeng.cn@gmail.com> <20221006151927.2079583-5-bmeng.cn@gmail.com> <19172ac9-519c-2a32-9336-7d92aaea05f8@linaro.org> In-Reply-To: <19172ac9-519c-2a32-9336-7d92aaea05f8@linaro.org> From: Bin Meng Date: Wed, 26 Oct 2022 08:44:35 +0800 Message-ID: Subject: Re: [PATCH v5 04/18] tests/qtest: migration-test: Avoid using hardcoded /tmp To: Richard Henderson Cc: qemu-devel@nongnu.org, =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= , Bin Meng , "Dr. David Alan Gilbert" , Juan Quintela , Laurent Vivier , Paolo Bonzini , Thomas Huth Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::735; envelope-from=bmeng.cn@gmail.com; helo=mail-qk1-x735.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On Wed, Oct 26, 2022 at 7:44 AM Richard Henderson wrote: > > On 10/7/22 01:19, Bin Meng wrote: > > From: Bin Meng > > > > This case was written to use hardcoded /tmp directory for temporary > > files. Update to use g_dir_make_tmp() for a portable implementation. > > > > Signed-off-by: Bin Meng > > Reviewed-by: Marc-Andr=C3=A9 Lureau > > --- > > > > Changes in v5: > > - Use g_autoptr(GError) > > > > Changes in v4: > > - Update the error reporting by using the GError "error" argument > > of g_dir_make_tmp() > > - Remove the const from tmpfs declaration > > > > Changes in v3: > > - Split to a separate patch > > This patch breaks with gcc 12: Weird GCC ... GCC 9 reported [1], but not GCC 11, and now GCC 12 reported again. > > > > @@ -2479,9 +2479,10 @@ int main(int argc, char **argv) > > return g_test_run(); > > } > > > > - tmpfs =3D g_mkdtemp(template); > > + tmpfs =3D g_dir_make_tmp("migration-test-XXXXXX", &err); > > if (!tmpfs) { > > - g_test_message("g_mkdtemp on path (%s): %s", template, strerro= r(errno)); > > + g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs, > > + err->message); > > } > > g_assert(tmpfs); > > > > ../src/tests/qtest/migration-test.c: In function =E2=80=98main=E2=80=99: > ../src/tests/qtest/migration-test.c:2484:49: error: =E2=80=98%s=E2=80=99 = directive argument is null > [-Werror=3Dformat-overflow=3D] > 2484 | g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs, > | ^~ > > The compiler correctly notices that tmpfs was tested and found to be null= , but tried to > print it anyway. > Patch [1] already queued in qemu-trivial [1] http://patchwork.ozlabs.org/project/qemu-devel/patch/20221017132023.222= 8641-1-bmeng.cn@gmail.com/ Regards, Bin