Bug 836121

Summary: Kernel build can fail due to non-existent req.list
Product: [Fedora] Fedora Reporter: Bruce Jerrick <bmj001>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 17CC: gansalmon, itamar, jonathan, kernel-maint, madhu.chinakonda
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-03 14:32:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bruce Jerrick 2012-06-28 07:21:32 UTC
Description of problem:
A kernel build (rpmbuild -bb ...) can fail with:

  ...
  + sort -u req.list
  sort: open failed: req.list: No such file or directory
  error: Bad exit status from /var/tmp/rpm-tmp.qtIY2n (%build)

The problem is that req.list first gets removed, then appended to by
conditional code.  If the conditions never evaluate true, then
req.list won't exist.
The code in question comes from the %build section kernel.spec .

Version-Release number of selected component (if applicable):
First appeared in F17 Releasei (still in F18 Rawhide):
kernel-3.3.4-5.fc17.src.rpm

How reproducible:
Always, if the kernel .config is just right.

Steps to Reproduce:
Probably not worthwhile -- just examine the code (see below).
It happened to me with a kernel config that had only about 35% of
the modules enabled.  I used 'make xconfig', then copied the resulting
.config to SOURCES/config-local (see SOURCE1000 in kernel.spec).

Actual results:
Build fails.

Expected results:
Build succeeds.

Additional info (and FIX):
The relevant code from kernel.spec follows.  The relevant lines are
tagged '>>>'.  A fix is to add the line tagged 'ADD'.  It also touches
dep.list, because the code that appends to it is also conditional, and
conceivably it could end up non-existent also.

Line 1782:
        # Look through all of the modules, and throw any that have a dependency in
        # our list into the list as well.
        rm -rf dep.list dep2.list
>>>     rm -rf req.list req2.list
ADD:    touch dep.list req.list     # ensure they exist for 'sort' below
        cp %{SOURCE16} .
        for dep in `cat modnames`
        do
          depends=`modinfo $dep | grep depends| cut -f2 -d":" | sed -e 's/^[ \t]*//'`
          [ -z "$depends" ] && continue;
          for mod in `echo $depends | sed -e 's/,/ /g'`
          do
            match=`grep "^$mod.ko" mod-extra.list` ||:
            if [ -z "$match" ]
            then
              continue
            else
              # check if the module we're looking at is in mod-extra too.  if so
              # we don't need to mark the dep as required
              mod2=`basename $dep`
              match2=`grep "^$mod2" mod-extra.list` ||:
              if [ -n "$match2" ]
              then
                continue
                #echo $mod2 >> notreq.list
              else
>>>             echo $mod.ko >> req.list
              fi
            fi
          done
        done

Comment 1 Josh Boyer 2012-07-03 14:32:32 UTC

*** This bug has been marked as a duplicate of bug 833558 ***