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

Default to bash shell when $SHELL is missing #6766

Closed
afbjorklund opened this issue Feb 23, 2020 · 9 comments · Fixed by #7887
Closed

Default to bash shell when $SHELL is missing #6766

afbjorklund opened this issue Feb 23, 2020 · 9 comments · Fixed by #7887
Assignees
Labels
cause/libmachine-bug Bugs caused by libmachine kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@afbjorklund
Copy link
Collaborator

afbjorklund commented Feb 23, 2020

The current message is somewhat confused:

$ unset SHELL
$ minikube docker-env
The default lines below are for a sh/bash shell, you can specify the shell you're using, with the --shell flag.


💣  Error detecting shell: Error: Unknown shell

😿  minikube is exiting due to an error. If the above message is not useful, open an issue:
👉  https://github.com/kubernetes/minikube/issues/new/choose
@afbjorklund afbjorklund added co/runtime/docker Issues specific to a docker runtime kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence. labels Feb 23, 2020
@afbjorklund
Copy link
Collaborator Author

It's equally confused upstream, always something.

$ unset SHELL
$ docker-machine env
The default lines below are for a sh/bash shell, you can specify the shell you're using, with the --shell flag.

Error: Unknown shell
$

I guess people normally don't unset their SHELL ?

@afbjorklund afbjorklund added the cause/libmachine-bug Bugs caused by libmachine label Feb 23, 2020
@afbjorklund
Copy link
Collaborator Author

First seen in #6643

@afbjorklund
Copy link
Collaborator Author

Probably worth filing a bug in the https://github.com/actions/runner repository ?

Looks like it is written in .NET, and I'm not really sure where the VM / images are.

@afbjorklund afbjorklund removed the co/runtime/docker Issues specific to a docker runtime label Feb 23, 2020
@afbjorklund
Copy link
Collaborator Author

Similar failure with minikube podman-env (not surprising, same code)

@medyagh
Copy link
Member

medyagh commented Feb 23, 2020

I would be happy to review a PR that defaults to BASH_WITH_WARNNING if nothing else is found. (better not not giving anything)

however there should be a Warnning to the user in the Hint text in form a Comment
(because if we do glog.Warrnning it will ruin the eval command)

@medyagh
Copy link
Member

medyagh commented Feb 23, 2020

we could produce something like this for default

# Warning we couldn't detect the shell. providing Bash is default.

export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://127.0.0.1:32778"
export DOCKER_CERT_PATH="/Users/medya/.minikube/certs"
export MINIKUBE_ACTIVE_DOCKERD="minikube"

# To point your shell to minikube's docker-daemon, run:
# eval $(minikube -p minikube docker-env)

@sayboras
Copy link
Contributor

Cool let me give it a try, thanks @afbjorklund @medyagh

@afbjorklund
Copy link
Collaborator Author

@medyagh : note that the initial bug is with libmachine, it prints an uncommented string on stdout...

https://github.com/docker/machine/blob/master/libmachine/shell/shell.go#L17_L26

	if shell == "" {
		fmt.Printf("The default lines below are for a sh/bash shell, you can specify the shell you're using, with the --shell flag.\n\n")
		return "", ErrUnknownShell
	}

So even when ErrUnknownShell is handled in minikube, that first line will still ruin the eval:

bash: unexpected EOF while looking for matching `''
bash: syntax error: unexpected end of file

Which basically means moving the os.Getenv("SHELL") to minikube.

And handle the unset ("") case, before it is even passed to libmachine ?

@medyagh
Copy link
Member

medyagh commented Feb 26, 2020

@medyagh : note that the initial bug is with libmachine, it prints an uncommented string on stdout...

https://github.com/docker/machine/blob/master/libmachine/shell/shell.go#L17_L26

	if shell == "" {
		fmt.Printf("The default lines below are for a sh/bash shell, you can specify the shell you're using, with the --shell flag.\n\n")
		return "", ErrUnknownShell
	}

So even when ErrUnknownShell is handled in minikube, that first line will still ruin the eval:

bash: unexpected EOF while looking for matching `''
bash: syntax error: unexpected end of file

Which basically means moving the os.Getenv("SHELL") to minikube.

And handle the unset ("") case, before it is even passed to libmachine ?

thanks for that finding ! yes I agree the problem is with the libmachine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cause/libmachine-bug Bugs caused by libmachine kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants