[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug in tr: assertion failed
From: |
Jim Meyering |
Subject: |
Re: bug in tr: assertion failed |
Date: |
Fri, 04 May 2007 11:02:04 +0200 |
Jim Meyering <address@hidden> wrote:
> "Blohm, Guntram (I/FP-831, extern)" <address@hidden> wrote:
>> gandalf$ tr -c '\012[a-z][A-Z][0-9].' '[_*256]'
>> tr: tr.c:1819: main: Assertion `get_next (s2, ((void *)0)) == -1 ||
>> truncate_set1' failed.
>> Aborted
>
> Thank you for reporting that!
> The fix appears to be simply to remove that assertion, since
> there's nothing wrong with having string2 longer than string1.
> This will be fixed upstream today, and will eventually appear
> in coreutils-6.10.
Here's most of the change I've checked in:
I'm excluding diffs for the generated file, tests/tr/Makefile.am.
(which reminds me that it's now ok to remove such Makefile.am files
from version control)
2007-05-04 Jim Meyering <address@hidden>
tr -c: don't abort when translating with S2 larger than complement of S1
* src/tr.c (main): Remove invalid assertion triggered by e.g.,
tr -c a '[b*256]'. There's nothing wrong with having Set2 larger
than Set1. Reported by Guntram Blohm.
* tests/tr/Test.pm (no-abort-1): Test for the above.
* NEWS: Mention this bug fix.
* THANKS: Add Guntram Blohm.
diff --git a/NEWS b/NEWS
index 0542cd9..e254a17 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,9 @@ GNU coreutils NEWS -*-
outline -*-
split --line-bytes=N (-C N) no longer creates an empty file
[this bug is present at least as far back as textutils-1.22 (Jan, 1997)]
+ tr -c no longer aborts when translating with Set2 larger than the
+ complement of Set1.
+
* Noteworthy changes in release 6.9 (2007-03-22) [stable]
diff --git a/THANKS b/THANKS
index 533ea94..4ffd1a8 100644
--- a/THANKS
+++ b/THANKS
@@ -188,6 +188,7 @@ Greg Troxel address@hidden
Greg Wooledge address@hidden
Gregory Leblanc address@hidden
Guido Leenders address@hidden
+Guntram Blohm address@hidden
H. J. Lu address@hidden
Hans Ginzel address@hidden
Hans Lermen address@hidden
diff --git a/src/tr.c b/src/tr.c
index d4453f4..22287e2 100644
--- a/src/tr.c
+++ b/src/tr.c
@@ -1,5 +1,5 @@
/* tr -- a filter to translate characters
- Copyright (C) 91, 1995-2006 Free Software Foundation, Inc.
+ Copyright (C) 91, 1995-2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1816,7 +1816,6 @@ main (int argc, char **argv)
xlate[i] = ch;
}
}
- assert (get_next (s2, NULL) == -1 || truncate_set1);
}
else
{
diff --git a/tests/tr/Test.pm b/tests/tr/Test.pm
index 3475740..625b47b 100755
--- a/tests/tr/Test.pm
+++ b/tests/tr/Test.pm
@@ -1,6 +1,6 @@
# Test "tr".
-# Copyright (C) 1996, 1997, 2000, 2002, 2004, 2005, 2006 Free Software
+# Copyright (C) 1996, 1997, 2000, 2002, 2004-2007 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -135,6 +135,8 @@ my @tv = (
# From Glenn Fowler.
['fowler-1', q|ah -H|, 'aha', '-H-', 0],
+# Prior to coreutils-6.10, this would provoke a failed assertion.
+['no-abort-1', '-c ' . q|a '[b*256]'|, 'abc', 'abb', 0],
);
sub test_vector