Kenneth MacDonald <[EMAIL PROTECTED]> wrote: > parted 1.8.7 (git trunk seems to be the same) > > The comparison of fs_type->name to "linux-swap" no longer catches Linux > swap partitions as they're called either "linux-swap(new)" or > "linux-swap(old)". This means, at least in the DOS label code, creating > Linux swap partitions results in the system (type) byte in the partition > table defaulting to "0x83" (Linux) rather than "0x82" (Linux Swap). > > I've fixed this by performing a match on the first ten characters of the > fs_type->name variable ("linux-swap" is ten characters long). > > Find attached a patch for the following labels: bsd, dasd, dos, mac, rdb > and sun. From what I can tell, the other labels either don't handle > Linux swap partitions or don't need to be changed (e.g. gpt simply looks > for a substring of "swap").
Thank you for the report and patch. This bug does indeed affect the very latest versions. Do you feel like adjusting your patch so that there's a single function to perform that comparison? You'd have to find a header that's included by all of the affected files and add a static inline function definition there. E.g., something like this: static inline int is_linux_swap (char const *fs_type_name) { char const *prefix = "linux-swap"; return strncmp (fs_type_name, prefix, strlen (prefix)) == 0; } Also, while trying to test it, I noticed that "linux-swap" is no longer a valid input partition type: $ N=1 t=linux-swap dev=dev-file dd if=/dev/null of=$dev bs=1 seek=${N}M 2>/dev/null \ && ./parted -s $dev mklabel msdos \ && ./parted -s $dev mkpartfs primary $t 0 $N ./parted: invalid token: linux-swap Error: Expecting a file system type. So, it'd be nice to map a requested partition type of "linux-swap" to "linux-swap(new), so that the above works. You can make it easier (quicker) for someone to apply your patch if you include a test case demonstrating the failure of the unpatched code. There are several tests in tests/t*.sh. For example, you could run the above commands, and then use dd to extract the file system ID from $dev and ensure that it is 82. Also helpful is to make your patch relative to the latest git trunk code. Finally, once there's a new test, make sure that "make check" fails without your fix and succeeds with it. Don't worry if you can't deal with any or all of these suggestions. Eventually someone will do it. _______________________________________________ bug-parted mailing list bug-parted@gnu.org http://lists.gnu.org/mailman/listinfo/bug-parted