Accepting request 900464 from home:gary_lin:branches:Base:System

- Add efivar-bsc1187386-fix-emmc-parsing.patch to fix the eMMC sysfs parsing (bsc#1187386)
- Add efivar-bsc1181967-fix-nvme-parsing.patch to fix the NVME path parsing (bsc#1181967)

OBS-URL: https://build.opensuse.org/request/show/900464
OBS-URL: https://build.opensuse.org/package/show/Base:System/efivar?expand=0&rev=50
This commit is contained in:
Gary Ching-Pang Lin 2021-06-17 00:38:28 +00:00 committed by Git OBS Bridge
parent 6d854739db
commit 7c5479f2f7
4 changed files with 2990 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
From 046f92b28c1d8114307b4588ee4ff33b8bab5904 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
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 position to use is always pos1 independent if we got
passed the whole disk; or a partition, 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 <hdegoede@redhat.com>
(cherry picked from commit f0d3ed17ef3b2bbdfdff4dde12ec0a82d1ccdd33)
---
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 bafa9cd..b68c51a 100644
--- a/src/linux-emmc.c
+++ b/src/linux-emmc.c
@@ -70,13 +70,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.31.1

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Jun 16 06:45:21 UTC 2021 - Gary Ching-Pang Lin <glin@suse.com>
- Add efivar-bsc1187386-fix-emmc-parsing.patch to fix the eMMC
sysfs parsing (bsc#1187386)
- Add efivar-bsc1181967-fix-nvme-parsing.patch to fix the NVME
path parsing (bsc#1181967)
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Sep 8 09:31:54 UTC 2020 - Gary Ching-Pang Lin <glin@suse.com> Tue Sep 8 09:31:54 UTC 2020 - Gary Ching-Pang Lin <glin@suse.com>

View File

@ -1,7 +1,7 @@
# #
# spec file for package efivar # spec file for package efivar
# #
# Copyright (c) 2020 SUSE LLC # Copyright (c) 2021 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -43,6 +43,8 @@ Patch2: efivar-Fix-all-the-places-Werror-address-of-packed-member-c.patc
Patch3: efivar-bsc1127544-fix-ucs2len.patch Patch3: efivar-bsc1127544-fix-ucs2len.patch
Patch4: efivar-fix-efidp_ipv4_addr-fields-assignment.patch Patch4: efivar-fix-efidp_ipv4_addr-fields-assignment.patch
Patch5: efivar-bsc1175989-handle-NULL-set-variable.patch Patch5: efivar-bsc1175989-handle-NULL-set-variable.patch
Patch6: efivar-bsc1181967-fix-nvme-parsing.patch
Patch7: efivar-bsc1187386-fix-emmc-parsing.patch
%if "0%{?buildroot}" == "0" %if "0%{?buildroot}" == "0"
# set a sane value for buildroot, unless it's already there! # set a sane value for buildroot, unless it's already there!
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -90,6 +92,8 @@ perl -pi -e 's{\#include \<uchar\.h\>}{typedef __CHAR16_TYPE__ char16_t;}' \
%patch3 -p1 %patch3 -p1
%patch4 -p1 %patch4 -p1
%patch5 -p1 %patch5 -p1
%patch6 -p1
%patch7 -p1
%build %build
CFLAGS="%{optflags} -Wno-nonnull -flto" CFLAGS="%{optflags} -Wno-nonnull -flto"