Stephen Powell wrote: ... > In the process of checking out the results, I discovered a bug in my code. > In include/parted/vtoc.h, at or near line 105, as part of the structure > declaration for ldl_volume_label, there is a line that says > > char ldl_version; /* Version number, valid for ldl format > */ > > It should say > > char ldl_version[1]; /* Version number, valid for ldl format > */ > > I was clued into this by a bunch of compile warnings in > libparted/labels/dasd.c > complaining about conversion of integer to pointer without a cast, > or something like that.
Hi Stephen, Thanks for the fix. Until today I had not compiled your changes on an s390x. When I did, there were 3 other minor problems, addressed by the patch below, just after the one you suggested. That got past "make check" as a non-privileged user. However, running "make check" as root exercises several other cases that cannot be tested as a regular user, and at least two of those are failing. Those failures are not due to your changes, so as soon as I have a test or two to exercise your changes I'll feel comfortable pushing the result. I expect to use the same mechanism as used in a few other tests whereby you specify a device and its size like this: sudo make check DEVICE_TO_ERASE=/dev/sdd DEVICE_TO_ERASE_SIZE=999MB But it won't be this weekend, so maybe next week... >From a0fd447e13ec76fa16a51bfd88b67af705d08c05 Mon Sep 17 00:00:00 2001 From: Stephen Powell <zlinux...@wowway.com> Date: Thu, 25 Nov 2010 15:52:21 +0100 Subject: [PATCH 1/2] tweak ldl_version member decl * include/parted/vtoc.h [struct ldl_volume_label] (ldl_version): Declare as array of length 1, not as a scalar. --- include/parted/vtoc.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/parted/vtoc.h b/include/parted/vtoc.h index 5ed40b5..d79ce39 100644 --- a/include/parted/vtoc.h +++ b/include/parted/vtoc.h @@ -102,7 +102,7 @@ struct __attribute__ ((packed)) ldl_volume_label { char vollbl[4]; /* Label identifier ("LNX1" in EBCDIC) */ char volid[6]; /* Volume identifier */ char res3[69]; /* Reserved field */ - char ldl_version; /* Version number, valid for ldl format */ + char ldl_version[1]; /* Version number, valid for ldl format */ u_int64_t formatted_blocks; /* valid when ldl_version >= "2" (in EBCDIC) */ }; -- 1.7.3.2.765.g642a8 >From 668956027eebd9204e486fdd75e67a981ead5ac5 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Thu, 25 Nov 2010 15:57:00 +0100 Subject: [PATCH 2/2] s390: avoid warnings * libparted/labels/vtoc.c (vtoc_read_volume_label): Remove decl of unused var. * libparted/labels/fdasd.c (fdasd_valid_vtoc_pointer): Return a value also when successful. * libparted/labels/dasd.c (dasd_alloc_metadata): Initialize "part" to NULL solely to avoid a spurious used-uninitialized warning. --- libparted/labels/dasd.c | 2 +- libparted/labels/fdasd.c | 1 + libparted/labels/vtoc.c | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c index 8114347..bca1662 100644 --- a/libparted/labels/dasd.c +++ b/libparted/labels/dasd.c @@ -906,7 +906,7 @@ dasd_alloc_metadata (PedDisk* disk) PedSector vtoc_end; LinuxSpecific* arch_specific; DasdDiskSpecific* disk_specific; - PedPartition* part; + PedPartition* part = NULL; /* initialize solely to placate gcc */ PedPartition* new_part2; PedSector trailing_meta_start, trailing_meta_end; struct fdasd_anchor anchor; diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c index 8da7b1f..6d708f6 100644 --- a/libparted/labels/fdasd.c +++ b/libparted/labels/fdasd.c @@ -707,6 +707,7 @@ fdasd_valid_vtoc_pointer(fdasd_anchor_t *anc, unsigned long b, int fd) return 0; fdasd_error(anc, wrong_disk_format, _("Invalid VTOC.")); + return 1; } /* diff --git a/libparted/labels/vtoc.c b/libparted/labels/vtoc.c index dab5181..cf2990e 100644 --- a/libparted/labels/vtoc.c +++ b/libparted/labels/vtoc.c @@ -290,7 +290,6 @@ vtoc_read_volume_label (int f, unsigned long vlabel_start, bogus_label_t *bogus_ptr = &mybogus; vollabel_t *union_ptr = &bogus_ptr->actual_label; volume_label_t *cdl_ptr = &union_ptr->cdl; - cms_volume_label_t *cms_ptr = &union_ptr->cms; PDEBUG int rc; -- 1.7.3.2.765.g642a8 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org