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

Handle hints files named "0" #293

Merged

Conversation

marc-vanderwal
Copy link
Contributor

Purpose

This PR fixes a programming oversight causing zonemaster-cli to disregard hints files named 0.

Context

Follow-up to #284.

Changes

Change a test for truthiness to a test for definedness.

How to test this PR

  1. Change to a working directory not containing any file named 0.
  2. Run zonemaster-cli --hints 0 test.
  3. Expect an error message starting with: Error loading hints file: read_file '0' - open: No such file or directory. (The erroneous behavior was that zonemaster-cli attempts to run a test, disregarding the --hints option.)

If a hints file named "0" was given on the command-line, it wasn’t read.
The code simply checked whether $self->hints is a truthy value; however,
in Perl, the string "0" is falsey.

Checking for definedness instead of truthiness is more robust. It also
helps guard against the case when a user gives --hints "", which is
obviously wrong and should cause zonemaster-cli to error out.
@marc-vanderwal marc-vanderwal added the T-Bug Type: Bug in software or error in test case description label Dec 13, 2022
@marc-vanderwal marc-vanderwal added this to the v2022.2 milestone Dec 13, 2022
@marc-vanderwal marc-vanderwal merged commit 63e42ef into zonemaster:develop Dec 13, 2022
@matsduf matsduf added the V-Patch Versioning: The change gives an update of patch in version. label Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Bug Type: Bug in software or error in test case description V-Patch Versioning: The change gives an update of patch in version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants