Removed '+' from distro name filter to solve issue #304

This commit is contained in:
Harald Hope 2024-06-15 14:10:51 -07:00
parent e70af3ef9a
commit 50adb95f13
2 changed files with 29 additions and 15 deletions

29
pinxi
View file

@ -50,8 +50,8 @@ use POSIX qw(ceil uname strftime ttyname);
## INXI INFO ##
my $self_name='pinxi';
my $self_version='3.3.34';
my $self_date='2024-06-14';
my $self_patch='16';
my $self_date='2024-06-15';
my $self_patch='17';
## END INXI INFO ##
my ($b_pledge,@pledges);
@ -6384,16 +6384,17 @@ sub clean_arm {
return $item;
}
# This is used only in distro name strings.
# arg: 0: name string to clean by reference
sub clean_characters {
my ($data) = @_;
# newline, pipe, brackets, + sign, with space, then clear doubled
# spaces and then strip out trailing/leading spaces.
# etc/issue often has junk stuff like (\l) \n \l
return if !$data;
$data =~ s/[:\47]|\\[a-z]|\n|,|\"|\*|\||\+|\[\s\]|n\/a|\s\s+/ /g;
$data =~ s/\(\s*\)//;
$data =~ s/^\s+|\s+$//g;
return $data;
# etc/issue often has junk stuff like (\l) \n \l. Removed + because can be
# part of distro name, like Slackware 15.0+
return if !${$_[0]}; # should not be needed since tests for not empty on use
${$_[0]} =~ s/[:\47]|\\[a-z]|\n|,|\"|\*|\||\[\s\]|n\/a|\s\s+/ /g;
${$_[0]} =~ s/\(\s*\)//;
${$_[0]} =~ s/^\s+|\s+$//g;
}
sub clean_disk {
@ -31721,7 +31722,7 @@ sub get_distro_linux {
$etc_issue = main::reader($issue,'strip',0) if -r $issue;
# debian issue can end with weird escapes like \n \l
# antergos: Antergos Linux \r (\l)
$etc_issue = main::clean_characters($etc_issue) if $etc_issue;
main::clean_characters(\$etc_issue) if $etc_issue;
# Note: always exceptions, so wild card after release/version:
# /etc/lsb-release-crunchbang
# Wait to handle since crunchbang file is one of the few in the world that
@ -31821,7 +31822,7 @@ sub get_distro_linux {
if (-r '/etc/antiX'){
@working = main::reader('/etc/antiX');
$distro->{'name'} = main::awk(\@working,'antix.*\.iso') if @working;
$distro->{'name'} = main::clean_characters($distro->{'name'}) if $distro->{'name'};
main::clean_characters(\$distro->{'name'}) if $distro->{'name'};
push(@{$distro->{'method'}},'file: /etc/antiX');
}
# This handles case where only one release/version file was found, and it's lsb-release.
@ -31867,9 +31868,7 @@ sub get_distro_linux {
}
push(@{$distro->{'method'}},'default: distro file');
}
if ($distro->{'name'}){
$distro->{'name'} = main::clean_characters($distro->{'name'});
}
main::clean_characters(\$distro->{'name'}) if $distro->{'name'};
}
# Otherwise try the default debian/ubuntu/distro /etc/issue file
elsif ($distro->{'issue'}){
@ -32163,7 +32162,7 @@ sub system_base_linux {
foreach my $key (keys %base_version){
if (-r $base_version{$key} && $distro->{'name'} =~ /($key)/i){
$distro->{'base'} = main::reader($base_version{$key},'strip',0);
$distro->{'base'} = main::clean_characters($distro->{'base'}) if $distro->{'base'};
main::clean_characters(\$distro->{'base'}) if $distro->{'base'};
push(@{$distro->{'base-method'}},"base_version: file: $key");
last;
}

View file

@ -33,6 +33,10 @@ a small refactor of the rpm logic in PackageData.
breaking OpenGL Mesa driver version detection. (was extra (git-..commit-ID) at
end of version string).
3. DistroData: codeberg user r1w1s1 in issue #304 for pointing out that the '+'
part of the distro name can be meaningful, as in Slackware 15.0+, where the +
means it's Slackware current.
--------------------------------------------------------------------------------
KNOWN ISSUES:
@ -86,6 +90,10 @@ mageia only one who didn't add trinity location to PATH).
3b. SYSTEM: DistroData: Added filter in case line 1 of /etc/issue doesn't
contain any valid characters. That's for T2 failure.
3c. SYSTEM: DistroData: main::clean_characters(): removed filter for '+' because
that can be a meaningful part of the name, as in r1w1s1's codeberg issue #304,
where the + indicates it's Slackware 15.0 Current, aka: Slackware 15.0+.
4. GRAPHICS: gl_data(): Issue #303 exposed a possible syntax that inxi had not
seen or handled before, the OpenGL core profile version string ending with a git
commit ID in parens:
@ -161,6 +169,10 @@ Active urpm repo: Stable
1: [repo location]
Active urpm repo: Testing
1: [repo location]
2: MAIN::clean_characters(): removed filter for '+' because that can be part of
the distro name, like Slackware 15.0+ (current, that is). Hopefully this won't
create any issues for other name strings, but it should be ok.
--------------------------------------------------------------------------------
DOCUMENTATION:
@ -197,6 +209,9 @@ them...
1b. MAIN: PackageData: Added --dbg 67 to make rpm packages handling debuggable.
Also refactored a bit, again to make rpm stuff debuggable.
1c. MAIN: clean_characters: refactored, now uses references, not copies, and
removed '+' from filter. This can be meaningful part of distro name.
2. REPOS: refactored completely slpkg to handle 3 possible config file syntax,
including the 2024-04-19 update which changes it completely.