Skip to content

History entries lost with multiple ksh sessions #997

Description

@aweeraman

When several ksh instances start concurrently with the same $HISTFILE (for example, a desktop session restoring many terminals at login), the history file can end up losing entries. The cause appears to be the trimming that happens during history initialization when the file has grown past its size threshold, which has a race on it.

This is a long-standing behavior inherited from the original ksh93, and dates to at least 2013 and likely earlier. It's still present in 1.0.10. In practice it is low severity and only affects shell history, the trigger is fairly specific with simple workarounds to avoid it. I have attached a small reproducer that triggers it reliably.

Version: 1.0.10 / Debian unstable
Reproducer: repro-721986.sh
Debian Bug#721986

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions