IS_DUPLICATE_FS_LABEL: blkid has a cache that can provoke false positive

Disable the cache by using `-c /dev/null`.

Example of false positive:

```
/dev/mapper/HDD0-swap2: LABEL="SWAP2" UUID="5540a49e-3e7b-4528-9c4e-49fb5f8d7f3d" TYPE="swap"
/dev/dm-0: LABEL="SWAP2" UUID="5540a49e-3e7b-4528-9c4e-49fb5f8d7f3d" TYPE="swap"
```

`dm-0` may have been cached during boot time, if you don't use a cache,
it doesn't appear any more.
This commit is contained in:
Benoît S. 2020-06-26 15:49:30 +09:00
parent 5e4b60e61b
commit 652fcdbe44

View file

@ -1013,7 +1013,7 @@ check_duplicate_fs_label() {
BLKID_BIN=$(command -v blkid)
if [ -x "$BLKID_BIN" ]; then
tmpFile=$(mktemp -p /tmp)
parts=$($BLKID_BIN | grep -ve raid_member -e EFI_SYSPART | grep -Eo ' LABEL=".*"' | cut -d'"' -f2)
parts=$($BLKID_BIN -c /dev/null | grep -ve raid_member -e EFI_SYSPART | grep -Eo ' LABEL=".*"' | cut -d'"' -f2)
for part in $parts; do
echo "$part" >> "$tmpFile"
done