[Rpm-maint] Strange test in doPatch/doUntar

Jean Delvare jdelvare at suse.de
Wed Jan 28 15:08:38 UTC 2015

Hi all,

While working on the rpmbuild performance patch I send last week, I
noticed something curious in file build/parsePrep.c, functions doPatch
and doUntar. These two functions look quite similar in the way they are
called and what they do. However they have different conditions for
early exit. doPatch has:

   /* On non-build parse's, file cannot be stat'd or read. */
    if ((spec->flags & RPMSPEC_FORCE) || rpmFileIsCompressed(fn, &compressed) || checkOwners(fn)) goto exit;

while doUntar has:

    /* XXX On non-build parse's, file cannot be stat'd or read */
    if (!(spec->flags & RPMSPEC_FORCE) && (rpmFileIsCompressed(fn, &compressed) || checkOwners(fn))) {
	goto exit;

While I will gladly admit my ignorance regarding what a "non-build
parse" is, I find the difference in logic rather suspect. Can anyone
more familiar with the code double check if one of these conditions is

Looking at the git history, I can see that the conditions were similar
up to this commit which changed the condition in doPatch:

commit 54b027535f95fea9088f2cd12ed765fddb20c5c1
Author: Panu Matilainen
Date:   Wed Mar 18 14:53:34 2009 +0200

    Don't try to parse %patch on spec query (rhbz#487855)

So I would bet that the condition in doUntar is incorrect and should be
fixed the same way?

Jean Delvare
SUSE L3 Support

More information about the Rpm-maint mailing list