On Wed, 01 Aug 2007 09:45:44 +0200 Jim Meyering <[EMAIL PROTECTED]> wrote:
> Hi David,
>
> What's the motivation for this patch?
> IMHO, such a change should be accompanied by
> a test case, or at the very least enough explanation
> to construct a test case.
>
> This change (on the trunk) causes "make check" to fail
> all but two tests, so I've reverted it there.
First, know that I'm pretty much only working with the stable-1.8.x branch. I
don't even have time to work with trunk, ever. Otavio suggested the patches be
made to trunk, then cherry-picked to stable. Well, I'm the stable branch
maintainer and that's not a very effective way for me to work. If a stable
patch is applicable to trunk, we can cherry-pick the other way.
On to the patch. While working on a RHEL bug, I discovered that the
linux_probe_all() function in libparted/arch/linux.c walks three possible
sources to find block devices:
- A list of "standard" devices hardwired in linux.c (just hdX and sdX
devices)
- The contents of /sys/block with ., .., dm-*, and ram* filtered out
- The contents of /proc/partitions
The /proc/partitions file is looked at only if /sys/block isn't available. On
my system, I had /sys/block available and there was one node that showed up
that caused parted to crash. That node was md0. There were no software RAID
devices on the system at all. /sys/block/md0 was bogus. But since libparted
found it during the device probe, it tried to read a label from it. Crash.
So I placed the ped_disk_new() test there because if it fails, the device
wouldn't open, so I return NULL there. Maybe that's the wrong place to do
that, but the situation is valid. We should test to make sure we can open the
device during a probe all rather than assuming it can be read.
Should I have written a test case...yes, but after hacking on it for a few days
and PM yelling at me, I really just didn't even think about it. Apologies.
--
David Cantrell <[EMAIL PROTECTED]>
Red Hat / Westford, MA
pgppfvmyoKW3Z.pgp
Description: PGP signature
_______________________________________________ parted-devel mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/parted-devel

