Skip to content

Lookup tty to be used just once #1683

Open

Description

@3v1n0

At the moment we're going through ttyname_from_dev in multuple places through current_tty_name, while this should be computed just once and used everywhere, avoiding issues such as the one fixed by #1682.

So I'd suggest to compute just once and keep it in the context to be used in the various places we need.

In fact right now we may end up computing the same value up to 5 times for a single execution:

  • init_pam: for PAM_TTY
  • log_command_execution: for the TTY= log entry
  • RecordScope::for_tty: for the session record scope
  • ttyname_from_dev: calls Process::tty_device_id() again on its own, so every current_tty_name() call reads /proc/self/stat again and may scan /dev/pts and /dev

Activity

  1. added 5 commits that reference this issue on Sep 24, 2026
    76fa1d3
    2dc0ace
    2ed0e12
    57c7096
    0756d83
  2. added
    enhancementNew feature or request
    choreImprovements that don't alter behaviour.
    on Sep 29, 2026
  3. added a commit that references this issue on Oct 12, 2026
    2374cc1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreImprovements that don't alter behaviour.enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions