Re: [Qemu-devel] [PATCH for-2.12] dump: Fix build with newer gcc
On 06/04/2018 17:06, Eric Blake wrote: > On 04/03/2018 01:46 PM, Eric Blake wrote: >> On 03/27/2018 03:21 PM, Eric Blake wrote: >>> gcc 8 on rawhide is picky enough to complain: >>> >>> /home/dummy/qemu/dump.c: In function 'create_header32': >>> /home/dummy/qemu/dump.c:817:5: error: 'strncpy' output truncated before >>> terminating nul copying 8 bytes from a string of the same length >>> [-Werror=stringop-truncation] >>> strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); >>> ^~~~ >>> >>> But we already have SIG_LEN defined as the right length without needing >>> to do a strlen(), and memcpy() is better than strncpy() when we know >>> we do not want a trailing NUL byte. >>> >>> Signed-off-by: Eric Blake >>> --- >>> dump.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> I'll include this in my qapi+misc pull request for 2.12-rc2 > > That pull request was abandoned; Paolo, do you want to pick this up in > your misc tree? > Ok. Paolo
Re: [Qemu-devel] [PATCH for-2.12] dump: Fix build with newer gcc
On 04/03/2018 01:46 PM, Eric Blake wrote: > On 03/27/2018 03:21 PM, Eric Blake wrote: >> gcc 8 on rawhide is picky enough to complain: >> >> /home/dummy/qemu/dump.c: In function 'create_header32': >> /home/dummy/qemu/dump.c:817:5: error: 'strncpy' output truncated before >> terminating nul copying 8 bytes from a string of the same length >> [-Werror=stringop-truncation] >> strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); >> ^~~~ >> >> But we already have SIG_LEN defined as the right length without needing >> to do a strlen(), and memcpy() is better than strncpy() when we know >> we do not want a trailing NUL byte. >> >> Signed-off-by: Eric Blake >> --- >> dump.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) > > I'll include this in my qapi+misc pull request for 2.12-rc2 That pull request was abandoned; Paolo, do you want to pick this up in your misc tree? -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org signature.asc Description: OpenPGP digital signature
Re: [Qemu-devel] [PATCH for-2.12] dump: Fix build with newer gcc
On 03/27/2018 03:21 PM, Eric Blake wrote: > gcc 8 on rawhide is picky enough to complain: > > /home/dummy/qemu/dump.c: In function 'create_header32': > /home/dummy/qemu/dump.c:817:5: error: 'strncpy' output truncated before > terminating nul copying 8 bytes from a string of the same length > [-Werror=stringop-truncation] > strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); > ^~~~ > > But we already have SIG_LEN defined as the right length without needing > to do a strlen(), and memcpy() is better than strncpy() when we know > we do not want a trailing NUL byte. > > Signed-off-by: Eric Blake > --- > dump.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) I'll include this in my qapi+misc pull request for 2.12-rc2 -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org signature.asc Description: OpenPGP digital signature
Re: [Qemu-devel] [PATCH for-2.12] dump: Fix build with newer gcc
Hi, This series failed docker-build@min-glib build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally. Type: series Message-id: 20180327202152.1799131-1-ebl...@redhat.com Subject: [Qemu-devel] [PATCH for-2.12] dump: Fix build with newer gcc === TEST SCRIPT BEGIN === #!/bin/bash set -e git submodule update --init dtc # Let docker tests dump environment info export SHOW_ENV=1 export J=8 time make docker-test-build@min-glib === TEST SCRIPT END === Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 Switched to a new branch 'test' cc8ef6a6be dump: Fix build with newer gcc === OUTPUT BEGIN === Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc' Cloning into '/var/tmp/patchew-tester-tmp-vs3sdjpj/src/dtc'... Submodule path 'dtc': checked out 'e54388015af1fb4bf04d0bca99caba1074d9cc42' BUILD min-glib make[1]: Entering directory '/var/tmp/patchew-tester-tmp-vs3sdjpj/src' GEN /var/tmp/patchew-tester-tmp-vs3sdjpj/src/docker-src.2018-03-31-02.48.49.8700/qemu.tar Cloning into '/var/tmp/patchew-tester-tmp-vs3sdjpj/src/docker-src.2018-03-31-02.48.49.8700/qemu.tar.vroot'... done. Checking out files: 38% (2340/6066) Checking out files: 39% (2366/6066) Checking out files: 40% (2427/6066) Checking out files: 41% (2488/6066) Checking out files: 42% (2548/6066) Checking out files: 43% (2609/6066) Checking out files: 44% (2670/6066) Checking out files: 45% (2730/6066) Checking out files: 46% (2791/6066) Checking out files: 47% (2852/6066) Checking out files: 48% (2912/6066) Checking out files: 49% (2973/6066) Checking out files: 50% (3033/6066) Checking out files: 51% (3094/6066) Checking out files: 52% (3155/6066) Checking out files: 52% (3178/6066) Checking out files: 53% (3215/6066) Checking out files: 54% (3276/6066) Checking out files: 55% (3337/6066) Checking out files: 56% (3397/6066) Checking out files: 57% (3458/6066) Checking out files: 58% (3519/6066) Checking out files: 58% (3526/6066) Checking out files: 59% (3579/6066) Checking out files: 60% (3640/6066) Checking out files: 61% (3701/6066) Checking out files: 62% (3761/6066) Checking out files: 63% (3822/6066) Checking out files: 64% (3883/6066) Checking out files: 65% (3943/6066) Checking out files: 66% (4004/6066) Checking out files: 67% (4065/6066) Checking out files: 68% (4125/6066) Checking out files: 69% (4186/6066) Checking out files: 70% (4247/6066) Checking out files: 71% (4307/6066) Checking out files: 72% (4368/6066) Checking out files: 73% (4429/6066) Checking out files: 74% (4489/6066) Checking out files: 75% (4550/6066) Checking out files: 76% (4611/6066) Checking out files: 77% (4671/6066) Checking out files: 78% (4732/6066) Checking out files: 79% (4793/6066) Checking out files: 80% (4853/6066) Checking out files: 81% (4914/6066) Checking out files: 82% (4975/6066) Checking out files: 83% (5035/6066) Checking out files: 84% (5096/6066) Checking out files: 85% (5157/6066) Checking out files: 86% (5217/6066) Checking out files: 87% (5278/6066) Checking out files: 88% (5339/6066) Checking out files: 89% (5399/6066) Checking out files: 90% (5460/6066) Checking out files: 91% (5521/6066) Checking out files: 92% (5581/6066) Checking out files: 93% (5642/6066) Checking out files: 94% (5703/6066) Checking out files: 95% (5763/6066) Checking out files: 96% (5824/6066) Checking out files: 97% (5885/6066) Checking out files: 98% (5945/6066) Checking out files: 99% (6006/6066) Checking out files: 100% (6066/6066) Checking out files: 100% (6066/6066), done. Your branch is up-to-date with 'origin/test'. Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc' Cloning into '/var/tmp/patchew-tester-tmp-vs3sdjpj/src/docker-src.2018-03-31-02.48.49.8700/qemu.tar.vroot/dtc'... Submodule path 'dtc': checked out 'e54388015af1fb4bf04d0bca99caba1074d9cc42' Submodule 'ui/keycodemapdb' (git://git.qemu.org/keycodemapdb.git) registered for path 'ui/keycodemapdb' Cloning into '/var/tmp/patchew-tester-tmp-vs3sdjpj/src/docker-src.2018-03-31-02.48.49.8700/qemu.tar.vroot/ui/keycodemapdb'... Submodule path 'ui/keycodemapdb': checked out '6b3d716e2b6472eb7189d3220552280ef3d832ce' tar: /var/tmp/patchew-tester-tmp-vs3sdjpj/src/docker-src.2018-03-31-02.48.49.8700/qemu.tar: Wrote only 2048 of 10240 bytes tar: Error is not recoverable: exiting now failed to create tar file COPYRUNNER RUN test-build in qemu:min-glib tar: Unexpected EOF in archive tar: Unexpected EOF in archive tar: Error is not recoverable: exiting now /var/tmp/qemu/run: line 32: prep_fail: command not found Environment variables: HOSTNAME=1014623e0fbf MAKEFLAGS= -j8 J=8 CCACHE_DIR=/var/tmp/ccache EXTRA_CONFIG
Re: [Qemu-devel] [PATCH for-2.12] dump: Fix build with newer gcc
On Tue, Mar 27, 2018 at 10:21 PM, Eric Blake wrote: > gcc 8 on rawhide is picky enough to complain: > > /home/dummy/qemu/dump.c: In function 'create_header32': > /home/dummy/qemu/dump.c:817:5: error: 'strncpy' output truncated before > terminating nul copying 8 bytes from a string of the same length > [-Werror=stringop-truncation] > strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); > ^~~~ > > But we already have SIG_LEN defined as the right length without needing > to do a strlen(), and memcpy() is better than strncpy() when we know > we do not want a trailing NUL byte. > > Signed-off-by: Eric Blake Reviewed-by: Marc-André Lureau > --- > dump.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/dump.c b/dump.c > index 669f715274d..b54cd42b217 100644 > --- a/dump.c > +++ b/dump.c > @@ -814,7 +814,7 @@ static void create_header32(DumpState *s, Error **errp) > size = sizeof(DiskDumpHeader32); > dh = g_malloc0(size); > > -strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); > +memcpy(dh->signature, KDUMP_SIGNATURE, SIG_LEN); > dh->header_version = cpu_to_dump32(s, 6); > block_size = s->dump_info.page_size; > dh->block_size = cpu_to_dump32(s, block_size); > @@ -926,7 +926,7 @@ static void create_header64(DumpState *s, Error **errp) > size = sizeof(DiskDumpHeader64); > dh = g_malloc0(size); > > -strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); > +memcpy(dh->signature, KDUMP_SIGNATURE, SIG_LEN); > dh->header_version = cpu_to_dump32(s, 6); > block_size = s->dump_info.page_size; > dh->block_size = cpu_to_dump32(s, block_size); > -- > 2.14.3 >
Re: [Qemu-devel] [PATCH for-2.12] dump: Fix build with newer gcc
On 03/27/2018 05:21 PM, Eric Blake wrote: > gcc 8 on rawhide is picky enough to complain: > > /home/dummy/qemu/dump.c: In function 'create_header32': > /home/dummy/qemu/dump.c:817:5: error: 'strncpy' output truncated before > terminating nul copying 8 bytes from a string of the same length > [-Werror=stringop-truncation] > strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); > ^~~~ > > But we already have SIG_LEN defined as the right length without needing > to do a strlen(), and memcpy() is better than strncpy() when we know > we do not want a trailing NUL byte. > > Signed-off-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé > --- > dump.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/dump.c b/dump.c > index 669f715274d..b54cd42b217 100644 > --- a/dump.c > +++ b/dump.c > @@ -814,7 +814,7 @@ static void create_header32(DumpState *s, Error **errp) > size = sizeof(DiskDumpHeader32); > dh = g_malloc0(size); > > -strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); > +memcpy(dh->signature, KDUMP_SIGNATURE, SIG_LEN); > dh->header_version = cpu_to_dump32(s, 6); > block_size = s->dump_info.page_size; > dh->block_size = cpu_to_dump32(s, block_size); > @@ -926,7 +926,7 @@ static void create_header64(DumpState *s, Error **errp) > size = sizeof(DiskDumpHeader64); > dh = g_malloc0(size); > > -strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE)); > +memcpy(dh->signature, KDUMP_SIGNATURE, SIG_LEN); > dh->header_version = cpu_to_dump32(s, 6); > block_size = s->dump_info.page_size; > dh->block_size = cpu_to_dump32(s, block_size); >