Package: sed
Version: 4.2.1-7
Severity: important

I illustrate the bug by two examples.  In each case I have a file called
bookmarks.html with a particular line in it containing the string
'Bookmarks Toolbar'.  I pipeline the result to diff to find out the
exact effect of the given sed one-line script.

I. Command:
sed '/Bookmarks Toolbar/p' <bookmarks.html |diff -au bookmarks.html -

Result:

--- bookmarks.html      2010-09-03 09:39:46.000000000 -0700
+++ -   2010-09-05 08:11:10.926462418 -0700
@@ -10814,6 +10814,8 @@
 <DD>Guides for designing web themes and templates on a wide range of Content 
Management Systems and related software.
     </DL><p>
     <DT><H3 ADD_DATE="1278709936" LAST_MODIFIED="1283531292" 
PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Toolbar</H3>
+    <DT><H3 ADD_DATE="1278709936" LAST_MODIFIED="1283531292" 
PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Toolbar</H3>
+<DD>Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar
 <DD>Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar
     <DL><p>
     </DL><p>

Issue: the p command prints out a pattern consisting of the matched line
as well as the next one.

II. Command:
sed '/Bookmarks Toolbar/d' <bookmarks.html |diff -au bookmarks.html -

Result:

--- bookmarks.html      2010-09-03 09:39:46.000000000 -0700
+++ -   2010-09-05 08:16:39.990467770 -0700
@@ -10813,8 +10813,6 @@
         <DT><A HREF="http://www.themeswiki.org/Main_Page"; 
ADD_DATE="1210889368" LAST_MODIFIED="1210889534" 
LAST_CHARSET="UTF-8">ThemesWiki</A>
 <DD>Guides for designing web themes and templates on a wide range of Content 
Management Systems and related software.
     </DL><p>
-    <DT><H3 ADD_DATE="1278709936" LAST_MODIFIED="1283531292" 
PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Toolbar</H3>
-<DD>Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar
     <DL><p>
     </DL><p>
 </DL><p>

Issue: this classic one-liner sed script for deleting a line containing
a pattern ends up deleting the line with the pattern as well as the
next line.

N.B. if you use the --posix sed option you get the same two bad
results as above.

I have classified this bug as serious because it will affect any sed
script that uses the pattern space.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages sed depends on:
ii  dpkg                      1.15.8.4       Debian package management system
ii  install-info              4.13a.dfsg.1-5 Manage installed documentation in 
ii  libc6                     2.11.2-2       Embedded GNU C Library: Shared lib
ii  libselinux1               2.0.96-1       SELinux runtime shared libraries

sed recommends no packages.

sed suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to