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

Make posix shell configurable in distributed #40696

Open
vchuravy opened this issue May 3, 2021 · 5 comments
Open

Make posix shell configurable in distributed #40696

vchuravy opened this issue May 3, 2021 · 5 comments
Labels
domain:parallelism Parallel or distributed computation

Comments

@vchuravy
Copy link
Sponsor Member

vchuravy commented May 3, 2021

Just encountered a system where sh -l doesn't work.

remotecmd = shell_escape_posixly(`sh -l -c $cmds`)

@vchuravy vchuravy added the domain:parallelism Parallel or distributed computation label May 3, 2021
@mgkuhn
Copy link
Contributor

mgkuhn commented May 4, 2021

Option -l (act like a login shell) may be a bashism, at least it is not in the POSIX spec for sh.

@mgkuhn
Copy link
Contributor

mgkuhn commented May 4, 2021

As far as I can see, all -l does is to cause bash/dash/zsh to make it a so-called “login shell”, which in turn just means it will read and execute commands from /etc/profile and ~/.profile.

@mgkuhn
Copy link
Contributor

mgkuhn commented May 4, 2021

@vchuravy What sh on what OS distribution/version was it that complained about -l, just out of curiosity?

@vchuravy
Copy link
Sponsor Member Author

vchuravy commented May 4, 2021

I think Centos 7 or so and the problem was that sh -l was then running bash scripts.

@mgkuhn
Copy link
Contributor

mgkuhn commented May 4, 2021

@vchuravy Did I understand you right that sh -l did actually work (as in: it executed option -l as intended by loading a startup file), but your problem was that there was some bashism in your /etc/profile or ~/.profile that then caused an error from the non-bash shell that sh linked to (e.g., dash)? What does ls -ld /bin/sh show? What was the line that caused an error?

We have arguably a slightly broken promise in that shell=:posix uses two command-line options that are not actually required to be supported by the POSIX standard, namely sh -l and cd --, and we could work around that if that is really a problem in practice. But it sounds like that may not be your actual problem, and fixing your ~/.profile may be the actual solution, e.g. by wrapping bashisms there into a test for bash, such as if [ -n "$BASH"].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:parallelism Parallel or distributed computation
Projects
None yet
Development

No branches or pull requests

2 participants