Skip to content

fix(terminal): stop proot "can't sanitize binding" fd warnings - #2878

Merged
RohitKushvaha01 merged 2 commits into
Acode-Foundation:mainfrom
RohitKushvaha01:fix/proot-fd-binding-warnings
Sep 11, 2026
Merged

fix(terminal): stop proot "can't sanitize binding" fd warnings#2878
RohitKushvaha01 merged 2 commits into
Acode-Foundation:mainfrom
RohitKushvaha01:fix/proot-fd-binding-warnings

Conversation

@RohitKushvaha01

Copy link
Copy Markdown
Member

proot canonicalizes every -b host path with realpath(3). The /proc/self/fd/N magic links only resolve when the descriptor points to a real file, so piped stdio (what Acode's ProcessBuilder uses) made realpath(3) fail and proot drop the binding with can't sanitize binding "/proc/self/fd/N".

The [ -e ] guard passed those links because stat(2) follows the magic link to the underlying pipe/socket inode, so it never filtered them out. Replace it with a can_bind helper that resolves the link target the way realpath(3) does, and narrow the LSP-side proot-warning filters to only this benign message so real proot warnings are no longer swallowed.

proot canonicalizes every -b host path with realpath(3). The /proc/self/fd/N magic links only resolve when the descriptor points to a real file, so piped stdio (what Acode's ProcessBuilder uses) made realpath(3) fail and proot drop the binding with `can't sanitize binding "/proc/self/fd/N"`.

The [ -e ] guard passed those links because stat(2) follows the magic link to the underlying pipe/socket inode, so it never filtered them out. Replace it with a can_bind helper that resolves the link target the way realpath(3) does, and narrow the LSP-side proot-warning filters to only this benign message so real proot warnings are no longer swallowed.
@greptile-apps

greptile-apps Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the follow-up descriptor probing change preserves the process identity and descriptors that proot receives.

Summary

  • Adds a shell helper that admits only descriptor links resolving to existing absolute paths.
  • Uses the sourcing shell’s PID so descriptor inspection is unaffected by readlink’s child-process redirection.
  • Restricts both LSP warning filters to the known benign /proc/self/fd binding warning.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Inspect shell descriptor via /proc/SELF_PID/fd/N] --> B{Descriptor target}
  B -->|Existing absolute path| C[Add proot binding]
  B -->|Pipe, socket, anonymous inode, or missing path| D[Skip binding]
  C --> E[Exec proot with inherited PID and descriptors]
  D --> E
  E --> F[LSP receives process output]
  F --> G{Known fd-binding warning?}
  G -->|Yes| H[Suppress benign warning]
  G -->|No| I[Surface output normally]
Loading

Reviews (2) · Last reviewed commit: "fix(terminal): probe /proc/self/fd via s..."

@RohitKushvaha01 RohitKushvaha01 moved this from Backlog to Done in The Code Board - Acode Sep 11, 2026
readlink(1) runs as a child process, so for fd 2 its /proc/self/fd/2 is the /dev/null of the `2>/dev/null` redirect rather than the stderr proot inherits.  That made can_bind treat a piped stderr as bindable, leaving one `can't sanitize binding "/proc/self/fd/2"` warning.  Probe /proc/$$/fd/N instead; $$ survives the exec and names the process proot runs as.
@RohitKushvaha01

Copy link
Copy Markdown
Member Author

@greptile

@RohitKushvaha01
RohitKushvaha01 added this pull request to the merge queue Sep 11, 2026
Merged via the queue into Acode-Foundation:main with commit 2e154b3 Sep 11, 2026
8 checks passed
@RohitKushvaha01
RohitKushvaha01 deleted the fix/proot-fd-binding-warnings branch September 11, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants