Bug 2171353 - /usr/lib/rpm/perl.req create bogus requirements on usage function of dpkg-source.pl
Summary: /usr/lib/rpm/perl.req create bogus requirements on usage function of dpkg-so...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: perl-generators
Version: 37
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jitka Plesnikova
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 694496
TreeView+ depends on / blocked
 
Reported: 2023-02-20 06:04 UTC by Sergio Basto
Modified: 2023-04-03 13:01 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-04-03 13:01:50 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Fix requires from perl-generators (978 bytes, patch)
2023-02-21 11:32 UTC, Michal Josef Spacek
no flags Details | Diff

Description Sergio Basto 2023-02-20 06:04:02 UTC
Hi,
As we see in https://bugzilla.redhat.com/show_bug.cgi?id=58537 and 
https://bugzilla.redhat.com/show_bug.cgi?id=1547805
https://bugzilla.redhat.com/show_bug.cgi?id=1539344

again  in dpkg-source.pl of package dpkg (bug #1539344), the text [1] on "sub usage" generate a bad requirement, this time the requirement is perl(at) [2] 


[1]
g_(
  'General options:
    --threads-max=<threads>
       use at most <threads> with compressor.
    -q                       quiet mode.


[2]
/usr/lib/rpm/perl.req dpkg-1.21.20/scripts/dpkg-source.pl
perl(Cwd)
perl(Dpkg)
perl(Dpkg::Arch)
perl(Dpkg::Changelog::Parse)
perl(Dpkg::Compression)
perl(Dpkg::Conf)
perl(Dpkg::Control::Fields)
perl(Dpkg::Control::Info)
perl(Dpkg::Control::Tests)
perl(Dpkg::Deps)
perl(Dpkg::ErrorHandling)
perl(Dpkg::Gettext)
perl(Dpkg::Source::Format)
perl(Dpkg::Source::Package)
perl(Dpkg::Substvars)
perl(Dpkg::Vars)
perl(Dpkg::Vendor)
perl(Dpkg::Version)
perl(File::Basename)
perl(File::Spec)
perl(List::Util)
perl(at)
perl(strict)
perl(warnings)

Comment 1 Jitka Plesnikova 2023-02-20 15:26:42 UTC
perl-req is able to skip 
* the here-docs "<<" blocks
* q{} quoted sections
* documentation
* assign statements with multiline string
* multiline print

For multiline print, it expects `print` and `"` or `'`. It is not so easy cover each user defined function e.g. `g_`.

perl-generators tries to filter as many lines as possible, but it can't filter everything what we need.

Comment 2 Sergio Basto 2023-02-20 16:00:49 UTC
I tried yesterday without success fixed the regexp , adding more one simple rule, lines or comnand must be ended with semi-colon (;) ,
if you can add this rule it will fix my case !

Comment 3 Sergio Basto 2023-02-20 16:03:52 UTC
to checkout you may run :

fedpkg clone dpkg 
cd dpkg
git reset HEAD~1 --hard # to remove my hack 
fedpkg prep
/usr/lib/rpm/perl.req dpkg-1.21.20/scripts/dpkg-source.pl

Comment 4 Jitka Plesnikova 2023-02-21 10:59:35 UTC
(In reply to Sergio Basto from comment #2)
> I tried yesterday without success fixed the regexp , adding more one simple
> rule, lines or comnand must be ended with semi-colon (;) ,
> if you can add this rule it will fix my case !

It is not so easy to solve it by adding semi-colon, because in this case, it will be ignore command like this:

use overload
    '+' => \&myadd,
    '-' => \&mysub;

use base qw/
    Try
/;

and it brings more issues.

Please add filter for bogus require perl(at) to your spec.

Comment 5 Michal Josef Spacek 2023-02-21 11:32:11 UTC
Created attachment 1945489 [details]
Fix requires from perl-generators

Comment 6 Michal Josef Spacek 2023-02-21 11:34:52 UTC
@sergio 

I added patch for proper fix.
If I am looking to previous patch:
> sed -e '/perl(Dselect::Ftp)/d' -e '/perl(extra)/d' -e '/perl(file)/d' -e '/perl(in)/d'

Dselect::Ftp is provided by dselect package and used in it only. It's ok.
I don't found perl(in).
And other are related to bad generation by perl-generators, so we need to remove it.

Comment 7 Sergio Basto 2023-02-21 19:32:54 UTC
hi,
I just notice today with your comment that sed command was already to fix for bad generation by perl-generators 

(In reply to Jitka Plesnikova from comment #4)
> (In reply to Sergio Basto from comment #2)
> > I tried yesterday without success fixed the regexp , adding more one simple
> > rule, lines or comnand must be ended with semi-colon (;) ,
> > if you can add this rule it will fix my case !
> 
> It is not so easy to solve it by adding semi-colon, because in this case, it
> will be ignore command like this:
> 
> use overload
>     '+' => \&myadd,
>     '-' => \&mysub;
> 
> use base qw/
>     Try
> /;
> 
> and it brings more issues.

These examples just confirm my suggest rule is correct, all the cases end with a semicolon.

In my point of view, the problem of the regexp is to trying do all in one step, if we have two or more steps, should be easier to work the regexps, in this case, if you extract the lines first and after in a second step check if end with semicolon ...  


> Please add filter for bogus require perl(at) to your spec.

done ( https://src.fedoraproject.org/rpms/dpkg/c/09d84c98b04c58751f4d03fa4cc141a9f987958b?branch=rawhide )

Comment 8 Jitka Plesnikova 2023-04-03 13:01:50 UTC
(In reply to Sergio Basto from comment #7)
> hi,
> I just notice today with your comment that sed command was already to fix
> for bad generation by perl-generators 
> 
> (In reply to Jitka Plesnikova from comment #4)
> > (In reply to Sergio Basto from comment #2)
> > > I tried yesterday without success fixed the regexp , adding more one simple
> > > rule, lines or comnand must be ended with semi-colon (;) ,
> > > if you can add this rule it will fix my case !
> > 
> > It is not so easy to solve it by adding semi-colon, because in this case, it
> > will be ignore command like this:
> > 
> > use overload
> >     '+' => \&myadd,
> >     '-' => \&mysub;
> > 
> > use base qw/
> >     Try
> > /;
> > 
> > and it brings more issues.
> 
> These examples just confirm my suggest rule is correct, all the cases end
> with a semicolon.

You're right. However, perl.req is simple script that processes files line by line, so it doesn't find the semicolon in one step.
It isn't easy to fix it now. I add the bug to tracking bug for Perl provides/requires.


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