Subject: Re: bug#63813: sed bug

From: Davide Brini <[email-masked]>
Date: Wed, 31 May 2023 22:01:04 +0200

On Wed, 31 May 2023 14:58:12 +0800, yu cuilu <[email-masked]> wrote:

>  missing version:
> sed (GNU sed) 4.2.2
>
> case 1: fail
>
> rm -f  ./resolv.conf;
> touch ./resolv.conf;  sed -i 'a nameserver 8.8.8.8' ./resolv.conf ; cat
> resolv.conf
>
> case 2: ok
>
> rm -f  ./resolv.conf;
> echo a > ./resolv.conf;  sed -i 'a nameserver 8.8.8.8' ./resolv.conf ; cat
> resolv.conf

This is all behaving as expected. The description for the "a" command says:

Appending text after a line

In the first example, there are no lines at all in the input, so sed has no
chance to append text after reading a line.

In the second example, the input consists of one line, after which sed can
append the specified text.

--
D.