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

Expand MAILTO and MAILFROM environment variables #61

Merged
merged 5 commits into from
Jul 23, 2020

Conversation

fcappi
Copy link
Contributor

@fcappi fcappi commented Jun 19, 2020

  • Uses wordexp to expand variables;
  • Allocated space for MAILTO/MAILFROM set to 255 based on RFC3696;
  • If for any reason the expand process fail, the variable remains as is;

The request was only for MAILFROM but I think it makes sense for MAILTO as well. Let me know if you do not agree with this, so I can remove this part.

Closes #26

Signed-off-by: Fernando Cappi [email protected]

Copy link
Member

@t8m t8m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not too fond of using wordexp to perform the substitution. If there was a way how to limit the expansion to environment variable expansion then I'd be OK, however that is not the case. There is also wildcard expansion, etc. Also I am not sure if wordexp is available on all platforms that cronie is used on.

anacron/runjob.c Outdated Show resolved Hide resolved
anacron/runjob.c Outdated Show resolved Hide resolved
anacron/runjob.c Outdated Show resolved Hide resolved
@fcappi
Copy link
Contributor Author

fcappi commented Jul 17, 2020

Agreed that wordexp is doing more than what we need and we may have some unexpected behaviors using it. So I created a function to find env vars in a string and another one to expand them, so we don't have the dependency on wordexp anymore.

Could you please take a look?

Thank you for the review!

@fcappi fcappi requested a review from t8m July 17, 2020 21:08
anacron/runjob.c Outdated Show resolved Hide resolved
src/env.c Outdated Show resolved Hide resolved
anacron/runjob.c Outdated Show resolved Hide resolved
anacron/runjob.c Outdated Show resolved Hide resolved
anacron/runjob.c Outdated Show resolved Hide resolved
anacron/runjob.c Outdated Show resolved Hide resolved
anacron/runjob.c Outdated Show resolved Hide resolved
anacron/runjob.c Outdated Show resolved Hide resolved
anacron/runjob.c Outdated Show resolved Hide resolved
anacron/runjob.c Outdated Show resolved Hide resolved
Copy link
Member

@t8m t8m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few more small changes needed.

cronie_common.c Outdated Show resolved Hide resolved
anacron/runjob.c Outdated Show resolved Hide resolved
src/do_command.c Outdated Show resolved Hide resolved
anacron/runjob.c Outdated Show resolved Hide resolved
@fcappi fcappi requested a review from t8m July 23, 2020 11:35
Copy link
Member

@t8m t8m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

@t8m t8m merged commit 24cb552 into cronie-crond:master Jul 23, 2020
@t8m
Copy link
Member

t8m commented Jul 23, 2020

Merged, thank you for the PR!

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

Successfully merging this pull request may close these issues.

MAILFROM should probably substitute variables
2 participants