Project

General

Profile

Bug #21709

problem in smart_partionable.sh

Added by Dennis Box 7 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Category:
-
Target version:
Start date:
01/16/2019
Due date:
% Done:

0%

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

Description

Found by linting when I was looking at something else. Line 82 of smart_partionable.sh reads:

elif [[ "X$RES_SLOT" = "Xmain" && "$num_cpus" > "1" ]]; then

this can create a file named "1" while failing to do any comparison on $num_cpus . The compare operator should be '\>' or better yet '-eq' as string comparison can be wrong, for instance comparing "011" with "1".

History

#1 Updated by Dennis Box 7 months ago

update: I dont understand the parsing of double brackets very well. After testing, I dont think it will create a file named "1" but "011" still does not compare correctly to "1"

#2 Updated by Marco Mambelli 7 months ago

  • Target version set to v3_4_3
  • Assignee set to Dennis Box
  • Status changed from New to Feedback

As I added also in the comment: # NOTE: $num_cpus can be a string AUTO, SLOT, NODE or a number. # - "$num_cpus" > "1" catches strings and numbers w/o prefoxes # - "$num_cpus" -gt "1" catches numbers with prefixed 0s, e.g. 03 -gt 1 # conditions are separated to be safer and more clear: # tests show prcedence left to right, but documentation no: https://www.tldp.org/LDP/abs/html/opprecedence.html

In branch v34/21709

#3 Updated by Marco Mambelli 7 months ago

  • Assignee changed from Dennis Box to Marco Mambelli
  • Status changed from Feedback to Resolved

#4 Updated by Marco Mambelli 7 months ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF