aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2017-01-10 15:39:47 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-11-21 14:42:59 +0000
commitc32bca840d262ebc5ac93b06d0bce79729a178b1 (patch)
tree7f3d653526cd814842adc2549f88c15f1a7ef91f
parenta0cb33b3285de03ae901e474da255efc88811c2d (diff)
downloadopenembedded-core-c32bca840d262ebc5ac93b06d0bce79729a178b1.zip
openembedded-core-c32bca840d262ebc5ac93b06d0bce79729a178b1.tar.gz
openembedded-core-c32bca840d262ebc5ac93b06d0bce79729a178b1.tar.bz2
opkg: fix conffile errors in 'opkg status' calls
If a conffile has been deleted (common when building a debugfs) the status command will throw errors instead of handling that situation. Stop the code being executed in the first place if it wasn't asked for, and handle errors gracefully. [ YOCTO #10761 ] Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta/recipes-devtools/opkg/opkg/status-conffile.patch69
-rw-r--r--meta/recipes-devtools/opkg/opkg_0.3.3.bb1
2 files changed, 70 insertions, 0 deletions
diff --git a/meta/recipes-devtools/opkg/opkg/status-conffile.patch b/meta/recipes-devtools/opkg/opkg/status-conffile.patch
new file mode 100644
index 0000000..6fc405b
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg/status-conffile.patch
@@ -0,0 +1,69 @@
+Upstream-Status: Submitted
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From 086d5083dfe0102368cb7c8ce89b0c06b64ca773 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@intel.com>
+Date: Tue, 10 Jan 2017 15:24:59 +0000
+Subject: [PATCH 1/2] opkg_cmd: only look at conffile status if we're going to
+ output it
+
+The loop to compare the recorded conffile hash with their hash on disk is
+outputted at level INFO but the loop was executed at level NOTICE and higher.
+
+This means that if a conffile had been deleted the status operation would
+produce error messages for output it isn't displaying.
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+---
+ libopkg/opkg_cmd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c
+index ba57c6a..37416fd 100644
+--- a/libopkg/opkg_cmd.c
++++ b/libopkg/opkg_cmd.c
+@@ -638,7 +638,7 @@ static int opkg_info_status_cmd(int argc, char **argv, int installed_only)
+
+ pkg_formatted_info(stdout, pkg);
+
+- if (opkg_config->verbosity >= NOTICE) {
++ if (opkg_config->verbosity >= INFO) {
+ conffile_list_elt_t *iter;
+ for (iter = nv_pair_list_first(&pkg->conffiles); iter;
+ iter = nv_pair_list_next(&pkg->conffiles, iter)) {
+--
+2.8.1
+
+From 225e30e0f9fa7cfeaa3f89e2713e5147ab371def Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@intel.com>
+Date: Tue, 10 Jan 2017 15:28:47 +0000
+Subject: [PATCH 2/2] conffile: gracefully handle deleted conffiles in
+ conffile_has_been_modified
+
+Handle conffiles that don't exist gracefully so that instead of showing an error
+message from file_md5sum_alloc() a notice that the file has been deleted is
+shown instead.
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+---
+ libopkg/conffile.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/libopkg/conffile.c b/libopkg/conffile.c
+index b2f2469..7b4b87b 100644
+--- a/libopkg/conffile.c
++++ b/libopkg/conffile.c
+@@ -51,6 +51,11 @@ int conffile_has_been_modified(conffile_t * conffile)
+ }
+
+ root_filename = root_filename_alloc(filename);
++ if (!file_exists(root_filename)) {
++ opkg_msg(INFO, "Conffile %s deleted\n", conffile->name);
++ free(root_filename);
++ return 1;
++ }
+
+ md5sum = file_md5sum_alloc(root_filename);
+
+--
+2.8.1
diff --git a/meta/recipes-devtools/opkg/opkg_0.3.3.bb b/meta/recipes-devtools/opkg/opkg_0.3.3.bb
index bce72fc..6e7c26d 100644
--- a/meta/recipes-devtools/opkg/opkg_0.3.3.bb
+++ b/meta/recipes-devtools/opkg/opkg_0.3.3.bb
@@ -15,6 +15,7 @@ SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz
file://opkg-configure.service \
file://opkg.conf \
file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \
+ file://status-conffile.patch \
"
SRC_URI[md5sum] = "a4613038c8afc7d8d482f5c53f137bdf"