]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libblkid: store only canonical devnames to the cache
authorKarel Zak <kzak@redhat.com>
Thu, 26 May 2016 10:02:12 +0000 (12:02 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 26 May 2016 10:15:26 +0000 (12:15 +0200)
commit924c93d9df118338fd54cd73b4a45ccddc4ac103
tree2538ad30217f7771cd76a59f19e649a78de6c1ee
parent4d7ef267ccc7675c319d04179c3c2a9396af1e93
libblkid: store only canonical devnames to the cache

Let's try to use symlink:

 # ls -la /dev/block/8\:1
 # lrwxrwxrwx 1 root root 7 May 25 16:42 /dev/block/8:1 -> ../sda1

 # blkid /dev/block/8:1
 /dev/block/8:3: LABEL="HOME" UUID="196972ad-3b13-4bba-ac54-4cb3f7b409a4" TYPE="ext4" PARTUUID="6073277f-87bc-43ff-bcfd-724c4484a63a"

unfortunately the symlink is stored to the cache:

 <device DEVNO="0x0803" TIME="1464253300.715279" LABEL="HOME" UUID="196972ad-3b13-4bba-ac54-4cb3f7b409a4" TYPE="ext4" PARTUUID="6073277f-87bc-43ff-bcfd-724c4484a63a">/dev/block/8:3</device>

next time if you ask for LABEL=HOME the answer will be /dev/block/8:3
rather than /dev/sda3.

It seems better to canonicalize the paths we store to the cache.

Unfortunately if you ask for /dev/block/8:3 then you probably expect
that blkid_dev_devname() returns the same path. This patch introduces
dev->bid_xname, this is the path used by application (and never stored
in the cache).

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1332779
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/blkidP.h
libblkid/src/dev.c
libblkid/src/devname.c