Bug 1291903 - Since file-5.19-2.fc22, a clawsker Perl script is misrecognized
Summary: Since file-5.19-2.fc22, a clawsker Perl script is misrecognized
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: file
Version: 22
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jan Kaluža
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-12-15 20:38 UTC by Michael Schwendt
Modified: 2016-01-16 14:21 UTC (History)
9 users (show)

Fixed In Version: file-5.22-6.fc23 file-5.22-5.fc22
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-01-07 19:52:29 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
failing source rpm (80.35 KB, application/x-rpm)
2015-12-15 20:38 UTC, Michael Schwendt
no flags Details
working source rpm 1 (80.35 KB, application/x-rpm)
2015-12-15 20:39 UTC, Michael Schwendt
no flags Details
working source rpm 2 (80.36 KB, application/x-rpm)
2015-12-15 20:39 UTC, Michael Schwendt
no flags Details
Reproducer (64.22 KB, text/plain)
2016-01-05 11:42 UTC, Petr Pisar
no flags Details

Description Michael Schwendt 2015-12-15 20:38:34 UTC
Created attachment 1106170 [details]
failing source rpm

Followup to the thread on devel@ list. A rebuild of a Fedora package ends up with no Perl dependencies. Not even a dep on /usr/bin/perl.

Which component to assign to?
rpm or perl-generators?

Anyway, here's a test-case:


* clawsker-0.7.11-1.fc23.FAILURE.src.rpm

Rebuilding that package on F23, all Perl module dependencies are missing. Building on F22 or older, there is no such problem.

The following line in rpmbuild output is missing:

  Requires: /usr/bin/perl perl(Digest::MD5) perl(Encode) perl(Glib) perl(Gtk2) perl(Locale::gettext) perl(POSIX) perl(constant) perl(strict) perl(utf8)


* clawsker-0.7.11-1.fc23.WORKS.src.rpm

The only change in this package is that the spec file installs the Perl script with three values not substituted. Apparently that change is enough to make the Perl dep generator work again. Diff:

+++ clawsker	2014-05-28 11:02:50.000000000 +0200
@@ -21,9 +21,9 @@
 use Digest::MD5 qw(md5_hex);
 
 my $NAME = 'clawsker';
-my $PREFIX = '/usr';
-my $LIBDIR = '/usr/lib/clawsker';
-my $VERSION = '0.7.11';
+my $PREFIX = '@PREFIX@';
+my $LIBDIR = '@LIBDIR@';
+my $VERSION = '@VERSION@';
 my $VERBOSE = FALSE;
 my $CLAWSV = undef;
 my $main_window = undef;


* clawsker-0.7.11-1.fc23.WORKSTOO.src.rpm

The only change in this package is that the spec file patches the Perl script's shebang to drop the trailing "-w" in "/usr/bin/perl -w". Apparently that change is enough to make the Perl dep generator work again, too.


Conclusion: /usr/lib/rpm/perl.req  is broken somehow.

Further info: in koji, the first failure appeared during mass-rebuild on 2015-06-17.

Comment 1 Michael Schwendt 2015-12-15 20:39:01 UTC
Created attachment 1106171 [details]
working source rpm 1

Comment 2 Michael Schwendt 2015-12-15 20:39:24 UTC
Created attachment 1106172 [details]
working source rpm 2

Comment 3 Michael Schwendt 2015-12-15 20:51:57 UTC
Running perl.req manually works, so which tool searches the buildroot for Perl executables and the /usr/bin/perl shebangs?

$ ls clawsker | /usr/lib/rpm/perl.req 
perl(Digest::MD5)
perl(Encode)
perl(Getopt::Long)
perl(Glib)
perl(Gtk2)
perl(Locale::gettext)
perl(POSIX)
perl(constant)
perl(strict)
perl(utf8)

Comment 4 Mikolaj Izdebski 2015-12-16 02:28:11 UTC
rpm-build uses libmagic to determine file types - Perl generators are ran for Perl source files only. In your case file libmagic doesn't recognise clawsker as Perl source. You can try adding some whitespace (eg. empty line after shebang) to workaround this. You can test them with file utility (/usr/bin/file).

