Project

General

Profile

Bug #22354

Strings evaluated as boolean

Added by Marco Mambelli 15 days ago. Updated 1 day ago.

Status:
Closed
Priority:
Urgent
Category:
-
Target version:
Start date:
04/10/2019
Due date:
% Done:

0%

Estimated time:
First Occurred:
Occurs In:
Stakeholders:
Duration:

Description

Some variables are assigned string values "True" or "False" but then are compared with booleans True and False.

Symptoms are incorrect behaviors like:
- preventing the Frontend fo match jobs [#21898]
- odd behaviors due to the incorrect evaluation

Here the new occurrence in 3.4.4

Turned out that this issue was not actually solved. The changes I made did fix an issue with the unsanitized classad GLIDEIN_REQUIRE_GLEXEC_USE , but the source of the original issue was in another place that is only triggered when glidein_glexec_use is set to NEVER (which I had not in my tests!).

The task of this ticket is to check the code looking for similar patterns and fix if there are other cases of mixed-use.

Searching with

egrep -R '\[.attrs.\]' * | egrep -i '(false|true)' | grep -v "^doc" | less

showed that also GLIDEIN_In_Downtime is used incorrectly and should be fixed.

The line used to evaluate the truthiness of these attributes should probably become a function since is being used many times (is_false()):

(str(glidein["attrs"].get("GLIDEIN_REQUIRE_GLEXEC_USE", False)).lower() == "false")

unless it is always inside the match expression where imports are difficult.

the is_true() or is_false() functions could be added to the unit tests


Related issues

Related to glideinWMS - Bug #21898: Error preventing the Frontend fo match jobsResolved2019-02-20

Related to glideinWMS - Support #21537: Double-check functions that deal with boolean ClassAd facing possible misleading behaviorNew2018-12-12

History

#1 Updated by Marco Mambelli 15 days ago

  • Related to Bug #21898: Error preventing the Frontend fo match jobs added

#2 Updated by Marco Mambelli 15 days ago

  • Related to Support #21537: Double-check functions that deal with boolean ClassAd facing possible misleading behavior added

#3 Updated by Marco Mascheroni 10 days ago

  • Assignee changed from Marco Mascheroni to Marco Mambelli
  • Status changed from New to Feedback

#4 Updated by Marco Mascheroni 10 days ago

  • Assignee changed from Marco Mambelli to Marco Mascheroni
  • Status changed from Feedback to Resolved

#5 Updated by Marco Mambelli 1 day ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF