ack3 icon indicating copy to clipboard operation
ack3 copied to clipboard

Doesn't work without perl-doc package installed on Debian

Open plicease opened this issue 5 years ago • 6 comments

arguably the perl package should include perldoc, but on Debian it does not, you have to also install perl-doc. Test could maybe test to see if perldoc returns You need to install the perl-doc package to use this program and if so skip the man tests.

name% prove -bvm t/invalid-ackrc.t t/ack-man.t
t/invalid-ackrc.t ..
1..3
# Subtest: Check --env and weird options
    1..10
    ok 1 - Should have no output to stderr: ack --env --help
    ok 2
    ok 3 - Should have no output to stderr: ack --env --thpppt
    ok 4
    ok 5 - Should have no output to stderr: ack --env --bar
    ok 6
    ok 7 - Should have no output to stderr: ack --env --cathy
    ok 8
    ok 9 - Should have no output to stderr: ack --env --version
    ok 10
ok 1 - Check --env and weird options
# Subtest: Check for all the types
    1..12
    ok 1 - Found at least one usage line
    ok 2 - Found the illegal option in the ackrc
    ok 3 - Got at least one for --perl
    ok 4
    ok 5
    ok 6
    ok 7
    ok 8 - Got at least one for --python
    ok 9
    ok 10 - Got at least one for --ruby
    ok 11
    ok 12
ok 2 - Check for all the types
# Subtest: Check --env --man
    1..2
    not ok 1 - Should have no output to stderr: ack --env --man

    #   Failed test 'Should have no output to stderr: ack --env --man'
    #   at t/invalid-ackrc.t line 78.
    #          got: '1'
    #     expected: '0'
    # STDERR:
    # You need to install the perl-doc package to use this program.
    not ok 2

    #   Failed test at t/invalid-ackrc.t line 82.
    #                   '#!/usr/bin/perl
    # '
    #     doesn't match '(?^ms:NAME.+ack(?:-standalone)?\s)'
    # Looks like you failed 2 tests of 2.
not ok 3 - Check --env --man

#   Failed test 'Check --env --man'
#   at t/invalid-ackrc.t line 83.
# Looks like you failed 1 test of 3.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/3 subtests
t/ack-man.t ........
1..3
ok 1 - The manual should be pretty long.
not ok 2 - But not too long.

#   Failed test 'But not too long.'
#   at t/ack-man.t line 19.
#     '2436'
#         <
#     '2000'
not ok 3 - Nothing in STDERR

#   Failed test 'Nothing in STDERR'
#   at t/ack-man.t line 22.
# [
#   'You need to install the perl-doc package to use this program.'
# ]
# Looks like you failed 2 tests of 3.
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/3 subtests

Test Summary Report
-------------------
t/invalid-ackrc.t (Wstat: 256 Tests: 3 Failed: 1)
  Failed test:  3
  Non-zero exit status: 1
t/ack-man.t      (Wstat: 512 Tests: 3 Failed: 2)
  Failed tests:  2-3
  Non-zero exit status: 2
Files=2, Tests=6,  1 wallclock secs ( 0.03 usr  0.06 sys +  0.45 cusr  0.37 csys =  0.91 CPU)
Result: FAIL

plicease avatar Dec 06 '19 21:12 plicease

Arguably...

Agreed, OS packages carving Perl (or C) standard distribution into more than one package has been an annoyance to developers since nearly forever. (And their answer is everyone should use their packaged version with their enhanced dependencies, which fails if you want something newer than they have. The alternative recommendation is to never use the system perl for anything but system things, and thus only use cpan(m|p) with a plenv/perl-brew/perl-install under your control. Which protects the application from an Os upgrade upgrading sys perl and breaking XS cpan modules! )

Thank you for a useful report.

n1vux avatar Dec 23 '19 21:12 n1vux

Yeah. I wouldn't be complaining if it was one of the mutant fedora perls before we managed to convince them to fix it.

But I feel like "not having the .pod files installed" is a bit different.

(OTOH, I normally always have the perl-doc package and only because I'm redoing install automation from scratch did this bite me, so I'm not going to claim it's high priority ;)

shadowcat-mst avatar Mar 24 '20 12:03 shadowcat-mst

Yeah. If only as a "Least Surprise" matter, I'd like to defensively fix this. Even though a Debian w/o perl-doc isn't a valid Perl according to Perl and thus "results are undefined," it would be good to DWIM. If you don't have perl-doc installed you probably don't need pod tests :smile: .

What confuses me is why this is happening.

Ack3 switching from perldoc command to Pod::Perldoc 3.20 for --man was supposed to make not having perl-doc package less painful, but it looks like Debian puts that too in package perl-doc , as i don't see it in e.g. libperl5.28. But I would expect cpanm to pull Pod::Perldoc: '3.20' (or rather current 3.28) from cpan as a dual-life module, or make to error on a missing prereq as it's listed in MYMETA.{yml,json} and Makefile?

Which package manager are you using to install ack? Which version ack?

I guess this could happen if one downloaded the CPAN (or github) tarball without a package manager, so missing downloading declared prereqs, and used perl Makefile.PL && make && make test but even that should hit the PREREQ check in Makefile !?.

(if cpanm is presuming prereqs in Perl Core must be present, that would be a bug!)

n1vux avatar Mar 24 '20 17:03 n1vux

For your context, @shadowcat-mst , redoing install automation, skipping make && make test and just installing the single-file ack-standalone as bin/ack is a portable alternative. Tradeoffs - usually works, doesn't give great diagnostics if it fails (P5's diagnostics aren't that bad but not as good as make), doesn't give false negatives based on packager stripping core Perl etc.

n1vux avatar Mar 24 '20 17:03 n1vux

(Speaking for myself, not for Ack ... In general I don't consider it sound to mix package managers. I know MST already knows why, but for the record ...

Using the Debian /bin/perl with cpan(m|p)? local::lib is fraught because CPAN only requires declaring non-core dependencies, based on P5P definition of core. Ack build fail on perldoc is only a special case. Which is why my $HOME/bin/ack is linked or copied from ack-standalone.

OTOH yes it would be nice to not break when people do what seems like should work, and if it's simple and safe, I'd like to do so.

With the growing importance of embedded sub-distros downstream, Debian's not putting perl-doc in base is once again defensible; the window has passed to fix that. i ran into a similar but different compartmentalized issue with Centos7 ... the 'scl' command to enable Perl 5.26 as system Perl put the alternative perl on path as advertised, but only did that, not the matching prove, i had to set PATH to get modern utilities too. sigh )

n1vux avatar Mar 24 '20 17:03 n1vux

We may want to define a CI config that includes Debian perl package but not perl-doc package ... or equivalently artificially removing perldoc and Pod/Perldoc.pm if necessary ... in order to provide testing for this ?

n1vux avatar Mar 24 '20 17:03 n1vux