BusyBox sed 'w' loses data on occasion
Alain Mouette
alainm at pobox.com
Mon Jan 3 13:57:50 UTC 2022
Tested here, Ubuntu 20.04:
$ printf 'a\nb\n' | busybox sed -n -e '/a/w xxx' -e '/b/w xxx' ;cat xxx
a
$ uname -a
Linux desktop 5.4.0-39-generic #43-Ubuntu SMP Fri Jun 19 10:28:31 UTC
2020 x86_64 x86_64 x86_64 GNU/Linux
Em 01/01/2022 22:38, Paul Eggert escreveu:
> 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
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
More information about the busybox
mailing list