Forced shell calls

From Apache OpenOffice Wiki
Jump to: navigation, search

What is it?

It's a single "+" in the receipt properties (right at the beginning of the line). Forced shell calls in makefile receipt lines are used to force execution of this line in a shell context instead of a plain exec call. The problem is, that starting up a seperate shell for a receipt line isn't cheap.

One may think this is nesseccary if shell functionality (e.g. piping, redirection or similar) is used - this is wrong.


When do i need them?

dmake supports defining a set of shell meta characters (SHELLMETA variable) to detect if a shell is required to process a specific receipt line. So if the set is properly defined, dmake is able to decide in almost all cases if a shell is required.

The only exception to this are shell internal commands. Depending on what shell you are used to, you may know "source", "set" or "copy". Using these commands requires forced shell calls as there are no according binaries (for exec) and no special chars for dmake to detect.

Now for some details

Since noone wants to slow down all shells just because a command is internal for one of them, the "+" previously found before every potential internal command has been moved into the according dmake variable (see unitools.mk).


The downside

  • Not all affected commands are yet wrapped by dmake variables - so there is a handfull of places where forced shell calls are still lingering around in makefiles.
  • In some rare places, moving the "+" into the variable leads to a receipt line containing a "+" somewhere in the middle of the line and thus causing an error. that's the reason for the ugly construct $(SOMETOOL:s/+//) found in solenv/inc.
Personal tools