Bug 1324032 - /usr/lib/rpm/rpmdeps not matching Perl scripts properly
Summary: /usr/lib/rpm/rpmdeps not matching Perl scripts properly
Keywords:
Status: CLOSED DUPLICATE of bug 1275551
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rpm
Version: 7.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: beta
: ---
Assignee: Florian Festi
QA Contact: Karel Srot
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-05 11:47 UTC by Karel Srot
Modified: 2016-08-02 05:58 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1324003
Environment:
Last Closed: 2016-08-02 05:58:05 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Karel Srot 2016-04-05 11:47:35 UTC
Same problem is also in the internal (default) requires generator:

# echo test.pl | /usr/lib/rpm/rpmdeps
# 

When checking rpm sources...

# grep -R "script)" *
autodeps/linux.req:exelist=`echo $filelist | xargs -r file | egrep -v ":.* (commands|script) " | \
autodeps/linux.req:	egrep ":.* (commands|script) " | cut -d: -f1`
autodeps/freebsd.req:scriptlist=`echo $filelist | xargs file | egrep ":.* (commands|script) " | cut -d: -f1 `
autodeps/freebsdelf.req:scriptlist=`if test "x$filelist" != x; then echo $filelist | xargs file | egrep ":.* (commands|script) " | cut -d: -f1; fi`
autodeps/darwin.req:scriptlist=`echo $filelist | xargs file | egrep ":.* (commands|script) " | cut -d: -f1 `
autodeps/openbsd.req:scriptlist=`echo $filelist | xargs file | egrep ":.* (commands|script) " | cut -d: -f1 `
build/parseScript.c:    tfe->script = (script && *script != '\0') ? xstrdup(script) : NULL;
build/pack.c:	if (p->script) {
build/pack.c:	    headerPutString(pkg->header, RPMTAG_TRIGGERSCRIPTS, p->script);
build/spec.c:	o->script = _free(o->script);
lib/psm.c:    if (script) {
lib/psm.c:	xx = Fwrite(script, sizeof(script[0]), strlen(script), fd);
lib/psm.c:    if (script) {
lib/psm.c:    if (rpmtdCount(&script) == 0 && rpmtdCount(&prog) == 0)
lib/psm.c:		   rpmtdGetString(&script), psm->scriptArg, -1);
lib/psm.c:    rpmtdFreeData(&script);
ltmain.sh:             have already dealt with, above (inluding dump-script), then
rpmio/rpmlua.c:    if (luaL_loadbuffer(L, script, strlen(script), name) != 0) {
rpmio/rpmlua.c:    if (luaL_loadbuffer(L, script, strlen(script), name) != 0) {


+++ This bug was initially created as a clone of Bug #1324003 +++

Description of problem:

/usr/lib/rpm/redhat/find-requires contain at two places following grep pattern:

  ":.* (commands|script) "

The problem is that file is identifying Perl scrips as follows:

  test.pl: Perl script, ASCII text executable

Therefore /usr/lib/rpm/find-requires from rpm rather uses

  ":.* (commands|script)[, ]"


Beside this problem there is also the same problem as described in bug 1275551.


Version-Release number of selected component (if applicable):
redhat-rpm-config-9.1.0-68.el7.noarch

How reproducible:
alwyas

Steps to Reproduce:

# cat > test.pl <<EOF
#!/usr/bin/perl

use AAA;
use BBB;

# use CCC is a comment and should not be part of requires
sub get_help
{
        return <<EOT;
This text is a help an if it contains something like
use DDD , it should not be part of requires
or like
        use EEE , it should not be part of requires
EOT
}
EOF

# chmod a+x test.pl
# echo test.pl | /usr/lib/rpm/redhat/find-requires
objdump: test.pl: File format not recognized


Expected results:

/usr/bin/perl
perl(AAA)
perl(BBB)

See also bug 1275551.

Comment 3 Karel Srot 2016-04-06 08:19:50 UTC
I guess there is no problem with missing requires in the end... I forgot to pass the parameter to rpmdeps.

# echo $PWD/test.pl | /usr/lib/rpm/rpmdeps -R
/usr/bin/perl
perl(AAA)
perl(BBB)
perl(DDD)
perl(EEE)

So the only problem that remains are incorrect (additional) requires.

Anyway, I am confused that it works, I can see in the source code that the regexp is not correct. Strange. Probably I am looking at the wrong piece of code.

Comment 6 Karel Srot 2016-04-06 08:52:48 UTC
(In reply to Karel Srot from comment #3)
> Anyway, I am confused that it works, I can see in the source code that the
> regexp is not correct. Strange. Probably I am looking at the wrong piece of
> code.

Of course I was looking at the wrong piece as the internal (C) generator is used by default. :-)

Comment 7 Karel Srot 2016-04-06 09:34:58 UTC
I have tested few more Perl samples from previously reported bugs and there is also an issue that more or less matches problems reported in bug 1268021:

  file enc2xs, there is a missing requires perl(File::Find)
  file ParseXS.pm, there is a missing requires perl(strict)

To summarize it, so far the issues found are missing requires ^^ and additional (unwanted) requires perl(DDD) perl(EEE) from the bug 1275551.

Comment 8 Karel Srot 2016-04-06 10:14:15 UTC
One more finding. Perl sample from bug 1024517
  file DependencyInfo.pm, there is an additional requires perl(warnings).

Comment 9 Karel Srot 2016-04-06 11:54:43 UTC
This has been filed against redhat-rpm-config by mistake, should be rpm.

Comment 11 Karel Srot 2016-08-02 05:58:05 UTC
It turned out this is a duplicate of bug 1275551.

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


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