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

CPL_DEBUG does not accept "YES" or "TRUE" #11219

Closed
dbaston opened this issue Nov 7, 2024 · 3 comments · Fixed by #11220
Closed

CPL_DEBUG does not accept "YES" or "TRUE" #11219

dbaston opened this issue Nov 7, 2024 · 3 comments · Fixed by #11220
Assignees

Comments

@dbaston
Copy link
Member

dbaston commented Nov 7, 2024

          > Any config option should accept any of these values. But the documentation probably does not give that impression.

Should or already does? At the moment, CPL_DEBUG=ON works, but YES and TRUE don't.

Originally posted by @lnicola in #8440 (comment)

Nearby, CPL_TIMESTAMP interprets any value as "YES", including "NO".

@dbaston dbaston self-assigned this Nov 7, 2024
@rouault
Copy link
Member

rouault commented Nov 7, 2024

Yes we should support YES,TRUE,ON,1 . For CPL_DEBUG, we can't use CPLTestBool() for that, since CPL_DEBUG also accepts other strings to filter by component.
For CPL_TIMESTAMP, we should just use CPLTestBool()

@rouault
Copy link
Member

rouault commented Nov 7, 2024

And we should likely enhance CPLTestBool() to warn if the string passed to it is not one of YES,TRUE,ON,1,NO,FALSE,OFF,0

@dbaston
Copy link
Member Author

dbaston commented Nov 7, 2024

And we should likely enhance CPLTestBool() to warn if the string passed to it is not one of YES,TRUE,ON,1,NO,FALSE,OFF,0

It wouldn't hurt for now, but unless I'm mistaken there would be no way for the error message to contain the context from which it was called?

Longer-term, something returning a std::optional<bool> would let the caller issue a more informative message. (#9953)

@rouault rouault closed this as completed in b47a2f2 Nov 7, 2024
rouault pushed a commit that referenced this issue Nov 7, 2024
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 a pull request may close this issue.

2 participants