summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro del Castillo <alejandro.delcastillo@ni.com>2018-09-05 13:16:57 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-09-06 10:36:31 +0100
commitfe40065693a936102804a37b53413eeb740180a4 (patch)
treec38a9cf5fb3ea1e1e32af3d3f5d6f12603e3b3ef
parent1d313f7cda527a2c4631d874e7406ea1a13ab86f (diff)
downloadpoky-fe40065693a936102804a37b53413eeb740180a4.tar.gz
opkg: add strict package matching on removal patch
During removal, opkg is using globs to select which metadata files to remove. The glob is too broad and sometimes can result in a package removing the metadata from a package with a close name. Make the matching more strict. Fixes bugzilla 12905 (From OE-Core rev: 715180e41884393d4f2f234dd557df61a21c4745) Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/opkg/opkg/0001-remove_maintainer_scripts-use-strict-matching.patch56
-rw-r--r--meta/recipes-devtools/opkg/opkg_0.3.6.bb1
2 files changed, 57 insertions, 0 deletions
diff --git a/meta/recipes-devtools/opkg/opkg/0001-remove_maintainer_scripts-use-strict-matching.patch b/meta/recipes-devtools/opkg/opkg/0001-remove_maintainer_scripts-use-strict-matching.patch
new file mode 100644
index 0000000000..ec160290be
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg/0001-remove_maintainer_scripts-use-strict-matching.patch
@@ -0,0 +1,56 @@
1From 55c4ad666e76281bdd0db55fa6f4ab2744fea7e4 Mon Sep 17 00:00:00 2001
2From: Alejandro del Castillo <alejandro.delcastillo@ni.com>
3Date: Tue, 4 Sep 2018 18:06:00 -0500
4Subject: [PATCH] remove_maintainer_scripts: use strict matching
5
6The function is using a glob to select which metadata files needs to be
7deleted during package removal, on the info_dir. However, the glob may
8match metadata files from packages with similar names. For example,
9during removal of package glibc-binary-localedata-de-at, the current
10logic was also removing the metadata for
11glibc-binary-localedata-de-at.iso-8859-1. Add check for an exact match
12before deletion.
13
14Fixes bugzilla: 12905
15
16Upstream-Status: Submitted [https://groups.google.com/forum/#!topic/opkg-devel/Fr40Yt0NBno]
17Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
18---
19 libopkg/opkg_remove.c | 14 +++++++++++---
20 1 file changed, 11 insertions(+), 3 deletions(-)
21
22diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c
23index 82125fa..3936628 100644
24--- a/libopkg/opkg_remove.c
25+++ b/libopkg/opkg_remove.c
26@@ -137,7 +137,7 @@ void remove_maintainer_scripts(pkg_t * pkg)
27 {
28 unsigned int i;
29 int err;
30- char *globpattern;
31+ char *globpattern, *filename, *lastdot;
32 glob_t globbuf;
33
34 if (opkg_config->noaction)
35@@ -151,8 +151,16 @@ void remove_maintainer_scripts(pkg_t * pkg)
36 return;
37
38 for (i = 0; i < globbuf.gl_pathc; i++) {
39- opkg_msg(INFO, "Deleting %s.\n", globbuf.gl_pathv[i]);
40- unlink(globbuf.gl_pathv[i]);
41+ filename = xstrdup(basename(globbuf.gl_pathv[i]));
42+ lastdot = strrchr(filename, '.');
43+ *lastdot = '\0';
44+ // Only delete files that match the package name (the glob may match files
45+ // with similar names)
46+ if (!strcmp(filename, pkg->name)) {
47+ opkg_msg(INFO, "Deleting %s.\n", globbuf.gl_pathv[i]);
48+ unlink(globbuf.gl_pathv[i]);
49+ }
50+ free(filename);
51 }
52 globfree(&globbuf);
53 }
54--
552.18.0
56
diff --git a/meta/recipes-devtools/opkg/opkg_0.3.6.bb b/meta/recipes-devtools/opkg/opkg_0.3.6.bb
index 579b51166c..6ebd58b967 100644
--- a/meta/recipes-devtools/opkg/opkg_0.3.6.bb
+++ b/meta/recipes-devtools/opkg/opkg_0.3.6.bb
@@ -14,6 +14,7 @@ PE = "1"
14SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz \ 14SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz \
15 file://opkg.conf \ 15 file://opkg.conf \
16 file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \ 16 file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \
17 file://0001-remove_maintainer_scripts-use-strict-matching.patch \
17" 18"
18 19
19SRC_URI[md5sum] = "79e04307f6f54db431c251772d7d987c" 20SRC_URI[md5sum] = "79e04307f6f54db431c251772d7d987c"