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

setting env vars does not expand other env vars #117

Open
rkitover opened this issue Aug 21, 2022 · 3 comments
Open

setting env vars does not expand other env vars #117

rkitover opened this issue Aug 21, 2022 · 3 comments

Comments

@rkitover
Copy link

E.g., this does not work:

PATH=$HOME/.local/bin:/usr/bin

, the PATH gets set to the literal value $HOME/.local/bin:/usr/bin.

No idea if this is intended or not, possibly could be an enhancement if you think it would be worthwhile.

I was setting variables like this for years and only just now noticed that this does not work.

@t8m
Copy link
Member

t8m commented Aug 22, 2022

Yes, this is not working and never was.

@rkitover
Copy link
Author

I could do a PR to implement this.

The implementation I was thinking of was opening a pipe to /bin/sh, sending the variable assignment statements in the order they were written then reading them back out. What do you think?

@t8m
Copy link
Member

t8m commented Aug 30, 2022

Ugh, that would be seriously ugly so IMO no, not this way.

There is actually already an expand_envvar() function in cronie_common.c which could be used to expand the envvar when setting it. Currently it is used only for MAILTO and MAILFROM variables when invoking the mail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants