trizen / pipe-viewer

A lightweight YouTube client for Linux, without requiring an API key.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gtk-pipe-viewer 0.4.9 does not launch after update from v. 0.4.8

Balans097 opened this issue · comments

~$ gtk-pipe-viewer
Unquoted string "state" may clash with future reserved word at /usr/share/perl5/vendor_perl/WWW/PipeViewer/Videos.pm line 145.
Unquoted string "cache" may clash with future reserved word at /usr/share/perl5/vendor_perl/WWW/PipeViewer/Videos.pm line 145.
Operator or semicolon missing before %cache at /usr/share/perl5/vendor_perl/WWW/PipeViewer/Videos.pm line 145.
Ambiguous use of % resolved as operator % at /usr/share/perl5/vendor_perl/WWW/PipeViewer/Videos.pm line 145.
Useless use of modulus (%) in void context at /usr/share/perl5/vendor_perl/WWW/PipeViewer/Videos.pm line 145.
Unquoted string "state" may clash with future reserved word at /usr/share/perl5/vendor_perl/WWW/PipeViewer.pm line 413.
Array found where operator expected (Do you need to predeclare "state"?) at /usr/share/perl5/vendor_perl/WWW/PipeViewer.pm line 413, near "state @LWP_CACHE"
syntax error at /usr/share/perl5/vendor_perl/WWW/PipeViewer.pm line 413, near "state @LWP_CACHE"
Execution of /usr/share/perl5/vendor_perl/WWW/PipeViewer.pm aborted due to compilation errors.
Compilation failed in require at /usr/bin/gtk-pipe-viewer line 56.
BEGIN failed--compilation aborted at /usr/bin/gtk-pipe-viewer line 56.

I cannot reproduce this issue with perl-5.38.1. Under what version of perl does this issue happen? (perl -v)

$ perl -v

This is perl 5, version 38, subversion 2 (v5.38.2) built for x86_64-linux-thread-multi
(with 15 registered patches, see perl -V for more detail)

Copyright 1987-2023, Larry Wall

Strange... What happens if you try to execute the following commands:

  1. perl -e 'use 5.014; state %x; $x{a}=42; say $x{a}'
  2. perl -e 'use feature qw(state say); state %x; $x{a}=42; say $x{a}'

Which one works?

If both commands work, then check the file /usr/share/perl5/vendor_perl/WWW/PipeViewer/Videos.pm and make sure it includes the following line:

use 5.014;

The SHA256 hash of the above file should be 85450328354f4623a9462837b7f8032e75a8c0c31d44fed6a13c881bf72f6fad.

$ perl -e 'use 5.014; state %x; $x{a}=42; say $x{a}'
42
$ perl -e 'use feature qw(state say); state %x; $x{a}=42; say $x{a}'
42

package WWW::PipeViewer::Videos;

use utf8;
use 5.014;
use warnings;

903d49efb0dd3fd532257b3748bf2a3a934d749e697d3dc53dba37c6a9cae6f7 *Videos.pm
The hash does not match. Could you please provide the correct file. Or what's wrong? I just did «sudo dnf update» yesterday.

And my /usr/share/perl5/vendor_perl/WWW/PipeViewer/Videos.pm contains this:
https://pastebin.com/AdbJFrrS

And what is strange to me: $ perl -V gave me this:
Summary of my perl5 (revision 5 version 38 subversion 2) configuration:
Platform:
osname=linux
osvers=6.5.10-200.fc38.x86_64

But I use:
$ uname -a
Linux fedora 6.6.9-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jan 1 20:05:54 UTC 2024 x86_64 GNU/Linux

Nevertheless gtk-pipe-viewer v.0.4.8 worked

The file matches. Just the line-endings are different (CR-LF vs LF).

However, regarding the issue, maybe there is a bug in the version of perl provided by Fedora.

What happens if you try to execute gtk-pipe-viewer as:

perl $(which gtk-pipe-viewer)

Same issue?

There is not much of a difference between v0.4.8 and v.0.4.9. Those state statements were in the v0.4.8 as well. I don't think downgrading to v0.4.8 will help. Maybe after a recent system upgrade, perl got broken somehow (maybe by a buggy patch applied by the vendor?).


