Blame SOURCES/gdb-6.5-readline-long-line-crash-test.patch

2c2fa1
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
2c2fa1
2c2fa1
2c2fa1
Index: ./gdb/testsuite/gdb.base/readline-overflow.exp
2c2fa1
===================================================================
2c2fa1
RCS file: ./gdb/testsuite/gdb.base/readline-overflow.exp
2c2fa1
diff -N ./gdb/testsuite/gdb.base/readline-overflow.exp
2c2fa1
--- /dev/null	1 Jan 1970 00:00:00 -0000
2c2fa1
+++ ./gdb/testsuite/gdb.base/readline-overflow.exp	13 Nov 2006 23:42:50 -0000
2c2fa1
@@ -0,0 +1,125 @@
2c2fa1
+# Copyright 2006 Free Software Foundation, Inc.
2c2fa1
+
2c2fa1
+# This program is free software; you can redistribute it and/or modify
2c2fa1
+# it under the terms of the GNU General Public License as published by
2c2fa1
+# the Free Software Foundation; either version 2 of the License, or
2c2fa1
+# (at your option) any later version.
2c2fa1
+# 
2c2fa1
+# This program is distributed in the hope that it will be useful,
2c2fa1
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2c2fa1
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2c2fa1
+# GNU General Public License for more details.
2c2fa1
+# 
2c2fa1
+# You should have received a copy of the GNU General Public License
2c2fa1
+# along with this program; if not, write to the Free Software
2c2fa1
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
2c2fa1
+
2c2fa1
+# Please email any bugs, comments, and/or additions to this file to:
2c2fa1
+# bug-gdb@prep.ai.mit.edu
2c2fa1
+
2c2fa1
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>
2c2fa1
+
2c2fa1
+# This file is part of the gdb testsuite.
2c2fa1
+
2c2fa1
+#
2c2fa1
+# Tests for readline buffer overflow.
2c2fa1
+#
2c2fa1
+
2c2fa1
+if $tracelevel {
2c2fa1
+  strace $tracelevel
2c2fa1
+}
2c2fa1
+
2c2fa1
+# Don't let a .inputrc file or an existing setting of INPUTRC mess up
2c2fa1
+# the test results.  Even if /dev/null doesn't exist on the particular
2c2fa1
+# platform, the readline library will use the default setting just by
2c2fa1
+# failing to open the file.  OTOH, opening /dev/null successfully will
2c2fa1
+# also result in the default settings being used since nothing will be
2c2fa1
+# read from this file.
2c2fa1
+global env
2c2fa1
+if [info exists env(INPUTRC)] {
2c2fa1
+    set old_inputrc $env(INPUTRC)
2c2fa1
+}
2c2fa1
+set env(INPUTRC) "/dev/null"
2c2fa1
+
2c2fa1
+set oldtimeout1 $timeout
2c2fa1
+set timeout 600
2c2fa1
+
2c2fa1
+if [info exists env(GDBHISTFILE)] {
2c2fa1
+    set old_gdbhistfile $env(GDBHISTFILE)
2c2fa1
+}
2c2fa1
+if [info exists env(HISTSIZE)] {
2c2fa1
+    set old_histsize $env(HISTSIZE)
2c2fa1
+}
2c2fa1
+set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history"
2c2fa1
+set env(HISTSIZE) "10"
2c2fa1
+
2c2fa1
+gdb_exit
2c2fa1
+gdb_start
2c2fa1
+gdb_reinitialize_dir $srcdir/$subdir
2c2fa1
+
2c2fa1
+
2c2fa1
+set width 11
2c2fa1
+gdb_test "set width $width" \
2c2fa1
+         "" \
2c2fa1
+         "Setting width to $width."
2c2fa1
+#gdb_test "set height 1" \
2c2fa1
+#         "" \
2c2fa1
+#         "Setting height to 1."
2c2fa1
+send_gdb "run X"
2c2fa1
+set i 0
2c2fa1
+# It crashes using `set width 7' on `set total 3560'.
2c2fa1
+# Sometimes it corrupts screen on `set width 7'.
2c2fa1
+# Bugreport used `set total 130001':
2c2fa1
+# 	https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
2c2fa1
+# Check also `timeout' above.
2c2fa1
+set total 4200
2c2fa1
+gdb_expect {
2c2fa1
+	-re X {
2c2fa1
+		incr i
2c2fa1
+		if {$i <= $total} {
2c2fa1
+			send_gdb "X"
2c2fa1
+			exp_continue
2c2fa1
+		}
2c2fa1
+	}
2c2fa1
+	-re "\[ \b\r\n\]" {
2c2fa1
+		exp_continue
2c2fa1
+	}
2c2fa1
+	eof {
2c2fa1
+		fail "gdb sending total $total characters"
2c2fa1
+		note "Failed after sending $i characters, reason: EOF"
2c2fa1
+		gdb_clear_suppressed
2c2fa1
+	}
2c2fa1
+	timeout {
2c2fa1
+		fail "gdb sending total $total characters"
2c2fa1
+		note "Failed after sending $i characters (timeout $timeout), reason: TIMEOUT"
2c2fa1
+		gdb_clear_suppressed
2c2fa1
+	}
2c2fa1
+	default {
2c2fa1
+		fail "gdb sending total $total characters"
2c2fa1
+		note "Failed after sending $i characters, reason: 0=\[$expect_out(0,string)\] buffer=\[$expect_out(buffer)\]"
2c2fa1
+		gdb_clear_suppressed
2c2fa1
+	}
2c2fa1
+}
2c2fa1
+gdb_test "\r" \
2c2fa1
+         "No executable file specified..*" \
2c2fa1
+         "All the characters transferred"
2c2fa1
+
2c2fa1
+
2c2fa1
+# Restore globals modified in this test...
2c2fa1
+if [info exists old_inputrc] {
2c2fa1
+    set env(INPUTRC) $old_inputrc
2c2fa1
+} else {
2c2fa1
+    unset env(INPUTRC)
2c2fa1
+}
2c2fa1
+if [info exists old_gdbhistfile] {
2c2fa1
+    set env(GDBHISTFILE) $old_gdbhistfile
2c2fa1
+} else {
2c2fa1
+    unset env(GDBHISTFILE)
2c2fa1
+}
2c2fa1
+if [info exists old_histsize] {
2c2fa1
+    set env(HISTSIZE) $old_histsize
2c2fa1
+} else {
2c2fa1
+    unset env(HISTSIZE)
2c2fa1
+}
2c2fa1
+set timeout $oldtimeout1
2c2fa1
+
2c2fa1
+return 0