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

Clarify in which sense the shell provides "independence of the host environment" #75

Open
RalfJung opened this issue Aug 2, 2023 · 2 comments

Comments

@RalfJung
Copy link

RalfJung commented Aug 2, 2023

The docs say

Reliability: no shell injection by construction, good error messages with file paths, non-zero exit status is an error, independence of the host environment, etc.

I first thought this would mean that the shell doesn't forward the entire host environment to the called programs. However, a quick test with cmd!(Shell::new()?, "env").run()? showed that the environment is forwarded. It might be worth clarifying what is meant by "independence" here.

@lnicola
Copy link
Collaborator

lnicola commented Aug 2, 2023

I think it's supposed to mean "host application working directory", not specifically environment variables. Being able to opt in to some of those might be useful, though.

@matklad
Copy link
Owner

matklad commented Aug 2, 2023

That’s confusing! What I meant was rather that, if you use bash, you need to worry whether grep is a gnu grep or bsd grep, but, if you use Rust+xshell, you’ll just do line processing within your process, and it’ll work the same on Linux, windows, and Mac. That’s not an absolute truth, but with bash you by default gain dependency on ambient environment you program runs in, while in Rust (and with xshell in particular) default is cross platform by default.

Probably should have said “same behavior across platforms” there.

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

3 participants