BusyBox sed 'w' loses data on occasion

Paul Eggert eggert at cs.ucla.edu
Sun Jan 2 01:38:52 UTC 2022


This bug in BusyBox 'sed' broke a Gnulib-based build; see 
<https://lists.gnu.org/r/bug-gnulib/2022-01/msg00004.html>.

The problem is that BusyBox 'sed' is confused about the 'w FILE' 
command. When there are multiple 'w FILE' commands (or 's/.../.../w 
FILE' commands) it opens FILE multiple times. This can lose data 
intended for FILE. Here is a simple shell transcript illustrating the 
problem:

$ printf 'a\nb\n' | busybox sed -n -e '/a/w xxx' -e '/b/w xxx'
$ cat xxx
a

The output should be:

a
b


More information about the busybox mailing list