zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] Re: Insecure tempfile creation
Date: Thu, 8 Jan 2015 14:10:59 +0000	[thread overview]
Message-ID: <20150108141059.GA1767@tarsus.local2> (raw)
In-Reply-To: <150108000821.ZM7996@torch.brasslantern.com>

Bart Schaefer wrote on Thu, Jan 08, 2015 at 00:08:21 -0800:
> On Jan 7, 10:48pm, Danek Duvall wrote:
> } Subject: Re: [PATCH] Re: Insecure tempfile creation
> }
> } On Wed, Jan 07, 2015 at 10:22:20PM -0800, Bart Schaefer wrote:
> } 
> } > On Wed, Jan 7, 2015 at 2:03 PM, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> } > > Coming back to this, it has occurred to me that
> } > >
> } > >         mv -f =(:) ${TMPPREFIX:-/tmp/zsh}foo$$
> } > >
> } > 
> } > Hmm.  Yup, we need "ln -Fh" instead of "mv -f".  Are the -F and -h
> } > options of "ln" fairly standard?
> } 
> } Neither exists on Solaris ln.  GNU coreutils ln doesn't seem to have -h,
> } either.  And -F just seems like a bad idea, supported or not.
> 
> -F on MacOS (where I was reading the manual) is like -f in coreutils,
> not like -F in coreutils (sigh).  And -h is --no-dereference.  
> 

So, for clarity, the flags you proposed mean "overwrite destination if
existing" and "if destination is symlink, don't dereference it".

> Fortunately, we have the zsh/files module which provides a buitin "ln"
> with well-defined semantics.  Hopefully that's good enough.

Another option: add a builtin that wraps the rename(2) syscall, and
then use:

    zrename =(<<<'') ${TMPPREFIX:-/tmp/zsh}foo$$


  reply	other threads:[~2015-01-08 14:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-22 20:36 Daniel Shahaf
2014-12-22 22:01 ` Mikael Magnusson
2014-12-23  2:07   ` Bart Schaefer
2014-12-28  6:30 ` Bart Schaefer
2014-12-28  7:44   ` [PATCH] " Bart Schaefer
2014-12-28  8:41     ` Bart Schaefer
2014-12-29  0:49       ` Daniel Shahaf
2014-12-29  4:01         ` Bart Schaefer
2015-01-07 22:03           ` Daniel Shahaf
2015-01-08  6:22             ` Bart Schaefer
2015-01-08  6:48               ` Danek Duvall
2015-01-08  8:08                 ` Bart Schaefer
2015-01-08 14:10                   ` Daniel Shahaf [this message]
2015-01-08 14:24                   ` Peter Stephenson
2015-01-08 16:35                     ` Ray Andrews
2015-01-08 17:40                       ` Peter Stephenson
2015-01-09  2:51                     ` Mikael Magnusson
2015-01-09  9:02                       ` Peter Stephenson
2015-01-09 12:51                         ` Peter Stephenson
2015-01-09 13:35                           ` Peter Stephenson

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=20150108141059.GA1767@tarsus.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /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 public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).