The per-ebuild logging (PORT_LOGDIR) doesn't seem to like FreeBSD's tee. spawnebuild is spawning a tee process which just sits there looking dumb, and then returns such that ebuild calls sys.exit() and then hangs until the tee process exits. Which it doesn't. Killing the tee process causes ebuild to quit normally.
This seems to be a GNU tee/BSD tee issue, so the obvious first thing to check is option incompatibilities between the two...
Bug occurs on 2.0.51-r2, but not on .51_pre20. According to AngusYoung, .51_rc1 had the problem too, so I'm not sure why it took this long to surface. :/
Some info about this problem (hope it helps):
The tee process state when portage hang is piperd (trying to read from a pipe). FreeBSD's tee accept both -i and -a used in gnu. Reading portage_exec.py I didn't find any other option to this command, so I think that may be something else.
It seems that the problem is around these statements:
... (some code)
if retval != 0:
... (more code)
Setting retval to 0 before the if, made it start logging.
Can you add a "print retval" to find out what the value actually is?
Adding a 'print retval' always shows me negative values, like this:
Your number there looks to be a 32bit signed int. The return value should be:
"a 16-bit number, whose low byte is the signal number that killed the process, and whose high byte is the exit status (if the signal number is zero); the high bit of the low byte is set if a core file was produced."
Something on your system and/or the FreeBSD port is broken. Feel free to reopen and reassign.