cronie-crond/cronie

Variable-substitution in MAILFROM does not work

Opened this issue · 0 comments

Is this cronie the cron/crontab implementation used in RHEL9?
(If no, you can just reject this ticket.)

If yes, I think there is a bug vs what the documentation says:

man 5 crontab
in RHEL9 says:

"Note: Both MAILFROM and MAILTO variables are expanded, so setting them as in the following example works as expected: MAILFROM=cron-$USER@cron.com ($USER is replaced by the system user)"

After a lot of trail'n'error I have concluded that any $variable in the
MAILFROM=someExpression
will cause that assignment to fail/get ignored and the sender of crontab mails will fall back to the default.
Hardcoding the value (without any $variable) works, but no variable substitution will work.

It's very easy to make a crontab test-case, like:

MAILFROM=cron-$USER@mydomain.com
* * * * * scriptThatDoesntExist.sh

The mail sent will have the default sender: user@hostname
not what you specified in MAILFROM.

If I'm totally missing something here, I am happy to get enlightened.