develooper Front page | perl.perl5.porters | Postings from April 2013

[perl #117539] Fix incorrect assumptions about gids & uids

Thread Next
Tony Cook via RT
April 11, 2013 00:58
[perl #117539] Fix incorrect assumptions about gids & uids
Message ID:
On Mon Apr 08 16:36:35 2013, Hugmeir wrote:
> [Please describe your issue here]
> See the attached patch. Copypasting the commit message here:
>     Stop making assumptions about uids and gids.
>     The code dealt rather inconsistently with uids and gids. Some
>     places assumed that they could be safely stored in UVs, others
>     in IVs, others in ints; All of them should've been using the
>     macros from config.h instead. Similarly, code that created
>     SVs or pushed values into the stack was also making incorrect
>     assumptions -- For point of reference, only pp_stat did the
>     right thing:
>      #if Uid_t_size > IVSIZE
>         mPUSHn(PL_statcache.st_uid);
>      #else
>      #   if Uid_t_sign <= 0
>         mPUSHi(PL_statcache.st_uid);
>      #   else
>         mPUSHu(PL_statcache.st_uid);
>      #   endif
>      #endif

I'd be inclined to put that knowledge in a central place rather than
#ifdeffing in every place, so for uids, two macros:


The mPUSHi() etc would become

  sv_setuid(PUSHmortal, someuid);

(which might become a third macro, mPUSHuid)

These macros would only be visible in the core.

That said, I think this is an improvement.


via perlbug:  queue: perl5 status: open

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