On Fri, Oct 03, 2014 at 08:48:51AM -0400, Dave Reisner wrote: > On Thu, Oct 02, 2014 at 04:35:52PM -0400, Andrew Gregory wrote: > > 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 <[email protected]> > > --- > > > > 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. > > Tested this since I was affected -- I don't know what the script did > this time, but it *didn't* destroy my local DB. So, +1. > > > 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) > > parents and newdir are invariants for the duration of the awk program. > Why not skip the whole for loop when [[ -z $parents$newdir ]] ? If you > do that, I think your printf here simply becomes: > > printf("%s%s\n", parents, newdir) >
Hrm. This comment makes no sense. Nevermind.
