develooper Front page | perl.perl5.porters | Postings from March 2011

Re: [perl #86794] Problem with Fcntl inlining subroutines (e.g.S_ISDIR S_IXUSR)

Thread Previous | Thread Next
From:
Rebs Guarina
Date:
March 24, 2011 01:32
Subject:
Re: [perl #86794] Problem with Fcntl inlining subroutines (e.g.S_ISDIR S_IXUSR)
Message ID:
AANLkTi=rNRLSb4694KwajBHhPdcLevG1g5=zVgaPPfDZ@mail.gmail.com
Oh, I see. Thanks for the correction. I was mislead by
S_ISDIR/S_ISLNK/S_ISREG still working in 5.10.1.

Can you point me to a document that references these changes? Something with
a list of things that will/will not work in versions 5.10 and above (for
this module) would be great. The perldelta doc on 5.10 and 5.10.1 doesn't
seem to cover this change; 5.8.9 doesn't seem to exhibit any symptoms too.
In addition, some clarification as to why it was silently misbehaving would
be great for people switching from 5.8.8.

Thanks in advance!

Best,

Rebs

On Thu, Mar 24, 2011 at 2:48 AM, Dave Mitchell via RT <
perlbug-followup@perl.org> wrote:

> On Tue, Mar 22, 2011 at 03:45:01PM -0700, rebx wrote:
> > I'm having some problems migrating a running code from v5.8.8 to 5.10.1
>
> This is because your code that "worked" under 5.8.8 was silently
> misbehaving; 5.10.0 just points out that your code is incorrect.
>
> > Here's the error I'm getting from my test
> >
> > # perl fcntltest.t
> > Too many arguments for main::S_IXUSR at fcntltest.t line 19, near "])"
> > Execution of fcntltest.t aborted due to compilation errors.
> > # Looks like your test exited with 255 before it could output anything.
>
> That's because S_IXUSR etc are documented to be *constants*, not functions.
>
> > ok (S_IXUSR($stat[2]), "test $file is executable by the user");
> > ok (S_ISREG($stat[2]), "test $file is a file");
>
> If you look carefully, you'll see that under 5.8.8, that first line always
> succeeds, even if the file isn't executable. In fact, under 5.8.8, even
> the following returns true:
>
>    S_IXUSR(0,0,0,0)
>
> You need to change your code to
>
> ($stat[2] & S_IXUSR)
>
> HTH.
>
> --
> Standards (n). Battle insignia or tribal totems.
>
>
>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About