kiniry / Mobius

4 stars 8 forks source link

bonc doesn't handle spaces in filenames #652

Open atiti opened 11 years ago

atiti commented 11 years ago

The bonc program installed from the Ubuntu repositories doesn't work if input filenames contain spaces:

{{{ bonc -i /home/davidc/Documents/2010-Spring/Advanced\ Models\ and\ Programs/eclipse-workspace/BON\ Examples/bon/connector.bon stdin: No files to parse! File not found: /home/davidc/Documents/2010-Spring/Advanced File not found: Programs/eclipse-workspace/BON File not found: Models File not found: and File not found: Examples/bon/connector.bon 6 errors. }}}

and

{{{ bonc -i /home/davidc/Documents/2010-Spring/Advanced\ Models\ and\ Programs/eclipse-workspace/BON\ Examples/bon/connector.bon stdin: No files to parse! File not found: /home/davidc/Documents/2010-Spring/Advanced\ File not found: Programs/eclipse-workspace/BON\ File not found: Models\ File not found: and\ File not found: Examples/bon/connector.bon 6 errors. }}}

General info: {{{ davidc@mimisbrunnr:~/tmp/docs$ bonc --version bonc-0.1.5 davidc@mimisbrunnr:~/tmp/docs$ uname -a Linux mimisbrunnr 2.6.31-20-generic #57-Ubuntu SMP Mon Feb 8 09:02:26 UTC 2010 x86_64 GNU/Linux }}}

atiti commented 11 years ago

From: fintan (GH: fintanf) Date: Mon Mar 8 12:23:25 2010

I believe this is not an issue with the latest version (0.2.5), which has been uploaded to the repository. If you see the same behaviour on the current version please reopen this bug report. Thanks.

atiti commented 11 years ago

From: david_christiansen (GH: None) Date: Mon Mar 8 13:57:08 2010

This is still not working for me; however, it is behaving differently now.

Runs with different attempts at making the syntax work:

{{{ davidc@mimisbrunnr:~/tmp/docs$ bonc --version bonc-0.2.5 davidc@mimisbrunnr:~/tmp/docs$ bonc -i /home/davidc/Documents/2010-Spring/Advanced\ Models\ and\ Programs/eclipse-workspace/BON\ Examples/bon/connector.bon Invalid arguments. File must exist: /home/davidc/Documents/2010-Spring/Advanced -i /home/davidc/Documents/2010-Spring/Advanced Models and Programs/eclipse-workspace/BON Examples/bon/connector.bon ^ File must exist: /home/davidc/Documents/2010-Spring/Advanced davidc@mimisbrunnr:~/tmp/docs$ bonc -i /home/davidc/Documents/2010-Spring/Advanced\ Models\ and\ Programs/eclipse-workspace/BON\ Examples/bon/connector.bon Invalid arguments. File must exist: /home/davidc/Documents/2010-Spring/Advanced\ -i /home/davidc/Documents/2010-Spring/Advanced\ Models\ and\ Programs/eclipse-workspace/BON\ Examples/bon/connector.bon ^ File must exist: /home/davidc/Documents/2010-Spring/Advanced\ davidc@mimisbrunnr:~/tmp/docs$ bonc -i "/home/davidc/Documents/2010-Spring/Advanced Models and Programs/eclipse-workspace/BON Examples/bon/connector.bon" Invalid arguments. File must exist: /home/davidc/Documents/2010-Spring/Advanced -i /home/davidc/Documents/2010-Spring/Advanced Models and Programs/eclipse-workspace/BON Examples/bon/connector.bon ^ File must exist: /home/davidc/Documents/2010-Spring/Advanced

}}}

atiti commented 11 years ago

From: fintan (GH: fintanf) Date: Mon Mar 8 14:20:21 2010

The changes to output are just a result of a change in the library handling command line option processing.

The issue is clearly a result of args being incorrectly separated before being passed to the underlying java program. The odd thing is that I cannot recreate on an install of the exact same version of ubuntu.

{{{ fintan@beast:~$ uname -a Linux beast 2.6.31-20-generic #57-Ubuntu SMP Mon Feb 8 09:02:26 UTC 2010 x86_64 GNU/Linux fintan@beast:~$ bonc -i /home/fintan/With\ Spaces/test.bon fintan@beast:~$ }}}

Is there any peculiarities with your system that you know of? In particular your version of bash.

Can you please test running bonc using the below commands and see if either performs differently:

/usr/share/bonc/bonc java -jar /usr/share/bonc/lib/BON.jar

This should help us to track down exactly where the args are being incorrectly split.

atiti commented 11 years ago

From: fintan (GH: fintanf) Date: Mon Mar 8 14:24:55 2010

Sorry, those two commands should be:

{{{ /usr/share/bonc/bonc java -jar /usr/share/bonc/lib/BON.jar }}}

Where is your original arguments that involve spaces in file names.

atiti commented 11 years ago

From: david_christiansen (GH: None) Date: Mon Mar 8 14:42:17 2010

Running those two commands works fine, so I assume it's part of the bonc-debian script.

Indeed, when I edit the script to: {{{

Copyright (c) 2007, Fintan Fairmichael, University College Dublin under the BSD licence.

See LICENCE.TXT for details.

export BON_HOME=/usr/share/bonc

if [ -d /usr/lib/jvm/java-6-sun ]; then export JAVA_HOME=/usr/lib/jvm/java-6-sun $BON_HOME/bonc "$@" elif [ -d /usr/lib/jvm/java-5-sun ]; then export JAVA_HOME=/usr/lib/jvm/java-5-sun $BON_HOME/bonc "$@" else echo "Unable to find a JVM at /usr/lib/jvm/java-5-sun or /usr/lib/jvm/java-6-sun, exiting." fi }}}

everything works. I just replaced $* with "$@" - sorry it's not a real diff, but I thought with such a short script, it was easier just to paste it in here.

The only special software I have installed by hand is Eclipse and some Haskell libraries, and I doubt they'd affect this. I have: {{{ davidc@mimisbrunnr:~/tmp/docs$ echo $PATH /home/davidc/.cabal/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games davidc@mimisbrunnr:~/tmp/docs$ bash --version GNU bash, version 4.0.33(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. davidc@mimisbrunnr:~/tmp/docs$ bonc -v bonc-0.2.5 }}}

atiti commented 11 years ago

From: fintan (GH: fintanf) Date: Tue Mar 9 00:53:05 2010

Strange that we see different behaviour given that I have an identical version of bash.

Anyway, I think "$@" is what I should've had in the first place, so I've made that change.

Thanks again for the bug report and the useful info on fixing this.

atiti commented 11 years ago

From: david_christiansen (GH: None) Date: Tue Mar 9 00:54:28 2010

That is strange. Perhaps it has something to do with the script not having a #! line?

Thanks for being so responsive!