Skip to content

Reduce Windows stubs#79

Merged
estesp merged 1 commit into
containerd:mainfrom
thaJeztah:reduce_windows_stubs
Sep 21, 2021
Merged

Reduce Windows stubs#79
estesp merged 1 commit into
containerd:mainfrom
thaJeztah:reduce_windows_stubs

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

Commit 421b4ca (#61) changed the use of
syscall.Signal in favor of unix.Signal, to match other code.

As a result, some code that imported these files on Windows (even if unused)
failed to compile, which lead to d6ba496 (#66),
which created a separate implementation for Windows without PdeathSignal.

Given that golang.org/x/sys/unix.Signal is an alias for syscall.Signal
(see https://github.com/golang/sys/blob/751e447fb3d0a97f584890476adddc1d56307388/unix/aliases.go#L13-L14),
they should be interchangeable.

Note that the io.go files could probably be excluded on Windows as a whole,
but taking a slightly less rigorous approach in this PR.

Commit 421b4ca changed the use of
syscall.Signal in favor of unix.Signal, to match other code.

As a result, some code that imported these files on Windows (even if unused)
failed to compile, which lead to d6ba496,
which created a separate implementation for Windows without PdeathSignal.

Given that golang.org/x/sys/unix.Signal is an alias for syscall.Signal
(see https://github.com/golang/sys/blob/751e447fb3d0a97f584890476adddc1d56307388/unix/aliases.go#L13-L14),
they should be interchangeable.

Note that the io.go files could probably be excluded on Windows as a whole,
but taking a slightly less rigorous approach in this PR.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 15, 2021

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.45%. Comparing base (d1e3ca2) to head (cb9c869).
⚠️ Report is 40 commits behind head on main.

Files with missing lines Patch % Lines
io.go 0.00% 2 Missing ⚠️
io_unix.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #79      +/-   ##
==========================================
- Coverage   21.52%   21.45%   -0.07%     
==========================================
  Files           7        7              
  Lines         683      685       +2     
==========================================
  Hits          147      147              
- Misses        498      500       +2     
  Partials       38       38              

☔ 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.

Comment thread io_unix.go
// NewPipeIO creates pipe pairs to be used with runc
func NewPipeIO(uid, gid int, opts ...IOOpt) (i IO, err error) {
// newPipeIO creates pipe pairs to be used with runc
func newPipeIO(uid, gid int, opts ...IOOpt) (i IO, err error) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Let me know if we should instead make whole of io**.go excluded on Windows (mostly concerned if there's code that might refer the types somewhere)

Comment thread io_windows.go
import "errors"

func newPipeIO(uid, gid int, opts ...IOOpt) (i IO, err error) {
return nil, errors.New("not implemented on Windows")
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

At least, I couldn't find code using this on Windows (looks like the only thing used by hcsshim / runhcs is runc.Monitor)

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

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

LGTM

@estesp estesp merged commit 1c99ade into containerd:main Sep 21, 2021
@thaJeztah thaJeztah deleted the reduce_windows_stubs branch September 21, 2021 18:48
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.

4 participants