“It’s hard to feel motivated. All this red vs. blue, it’s like, Are you guys Crips and Bloods? What about tackling jobs, obesity, poverty? Since red and blue make purple, why not unite, because scientifically speaking, purple is the fastest light. If they were to come together, they would be faster and more powerful”

The Black Eyed Peas’ Will.I.Am, quoted in Newsweek, December 27, 2010

osql -> isql -> aargh on Ubuntu

Trying to set up ODBC on Ubuntu. osql is a great script to test it out, but running it on Ubuntu 10.10:

root:~# osql -S fcstest -U sa -P *****
osql: error: no potential directory strings in "/usr/local/bin/isql"
isql strings are:
+ /lib/ld-linux.so.2

So inspecting the code, I can extract the meaningful parts on RHEL, where it works:

ISQL=$(command -v isql)
strings ${ISQL} | grep ^/

but on Ubuntu, the same sequence:

dchwalis:/usr/local/src$ strings ${ISQL} | grep ^/

Note the missing /usr/local/lib – the grep filters following will NEVER find any strings…

Maybe we should do this: RHEL:

$ ldd /usr/local/bin/isql
libodbc.so.1 => /usr/local/lib/libodbc.so.1 (0x00002b5b76eb4000)

and Ubuntu:

root:/usr/local/bin# ldd isql
libodbc.so.1 => /usr/local/lib/libodbc.so.1 (0x001cd000)

We can pull a path from that!

Hudson, Git and the extra space

At work I am installing a new Hudson slave for continuous integration. Everything works great, using the Tanuki Java Service Wrapper to fire up the slave.jar, but when it comes time to run the build, it fails:

Started by user anonymous
Building remotely on warehouse_build_slave
Checkout:WarehousePortal_Rake / /var/hudson/workspace/WarehousePortal_Rake - hudson.remoting.Channel@26c81672:warehouse_build_slave
Using strategy: Default
Checkout:WarehousePortal_Rake / /var/hudson/workspace/WarehousePortal_Rake - hudson.remoting.LocalChannel@1e9b7b2
Cloning the remote Git repository
Cloning repository origin
ERROR: Error cloning remote repo 'origin' : Could not clone ssh://XXXXXX.XXX/git/projectname
ERROR: Cause: Error performing command: /usr/local/bin/git clone -o origin ssh://XXXXXXX.XXX/git/projectname /var/hudson/workspace/projectname_rake
Cannot run program "/usr/local/bin/git ": java.io.IOException: error=2, No such file or directory
Trying next repository
ERROR: Could not clone repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:880)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:812)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1899)
at hudson.remoting.UserRequest.perform(UserRequest.java:114)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:270)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at hudson.remoting.Engine$1$1.run(Engine.java:58)
at java.lang.Thread.run(Thread.java:662)

Lots of Googling. Pulled down the source for Hudson, opened in Eclipse. Pulled down the Git plugin source. Reviewed the setup with other Hudson slaves. Looks great. But it doesn’t work.

Run /usr/local/bin/git clone -o origin ssh://XXXXXXX.XXX/git/projectname /var/hudson/workspace/projectname_rake from the shell. Works great.

Permissions good. Using /usr/local/bin/git to launch. Replaced with a shell script and could echo out some stuff. The dang thing is running!

Finally poking around in hudson.Util.ArgumentListBuilder.
if(arg.indexOf(' ')>=0 || arg.length()==0)

Oh no. If there is a space in the program name it will double quote it.

Open Manage Hudson, Configure System. Check the git “Path to Git executable”. It is “/usr/local/bin/git ” with a space at the end. Just like in the log:
Cannot run program "/usr/local/bin/git ": java.io.IOException: error=2, No such file or directory

Remove the space. Fixed. 3 hours I will never get back.