File::Copy, autodie, VMS (was Re: maint-5.10-1531-ga5f97a6 on VMS status)

Craig Berry <[email protected]>
Newsgroups gmane.comp.lang.perl.ports.vms,gmane.comp.lang.perl.perl5.porters
Message-ID <[email protected]>
 
On Tuesday, July 07, 2009, at 11:03AM, "Paul Fenwick" <[email protected]> wrote:
>G'day Craig / All,
>
>Craig A. Berry wrote:
>
>> So likely we have an incompatible exit value on File::Copy, but I don't
>> know offhand why autodie cares about that.  Needs looking into.
>
>It doesn't *really* care, those tests are verifying that File::Copy returns
>what we expect, so that if any of the later tests fail, we know that
>something is wrong.
>
>However the documentation for File::Copy states for "RETURN":
>
>       All functions return 1 on success, 0 on failure.
>
>So it *should* be returning 0 if we're to be following what the docs say.
>
>I can patch autodie to skip this test on VMS, or we can patch File::Copy to
>return 0 rather than "" on failure.  I believe that cherry-picking
>079cb8cc5abf40c0b016f9f878493b4d192d85d3 into maint-5.10 should do this.

Aha.  On VMS, File::Copy::syscopy is aliased to File::Copy::rmscopy, which is implemented in XS at vms/vms.c:rmscopy_fromperl.  That's been returning PL_sv_no on failure and PL_sv_yes on success since the beginning of time, despite what the docs say.  Most likely people have depended on simple truth value and it hasn't made much difference.  But what I think needs doing is returning sv_2mortal(newSViv(0)) on failure and sv_2mortal(newSViv(1)) on success rather than the boolean brothers PL_sv_no and PL_sv_yes, but I'm no XS guru and it may be a day or so before I have time to test that theory.
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.