all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Reiner Steib <reinersteib+gmane@imap.cc>
Subject: Re: sh-tmp-file inserts unsafe code
Date: Mon, 10 Oct 2005 17:10:41 +0200	[thread overview]
Message-ID: <v9achhh0ge.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: 74205160510100306wfc57ea3v69373e100895193a@mail.gmail.com

On Mon, Oct 10 2005, Emanuele Giaquinta wrote:

>         > "tmp = /tmp/" str ".$pid" \n
>         "fn sigexit { rm $tmp^* >[2]/dev/null }" \n)
>     (sh (file-name-nondirectory (buffer-file-name))
> !       > "TMP=`mktemp ${TMPDIR:-/tmp}/" str ".XXXXXX`" \n
>         "trap \"rm $TMP* 2>/dev/null\" " ?0 \n))

Why not use `-t' instead of dealing explicitly with TMPDIR?

--8<---------------cut here---------------start------------->8---
--- sh-script.el	19 Sep 2005 11:36:31 +0200	1.166
+++ sh-script.el	10 Oct 2005 17:08:56 +0200	
@@ -3392,7 +3392,7 @@
   "Insert code to setup temporary file handling.  See `sh-feature'."
   (bash sh-append ksh88)
   (csh (file-name-nondirectory (buffer-file-name))
-       "set tmp = /tmp/" str ".$$" \n
+       "set tmp = `mktemp -t " str ".XXXXXXXXXX`" \n
        "onintr exit" \n _
        (and (goto-char (point-max))
 	    (not (bolp))
@@ -3415,7 +3415,7 @@
       > "tmp = /tmp/" str ".$pid" \n
       "fn sigexit { rm $tmp^* >[2]/dev/null }" \n)
   (sh (file-name-nondirectory (buffer-file-name))
-      > "TMP=${TMPDIR:-/tmp}/" str ".$$" \n
+      > "TMP=`mktemp -t " str ".XXXXXXXXXX`" \n
       "trap \"rm $TMP* 2>/dev/null\" " ?0 \n))
 
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

  reply	other threads:[~2005-10-10 15:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-09 15:30 sh-tmp-file inserts unsafe code Sven Joachim
2005-10-10  4:14 ` Richard M. Stallman
2005-10-10  8:20   ` Sven Joachim
2005-10-10 10:06     ` Emanuele Giaquinta
2005-10-10 15:10       ` Reiner Steib [this message]
2005-10-10 23:47       ` Richard M. Stallman
2005-10-11 13:53   ` Sven Joachim
     [not found]     ` <74205160510110729i683ad538xa6bdc6b76f131532@mail.gmail.com>
2005-10-11 14:41       ` Sven Joachim
2005-10-11 16:56         ` Reiner Steib
2005-10-12 16:24           ` Richard M. Stallman
2005-10-11 22:43     ` Richard M. Stallman
2005-10-10 17:46 ` Kevin Rodgers
  -- strict thread matches above, loose matches on Subject: below --
2005-10-11 13:55 Sven Joachim
2005-10-12 16:19 Sven Joachim
2005-10-12 19:23 Sven Joachim
2005-10-13 17:26 ` Kevin Rodgers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=v9achhh0ge.fsf@marauder.physik.uni-ulm.de \
    --to=reinersteib+gmane@imap.cc \
    --cc=Reiner.Steib@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.