Bug 712251

Summary: find-requires misses script #! requirements
Product: [Fedora] Fedora Reporter: Josh Stone <jistone>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 15CC: ffesti, gholms, jnovy, pmatilai
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.9.0-9.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-15 05:37:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Josh Stone 2011-06-09 23:23:09 UTC
Description of problem:
In a recent build of the systemtap-sdt-devel rpm, we discovered that it didn't get the usual implicit "Requires: /usr/bin/python" for the #! in /usr/bin/dtrace.  On further investigation, this looks like a regression for ALL package scripts, related to the changed output from "file".

Version-Release number of selected component (if applicable):
rpm-build-4.9.0-6.fc15.i686
file-5.07-2.fc15.i686

How reproducible:
100%

Steps to Reproduce:
1. rpmbuild -ba systemtap.src.rpm
2. rpm -qRp systemtap-sdt-devel.rpm
  
Actual results:
Package does not require python, despite having a script #!/usr/bin/python.

Expected results:
Requires: /usr/bin/python

Additional info:
This is not specific to systemtap - that's just how I discovered it.  It can be seen on any package with scripts, say glibc-common:/usr/bin/ldd.

Fedora 15:
$ head -n1 /usr/bin/ldd
#! /bin/bash
$ file /usr/bin/ldd
/usr/bin/ldd: Bourne-Again shell script, ASCII text executable
$ rpm -qRf /usr/bin/ldd | grep bash
$ echo $?
1

Fedora 14:
$ head -n1 /usr/bin/ldd
#! /bin/bash
$ file /usr/bin/ldd
/usr/bin/ldd: Bourne-Again shell script text executable
$ rpm -qRf /usr/bin/ldd | grep bash
/bin/bash  
$ echo $?
0


I include the "file" output because I think this change caused the breakage, via this command in /usr/lib/rpm/find-requires:

scriptlist=`echo $filelist | xargs -r file | \
        grep -E ":.* (commands|script) " | cut -d: -f1`

The new "file" output places a comma that will break this regex.

Comment 1 Panu Matilainen 2011-06-10 07:49:02 UTC
Oh ugh :( Thanks for the heads-up, this is a pretty nasty regression, indeed caused by file 5.07 change(s).

/usr/lib/rpm/find-requires might be affected too, but that's the old "external" dependency generator which is not really used for anything in Fedora, the more relevant part is in /usr/lib/rpm/fileattrs/script.attr:

%__script_requires      %{_rpmconfigdir}/script.req
%__script_magic         ^.* script text.*$
%__script_flags         exeonly

The file output was "<mumble> script text" for years, makes one wonder why they suddenly changed it. Anyway... will fix ASAP.

Comment 2 Fedora Update System 2011-06-10 10:35:40 UTC
rpm-4.9.0-9.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/rpm-4.9.0-9.fc15

Comment 3 Fedora Update System 2011-06-11 04:32:58 UTC
Package rpm-4.9.0-9.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing rpm-4.9.0-9.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/rpm-4.9.0-9.fc15
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2011-06-15 05:37:34 UTC
rpm-4.9.0-9.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.