Bug 1291903 - Since file-5.19-2.fc22, a clawsker Perl script is misrecognized
Since file-5.19-2.fc22, a clawsker Perl script is misrecognized
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: file (Show other bugs)
22
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jan Kaluža
Fedora Extras Quality Assurance
: Regression
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-12-15 15:38 EST by Michael Schwendt
Modified: 2016-01-16 09:21 EST (History)
9 users (show)

See Also:
Fixed In Version: file-5.22-6.fc23 file-5.22-5.fc22
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-01-07 14:52:29 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Michael Schwendt 2015-12-15 15:38:34 EST
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 15:39 EST
Created attachment 1106171 [details]
working source rpm 1
Comment 2 Michael Schwendt 2015-12-15 15:39 EST
Created attachment 1106172 [details]
working source rpm 2
Comment 3 Michael Schwendt 2015-12-15 15:51:57 EST
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-15 21:28:11 EST
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 08:23:44 EST
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 06:28:15 EST
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 06:39:59 EST
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 06:41:50 EST
$ 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 06:42 EST
Created attachment 1111803 [details]
Reproducer

This the affected clawsker file.
Comment 10 Petr Pisar 2016-01-05 06:55:13 EST
(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 08:34:30 EST
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 08:49:59 EST
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 02:24:35 EST
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 02:31:12 EST
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 02:47:12 EST
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-06 23:54:08 EST
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 00:24:05 EST
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 14:52:22 EST
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 09:21:04 EST
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.