The command `sh-tmp-file' (bound to `C-c C-t' in shell-script-mode)
inserts code to setup temporary file handling based on the script's
name and its pid at runtime.  E.g., for foo.sh:

TMP=${TMPDIR:-/tmp}/foo.sh.$$
trap "rm $TMP* 2>/dev/null" 0

Or for foo.csh:

set tmp = /tmp/foo.csh.$$
onintr exit

Such handling of temporary files used to be common practice, but it is
_unsafe_, exposing the user of the script to symlink attacks.  This is
especially bad if the script is to be run by the superuser, but even
an ordinary user could suffer data loss.  I think Emacs should not
encourage such dangerous coding practice.

How about rewriting sh-tmp-file so that it uses mktemp(1) to create
the temporary file?




_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to