Subject: bug#30829: (no subject)

From: "Don Crissti" <[email-masked]>
Date: Fri, 16 Mar 2018 00:09:05 +0100

Thanks for the prompt reply !
While I understand your explanation I think we are talking about slightly different things. Your example is different than mine. Let me re-write my code so as to be portable:
 
printf %s\\n 1 2 3 4 5 | sed -e '2,/5/{//!d' -e'}'

Now, as you can see, the main difference between my sample above and your sample

printf "%s\n" 1 2 3 4 5 | sed -n -e '2,/5/p' -e '//p'

is the braces (the command grouping). In other words, you are unconditionally using an empty regex while I'm only using it for lines that meet certain criteria. Based on your explanation (i.e. applied regex=executed regex, no executed regex=no previous regex on line 1 hence fail) I can understand why your code exits with error.

However, my code uses empty regex on condition (only for a certain range of lines). It is logical that '//!d' should not be executed for lines outside that range. If I used a plain 'd' instead of '//!d' would sed unconditionally delete all lines from the file ? No. It would delete only the lines in that range. Similarly, sed should not even attempt to evaluate the empty regex in '{//!d' for lines outside that range.

Unless I'm missing something I still see this as a bug.