Skip to content
Snippets Groups Projects
Commit 4caeb0db authored by Moe Jette's avatar Moe Jette
Browse files

Fix for incorrectly generated masks for task/affinity plugin

    patch.1.2.0-pre9.061207.bitfmthex from Dan Palermo (HP).
parent ea94c4be
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,8 @@ documents those changes that are of interest to users and admins. ...@@ -9,6 +9,8 @@ documents those changes that are of interest to users and admins.
reconfig. reconfig.
-- Added new slurm.conf parameter TaskPluginParam. -- Added new slurm.conf parameter TaskPluginParam.
-- Fix for job requeue and credential revoke logic from Hongjia Cao (NUDT). -- Fix for job requeue and credential revoke logic from Hongjia Cao (NUDT).
-- Fix for incorrectly generated masks for task/affinity plugin
patch.1.2.0-pre9.061207.bitfmthex from Dan Palermo (HP).
* Changes in SLURM 1.2.0-pre9 * Changes in SLURM 1.2.0-pre9
============================= =============================
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#include "src/common/bitstring.h" #include "src/common/bitstring.h"
#include "src/common/macros.h" #include "src/common/macros.h"
...@@ -1034,8 +1035,11 @@ char * bit_fmt_hexmask(bitstr_t * bitmap) ...@@ -1034,8 +1035,11 @@ char * bit_fmt_hexmask(bitstr_t * bitmap)
if ((i < bitsize) && bit_test(bitmap,i++)) current |= 0x2; if ((i < bitsize) && bit_test(bitmap,i++)) current |= 0x2;
if ((i < bitsize) && bit_test(bitmap,i++)) current |= 0x4; if ((i < bitsize) && bit_test(bitmap,i++)) current |= 0x4;
if ((i < bitsize) && bit_test(bitmap,i++)) current |= 0x8; if ((i < bitsize) && bit_test(bitmap,i++)) current |= 0x8;
current += '0'; if (current <= 9) {
if (current > '9') current += ('A' - '9'); current += '0';
} else {
current += 'A' - 10;
}
*ptr-- = current; *ptr-- = current;
} }
...@@ -1054,6 +1058,7 @@ char * bit_fmt_hexmask(bitstr_t * bitmap) ...@@ -1054,6 +1058,7 @@ char * bit_fmt_hexmask(bitstr_t * bitmap)
int bit_unfmt_hexmask(bitstr_t * bitmap, const char* str) int bit_unfmt_hexmask(bitstr_t * bitmap, const char* str)
{ {
int bit_index = 0, len = strlen(str); int bit_index = 0, len = strlen(str);
int rc = 0;
const char *curpos = str + len - 1; const char *curpos = str + len - 1;
char current; char current;
bitoff_t bitsize = bit_size(bitmap); bitoff_t bitsize = bit_size(bitmap);
...@@ -1065,8 +1070,18 @@ int bit_unfmt_hexmask(bitstr_t * bitmap, const char* str) ...@@ -1065,8 +1070,18 @@ int bit_unfmt_hexmask(bitstr_t * bitmap, const char* str)
while(curpos >= str) { while(curpos >= str) {
current = (int) *curpos; current = (int) *curpos;
if (current <= '9') current -= '0'; if (isxdigit(current)) { /* valid hex digit */
if (current > '9') current -= ('A' - '9'); if (isdigit(current)) {
current -= '0';
} else {
current = toupper(current);
current -= 'A' - 10;
}
} else { /* not a valid hex digit */
current = 0;
rc = -1;
}
if ((current & 1) && (bit_index < bitsize)) if ((current & 1) && (bit_index < bitsize))
bit_set(bitmap, bit_index); bit_set(bitmap, bit_index);
if ((current & 2) && (bit_index+1 < bitsize)) if ((current & 2) && (bit_index+1 < bitsize))
...@@ -1079,7 +1094,7 @@ int bit_unfmt_hexmask(bitstr_t * bitmap, const char* str) ...@@ -1079,7 +1094,7 @@ int bit_unfmt_hexmask(bitstr_t * bitmap, const char* str)
curpos--; curpos--;
bit_index+=4; bit_index+=4;
} }
return 0; return rc;
} }
/* bit_fmt_binmask /* bit_fmt_binmask
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment