CC: | perlancar [...] cpan.org |
Subject: | Term::Detect::Software v0.222 Bug Report |
Date: | Thu, 9 Jul 2020 08:49:10 -0400 |
To: | bug-Term-Detect-Software [...] rt.cpan.org |
From: | Kevin Van Workum <vanw [...] sabalcore.com> |
Summary:
Running Term::Detect::Software:detect_terminal() in a Docker container
emits an "uninitialized value" warning.
Reproduce:
# docker run --rm -t perl:latest bash -c "cpanm --notest --quiet
Term::Detect::Software; perl -MTerm::Detect::Software=detect_terminal -e
detect_terminal"
Successfully installed Proc-ProcessTable-0.59
Successfully installed Proc-Find-Parents-0.631
Successfully installed File-Which-1.23
Successfully installed Term-Detect-Software-0.222
4 distributions installed
*Use of uninitialized value $proc in string eq at
/usr/local/lib/perl5/site_perl/5.32.0/Term/Detect/Software.pm line 156.*
Bug:
detect_terminal assumes the perl process has a parent process, but under
docker, this is not always true. It can be PID 1.
Patch:
*** /usr/local/share/perl5/Term/Detect/Software.pm 2019-08-20
19:28:53.000000000 +0000
--- Software.pm 2020-07-09 11:04:33.461206097 +0000
***************
*** 138,144 ****
}
# [0] is shell
! my $proc = @$ppids >= 1 ? $ppids->[1]{name} : '';
#say "D:proc=$proc";
if ($proc ~~ $gnome_terminal_terms) {
push @dbg, "detect: gnome-terminal via procname ($proc)";
--- 138,144 ----
}
# [0] is shell
! my $proc = @$ppids >= 2 ? $ppids->[1]{name} : '';
#say "D:proc=$proc";
if ($proc ~~ $gnome_terminal_terms) {
push @dbg, "detect: gnome-terminal via procname ($proc)";
--
*Kevin Van Workum, PhD*
*Principal, Sabalcore*
*P* 877-492-8027 x1011
*W* www.sabalcore.com *E* vanw@sabalcore.com
*A *3505 Lake Lynda Drive Suite 200, Orlando, FL 32817
--
*Disclaimer*
The information contained in this communication from the
sender is confidential. It is intended solely for use by the recipient and
others authorized to receive it. If you are not the recipient, you are
hereby notified that any disclosure, copying, distribution or taking action
in relation of the contents of this information is strictly prohibited and
may be unlawful.