1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
From b0902e36108b49e6bc88d6b251cc2f8cffcd5a13 Mon Sep 17 00:00:00 2001
From: Ricardo Ribalda <ricardo@ribalda.com>
Date: Sun, 5 Apr 2020 11:40:30 +0000
Subject: [PATCH] pseudo: On a DB fixup remove files that do not exist anymore
If the user decides to fix a database, remove the files that do not
exist anymore.
If only DB test is selected do not change the behaviour (return error).
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
Upstream-Status: Submitted [https://lists.openembedded.org/g/openembedded-core/message/137045]
---
pseudo.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/pseudo.c b/pseudo.c
index 0f5850e..98e5b0c 100644
--- a/pseudo.c
+++ b/pseudo.c
@@ -1087,9 +1087,15 @@ pseudo_db_check(int fix) {
int fixup_needed = 0;
pseudo_debug(PDBGF_DB, "Checking <%s>\n", m->path);
if (lstat(m->path, &buf)) {
- errors = EXIT_FAILURE;
- pseudo_diag("can't stat <%s>\n", m->path);
- continue;
+ if (!fix) {
+ pseudo_diag("can't stat <%s>\n", m->path);
+ errors = EXIT_FAILURE;
+ continue;
+ } else {
+ pseudo_debug(PDBGF_DB, "can't stat <%s>\n", m->path);
+ fixup_needed = 2;
+ goto do_fixup;
+ }
}
/* can't check for device type mismatches, uid/gid, or
* permissions, because those are the very things we
@@ -1125,6 +1131,7 @@ pseudo_db_check(int fix) {
S_ISDIR(m->mode));
fixup_needed = 2;
}
+ do_fixup:
if (fixup_needed) {
/* in fixup mode, either delete (mismatches) or
* correct (dev/ino).
--
2.21.1
|