Skip to content

stdbuf: return stderr from the cygwin stderr getter - #15480

Open
Ecordonnier wants to merge 2 commits into
uutils:mainfrom
Ecordonnier:eco/stdbuf-cygwin-stderr-getter
Open

Ecordonnier wants to merge 2 commits into
uutils:mainfrom
Ecordonnier:eco/stdbuf-cygwin-stderr-getter

Conversation

@Ecordonnier

Copy link
Copy Markdown
Collaborator

__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).

__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).
Copilot AI balanced review requested due to automatic review settings October 18, 2026 15:22
@Ecordonnier

Copy link
Copy Markdown
Collaborator Author

@500-internal-server-error FYI

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 _stderr instead of _stdin from 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 }
@500-internal-server-error

Copy link
Copy Markdown
Contributor

__stdbuf_get_stderr read _stdin from the reent struct on cygwin, so stdbuf -e changed the buffering of stdin instead of 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.
Copilot AI balanced review requested due to automatic review settings October 18, 2026 15:54
@Ecordonnier

Copy link
Copy Markdown
Collaborator Author

__stdbuf_get_stderr read _stdin from the reent struct on cygwin, so stdbuf -e changed the buffering of stdin instead of stderr.

Whoops, it looks like I forgot to replace this one when copy pasting... apologies :(

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"]

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants