From e356a6eeae96906d0b1a3b4b2bd75a4fe57fb9a1fb44725319bfcd58f05584f8 Mon Sep 17 00:00:00 2001 From: Gary Ching-Pang Lin Date: Tue, 5 Mar 2013 10:12:49 +0000 Subject: [PATCH] Accepting request 157208 from home:gary_lin:branches:devel:openSUSE:Factory (bnc#798043#c4) remove double seperators from the bootpath OBS-URL: https://build.opensuse.org/request/show/157208 OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory/shim?expand=0&rev=20 --- shim-bnc798043-no-doulbe-separators.patch | 59 +++++++++++++++++++++++ shim.changes | 6 +++ shim.spec | 3 ++ 3 files changed, 68 insertions(+) create mode 100644 shim-bnc798043-no-doulbe-separators.patch diff --git a/shim-bnc798043-no-doulbe-separators.patch b/shim-bnc798043-no-doulbe-separators.patch new file mode 100644 index 0000000..27a0140 --- /dev/null +++ b/shim-bnc798043-no-doulbe-separators.patch @@ -0,0 +1,59 @@ +From 5c736550e8f7645f39df6948785ab5cae2201418 Mon Sep 17 00:00:00 2001 +From: Gary Ching-Pang Lin +Date: Fri, 1 Mar 2013 18:04:06 +0800 +Subject: [PATCH] Remove double-separators from the bootpath + +--- + shim.c | 27 ++++++++++++++++++++------- + 1 file changed, 20 insertions(+), 7 deletions(-) + +diff --git a/shim.c b/shim.c +index 690d064..c36b641 100644 +--- a/shim.c ++++ b/shim.c +@@ -907,7 +907,7 @@ static EFI_STATUS generate_path(EFI_LOADED_IMAGE *li, CHAR16 *ImagePath, + { + EFI_DEVICE_PATH *devpath; + EFI_HANDLE device; +- int i; ++ int i, j, last = -1; + unsigned int pathlen = 0; + EFI_STATUS efi_status = EFI_SUCCESS; + CHAR16 *bootpath; +@@ -927,14 +927,27 @@ static EFI_STATUS generate_path(EFI_LOADED_IMAGE *li, CHAR16 *ImagePath, + if (bootpath[i] == '/') + bootpath[i] = '\\'; + } ++ + for (i=pathlen; i>0; i--) { +- if (bootpath[i] == '\\' && bootpath[i-1] != '\\') +- break; ++ if (bootpath[i] == '\\' && bootpath[i-1] == '\\') ++ bootpath[i] = '/'; ++ else if (last == -1 && bootpath[i] == '\\') ++ last = i; ++ } ++ ++ if (last == -1 && bootpath[0] == '\\') ++ last = 0; ++ bootpath[last+1] = '\0'; ++ ++ if (last > 0) { ++ for (i = 0, j = 0; bootpath[i] != '\0'; i++) { ++ if (bootpath[i] != '/') { ++ bootpath[j] = bootpath[i]; ++ j++; ++ } ++ } ++ bootpath[j] = '\0'; + } +- if (bootpath[i] == '\\') +- bootpath[i+1] = '\0'; +- else +- bootpath[0] = '\0'; + + while (*ImagePath == '\\') + ImagePath++; +-- +1.7.10.4 + diff --git a/shim.changes b/shim.changes index 2e94ad5..5c21249 100644 --- a/shim.changes +++ b/shim.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Mar 1 10:07:55 UTC 2013 - glin@suse.com + +- Add shim-bnc798043-no-doulbe-separators.patch to remove double + seperators from the bootpath (bnc#798043#c4) + ------------------------------------------------------------------- Thu Feb 28 08:57:48 UTC 2013 - lnussel@suse.de diff --git a/shim.spec b/shim.spec index d110803..b48dd8b 100644 --- a/shim.spec +++ b/shim.spec @@ -55,6 +55,8 @@ Patch9: shim-mokmanager-support-crypt-hash-method.patch Patch10: shim-keep-unsigned-mokmanager.patch # PATCH-FIX-UPSTREAM shim-bnc804631-fix-broken-bootpath.patch bnc#804631 glin@suse.com -- Fix the broken bootpath generated in generate_path() Patch11: shim-bnc804631-fix-broken-bootpath.patch +# PATCH-FIX-UPSTREAM shim-bnc798043-no-doulbe-separators.patch bnc#798043 glin@suse.com -- Remove all double-separators from the bootpath +Patch12: shim-bnc798043-no-doulbe-separators.patch BuildRequires: gnu-efi >= 3.0q BuildRequires: mozilla-nss-tools BuildRequires: openssl >= 0.9.8 @@ -87,6 +89,7 @@ Authors: %patch9 -p1 %patch10 -p1 %patch11 -p1 +%patch12 -p1 %build chmod +x "make-certs"