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

$SHELL not exported in ddev ssh #6018

Open
hanoii opened this issue Mar 26, 2024 · 12 comments
Open

$SHELL not exported in ddev ssh #6018

hanoii opened this issue Mar 26, 2024 · 12 comments

Comments

@hanoii
Copy link
Collaborator

hanoii commented Mar 26, 2024

This is an odd thing but as I saw it twice in different situations I rather raise it up.

Some time ago I submitted platformsh/cli#117

In working with https://github.com/hanoii/ddev-pimp-my-shell I also submitted junegunn/fzf-git.sh#37. I couldn't really understand what was going on until I figured those issues were the same issue, $SHELL was not bash on either situation.

Steps To Reproduce

I tried to reproduce it with scripts, but I couldn't, the best way I found for you to reproduce it is to spin up a bare php project and install the platform-cli inside ddev ssh:

curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash

Then run

platform self:install

You will see the following in the output:

Setting up autocompletion... skipped (unsupported shell)

If you run, however, the following:

SHELL=$SHELL platform self:install

You will see:

Setting up autocompletion... done

So not sure if this is the expected behavior. I think SHELL just needs to be properly exported, but I haven't tracked why this happens.

I ended up export SHELL myself on my addon at https://github.com/hanoii/ddev-pimp-my-shell/blob/514d264b76e3555c87df2390283aaea36b0aac81/homeadditions/.bashrc.d/pimp-my-shell.sh#L4 which fixed both things.

@hanoii hanoii changed the title $SHELL not available on some child process $SHELL not available on some child processes Mar 26, 2024
@hanoii hanoii changed the title $SHELL not available on some child processes $SHELL not available on child processes Mar 26, 2024
@rfay
Copy link
Member

rfay commented Mar 26, 2024

Is this is the right repo?

@hanoii
Copy link
Collaborator Author

hanoii commented Mar 26, 2024

Erm.. I think so, why?

@hanoii
Copy link
Collaborator Author

hanoii commented Mar 26, 2024

I think it's the fact that the image doesn't properly export SHELL as it should, but that's my understanding, I might be wrong.

@rfay
Copy link
Member

rfay commented Mar 26, 2024

It doesn't mention anything about DDEV, all about platform cli?

@rfay
Copy link
Member

rfay commented Mar 26, 2024

I think your answer is in https://unix.stackexchange.com/questions/277944/what-sets-the-shell-environment-variable

SHELL is set on login shells.

@hanoii
Copy link
Collaborator Author

hanoii commented Mar 26, 2024 via email

@hanoii
Copy link
Collaborator Author

hanoii commented Mar 26, 2024 via email

@hanoii
Copy link
Collaborator Author

hanoii commented Mar 26, 2024

SHELL is set on login shells.

but SHELL is set, that's why SHELL=$SHELL platform self:install works (within ddev)

Only it's not carried on to the platform binary, nor to fzf, as it is not exported.

@rfay
Copy link
Member

rfay commented Mar 26, 2024

Maybe you can come up with a recreation scenario so we can talk. I can't understand how this relates to DDEV at this point.

I always appreciate your careful attention to DDEV and reporting problems and frictions!

@hanoii
Copy link
Collaborator Author

hanoii commented Mar 26, 2024 via email

@rfay
Copy link
Member

rfay commented Mar 26, 2024

Please provide a simple recreation scenario that shows step-by-step what to do to demonstrate the issue. Use a simple script perhaps?

@rfay
Copy link
Member

rfay commented Mar 26, 2024

Thanks for taking the time to explain this in Discord.

Although it's not exactly standard for bash -l to set $SHELL I'm OK with a PR to /etc/skel/.bash_profile that exports it.

@rfay rfay changed the title $SHELL not available on child processes $SHELL not exported in ddev ssh Mar 26, 2024
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

No branches or pull requests

2 participants