Skip to content

Reject empty string as value in cronvar #10445

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

gdrosos
Copy link

@gdrosos gdrosos commented Jul 24, 2025

SUMMARY

Reject empty string values for value in the cronvar module to prevent misleading success reports in some OSes.
I also added the necessary integration test.
Fixes #10439

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

cronvar

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug integration tests/integration module module new_contributor Help guide this first time contributor plugins plugin (any type) tests tests needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jul 24, 2025
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-10 Automatically create a backport for the stable-10 branch backport-11 Automatically create a backport for the stable-10 branch labels Jul 24, 2025
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

@ansibullbot ansibullbot added needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI and removed needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI labels Jul 24, 2025
@felixfontein
Copy link
Collaborator

Restarting CI.

@felixfontein
Copy link
Collaborator

Hmm I guess this needs another commit, or a rebase, to get rid of the CI failures, since the CI matrix changed. I was hoping that closing + reopening updates the matrix, but apparently it does not 🤷

@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Jul 24, 2025
gdrosos and others added 4 commits July 24, 2025 19:24
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
@gdrosos
Copy link
Author

gdrosos commented Jul 24, 2025

Thank for the immediate feedback! I rebased the branch so now the CI matrix succeeds.

@russoz
Copy link
Collaborator

russoz commented Jul 25, 2025

There could be cases where the user wants to remove the existing content of the var, replacing it with "". I don't think that prohibiting empty value is a good solution for the situation. The module clearly needs to handle that case better for Ubuntu/Debian systems. What is the content it is generating that is wrong in syntax?

@gdrosos
Copy link
Author

gdrosos commented Jul 25, 2025

The module currently writes this line into the crontab:
EMPTY_VAR=
This is written exactly like that — without quotes. On Ubuntu/Debian, this causes a crontab parse error in the temporary file:

"/tmp/crontab123":0: bad minute
errors in crontab file, can't install.

So while the syntax EMPTY_VAR= is accepted on systems like Rocky and Fedora , it is rejected by Debian-based systems.

To support this use case safely across platforms, I could also modify the module to render:
EMPTY_VAR=""

instead of EMPTY_VAR= when the value is an empty string. This preserves the user's intent to clear a variable while maintaining compatibility on all platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-10 Automatically create a backport for the stable-10 branch backport-11 Automatically create a backport for the stable-10 branch bug This issue/PR relates to a bug check-before-release PR will be looked at again shortly before release and merged if possible. integration tests/integration module module new_contributor Help guide this first time contributor plugins plugin (any type) tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cronvar: module fails to handle empty string variables consistently across platforms
4 participants