From 8b395cffa49a274e26b32644d4184460ea33ff0f Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 27 Dec 2024 15:54:31 +0100 Subject: [PATCH] lib, plugins: use mktemp with -p /var/tmp to avoid disk full situations on tmpfs --- lib/libapse.lib.in | 2 +- lib/libnetwork.lib.in | 6 +++--- lib/libspec.lib.in | 2 +- plugins/pck-update.in | 14 +++++++------- plugins/spec-create.in | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/libapse.lib.in b/lib/libapse.lib.in index 3098a1f..0a278e9 100644 --- a/lib/libapse.lib.in +++ b/lib/libapse.lib.in @@ -307,7 +307,7 @@ proxy:,proxy-user:,autoupdate-off: \ # FIXME : should `specname' be an optional argument? [ "$specname" ] || { usage; ${EXIT_FUNC:-"exit"} 1; } - local fcurlout=$(mktemp -q -t fcurlout.XXXXXXXX) || + local fcurlout=$(mktemp -q -p /var/tmp -t fcurlout.XXXXXXXX) || notify.error $"can't create temporary files" # SPEC_SOURCE0_PCKNAME --> src0pckname diff --git a/lib/libnetwork.lib.in b/lib/libnetwork.lib.in index 08c163b..5ca3164 100644 --- a/lib/libnetwork.lib.in +++ b/lib/libnetwork.lib.in @@ -221,7 +221,7 @@ getting list of files from"" \`${NOTE}$currurl/${NORM}'..." continue ;; esac - currflist="$(mktemp -q -t flist.XXXXXXXX)" || + currflist="$(mktemp -q -p /var/tmp -t flist.XXXXXXXX)" || notify.error $"can't create temporary files" notify.debug "$FUNCNAME: currflist = $currflist" @@ -365,7 +365,7 @@ function repository.get_RPMS_name() { [ "$archlist" ] || notify.error $"\ (bug)"" -- $FUNCNAME: "$"no list of architectures set"" (\$archlist)" - local flist=`mktemp -q -t flist.XXXXXXXX` || + local flist=`mktemp -q -p /var/tmp -t flist.XXXXXXXX` || notify.error $"can't create temporary files" local curr_arch errors pck_name curr_match @@ -1026,7 +1026,7 @@ function git.create_tarball() { type -p git &>/dev/null || notify.error $"utility not found"": \`git'" - local tmpgitdir=$(mktemp -q -d -t tmpgit.XXXXXXXX) + local tmpgitdir=$(mktemp -q -d -p /var/tmp -t tmpgit.XXXXXXXX) [ $? -eq 0 ] || notify.error $"can't create temporary files" notify.debug "$FUNCNAME: tmpgitdir = $tmpgitdir" diff --git a/lib/libspec.lib.in b/lib/libspec.lib.in index 842ebb2..f294f54 100644 --- a/lib/libspec.lib.in +++ b/lib/libspec.lib.in @@ -632,7 +632,7 @@ $FUNCNAME: specfile_preprocessed = \"$specfile_preprocessed\"" shift done - local tmpspreprerr=$(mktemp -q -t $me.XXXXXXXX) + local tmpspreprerr=$(mktemp -q -p /var/tmp -t $me.XXXXXXXX) [ $? -eq 0 ] || notify.error "$FUNCNAME: "$"can't create temporary files" notify.debug "$FUNCNAME: tmpspreprerr = \`${NOTE}$tmpspreprerr${NORM}'" diff --git a/plugins/pck-update.in b/plugins/pck-update.in index 29c2e88..da287b8 100644 --- a/plugins/pck-update.in +++ b/plugins/pck-update.in @@ -407,11 +407,11 @@ $"illegal value"": \"$ftp_rw_server_num_default\"" # display users and passwords in the debug messages (default: '0') debug_print_private_user_infos=0 -infofile=$(mktemp -q -t infofile.XXXXXXXX) +infofile=$(mktemp -q -p /var/tmp -t infofile.XXXXXXXX) [ $? -eq 0 ] || notify.error $"can't create temporary files" # preprocessed specfile generated by 'rpm --specfile --specedit' -specfile_preprocessed=$(mktemp -q -t specpreproc.XXXXXXXX) +specfile_preprocessed=$(mktemp -q -p /var/tmp -t specpreproc.XXXXXXXX) [ $? -eq 0 ] || notify.error $"can't create temporary files" trap "rm -f $infofile $specfile_preprocessed" 0 1 2 3 6 7 9 13 15 @@ -1341,7 +1341,7 @@ illegal \`format_extra_rules' (see configuration file(s))" local sharedstatedir=`rpm --eval=%{_sharedstatedir}` local sysconfdir=`rpm --eval=%{_sysconfdir}` - local tmpspec=$(mktemp -q -t $me.XXXXXXXX) + local tmpspec=$(mktemp -q -p /var/tmp -t $me.XXXXXXXX) [ $? -eq 0 ] || notify.error $"can't create temporary files" notify.debug "tmpspec = \`${NOTE}$tmpspec${NORM}'" @@ -1478,7 +1478,7 @@ for i in $(seq 1 1 ${#spec_lines[@]}); do echo -n "\n ${spec_lines[$i-1]}" done)" - local tmppreamble=$(mktemp -q -t $me.XXXXXXXX) + local tmppreamble=$(mktemp -q -p /var/tmp -t $me.XXXXXXXX) [ $? -eq 0 ] || notify.error $"can't create temporary files" notify.debug "tmppreamble = \`${NOTE}$tmppreamble${NORM}'" @@ -2193,7 +2193,7 @@ It seems good but do not forget to run quality and security tests"\ " (-a8)${NORM}"" " else - local tmpunpackfiles=$(mktemp -q -t $me.XXXXXXXX) + local tmpunpackfiles=$(mktemp -q -p /var/tmp -t $me.XXXXXXXX) [ $? -eq 0 ] || notify.error $"can't create temporary files" notify.debug "tmpunpackfiles = \`${NOTE}$tmpunpackfiles${NORM}'" @@ -2273,7 +2273,7 @@ build the list of the build requirements""${NORM}" notify.debug "SPEC_TARGET = [ ${SPEC_TARGET[*]} ]" notify.debug "pcks_list = [ ${pcks_list[*]} ]" - local frequires=$(mktemp -q -t frequires.XXXXXXXX) || + local frequires=$(mktemp -q -p /var/tmp -t frequires.XXXXXXXX) || notify.error $"can't create temporary files" # FIXME: "/usr/lib/perl5" should be defined in autospec.conf local perl_prefixes=$(perl -V | grep "^[[:space:]]\+/usr/lib/perl5") @@ -2521,7 +2521,7 @@ pck_newver = \"$pck_newver\", pck_newrel = \"$pck_newrel\"" notify.debug "pck_rpmrelease = $pck_rpmrelease" local tmpextractdir - tmpextractdir=$(mktemp -q -d -t rpm_extract.XXXXXXXX) + tmpextractdir=$(mktemp -q -d -p /var/tmp -t rpm_extract.XXXXXXXX) [[ $? -eq 0 ]] || notify.error $"can't create temporary files" notify.debug "$FUNCNAME: tmpextractdir = $tmpextractdir" diff --git a/plugins/spec-create.in b/plugins/spec-create.in index 33aa451..729ab65 100644 --- a/plugins/spec-create.in +++ b/plugins/spec-create.in @@ -654,7 +654,7 @@ python modules must have this name structure (use \`-n'):"" \ # link fd#3 with stdout and redirect stdout to the log file [ "$outfile" ] && { exec 3<&1; exec 1>>$outfile; } - local tmpdir=`mktemp -q -d -t $me.XXXXXXXX` + local tmpdir=`mktemp -q -d -p /var/tmp -t $me.XXXXXXXX` [ $? -eq 0 ] || notify.error $"can't create temporary directory"