[illumos-Developer] sed -i behavior - question

Garrett D'Amore garrett at damore.org
Mon Dec 20 16:56:12 PST 2010


If you don't use sed, or care about it, delete this message.

The question centers around "-i" in our implementation of sed.  While we 
have a "-i" flag, it *assumes* a suffix (extension) will follow it.  The 
next argument is taken as such unconditionally.  (E.g. it uses i: in 
getopt string.)

Now GNU sed has the SUFFIX as optional.  It looks at the next string and 
tries to make a decision based on whether the next option starts with a 
"-" or not.   This feels far "tar-ish", unfortunately, and violates the 
CLIP (and I think, the POSIX rules too.)

So, this leads us to a question.  We have two choices:

a) treat -i as we do now, and require an extension/suffix be supplied.

b) attempt to intuit based on whether it starts with "-i" or not, 
whether a SUFFIX is supplied.  This makes us behave more like GNU sed, 
but at the cost of additional complexity, and would make it impossible 
to supply a SUFFIX beginning with "-".

My mind would normally be to use "a", but if it will make a large number 
of Linux devotees happy, then I'm willing to hold my nose and do "b".

I'd like to hear your thoughts on this if you care, ideally backed up 
with supporting evidence as to why we should go one way or the other.

     - Garrett




More information about the Developer mailing list