uutils / uutils/coreutils

stdbuf cannot use libstdbuf on the same directory if /proc is masked

Open
#11,134 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - stdbuf
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

$ run0 mv /usr/lib/uutils-coreutils/libstdbuf.so -t /tmp
$ cp /usr/bin/stdbuf -t /tmp
$ unshare -rm bash -c "mount -t tmpfs tmpfs /proc && /tmp/stdbuf -oL true"
stdbuf: External libstdbuf not found at configured path: /usr/lib/uutils-coreutils/libstdbuf.so

$ unshare -rm bash -c "mount -t tmpfs tmpfs /proc && /tmp/gnu-stdbuf -oL true"
# success

I believe it is because std::env::current_exe() requires /proc/self/exe:
https://github.com/uutils/coreutils/blob/e939eda7bdea0391161eb99687e8a8a7054671bd/src/uu/stdbuf/src/stdbuf.rs#L189

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.

Research direction

Start in src/uu/stdbuf/src/stdbuf.rs around line 189 and inspect how current_exe() is used to locate libstdbuf.so. Reproduce the failure with the unshare commands in the issue, then verify that stdbuf can locate and use the library when /proc is masked, while retaining its normal behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.