Repository navigation
stdbuf: return stderr from the cygwin stderr getter - #15480
Ecordonnier wants to merge 2 commits into
Conversation
__stdbuf_get_stderr read _stdin from the reent struct on cygwin, so stdbuf -e changed the buffering of stdin instead of stderr. Introduced in 54ba74b ("Add more Cygwin support", uutils#9686).
There was a problem hiding this comment.
🟡 Changes recommended
The bug fix lacks the regression test required by repository guidelines.
1 open issue
What changed in this PR
Fixes Cygwin’s stderr getter so stdbuf -e changes stderr buffering rather than stdin buffering.
Changes:
- Returns
_stderrinstead of_stdinfrom the Cygwin reentrancy structure.
| File | Description |
|---|---|
| src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs | Corrects the Cygwin stderr stream pointer. |
Review effort: Balanced
| } | ||
|
|
||
| unsafe { (*__getreent())._stdin } | ||
| unsafe { (*__getreent())._stderr } |
Whoops, it looks like I forgot to replace this one when copy pasting... apologies :( |
Check that the stdin, stdout and stderr getters give file descriptors 0, 1 and 2. This would have caught the cygwin stderr getter returning stdin. Enable the unit tests of libstdbuf for this.
No problem. I just thought you may want to cherry-pick this if you have a use-case where you're using stdbuf on cygwin. |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
2 open issues
Review effort: Lite
| @@ -14,7 +14,6 @@ rust-version.workspace = true | |||
| name = "stdbuf" | |||
| path = "src/libstdbuf.rs" | |||
| crate-type = ["cdylib"] | |||


__stdbuf_get_stderr read _stdin from the reent struct on cygwin, so stdbuf -e changed the buffering of stdin instead of stderr.
Introduced in 54ba74b ("Add more Cygwin support", #9686).