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

Illegal instruction error when region attribute is not found in the CV #638

Closed
mauzey1 opened this issue Nov 12, 2021 · 1 comment · Fixed by #639
Closed

Illegal instruction error when region attribute is not found in the CV #638

mauzey1 opened this issue Nov 12, 2021 · 1 comment · Fixed by #639
Assignees
Labels
Projects

Comments

@mauzey1
Copy link
Collaborator

mauzey1 commented Nov 12, 2021

I encountered an error when working on #628. It was when I tried to set the region attribute for the input4MIPs variable to a string made from a list that I got the "illegal instruction" error. It turned out that CMOR was trying to create an error message that said that the string used for the attribute value was not found in a regular expression composed of all the regions listed in the input4MIPs CV file. This causes a problem since there are enough regions in that list to make the regular expression string exceed the maximum string length of CMOR. The code that produces this message is below.

cmor/Src/cmor_CV.c

Lines 2008 to 2031 in e38ba87

/* -------------------------------------------------------------------- */
/* We could not validate this attribute, exit. */
/* -------------------------------------------------------------------- */
if (i == (attr_CV->anElements)) {
for (i = 0; i < attr_CV->anElements; i++) {
strcat(szValids, "\"");
strncpy(szOutput, attr_CV->aszValue[i], CMOR_MAX_STRING);
strcat(szValids, szOutput);
strcat(szValids, "\" ");
}
snprintf(msg, CMOR_MAX_STRING,
"The attribute \"%s\" could not be validated. \n! "
"The current input value is "
"\"%s\" which is not valid \n! "
"Valid values must match the regular expression:"
"\n! \t[%s] \n! \n! "
"Check your Control Vocabulary file \"%s\".\n! ",
szKey, szValue, szValids, CV_Filename);
cmor_handle_error(msg, CMOR_NORMAL);
cmor_pop_traceback();
return (-1);
}

This issue is related to the bigger issue of the maximum string length being only 1024 as listed in #530. However, rather than tackle that larger issue here, I will just find a solution to handle errors for not finding attribute values in large lists in the CV. Maybe just mention which attribute in the CV where it couldn't find the values.

@mauzey1 mauzey1 added the bug label Nov 12, 2021
@mauzey1 mauzey1 added this to To do in 3.7.0 via automation Nov 12, 2021
@mauzey1 mauzey1 self-assigned this Nov 12, 2021
@durack1
Copy link
Contributor

durack1 commented Nov 12, 2021

@mauzey1 thanks for continuing to spring clean!

What would the likely investment be to tackle and solve #530? It seems like that is something that we may continue to trip over. I wonder if there is any possibility of initializing a dynamic variable rather than these fixed size variables instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
3.7.0
Done
Development

Successfully merging a pull request may close this issue.

2 participants