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

Add integration test for minikube ssh: stdin input #8359

Open
joshmue opened this issue Jun 2, 2020 · 13 comments
Open

Add integration test for minikube ssh: stdin input #8359

joshmue opened this issue Jun 2, 2020 · 13 comments
Labels
co/sshd ssh related issues kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@joshmue
Copy link
Contributor

joshmue commented Jun 2, 2020

Steps to reproduce the issue:

  1. Download Minikube v1.11.0 as minikube_v1.11.0 (and v1.10.1 as minikube_v1.10.1 for reference).
  2. Do ./minikube_v1.11.0 start (VirtualBox installed).
  3. Then do:
prompt$ echo 'some test data' | ./minikube_v1.11.0 ssh -- cat -
some test data
some test data

The data is handled (twice?), but the process does not terminate.

For reference, the same command using minikube_v1.10.1 is working as expected:

prompt$ echo 'some test data' | ./minikube_v1.10.1 ssh -- cat -
some test data
prompt$

I assume this is a regression? Please ask if you need any more information.

@afbjorklund
Copy link
Collaborator

Seems to be related to 7224064, @sharifelgamal please take a look

 echo "hello world" | minikube ssh -- cat -
hello world
hello world
^C

When you revert that commit, it goes back to normal:

 echo "hello world" | ./out/minikube ssh -- cat -
hello world

However, the value of the --native-ssh doesn't seem to have any effect.

@afbjorklund afbjorklund added the kind/bug Categorizes issue or PR as related to a bug. label Jun 2, 2020
@afbjorklund
Copy link
Collaborator

The difference that was made, was the order between the calls:

ssh.SetDefaultClient

host.CreateSSHClient

That would be from github.com/docker/machine/libmachine/ssh

@afbjorklund
Copy link
Collaborator

However, the value of the --native-ssh doesn't seem to have any effect.

Basically the old code always used external, the new code always native.

--native-ssh=false
libmachine: Using SSH client type: external
--native-ssh=true
libmachine: Using SSH client type: external

--native-ssh=true
libmachine: Using SSH client type: native
--native-ssh=false
libmachine: Using SSH client type: native

And the native implementation seems to be broken (doesn't work).

@afbjorklund
Copy link
Collaborator

afbjorklund commented Jun 2, 2020

Possibly related to this bug: docker/machine#4806

hello world^M
hello world^M

Yup, looks familiar:

 echo hello world | docker-machine ssh default cat -
hello world
 echo hello world | docker-machine --native-ssh ssh default cat -
hello world
hello world
^C

@sharifelgamal sharifelgamal added the co/sshd ssh related issues label Jun 2, 2020
@sharifelgamal
Copy link
Collaborator

So you're exactly right, there are 2 separate issues here:

  • We're not honoring the native-ssh parameter so it's native no matter what
  • The native ssh implementation end lines with windows style carriage returns for reasons I don't quite understand.

The first one is easy enough to fix, it was just a regression I introduced. The second one should be able to be fixed, at least on our fork of libmachine.

@sharifelgamal sharifelgamal added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Jun 2, 2020
@afbjorklund
Copy link
Collaborator

Looks like some kind of bottomless hole, regarding MakeRaw and \r\n in terminals.

Like https://golang.org/cl/33902 and friends, and termios stuff like OPOST and ONLCR

@priyawadhwa priyawadhwa added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Aug 13, 2020
@joshmue
Copy link
Contributor Author

joshmue commented Sep 1, 2020

So you're exactly right, there are 2 separate issues here:

* We're not honoring the `native-ssh` parameter so it's native no matter what

* The native ssh implementation end lines with windows style carriage returns for reasons I don't quite understand.

The first one is easy enough to fix, it was just a regression I introduced. The second one should be able to be fixed, at least on our fork of libmachine.

Maybe it would be possible to fix the regression separate from the more complicated issues with native SSH?

Just asking because of the change of priority from "important-soon" to "important-longterm", while the effort required to fix just the regression appears to be quite small, as far as I understand. If I may be of any assistance (Open a separate issue; Open a PR attempting to fix the regression or similar), please say so.

@priyawadhwa
Copy link

priyawadhwa commented Sep 23, 2020

Hey @joshmue if you would be interested in opening a PR that would be great!

Info about contributing: https://minikube.sigs.k8s.io/docs/contrib/

@joshmue
Copy link
Contributor Author

joshmue commented Sep 25, 2020

Alright, I will take a look into it!

@medyagh
Copy link
Member

medyagh commented Oct 7, 2020

this is still a bug,

I tried myself

medya@~/workspace/minikube (master) $ echo 'some test data' | minikube ssh --native-ssh=false -- cat -
some test data
some test data

^C
medya@~/workspace/minikube (master) $ echo 'some test data' | minikube ssh --native-ssh=true -- cat -
some test data
some test data

I am not sure what is the source of the bug, but if someone finds out why this is happening, we should add integration test so we never break this again !

( I suspect this is something about native ssh flag not being set correctly, once we tried to fix this and windows was broken)

@medyagh medyagh changed the title minikube ssh: Unexpected handling of stdin input Add integration test for minikube ssh: stdin input Oct 7, 2020
@joshmue
Copy link
Contributor Author

joshmue commented Oct 8, 2020

#9417 should fix the underlying bug. It does not contain an integration test, though.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 6, 2021
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Feb 5, 2021
@tstromberg tstromberg added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. labels Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/sshd ssh related issues kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

8 participants