Euphoria Ticket #467: cmd_parse() value of {1,1}

When there is an option that is specified in the command line twice, and which is defined as, for example:

{ "batch",     0, GetMsgText(279,0), { NO_CASE } } 

...cmd_parse() returns {1,1} as its value. It's possible that this is correct (the docs don't appear to say), in which case the error is really in cominit.e:finalize_command_line(), or possibly in the way that eu.cfg options are merged with command line options.

svn:4372 updated t_command_line_quote.e to properly fail when the file that contains the output does not exist. Both t_command_line_quote.e and t_socket.e fail when they build a command line based on the existing option switches when a eu.cfg file has the -batch parameter. Eutest also passes -batch by default.

As a simple example:

-- bug.ex 
include std/console.e 
display( option_switches() ) 

I get:

$ eui bug.ex 
{ 
  "-i", 
  "/usr/share/euphoria/include", 
  "-i", 
  "/usr/local/share/euphoria/include", 
  "-i", 
  "~/eu", 
  "-batch" 
} 
 
$ eui -batch bug.ex 
{ 
  "-i", 
  "/usr/share/euphoria/include", 
  "-i", 
  "/usr/local/share/euphoria/include", 
  "-i", 
  "~/eu", 
  "-batch", 
  {1,1} 
} 
 

Details

Type: Bug Report Severity: Blocking Category: Interpreter
Assigned To: jeremy Status: Fixed Reported Release:
Fixed in SVN #: 4384,4391 View VCS: 4384, 4391 Milestone: 4.0.0RC2

1. Comment by jeremy Dec 01, 2010

-batch is turning into {1,1} after the merge_maps() command. Seems right now we call cmd_parse() on the options, then do something with GetDefaultArs() and call cmd_parse() again, then merge the two maps.

On each case of cmd_parse() calls, -batch is 1 (when supplied on the command line and in eu.cfg), but when merging, it turns into {1,1}

See ~55 of intinit.e

2. Comment by mattlewis Dec 01, 2010

Changing category to interpreter, since that's where the problem is.

3. Comment by jeremy Dec 01, 2010

Should work as of svn:4384. Found various issues all over the board, including the commit log here:

  • Fixed interpreter, translator and binder for handling multiple parameters when one comes from a eu.cfg file and the other from the command line, but the given option was designed to only be used ONCE, such as -batch
  • cmd_parse sets NO_CASE, NO_PARAMETER, ONCE when their counterparts are not present
  • Removed implicit NO_CASE, NO_PARAMETER and ONCE options from command line option sequences

Further, I forgot to add to the commit log:

  • cmd_parse() uses map:ADD operation if parameter option is NO_PARAMETER and MULTIPLE. This will cause things such as -verbose -verbose -verbose to result in map:get(opts, "verbose") to be 3 instead of {1,1,1}

4. Comment by mattlewis Dec 01, 2010

It's working correctly now.

Search



Quick Links

User menu

Not signed in.

Misc Menu