[pacman-dev] [PATCH] pacman-db-upgrade: do not mangle file lists

Andrew Gregory andrew.gregory.8 at gmail.com
Thu Oct 2 20:35:52 UTC 2014


grep'ing out blank lines and sorting output thoroughly breaks any file
lists with %BACKUP% entries which must be separated from the file list
by a blank line.

Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---

Anybody who has replaced an owned directory with a symlink and run
pacman-db-upgrade has mangled the file list for all packages with backup files.
To check for broken file lists run:
`grep -xA1 %BACKUP% /var/lib/pacman/local/*/files | grep -B1 %FILES%`
Any file lists with output are broken.  Broken file lists can be repaired by
reinstalling the affected packages with --dbonly.  After repairing, users
should remove /var/lib/pacman/local/ALPM_DB_VERSION and run the fixed version
of pacman-db-upgrade.

 scripts/pacman-db-upgrade.sh.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/pacman-db-upgrade.sh.in b/scripts/pacman-db-upgrade.sh.in
index d2d317b..d7e34bd 100644
--- a/scripts/pacman-db-upgrade.sh.in
+++ b/scripts/pacman-db-upgrade.sh.in
@@ -211,9 +211,9 @@ if [[ -z "$db_version" ]]; then
 					{
 						if ($0 == olddir) {
 							# replace symlink with its target, including parents
-							printf("%s", parents)
-							printf("%s\n", newdir)
-						} else if ($0 == file) {
+							if (parents) printf("%s", parents)
+							if (newdir) printf("%s\n", newdir)
+						} else if (file && $0 == file) {
 							# newdir already existed as a file, skip it
 						} else if (index($0, olddir) == 1) {
 							# update paths that were under olddir
@@ -222,7 +222,7 @@ if [[ -z "$db_version" ]]; then
 							# print everything else as-is
 							print
 						}
-					}' "$f" | grep . | LC_ALL=C sort -u > "$f.tmp"
+					}' "$f" > "$f.tmp"
 				mv "$f.tmp" "$f"
 			done
 		done
-- 
2.1.1


More information about the pacman-dev mailing list