GNU bug report logs - #20796
[PATCH] Document behavior of sed -i -

Previous Next

Package: sed;

Reported by: Stanislav Brabec <sbrabec <at> suse.com>

Date: Fri, 12 Jun 2015 15:34:02 UTC

Severity: normal

Tags: patch

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 20796 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Stanislav Brabec <sbrabec <at> suse.com>
Cc: sbrabec <at> suse.cz, 20796 <20796 <at> debbugs.gnu.org>
Subject: Re: [PATCH] Keep special meaning of "-" even for "sed -i"
Date: Mon, 22 Jun 2015 08:03:52 -0700
On Mon, Jun 22, 2015 at 7:40 AM, Stanislav Brabec <sbrabec <at> suse.com> wrote:
> "sed -i -" does not fail, but it also does not do what one would expect.
> It attempts to access file "./-" and edit it in place.
>
> Keep special meaning of "-" even for "sed -i". It will cause failure,
> which is what most people would expect:
>
> sed: couldn't edit /dev/stdin: is a terminal
>
> Note that the previous behavior could have security implications:
> ln -s /etc/passwd -- -
> echo root | sed -i --follow-symlinks s/root/parrot/ -
>
> Signed-off-by: Stanislav Brabec <sbrabec <at> suse.com>
> ---
>  sed/execute.c        |  2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sed/execute.c b/sed/execute.c

Thanks for the patch.
I guess you didn't see that I posted one yesterday?

  http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20796#8




This bug report was last modified 9 years and 334 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.