Regarding #194 (comment):

The value for osvers in perl -V is the version of the kernel that was used to compile perl, which may not match your current kernel version.

$ perl $(which gtk-pipe-viewer)
Unquoted string "state" may clash with future reserved word at /usr/share/perl5/vendor_perl/WWW/PipeViewer/Videos.pm line 145.
Unquoted string "cache" may clash with future reserved word at /usr/share/perl5/vendor_perl/WWW/PipeViewer/Videos.pm line 145.
Operator or semicolon missing before %cache at /usr/share/perl5/vendor_perl/WWW/PipeViewer/Videos.pm line 145.
Ambiguous use of % resolved as operator % at /usr/share/perl5/vendor_perl/WWW/PipeViewer/Videos.pm line 145.
Useless use of modulus (%) in void context at /usr/share/perl5/vendor_perl/WWW/PipeViewer/Videos.pm line 145.
Unquoted string "state" may clash with future reserved word at /usr/share/perl5/vendor_perl/WWW/PipeViewer.pm line 413.
Array found where operator expected (Do you need to predeclare "state"?) at /usr/share/perl5/vendor_perl/WWW/PipeViewer.pm line 413, near "state @LWP_CACHE"
syntax error at /usr/share/perl5/vendor_perl/WWW/PipeViewer.pm line 413, near "state @LWP_CACHE"
Execution of /usr/share/perl5/vendor_perl/WWW/PipeViewer.pm aborted due to compilation errors.
Compilation failed in require at /usr/bin/gtk-pipe-viewer line 56.
BEGIN failed--compilation aborted at /usr/bin/gtk-pipe-viewer line 56.

The value for osvers in perl -V is the version of the kernel that was used to compile perl, which may not match your current kernel version.

I see, thanks.

Maybe after a recent system upgrade, perl got broken somehow (maybe by a buggy patch applied by the vendor?)

I'll try to reinstall perl. But it is related to the TeXLive that I use. And this is 3.9 GB. But your program is so good that I will still take this radical step. Or... should I just wait?..

Alternatively, you can compile and install perl locally, using perlbrew:

perlbrew init
perlbrew install --64all -Doptimize='-march=native -O2 -pipe -fno-plt' -j 2 --noman --notest --thread --multi perl-5.38.2

Then you can use this local version of perl as:

perlbrew use perl-5.38.2

After installing the required dependencies:

cpan -T Gtk3 LWP::Protocol::https

You can execute gtk-pipe-viewer as:

perl -Mlib=/usr/share/perl5/vendor_perl $(which gtk-pipe-viewer)

I'm getting this error on perl v5.38.1 on Arch Linux.

  • Output of perl -v
This is perl 5, version 38, subversion 1 (v5.38.1) built for x86_64-linux-thread-multi
perl -V Summary of my perl5 (revision 5 version 38 subversion 1) configuration:

Platform:
osname=linux
osvers=5.12.15-arch1-1
archname=x86_64-linux-thread-multi
uname='archlinux'
config_args='-des -Dusethreads -Duseshrplib -Doptimize=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -flto=auto -Dprefix=/usr -Dvendorprefix=/usr -Dprivlib=/usr/share/perl5/core_perl -Darchlib=/usr/lib/perl5/5.38/core_perl -Dsitelib=/usr/share/perl5/site_perl -Dsitearch=/usr/lib/perl5/5.38/site_perl -Dvendorlib=/usr/share/perl5/vendor_perl -Dvendorarch=/usr/lib/perl5/5.38/vendor_perl -Dscriptdir=/usr/bin/core_perl -Dsitescript=/usr/bin/site_perl -Dvendorscript=/usr/bin/vendor_perl -Dinc_version_list=none -Dman1ext=1perl -Dman3ext=3perl -Dlddlflags=-shared -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto -Dldflags=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto'
hint=recommended
useposix=true
d_sigaction=define
useithreads=define
usemultiplicity=define
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
Compiler:
cc='cc'
ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
optimize='-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -flto=auto'
cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
ccversion=''
gccversion='13.2.1 20230801'
gccosandvers=''
intsize=4
longsize=8
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=16
longdblkind=3
ivtype='long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='off_t'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='cc'
ldflags ='-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto -fstack-protector-strong -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib
libs=-lpthread -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
libc=/lib/../lib/libc.so.6
so=so
useshrplib=true
libperl=libperl.so
gnulibc_version='2.38'
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.38/core_perl/CORE'
cccdlflags='-fPIC'
lddlflags='-shared -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto -L/usr/local/lib -fstack-protector-strong'

