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

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

Thread Previous | Thread Next
Ævar Arnfjörð Bjarmason
February 11, 2012 12:42
Re: [perl #96208] UIDs and GIDs should not be cached
Message ID:
On Sat, Feb 11, 2012 at 20:45, Leon Timmermans <> wrote:
> On Sun, Jan 15, 2012 at 10:07 PM, Leon Timmermans <> wrote:
>> Third attempt. I really should stop coding for tonight.
> Fix attached. I couldn't remove the cache entirely, as it's also used
> by the ID swapping, but now every read of $<, $>, $( or $) always
> returns the correct result.

I very much like where this patch is going, but IMO it needs some

 * 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.

 * 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

   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:

            Uid_t           uid
    #ifndef WIN32
            if (RETVAL >= 0) {
                PL_uid  = getuid();
                PL_euid = geteuid();

 * 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

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About