Hello, Miguel!
It appears that the listings produced by RPM are unreliable. The code that
you recently uncommented (I hope that you had tested it):
rpm -qlvp "$1" | sed -e 's/^\(..........\)[-t]* /\1 1 /'
doesn't work with rpm-4.0.2 because it already prints "1" (link count)
after the premission. Adding another "1" makes the listing unparseable.
I can't think of any reliable way to deal with both listing types without
risking to have another breakage in the future. I think it would be better
to use rpm2cpio, since the output of cpio is more standartized:
rpm2cpio "$1" | cpio -tv --quiet
I'm checking it in since the fix appears to be correct. I'm also checking
in a fix that make it possible to access CONTENTS.cpio - it was placed
after "*" and thus had no chance to match.
Another problem is that the files in the Version 4 packages (RedHat 7.0
and above) cannot be accessed (except through CONTENTS.cpio) because the
names in the archive begin with "./" and cpio doesn't strip it while
searching for a file in the archive.
The workaround is to make cpio scan for both "$2" and "./$2"
I'm applying the patch, but any better suggestions will be appreciated.
--
Regards,
Pavel Roskin
____________________________
--- vfs/extfs/rpm
+++ vfs/extfs/rpm
@@ -113,7 +113,7 @@
echo "$FILEPREF 0 $DATE INFO/CHANGELOG"
fi
- rpm -qlvp "$1" | sed -e 's/^\(..........\)[-t]* /\1 1 /'
+ rpm2cpio "$1" | cpio -tv --quiet
echo "$FILEPREF 0 $DATE CONTENTS.cpio"
}
@@ -150,16 +150,16 @@
INFO/OS) rpm -qp --qf "%{OS}\n" "$1" > "$3"; exit 0;;
INFO/CHANGELOG) rpm -qp --qf "[* %{CHANGELOGTIME:date}
%{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]\n" "$1" > "$3"; exit 0;;
INFO/SIZE) rpm -qp --qf "%{SIZE} bytes\n" "$1" > "$3"; exit 0;;
+ CONTENTS.cpio) rpm2cpio "$1" > "$3"; exit 0;;
*)
TMPDIR=/tmp/mctmpdir.$$
mkdir $TMPDIR || exit 1
cd $TMPDIR
- rpm2cpio "$1" | cpio -iumd --quiet "$2" >/dev/null
- mv "$2" "$3"
+ # Files in RPM version 4 and above start with "./" - try both
+ rpm2cpio "$1" | cpio -iumd --quiet "$2" "./$2" >/dev/null
+ mv "$2" "$3" 2>/dev/null
cd /
rm -rf $TMPDIR;;
-
- CONTENTS.cpio) rpm2cpio "$1" > "$3"; exit 0;;
esac
}
____________________________