octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Desired behavior for bug #38485: using 'run history' twice


From: Daniel J Sebald
Subject: Re: Desired behavior for bug #38485: using 'run history' twice
Date: Sat, 09 Mar 2013 00:44:33 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16

On 03/08/2013 09:48 PM, Daniel J Sebald wrote:
On 03/08/2013 07:16 PM, Sander van Rijn wrote:

Fri 08 Mar 2013 06:00:09 AM CET, *original submission:*
<https://savannah.gnu.org/bugs/?38485#comment0>

Using 'run history' twice in a row leads to a segfault. The first
invocation runs the previous command, whatever it was. The second
invocation executes the previous command which is 'run history' and an
infinite loop is generated. This isn't a common occurrence, but it isn't
great behavior by the interpreter either.

Sample Code:

disp (1); run history run history



What would be the desired behavior in this case? An error about causing
an infinite loop or a recursive implementation which would make second
'run history' in the sample code also execute 'disp (1);' ?

I can't replicate this problem. What is "run history" supposed to do?

Oh, run_history, with an underscore. Yes, I see there is a problem there. I'm inclined to say recursive implementation, but could that run into stack issues thereby requiring some error checking also or leave it open to potentially crash? Have to think this one over.

I point out that the help documentation for "run_history" could be improved as well. Anyway, there may be a bug in the run_history whereby the most recent history entry can't be accessed by number:

octave:24> history -5
 1048 1
 1049 2
 1050 3
 1051 4
 1052 history -5
octave:25> run_history 1052
error: run_history: history specification out of range

The second most recent can be accessed though:

octave:29> history -5
 1054 6
 1055 7
 1056 8
 1057 9
 1058 history -5
octave:30> run_history 1057
ans =  9

Lastly, the non-argument version of "history" doesn't seem of much use. Is the following what it is supposed to do?

octave:34> history
 1063 history
octave:35> history
 1064 history

I would think that a full listing of history would be a more useful thing to display, or at least default the list to, say, 25 entries.

Dan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]