Skip to content

Self-test diagnostic output leaks to terminal stdout/stderr #40

@Bahtya

Description

@Bahtya

Bug: Self-test output leaks to terminal

When libvproc.so is loaded and vproc_ffi_create_session() / vproc_ffi_create_process() are called, diagnostic messages are printed directly to file descriptors 1 and 2 (stdout/stderr), which in a terminal emulator context means they appear in the user's terminal as garbage output.

Observed output in terminal

vproc: self-test skipped (probe=ok)

This appears after the first command execution (e.g. after ls), not during library load.

Environment

  • Device: vivo (MTK, Android 14)
  • Architecture: arm64-v8a
  • vproc version: v4.0.0
  • Host app: Hermux (Termux fork)

Expected behavior

vproc should write diagnostic output to __android_log_print() (logcat) instead of stdout/stderr, or provide a configuration option to suppress self-test output.

Current workaround

We redirect fd 1/2 to /dev/null during dlopen() and create_session()/create_process(), then restore them afterwards. This is fragile and may miss output from background threads.


Related: cannot set terminal process group with vproc

Since vproc runs commands as coroutines in the same process (no fork), there is no setsid() call. When bash starts, it calls tcsetpgrp() which fails:

bash: cannot set terminal process group (1120): Bad file descriptor
bash: no job control in this shell

This means job control (Ctrl+Z, fg/bg) does not work in vproc sessions. Would it be possible for vproc to internally handle session/process group management so that bash's tcsetpgrp() succeeds?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions