SHRALIAS and command history

ron

Aug 19, 2008
147
0
#1
What determines the amount of history "SHRALIAS" will save to a file when SHRALIAS_SAVE_PATH=c:\ProgramData\JPSoft is set?

The reason I ask is, when starting with this...

history.sav 20,783 08/28/2011 18:36 -a--

D:\>shralias
D:\>history /r history.sav
D:\>shralias /u

I end up with this in c:\ProgramData\JPSoft

history.sav 16,778 09/02/2011 09:54 -a--

The original file has 663 commands and the one saved by SHRALIAS has "255".
 

ron

Aug 19, 2008
147
0
#2
Let's add to the goofy behavior...

In TC13, it's not as destructive. 664 reduced to 628. The diff is easier to analyze here too. SHRALIAS removed all but 4 of the first 41 commands. The remainder are intact when compared to the original.

That's 664 and 628 individual command lines, not bytes.
 

ron

Aug 19, 2008
147
0
#7
It could take a while to track down this issue. I created a simple command file with 2000 individual commands and none were lost using the test below.
 

ron

Aug 19, 2008
147
0
#8
Duplicates. That's the answer. When I sort -u the original file, it's reduced to 255.

So, duplicates exist in the buffer but they get removed on save.

Move to end / save last is my setting.

Somehow I thought TCMD was dynamically removing duplicates from the live buffer.
 
Jun 7, 2008
96
3
#9
On Fri, Sep 2, 2011 at 7:12 PM, ron <> wrote:

> Duplicates. *That's the answer. *When I sort -u the original file, it's reduced to 255.
>
> So, duplicates exist in the buffer but they get removed on save.
>
> Move to end / save last is my setting.
>
> Somehow I thought TCMD was dynamically removing duplicates from the live buffer.
Live duplicate removal has been a wish list item for years. It hasn't
happened because it would take too much code and require too much
overhead to do it on the fly. TCC/TCMD would have to scan the entire
history on every command entered to see if it was a dupe. Ugh. Much
easier to do it once on exit
______
Dennis
 
#10
On Fri, 02 Sep 2011 19:12:54 -0400, ron <> wrote:

|Duplicates. That's the answer. When I sort -u the original file, it's reduced to 255.
|
|So, duplicates exist in the buffer but they get removed on save.
|
|Move to end / save last is my setting.
|
|Somehow I thought TCMD was dynamically removing duplicates from the live buffer.

SHRALIAS is pretty straightforward. It just sits on the handles so the
memory-mapped files don't get closed, and dumps them when appropriate; it has no
idea what's in them.

TCC does remove dups (or otherwise honor your preferences) immediately, in the
live buffer as you put it. Just look at the (live) history and you'll see that.
The duplicates were probably removed when the old file (with duplicates) was
read into the active history.
 
#11
On Fri, 02 Sep 2011 20:24:48 -0400, DMcCunney <> wrote:

|Live duplicate removal has been a wish list item for years. It hasn't
|happened because it would take too much code and require too much
|overhead to do it on the fly. TCC/TCMD would have to scan the entire
|history on every command entered to see if it was a dupe. Ugh. Much
|easier to do it once on exit

It *is* done live, as far as I can tell I just looked at my recent history ...
saw "ver" seven or eight commands back ... issued "ver" again and now it's at
the end of the history and not where it was before.