Bug 567118

Summary: PartitionException: Extended partitions cannot be hidden on msdos disk labels.
Product: [Fedora] Fedora Reporter: Flóki Pálsson <flokip>
Component: partedAssignee: Hans de Goede <hdegoede>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: dcantrell, hdegoede, jonathan, vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: anaconda_trace_hash:d2955d49e42f77fa08a12f13baf76349dfe4bedb4f6f520b1b5c670725298e13
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 569637 (view as bug list) Environment:
Last Closed: 2010-03-02 08:20:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Attached traceback automatically from anaconda. none

Description Flóki Pálsson 2010-02-21 18:28:06 UTC
The following was filed automatically by anaconda:
anaconda 13.26 exception report
Traceback (most recent call first):
  File "/usr/lib64/python2.6/site-packages/parted/partition.py", line 161, in unsetFlag
    return self.__partition.set_flag(flag, 0)
  File "/usr/lib64/python2.6/site-packages/parted/decorators.py", line 30, in localeC
    ret = fn(*args, **kwds)
  File "<string>", line 2, in unsetFlag
  File "/usr/lib/anaconda/storage/devices.py", line 1221, in unsetFlag
    self.partedPartition.unsetFlag(flag)
  File "/usr/lib/anaconda/storage/deviceaction.py", line 271, in execute
    self.device.unsetFlag(flag)
  File "/usr/lib/anaconda/storage/devicetree.py", line 670, in processActions
    action.execute(intf=self.intf)
  File "/usr/lib/anaconda/storage/__init__.py", line 290, in doIt
    self.devicetree.processActions()
  File "/usr/lib/anaconda/packages.py", line 109, in turnOnFilesystems
    anaconda.storage.doIt()
  File "/usr/lib/anaconda/dispatch.py", line 205, in moveStep
    rc = stepFunc(self.anaconda)
  File "/usr/lib/anaconda/dispatch.py", line 126, in gotoNext
    self.moveStep()
  File "/usr/lib/anaconda/gui.py", line 1311, in nextClicked
    self.anaconda.dispatch.gotoNext()
PartitionException: Extended partitions cannot be hidden on msdos disk labels.

Comment 1 Flóki Pálsson 2010-02-21 18:28:12 UTC
Created attachment 395377 [details]
Attached traceback automatically from anaconda.

Comment 2 David Lehman 2010-02-22 15:21:29 UTC
1. We are unsetting the flag. This is no time to complain about the flag being set.

2. Anaconda checks the return value of isFlagAvailable before calling unsetFlag. If the flag is not available don't say that it is.

Comment 3 David Cantrell 2010-02-25 14:17:34 UTC
pyparted gets this information from libparted.  libparted needs to enforce its own rules.  The msdos_partition_is_flag_available() needs to return false for PED_PARTITION_HIDDEN when the partition type is PED_PARTITION_EXTENDED.  This prevents an exception in msdos_partition_set_flag() later.  Change msdos_partition_get_flag() for consistency.

diff -up parted-2.1/libparted/labels/dos.c.flag_available parted-2.1/libparted/labels/dos.c
--- parted-2.1/libparted/labels/dos.c.flag_available	2010-02-25 03:35:47.000000000 -1000
+++ parted-2.1/libparted/labels/dos.c	2010-02-25 04:14:19.000000000 -1000
@@ -1481,7 +1481,10 @@ msdos_partition_get_flag (const PedParti
 	dos_data = part->disk_specific;
 	switch (flag) {
 	case PED_PARTITION_HIDDEN:
-		return dos_data->hidden;
+		if (part->type == PED_PARTITION_EXTENDED)
+			return 0;
+		else
+			return dos_data->hidden;
 
 	case PED_PARTITION_BOOT:
 		return dos_data->boot;
@@ -1512,6 +1515,10 @@ msdos_partition_is_flag_available (const
 {
 	switch (flag) {
 	case PED_PARTITION_HIDDEN:
+		if (part->type == PED_PARTITION_EXTENDED)
+			return 0;
+		else
+			return 1;
 	case PED_PARTITION_BOOT:
 	case PED_PARTITION_RAID:
 	case PED_PARTITION_LVM:

Comment 4 Hans de Goede 2010-03-02 08:20:34 UTC
Although I fully agree with comment #3, and I'll forward the patch upstream. That is not the real issue here.

Note that this happens from ActionCreateFormat.execute(), iow we are trying
to create a filesystem (or pv or raidmember) on the *extended* partition.

This can mean 1 of 2 things:
1) There is an anaconda bug
2) The underlying libparted pedPartition object has been free-ed and the
   memory re-used, due to bug 567576. Causing parted to think this
   is an extended partition.

I'm pretty sure 2 is the cause, so I'm marking this as a duplicate of
bug 567576.

*** This bug has been marked as a duplicate of bug 567576 ***