Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: can't allow exec attach ttyMode container from a non-tty client #2351

Merged
merged 1 commit into from
Oct 25, 2018

Conversation

ZYecho
Copy link
Contributor

@ZYecho ZYecho commented Oct 24, 2018

Signed-off-by: zhangyue [email protected]

Ⅰ. Describe what this PR did

fix the same issue with pr #2338

Ⅱ. Does this pull request fix one issue?

fix the same issue with pr #2338

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

add TestExecWithTty testcase.

Ⅳ. Describe how to verify it

None.

Ⅴ. Special notes for reviews

None.

@codecov
Copy link

codecov bot commented Oct 24, 2018

Codecov Report

Merging #2351 into master will increase coverage by 4.4%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #2351     +/-   ##
=========================================
+ Coverage   63.62%   68.03%   +4.4%     
=========================================
  Files         265      265             
  Lines       18213    18213             
=========================================
+ Hits        11588    12391    +803     
+ Misses       5342     4401    -941     
- Partials     1283     1421    +138
Flag Coverage Δ
#criv1alpha1test 31.55% <ø> (?)
#criv1alpha2test 35.39% <ø> (-0.09%) ⬇️
#integrationtest 39.5% <ø> (-0.03%) ⬇️
#nodee2etest 33.07% <ø> (+0.13%) ⬆️
#unittest 25.3% <ø> (ø) ⬆️
Impacted Files Coverage Δ
ctrd/image.go 76.75% <0%> (-2.2%) ⬇️
ctrd/container.go 59.28% <0%> (-0.48%) ⬇️
daemon/mgr/container.go 59% <0%> (+0.21%) ⬆️
cri/v1alpha2/cri.go 68.56% <0%> (+0.84%) ⬆️
daemon/logger/jsonfile/utils.go 73.17% <0%> (+1.62%) ⬆️
cri/v1alpha2/cri_wrapper.go 62.4% <0%> (+2.39%) ⬆️
ctrd/watch.go 81.81% <0%> (+3.03%) ⬆️
cri/criservice.go 55.95% <0%> (+21.42%) ⬆️
cri/v1alpha1/cri_utils.go 83.22% <0%> (+24.16%) ⬆️
cri/v1alpha1/cri_stream.go 65.71% <0%> (+37.14%) ⬆️
... and 5 more

@pouchrobot pouchrobot added kind/bug This is bug report for project size/S labels Oct 24, 2018
// TestExecWithTty tests running container with -tty flag and attach stdin in a non-tty client.
func (suite *PouchExecSuite) TestExecWithTty(c *check.C) {
name := "TestExecWithTty"
res := command.PouchRun("run", "-d", "--name", name, busyboxImage, "sleep", "100000")
Copy link
Contributor

Choose a reason for hiding this comment

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

it's just nit. could we use one line to check command.PouchRun("run", "-d", "--name", name, busyboxImage, "sleep", "100000").Assert(c, icmd.Success) ? thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@ZYecho ZYecho force-pushed the fix-exec-tty branch 3 times, most recently from fdd3d2d to 4783fff Compare October 25, 2018 05:38
cli/exec.go Outdated
@@ -77,6 +77,10 @@ func (e *ExecCommand) runExec(args []string) error {
Env: e.Envs,
}

if err := checkTty(createExecConfig.AttachStdin, createExecConfig.Tty, os.Stdout.Fd()); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be os.Stdin.Fd() here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated.

Copy link
Contributor

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

@fuweid fuweid merged commit 693cca7 into AliyunContainerService:master Oct 25, 2018
@ZYecho ZYecho deleted the fix-exec-tty branch November 6, 2018 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is bug report for project size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants