This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2] Fix gdb.base/gdbinit-history.exp when HISTSIZE is set in the environment (Re: [PATCH] [COMMITTED] Fix PR gdb/17820)
- From: Patrick Palka <patrick at parcs dot ath dot cx>
- To: Pedro Alves <palves at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 15 May 2015 17:42:54 -0400
- Subject: Re: [PATCH v2] Fix gdb.base/gdbinit-history.exp when HISTSIZE is set in the environment (Re: [PATCH] [COMMITTED] Fix PR gdb/17820)
- Authentication-results: sourceware.org; auth=none
- References: <1431523782-20409-1-git-send-email-patrick at parcs dot ath dot cx> <55561958 dot 2030105 at redhat dot com> <CA+C-WL8V=chtJT3EM02Cd5C5v4KNcvgAfSNPJxUJUK=4j7ooGQ at mail dot gmail dot com> <55563C0D dot 9010903 at redhat dot com>
On Fri, May 15, 2015 at 2:33 PM, Pedro Alves <palves@redhat.com> wrote:
> 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?
What a neat language (TCL).
Both the original approach (with $have_old_histsize) and this one look
fine by me.