[OpenWrt-Devel] [PATCH] opkg: remove inexistent files from list only

Peter Stadler peter.stadler at student.uibk.ac.at
Sat Apr 4 07:30:15 EDT 2020


This avoids misleading messages for files that are deleted already
(by the user or by remove_obsolesced_files), e.g. for conffiles:
  * file_sha256sum_alloc: Failed to open file …
  Not deleting modified conffile …
(This statement is false for obsolete files as opkg deleted them.)

Signed-off-by: Peter Stadler <peter.stadler at student.uibk.ac.at>
---
 libopkg/opkg_remove.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c
index 96ca558..a9c7d5a 100644
--- a/libopkg/opkg_remove.c
+++ b/libopkg/opkg_remove.c
@@ -355,6 +355,12 @@ void remove_data_files_and_list(pkg_t * pkg)
 	     iter = str_list_next(installed_files, iter)) {
 		file_name = (char *)iter->data;
 
+		if (!file_exists(file_name)) {
+			/* File deleted by user or remove_obsolesced_files(). */
+			file_hash_remove(file_name);
+			continue;
+		}
+
 		owner = file_hash_get_file_owner(file_name);
 		if (owner != pkg)
 			/* File may have been claimed by another package. */
-- 
2.24.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list