Linux Shebangigans

Nov 29, 2006 23:57

Today at work, I asked coworker Isaiah for some help. He was the last person to touch a particular body of code that I couldn't get to compile. It didn't help that the project had been converted to use cmake as the build tool, as I don't know anything about cmake. The problem was magnified by cmake error message, which was unable to specify in which file it was encountering the error. It also suggested that the error had happened on line number -1 of the unnamed file. Good luck finding that one in a text editor! I'd been through all of the cmake code looking for the offending line, but it seemed not to be there. Thirty minutes of poking later, Isaiah found it . . . in a csh script. We knew it was a csh script because an English comment said so. Unfortunately, computers aren't quite smart enough to parse such a thing. They will, however, understand a shebang, the incantation that specifies which program should be executing the script. This script didn't have one, so cmake tried to parse it as cmake instead of invoking csh to handle it. Lovely.

The other great mystery today was why coworker Edgar's shell wouldn't execute anything on his path, even when echo $PATH and echo $path produced reasonable results. The answer: missing newlines at the end of his .cshrc. Edgar also asked why he couldn't connect with an SFTP client. Fortunately, coworker Jay and I had recently solved that mystery after years of confusion. SFTP clients barf on messages printed out at shell startup, and we didn't have anything in our .cshrc files to say "oh, not a shell? Stop parsing before we print any messages."

work, i hate computers

Previous post Next post
Up