Open hvds opened 8 months ago
You can easily argue the inconsistent order is a bug, it's a big harder to argue which order is better.
Using setreuid
this way will not only change the real user id, but also the saved user id, while setruid
and setresuid
will not do such a thing.
The core problem is that this interface predates saved ids, there's no one true way to do this (though I prefer the setresuid semantics myself).
I notice by code inspection that when assigning to
$<
inmg.c:Perl_magic_set
it uses the first available ofsetruid
,setreuid
,setresuid
or (with more caveats)setuid
. However it only goes through that path if it's a scalar assignment: list assignments havePL_delaymagic
set, and end up instead going through the code inpp_hot.c:S_aassign_uid
, which uses the first available ofsetresuid
,setreuid
,setruid
,setuid
- a different order.Is this a bug? I haven't checked, but I assume the same will apply to
$>
,$(
and$)
if so.My guess is that the order doesn't matter: any of the first three that are defined will do what is needed (and if one is buggy it should be undef'd in configuration), so it's just a matter of finding one that's available on this platform. But it would be good to know for sure, and perhaps record it in a comment.