Skip to content

Commit

Permalink
Avoid leaking STDIN/STDOUT/STDERR to port builds
Browse files Browse the repository at this point in the history
  • Loading branch information
bdrewery committed Nov 9, 2022
1 parent 2b13f91 commit effd609
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/share/poudriere/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4261,6 +4261,10 @@ build_port() {
originspec_decode "${originspec}" port flavor
_lookup_portdir portdir "${port}"

if ! was_a_testport_run; then
exec </dev/null
fi

if [ "${BUILD_AS_NON_ROOT}" = "yes" ]; then
_need_root="NEED_ROOT NEED_ROOT"
fi
Expand Down Expand Up @@ -4442,15 +4446,15 @@ build_port() {
if [ "${phase#*-}" = "depends" ]; then
injail /usr/bin/env ${phaseenv:+-S "${phaseenv}"} \
/usr/bin/make -C ${portdir} ${MAKE_ARGS} \
${phase} || return 1
${phase} 3>&- 4>&- || return 1
else

nohang ${max_execution_time} ${NOHANG_TIME} \
"${log}/logs/${pkgname}.log" \
"${MASTER_DATADIR}/var/run/${MY_JOBID:-00}_nohang.pid" \
injail /usr/bin/env ${phaseenv:+-S "${phaseenv}"} \
/usr/bin/make -C ${portdir} ${MAKE_ARGS} \
${phase}
${phase} 3>&- 4>&-
hangstatus=$? # This is done as it may return 1 or 2 or 3
if [ $hangstatus -ne 0 ]; then
# 1 = cmd failed, not a timeout
Expand Down

0 comments on commit effd609

Please sign in to comment.