seri/gettc

A bug in runner.sh

Closed this issue · 4 comments

I found a bug in bin/runner.sh. In many places of runner.sh, "==" is used for testing equality, however, it seemed that "=" should be used instead (maybe a difference between C++ and BASH).

Thanks!

seri commented

Hi bokertov,
It's true I rarely write Bash, but according to this source:
http://tldp.org/LDP/abs/html/comparison-ops.html
== and = behave almost identical except some edge cases.
Do tell me if it becomes a real issue in your case though.

I am no expert on Bash, either.
However, when I tried the problem "AccessChanger" (ID 4830), I got the following errors:

AccessChanger/solve/cpp$ make
if [ ! -d ../../build/cpp ]; then mkdir -p ../../build/cpp; fi
g++ -std=gnu++0x -I$HOME/.gettc/include/cpp -o ../../build/cpp/AccessChangerRunner AccessChangerRunner.cpp
sh ../../bin/runner.sh verbose ../../build/cpp/AccessChangerRunner ../../data/demo ../../build/cpp/demo
[: 104: verbose: unexpected operator
[: 104: verbose: unexpected operator
3 cases checked, 0 failed

I found that if I replaced all "==" by "=", then the script runs perfectly fine.

Everything else works great. Thanks a lot for your project.

seri commented

I got no problems with AccessChanger on my system, but since your fix is more portable, I have made the change.

I see. Maybe it's just different implementations of Bash.

Thanks a lot.