<blockquote><br>Dear List,<br><br>While porting an application to the upcoming Debian Wheeze<br>we noted a misbehaviour in command line parsing by PETSC 3.2.<br><br>It looks like if a "--key value" pair is following a "--flag-with-no-value" option<br>
at the leading position, the key-value pair is being ignored. See minimal<br>example below.<br><br>Is this something known? Is there a simple fix that had a chance<br>to convince Debian maintainers to apply it before 7.0 or even<br>
7.0.1?<br><br>Alexei, Bo<br><br><br>$ cat options.c <br>
<br>
#include "petsc.h"<br>
<br>
int main( int argc, char *argv[] )<br>
{<br>
int val1 = 1; <br>
int val2 = 2;<br>
PetscBool test;<br>
PetscErrorCode ierr;<br>
<br>
PetscInitialize( &argc, &argv, 0, 0);<br>
<br>
ierr = PetscOptionsHasName (PETSC_NULL, "--test", &test);<br>
if (test)<br>
PetscPrintf (PETSC_COMM_WORLD, "with --test option\n");<br>
else<br>
PetscPrintf (PETSC_COMM_WORLD, "without --test option
\n");<br>
<br>
ierr = PetscOptionsGetInt (PETSC_NULL, "--op1", &val1,
&test);<br>
ierr = PetscOptionsGetInt (PETSC_NULL, "--op2", &val2,
&test);<br>
<br>
<br>
<br>
PetscPrintf (PETSC_COMM_WORLD, "op1: %d\n", val1);<br>
PetscPrintf (PETSC_COMM_WORLD, "op2: %d\n", val2);<br>
<br>
PetscFinalize();<br>
<br>
return 0;<br>
}<br>
</blockquote>
When executing on neh13, "--opt1" couldn't get its value from
command line when the no-value option "--test" appears before it:<br>
<blockquote>lib@neh13:~/petsc/options$ ./test --test --op1 23 --op2
45<br>
with --test option<br>
op1: 1<br>
op2: 45<br>
lib@neh13:~/petsc/options$ ./test --op1 23 --op2 45<br>
without --test option <br>
op1: 23<br>
op2: 45<br>
lib@neh13:~/petsc/options$ ./test --op1 23 --op2 45 --test<br>
with --test option<br>
op1: 23<br>
op2: 45<br>
</blockquote>
I also test it on quad4 and on my local cluster with the latest
version of Petsc(3.3), this bug doesn't appear:<br>
<blockquote>lib@crc3:~/petsc/options$ ./test --test --op1 23 --op2
45<br>
with --test option<br>
op1: 23<br>
op2: 45<br>
</blockquote>
Looks it only exists in Petsc-3.2 :(<br>