Subject: bug#20796: [PATCH] Document behavior of sed -i -

From: Stanislav Brabec <[email-masked]>
Date: Fri, 12 Jun 2015 17:32:50 +0200

"sed -i -" does not fail, but it also does not do what one would expect.
Document it, as it could have security implications:

Example:
The sed command below looks broken, but it is executed and succeeds:

ln -s /etc/passwd -- -
echo root | sed -i --follow-symlinks s/root/parrot/ -

Signed-off-by: Stanislav Brabec <[email-masked]>
---
 doc/sed-in.texi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/doc/sed-in.texi b/doc/sed-in.texi
index 0e10cde..c8f1289 100644
--- a/doc/sed-in.texi
+++ b/doc/sed-in.texi
@@ -180,6 +180,7 @@ sed OPTIONS... [SCRIPT] [INPUTFILE...]
 @end example
 
 If you do not specify @var{INPUTFILE}, or if @var{INPUTFILE} is @file{-},
+and @option{-i} is not used,
 @command{sed} filters the contents of the standard input.  The @var{script}
 is actually the first non-option parameter, which @command{sed} specially
 considers a script and not an input file if (and only if) none of the
-- 
2.4.2

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: [email-masked]
Lihovarská 1060/12                            tel: +49 911 7405384547
190 00 Praha 9                                 fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76