From 9a21dabf72ee2d3012b22d33f7479b2a3962d180 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 22 Apr 2020 20:15:40 +0200 Subject: [PATCH] Add a patch to fix eMMC sysfs path parsing Resolves: rhbz#1826864 --- ...x-sys-block-sysfs-parsing-for-eMMC-s.patch | 55 +++++++++++++++++++ efivar.spec | 10 +++- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 0001-Fix-sys-block-sysfs-parsing-for-eMMC-s.patch diff --git a/0001-Fix-sys-block-sysfs-parsing-for-eMMC-s.patch b/0001-Fix-sys-block-sysfs-parsing-for-eMMC-s.patch new file mode 100644 index 0000000..0b7c070 --- /dev/null +++ b/0001-Fix-sys-block-sysfs-parsing-for-eMMC-s.patch @@ -0,0 +1,55 @@ +From 54dad567c41b57c4843329856ca5047e63325a9f Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 22 Apr 2020 19:33:01 +0200 +Subject: [PATCH] Fix /sys/block sysfs parsing for eMMC-s + +Commit 471869409464 ("sysfs parsers: make all the /sys/block link +parsers work the same way") has broken sysfs parsing for eMMC-s when +the passed in path points to the whole block device. + +In that case pos2 will stay at its -1 initializaton value, because we +only do 4 conversions; and when we then do: + +current += pos2 + +We end up moving current one char position backwards and we end up +returning -1. + +The correct positing to use is always pos1 independent if we got +passed the whole disk; or a parition, as we always want to return +only the part which points to whole disk which ends at pos1. + +Note that it seems that before commit 471869409464, the case where +path points to the partition was likely broken as the old code then +would return the entire path including the partition element. + +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1826864 +Signed-off-by: Hans de Goede +--- + src/linux-emmc.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/src/linux-emmc.c b/src/linux-emmc.c +index 800dc14..65557b4 100644 +--- a/src/linux-emmc.c ++++ b/src/linux-emmc.c +@@ -56,13 +56,10 @@ parse_emmc(struct device *dev, const char *path, const char *root UNUSED) + dev->emmc_info.slot_id = slot_id; + dev->interface_type = emmc; + +- if (rc == 6) { +- if (dev->part == -1) +- dev->part = partition; ++ if (rc == 6 && dev->part == -1) ++ dev->part = partition; + +- pos2 = pos1; +- } +- current += pos2; ++ current += pos1; + + debug("current:'%s' sz:%zd", current, current - path); + return current - path; +-- +2.26.0 + diff --git a/efivar.spec b/efivar.spec index 11efdd8..9dd2105 100644 --- a/efivar.spec +++ b/efivar.spec @@ -1,6 +1,6 @@ Name: efivar Version: 37 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Tools to manage UEFI variables License: LGPLv2.1 URL: https://github.com/rhboot/efivar @@ -16,6 +16,10 @@ Source1: efivar.patches %include %{SOURCE1} +# Source1 patches reflect a git snapshot, this is a separate fix on top +# with a gap in between +Patch100: 0001-Fix-sys-block-sysfs-parsing-for-eMMC-s.patch + %description efivar provides a simple command line interface to the UEFI variable facility. @@ -75,6 +79,10 @@ make abicheck %{_libdir}/*.so.* %changelog +* Wed Apr 22 2020 Hans de Goede - 37-8 +- Add a patch to fix eMMC sysfs path parsing + Resolves: rhbz#1826864 + * Mon Feb 24 2020 Peter Jones - 37-7 - Package our abignore file to try to shut taskotron up some.