- Parted should not canonicalize symlinks under /dev/mapper (#577824)

This commit is contained in:
Hans de Goede 2010-04-06 15:16:50 +00:00
parent 740a497422
commit 211df98dc5
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From 70352b39e16f881b915b06440331acf47bcef984 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 6 Apr 2010 15:02:09 +0200
Subject: [PATCH parted] libparted: Don't canonicalize /dev/mapper paths
Besides fixing the issue displayed by libparted/tests/symlink.c,
this has the added advantage that the output of parted p on one of these
devices now says:
"Disk /dev/mapper/BigVol2-lv_iscsi_disk2: 34.4GB"
Which is a lot more user friendly then the output before this patch:
"Disk /dev/dm-6: 34.4GB"
* libparted/device.c: Don't canonicalize /dev/mapper paths
---
libparted/device.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libparted/device.c b/libparted/device.c
index 0f36a03..64da978 100644
--- a/libparted/device.c
+++ b/libparted/device.c
@@ -139,10 +139,12 @@ PedDevice*
ped_device_get (const char* path)
{
PedDevice* walk;
- char* normal_path;
+ char* normal_path = NULL;
PED_ASSERT (path != NULL, return NULL);
- normal_path = canonicalize_file_name (path);
+ /* Don't canonicalize /dev/mapper paths, see tests/symlink.c */
+ if (strncmp (path, "/dev/mapper/", 12))
+ normal_path = canonicalize_file_name (path);
if (!normal_path)
/* Well, maybe it is just that the file does not exist.
* Try it anyway. */
--
1.7.0.1

View File

@ -4,12 +4,17 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 2.2
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv3+
Group: Applications/System
URL: http://www.gnu.org/software/parted
Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
# All patches are in upstream git
# Don't cache the resolving of /dev/mapper/... symlinks, they may point
# to a different /dev/dm-# by the time we use the cached result.
Patch0: parted-dev-mapper-symlink-rh577824.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: e2fsprogs-devel
@ -49,6 +54,7 @@ Parted library, you need to install this package.
%prep
%setup -q
%patch0 -p1
iconv -f ISO-8859-1 -t UTF8 AUTHORS > tmp; touch -r AUTHORS tmp; mv tmp AUTHORS
@ -124,6 +130,9 @@ fi
%changelog
* Tue Apr 6 2010 Hans de Goede <hdegoede@redhat.com> 2.2-2
- Parted should not canonicalize symlinks under /dev/mapper (#577824)
* Tue Mar 30 2010 Hans de Goede <hdegoede@redhat.com> 2.2-1
- New upstream version 2.2 (#577478)
- Drop all our patches (all upstreamed)