Message ID | 20221017114647.2226535-1-bmeng.cn@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] tests/qtest: migration-test: Fix [-Werror=format-overflow=] build warning | expand |
Bin Meng <bmeng.cn@gmail.com> writes: > From: Bin Meng <bin.meng@windriver.com> > > When tmpfs is NULL, a build warning is seen with GCC 9.3.0. > It's strange that GCC 11.2.0 on Ubuntu 22.04 does not catch this, > neither did the QEMU CI. > > Reported-by: Shengjiang Wu <shengjiang.wu@windriver.com> > Fixes: e5553c1b8d28 ("tests/qtest: migration-test: Avoid using hardcoded /tmp") > Signed-off-by: Bin Meng <bin.meng@windriver.com> > --- > > tests/qtest/migration-test.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c > index ef4427ff4d..83a8998e40 100644 > --- a/tests/qtest/migration-test.c > +++ b/tests/qtest/migration-test.c > @@ -2481,7 +2481,7 @@ int main(int argc, char **argv) > > tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err); > if (!tmpfs) { > - g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs, > + g_test_message("g_dir_make_tmp on path (%s): %s", g_get_tmp_dir(), > err->message); > } > g_assert(tmpfs); Thomas posted the same fix as "[PATCH] tests/qtest/migration-test: Do not try to print NULL pointer string". You guys figure out which one you like better :) Reviewed-by: Markus Armbruster <armbru@redhat.com>
Markus Armbruster <armbru@redhat.com> writes: > Bin Meng <bmeng.cn@gmail.com> writes: > >> From: Bin Meng <bin.meng@windriver.com> >> >> When tmpfs is NULL, a build warning is seen with GCC 9.3.0. >> It's strange that GCC 11.2.0 on Ubuntu 22.04 does not catch this, >> neither did the QEMU CI. >> >> Reported-by: Shengjiang Wu <shengjiang.wu@windriver.com> >> Fixes: e5553c1b8d28 ("tests/qtest: migration-test: Avoid using hardcoded /tmp") >> Signed-off-by: Bin Meng <bin.meng@windriver.com> >> --- >> >> tests/qtest/migration-test.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c >> index ef4427ff4d..83a8998e40 100644 >> --- a/tests/qtest/migration-test.c >> +++ b/tests/qtest/migration-test.c >> @@ -2481,7 +2481,7 @@ int main(int argc, char **argv) >> >> tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err); >> if (!tmpfs) { >> - g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs, >> + g_test_message("g_dir_make_tmp on path (%s): %s", g_get_tmp_dir(), >> err->message); >> } >> g_assert(tmpfs); > > Thomas posted the same fix as "[PATCH] tests/qtest/migration-test: Do > not try to print NULL pointer string". You guys figure out which one > you like better :) Correction: not the same. > Reviewed-by: Markus Armbruster <armbru@redhat.com>
On Mon, Oct 17, 2022 at 8:28 PM Markus Armbruster <armbru@redhat.com> wrote: > > Bin Meng <bmeng.cn@gmail.com> writes: > > > From: Bin Meng <bin.meng@windriver.com> > > > > When tmpfs is NULL, a build warning is seen with GCC 9.3.0. > > It's strange that GCC 11.2.0 on Ubuntu 22.04 does not catch this, > > neither did the QEMU CI. > > > > Reported-by: Shengjiang Wu <shengjiang.wu@windriver.com> > > Fixes: e5553c1b8d28 ("tests/qtest: migration-test: Avoid using hardcoded /tmp") > > Signed-off-by: Bin Meng <bin.meng@windriver.com> > > --- > > > > tests/qtest/migration-test.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c > > index ef4427ff4d..83a8998e40 100644 > > --- a/tests/qtest/migration-test.c > > +++ b/tests/qtest/migration-test.c > > @@ -2481,7 +2481,7 @@ int main(int argc, char **argv) > > > > tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err); > > if (!tmpfs) { > > - g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs, > > + g_test_message("g_dir_make_tmp on path (%s): %s", g_get_tmp_dir(), > > err->message); > > } > > g_assert(tmpfs); > > Thomas posted the same fix as "[PATCH] tests/qtest/migration-test: Do > not try to print NULL pointer string". You guys figure out which one > you like better :) > Oops, almost the same time :) Will let Thomas decide. > Reviewed-by: Markus Armbruster <armbru@redhat.com> > Regards, Bin
On 17/10/2022 15.56, Bin Meng wrote: > On Mon, Oct 17, 2022 at 8:28 PM Markus Armbruster <armbru@redhat.com> wrote: >> >> Bin Meng <bmeng.cn@gmail.com> writes: >> >>> From: Bin Meng <bin.meng@windriver.com> >>> >>> When tmpfs is NULL, a build warning is seen with GCC 9.3.0. >>> It's strange that GCC 11.2.0 on Ubuntu 22.04 does not catch this, >>> neither did the QEMU CI. >>> >>> Reported-by: Shengjiang Wu <shengjiang.wu@windriver.com> >>> Fixes: e5553c1b8d28 ("tests/qtest: migration-test: Avoid using hardcoded /tmp") >>> Signed-off-by: Bin Meng <bin.meng@windriver.com> >>> --- >>> >>> tests/qtest/migration-test.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c >>> index ef4427ff4d..83a8998e40 100644 >>> --- a/tests/qtest/migration-test.c >>> +++ b/tests/qtest/migration-test.c >>> @@ -2481,7 +2481,7 @@ int main(int argc, char **argv) >>> >>> tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err); >>> if (!tmpfs) { >>> - g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs, >>> + g_test_message("g_dir_make_tmp on path (%s): %s", g_get_tmp_dir(), >>> err->message); >>> } >>> g_assert(tmpfs); >> >> Thomas posted the same fix as "[PATCH] tests/qtest/migration-test: Do >> not try to print NULL pointer string". You guys figure out which one >> you like better :) >> > > Oops, almost the same time :) > > Will let Thomas decide. The improvement of the error message in your v2 makes a lot of sense - I'll queue that version. Thomas
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index ef4427ff4d..83a8998e40 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2481,7 +2481,7 @@ int main(int argc, char **argv) tmpfs = g_dir_make_tmp("migration-test-XXXXXX", &err); if (!tmpfs) { - g_test_message("g_dir_make_tmp on path (%s): %s", tmpfs, + g_test_message("g_dir_make_tmp on path (%s): %s", g_get_tmp_dir(), err->message); } g_assert(tmpfs);