[Users] [Bug 4139] New: Clawsker broken with perl 5.22+

H.Merijn Brand h.m.brand at xs4all.nl
Fri Dec 21 21:46:07 CET 2018


On Fri, 21 Dec 2018 17:18:27 +0000, noreply at thewildbeast.co.uk wrote:

Which version of clawsker are you working on?

> $ clawsker
> Can't locate Gtk3.pm in @INC (you may need to install the Gtk3 module)
> 
> That's the packaging bug showing. Clawsker needs different
> dependencies than those currently stated in the official package
> [https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/clawsker].
> I'll be filing an issue for that asap. Installing perl-gtk3 and try
> again:
> 
> $ sudo pacman -S perl-gtk3
> ...
> 
> $ clawsker
> Can't locate File/Which.pm in @INC (you may need to install the
> File::Which module)
> 
> Another faulty dependency...
> 
> $ sudo pacman -S perl-file-which
> ...
> 
> $ clawsker
> Use of uninitialized value $fver[2] in string eq at /usr/bin/clawsker
> line 298. Invalid version string at /usr/bin/clawsker line 298.
>
> I'm not at all experienced in Perl, but I'm getting the same error on
> Ubuntu, albeit on different lines of the script:
> 
> OS: Ubuntu 16.04 (fully updated)
> 
> $ apt-cache policy clawsker
> clawsker:
>   Installed: 0.7.13-1
>   Candidate: 0.7.13-1
>   Version table:
>  *** 0.7.13-1 500
>         500 http://archive.ubuntu.com/ubuntu xenial/universe amd64
> Packages 100 /var/lib/dpkg/status
> 
> $ apt-cache policy perl
> perl:
>   Installed: 5.22.1-9ubuntu0.6
>   Candidate: 5.22.1-9ubuntu0.6
>   Version table:
>  *** 5.22.1-9ubuntu0.6 500
>         500 http://archive.ubuntu.com/ubuntu xenial-updates/main
> amd64 Packages 500 http://archive.ubuntu.com/ubuntu
> xenial-security/main amd64 Packages
>         100 /var/lib/dpkg/status
>      5.22.1-9 500
>         500 http://archive.ubuntu.com/ubuntu xenial/main amd64
> Packages
> 
> $ clawsker
> Use of uninitialized value $fver[2] in string eq at /usr/bin/clawsker
> line 260. Invalid version string at /usr/bin/clawsker line 260.

That must be this code:

sub get_claws_version {
    $_ = which ('claws-mail');
    return "" unless defined $_; # not installed
    my $res = "";
    $_ = qx/$_ -v/;
    chomp;
    my @fver = split (/ /);
    die "Invalid version string" unless ($fver[2] eq "version");
    my @ver = split (/\./, $fver[3]);

As the script requires perl-5.10, as simple and save quick fix would be

    die "Invalid version string" unless (($fver[2] // "") eq "version");

but the root cause is in the qx// if/when the full path to claws-mail
contains a space. The code makes it really hard to debug, as $_ is
abused and altered, so you cannot show the full path on failure. Here
is a safe version:

sub get_claws_version {
    my $cm_path = which ('claws-mail') or return ""; # not found
    open my $ph, "-|", $cm_path, "-v"  or return ""; # no pipe
    chomp (my $v = <$ph>);
    close $ph;
    # Claws Mail version 3.17.2git17
    $v =~ m/\bversion\s+(\d[\w.]+)/ or die "Invalid version string: '$v'";
    my $cmv = $1;
    my @ver = split m/\./ => $cmv;
    my $res = "$ver[0].$ver[1].";
    return $res . ($ver[3] =~ m/(\d+)git(\d+)/ ? "$1.$2" : "$ver[2].0";
    }

> Please note that I have very little experience with Perl, and it
> might be yet too soon to expect to see the newly added hidden pref
> "use_tls_sni", but clawsker seems broken with these perl versions.
> Don't have access to different perl versions currently, so the actual
> version number mentioned in this bug summary might not be fully
> correct. Please advise.
> 
> Regards

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.29   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.claws-mail.org/pipermail/users/attachments/20181221/5c74ab18/attachment.sig>


More information about the Users mailing list