Bug fixes, updates!!! Yes!! Why wait!!! Can't stay frozen forever!

Bugs:
1. Not an inxi bug, but a weird change in defaults for ubuntu GNOME ENV
variable values when running at least the gnome desktop, result to end
users appears to be a bug. This resolves issue #228
Note that so much weird non desktop data was put into those environmental
variables that inxi simply could make no sense of it. The fix was to make
the detections more robust, using regex instead of string compare, as well as
to at least try to strip out such corrupted data values, though that can never
be fully predictable.
As far as I know, this issue only hits ubuntu gnome desktops, I've never seen these
value corruptions on any other distro, or on any other ubuntu desktop, though
they may be there, but I'm not going to test all the ubuntu spins to find out.

I'm hoping the combination of logic fixes and junk data cleaning will handle
most future instances of these types of corruptions automatically.

Again, this only happens on relatively laste ubuntu gnomes as far as I know.

Fixes:
1. An oversight, added sshd to list of whitelisted start clients. This permits
expected output for: ssh <name@server> inxi -bay
that is, running inxi as an ssh command string. Should have done that a while ago,
but better late than never.
This corrects issue #227, or at least, has a better default, it worked fine before,
but required using --tty to reset to default terminal behavior. The problem is
that if inxi can't determine what it's running in, it defaults to thinking it's
in an IRC client, and switches to IRC color codes, among other changes.
But it was nice to get sshd covered automatically so users don't have to know
the --tty option.

Changes:
1. More disk vendors and vendor IDs!!! Yes, that's right, the list never ends!!
This commit is contained in:
Harald Hope 2020-10-16 13:54:25 -07:00
parent 4e4c0d8e14
commit e45c696010
3 changed files with 85 additions and 16 deletions

53
inxi
View file

