From patchwork Fri May 15 18:33:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 6750 Received: (qmail 116058 invoked by alias); 15 May 2015 18:33:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 116043 invoked by uid 89); 15 May 2015 18:33:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 15 May 2015 18:33:54 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t4FIXpgq014437 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 May 2015 14:33:52 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4FIXn4c007471; Fri, 15 May 2015 14:33:50 -0400 Message-ID: <55563C0D.9010903@redhat.com> Date: Fri, 15 May 2015 19:33:49 +0100 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Patrick Palka CC: "gdb-patches@sourceware.org" Subject: [PATCH v2] Fix gdb.base/gdbinit-history.exp when HISTSIZE is set in the environment (Re: [PATCH] [COMMITTED] Fix PR gdb/17820) References: <1431523782-20409-1-git-send-email-patrick@parcs.ath.cx> <55561958.2030105@redhat.com> In-Reply-To: On 05/15/2015 06:03 PM, Patrick Palka wrote: > On Fri, May 15, 2015 at 12:05 PM, Pedro Alves wrote: >> + if {$have_old_histsize} { >> + set env(HISTSIZE) $old_histsize >> + } > > Why not change this predicate to > > if [info exists old_histsize] > > to obviate the need for $have_old_histsize altogether? Yeah, "info exists" is ok since this is local scope; I was worrying that the code ends up copied elsewhere to global context, and then the "info exists" would be the wrong thing to use, considering e.g., [1] and [2]. Maybe I'm worrying too much. But how about instead simply saving/restoring the whole env array, like in the updated patch below, which sidesteps that issue? [1] https://sourceware.org/ml/gdb-patches/2015-04/msg00261.html [2] https://sourceware.org/ml/gdb-patches/2015-04/msg00537.html -------- From b5c09f8bdd4f780d176d110ce61f4eb153ecc9ef Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 15 May 2015 19:27:07 +0100 Subject: [PATCH] Fix gdb.base/gdbinit-history.exp when HISTSIZE is set in the environment Some buildslaves are showing that this test is failing. E.g.,: https://sourceware.org/ml/gdb-testers/2015-q2/msg04164.html The issue is that HISTSIZE is set to 1000 in the environment that runs the tests (that's the default in Fedora, set in /etc/profile). We can trivially reproduce it with: $ HISTSIZE=1000 make check RUNTESTFLAGS="gdbinit-history.exp" (...) Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/gdbinit-history.exp ... FAIL: gdb.base/gdbinit-history.exp: show history size FAIL: gdb.base/gdbinit-history.exp: show history size FAIL: gdb.base/gdbinit-history.exp: show commands gdb.log shows: ... (gdb) set height 0 (gdb) set width 0 (gdb) show history size The size of the command history is 1000. (gdb) FAIL: gdb.base/gdbinit-history.exp: show history size gdb/testsuite/ChangeLog: 2015-05-15 Pedro Alves * gdb.base/gdbinit-history.exp (test_gdbinit_history_setting): Save the whole env array instead of just HOME. Unset HISTSIZE in the environment while testing. Restore whole environment afterwards. --- gdb/testsuite/gdb.base/gdbinit-history.exp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp index 474680a..aba15b4 100644 --- a/gdb/testsuite/gdb.base/gdbinit-history.exp +++ b/gdb/testsuite/gdb.base/gdbinit-history.exp @@ -27,8 +27,15 @@ proc test_gdbinit_history_setting { home size } { global srcdir global subdir - set old_home $env(HOME) + array set old_env [array get env] + set env(HOME) "$srcdir/$subdir/$home" + + # The HISTSIZE environment variable takes precedence over whatever + # history size is set in .gdbinit. Make sure the former is not + # set. + unset -nocomplain env(HISTSIZE) + set saved_internal_gdbflags $INTERNAL_GDBFLAGS set INTERNAL_GDBFLAGS [string map {"-nx" ""} $INTERNAL_GDBFLAGS] @@ -44,7 +51,8 @@ proc test_gdbinit_history_setting { home size } { } set INTERNAL_GDBFLAGS $saved_internal_gdbflags - set $env(HOME) $old_home + + array set env [array get old_env] } test_gdbinit_history_setting "gdbinit-history/unlimited" "unlimited"