Re: [blead-442-gc6d234b] VMS stat fixes.

[email protected] (John Malmberg)
Newsgroups perl.perl5.porters,perl.vmsperl
Message-ID <[email protected]>
Craig A. Berry wrote:

> On Jan 27, 2009, at 8:43 AM, John Malmberg wrote:

It turns out that with a simple optimization, the int_flex_stat() and 
int_flex_lstat() will not be used.

This is also a side effect of dealing with that the CRTL sees "foo bar" 
and "foobar" as the same file in the default mode, and Perl sees them as 
different files.

>> +#if defined(PERL_IMPLICIT_CONTEXT)
>> +        /* If the context is null, this will access violate */
>> +        /* and stat() has so many issues we will may need to use this */
>> +        /* routine in places where we do not have a thread context */
>> +        /* In those cases we usually do not care about the time 
>> stamps */
>> +        if (aTHX != NULL) {
>> +#endif
>> +        time((time_t *)&statbufp->st_mtime);
>> +#if defined(PERL_IMPLICIT_CONTEXT)
>> +        } else {
>> +            statbufp->st_mtime = 0;
>> +        }
>> +#endif
>>
> 
> A better way to fix this is in Perl_my_time with something like:
> 
> --- vms/vms.c;-0        2009-01-28 18:32:55 -0600
> +++ vms/vms.c   2009-01-28 18:58:30 -0600
> @@ -11995,9 +11995,17 @@ time_t Perl_my_time(pTHX_ time_t *timep)
>    when = time(NULL);
>  # ifdef VMSISH_TIME
>  # ifdef RTL_USES_UTC
> -  if (VMSISH_TIME) when = _toloc(when);
> +  if (
> +#  if defined(PERL_IMPLICIT_CONTEXT)
> +      my_perl &&
> +#  endif
> +      VMSISH_TIME) when = _toloc(when);
>  # else
> -  if (!VMSISH_TIME) when = _toutc(when);
> +  if (
> +#  if defined(PERL_IMPLICIT_CONTEXT)
> +      my_perl &&
> +#  endif
> +      !VMSISH_TIME) when = _toutc(when);
>  # endif
>  # endif
>    if (timep != NULL) *timep = when;
> 
> The place where it's checking Perl context is when it's looking at the 
> vmsish bits of $^H.

I can do that.  I did not see any other places where the time wrapper is 
called with a null thread context, so it seems simpler to just avoid 
calling it when simulating stat() for NLAO:

-John
[email protected]
Personal Opinion Only
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.