diff options
author | Bryan Drewery <bryan@shatow.net> | 2022-11-10 02:41:29 +0300 |
---|---|---|
committer | Bryan Drewery <bryan@shatow.net> | 2022-11-10 02:57:06 +0300 |
commit | effd6090e3dec2e73eee513464538bb71c4e884e (patch) | |
tree | 2751ce0e9927db5055b6b1e22dd4ac611946ee82 | |
parent | 2b13f915e1f8aeb5bba52bd52d33879f4fd481bc (diff) |
Avoid leaking STDIN/STDOUT/STDERR to port builds
-rwxr-xr-x | src/share/poudriere/common.sh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/share/poudriere/common.sh b/src/share/poudriere/common.sh index 0bc42a68..19ab4e41 100755 --- a/src/share/poudriere/common.sh +++ b/src/share/poudriere/common.sh @@ -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 @@ -4442,7 +4446,7 @@ 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} \ @@ -4450,7 +4454,7 @@ build_port() { "${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 |