New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scalar Win32::GetOSVersion() broken in 5.8.3 #7150
Comments
From Chris.Madsen@trx.comCreated by chris.madsen@trx.comWin32::GetOSVersion() is broken when called in scalar context in perl Returns the list (STRING, MAJOR, MINOR, BUILD, ID), .... Test case: printf "%d\n", (scalar Win32::GetOSVersion()); These two lines should produce identical output. On Win2K It should have produced: I think it's returning PRODUCTTYPE instead of ID. This worked correctly in 5.8.0. I'm not sure about the intervening A suggested test: -- Perl Info
|
From @steve-m-hayChristopher J. Madsen (via RT) wrote:
It is indeed returning ProductType instead of PlatformId. It is broken Perl 5.8.0 did this in w32_GetOSVersion() (win32/win32.c): ... which means PlatformId is returned in scalar context, but as of Perl ... so ProductType is returned in scalar context if the extra items were The attached patch against bleadperl (incorporating your test) fixes it. - Steve Radan Computational Ltd. The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only. If you have received this message in error or there are any problems, please notify the sender immediately. The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden. Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd. The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email. |
From @steve-m-hayInline Patchdiff -ruN perl-5.9.x.orig/MANIFEST perl-5.9.x/MANIFEST
--- perl-5.9.x.orig/MANIFEST 2004-02-20 11:10:03.000000000 +0000
+++ perl-5.9.x/MANIFEST 2004-03-04 09:36:04.864585100 +0000
@@ -2949,6 +2949,7 @@
t/uni/tr_utf8.t See if Unicode tr/// works
t/uni/upper.t See if Unicode casing works
t/uni/write.t See if Unicode formats work
+t/win32/getosversion.t Test if Win32::GetOSVersion() works
t/win32/longpath.t Test if Win32::GetLongPathName() works
t/win32/system.t See if system works in Win*
t/win32/system_tests Test runner for system.t
diff -ruN perl-5.9.x.orig/t/win32/getosversion.t perl-5.9.x/t/win32/getosversion.t
--- perl-5.9.x.orig/t/win32/getosversion.t 1970-01-01 00:00:00.000000000 +0000
+++ perl-5.9.x/t/win32/getosversion.t 2004-03-04 09:34:56.397149700 +0000
@@ -0,0 +1,13 @@
+#!perl -w
+
+# tests for Win32::GetOSVersion()
+
+$^O =~ /^MSWin/ or print("1..0 # not win32\n" ), exit;
+
+print "1..1\n";
+
+my $scalar = Win32::GetOSVersion();
+my @array = Win32::GetOSVersion();
+
+print "not " unless $scalar == $array[4];
+print "ok 1\n";
diff -ruN perl-5.9.x.orig/win32/win32.c perl-5.9.x/win32/win32.c
--- perl-5.9.x.orig/win32/win32.c 2003-12-29 10:50:38.000000000 +0000
+++ perl-5.9.x/win32/win32.c 2004-03-04 09:30:55.231352800 +0000
@@ -4618,6 +4618,9 @@
XSRETURN_EMPTY;
}
}
+ if (GIMME_V == G_SCALAR) {
+ XSRETURN_IV(osverw.dwPlatformId);
+ }
W2AHELPER(osverw.szCSDVersion, szCSDVersion, sizeof(szCSDVersion));
XPUSHs(newSVpvn(szCSDVersion, strlen(szCSDVersion)));
osver.dwMajorVersion = osverw.dwMajorVersion;
@@ -4638,6 +4641,9 @@
XSRETURN_EMPTY;
}
}
+ if (GIMME_V == G_SCALAR) {
+ XSRETURN_IV(osver.dwPlatformId);
+ }
XPUSHs(newSVpvn(osver.szCSDVersion, strlen(osver.szCSDVersion)));
}
XPUSHs(newSViv(osver.dwMajorVersion)); |
The RT System itself - Status changed from 'new' to 'open' |
From @rgsSteve Hay wrote in perl.perl5.porters :
Thanks, applied as 22431 to bleadperl. |
From @steve-m-hayFixed in perl-5.8.4 by change 22431 (see previous correspondence). |
@steve-m-hay - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#27357 (status was 'resolved')
Searchable as RT27357$
The text was updated successfully, but these errors were encountered: