Skip Menu |

This queue is for tickets about the Sys-Info-Driver-Linux CPAN distribution.

Report information
The Basics
Id: 72673
Status: resolved
Priority: 0/
Queue: Sys-Info-Driver-Linux

People
Owner: Nobody in particular
Requestors:
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.7801
Fixed in: (no value)



Subject: Sys::Info::Driver::Linux::OS::Distribution::_probe_release() returns 'centos' as the DISTRIB_ID for Red Hat Enterprise Linux Server release 5.7 (Tikanga)
Hello and thank you for Sys::Info::Driver::Linux On... cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.7 (Tikanga) Sys::Info::Driver::Linux::OS::Distribution::_probe_release() returns 'centos' as the DISTRIB_ID and not 'redhat' because /etc/redhat-release exists and /etc/redhat_version does not, the Conf.pm contains: <redhat> version_match = Red Hat Linux release (.*) \( release = redhat-release release = redhat_version </redhat> But the hash used only contains: { ... 'redhat-release' => 'centos', ... 'redhat_version' => 'redhat', ... }; I ended up making these changes (they will not work if you are on centos) Sys-Info-Driver-Linux- 0.7801/lib/Sys/Info/Driver/Linux/OS/Distribution/Conf.pm 22,27d21 < <centos> < manufacturer = Lance Davis < release = redhat-release < version_match = CentOS release (.*) \( < </centos> < 147c141,142 < version_match = Red Hat Linux release (.*) \( --- Show quoted text
> manufacturer = Red Hat > version_match = Red Hat .*Linux .*release (.*) \(
149d143 < release = redhat_version To differentiate between centos and redhat by /etc/$id file I think the code will also need to check the contents of the file. Cheers, Peter (Stig) Edwards
I haven't looked closeley at this code, but couldn't you just look for /etc/centos-release and assume centos. Then if that fails, assume redhat-release means redhat? If you want to get really fancy, the best way I've seen is to do rpm -qf /etc/redhat-release
Here is a combined patch that will work for CentOS and RedHat note that I ve added release_derived attribute for redhat to avoid the conflict with centos index 3796173..dabbaa1 100644 --- a/lib/Sys/Info/Driver/Linux/OS/Distribution.pm +++ b/lib/Sys/Info/Driver/Linux/OS/Distribution.pm @@ -86,6 +86,7 @@ sub _probe_release { if ( -f "/etc/$id" && !-l "/etc/$id" ){ $self->{DISTRIB_ID} = $r->{ $id }; $self->{release_file} = $id; + next unless $self->{DISTRIB_ID} && $self->_probe_version; return $self->{DISTRIB_ID}; } } index fcc3515..4a5ad43 100644 --- a/lib/Sys/Info/Driver/Linux/OS/Distribution/Conf.pm +++ b/lib/Sys/Info/Driver/Linux/OS/Distribution/Conf.pm @@ -22,6 +22,7 @@ $VERSION = '0.7900'; <centos> manufacturer = Lance Davis release = redhat-release + release = centos-release version_match = CentOS(?: Linux)? release (.*) \( </centos> @@ -154,9 +155,10 @@ $VERSION = '0.7900'; </redflag> <redhat> - version_match = Red Hat Linux release (.*) \( + version_match = Red Hat (?:Enterprise )?Linux (?:Server )release (.*) \( release = redhat-release release = redhat_version + release_derived = redhat-release </redhat> <pardus> On Wed Nov 23 14:35:37 2011, cpan@pjedwards.co.uk wrote: Show quoted text
> Hello and thank you for Sys::Info::Driver::Linux > > On... > > cat /etc/redhat-release > Red Hat Enterprise Linux Server release 5.7 (Tikanga) > > Sys::Info::Driver::Linux::OS::Distribution::_probe_release() returns > 'centos' as the DISTRIB_ID > > and not 'redhat' because /etc/redhat-release exists and > /etc/redhat_version does not, the Conf.pm contains: > > <redhat> > version_match = Red Hat Linux release (.*) \( > release = redhat-release > release = redhat_version > </redhat> > > But the hash used only contains: > > { > ... > 'redhat-release' => 'centos', > ... > 'redhat_version' => 'redhat', > ... > }; > > I ended up making these changes (they will not work if you are on > centos) > > Sys-Info-Driver-Linux- > 0.7801/lib/Sys/Info/Driver/Linux/OS/Distribution/Conf.pm > 22,27d21 > < <centos> > < manufacturer = Lance Davis > < release = redhat-release > < version_match = CentOS release (.*) \( > < </centos> > < > 147c141,142 > < version_match = Red Hat Linux release (.*) \( > ---
> > manufacturer = Red Hat > > version_match = Red Hat .*Linux .*release (.*) \(
> 149d143 > < release = redhat_version > > To differentiate between centos and redhat by /etc/$id file I think the > code will also need to check the contents of the file. > > Cheers, > Peter (Stig) Edwards
centos 5 was building but C6 was not for me. Applying the above patch allowed tests to pass.
Hi, This is fixed in v0.7901 (will arrive into CPAN mirrors shortly). -Burak