@ -39,8 +39,8 @@ use POSIX qw(uname strftime ttyname);
## INXI INFO ##
my $self_name='inxi';
my $self_version='3.1.07';
my $self_date='2020-09-29';
my $self_version='3.1.08';
my $self_date='2020-10-16';
my $self_patch='00';
## END INXI INFO ##
@ -3618,6 +3618,7 @@ sub program_version {
my @data = reader($extra,'strip');
@data = map {s/$stderr/ /;$_} @data if $stderr; # $stderr is the splitter
$output = join "\n",@data;
$cmd = '';
}
# These will mostly be shells that require running the shell command -c to get info data
elsif ($version eq 'cmd'){
@ -5345,7 +5346,7 @@ sub get_client_version {
my $wl_terms = 'alacritty|evilvte|germinal|guake|hyper|kate|kitty|kmscon|';
$wl_terms .= 'konsole|minicom|putty|rxvt|sakura|shellinabox|^st$|sudo|term|tilda|';
$wl_terms .= 'tilix|urvxt|yaft|yakuake';
my $wl_clients = 'ansible|chef|run-parts';
my $wl_clients = 'ansible|chef|run-parts|sshd';
my $whitelist = "$wl_terms|$wl_clients";
# print "$client{'name'}\n";
if ($client{'name'} =~ /($whitelist)/i){
@ -9776,7 +9777,7 @@ sub set_vendors {
['(^MKN|Mushkin)','Mushkin','Mushkin',''], # MKNS
# MU = Multiple_Flash_Reader too risky: |M[UZ][^L] HD103SI HD start risky
# HM320II HM320II
['(SAMSUNG|^MCG[0-9]+GC|^MCC|^MCBOE|\bEVO\b|^[GS]2 Portable|^[DG]3 Station|^DUO\b|^P3|^BGN|^BJ[NT]|^BWB|^(HM|SP)[0-9]{2}|^MZMPC|^HD[0-9]{3}[A-Z]{2}$)','SAMSUNG','Samsung',''], # maybe ^SM, ^HM
['(SAMSUNG|^MCG[0-9]+GC|^MCC|^MCBOE|\bEVO\b|^[GS]2 Portable|^[DG]3 Station|^DUO\b|^P3|^BGN|^CJN|^BJ[NT]|^BWB|^(HM|SP)[0-9]{2}|^MZMPC|^HD[0-9]{3}[A-Z]{2}$)','SAMSUNG','Samsung',''], # maybe ^SM, ^HM
# Android UMS Composite?
['(SanDisk|^SDS[S]?[DQ]|^SL([0-9]+)G|^AFGCE|^ABLCD|^SDW[1-9]|^U3\b|ULTRA\sFIT|Clip Sport|Cruzer|^Extreme)','SanDisk','SanDisk',''],
['^STEC\b','^STEC\b','STEC',''], # ssd drive, must come before seagate ST test
@ -9814,6 +9815,7 @@ sub set_vendors {
['^5ACE','^5ACE','5ACE',''], # could be seagate: ST316021 5ACE
['^(AbonMax|ASU[0-9])','^AbonMax','AbonMax',''],
['^Addlink','^Addlink','Addlink',''],
['^(Advantech|SQF)','^Advantech','Advantech',''],
['^Aireye','^Aireye','Aireye',''],
['^Alfawise','^Alfawise','Alfawise',''],
['^Android','^Android','Android',''],
@ -9824,6 +9826,7 @@ sub set_vendors {
['^(AP|Apacer)','^Apacer','Apacer',''],
['^(A-?RAM|ARSSD)','^A-?RAM','A-RAM',''],
['^Arch','^Arch(\s*Memory)?','Arch Memory',''],
['^(Asenno|AS[1-9])','^Asenno','Asenno',''],
['^Asgard','^Asgard','Asgard',''],
['^(ASM|2115)','^ASM','ASMedia',''],#asm1153e
['^(AVEXIR|AVSSD)','^AVEXIR','Avexir',''],
@ -9896,6 +9899,7 @@ sub set_vendors {
['^G[\s-]*Tech','^G[\s-]*Technology','G-Technology',''],
['^HDC','^HDC\b','HDC',''],
['^Hectron','^Hectron','Hectron',''],
['^HEMA','^HEMA','HEMA',''],
['^(Hikvision|HKVSN)','^Hikvision','Hikvision',''],
['^Hoodisk','^Hoodisk','Hoodisk',''],
['^HUAWEI','^HUAWEI','Huawei',''],
@ -9924,6 +9928,7 @@ sub set_vendors {
['^KingDian','^KingDian','KingDian',''],
['^Kingfast','^Kingfast','Kingfast',''],
['^KingMAX','^KingMAX','KingMAX',''],
['^Kingrich','^Kingrich','Kingrich',''],
['^KING\s?SHARE','^KING\s?SHARE','KingShare',''],
['^(KingSpec|ACSC)','^KingSpec','KingSpec',''],
# kingwin docking, not actual drive
@ -9967,7 +9972,7 @@ sub set_vendors {
['^(MRMA|Memoright)','^Memoright','Memoright',''],
['^MTASE','^MTASE','MTASE',''],
['^MTRON','^MTRON','MTRON',''],
['^Neo\s*Forza','^Neo\s*Forza','Neo Forza',''],
['^(Neo\s*Forza|NFS[0-9])','^Neo\s*Forza','Neo Forza',''],
['^Netac','^Netac','Netac',''],
['^Nik','^Nikimi','Nikimi',''],
['^Orico','^Orico','Orico',''],
@ -10052,6 +10057,7 @@ sub set_vendors {
['^Wilk','^Wilk','Wilk',''],
['^Xintor','^Xintor','Xintor',''],
['^XPG','^XPG','XPG',''],
['^XrayDisk','^XrayDisk','XrayDisk',''],
['^XUNZHE','^XUNZHE','XUNZHE',''],
['^(YUCUN|R880)','^YUCUN','YUCUN',''],
['^ZALMAN','^ZALMAN','Zalman',''],
@ -10060,6 +10066,7 @@ sub set_vendors {
['^(Zotac|ZTSSD)','^Zotac','Zotac',''],
['^ZSPEED','^ZSPEED','ZSpeed',''],
['^ZTC','^ZTC','ZTC',''],
['^ZTE','^ZTE','ZTE',''],
['^(ASMT|2115)','^ASMT','ASMT (case)',''],
);
eval $end if $b_log;
@ -17925,13 +17932,8 @@ package DesktopEnvironment;
my ($b_gtk,$b_qt,$b_xprop,$desktop_session,$gdmsession,$kde_session_version,
$xdg_desktop,@desktop,@data,@xprop);
sub get {
# NOTE $XDG_CURRENT_DESKTOP envvar is not reliable, but it shows certain desktops better.
# most desktops are not using it as of 2014-01-13 (KDE, UNITY, LXDE. Not Gnome)
$desktop_session = ( $ENV{'DESKTOP_SESSION'} ) ? lc($ENV{'DESKTOP_SESSION'}) : '';
$xdg_desktop = ( $ENV{'XDG_CURRENT_DESKTOP'} ) ? lc($ENV{'XDG_CURRENT_DESKTOP'}) : '';
$kde_session_version = ($ENV{'KDE_SESSION_VERSION'}) ? $ENV{'KDE_SESSION_VERSION'} : '';
# for fallback to fallback protections re false gnome id
$gdmsession = ( $ENV{'GDMSESSION'} ) ? lc($ENV{'GDMSESSION'}) : '';
eval $start if $b_log;
set_desktop_values();
main::set_ps_gui() if ! $b_ps_gui;
get_kde_trinity_data();
if (!@desktop){
@ -17956,8 +17958,26 @@ sub get {
set_qt_data() if $b_qt && $extra > 1;
main::log_data('dump','@desktop', \@desktop) if $b_log;
# ($b_xprop,$kde_session_version,$xdg_desktop,@data,@xprop) = undef;
eval $end if $b_log;
return @desktop;
}
sub set_desktop_values {
# NOTE $XDG_CURRENT_DESKTOP envvar is not reliable, but it shows certain desktops better.
# most desktops are not using it as of 2014-01-13 (KDE, UNITY, LXDE. Not Gnome)
$desktop_session = ( $ENV{'DESKTOP_SESSION'} ) ? prep_desktop_value($ENV{'DESKTOP_SESSION'}) : '';
$xdg_desktop = ( $ENV{'XDG_CURRENT_DESKTOP'} ) ? prep_desktop_value($ENV{'XDG_CURRENT_DESKTOP'}) : '';
$kde_session_version = ($ENV{'KDE_SESSION_VERSION'}) ? $ENV{'KDE_SESSION_VERSION'} : '';
# for fallback to fallback protections re false gnome id
$gdmsession = ( $ENV{'GDMSESSION'} ) ? prep_desktop_value($ENV{'GDMSESSION'}) : '';
}
# note: an ubuntu regresssion replaces or adds 'ubuntu' string to
# real value. Since ubuntu is the only distro I know that does this,
# will add more distro type filters as/if we come across them
sub prep_desktop_value {
$_[0] = lc(main::trimmer($_[0]));
$_[0] =~ s/\b(arch|debian|fedora|manjaro|mint|opensuse|ubuntu):?\s*//;
return $_[0];
}
sub get_kde_trinity_data {
eval $start if $b_log;
my ($program,@version_data,@version_data2);
@ -18140,11 +18160,13 @@ sub get_env_xprop_gnome_based_data {
sub check_gnome {
eval $start if $b_log;
my ($b_gnome,$detection) = (0,'');
if ($xdg_desktop && $xdg_desktop eq 'gnome'){
if ($xdg_desktop && $xdg_desktop =~ /gnome/){
$detection = 'xdg_current_desktop';
$b_gnome = 1;
}
elsif ($xdg_desktop && $xdg_desktop ne 'gnome'){
# should work as long as string contains gnome, eg: peppermint:gnome
# filtered explicitly in set_desktop_values
elsif ($xdg_desktop && $xdg_desktop !~ /gnome/){
$detection = 'xdg_current_desktop';
}
# possible values: lightdm-xsession, only positive match tests will work
@ -18170,7 +18192,8 @@ sub check_gnome {
$detection = 'xprop-root';
$b_gnome = 1;
}
main::log_data('data','$detection:$b_gnome',$detection . ":$b_gnome") if $b_log;
main::log_data('data','$detection:$b_gnome>>' . $detection . ":$b_gnome") if $b_log;
eval $end if $b_log;
return $b_gnome;
}

2
inxi.1
View file

@ -1,4 +1,4 @@
.TH INXI 1 "2020\-09\-29" inxi "inxi manual"
.TH INXI 1 "2020\-10\-16" inxi "inxi manual"
.SH NAME
inxi \- Command line system information script for console and IRC

View file

@ -1,3 +1,49 @@
=====================================================================================
Version: 3.1.08
Patch: 00
Date: 2020-10-16
-----------------------------------
Changes:
-----------------------------------
Bug fixes, updates!!! Yes!! Why wait!!! Can't stay frozen forever!
Bugs:
1. Not an inxi bug, but a weird change in defaults for ubuntu GNOME ENV
variable values when running at least the gnome desktop, result to end
users appears to be a bug. This resolves issue #228
Note that so much weird non desktop data was put into those environmental
variables that inxi simply could make no sense of it. The fix was to make
the detections more robust, using regex instead of string compare, as well as
to at least try to strip out such corrupted data values, though that can never
be fully predictable.
As far as I know, this issue only hits ubuntu gnome desktops, I've never seen these
value corruptions on any other distro, or on any other ubuntu desktop, though
they may be there, but I'm not going to test all the ubuntu spins to find out.
I'm hoping the combination of logic fixes and junk data cleaning will handle
most future instances of these types of corruptions automatically.
Again, this only happens on relatively laste ubuntu gnomes as far as I know.
Fixes:
1. An oversight, added sshd to list of whitelisted start clients. This permits
expected output for: ssh <name@server> inxi -bay
that is, running inxi as an ssh command string. Should have done that a while ago,
but better late than never.
This corrects issue #227, or at least, has a better default, it worked fine before,
but required using --tty to reset to default terminal behavior. The problem is
that if inxi can't determine what it's running in, it defaults to thinking it's
in an IRC client, and switches to IRC color codes, among other changes.
But it was nice to get sshd covered automatically so users don't have to know
the --tty option.
Changes:
1. More disk vendors and vendor IDs!!! Yes, that's right, the list never ends!!
-----------------------------------
-- Harald Hope - Fri, 16 Oct 2020 13:43:40 -0700
=====================================================================================
Version: 3.1.07
Patch: 00