Skip Menu |

This queue is for tickets about the Test-Smoke CPAN distribution.

Report information
The Basics
Id: 39314
Status: resolved
Priority: 0/
Queue: Test-Smoke

People
Owner: Nobody in particular
Requestors: JDB [...] cpan.org
Cc:
AdminCc:

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



Subject: Don't require write-access to the registry
The Test::Smoke::SysInfo module on MSWin32 accesses the registry to scrape some system information. By default Win32::TieRegistry requests read and write access, which fails when you are not running as an administrator. The attached patch uses read-only access and retrieves the required information even when running as a normal user.
Subject: SysInfo.diff
--- SysInfo.pm.orig Sat Jul 19 02:04:55 2008 +++ SysInfo.pm Mon Sep 15 16:13:10 2008 @@ -660,19 +660,19 @@ eval { require Win32::TieRegistry }; unless ( $@ ) { Win32::TieRegistry->import(); + my $Registry = $Win32::TieRegistry::Registry->Open("", {Access => 0x2000000}); my $basekey = join "\\", qw( LMachine HARDWARE DESCRIPTION System CentralProcessor ); my $pnskey = "$basekey\\0\\ProcessorNameString"; - my $cpustr = $Win32::TieRegistry::Registry->{ $pnskey }; + my $cpustr = $Registry->{ $pnskey }; my $idkey = "$basekey\\0\\Identifier"; - $cpustr ||= $Win32::TieRegistry::Registry->{ $idkey }; + $cpustr ||= $Registry->{ $idkey }; $cpustr =~ tr/ / /sd; my $mhzkey = "$basekey\\0\\~MHz"; - $cpustr .= sprintf "(~%d MHz)", - hex $Win32::TieRegistry::Registry->{ $mhzkey }; + $cpustr .= sprintf "(~%d MHz)", hex $Registry->{ $mhzkey }; $cpu = $cpustr; - $ncpu = keys %{ $Win32::TieRegistry::Registry->{ $basekey } }; - ($cpu_type) = $Win32::TieRegistry::Registry->{ $idkey } =~ /^(\S+)/; + $ncpu = keys %{ $Registry->{ $basekey } }; + ($cpu_type) = $Registry->{ $idkey } =~ /^(\S+)/; } return {
On Mon Sep 15 19:18:16 2008, JDB wrote: Show quoted text
> The Test::Smoke::SysInfo module on MSWin32 accesses the registry to > scrape some system information. By default Win32::TieRegistry
requests Show quoted text
> read and write access, which fails when you are not running as an > administrator. The attached patch uses read-only access and retrieves > the required information even when running as a normal user.
Brill! this will be in the next release. Thanks for your patch. -- Abe.