Bug 58519
Summary: | /usr/lib/rpm/find-{provides,requires}.{perl,} are obsolete/broken | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | dharris | ||||||
Component: | rpm-build | Assignee: | Jeff Johnson <jbj> | ||||||
Status: | CLOSED RAWHIDE | QA Contact: | |||||||
Severity: | medium | Docs Contact: | |||||||
Priority: | medium | ||||||||
Version: | 7.2 | ||||||||
Target Milestone: | --- | ||||||||
Target Release: | --- | ||||||||
Hardware: | i386 | ||||||||
OS: | Linux | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2002-01-19 14:26:55 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: | |||||||||
Attachments: |
|
Description
dharris
2002-01-18 16:36:48 UTC
Created attachment 42834 [details]
Suggested patch to solve problem
NOTE: I have not tested this patch. It looks simple enough to me to be correct. However, I recommend that you test it before using. Mea culpa. I was wrong when I stated that find-requires.perl and find-requires produce the same result. (However, I still find that find-provides.perl and find-provides produce the same result.) I ran this command as a test: # find /usr/lib/perl5 | /usr/lib/rpm/find-requires | sort | uniq > requires.normal # find /usr/lib/perl5 | /usr/lib/rpm/find-requires.perl | sort | uniq > requires.perl # diff -u3 requires.normal requires.perl A big diff results because find-requires and find-requires.perl produce different results. (More on how they are different later.) I was, however, correct when stating that find-provides and find-provides.perl produce the same result: # find /usr/lib/perl5 | /usr/lib/rpm/find-provides | sort | uniq > provides.normal # find /usr/lib/perl5 | /usr/lib/rpm/find-provides.perl | sort | uniq > provides.perl # diff -u3 provides.normal provides.perl No diffs result, which shows that find-provides and find-provides.perl produce the same results. --- Well, how find-requires and find-requires.perl different? The find-requires script does not find search for requirements in .pm perl module files, only in perl script files. The find-requires.perl script also looks in .pm perl module files for requirements. I see no reason for the behavior. I suggest that find-requires should be updated to find requirements in .pm perl module files as well. Any other changes that are required to make their behavior the same should be done. Then find-requires.perl should be obsolete and become a stub file pointing to find- requires. This is good because: (1) This prevents logic duplication. (2) I suspect that the lack of searching for perl requirements in .pm module files by find-requires is actually a bug, not a feature. This removes an undocumented difference. Theres never a good reason to not search for perl requirements, is there? :-) I dug deeper into the scripts to see exactly how things worked and to find out what the differences between find-requires and find-requires.perl were. I have created a new patch to solve the original problem. The patch unifies all the logic into find-{requires,provides} and replaced find- {requires,provides}.perl with stubs. find-requires --------------------- find-requires had a bug where on line 66: *) [ "${f%.pm}" != "${f}" ] && perllist="$perllist $f" ;; This line attempts to add .pm perl module files to $perllist for later inspection by /usr/lib/rpm/perl.req. The problem is that a previous test on line 61 in this loop restricts processing to only $f files that were executable. Since perl module files are usually not executable, they are missed by this code. I did not see any bugs in find-requires.perl, which parsed *.pm files regardless of the execute bit. Obviously the intent was to parse .pm files for their perl requirements. In my patch, I patched find-requires so that it adds .pm files to $perllist regardless of if they are executable. This makes it logically equivalent to find-requires.perl. I then replaced find-requires.perl with a stub to find- requires, as they are logically equivalent now. find-provides -------------------- On inspection, I found that find-provides and find-provides.perl are logically different even though they produced the same results in my test. (a) find-provides.perl gives every file in $filelist to /usr/lib/rpm/perl.prov for inspection (see line 9). (b) find-provides *attempts* to give only *.pm files from $filelist to /usr/lib/rpm/perl.prov for inspection (see lines 10 and 50). However, there is a bug on line 10: perllist=$(echo $filelist | grep '\.pm$') Since $filelist is a space separated list (and grep is thinking line- separated), either all or none of the files get acced to $perllist depending only on the last file in the list. To determine if all files (what find-provides.perl does) or just the *.pm files (what find-provides attempts to do) should be parsed by perl.prov, I looked at the perl.prov script and saw that it is designed specifically to parse perl module files and treats any file given to it as a perl module. Therefore, I believe the behavior from find-provides which only looks at *.pm files is correct. In my patch, I fixed find-provides to pass only *.pm files to perl.prov for inspection. I then replaced find-provides.perl with a stub pointing to find- provides. Created attachment 42875 [details]
Second patch. Obsoletes first patch. Fixes find-{provides,requires} and creates stubs out of find-{provides,requires}.perl
Again, thanks for the patch, should be in rpm-4.0.4-0.17 (with the perl.req execute bit turned on :-) |