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

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

Thread Next
From:
Tony Cook via RT
Date:
April 11, 2013 00:58
Subject:
[perl #117539] Fix incorrect assumptions about gids & uids
Message ID:
rt-3.6.HEAD-28177-1365641868-1031.117539-15-0@perl.org
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:

  sv_setuid
  SvUID

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.

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=117539

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