[illumos-Developer] sed -i behavior - question

Samuel Younge samuel.younge at 31415.org
Mon Dec 20 18:38:32 PST 2010


Let me try that again. 

I believe cross platform compatibility is important. Since sed often ties into the operation of many shell scripts and shell scripts are common to most third party applications, I think following the GNU syntax would ease porting from Linux targets which are ubiquitous .


On Dec 20, 2010, at 2:56 PM, Garrett D'Amore <garrett at damore.org> wrote:

> 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
> 
> 
> _______________________________________________
> Developer mailing list
> Developer at lists.illumos.org
> http://lists.illumos.org/m/listinfo/developer



More information about the Developer mailing list