Re: [PATCH 2/4] Prevent /sys/class/block/mapper!vg*-lv* lookups.

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

 



On Tue, 2011-04-19 at 13:05 -1000, David Cantrell wrote:
> I was hitting this today.  The /dev/mapper/vg*-lv* names were getting
> translated to /sys/class/block/mapper!vg*-lv*.
> ---
>  pyanaconda/iutil.py |    4 +---
>  1 files changed, 1 insertions(+), 3 deletions(-)

I think the right fix for this is to trim /dev/ and then trim mapper/ if
it's there. Otherwise you lose the point of the replace, as Brian points
out.

Dave

> 
> diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
> index a004ae0..00567d7 100644
> --- a/pyanaconda/iutil.py
> +++ b/pyanaconda/iutil.py
> @@ -806,9 +806,7 @@ def get_sysfs_path_by_name(dev_node, class_name="block"):
>          (e.g. /sys/class/block/vda2). This also has to work for device nodes
>          that are in a subdirectory of /dev like '/dev/cciss/c0d0p1'.
>       """
> -    dev_name = os.path.basename(dev_node)
> -    if dev_node.startswith("/dev/"):
> -        dev_name = dev_node[5:].replace("/", "!")
> +    dev_name = os.path.basename(os.path.realpath(dev_node)).replace("/", "!")
>      sysfs_class_dir = "/sys/class/%s" % class_name
>      dev_path = os.path.join(sysfs_class_dir, dev_name)
>      if os.path.exists(dev_path):


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux