Subject: Re: [PATCH] Keep special meaning of "-" even for "sed -i"

From: Jim Meyering <[email-masked]>
Date: Mon, 22 Jun 2015 08:03:52 -0700

On Mon, Jun 22, 2015 at 7:40 AM, Stanislav Brabec <[email-masked]> 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 <[email-masked]>
> ---
>  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