This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Bug in loadti/dss getArgs.js code in CCS 4/5

There is a logic error in the getArgs() function of the getArgs.js
file that is part of the DSS examples/loadti installation.

The loadti function has the general form

  loadti -c <config_ccxml_file> -x <log_file> <out_file> <arg1> <arg2> ... <argN>

where arg1, ..., argN are arguments to the out_file.

The error occurs if, by chance, one of the arguments to the out_file
(i.e., one of the <arg1>, ..., <argN>) happen to also be of the form
of one of the deprecated --out-file options.

For example, in my situation, one of my out_file options begins with
"-o", and thus the check for the deprecated --out-file options finds
this "-o" and mistakenly determines that the deprecated option is in
use, setting

  usingOutfileOption = true;

on line 112.

Next the top-level while loop

 while (argCt < arguments.length)

parses the -c and -x options (to loadti) properly.

When the top-level while loop reaches the out_file, it falls
through the "option check":

  if (arguments[argCt].match(/^-(.*)/))

into the else:

  else
  {
   if (usingOutfileOption)
   {
    // it is a argument to be passed to main
    testEnv.argvArgs[argvNum++] = arguments[argCt++];
   }
   else
   {
    // it is the outfile list, and all arguments that follow it are arguments to be passed to main
    
    testEnv.outFiles = arguments[argCt++];
    
    while (argCt < arguments.length)
    {
     testEnv.argvArgs[argvNum++] = arguments[argCt++];
    }

    break;
   }
  }

Since usingOutfileOption is true, it parses only one argument (the
out_file). Therefore the next time through the top-level while loop,
the next argument passed to loadti (which is supposed to be the first
argument to out_file, arg1) is parsed as if it were a loadti argument,
which is an error. In my case, arg1 was "-i", which is not a valid loadti
option, so i was getting to the line

  exitWithArgError("Unrecognized option `" + arguments[argCt-1] + "'");

and exiting.

This error appears to be in both CCS4 and CCS5.

Just thought I thought I'd pass on my findings to help out.

--Randy