summaryrefslogtreecommitdiff
path: root/Completion
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2014-12-28 00:49:08 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2014-12-28 00:49:08 -0800
commit33b395806470eeac408070fec535bfd5efc20a2c (patch)
tree460b4348ea6401c36bd3488a0bf3fe12f9b4d7c4 /Completion
parent200accac63deae99eb9656b26363c85648bd6748 (diff)
downloadzsh-33b395806470eeac408070fec535bfd5efc20a2c.tar.gz
zsh-33b395806470eeac408070fec535bfd5efc20a2c.zip
34068: create tempfiles without forking, and safe temp directory creation
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/Widget/_complete_debug2
-rw-r--r--Completion/Unix/Command/_cvs13
-rw-r--r--Completion/compinstall4
3 files changed, 11 insertions, 8 deletions
diff --git a/Completion/Base/Widget/_complete_debug b/Completion/Base/Widget/_complete_debug
index 00f600e37..50fc8090a 100644
--- a/Completion/Base/Widget/_complete_debug
+++ b/Completion/Base/Widget/_complete_debug
@@ -9,7 +9,7 @@ local pager w="${(qq)words}"
integer debug_fd=-1
{
if [[ -t 2 ]]; then
- mv -f =(:) $tmp &&
+ mv -f =(<<<'') $tmp &&
exec {debug_fd}>&2 2>| $tmp
fi
diff --git a/Completion/Unix/Command/_cvs b/Completion/Unix/Command/_cvs
index 3c06e0481..31997ec09 100644
--- a/Completion/Unix/Command/_cvs
+++ b/Completion/Unix/Command/_cvs
@@ -704,15 +704,18 @@ _cvs_sub_modules() {
_cvs_run() {
local cvsroot="$1" dir="$2"
shift 2
- local d=/tmp/zsh-cvs-work-$$
- mkdir $d >&/dev/null
- cd $d
- mkdir CVS >&/dev/null
+ local d=${TMPPREFIX:-/tmp/zsh}-cvs-work-$$
+ rm -rf $d
+ mkdir $d &&
+ (
+ chmod 0700 $d &&
+ builtin cd -q $d &&
+ mkdir CVS >&/dev/null || return 1
print -r - "$cvsroot" > CVS/Root
print "$dir" > CVS/Repository
print D > CVS/Entries
CVS_IGNORE_REMOTE_ROOT= cvs "$@"
- cd $OLDPWD
+ )
rm -rf $d
}
diff --git a/Completion/compinstall b/Completion/compinstall
index 7d34ee4d8..ae94993d6 100644
--- a/Completion/compinstall
+++ b/Completion/compinstall
@@ -1958,8 +1958,8 @@ if [[ -z $ifile || -d $ifile ]] ||
fi
local tmpout=${TMPPREFIX:-/tmp/zsh}compinstall$$
-mv -f =(:) $tmpout && # safe tempfile creation
-mv -f =(:) ${tmpout}x || return 1
+mv -f =(<<<'') $tmpout && # safe tempfile creation
+mv -f =(<<<'') ${tmpout}x || return 1
#
# Assemble the complete set of lines to