choco-solver
choco-solver copied to clipboard
[BUG] Cannot parser args correctly in fzn-choco
The bug happend in "fzn-choco" script at master branch, located at "parsers/src/main/minizinc/fzn-choco".
First, i try the command bash fzn-choco -jar choco-parsers-4.10.14-light.jar output.fzn
then it output:
"-jar" is not a valid option
ChocoFZN [options...] file
file : File to parse.
-a (--all) : Search for all solutions (default:
false). (default: false)
(......)
Second, i modify the script and make it print the finally command it will run.
bash fzn-choco -jar choco-parsers-4.10.14-light.jar output.fzn
java -server -Xss64M -Xms2G -Xmx8G -XX:NewSize=512M -cp .:choco-parsers-4.10.14-light.jar org.chocosolver.parser.flatzinc.ChocoFZN -limit=[-1,-1sols] -lvl COMPET "-jar"
Obviously, the script parser the "--jar" as file path.
The error caused at line 61. May be we should move FILE="$1" after case switch.
I fork and fix the issue. I read the CONTRIBUTING.md and there no more details about modify a shell script. So, can i make a PR about this issue directly?
Thank you for the bug reporting. Indeed, the last commit on this file change the order of the parameter and was not compliant with the expectations. I just encountered the same problem this morning, before reading the issue and came to the same patch.
I am not able to test the fzn-choco.exe file but I suppose the same error occurs.
I'll push your correction for the bash version and wait for a windows user to test the other one.
Related to #1097