From 03d5395a062fd0871e3f0d343912414f789d318e Mon Sep 17 00:00:00 2001 From: Harald Hope Date: Wed, 18 Apr 2018 19:35:49 -0700 Subject: [PATCH] New version, new man. Bug fixes. BSD fixes. Bugs fixed: 1. CPU: MT/HT was wrong for old xeon, made mt detection more robust and hopefully more reliable, removed all explicit b_xeon based tests. 2. fixed /dev/mapper glitch, that make /dev/mapper links fail to get id'ed. 3. openbsd: fixed memory handler; fixed cpu flags, fixed partitions handling. 4. freebsd: fixed similar partition bugs, these were caused by the darwin patch. 5. man page: fixed top synopis syntax, thanks ESR. 6. partitions fs: fixed possible failures with lsblk fs. lsblk: added debuggers so we can track down this failure in the future. 7. added sshfs filter for disk used output, note, there is a possible syntax for remote fs that isn't handled: AAA:BBB that is, no :/, only the :. This makes explicit detection of still unknown remote fs very difficult since : is a legal nix filename character. --- inxi | 156 +++++++++++++++++++++++++------------------------ inxi.1 | 19 +++--- inxi.changelog | 26 +++++++++ 3 files changed, 115 insertions(+), 86 deletions(-) diff --git a/inxi b/inxi index cd747f5..791a3a5 100755 --- a/inxi +++ b/inxi @@ -31,7 +31,7 @@ use POSIX qw(uname strftime ttyname); ## INXI INFO ## my $self_name='inxi'; -my $self_version='3.0.06'; +my $self_version='3.0.07'; my $self_date='2018-04-17'; my $self_patch='00'; ## END INXI INFO ## @@ -1340,16 +1340,15 @@ sub disk_data { ['lsblk', '-fsr'], ['lsblk', '-fsP'], ['lsblk', '-a'], + ['lsblk', '-aP'], ['lsblk', '-ar'], ['lsblk', '-p'], ['lsblk', '-pr'], ['lsblk', '-pP'], ['lsblk', '-r'], - ['lsblk', '-r --output TYPE,NAME,PKNAME,RM,FSTYPE,SIZE'], - ['lsblk', '-rb --output TYPE,NAME,PKNAME,RM,FSTYPE,SIZE'], - ['lsblk', '-Pb --output TYPE,NAME,PKNAME,RM,FSTYPE,SIZE'], - ['lsblk', '-rb --output NAME,PKNAME,TYPE,RM,FSTYPE,SIZE'], - ['lsblk', '-Pb --output NAME,PKNAME,TYPE,RM,FSTYPE,SIZE'], + ['lsblk', '-r --output NAME,PKNAME,TYPE,RM,FSTYPE,SIZE,LABEL,UUID,MOUNTPOINT'], + ['lsblk', '-rb --output NAME,PKNAME,TYPE,RM,FSTYPE,SIZE,LABEL,UUID,MOUNTPOINT'], + ['lsblk', '-Pb --output NAME,PKNAME,TYPE,RM,FSTYPE,SIZE,LABEL,UUID,MOUNTPOINT'], ['gpart', 'list'], ['gpart', 'show'], ['gpart', 'status'], @@ -4473,7 +4472,7 @@ sub perl_python_client { $client{'name'} = 'gribble'; $client{'name-print'} = 'Gribble'; } - if ( ( scalar grep { $_ =~ /limnoria/ } @ps_cmd ) > 0){ + if ( grep { $_ =~ /limnoria/ } @ps_cmd){ $client{'name'} = 'limnoria'; $client{'name-print'} = 'Limnoria'; } @@ -5862,10 +5861,8 @@ sub create_output_full { main::key($num++,'model') => $cpu{'model_name'}, },); @rows = (@rows,@data); - #if ($extra > 1){ - $properties{'bits-sys'} ||= 'N/A'; - $rows[$j]{main::key($num++,'bits')} = $properties{'bits-sys'}; - #} + $properties{'bits-sys'} ||= 'N/A'; + $rows[$j]{main::key($num++,'bits')} = $properties{'bits-sys'}; if ($type){ $rows[$j]{main::key($num++,'type')} = $type; } @@ -6009,9 +6006,7 @@ sub prep_short_data { my (%cpu) = @_; my %properties = cpu_properties(%cpu); my ($cpu,$speed_key,$speed,$type) = ('','speed',0,''); - if ($cpu{'model_name'}){ - $cpu = $cpu{'model_name'}; - } + $cpu = $cpu{'model_name'} if $cpu{'model_name'}; $type = $properties{'cpu-type'} if $properties{'cpu-type'}; $speed_key = $properties{'speed-key'} if $properties{'speed-key'}; $speed = $properties{'speed'} if $properties{'speed'}; @@ -6038,7 +6033,6 @@ sub data_cpuinfo { my ($arch,@ids,@line,$b_first,$b_proc_int,$starter); # use --arm flag when testing arm cpus # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/arm/arm-4-core-pinebook-1.txt"; - # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/arm/arm-4-core-pinebook-1.txt"; # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/arm/armv6-single-core-1.txt"; # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/arm/armv7-dual-core-1.txt"; # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/arm/armv7-new-format-model-name-single-core.txt"; @@ -6047,6 +6041,9 @@ sub data_cpuinfo { # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/amd/2-16-core-epyc-abucodonosor.txt"; # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/amd/2-core-probook-antix.txt"; # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/amd/4-core-jean-antix.txt"; + # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/amd/4-core-althlon-mjro.txt"; + # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/amd/4-core-apu-vc-box.txt"; + # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/amd/4-core-a10-5800k-1.txt"; # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/intel/2-core-ht-atom-bruh.txt"; # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/intel/core-2-i3.txt"; # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/intel/8-core-i7-damentz64.txt"; @@ -6055,6 +6052,7 @@ sub data_cpuinfo { # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/intel/2-core-i5-fake-dual-die-hek.txt"; # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/intel/2-1-core-xeon-vm-vs2017.txt"; # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/intel/4-1-core-xeon-vps-frodo1.txt"; + $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/intel/4-6-core-xeon-no-mt-lathander.txt"; my %speeds = set_cpu_speeds_sys(); my @cpuinfo = main::reader($file); my @phys_cpus = (0);# start with 1 always @@ -6266,7 +6264,6 @@ sub data_sysctl { my (@ids,@line,%speeds,@working); my ($sep) = (''); my ($cache,$die_holder,$die_id,$phys_holder,$phys_id,$proc_count,$speed) = (0,0,0,0,0,0,0); - foreach (@sysctl){ @line = split /\s*:\s*/, $_; next if ! $line[0]; @@ -6395,16 +6392,23 @@ sub data_sysctl { sub cpu_properties { my (%cpu) = @_; - my $b_xeon = ($cpu{'model_name'} && $cpu{'model_name'} =~ /Xeon/i) ? 1 : 0; - my ($b_amd_zen,$b_epyc,$b_ht,$b_ryzen); - if ( $cpu{'type'} && $cpu{'type'} eq 'amd' && $cpu{'family'} && $cpu{'family'} eq '17' ) { - $b_amd_zen = 1; - if ($cpu{'model_name'} ){ - if ($cpu{'model_name'} =~ /Ryzen/i ){ - $b_ryzen = 1; - } - elsif ($cpu{'model_name'} =~ /EPYC/i){ - $b_epyc = 1; + my ($b_amd_zen,$b_epyc,$b_ht,$b_intel,$b_ryzen,$b_xeon); + if ($cpu{'type'} ){ + if ($cpu{'type'} eq 'intel'){ + $b_intel = 1; + $b_xeon = 1 if $cpu{'model_name'} =~ /Xeon/i; + } + elsif ($cpu{'type'} eq 'amd' ){ + if ( $cpu{'family'} && $cpu{'family'} eq '17' ) { + $b_amd_zen = 1; + if ($cpu{'model_name'} ){ + if ($cpu{'model_name'} =~ /Ryzen/i ){ + $b_ryzen = 1; + } + elsif ($cpu{'model_name'} =~ /EPYC/i){ + $b_epyc = 1; + } + } } } } @@ -6429,10 +6433,8 @@ sub cpu_properties { #print "p count:$processors_count\n"; #print Data::Dumper::Dumper \@processors; # $cpu_cores is per physical cpu - my ($cpu_layout,$cpu_type,$min_max,$min_max_key,$cache,$core_count, - $cpu_cores,$die_count) = ('','','','',0,0,0,0); - my @cores; - + my ($cpu_layout,$cpu_type,$min_max,$min_max_key) = ('','','',''); + my ($cache,$core_count,$cpu_cores,$die_count) = (0,0,0,0); foreach my $die_ref ( @phys ){ next if ! $die_ref; my @dies = @$die_ref; @@ -6452,18 +6454,8 @@ sub cpu_properties { #print 'cores: ' . $core_count, "\n"; } } - # like, intel core duo - # NOTE: sadly, not all core intel are HT/MT, oh well... - # if ($b_xeon || $cpu{'model_name'} =~ /intel.*core/i){ - if ($b_xeon ){ - $b_ht = 1; - } # this covers potentially cases where ARM cpus have > 1 die $cpu{'dies'} = ($b_arm && $die_count <= 1 && $cpu{'dies'} > 1) ? $cpu{'dies'}: $die_count; - # Note: for > 1 phys cpu system, the die counts will be wrong - if ($phyical_count > 1 && $die_count > 1 ){ - - } # this is an attempt to fix the amd family 15 bug with reported cores vs actual cores # NOTE: amd A6-4400M APU 2 core reports: cores: 1 siblings: 2 # NOTE: AMD A10-5800K APU 4 core reports: cores: 2 siblings: 4 @@ -6475,13 +6467,24 @@ sub cpu_properties { } #print "cpu-c:$cpu_cores\n"; #$cpu_cores = $cpu{'cores'}; + # like, intel core duo + # NOTE: sadly, not all core intel are HT/MT, oh well... # xeon may show wrong core / physical id count, if it does, fix it. A xeon # may show a repeated core id : 0 which gives a fake num_of_cores=1 - if ($b_xeon && $cpu{'siblings'} > 1){ - $cpu_cores = ($cpu{'siblings'}/2); + if ($b_intel){ + if ($cpu{'siblings'} && $cpu{'siblings'} > 1 && $cpu{'cores'} && $cpu{'cores'} > 1 ){ + if ( $cpu{'siblings'}/$cpu{'cores'} == 1 ){ + $b_intel = 0; + $b_ht = 0; + } + else { + $cpu_cores = ($cpu{'siblings'}/2); + $b_ht = 1; + } + } } # ryzen is made out of blocks of 8 core dies - if ($b_ryzen){ + elsif ($b_ryzen){ $cpu_cores = $cpu{'cores'}; # note: posix ceil isn't present in Perl for some reason, deprecated? my $working = $cpu_cores / 8; @@ -6525,7 +6528,8 @@ sub cpu_properties { #print "prc: $processors_count phc: $phyical_count coc: $core_count cpc: $cpu_cores\n"; if (!$b_arm && $processors_count == $phyical_count*$core_count && $cpu_cores > $core_count){ $b_ht = 0; - $b_xeon = 0; + #$b_xeon = 0; + $b_intel = 0; $cpu_cores = 1; $core_count = 1; $cpu{'siblings'} = 1; @@ -6537,16 +6541,16 @@ sub cpu_properties { # if > 1 processor && processor id (physical id) != core id then Multi-Core Processors (MCP) # if > 1 processor && processor ids (physical id) > 1 then Symmetric Multi Processing (SMP) # if = 1 processor then single core/processor Uni-Processor (UP) - if ( $processors_count > 1 || ( $b_xeon && $cpu{'siblings'} > 0 ) ) { + if ( $processors_count > 1 || ( $b_intel && $cpu{'siblings'} > 0 ) ) { # non-multicore MT if ($processors_count == ($phyical_count * $cpu_cores * 2)){ #print "mt:1\n"; $cpu_type .= 'MT'; } - elsif ($b_xeon && $cpu{'siblings'} > 1){ - #print "mt:2\n"; - $cpu_type .= 'MT'; - } +# elsif ($b_xeon && $cpu{'siblings'} > 1){ +# #print "mt:2\n"; +# $cpu_type .= 'MT'; +# } elsif ($cpu{'siblings'} > 1 && ($cpu{'siblings'} == 2 * $cpu_cores )){ #print "mt:3\n"; $cpu_type .= 'MT'; @@ -6573,15 +6577,8 @@ sub cpu_properties { if ($phyical_count > 1){ $cpu_layout = $phyical_count . 'x '; } - if (!$bsd_type){ - $cpu_layout .= count_alpha($cpu_cores) . 'Core'; - if ($cpu{'dies'} > 1){ - $cpu_layout .= ' (' . $cpu{'dies'}. '-Die)'; - } - } - else { - $cpu_layout .= count_alpha($cpu_cores) . ' Core'; - } + $cpu_layout .= count_alpha($cpu_cores) . 'Core'; + $cpu_layout .= ' (' . $cpu{'dies'}. '-Die)' if !$bsd_type && $cpu{'dies'} > 1; # the only possible change for bsds is if we can get phys counts in the future if ($bsd_type){ $cache = $cpu{'l2-cache'} * $phyical_count; @@ -9735,6 +9732,7 @@ sub create_output { $dev_type = 'raid'; $dev = $row{'dev-base'}; } + # note: I have seen this: beta:data/ for sshfs path elsif ($row{'dev-base'} =~ /^\/\/|:\//){ $dev_type = 'remote'; $dev = $row{'dev-base'}; @@ -9798,14 +9796,13 @@ sub partition_data { # in freebsd. However since most use is from linux, we make that default if (!$bsd_type){ @partitions_working = main::grabber("df -P -T -k 2>/dev/null"); - if (-d '/dev/disk/mapper'){ + if (-d '/dev/mapper'){ @mapper = main::globber('/dev/mapper/*'); } } else { # this is missing the file system data if ($bsd_type ne 'darwin'){ - $cols = 5; @partitions_working = main::grabber("df -T -k 2>/dev/null"); } #Filesystem 1024-blocks Used Available Capacity iused ifree %iused Mounted on @@ -9817,6 +9814,7 @@ sub partition_data { if (!@partitions_working){ @partitions_working = main::grabber("df -k 2>/dev/null"); $b_fs = 0; + $cols = 5 if $bsd_type ne 'darwin'; if (my $path = main::check_program('mount')){ @mount = main::grabber("$path 2>/dev/null"); } @@ -10045,7 +10043,7 @@ sub set_lsblk { $b_lsblk = 1; my (@temp,@working); if (my $program = main::check_program('lsblk')){ - @working = main::grabber("$program -bP --output NAME,TYPE,RM,FSTYPE,SIZE 2>/dev/null"); + @working = main::grabber("$program -bP --output NAME,TYPE,RM,FSTYPE,SIZE,LABEL,UUID,MOUNTPOINT 2>/dev/null"); foreach (@working){ my ($name,$type,$rm,$fstype,$size) = ('','','','',''); if (/NAME="([^"]*)"\s+TYPE="([^"]*)"\s+RM="([^"]*)"\s+FSTYPE="([^"]*)"\s+SIZE="([^"]*)"/){ @@ -10062,7 +10060,6 @@ sub set_lsblk { } # print Data::Dumper::Dumper \@lsblk; main::log_data('dump','@lsblk',\@lsblk) if $b_log; - shift @lsblk if @lsblk; # get rid of row headers eval $end if $b_log; } sub check_lsblk { @@ -10079,7 +10076,8 @@ sub check_lsblk { last; } } - eval $start if $b_log; + main::log_data('dump','%part',\%part) if $b_log; + eval $end if $b_log; return %part; } sub get_label { @@ -14261,6 +14259,7 @@ sub set_xprop { if (my $program = main::check_program('xprop')){ @xprop = main::grabber("xprop -root $display_opt 2>/dev/null"); if (@xprop){ + # add wm / de as required, but only add what is really tested for above my $pattern = 'blackbox_pid|enlightenment|^_gnome|herbstluftwm|'; $pattern .= '^i3_|icewm|_marco|_muffin|openbox_pid|^windowmaker|^_wm2|xfce'; # let's only do these searches once @@ -14269,7 +14268,7 @@ sub set_xprop { $b_xprop = 1 if scalar @xprop > 0; } } - #print "@xprop\n"; + # print "@xprop\n"; eval $end if $b_log; } @@ -14283,7 +14282,7 @@ sub get_display_manager { # explicitly, not -e my @dms = qw(entranced.pid gdm.pid gdm3.pid kdm.pid ldm.pid lightdm.pid lxdm.pid mdm.pid nodm.pid sddm.pid sddm slim.lock - tint2.pid wdm.pid xdm.pid); + tint2.pid wdm.pid xdm.pid xenodm.pid); # this is the only one I know of so far that has --version # lightdm outputs to stderr, so it has to be redirected my @dms_version = qw(lightdm); @@ -14818,15 +14817,16 @@ sub get_memory_data_bsd { my $memory = ''; my ($avail,$total,$free_mem,$real_mem) = (0,0,0,0); my (@data,$message); + my $arg = ($bsd_type ne 'openbsd') ? '-H' : ''; if (my $program = check_program('vmstat')){ # see above, it's the last line. -H makes it hopefully all in kB so no need # for K/M/G tests - my $row = (grabber('vmstat -H 2>/dev/null','\n','strip'))[-1]; + my $row = (grabber("vmstat $arg 2>/dev/null",'\n','strip'))[-1]; if ( $row ){ @data = split /\s+/, $row; # dragonfly can have 0 avg, but they may fix that so make test dynamic if ($data[3] != 0){ - $avail = sprintf ('%.1f',$data[3]/1024); + $avail = ($bsd_type ne 'openbsd') ? sprintf ('%.1f',$data[3]/1024) : $data[3]; } elsif ($data[4] != 0){ $free_mem = sprintf ('%.1f',$data[4]); @@ -14919,17 +14919,19 @@ sub get_module_version { sub get_partition_extra_data { eval $start if $b_log; $b_partition_extra = 1; - if (!$bsd_type){ - if (-d '/dev/disk/by-label'){ - @labels = main::globber('/dev/disk/by-label/*'); + if ( $show{'unmounted'} || $show{'label'} || $show{'uuid'} ){ + if (!$bsd_type){ + if (-d '/dev/disk/by-label'){ + @labels = main::globber('/dev/disk/by-label/*'); + } + if (-d '/dev/disk/by-uuid'){ + @uuids = main::globber('/dev/disk/by-uuid/*'); + } } - if (-d '/dev/disk/by-uuid'){ - @uuids = main::globber('/dev/disk/by-uuid/*'); - } - } - else { - if ( ($show{'unmounted'} || $show{'label'} || $show{'uuid'} ) && (my $path = main::check_program('gpart'))){ - @gpart = main::grabber("$path list 2>/dev/null",'strip'); + else { + if ( my $path = main::check_program('gpart')){ + @gpart = main::grabber("$path list 2>/dev/null",'strip'); + } } } eval $end if $b_log; diff --git a/inxi.1 b/inxi.1 index 9ac5894..369634e 100644 --- a/inxi.1 +++ b/inxi.1 @@ -1,17 +1,17 @@ -.TH INXI 1 "2018\-04\-17" inxi "inxi manual" +.TH INXI 1 "2018\-04\-18" inxi "inxi manual" .SH NAME inxi \- Command line system information script for console and IRC .SH SYNOPSIS -\fBinxi\fR \- Display a short system summary. +\fBinxi\fR -\fBinxi \fR[\fB\-AbBCdDfFGhiIlmMnNopPrRsSuUVwzZ\fR] +\fBinxi\fR [\fB\-AbBCdDfFGhiIlmMnNopPrRsSuUVwzZ\fR] -\fBinxi \fR[\fB\-c NUMBER\fR] [\fB\-t c|m|cm|mc [NUMBER]\fR] \fR[\fB\-v NUMBER\fR] -[\fB\-W LOCATION\fR] [\fB\-y WIDTH\fR] +\fBinxi\fR [\fB\-c NUMBER\fR] [\fB\-t [\fBc\fR|\fBm\fR|\fBcm\fR|\fBmc\fR] +[\fBNUMBER\fR]] \fR[\fB\-v NUMBER\fR] [\fB\-W LOCATION\fR] [\fB\-y WIDTH\fR] -\fBinxi \fR[\fB\-\-recommends\fR] \fR[\fB\-\-slots\fR] \fR[\fB\-\-usb\fR] +\fBinxi\fR [\fB\-\-recommends\fR] \fR[\fB\-\-slots\fR] \fR[\fB\-\-usb\fR] -\fBinxi \fB\-x\fR|\fB\-xx\fR|\fB\-xxx\fR \fB\-OPTION(s) \fR +\fBinxi\fB \-x\fR|\fB\-xx\fR|\fB\-xxx\fR \fB\-OPTION(s) \fR All options have long form variants \- see below for these and more advanced options. @@ -1065,8 +1065,9 @@ RAM \fB\-m\fR option. AntiX users and admins, who have helped greatly with testing and debugging, particularly for the 3.0.0 release. -ArcherSeven (Max) and Iotaka, who always manage to find the weirdest or most extreme -hardware and setups that help make inxi much more robust. +ArcherSeven (Max), Brett Bohnenkamper (aka KittyKatt), and Iotaka, who always +manage to find the weirdest or most extreme hardware and setups that help make +inxi much more robust. For the vastly underrated skill of output error/glitch catching, Pete Haddow. His patience and focus in going through inxi repeatedly to find errors and inconsistencies diff --git a/inxi.changelog b/inxi.changelog index c1eeb61..82c3aec 100644 --- a/inxi.changelog +++ b/inxi.changelog @@ -1,3 +1,29 @@ +===================================================================================== +Version: 3.0.07 +Patch Version: 00 +Script Date: 2018-04-17 +----------------------------------- +Changes: +----------------------------------- +New version, new man. Bug fixes. BSD fixes. + +Bugs fixed: +1. CPU: MT/HT was wrong for old xeon, made mt detection more robust and hopefully +more reliable, removed all explicit b_xeon based tests. +2. fixed /dev/mapper glitch, that make /dev/mapper links fail to get id'ed. +3. openbsd: fixed memory handler; fixed cpu flags, fixed partitions handling. +4. freebsd: fixed similar partition bugs, these were caused by the darwin patch. +5. man page: fixed top synopis syntax, thanks ESR. +6. partitions fs: fixed possible failures with lsblk fs. lsblk: added debuggers +so we can track down this failure in the future. +7. added sshfs filter for disk used output, note, there is a possible syntax for +remote fs that isn't handled: AAA:BBB that is, no :/, only the :. This makes +explicit detection of still unknown remote fs very difficult since : is a legal +nix filename character. + +----------------------------------- +-- Harald Hope - Wed, 18 Apr 2018 19:29:02 -0700 + ===================================================================================== Version: 3.0.06 Patch Version: 00