At 10:35 PM -0400 8/22/05, John E. Malmberg wrote:
> On every blead Perl I have seen, the following bug is present on
> VMS and is causing the script t/op/magic.t to fail at test 7.
>
> In the Perl debugger, before running any script if you issue the
> command 'x keys(%ENV), the entry for index 0, also shows up as
> index 1.
> DB<1> x keys(%ENV)
> 0 'SYS$TIMEZONE_DAYLIGHT_SAVING'
> 1 'SYS$TIMEZONE_DAYLIGHT_SAVING'
> 2 'CDE$DETACHED_LOGICALS'
> 3 'MOP$NAMED_LOAD'
> 4 'BUILD_ROOT'
>
> On all subsequent calls, you get the expected results:
>
> DB<2> x keys(%ENV)
> 0 'SYS$TIMEZONE_DAYLIGHT_SAVING'
> 1 'CDE$DETACHED_LOGICALS'
> 2 'MOP$NAMED_LOAD'
> 3 'BUILD_ROOT'
> 4 'SMBSRVSHR_TV'
In Perl_hv_iternext_flags, on the VMS platform, the calls
prime_env_iter() which can load up new environment values. If it does,
then the index to the environment hash needs to be reset, otherwise it
cause this problem.
This patch appears to fix this. It is quite possible that there are
better ways of doing this, and that this also potentially affects any
other platform that calls prime_env_iter().
-John
[EMAIL PROTECTED]
Personal Opinion Only
--- hv.c_25334 Sat Aug 27 18:45:50 2005
+++ hv.c Sat Aug 27 18:51:42 2005
@@ -1983,8 +1983,17 @@
return Null(HE*);
}
#ifdef DYNAMIC_ENV_FETCH /* set up %ENV for iteration */
- if (!entry && SvRMAGICAL((SV*)hv) && mg_find((SV*)hv, PERL_MAGIC_env))
+ if (!entry && SvRMAGICAL((SV*)hv) && mg_find((SV*)hv, PERL_MAGIC_env)) {
prime_env_iter();
+#ifdef VMS
+ /* The prime_env_iter() on VMS just loaded up new hash values
+ * so the iteration count needs to be reset back to the beginning
+ */
+ hv_iterinit(hv);
+ iter = HvAUX(hv);
+ oldentry = entry = iter->xhv_eiter; /* HvEITER(hv) */
+#endif
+ }
#endif
/* hv_iterint now ensures this. */