Terminal(teletype?) detection implementation is wrong

Open
#179 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust

Research direction

Start by tracing terminal detection used by pgrep and pidof, focusing on the /proc/{pid}/fd scan described in the issue. Reproduce the tty1 example in normal user mode and compare it with privileged mode. Done means terminal detection returns the expected process for pgrep and pidof without relying on inaccessible file descriptors.

Written by the indexing model from the issue text.

Description

bug

The current implementation relies on scanning /proc/{pid}/fd, which works well in privileged mode because all fd's are accessible.

But the result is incorrect when used in normal user mode. For example:

❯ pgrep -t tty1
2384
❯ cargo run -q pgrep -t tty1
(*empty here)

And affects the following commands

  • pgrep
  • pidof
  • pkill (in future)
Dominant language
Rust
Stars
116
Forks
38
Avg merge
1d 3h
Merged PRs (30d)
14

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from uutils/procps

All issues in uutils/procps

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.