[parted-devel] [PATCH] detect device map type

Jim Meyering jim at meyering.net
Fri Jun 6 07:00:14 UTC 2008


Guido Günther <agx at sigxcpu.org> wrote:
> On Thu, Jun 05, 2008 at 03:19:38PM +0200, Jim Meyering wrote:
>> I'm looking through your patches.
>> Running the new test as root elicits a failure for me,
> Could you paste that one. We rely on having multipath-tools around and
> the apropriate kernel modules loaded. Maybe we should add this to the
> test.

My problem was silly: the new test failed when I had built
*without* --enable-device-mapper.  I'll fix that shortly.

However, there was another problem: all _other_ tests would
fail with segfaults when configured with --enable-device-mapper.

I debugged it and discovered a free-uninitialized error with the new
member, dmtype.  Works fine if the uninitialized value is 0, but that
wasn't the case for me.  I've tentatively chosen to initialize it
like this.  If you see a better way, let me know.

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 67b8fb6..04107d8 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -1158,6 +1158,7 @@ linux_new (const char* path)
         if (!dev)
                 goto error;

+        dev->dmtype = NULL;
         dev->path = strdup (path);
         if (!dev->path)
                 goto error_free_dev;

>> so I'm investigating that.  Looking at the file you added,
>> dm-utils.sh, it seems to come from lvm's tests/lvm-utils.sh, but
>> with some changes.  Or maybe you took an older version, verbatim?
>> If you made changes, please list them with an explanation of why
>> you made them.  Otherwise, I'll use the latest from lvm's CVS repository.
>
> Besides removing some lvm specific functions I needed to change some
> variable names:
...
I'm copying more of the lvm-related testing framework, so it will
be easier to keep things in sync.  Did those lvm-specific functions
cause trouble?

Also, I'm keeping the random-named temporary directories.
That will be important when automake (or package-specific set-up
as in coreutils) allows individual tests to be run in parallel.

>> By the way, normally, facts like that would be noted in
>> a commit log/ChangeLog entry something like this:
>>
>>   * tests/dm-utils.sh: New file.  Copied from lvm's tests/lvm-utils.sh.
> Sure. Omission on my end. Sorry.

No trouble.  You did hint at it in your mail.
I'll post an updated patch soon.



More information about the parted-devel mailing list