Re: Rationalizing sed -i/-I (in-place editing) argument handling
On 3/8/2021 12:13 PM, Ed Maste wrote: > 5. Retire the special case for -I "". Just to be clear, we are not suggesting removing compat for -i '' right? -- Regards, Bryan Drewery ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: Rationalizing sed -i/-I (in-place editing) argument handling
On Mon, 8 Mar 2021 at 16:41, Ed Maste wrote: > > On Mon, 8 Mar 2021 at 15:55, Ian Lepore wrote: > > > > I also hate the idea of requiring no space between -I and its related > > value. That seems like a huge POLA violation compared to how virtually > > every other command's options and arguments work. > > On the other hand, -i.ext with no space is compatible with FreeBSD > today and is portable to OpenBSD, NetBSD, macOS, and GNU. -i .ext > works only with FreeBSD and macOS. I'd like to go ahead with a man page update shortly. Even if we do not modify sed, it is valuable to document and describe the compatibility issues with our -i/-I, including the odd way we specify no backup file. On the topic of POLA our -i/-I support was based on perl's in-place editing, except perl uses the optional argument style (-i / -i.bak). I'd also argue that our -i "" is a POLA violation compared to how most other commands work, and has caused significant confusion for folks interested in cross-OS compatibility. If anyone has suggestions or improvements to the proposed man page text I'd appreciate a follow-up here or a comment in the review, https://reviews.freebsd.org/D29128. ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: Rationalizing sed -i/-I (in-place editing) argument handling
On Mon, 8 Mar 2021 at 17:00, John-Mark Gurney wrote: > > How is the program suppose to tell when the extension is "-e", or -e > is a different option and not the argument to -I? -i-e is an in-place edit with extension "-e" -i -e is an in-place edit with no extension ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: Rationalizing sed -i/-I (in-place editing) argument handling
Ed Maste wrote this message on Mon, Mar 08, 2021 at 15:13 -0500: > A relatively minor but longstanding incompatibility between FreeBSD > and many other systems is the way sed handles backup files for > in-place editing -- sed's -I and -i options. GNU sed and other BSDs > accept an optional argument: -I.bak will save a backup file with a > .bak extension, and -I with no argument will not create a backup file. > FreeBSD currently accepts either -I.bak or -I .bak to save a backup > with the given extension, and -I "" (an empty argument) to specify no > backup. > > I've been tripped up by this in the past and I know many others have. > Most recently tobik@ filed PR 254091 for this. Now, I think a single > change to make -i/-I to be compatible with other sed implementations > in one step is too much of a POLA violation, but I think it can > reasonably be done in stages: > > 1. Update the man page to indicate that -i/-I should not have a space > between the flag and the extension. This is compatible with current > FreeBSD sed, other BSDs sed, GNU sed, and my proposed changes below. > No backup is still a special case and remains as -I "". > > I've opened https://reviews.freebsd.org/D29128 with proposed man page changes. > > 2. Continue accepting -I .bak, but emit a warning suggesting the use > of -I.bak instead. > > 3. Change -I/-i to getopt optional arguments, but keep a special case > for -I/-i "". At this point -I .bak becomes invalid as with other > seds, and specifying no backup can be done with either -I "" or -I > with no argument. This relies on an empty argument having no other > sensible interpretation. I will say that IMO, I really dislike a command line argument having an optional argument. It can cause parsing confusion and possibly security issues... Copying this behavior, IMO, is not good... So my vote is against this misfeature.. How is the program suppose to tell when the extension is "-e", or -e is a different option and not the argument to -I? -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: Rationalizing sed -i/-I (in-place editing) argument handling
On Mon, 8 Mar 2021 at 15:55, Ian Lepore wrote: > > I also hate the idea of requiring no space between -I and its related > value. That seems like a huge POLA violation compared to how virtually > every other command's options and arguments work. On the other hand, -i.ext with no space is compatible with FreeBSD today and is portable to OpenBSD, NetBSD, macOS, and GNU. -i .ext works only with FreeBSD and macOS. ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: Rationalizing sed -i/-I (in-place editing) argument handling
Ian Lepore wrote in <8e9983a4243d158789029ec8b16837b35ca4451a.ca...@freebsd.org>: |On Mon, 2021-03-08 at 15:13 -0500, Ed Maste wrote: |> A relatively minor but longstanding incompatibility between FreeBSD |> and many other systems is the way sed handles backup files for |> in-place editing -- sed's -I and -i options. GNU sed and other BSDs |> accept an optional argument: -I.bak will save a backup file with a |> .bak extension, and -I with no argument will not create a backup |> file. |> FreeBSD currently accepts either -I.bak or -I .bak to save a backup |> with the given extension, and -I "" (an empty argument) to specify no |> backup. |> |> I've been tripped up by this in the past and I know many others have. |> Most recently tobik@ filed PR 254091 for this. Now, I think a single ... |> change to make -i/-I to be compatible with other sed implementations |> in one step is too much of a POLA violation, but I think it can |> reasonably be done in stages: |> |> 1. Update the man page to indicate that -i/-I should not have a space |> between the flag and the extension. This is compatible with current |> FreeBSD sed, other BSDs sed, GNU sed, and my proposed changes below. |> No backup is still a special case and remains as -I "". ... |As someone who has to take care of common software that runs on |everything from freebsd 8 through -current, I HATE the very idea of |this. If we keep whittling away at the backwards compatibility freebsd |is so famous for, I'll have abosolutely zero arguments left for why |$work shouldn't just switch to the much more popular and better- |supported linux. | |I also hate the idea of requiring no space between -I and its related |value. That seems like a huge POLA violation compared to how virtually |every other command's options and arguments work. I hate it too. But just wanted to note that sccs used this (and still does, even standardized) decades ago already (and i always did it wrong). --steffen | |Der Kragenbaer,The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt) ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: Rationalizing sed -i/-I (in-place editing) argument handling
On Mon, 2021-03-08 at 15:13 -0500, Ed Maste wrote: > A relatively minor but longstanding incompatibility between FreeBSD > and many other systems is the way sed handles backup files for > in-place editing -- sed's -I and -i options. GNU sed and other BSDs > accept an optional argument: -I.bak will save a backup file with a > .bak extension, and -I with no argument will not create a backup > file. > FreeBSD currently accepts either -I.bak or -I .bak to save a backup > with the given extension, and -I "" (an empty argument) to specify no > backup. > > I've been tripped up by this in the past and I know many others have. > Most recently tobik@ filed PR 254091 for this. Now, I think a single > change to make -i/-I to be compatible with other sed implementations > in one step is too much of a POLA violation, but I think it can > reasonably be done in stages: > > 1. Update the man page to indicate that -i/-I should not have a space > between the flag and the extension. This is compatible with current > FreeBSD sed, other BSDs sed, GNU sed, and my proposed changes below. > No backup is still a special case and remains as -I "". > > I've opened https://reviews.freebsd.org/D29128 with proposed man page > changes. > > 2. Continue accepting -I .bak, but emit a warning suggesting the use > of -I.bak instead. > > 3. Change -I/-i to getopt optional arguments, but keep a special case > for -I/-i "". At this point -I .bak becomes invalid as with other > seds, and specifying no backup can be done with either -I "" or -I > with no argument. This relies on an empty argument having no other > sensible interpretation. > > 4. Continue accepting -I "" to specify no backup, but emit a warning > suggesting the use of -I with no argument. > > 5. Retire the special case for -I "". > > These steps could be done over an extended period of time (such as > one > major release to another) - this is most important between steps 2 > and > 3. > > Please let me know what you think, and if there's something I've > missed. > As someone who has to take care of common software that runs on everything from freebsd 8 through -current, I HATE the very idea of this. If we keep whittling away at the backwards compatibility freebsd is so famous for, I'll have abosolutely zero arguments left for why $work shouldn't just switch to the much more popular and better- supported linux. I also hate the idea of requiring no space between -I and its related value. That seems like a huge POLA violation compared to how virtually every other command's options and arguments work. -- Ian ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: Rationalizing sed -i/-I (in-place editing) argument handling
On 2021-03-08 12:13, Ed Maste wrote: A relatively minor but longstanding incompatibility between FreeBSD and many other systems is the way sed handles backup files for in-place editing -- sed's -I and -i options. GNU sed and other BSDs accept an optional argument: -I.bak will save a backup file with a .bak extension, and -I with no argument will not create a backup file. FreeBSD currently accepts either -I.bak or -I .bak to save a backup with the given extension, and -I "" (an empty argument) to specify no backup. I've been tripped up by this in the past and I know many others have. Most recently tobik@ filed PR 254091 for this. Now, I think a single change to make -i/-I to be compatible with other sed implementations in one step is too much of a POLA violation, but I think it can reasonably be done in stages: 1. Update the man page to indicate that -i/-I should not have a space between the flag and the extension. This is compatible with current FreeBSD sed, other BSDs sed, GNU sed, and my proposed changes below. No backup is still a special case and remains as -I "". I've opened https://reviews.freebsd.org/D29128 with proposed man page changes. 2. Continue accepting -I .bak, but emit a warning suggesting the use of -I.bak instead. 3. Change -I/-i to getopt optional arguments, but keep a special case for -I/-i "". At this point -I .bak becomes invalid as with other seds, and specifying no backup can be done with either -I "" or -I with no argument. This relies on an empty argument having no other sensible interpretation. 4. Continue accepting -I "" to specify no backup, but emit a warning suggesting the use of -I with no argument. 5. Retire the special case for -I "". These steps could be done over an extended period of time (such as one major release to another) - this is most important between steps 2 and 3. Please let me know what you think, and if there's something I've missed. +1 This seems more than a reasonable course of action. :-) Thanks! ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Rationalizing sed -i/-I (in-place editing) argument handling
A relatively minor but longstanding incompatibility between FreeBSD and many other systems is the way sed handles backup files for in-place editing -- sed's -I and -i options. GNU sed and other BSDs accept an optional argument: -I.bak will save a backup file with a .bak extension, and -I with no argument will not create a backup file. FreeBSD currently accepts either -I.bak or -I .bak to save a backup with the given extension, and -I "" (an empty argument) to specify no backup. I've been tripped up by this in the past and I know many others have. Most recently tobik@ filed PR 254091 for this. Now, I think a single change to make -i/-I to be compatible with other sed implementations in one step is too much of a POLA violation, but I think it can reasonably be done in stages: 1. Update the man page to indicate that -i/-I should not have a space between the flag and the extension. This is compatible with current FreeBSD sed, other BSDs sed, GNU sed, and my proposed changes below. No backup is still a special case and remains as -I "". I've opened https://reviews.freebsd.org/D29128 with proposed man page changes. 2. Continue accepting -I .bak, but emit a warning suggesting the use of -I.bak instead. 3. Change -I/-i to getopt optional arguments, but keep a special case for -I/-i "". At this point -I .bak becomes invalid as with other seds, and specifying no backup can be done with either -I "" or -I with no argument. This relies on an empty argument having no other sensible interpretation. 4. Continue accepting -I "" to specify no backup, but emit a warning suggesting the use of -I with no argument. 5. Retire the special case for -I "". These steps could be done over an extended period of time (such as one major release to another) - this is most important between steps 2 and 3. Please let me know what you think, and if there's something I've missed. ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"