Harden move_to script.

If the package name is not found in the packages file (perhaps because
the package was resolved to a different name through Obsoletes etc)
then the move_to script could create two dependencies.  Detect this
and hard-fail.

See also:
https://bugzilla.redhat.com/show_bug.cgi?id=1568676
This commit is contained in:
Richard W.M. Jones 2018-04-19 10:00:52 +01:00
parent c251db3ac8
commit 0fc7c3e4db
1 changed files with 4 additions and 0 deletions

View File

@ -998,6 +998,10 @@ gzip --best installed-docs/*.xml
pushd $RPM_BUILD_ROOT%{_libdir}/guestfs/supermin.d
function move_to
{
if ! grep -Esq "^$1$" packages; then
echo "move_to $1: package name not found in packages file"
exit 1
fi
grep -Ev "^$1$" < packages > packages-t
mv packages-t packages
echo "$1" >> "$2"