Characteristics of this binary (from libperl):
Compile-time options:
HAS_LONG_DOUBLE
HAS_STRTOLD
HAS_TIMES
MULTIPLICITY
PERLIO_LAYERS
PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_SIPHASH13
PERL_HASH_USE_SBOX32
PERL_MALLOC_WRAP
PERL_OP_PARENT
PERL_PRESERVE_IVUV
PERL_USE_SAFE_PUTENV
USE_64_BIT_ALL
USE_64_BIT_INT
USE_ITHREADS
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_COLLATE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_PERLIO
USE_PERL_ATOF
USE_REENTRANT_API
USE_THREAD_SAFE_LOCALE
Built under linux
Compiled at Nov 27 2023 23:27:09
@inc:
/usr/lib/perl5/5.38/site_perl
/usr/share/perl5/site_perl
/usr/lib/perl5/5.38/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib/perl5/5.38/core_perl
/usr/share/perl5/core_perl

  • git bisect shows commit bfa5a03cc6cae5921fdf7644236c62a10f06057d (- Made the CLI version to start a little faster.) is the first to introduce the crash.
    The regression seems to be due to this change:
diff --git a/bin/gtk-pipe-viewer b/bin/gtk-pipe-viewer
index b1ca5b3..371168b 100755
--- a/bin/gtk-pipe-viewer
+++ b/bin/gtk-pipe-viewer
@@ -28,18 +28,6 @@ use 5.016;
 use warnings;
 no warnings 'once';
 
-use Cwd qw(abs_path);
-
-# Devel mode
-my $DEVEL;
-use if ($DEVEL = -w __FILE__), lib => abs_path(__FILE__ . '/../../lib');
-
-use WWW::PipeViewer v0.4.8;
-use WWW::PipeViewer::DiskCache;
-use WWW::PipeViewer::ParseJSON;
-use WWW::PipeViewer::RegularExpressions;
-use WWW::PipeViewer::Utils;
-use WWW::PipeViewer::Worker;
 use Gtk3         qw(-init);
 use Storable     qw();
 use Scalar::Util qw(looks_like_number);
@@ -62,6 +50,15 @@ sub devel_path {
     return @dirs;
 }
 
+my $DEVEL;
+use if ($DEVEL = -w __FILE__), lib => catdir(devel_path(), 'lib');
+
+use WWW::PipeViewer v0.4.8;
+use WWW::PipeViewer::DiskCache;
+use WWW::PipeViewer::ParseJSON;
+use WWW::PipeViewer::RegularExpressions;
+use WWW::PipeViewer::Utils;
+use WWW::PipeViewer::Worker;
 
 binmode(STDOUT, ':utf8');
 binmode(STDERR, ':utf8');

I'm using Arch Linux as well, but I'm not getting this error... This is so weird...

Can you please try this commit and see if it fixes the issue?

That commit fixed the issue.

Curiously, I tried an identical installation of Arch (cloned the disk, a few months ago) and it doesn't get this error.
I cloned a fresh copy of the repo at commit 082122c6a5e10f7255ac98eaebafea11f2e7a74b on each. One crashed, the other doesn't.

I will investigate and report back if I find any clues.

Thanks for the testing and confirming the fix.

I guess there is a bug in some of the dependencies; either in Gtk3, Storable, Scalar::Util or List::Util, which somehow disable the features enabled by use 5.014.

Note: I'm using the latest versions of the dependencies from MetaCPAN (sudo cpan -u) and this may explain why I'm not able to reproduce the issue.

trizen man
that helps!
thank you very much!