xbps-src: exit properly if mktemp(1) fails, not from its subshell.

Thanks @huglovefan
This commit is contained in:
Juan RP 2019-06-17 17:38:07 +02:00
parent 8614cca7df
commit 7b7d7c13a1
No known key found for this signature in database
GPG Key ID: AF19F6CB482F9368
10 changed files with 12 additions and 12 deletions

View File

@ -18,7 +18,7 @@ if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
fi
# proot does not properly return the resultcode. Workaround this
RESULT=$(mktemp || exit 1)
RESULT=$(mktemp) || exit 1
PROOT_NO_SECCOMP=1 proot -r $MASTERDIR -w / -b "$RESULT:/.result" -b $DISTDIR:/void-packages \
${HOSTDIR:+-b $HOSTDIR:/host} -b /proc:/proc -b /dev:/dev \

View File

@ -12,7 +12,7 @@ _add_trigger() {
process_metadata_scripts() {
local action="$1"
local action_file="$2"
local tmpf=$(mktemp || exit 1)
local tmpf=$(mktemp) || exit 1
local fpattern="s|${PKGDESTDIR}||g;s|^\./$||g;/^$/d"
local targets= f= _f= info_files= home= shell= descr= groups=
local found= triggers_found= _icondirs= _schemas= _mods= _tmpfiles=

View File

@ -61,7 +61,7 @@ hook() {
return 0
fi
depsftmp=$(mktemp || exit 1)
depsftmp=$(mktemp) || exit 1
find ${PKGDESTDIR} -type f -perm -u+w > $depsftmp 2>/dev/null
exec 3<&0 # save stdin

View File

@ -5,7 +5,7 @@ collect_sonames() {
local _destdir="$1" f _soname _fname _pattern
local _pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)*$"
local _versioned_pattern="^[[:alnum:]]+(.*)+\.so(\.[0-9]+)+$"
local _tmpfile="$(mktemp || exit 1)"
local _tmpfile=$(mktemp) || exit 1
if [ ! -d ${_destdir} ]; then
rm -f ${_tmpfile}

View File

@ -131,7 +131,7 @@ fi
# the bootstrap pkgs from scratch.
if [ -z "$CHROOT_READY" -a "$PKGNAME" = "base-files" ]; then
msg_normal "Installing $PKGNAME into masterdir...\n"
_log=$(mktemp || exit 1)
_log=$(mktemp) || exit 1
XBPS_ARCH=$XBPS_MACHINE $XBPS_INSTALL_CMD -yf $PKGNAME >${_log} 2>&1
if [ $? -ne 0 ]; then
msg_red "Failed to install $PKGNAME into masterdir, see below for errors:\n"

View File

@ -30,7 +30,7 @@ bulk_sortdeps() {
fi
done
tmpf=$(mktemp || exit 1)
tmpf=$(mktemp) || exit 1
# Now make the real dependency graph of all pkgs to build.
# Perform a topological sort of all pkgs but only with build dependencies
# that are found in previous step.

View File

@ -5,7 +5,7 @@ run_func() {
: ${funcname:=$func}
logpipe=$(mktemp -u -p ${XBPS_STATEDIR} ${pkgname}_${XBPS_CROSS_BUILD}_XXXXXXXX.logpipe || exit 1)
logpipe=$(mktemp -u -p ${XBPS_STATEDIR} ${pkgname}_${XBPS_CROSS_BUILD}_XXXXXXXX.logpipe) || exit 1
logfile=${XBPS_STATEDIR}/${pkgname}_${XBPS_CROSS_BUILD}_${funcname}.log
msg_normal "${pkgver:-xbps-src}: running ${desc:-${func}} ...\n"

View File

@ -6,7 +6,7 @@ remove_pkg_cross_deps() {
cd $XBPS_MASTERDIR || return 1
msg_normal "${pkgver:-xbps-src}: removing autocrossdeps, please wait...\n"
tmplogf=$(mktemp || exit 1)
tmplogf=$(mktemp) || exit 1
if [ -z "$XBPS_REMOVE_XCMD" ]; then
source_file $XBPS_CROSSPFDIR/${XBPS_CROSS_BUILD}.sh
@ -37,7 +37,7 @@ prepare_cross_sysroot() {
[ $? -eq 0 ] && return 0
msg_normal "Installing $cross cross pkg: cross-vpkg-dummy ...\n"
errlog=$(mktemp || exit 1)
errlog=$(mktemp) || exit 1
$XBPS_INSTALL_XCMD -Syfd cross-vpkg-dummy &>$errlog
rval=$?
if [ $rval -ne 0 -a $rval -ne 17 ]; then
@ -71,7 +71,7 @@ install_cross_pkg() {
check_installed_pkg cross-${XBPS_CROSS_TRIPLET}-0.1_1
[ $? -eq 0 ] && return 0
errlog=$(mktemp || exit 1)
errlog=$(mktemp) || exit 1
msg_normal "Installing $cross cross compiler: cross-${XBPS_CROSS_TRIPLET} ...\n"
$XBPS_INSTALL_CMD -Syfd cross-${XBPS_CROSS_TRIPLET} &>$errlog
rval=$?

View File

@ -48,7 +48,7 @@ remove_pkg_autodeps() {
cd $XBPS_MASTERDIR || return 1
msg_normal "${pkgver:-xbps-src}: removing autodeps, please wait...\n"
tmplogf=$(mktemp || exit 1)
tmplogf=$(mktemp) || exit 1
remove_pkg_cross_deps
$XBPS_RECONFIGURE_CMD -a >> $tmplogf 2>&1

View File

@ -64,7 +64,7 @@ show_pkg_build_depends() {
local f x _pkgname _srcpkg _dep found result
local _deps="$1"
result=$(mktemp || exit 1)
result=$(mktemp) || exit 1
# build time deps
for f in ${_deps}; do