[illumos-Developer] sed -i behavior - question

Garrett D'Amore garrett at damore.org
Mon Dec 20 18:43:11 PST 2010


On 12/20/10 06:38 PM, Samuel Younge wrote:
> 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 .
>    

My first inclination is to agree... however this particular syntax is 
horribly ugly and violates other long-established syntax rules.  
Therefore, I'd like to have more concrete supporting evidence before I 
undertake the change.  Conversely, if such a change will create problems 
for POSIX compliance or other hardship, then I'd like to know (I don't 
think it will.)

To put it more clearly, I don't want to make any change on this 
unilaterally -- I'd like to give other interested parties a chance to 
contribute meaningfully.  (That means I want people who have a concrete 
vested interest in the outcome of this to speak up.  Vague "we should be 
more like Linux!" and +1's don't do a lot to add to the consideration 
here, unless they are backed with concrete supporting evidence.  (Such 
as "program XYZ depends on this behavior, and changing this will make 
supporting XYZ on illumos possible.")

   - Garrett

>
> 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