heimdal/heimdal — pull request #59 by chewi (2014-02-01 22:11:55+00:00)
Title: Fix roken-h-process.pl

I'm trying to cross-build Heimdal. I hit upon some problems that I know have been reported to you before but, for one reason or another, haven't been fully resolved.

First off, roken-h-process.pl is still missing from EXTRA_DIST so it wasn't in the tarball.

Second, I stumbled across the problem outlined [here](http://comments.gmane.org/gmane.comp.encryption.kerberos.heimdal.general/6196) back in 2011. Although you did add @jpadhye's fix for roken-h-process.pl, you added it in the wrong place so it was ineffective. As it turns out, the fix itself was wrong anyway. This is why he felt the need to modify roken.in.h even though you rightly pointed out that it was correct.

I don't know what possessed you to try and reimplement the C preprocessor in Perl but I won't dwell on it. ;) The HAVE_STRERROR_R line was just too complex for it to handle with the existing set of regular expressions. It was evaluating the left-most clause as false, followed by &&, subsequently ignoring the rest. I fixed this by adding a longer regular expression that looks for (A && B) || (C && D).

That wasn't all. I noticed that the existing "or" clause wasn't being handled properly because of precedence rules in Perl. This resulted in the wrong outcome for the mkstemp function. The following two lines are not equivalent. You want the latter, not the former.

```perl
return parse_if($1) or parse_if($2);
return (parse_if($1) or parse_if($2));
```

I am still having trouble with compile_et but I will file another issue about that.