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

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