Cygwin and the Little Tin God.

2003/12/29

Categories: GeekStuff

The 10 Commandments for C Programmers is a very important document. All programmers should read it.

I would like to call your attention to a side comment in the annotations for Commandment #7:

Numberless are the unwashed heathen who scorn their libraries on various silly and spurious grounds, such as blind worship of the Little Tin God (also known as \`\`Efficiency'').
Cygwin's bourne shell clone has had a feature, the getopts builtin command, removed from it for lo these many years. The topic is discussed occasionally, as a Google search shows.

Why were these things removed? To make the shell smaller. Why? To make it faster, supposedly.

Well, it turns out that removing getopts doesn’t make the shell faster. But that’s not the best part. The best part is that getopts wasn’t really removed; it’s still there, in the shell, it’s just that the entry in the builtin command table has been removed. The code is still being compiled. It’s still in the shell.

Removing this feature was stupid to begin with; the goal of a “code-minimized” shell is incompatible with the goal of providing a working environment to which scripts written on other Unix-like systems will run. But turning it off for no benefit at all is just plain crazy.

The feature should be reenabled, and the person who removed it should re-read Spencer’s commandments. Premature optimization is the root of a great deal of evil, but not even successfully removing the feature suggests a carelessness inappropriate for maintaining a shell.