Bug 88573 - perl.req generates erroneous require statements for here docs
Summary: perl.req generates erroneous require statements for here docs
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm-build
Version: 9
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2003-04-10 23:37 UTC by Trenton Lipscomb
Modified: 2007-04-18 16:52 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2003-04-21 14:17:17 UTC

Attachments (Terms of Use)
Perl source demonstrating bug (342 bytes, text/plain)
2003-04-10 23:40 UTC, Trenton Lipscomb
no flags Details

Description Trenton Lipscomb 2003-04-10 23:37:40 UTC
Description of problem: 

  perl.req is generating a erroneous Requires. It appears that
  this script can't parse here documents.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:

  1. Run /usr/lib/rpm/perl.req on the attached file.
Actual results:


Expected results:


Additional info:

Comment 1 Trenton Lipscomb 2003-04-10 23:40:41 UTC
Created attachment 91069 [details]
Perl source demonstrating bug

This is a cut and paste of a section of code from
mysql-3.23.54a/bin/mysqlaccess, which you can find in the tgz of MySQL here


Comment 2 Jeff Johnson 2003-04-14 19:01:20 UTC
Try the perl.req from rpm-4.1. I'm pretty sure
this problem is fixed there.

Comment 3 Trenton Lipscomb 2003-04-18 23:17:36 UTC
Still broken.

% cd /var/tmp
% rpm -q redhat-release
% rpm -qf /usr/lib/rpm/perl.req
% wget -q -O test.pl \
% /usr/lib/rpm/perl.req test.pl

Comment 4 Jeff Johnson 2003-04-21 14:17:17 UTC
Then you will need to filter the offending dependencies
manually. See many CPAN package, look for %__find_requires
override in spec file.

FWIW, there's also a replacement for perl.{prov,req} scripts
in rp[m-4.1.1 and later.

Comment 5 Trenton 2003-04-21 17:37:21 UTC
This bug has nothign to do with CPAN. This is a bug when perl.req parses ANY
here doc. In this case, it's scrwing up with parsing stuff in a mysql build.

It'd be really helpful if you could send a url to one of those spec files. I'm
sure it's in many modules, but there are many * 2 modules, so it's kinda like
the old needle and haystack deal.

Secondly, I am using 4.1.1 so I'm not sure what you mean about the replacement deal.

Comment 6 Jeff Johnson 2003-04-21 17:44:32 UTC
Look at perl-DBD-MySQL spec file from Red Hat 9.

Don't worry, no one is using /usr/lib/rpm/perldeps.pl, also in rpm-4.1.1.

Comment 7 Hoss 2003-04-21 18:16:45 UTC
I started looking into the guts of "perl.req" and this regexp looks fairly wrong
to me...

        (m/^(\s*)         # we hope the inclusion starts the line
         (require|use)\s+(?!\{)     # do not want 'do {' loops
         # quotes around name are always legal
         [\'\"]?([^\;\ \'\"\t]*)[\'\"]?[\t\;\ ]
         # the syntax for 'use' allows version requirements
       ) {
      my ($whitespace, $statement, $module, $version) = ($1, $2, $3,$4);

For starters, it's allowing the ";" to appear prior to the version number  ...
and it doesn't seem like this regexp (or any of the other code after it) is
enforcing that there must eventually be a ";" (after an optional LIST for the
modules impot method).

I also noticed this line...

      # skip if the phrase was "use of" -- shows up in gimp-perl, et al
      next if $module eq 'of';

which makes me wonder if perhaps this bug could be fixed quickly by changing
that line to ...

      # skip if the phrase was "use of" -- shows up in gimp-perl, et al
      next if $module =~ /^(of|the)$/i;

(which could later include any other common prepositions that show up in

Lastly: I have to wonder if the best solution wouldn't be to strip "here docs"
the same way that POD is striped?

Comment 8 Jeff Johnson 2003-04-21 18:23:04 UTC
Yup, perl.req (or new-fangled /usr/lib/rpm/perldeps.pl) is
where final fix for an errant misfiring regex is gonna be needed.

Getting consensus on the fix is harder, requires burn-in on an entire
release cycle these days. Equivalently, rebuild 1500+ packages in distro
to show equivalent automagic dependency generation.

Comment 9 Trenton Lipscomb 2003-04-22 02:41:49 UTC
Well, if redhat really plans to fix this, shouldn't the bug be left open? Or
marked as a duplicate/dependency of a bug that tracks the acutal work? It'll be
forgotten, or the same defect filed again if this stays closed.

I'm not trying to be a jackass user, just trying to help redhat make a solid
product. I don't want this to slip through the cracks.

Separately, I want to see if /usr/lib/rpm/perldeps.pl has the same problems.
Which rpm owns this file?

Comment 10 Jeff Johnson 2003-04-22 12:51:20 UTC
bash$ rpm -qf /usr/lib/rpm/perldeps.pl 

I'd love to fix, but correctly generating correct
output for all possible perl scripts is not an easy

    Requires: perl(strict)
is a real dependency.

bash$ rpm -q --provides perl | grep strict

Note You need to log in before you can comment on or make changes to this bug.