summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-05-04 09:57:10 +0200
committerJim Meyering <jim@meyering.net>2007-05-04 10:03:01 +0200
commitab402c29f9bbb7b6b55482e848bcb320b9eb70b9 (patch)
tree902d5bb69d593c668b8e30ff4435a51105323374
parentbf8cfacd2468ada25c46a228344ab7af36515f67 (diff)
downloadcoreutils-ab402c29f9bbb7b6b55482e848bcb320b9eb70b9.tar.xz
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.
-rw-r--r--ChangeLog10
-rw-r--r--NEWS3
-rw-r--r--THANKS1
-rw-r--r--src/tr.c3
-rw-r--r--tests/tr/Makefile.am4
-rwxr-xr-xtests/tr/Test.pm4
6 files changed, 20 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index e6a1b4f4d..5efd94b2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-05-04 Jim Meyering <jim@meyering.net>
+
+ 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.
+
2007-05-03 Jim Meyering <jim@meyering.net>
Avoid test failure when run with a permissive umask.
diff --git a/NEWS b/NEWS
index 0542cd987..e254a172b 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 533ea9461..4ffd1a840 100644
--- a/THANKS
+++ b/THANKS
@@ -188,6 +188,7 @@ Greg Troxel gdt@bbn.com
Greg Wooledge gawooledge@sherwin.com
Gregory Leblanc gleblanc@cu-portland.edu
Guido Leenders guido.leenders@invantive.com
+Guntram Blohm Extern.Guntram.Blohm@AUDI.DE
H. J. Lu hjl@valinux.com
Hans Ginzel hans@matfyz.cz
Hans Lermen lermen@fgan.de
diff --git a/src/tr.c b/src/tr.c
index d4453f4da..22287e2dc 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/Makefile.am b/tests/tr/Makefile.am
index 1d9605aa2..c9f4cf8f5 100644
--- a/tests/tr/Makefile.am
+++ b/tests/tr/Makefile.am
@@ -33,7 +33,7 @@ ross-1b.I ross-1b.X ross-2.I ross-2.X ross-3.I ross-3.X ross-4.I ross-4.X \
ross-5.I ross-5.X ross-6.I ross-6.X empty-eq.I empty-eq.X empty-cc.I \
empty-cc.X repeat-bs-9.I repeat-bs-9.X repeat-0.I repeat-0.X repeat-zeros.I \
repeat-zeros.X repeat-compl.I repeat-compl.X repeat-xC.I repeat-xC.X \
-fowler-1.I fowler-1.X
+fowler-1.I fowler-1.X no-abort-1.I no-abort-1.X
run_gen = 1.O 1.E 2.O 2.E 3.O 3.E 4.O 4.E 5.O 5.E 6.O 6.E 7.O 7.E 8.O 8.E 9.O \
9.E a.O a.E b.O b.E c.O c.E d.O d.E e.O e.E f.O f.E g.O g.E h.O h.E i.O i.E \
j.O j.E k.O k.E l.O l.E m.O m.E n.O n.E o.O o.E p.O p.E q.O q.E r.O r.E s.O \
@@ -46,7 +46,7 @@ ross-1b.O ross-1b.E ross-2.O ross-2.E ross-3.O ross-3.E ross-4.O ross-4.E \
ross-5.O ross-5.E ross-6.O ross-6.E empty-eq.O empty-eq.E empty-cc.O \
empty-cc.E repeat-bs-9.O repeat-bs-9.E repeat-0.O repeat-0.E repeat-zeros.O \
repeat-zeros.E repeat-compl.O repeat-compl.E repeat-xC.O repeat-xC.E \
-fowler-1.O fowler-1.E
+fowler-1.O fowler-1.E no-abort-1.O no-abort-1.E
##test-files-end
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
diff --git a/tests/tr/Test.pm b/tests/tr/Test.pm
index 3475740e0..625b47b98 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