Skip to content

Conversation

@panjf2000
Copy link
Owner

No description provided.

Copilot AI review requested due to automatic review settings December 25, 2025 08:31
@github-actions github-actions bot added docs patch Release patch version labels Dec 25, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This is a patch release (v2.9.6) that includes a security improvement for Unix socket handling and documentation updates to the README files.

  • Adds close-on-exec flag to duplicated file descriptors in the client enrollment process
  • Updates README section headings for better clarity
  • Changes English "Comparison with Rust" section to "Combat with Rust"

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
client_unix.go Adds CloseOnExec call to prevent file descriptor leakage to child processes after duplicating socket FDs
README.md Updates section heading from "Milestone" to "Milestones" and changes "Comparison with Rust" to "Combat with Rust"
README_ZH.md Updates Chinese section headings from "当前支持" to "里程碑" and "未来计划" to "蓝图" for consistency with English README

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

var dupFD int
e := rc.Control(func(fd uintptr) {
dupFD, err = unix.Dup(int(fd))
// Set the socket to close-on-exec, so that the socket is closed when the process forks
Copy link

Copilot AI Dec 25, 2025

Choose a reason for hiding this comment

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

The comment is inaccurate. The close-on-exec flag prevents the file descriptor from being inherited by child processes created via exec() system calls, not fork(). After fork(), file descriptors are inherited by default, but close-on-exec ensures they are closed when exec() is called. The comment should be updated to reflect this distinction.

Suggested change
// Set the socket to close-on-exec, so that the socket is closed when the process forks
// Set the socket to close-on-exec so that the duplicated descriptor is not inherited by exec'ed child processes.

Copilot uses AI. Check for mistakes.
Comment on lines 213 to +215
dupFD, err = unix.Dup(int(fd))
// Set the socket to close-on-exec, so that the socket is closed when the process forks
unix.CloseOnExec(dupFD)
Copy link

Copilot AI Dec 25, 2025

Choose a reason for hiding this comment

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

The CloseOnExec call is missing error handling. If unix.Dup() fails (line 213), dupFD will be 0 (the zero value for int), and calling unix.CloseOnExec(0) could incorrectly set the close-on-exec flag on stdin. The error from unix.Dup should be checked before calling CloseOnExec, or CloseOnExec should only be called if dupFD is valid (greater than 0).

Suggested change
dupFD, err = unix.Dup(int(fd))
// Set the socket to close-on-exec, so that the socket is closed when the process forks
unix.CloseOnExec(dupFD)
newFD, dupErr := unix.Dup(int(fd))
if dupErr != nil {
err = dupErr
return
}
dupFD = newFD
// Set the socket to close-on-exec, so that the socket is closed when the process forks
if closeErr := unix.CloseOnExec(dupFD); closeErr != nil {
err = closeErr
}

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Dec 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.31%. Comparing base (a46e1e7) to head (58d255f).
⚠️ Report is 37 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #744   +/-   ##
=======================================
  Coverage   84.30%   84.31%           
=======================================
  Files          22       22           
  Lines        2402     2403    +1     
=======================================
+ Hits         2025     2026    +1     
  Misses        257      257           
  Partials      120      120           
Flag Coverage Δ
unittests 84.31% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@panjf2000 panjf2000 merged commit 5f40e2a into master Dec 25, 2025
92 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs patch Release patch version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants