Package: sed
Version: 4.1.5-1
Severity: normal

Sed seems to be unable to handle the program "/foo/i\\", interpreted
as a C string (that is, the two last characters of the program are i
and backslash; there's no newline).

$ echo -e "bar\nfoo" | sed "/foo/i\\"
bar
<data>  sed: couldn't write -1 items to stdout: Success
(where <data> are characters with the high bit set)

$ echo -e "bar\nfoo" | sed "/foo/i\\" | hd | less
<the same; it turns out there's a lot of zeroes too>

$ echo -e "bar\nfoo" | sed "/foo/i\\" > foo
Segmentation fault

Using longer input ("baz\nbar\nfoo") does the same for all test
cases.  However, a feeding sed a single line seems okay:

$ echo -e "foo" | sed "/foo/i\\"
sed: couldn't write -1 items to stdout: Success

I'm guessing that with just a single line, there's something which has
not yet been initialised; that would explain why there's no gibberish.

Putting the script in a file and calling sed with -f seems to do the
same thing as when just giving sed the script as an argument.

Since sed has a test suite, once someone fixes this it would be good
to include a test case for this to guard against regression.

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-3-686
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1) (ignored: LC_ALL set to 
en_GB.ISO-8859-1)

Versions of packages sed depends on:
ii  libc6                        2.3.6.ds1-8 GNU C Library: Shared libraries

sed recommends no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to