develooper Front page | perl.perl5.porters | Postings from February 2012

Re: [perl #96208] UIDs and GIDs should not be cached

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
February 11, 2012 13:54
Subject:
Re: [perl #96208] UIDs and GIDs should not be cached
Message ID:
CAHhgV8jBrGzzjjpR7T3wnjnrJwBhjh8xPJiB1KqXLpyDN7bsPA@mail.gmail.com
On Sat, Feb 11, 2012 at 9:42 PM, Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
> I very much like where this patch is going, but IMO it needs some
> improvement:
>
>  * You've changed it so that we now return the current and correct
>   values when getting $<, $>, $( and $), but there's still a lot of
>   places in the perl core where we're looking at PL_uid and pals,
>   these should be changed to call PerlProc_getuid et al instead.

Yeah, that'd be a good idea. Though doing it properly may invite some
refactoring

>  * Since the id swapping is only used by "PL_delaymagic &= ~DM_RUID;"
>   and pp_sassign (and variants) we should just add new a new
>   PL_delaymagic_uid variable that's only used by the set() magic and
>   sassign().
>
>   This variable should not be made public. Thus programs on the CPAN
>   that expect to assign to PL_uid would fail and would need to be
>   updated, but they wouldn't contain a logic error anymore (by
>   expecting the core to read from PL_uid).
>
>  * Code like the code in this ifdef in POSIX.xs can just go away:
>
>    SysRet
>    setuid(uid)
>            Uid_t           uid
>        CLEANUP:
>    #ifndef WIN32
>            if (RETVAL >= 0) {
>                PL_uid  = getuid();
>                PL_euid = geteuid();
>            }
>    #endif
>
>  * It would also be informative to check how much of the CPAN is
>   relying on PL_uid, but I don't think that should block this going
>   in.

I took my approach because it's easiest. Existing code would
effectively become a no-op. In principle it's a good idea, but given
this may break stuff on CPAN, depends on #1 and we're approaching the
user-visible features deadline fast I'd rather postpone it until 5.17.

Leon

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