GNU bug report logs -
#15348
[PATCH 11/19] libparted: don't canonicalize /dev/md/ paths (#872361)
Previous Next
To reply to this bug, email your comments to 15348 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-parted <at> gnu.org
:
bug#15348
; Package
parted
.
(Wed, 11 Sep 2013 20:16:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Brian C. Lane" <bcl <at> redhat.com>
:
New bug report received and forwarded. Copy sent to
bug-parted <at> gnu.org
.
(Wed, 11 Sep 2013 20:16:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Brian C. Lane" <bcl <at> redhat.com>
This is the same issue we have with /dev/mapper/ paths that was fixed in
commit c1eb485b9fd8919e18f192d678bc52b0488e6ee0. When libparted
is used to setup the device the symlink should be used to reference it,
not the backing device name which could change.
* libparted/device.c (ped_device_get): Don't canonicalize names
that start with "/dev/md/".
---
libparted/device.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libparted/device.c b/libparted/device.c
index 738b320..cdcc117 100644
--- a/libparted/device.c
+++ b/libparted/device.c
@@ -152,8 +152,11 @@ ped_device_get (const char* path)
char* normal_path = NULL;
PED_ASSERT (path != NULL);
- /* Don't canonicalize /dev/mapper paths, see tests/symlink.c */
- if (strncmp (path, "/dev/mapper/", 12))
+ /* Don't canonicalize /dev/mapper or /dev/md/ paths, see
+ tests/symlink.c
+ */
+ if (strncmp (path, "/dev/mapper/", 12) &&
+ strncmp (path, "/dev/md/", 8))
normal_path = canonicalize_file_name (path);
if (!normal_path)
/* Well, maybe it is just that the file does not exist.
--
1.8.3.1
Information forwarded
to
bug-parted <at> gnu.org
:
bug#15348
; Package
parted
.
(Wed, 25 Sep 2013 15:57:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 15348 <at> debbugs.gnu.org (full text, mbox):
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I still think this section of code is wrong for two reasons:
1) It should not skip canonicalization, but rather do it correctly
2) It should not be based on the path given, but on the dev_t
Examples:
parted /dev/disk/by-id/xxxxx print
parted /dev/vg/lv print
Because the string does not start with /dev/mapper, it is
canonicalized to /dev/dm-x. Instead it should notice the dev_t major
is device mapper, and use the dm api to read the name and append it to
"/dev/mapper" for the official name.
On 9/11/2013 3:25 PM, Brian C. Lane wrote:
> From: "Brian C. Lane" <bcl <at> redhat.com>
>
> This is the same issue we have with /dev/mapper/ paths that was
> fixed in commit c1eb485b9fd8919e18f192d678bc52b0488e6ee0. When
> libparted is used to setup the device the symlink should be used to
> reference it, not the backing device name which could change.
>
> * libparted/device.c (ped_device_get): Don't canonicalize names
> that start with "/dev/md/". --- libparted/device.c | 7 +++++-- 1
> file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/libparted/device.c b/libparted/device.c index
> 738b320..cdcc117 100644 --- a/libparted/device.c +++
> b/libparted/device.c @@ -152,8 +152,11 @@ ped_device_get (const
> char* path) char* normal_path = NULL;
>
> PED_ASSERT (path != NULL); - /* Don't canonicalize /dev/mapper
> paths, see tests/symlink.c */ - if (strncmp (path, "/dev/mapper/",
> 12)) + /* Don't canonicalize /dev/mapper or /dev/md/ paths, see +
> tests/symlink.c + */ + if (strncmp (path, "/dev/mapper/", 12) && +
> strncmp (path, "/dev/md/", 8)) normal_path = canonicalize_file_name
> (path); if (!normal_path) /* Well, maybe it is just that the file
> does not exist.
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJSQwfEAAoJEJrBOlT6nu75U4oIANFSZR6fU0vKIYLp/GIGjVOM
aqaPoBFpzWMfXoP4niJaKLm22Q0t50ckjl6Mv9iwoZbI2xHj0vaFCDwEttw6wCYZ
hLt6JLFmA3sZE8psSm9VeflCCgEIKVtOS4pq0S13eWcZhlW6JgMpbidHVg2Fvjkw
eBK2MUY0nga22J1B8Ib84ugv/RImatg/x2w1+xwfihon83MnKz5v9ZwybQ/bUHhc
Bm1xAbtihdfLUzSFoblAhQqdBdUnoUmlOaLsHch2ZY+/4cEu1H76WiHdLUcO6GZV
MjMh9UPZGVSvCmMtUgL7SmbAdsVy5EcaYTfzDPI/k9I5LaBsw2tRl97vUoEfMzc=
=b+wC
-----END PGP SIGNATURE-----
Information forwarded
to
bug-parted <at> gnu.org
:
bug#15348
; Package
parted
.
(Mon, 30 Sep 2013 02:22:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 15348 <at> debbugs.gnu.org (full text, mbox):
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
I just posted a patch refactoring the existing dm fix in the way that
I described. I'm not sure what ioctls are needed to retrieve the
correct name for md devices, so I haven't tried to do that part yet.
If you know how to do that, you should be able to see the direction I
went with the dm devices and follow suit with md.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBCgAGBQJSSOA3AAoJEJrBOlT6nu75pHoH/REFNjKL2Z5yS4Hbk7q7+7uq
KZaxWU8lyGSjIBH6ZduePnPaaYELmJJAsBQcEuKQgpXv0GcQYkjewL3hnCtM1QZG
2VhbzMX7OoL7coPNjY6t/VzpgAGKDxqFSiDcm8gmyZxOaaD7t6je9udI0gjcwmJS
jZOXslsUH4MuVDtdL1yFMb0buvZC/CVeeH5RZ1gRFbshLT8LqCvHucJ6b3qeDUCh
hH3a4c3/T70fTG057j7QXC6oLxDK6UhJvKmxgH2QvSmSfevytl3M+AJvwDkdUGR9
MbQ1AYgFTyVxxlxcpPqjemspGtj8I70E4Z82zOJXIjgGvtjrAdIwWXQIRC6lDKg=
=3Qg7
-----END PGP SIGNATURE-----
Information forwarded
to
bug-parted <at> gnu.org
:
bug#15348
; Package
parted
.
(Mon, 30 Sep 2013 19:30:04 GMT)
Full text and
rfc822 format available.
Message #14 received at 15348 <at> debbugs.gnu.org (full text, mbox):
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Now that I look more closely at the named md situation, it seems it
doesn't quite face the same issue as dm. With dm, you must not
canonicalize the name when generating the partition device name, since
there is no /dev/dm-0p1 ( so we would fail to open the partition dev
node ). With md, there is a /dev/md0p1, in addition to the
/dev/md/foo1 symlink pointing to it, so either way should work.
I guess now the purpose of this patch is purely for the user
experience? If a user runs parted on /dev/md/foo then they expect
parted to state that is what it is working on instead of /dev/md0? Is
the reverse true, or should parted always favor the name even if run
on the number? What if it is invoked on /dev/disk/by-id?
On 9/29/2013 10:21 PM, Phillip Susi wrote:
> I just posted a patch refactoring the existing dm fix in the way
> that I described. I'm not sure what ioctls are needed to retrieve
> the correct name for md devices, so I haven't tried to do that part
> yet. If you know how to do that, you should be able to see the
> direction I went with the dm devices and follow suit with md.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJSSdExAAoJEJrBOlT6nu75mMAH/iXGT9r6SftVnyTgTHmi1cV2
iY+WTy/LlzPDoXz/b3NhLU/+v7HG/fYSiee3itG1Qim/YT3ytc/1xBc9EaMqhXCL
myh6bOwheMovD+TuFRySbTi7KamWFy7f9pQafmHsYN6Hiy9ueDzTL3do0SrVshU4
VmMa8hcwFAvYdmrSIwvbSLY/UUmj/7GvJ1QeE9QgVs7Flu4Zi4tmSXpEMni1Xy8f
Sm+A3bUzOhEQegiYlwyFiBqyzNQfIy6Bz2Fomnw4w7A3PICjiH9pzUP7SM3EG20R
CbPKMdYmNWaX2d9XNHQIPGC4w3xOl1D9tuvIn57lWZJ4cXDzX6T37JDVZZsvfCw=
=qM1I
-----END PGP SIGNATURE-----
Information forwarded
to
bug-parted <at> gnu.org
:
bug#15348
; Package
parted
.
(Wed, 02 Oct 2013 18:46:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 15348 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Mon, Sep 30, 2013 at 03:29:53PM -0400, Phillip Susi wrote:
> Now that I look more closely at the named md situation, it seems it
> doesn't quite face the same issue as dm. With dm, you must not
> canonicalize the name when generating the partition device name, since
> there is no /dev/dm-0p1 ( so we would fail to open the partition dev
> node ). With md, there is a /dev/md0p1, in addition to the
> /dev/md/foo1 symlink pointing to it, so either way should work.
>
> I guess now the purpose of this patch is purely for the user
> experience? If a user runs parted on /dev/md/foo then they expect
> parted to state that is what it is working on instead of /dev/md0? Is
> the reverse true, or should parted always favor the name even if run
> on the number? What if it is invoked on /dev/disk/by-id?
I think parted should always stick with the name the user gives it. I'm
not sure what side-effects that would have so that's why I only changed
it for /dev/md/
I don't think looking up specific majors is useful here, the actual
problem is that when something uses libparted (eg. anaconda) to open a
device and then later tries to look it up by that same path it won't
find it if the symlink is followed and the name changed.
Personally, I can't think of a situation where I'd ever want the name I
give it to be changed, whether I'm using the cli or libparted. Maybe we
should drop that whole bit and just use the path we're given?
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
[Message part 2 (application/pgp-signature, inline)]
Information forwarded
to
bug-parted <at> gnu.org
:
bug#15348
; Package
parted
.
(Wed, 02 Oct 2013 19:14:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 15348 <at> debbugs.gnu.org (full text, mbox):
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 10/2/2013 2:45 PM, Brian C. Lane wrote:
> I think parted should always stick with the name the user gives it.
> I'm not sure what side-effects that would have so that's why I only
> changed it for /dev/md/
I kind of like the fact that it tells you what the "real" device is
when you run it on a symlink.
> I don't think looking up specific majors is useful here, the
> actual problem is that when something uses libparted (eg. anaconda)
> to open a device and then later tries to look it up by that same
> path it won't find it if the symlink is followed and the name
> changed.
I don't follow.
> Personally, I can't think of a situation where I'd ever want the
> name I give it to be changed, whether I'm using the cli or
> libparted. Maybe we should drop that whole bit and just use the
> path we're given?
Just because you have a symlink to a disk doesn't mean the partitions
will follow suit. For instance, if you look at /dev/disk/by-id/foo,
you don't have /dev/disk/by-id/foo1. That means that we at least
internally have to canonicalize the name to open the correct partition
node. Would calling tools then be confused and try to look for the
partition in /dev/disk/by-id?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJSTHBWAAoJEJrBOlT6nu75554H/RWRBs2b1NCjv1e38vugEfGy
Iea6//amNYDdWd2bOcwisvZaxWm/X3o399ZORpP88WxrGtub1Pb34ynpLDDpQ5zK
8cc/NBzqJ3ho74F5vb2FyXtg4SrMrDlkC9GO7g3S7NVhKAJHxPNx6WQ4L1MACEus
b2DDx8xEplwYpgSc0FG73Gg5JTi6hF/GmT8tqufPBbQcXg/W6/9vUYclmctGrz74
XdHbGJXXB5zkvFua0J8bjVKdLckaGR/JbiKJF7eG1tpgYp1uSCHC6MgYF8EHe+kq
eiWPEkgzrlHlvYP5k51RKms386AeQLhrY2fn4eolrWLZKQJe8Si8t+AglZtXKNo=
=YeAt
-----END PGP SIGNATURE-----
This bug report was last modified 11 years and 313 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.