From: Pedro Alves <palves@redhat.com>
To: Patrick Palka <patrick@parcs.ath.cx>
Cc: "gdb-patches@sourceware.org" <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)
Date: Fri, 15 May 2015 18:33:00 -0000 [thread overview]
Message-ID: <55563C0D.9010903@redhat.com> (raw)
In-Reply-To: <CA+C-WL8V=chtJT3EM02Cd5C5v4KNcvgAfSNPJxUJUK=4j7ooGQ@mail.gmail.com>
On 05/15/2015 06:03 PM, Patrick Palka wrote:
> On Fri, May 15, 2015 at 12:05 PM, Pedro Alves <palves@redhat.com> 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 <palves@redhat.com>
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 <palves@redhat.com>
* 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"
--
1.9.3
next prev parent reply other threads:[~2015-05-15 18:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 13:29 [PATCH] [COMMITTED] Fix PR gdb/17820 Patrick Palka
2015-05-15 16:05 ` Pedro Alves
2015-05-15 17:04 ` Patrick Palka
2015-05-15 18:33 ` Pedro Alves [this message]
2015-05-15 21:43 ` [PATCH v2] Fix gdb.base/gdbinit-history.exp when HISTSIZE is set in the environment (Re: [PATCH] [COMMITTED] Fix PR gdb/17820) Patrick Palka
2015-05-19 9:59 ` Pedro Alves
2015-05-15 17:10 ` [PATCH] [COMMITTED] Fix PR gdb/17820 Patrick Palka
2015-05-15 17:17 ` Pedro Alves
2015-05-15 17:27 ` Patrick Palka
2015-05-15 17:48 ` Pedro Alves
2015-05-15 21:22 ` Patrick Palka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55563C0D.9010903@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=patrick@parcs.ath.cx \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox