[MacPorts] #43202: macports.tcl: doesn't reset user if svn fails
MacPorts
noreply at macports.org
Sat Apr 5 04:13:45 PDT 2014
#43202: macports.tcl: doesn't reset user if svn fails
----------------------+-----------------------------
Reporter: mojca@… | Owner: cal@…
Type: defect | Status: closed
Priority: Normal | Milestone: MacPorts Future
Component: base | Version: 2.2.99
Resolution: fixed | Keywords: haspatch
Port: |
----------------------+-----------------------------
Comment (by cal@…):
Replying to [comment:4 mojca@…]:
> Thank you. As already mentioned it would be nice to see it in 2.3.0, but
that's up to you or others to decide.
I'm not in any way more qualified to decide whether to backport that to
2.3.0 than you are. In fact, you could just go ahead and cherry-pick the
change onto the 2.3 branch.
> I forgot to say earlier (and maybe I could write a patch as well), but
it would probably be helpful to add a bit of extra `ui_debug` info. For
example the following:
> {{{
> set euid [geteuid]
> set egid [getegid]
> ui_debug "changing euid/egid - current euid: $euid - current egid:
$egid"
> setegid [name_to_gid [file attributes $portdir -group]]
> seteuid [name_to_uid [file attributes $portdir -owner]]
> }}}
> would be more helpful if both initial and final UID and GID were
reported (ideally also with username, not just number?). And it would
probably be nice to cleary report the the change during reversal as well.
Actually I was surprised the change was done manually. There are a few
other places in MacPorts where euid/egid are set and those are IIRC
capsuled in a proc that also prints some debugging info. Maybe re-using
that code and making it print nicer messages would be the way to go?
In fact, one could re-factor the whole thing as a block statement with
appropriate error handling, like `registry::write { code }` does,
something along the lines of
{{{
runAsUser $uid $gid {
# run svn command here
}
}}}
that would set euid/egid, print debug messages, run the block of code with
the changed privileges and restore the previous uid/gid when the block
finishes or throws an error.
--
Ticket URL: <https://trac.macports.org/ticket/43202#comment:5>
MacPorts <http://www.macports.org/>
Ports system for OS X
More information about the macports-tickets
mailing list