January 31, 2011

Missing Separator Mystery Solved

I occasionally run into a problem where "make" complains that my makefile has a missing separator.

makefile64:25: *** missing separator. Stop.

The documentation clearly states it's the result of a recipe line that does not begin with a tab. Yeah, I already knew that. It's interesting to note that this only happens after pasting text into a 'vim' edit session. Carefully inserting tab characters for every line where they belong does not fix the problem. Recreating the entire makefile by hand in a new vim session does fix the problem. As this problem has never, ever happened to me in any environment except under the USS shell on z/OS, I've tried to avoid pasting into makefiles in that environment.

Well, today I experienced the problem again after pasting a rather large block of recipes. Damn it all! I knew I should have typed it instead. Pissed, but determined as ever to figure this out, I meticulously retyped everything by hand, with the same result! Take a look at these last four lines of the makefile in the vim session:

clean:
        rm -f *.o
        rm -f *.so
        rm -f *.listing
~
~
"makefile" character 1, column 8

The indented lines, of course, begin with a tab character. See the problem? No, neither did I, at first. See those tilde characters after the last line, the ones that vim uses to indicate non-existent lines between the last line of text and the last line of the screen? The first tilde isn't a non-existent line. It's the tilde indicating a non-existent line in the source makefile that got pasted into this makefile!

Now, I've always been extremely careful to not copy those tildes and, as I've said, this has never happened before in any other environment. I haven't yet figured out what's unique about this particular environment, but it might be something like a jittery mouse that occasionally adds a character to the selection. In any case, it was tough to spot this one! From now on I'll be watching more closely for tildes hiding in plain sight!

Posted by pscott at January 31, 2011 04:01 PM