[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#405579: PowerPC, prep-flavor: manual partitioning error



Hi,

I think I found a possible source of this:

[del]
>/lib/partman/update.d/50filesystems : IN : CHANGE_FILE_SYSTEM =dev=scsi=host0=bus0=target0=lun0=disc 32256-98703359 prep
>parted_server: opening outfifo
>parted_server: command_change_file_system(32256-98703359,prep)
>parted_server: partition_with_id(32256-98703359)
>parted_server: Filesystem + not found, let's see if it is a flag
>parted_server: Bad file system or flag type: +
>parted_server: line 1616. CRITICAL ERROR!!! EXITING
[del]

In this context 32256-98703359 is the partition ID, "prep" is only a flag,
not a real partition type. This is important for the code flow in:

packages/partman/partman-base/parted_server.c

there's the function command_change_file_system():
....
        if (2 != iscanf("%as %as", &id, &s_fstype))
                critical_error("Expected partition id and file system");
        log("command_change_file_system(%s,%s)", id, s_fstype);
        part = partition_with_id(disk, id);
        if (part == NULL) {
                critical_error("Partition not found: %s", id);
        }
        free(id);
        fstype = ped_file_system_type_get(s_fstype);
        free(s_fstype);
        if (fstype == NULL) {
                log("Filesystem %s not found, let's see if it is a flag",
                    s_fstype);
                flag = ped_partition_flag_get_by_name(s_fstype);
                if (ped_partition_is_flag_available(part, flag)) {
                        ped_partition_set_flag(part, flag, 1);
                } else {
                        critical_error("Bad file system or flag type: %s",
                                       s_fstype);
                }
        } else {
                ped_partition_set_system(part, fstype);
        }
...

where s_fstype is free'ed too early. I would propose the following patch:

Index: packages/partman/partman-base/parted_server.c
===================================================================
--- packages/partman/partman-base/parted_server.c       (revision 43984)
+++ packages/partman/partman-base/parted_server.c       (working copy)
@@ -1604,7 +1604,6 @@
         }
         free(id);
         fstype = ped_file_system_type_get(s_fstype);
-        free(s_fstype);
         if (fstype == NULL) {
                 log("Filesystem %s not found, let's see if it is a flag",
                     s_fstype);
@@ -1618,6 +1617,7 @@
         } else {
                 ped_partition_set_system(part, fstype);
         }
+        free(s_fstype);
         oprintf("OK\n");
 }
===================================================================

I am not sure if this will really fix the problem, I'd like to have the
patch reviewed before I take the next step.

HTH,
Uli
-- 
Dipl. Inf. Ulrich Teichert|e-mail: Ulrich.Teichert@gmx.de
Stormweg 24               |listening to: Single (Hushpuppies), Pay The Cobra
24539 Neumuenster, Germany|(The Bellrays), She's Got Standards (The Rifles)



Reply to: