diff --git a/inxi b/inxi index 23d9d0f..32059dd 100755 --- a/inxi +++ b/inxi @@ -31,8 +31,8 @@ use POSIX qw(uname strftime ttyname); ## INXI INFO ## my $self_name='inxi'; -my $self_version='3.0.03'; -my $self_date='2018-04-12'; +my $self_version='3.0.04'; +my $self_date='2018-04-14'; my $self_patch='00'; ## END INXI INFO ## @@ -75,8 +75,7 @@ my ($b_sysctl_disk,$b_update,$b_weather) = (1,1,1); ## System my ($bsd_type,$language,$os) = ('','',''); my ($cpu_sleep,$dl_timeout,$limit,$ps_count,$usb_level) = (0.35,4,10,5,0); -my @paths = qw(/sbin /bin /usr/sbin /usr/bin /usr/X11R6/bin /usr/local/sbin /usr/local/bin); -$ENV{'PATH'} = 'sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin'; +my @paths = qw(/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin /usr/X11R6/bin); my $sensors_cpu_nu = 0; ## Tools @@ -139,7 +138,6 @@ sub main { #my $ob_start = StartClient->new(); #$ob_start->get_client_data(); StartClient::get_client_data(); - #print_line("path: $ENV{'PATH'}"); # print_line( Dumper \%client); get_options(); set_debugger(); # right after so it's set @@ -161,7 +159,7 @@ sub main { sub initialize { set_os(); - # set_path(); + set_path(); set_user_paths(); set_basics(); system_files('set'); @@ -375,23 +373,21 @@ sub set_os { } } } -# not used, leaving for now in case something unaccounted happens. -# this data is now hard set top of program +# This data is hard set top of program but due to a specific project's +# foolish idea that ignoring the FSH totally is somehow a positive step +# forwards for free software, we also have to padd the results with PATH. sub set_path { - my $added_paths = ''; # Extra path variable to make execute failures less likely, merged below - my @path = split ':', $ENV{'PATH'}; - #print "PATH=$ENV{'PATH'}\n"; + my (@path); + @path = split /:/, $ENV{'PATH'} if $ENV{'PATH'}; + # print "paths: @paths\nPATH: $ENV{'PATH'}\n"; # Create a difference of $PATH and $extra_paths and add that to $PATH: - foreach (@paths) { - if ( ! grep (/$_/, @path) ){ - $added_paths .= ":$_"; - # print "$added_paths\n"; + foreach my $id (@path) { + if ( !(grep { /^$id$/ } @paths) && $id !~ /(game)/ ){ + push @paths, $id; } } - $ENV{'PATH'} .= $added_paths; - # print "PATH=$ENV{'PATH'}\n"; - ##/bin/sh -c 'echo "PATH in subshell=\"$PATH\""' + # print "paths: @paths\n"; } sub set_sep { @@ -1042,6 +1038,7 @@ sub begin_logging { $data .= "$now\n"; $data .= "Elapsed since start: $t3\n"; $data .= "n: $self_name v: $self_version p: $self_patch d: $self_date\n"; + $data .= '@paths:' . joiner(\@paths, '::', 'unset') . "\n"; $data .= $line2; print $fh_l $data; @@ -1511,6 +1508,7 @@ sub system_data { # @(#)MIRBSD KSH R56 2018/03/09: ksh and mksh 'ksh-version' => $ENV{'KSH_VERSION'}, 'manpath' => $ENV{'MANPATH'}, + 'path' => $ENV{'PATH'}, 'xdg-config-home' => $ENV{'XDG_CONFIG_HOME'}, 'xdg-config-dirs' => $ENV{'XDG_CONFIG_DIRS'}, 'xdg-data-home' => $ENV{'XDG_DATA_HOME'}, @@ -2930,7 +2928,8 @@ sub program_values { 'kded4' => ['^KDE Development Platform:',4,'--version','KDE',0,1], # command: lxqt-about 'lxqt' => ['^lxqt-about',2,'--version','LXQT',0,1], - 'mate' => ['^MATE[[:space:]]DESKTOP',-1,'--version','MATE',0,1], + 'mate-about' => ['^MATE[[:space:]]DESKTOP',-1,'--version','MATE',0,1], + 'mate-session' => ['^mate-session',-1,'--version','MATE',0,1], 'openbox' => ['^openboxt',2,'--version','Openbox',0,1], 'pekwm' => ['^pekwm',3,'--version','pekwm',0,1], 'plasmashell' => ['^plasmashell',2,'--version','KDE Plasma',0,1], @@ -6024,6 +6023,7 @@ sub data_cpuinfo { eval $start if $b_log; my ($file,$type)= @_; 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"; @@ -6041,6 +6041,7 @@ sub data_cpuinfo { # $file = "$ENV{'HOME'}/bin/scripts/inxi/data/cpu/intel/4-core-xeon-fake-dual-die-zyanya.txt"; # $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"; my %speeds = set_cpu_speeds_sys(); my @cpuinfo = main::reader($file); my @phys_cpus = (0);# start with 1 always @@ -6397,9 +6398,14 @@ sub cpu_properties { #my @dies = $phys[0][0]; my $ref = $cpu{'ids'}; my @phys = @$ref; - my $phyical_count = scalar @phys; + my $phyical_count = 0; + #my $phyical_count = scalar @phys; my @processors; my ($speed,$speed_key); + # handle case where cpu reports say, phys id 0, 2, 4, 6 [yes, seen it] + foreach (@phys) { + $phyical_count++ if $_; + } $phyical_count ||= 1; # assume 1 if no id found, as with ARM # count unique processors ## # note, this fails for intel cpus at times @@ -6415,6 +6421,7 @@ sub cpu_properties { my @cores; foreach my $die_ref ( @phys ){ + next if ! $die_ref; my @dies = @$die_ref; $core_count = 0; $die_count = scalar @dies; @@ -9793,7 +9800,7 @@ sub partition_data { } } @partitions_working = grep {!/^rootfs/} @partitions_working if $roots > 1; - my $filters = '^(aufs|cgroup|cgroup2|cgmfs|configfs|debugfs|\/dev|dev|\/dev/loop[0-9]*|devfs|devtmpfs|'; + my $filters = '^(aufs|cgroup.*|cgmfs|configfs|debugfs|\/dev|dev|\/dev/loop[0-9]*|devfs|devtmpfs|'; $filters .= 'fdescfs|iso9660|linprocfs|none|procfs|\/run(\/.*)?|run|squashfs|sys|\/sys\/.*|sysfs|'; $filters .= 'tmpfs|type|udev|unionfs|vartmp)$'; foreach (@partitions_working){ @@ -13813,7 +13820,7 @@ sub get_env_de_data { } sub get_env_xprop_de_data { eval $start if $b_log; - my ($program,@version_data); + my ($program,$string,@version_data); # NOTE: Always add to set_prop the search term if you add an item!! set_xprop(); # note that cinnamon split from gnome, and and can now be id'ed via xprop, @@ -13830,9 +13837,18 @@ sub get_env_xprop_de_data { $desktop[0] ||= 'Cinnamon'; } elsif ($xdg_desktop eq 'mate' || ( $b_xprop && main::awk(\@xprop,'_marco') )){ - @data = main::program_values('mate'); - $desktop[0] = $data[3]; - $desktop[1] = main::program_version('mate-about',$data[0],$data[1],$data[2],$data[5]); + # NOTE: mate-about reported wrong version, 1.18.0 when actual was 1.18.2 + if ($program = main::check_program('mate-session') ) { + $string = 'mate-session'; + } + elsif ($program = main::check_program('mate-about') ) { + $string = 'mate-about'; + } + if ($string){ + @data = main::program_values($string); + $desktop[0] = $data[3]; + $desktop[1] = main::program_version($program,$data[0],$data[1],$data[2],$data[5]); + } set_gtk_data() if $extra > 0; $desktop[0] ||= 'MATE'; } @@ -14511,6 +14527,9 @@ sub get_hostname { if ( $ENV{'HOSTNAME'} ){ $hostname = $ENV{'HOSTNAME'}; } + elsif ( !$bsd_type && -f "/proc/sys/kernel/hostname" ){ + $hostname = (reader('/proc/sys/kernel/hostname'))[0]; + } # puppy removed this from core modules, sigh # this is faster than subshell of hostname elsif (check_module('Sys::Hostname')){ @@ -14929,14 +14948,22 @@ sub get_shell_data { sub get_shell_source { eval $start if $b_log; my (@data); - my ($self_parent,$shell_parent) = ('',''); + my ($msg,$self_parent,$shell_parent) = ('','',''); my $ppid = getppid(); $self_parent = get_start_parent($ppid); + if ($b_log){ + $msg = ($ppid) ? "self parent: $self_parent ppid: $ppid": "self parent: undefined"; + log_data('data',$msg); + } #print "self parent: $self_parent ppid: $ppid\n"; if ($self_parent){ $shell_parent = get_shell_parent($self_parent); $client{'su-start'} = $shell_parent if ($shell_parent eq 'su' && !$client{'su-start'}); #print "shell parent 1: $shell_parent\n"; + if ($b_log){ + $msg = ($shell_parent) ? "shell parent 1: $shell_parent": "shell parent 1: undefined"; + log_data('data',$msg); + } # in case sudo starts inxi, parent is shell (or perl inxi if run by debugger) if ( $shell_parent && ( $shell_parent eq 'su' || $shell_parent =~ /^(bash|csh|ksh|lksh|loksh|mksh|pdksh|sh|dash|perl|zsh|tcsh)$/ ) ){ @@ -14945,12 +14972,20 @@ sub get_shell_source { $self_parent = get_start_parent($self_parent); $shell_parent = get_shell_parent($self_parent) if $shell; #print "shell parent 2: $shell_parent\n"; + if ($b_log){ + $msg = ($shell_parent) ? "shell parent 2: $shell_parent": "shell parent 2: undefined"; + log_data('data',$msg); + } if (!$shell || $shell_parent =~ /^(bash|csh|ksh|lksh|loksh|mksh|pdksh|sh|dash|perl|zsh|tcsh)$/ ){ $self_parent = get_start_parent($self_parent); $shell_parent = get_shell_parent($self_parent); } - #print "shell parent 2: $shell_parent\n"; + #print "shell parent 3: $shell_parent\n"; + if ($b_log){ + $msg = ($shell_parent) ? "shell parent 3: $shell_parent": "shell parent 3: undefined"; + log_data('data',$msg); + } } # to work around a ps -p or gnome-terminal bug, which returns # gnome-terminal- trim - off end @@ -16257,7 +16292,6 @@ sub generate_system_data { if (scalar @compiler != 2){ @compiler = ('N/A', ''); } - $data{$data_name}[$index]{main::key($num++,'compiler')} = $compiler[0]; # if no compiler, obviously no version, so don't waste space showing. if ($compiler[0] ne 'N/A'){ @@ -16267,7 +16301,6 @@ sub generate_system_data { } # note: tty can have the value of 0 but the two tools # return '' if undefined, so we test for explicit '' - if ($b_display){ my @desktop_data = DesktopEnvironment::get(); $desktop = $desktop_data[0] if $desktop_data[0]; @@ -16281,6 +16314,7 @@ sub generate_system_data { if ($extra > 2 && $desktop_data[4]){ $desktop_info = $desktop_data[4]; } + # don't print the desktop if it's a wm and the same if ($desktop_data[5] && (!$desktop_data[0] || lc($desktop_data[0]) ne lc($desktop_data[5]))){ $wm = $desktop_data[5]; } diff --git a/inxi.changelog b/inxi.changelog index 4e77968..0dd489b 100644 --- a/inxi.changelog +++ b/inxi.changelog @@ -1,3 +1,23 @@ +===================================================================================== +Version: 3.0.04 +Patch Version: 00 +Script Date: 2018-04-14 +----------------------------------- +Changes: +----------------------------------- +New version. Fixes several issues. + +1. issue #145 - corrects case with vm xeon where phys id skips numbers, creating +bad array looping error. +2. for issue #143, added user PATH to static list of paths, this works around distros +that have chosen to abandon the FSH standard, sigh... This adds to number of paths that +have to be checked, but there was no clean way to handle it otherwise. +3. For MATE, added new version source, mate-session, because mate-about was reporting +a non-matching version number for current MATE. + +----------------------------------- +-- Harald Hope - Sat, 14 Apr 2018 17:52:33 -0700 + ===================================================================================== Version: 3.0.03 Patch Version: 00