Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Posix call (execve) breaks mercurial?

Skip to first unread message

Wayne Werner

unread,
Oct 11, 2012, 7:10:12 PM10/11/12
to pytho...@python.org
So... this is certainly the deepest I've got to dig into any source code.

I'm experimenting with Review Board for code reviews, and trying to get it
set up/working here at work. When using post-review, however, I started
getting issues with untrusted users - even though they were set to trusted
in my ~/.hgrc and things worked fine otherwise.

So here's where things got weird. I could call
`subprocess.check_output(['hg', 'root'])`, and things worked just fine.
But when I added the env parameter, I got the untrusted issues. So if I
did:

import os, subprocess

# Works just fine
subprocess.check_output(['hg', 'root'])

# Gives untrusted issues
subprocess.check_output(['hg', 'root'], env=os.environ)


Long story short, I dug around the source code and ended up at the POSIX
execve function. I've been reading the manpages, but nothing seems to pop
out at me as "hey, this should/shouldn't work!".

Does anyone know what's going on here, or where I should go for more help?

Thanks,
Wayne

Wayne Werner

unread,
Oct 11, 2012, 7:33:49 PM10/11/12
to pytho...@python.org
On Thu, 11 Oct 2012, Wayne Werner wrote:

> So here's where things got weird. I could call
> `subprocess.check_output(['hg', 'root'])`, and things worked just fine. But
> when I added the env parameter, I got the untrusted issues. So if I did:
>
> import os, subprocess
>
> # Works just fine
> subprocess.check_output(['hg', 'root'])
>
> # Gives untrusted issues
> subprocess.check_output(['hg', 'root'], env=os.environ)

So... curiouser and curiouser - it looks like it's not *actually* execve's
fault after all. I just compiled the code from the man page, tweaked it to
run 'hg root', and passed it a new environment. No problems. Well, then I
manually called the posix one from Python and thing worked fine. *Then* I
actually tried the above code, and *it* worked fine.

However I *still* get problems with the post-review code. So it looks like
when I get back to work on Monday I'll be looking to see what the
difference in environment is there.

-Wayne

Antoine Pitrou

unread,
Oct 12, 2012, 9:31:22 AM10/12/12
to pytho...@python.org

Hello,

Wayne Werner <wayne <at> waynewerner.com> writes:
>
> So... curiouser and curiouser - it looks like it's not *actually* execve's
> fault after all. I just compiled the code from the man page, tweaked it to
> run 'hg root', and passed it a new environment. No problems. Well, then I
> manually called the posix one from Python and thing worked fine. *Then* I
> actually tried the above code, and *it* worked fine.
>
> However I *still* get problems with the post-review code. So it looks like
> when I get back to work on Monday I'll be looking to see what the
> difference in environment is there.

Your problem is a user question for the Mercurial mailing-list, not a Python
problem. See http://selenic.com/mailman/listinfo/mercurial

Regards

Antoine.


0 new messages