Bug 252663 - tcsh history file is not merged
Summary: tcsh history file is not merged
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.2-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: Dmitry Chagin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-14 08:10 UTC by Osamu Matsuda
Modified: 2021-03-24 08:33 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Osamu Matsuda 2021-01-14 08:10:26 UTC
The tcsh has been updated to 6.21.00 in FreeBSD 12.2-Release.

Unfortunately, the new tcsh 6.21.00 has a problem on merging histories.
When several tcsh instances are running with the "merge" option for "savehist" shell variable, each tcsh instance doesn't merge the history list to existing ~/.history on exit: it just overwrites ~/.history with its own history list.

How to reproduce:

1) open two tcsh's (let them as tcsh A and tcsh B) with .cshrc including
      set savehist = (1000 merge)
2) execute
      echo abc
   on tcsh A and then exit
3) execute
      echo def
   on tcsh B and then exit
4) open another tcsh and do "history".
   It only includes "echo def" not "echo abc".
   Of course we expect both "echo abc" and "echo def" were included.

The situation is the same for 13-Current.

To fix this, I found a patch for 6.22.00 at 
https://mailman.astron.com/pipermail/tcsh/2020-February/000072.html

I confirmed that the mentioned patch fixes the problem also for 6.21.00, but I'm not sure whether the patch has any side effect or not.
Comment 1 Osamu Matsuda 2021-01-21 01:01:43 UTC
According to https://github.com/tcsh-org/tcsh/blob/master/Fixes,
the latest tcsh 6.22.03 includes "Fixed reversed test that broke history merging"

The source for 6.22.03 taken from https://github.com/tcsh-org/tcsh
can be built on FreeBSD 12.2-release without any change. The history list is properly handled with this.
Comment 2 Walter von Entferndt 2021-03-12 16:01:10 UTC
Could this fix be merged into *-stable, and be included to be shiped for *-release with the next security updates?  This bug is really annoying, because it occasionally blocks a terminal (either vt(4) or any type of xterm(1)-like).

Thank you.
Comment 3 Walter von Entferndt 2021-03-12 16:39:08 UTC
Could you give me a hint how to incorporate the upstream tcsh src into my FreeBSD src tree? I have 'git pull https://github.com/tcsh-org/tcsh' in my user's $home, $SRCTOP/contrib, overlaying (unionfs) the plain vanilla /usr/src; i.e. only contrib/tcsh is changed, everything else is 12.2-REL sources.  When I try to build with make -C bin/csh, I get multiple errors:
ld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in /tmp/gethost-dd1c17.o
>>> referenced by gethost.c:242 (/home/paul/Projects/FreeBSD/src/12.2-REL/contrib/tcsh/gethost.c:242)
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-03-14 16:58:12 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=5224c2a3bc95b431f729f3692f264395248d8acc

commit 5224c2a3bc95b431f729f3692f264395248d8acc
Merge: 9db44a8e5da9 1b174d6cdff5
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2021-03-14 16:33:13 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2021-03-14 16:33:13 +0000

    Merge tcsh 6.22.03-ceccc7f

    PR:             252663
    MFC after:      1 week

 contrib/tcsh/FAQ                  |  339 ++--
 contrib/tcsh/Fixes                |   23 +
 contrib/tcsh/Imakefile            |   14 +-
 contrib/tcsh/Makefile.ADMIN (new) |   24 +
 contrib/tcsh/Makefile.in          |   11 +-
 contrib/tcsh/Makefile.std         |    2 +-
 contrib/tcsh/Makefile.vms         |    2 +-
 contrib/tcsh/README.md            |    9 +-
 contrib/tcsh/configure            | 3803 ++++++++++++++++++++++---------------
 contrib/tcsh/dot.login (new)      |   12 +
 contrib/tcsh/dot.tcshrc (new)     |  110 ++
 contrib/tcsh/ed.chared.c          |   18 +-
 contrib/tcsh/ed.inputl.c          |    2 +-
 contrib/tcsh/ed.screen.c          |    2 +-
 contrib/tcsh/ed.xmap.c            |    2 +-
 contrib/tcsh/host.defs            |    2 +-
 contrib/tcsh/patchlevel.h         |    6 +-
 contrib/tcsh/sh.c                 |   17 +-
 contrib/tcsh/sh.dir.c             |   41 +-
 contrib/tcsh/sh.dol.c             |  132 +-
 contrib/tcsh/sh.exp.c             |    2 +-
 contrib/tcsh/sh.func.c            |    5 +-
 contrib/tcsh/sh.glob.c            |   11 +-
 contrib/tcsh/sh.h                 |    6 +-
 contrib/tcsh/sh.hist.c            |   10 +-
 contrib/tcsh/sh.lex.c             |   47 +-
 contrib/tcsh/sh.misc.c            |   21 +-
 contrib/tcsh/sh.set.c             |   14 +-
 contrib/tcsh/tc.alloc.c           |   10 +
 contrib/tcsh/tc.disc.c            |    4 +
 contrib/tcsh/tc.os.c              |    2 +-
 contrib/tcsh/tc.prompt.c          |    2 +-
 contrib/tcsh/tcsh.man             |   21 +-
 contrib/tcsh/tcsh.man.new         |   64 +-
 contrib/tcsh/tw.parse.c           |    4 +-
 35 files changed, 2855 insertions(+), 1939 deletions(-)
Comment 5 Osamu Matsuda 2021-03-16 07:15:53 UTC
Thank you very much.
I confirmed the commit builds tcsh 6.22.03 successfully in 13-stable.
The history list is merged correctly as expected.
Comment 6 commit-hook freebsd_committer freebsd_triage 2021-03-21 06:08:21 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=2c31ae65cd9271eaf24da4fbd8f508af75e62a13

commit 2c31ae65cd9271eaf24da4fbd8f508af75e62a13
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2021-03-14 16:33:13 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2021-03-21 06:07:18 +0000

    Merge tcsh 6.22.03-ceccc7f

    PR:             252663

    (cherry picked from commit 5224c2a3bc95b431f729f3692f264395248d8acc)

 contrib/tcsh/FAQ                  |  339 ++--
 contrib/tcsh/Fixes                |   23 +
 contrib/tcsh/Imakefile            |   14 +-
 contrib/tcsh/Makefile.ADMIN (new) |   24 +
 contrib/tcsh/Makefile.in          |   11 +-
 contrib/tcsh/Makefile.std         |    2 +-
 contrib/tcsh/Makefile.vms         |    2 +-
 contrib/tcsh/README.md            |    9 +-
 contrib/tcsh/configure            | 3803 ++++++++++++++++++++++---------------
 contrib/tcsh/dot.login (new)      |   12 +
 contrib/tcsh/dot.tcshrc (new)     |  110 ++
 contrib/tcsh/ed.chared.c          |   18 +-
 contrib/tcsh/ed.inputl.c          |    2 +-
 contrib/tcsh/ed.screen.c          |    2 +-
 contrib/tcsh/ed.xmap.c            |    2 +-
 contrib/tcsh/host.defs            |    2 +-
 contrib/tcsh/patchlevel.h         |    6 +-
 contrib/tcsh/sh.c                 |   17 +-
 contrib/tcsh/sh.dir.c             |   41 +-
 contrib/tcsh/sh.dol.c             |  132 +-
 contrib/tcsh/sh.exp.c             |    2 +-
 contrib/tcsh/sh.func.c            |    5 +-
 contrib/tcsh/sh.glob.c            |   11 +-
 contrib/tcsh/sh.h                 |    6 +-
 contrib/tcsh/sh.hist.c            |   10 +-
 contrib/tcsh/sh.lex.c             |   47 +-
 contrib/tcsh/sh.misc.c            |   21 +-
 contrib/tcsh/sh.set.c             |   14 +-
 contrib/tcsh/tc.alloc.c           |   10 +
 contrib/tcsh/tc.disc.c            |    4 +
 contrib/tcsh/tc.os.c              |    2 +-
 contrib/tcsh/tc.prompt.c          |    2 +-
 contrib/tcsh/tcsh.man             |   21 +-
 contrib/tcsh/tcsh.man.new         |   64 +-
 contrib/tcsh/tw.parse.c           |    4 +-
 35 files changed, 2855 insertions(+), 1939 deletions(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-03-21 06:09:23 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=ea1f0ecc15bc5a314cf5beccc7384a21d04ca40f

commit ea1f0ecc15bc5a314cf5beccc7384a21d04ca40f
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2021-03-14 16:33:13 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2021-03-21 06:08:54 +0000

    Merge tcsh 6.22.03-ceccc7f

    PR:             252663

    (cherry picked from commit 5224c2a3bc95b431f729f3692f264395248d8acc)

 contrib/tcsh/FAQ                  |  339 ++--
 contrib/tcsh/Fixes                |   23 +
 contrib/tcsh/Imakefile            |   14 +-
 contrib/tcsh/Makefile.ADMIN (new) |   24 +
 contrib/tcsh/Makefile.in          |   11 +-
 contrib/tcsh/Makefile.std         |    2 +-
 contrib/tcsh/Makefile.vms         |    2 +-
 contrib/tcsh/README.md            |    9 +-
 contrib/tcsh/configure            | 3803 ++++++++++++++++++++++---------------
 contrib/tcsh/dot.login (new)      |   12 +
 contrib/tcsh/dot.tcshrc (new)     |  110 ++
 contrib/tcsh/ed.chared.c          |   18 +-
 contrib/tcsh/ed.inputl.c          |    2 +-
 contrib/tcsh/ed.screen.c          |    2 +-
 contrib/tcsh/ed.xmap.c            |    2 +-
 contrib/tcsh/host.defs            |    2 +-
 contrib/tcsh/patchlevel.h         |    6 +-
 contrib/tcsh/sh.c                 |   17 +-
 contrib/tcsh/sh.dir.c             |   41 +-
 contrib/tcsh/sh.dol.c             |  132 +-
 contrib/tcsh/sh.exp.c             |    2 +-
 contrib/tcsh/sh.func.c            |    5 +-
 contrib/tcsh/sh.glob.c            |   11 +-
 contrib/tcsh/sh.h                 |    6 +-
 contrib/tcsh/sh.hist.c            |   10 +-
 contrib/tcsh/sh.lex.c             |   47 +-
 contrib/tcsh/sh.misc.c            |   21 +-
 contrib/tcsh/sh.set.c             |   14 +-
 contrib/tcsh/tc.alloc.c           |   10 +
 contrib/tcsh/tc.disc.c            |    4 +
 contrib/tcsh/tc.os.c              |    2 +-
 contrib/tcsh/tc.prompt.c          |    2 +-
 contrib/tcsh/tcsh.man             |   21 +-
 contrib/tcsh/tcsh.man.new         |   64 +-
 contrib/tcsh/tw.parse.c           |    4 +-
 35 files changed, 2855 insertions(+), 1939 deletions(-)
Comment 8 rashey 2021-03-24 08:06:26 UTC
Is there any chance to MFC the patch to releng/13.0 before RELEASE build begin?
Comment 9 Dmitry Chagin freebsd_committer freebsd_triage 2021-03-24 08:33:23 UTC
(In reply to rashey from comment #8)

I didn't plan it, but I'll try