Re: [PATCH v2] Fix gdb.base/gdbinit-history.exp when HISTSIZE is set in the environment (Re: [PATCH] [COMMITTED] Fix PR gdb/17820)

Pedro Alves
2015-05-19T09:59:28Z

On 05/15/2015 10:42 PM, Patrick Palka wrote:
> 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).

:-)

(It's more an issue with DejaGnu sourcing all test files into
the same context, than language.)

>
> Both the original approach (with $have_old_histsize) and this one look
> fine by me.

I've pushed this one in now.

Thanks,
Pedro Alves