Comment 5 Michael Schwendt 2015-12-17 13:23:44 UTC
Not helpful.

A Perl script is detected for the test-cases:

  #!/usr/bin/perl -w
  $ file clawsker
  clawsker: Perl script, ASCII text executable

  #!/usr/bin/perl
  $ file clawsker
  clawsker: Perl script, ASCII text executable

And yet the rpmbuild works fine for the case of the deleted " -w".

There must also be a second bug, because the /usr/bin/perl shebang itself is not detected by rpmbuild either. See this mass-rebuild from 2015-06-17:
http://koji.fedoraproject.org/koji/rpminfo?rpmID=6387828

Comment 6 Petr Pisar 2016-01-05 11:28:15 UTC
I get different result. `file' reports on the clawsker this:

$ file build/clawsker
build/clawsker: , init=0x4c45, stat=0x3b5d, dev=0x200a, bas=0x2020

I get this result consistently across Fedoras 24--22. What `file' package do you have? I have file-5.22-4.fc22.x86_64.

Comment 7 Petr Pisar 2016-01-05 11:39:59 UTC
This is regression between file 5.14-22.fc21 and 5.19-2.fc22. The former reports expected value "Perl script, ASCII text executable", the later the broken one ", init=0x4c45, stat=0x3b5d, dev=0x200a, bas=0x2020".

Comment 8 Michael Schwendt 2016-01-05 11:41:50 UTC
$ file build/clawsker
build/clawsker: Perl script, ASCII text executable
$ rpm -q file
file-5.22-5.fc23.x86_64

$ file /usr/bin/clawsker 
/usr/bin/clawsker: Perl script, ASCII text executable
$ rpm -q clawsker
clawsker-0.7.13-1.fc23.noarch

Comment 9 Petr Pisar 2016-01-05 11:42:07 UTC
Created attachment 1111803 [details]
Reproducer

This the affected clawsker file.

Comment 10 Petr Pisar 2016-01-05 11:55:13 UTC
(In reply to Michael Schwendt from comment #8)
> $ file build/clawsker
> build/clawsker: Perl script, ASCII text executable
> $ rpm -q file
> file-5.22-5.fc23.x86_64
> 
> $ file /usr/bin/clawsker 
> /usr/bin/clawsker: Perl script, ASCII text executable
> $ rpm -q clawsker
> clawsker-0.7.13-1.fc23.noarch

/usr/bin/clawsker from the lawsker-0.7.13-1.fc23.noarch is without the "-w" argument.

Comment 11 Michael Schwendt 2016-01-05 13:34:30 UTC
True, but file build/clawsker is with "-w".

Whether there is a "-w" in the shebang is irrelevant.

As shown before, while dropping the "-w" from clawsker 0.7.11 makes a difference, other (arbitrary?) changes to that file also influence the results of running "file" on it. See bottom of the original bug report. With unexpanded '@foo@' variables, "file" also detects a Perl script.

Comment 12 Petr Pisar 2016-01-05 13:49:59 UTC
It's not surprising. The magic database have multiple rules with for matching "Perl script" that has different preference and there can be more regressions. I remember one of them checks for "@" character because this is how array variables are named in the Perl. I believe file maintainer will cover all the relevant ones.

Comment 13 Jan Kaluža 2016-01-06 07:24:35 UTC
Upstream bugreport with patch: http://bugs.gw.com/view.php?id=505
Fixed in rawhide. Other Fedora versions will follow.

Comment 14 Fedora Update System 2016-01-06 07:31:12 UTC
file-5.22-6.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-f2bca5dec7

Comment 15 Fedora Update System 2016-01-06 07:47:12 UTC
file-5.22-5.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2016-8cde92e12a

Comment 16 Fedora Update System 2016-01-07 04:54:08 UTC
file-5.22-6.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-f2bca5dec7

Comment 17 Fedora Update System 2016-01-07 05:24:05 UTC
file-5.22-5.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-8cde92e12a

Comment 18 Fedora Update System 2016-01-07 19:52:22 UTC
file-5.22-6.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 19 Fedora Update System 2016-01-16 14:21:04 UTC
file-5.22-5.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.


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