GNU bug report logs - #34218
Partition name is not set by mkpart if compiled with --disable-debug

Previous Next

Package: parted;

Reported by: Oliver Mangold <o.mangold <at> gmail.com>

Date: Sun, 27 Jan 2019 11:43:02 UTC

Severity: normal

Done: "Brian C. Lane" <bcl <at> redhat.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34218 in the body.
You can then email your comments to 34218 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-parted <at> gnu.org:
bug#34218; Package parted. (Sun, 27 Jan 2019 11:43:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oliver Mangold <o.mangold <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-parted <at> gnu.org. (Sun, 27 Jan 2019 11:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Oliver Mangold <o.mangold <at> gmail.com>
To: bug-parted <at> gnu.org
Subject: Partition name is not set by mkpart if compiled with --disable-debug
Date: Sun, 27 Jan 2019 11:34:40 +0100
Hi,

I noticed a long-standing bug, that the 'name' argument of mkpart seems to be ignored. It happens only with debug disabled on compilation '--disable-debug' (as e.g. Arch Linux does for its package). The reason is, that from parted.c the function ped_partition_set_name is called within an assert. I believe the code should be rather something like this (which works for me):

--- parted/parted.c.orig	2019-01-27 11:27:54.742081238 +0100
+++ parted/parted.c	2019-01-27 11:28:18.049039748 +0100
@@ -806,7 +806,8 @@
 
         /* set minor attributes */
         if (part_name)
-                PED_ASSERT (ped_partition_set_name (part, part_name));
+            if (!ped_partition_set_name (part, part_name))
+                goto error;
         free (part_name);  /* avoid double-free upon failure */
         part_name = NULL;
         if (!ped_partition_set_system (part, fs_type))
---

Best regards,

Oliver




Reply sent to "Brian C. Lane" <bcl <at> redhat.com>:
You have taken responsibility. (Thu, 31 Jan 2019 19:31:02 GMT) Full text and rfc822 format available.

Notification sent to Oliver Mangold <o.mangold <at> gmail.com>:
bug acknowledged by developer. (Thu, 31 Jan 2019 19:31:03 GMT) Full text and rfc822 format available.

Message #10 received at 34218-done <at> debbugs.gnu.org (full text, mbox):

From: "Brian C. Lane" <bcl <at> redhat.com>
To: Oliver Mangold <o.mangold <at> gmail.com>
Cc: 34218-done <at> debbugs.gnu.org
Subject: Re: bug#34218: Partition name is not set by mkpart if compiled with
 --disable-debug
Date: Thu, 31 Jan 2019 11:30:05 -0800
On Sun, Jan 27, 2019 at 11:34:40AM +0100, Oliver Mangold wrote:
> Hi,
> 
> I noticed a long-standing bug, that the 'name' argument of mkpart seems to be ignored. It happens only with debug disabled on compilation '--disable-debug' (as e.g. Arch Linux does for its package). The reason is, that from parted.c the function ped_partition_set_name is called within an assert. I believe the code should be rather something like this (which works for me):
> 
> --- parted/parted.c.orig	2019-01-27 11:27:54.742081238 +0100
> +++ parted/parted.c	2019-01-27 11:28:18.049039748 +0100
> @@ -806,7 +806,8 @@
>  
>          /* set minor attributes */
>          if (part_name)
> -                PED_ASSERT (ped_partition_set_name (part, part_name));
> +            if (!ped_partition_set_name (part, part_name))
> +                goto error;
>          free (part_name);  /* avoid double-free upon failure */
>          part_name = NULL;
>          if (!ped_partition_set_system (part, fs_type))

Thanks, I've applied this to master with a small change, it needs to
jump to error_remove_part

I'm also not sure it's a good idea to run parted without debug, when I
added --disable-debug to my fedora build pretty much all the tests fail
with segfaults.

But either way, an assert shouldn't be wrapping function calls that have
side-effects.

-- 
Brian C. Lane (PST8PDT)




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 01 Mar 2019 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 29 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.