[Tcsh] How is merge in savehist supposed to work?

Kimmo Suominen kim at netbsd.org
Fri Jul 14 06:32:43 UTC 2023


This is how the manual page documents the merge setting:

    If the second word of savehist is set to ‘merge’, the history
    list is merged with the existing history file instead of replacing
    it (if there is one) and sorted by time stamp.

I'm not sure sethistory() is the correct place to fix this: the merge
option should impact saving the history. It should not impact loading the
history, and it should not discard history entries when the size of the
history is changed.

I have not yet tried the patch, but I will when I have some time.

Kind regards,
+ Kimmo


On Thu, 13 Jul 2023 at 14:29, Dr. Werner Fink <werner at suse.de> wrote:

> On 2023/07/13 10:51:08 +0200, Dr. Werner Fink wrote:
> > Hi
> >
> > after a report of a user I've done a small test case to show the
> > problem:
> >
> >  boole:~ # useradd -m -s /bin/tcsh c1
> >  boole:~ # vi /home/c1/.tcshrc
> >  boole:~ # cat /home/c1/.tcshrc
> >  set histdup=prev
> >  set history=8
> >  set savehist=($history merge lock)
> >  boole:~ # su - c1
> >  boole /home/c1> touch m1
> >  boole /home/c1> touch m2
> >  boole /home/c1> touch m3
> >  boole /home/c1> touch m4
> >  boole /home/c1> touch m5
> >  boole /home/c1> touch m6
> >  boole /home/c1> touch m7
> >  boole /home/c1> touch m8
> >  boole /home/c1> logout
> >  boole:~ # su - c1
> >  boole /home/c1> cat m1
> >  boole /home/c1> cat m2
> >  boole /home/c1> cat m3
> >  boole /home/c1> cat m4
> >  boole /home/c1> cat m5
> >  boole /home/c1> cat m6
> >  boole /home/c1> cat m7
> >  boole /home/c1> cat m8
> >  boole /home/c1> logout
> >  boole:~ # cat /home/c1/.history
> >  boole:~ # cat /home/c1/.history
> >  #+1689237920
> >  touch m1
> >  #+1689237921
> >  touch m2
> >  #+1689237922
> >  touch m3
> >  #+1689237923
> >  touch m4
> >  #+1689237924
> >  touch m5
> >  #+1689237925
> >  touch m6
> >  #+1689237926
> >  touch m7
> >  #+1689237927
> >  touch m8
> >
> > ... looks like `merge` does not work to get the recent history
> >
> > Werner
>
> the attached patch seems to solve the problem
>
> Werner
>
> --
>   "Having a smoking section in a restaurant is like having
>           a peeing section in a swimming pool." -- Edward Burr
> --
> Tcsh mailing list
> Tcsh at astron.com
> https://mailman.astron.com/mailman/listinfo/tcsh
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.astron.com/pipermail/tcsh/attachments/20230714/627f7bc9/attachment.htm>


More information about the Tcsh mailing list