Subject: Re: pkg/33870: obfuscated code in regarding X11_TYPE
To: None <,,>
From: Roland Illig <>
List: pkgsrc-bugs
Date: 06/30/2006 05:00:05
The following reply was made to PR pkg/33870; it has been noted by GNATS.

From: Roland Illig <>
Subject: Re: pkg/33870: obfuscated code in regarding X11_TYPE
Date: Fri, 30 Jun 2006 06:57:39 +0200 wrote:
 > .if ((defined(X11_TYPE) && !empty(X11_TYPE:MXFree86) || \
 >      defined(X11_TYPE) && !empty(X11_TYPE:Mxorg)) && \
 >      defined(X11_TYPE) && empty(X11_TYPE:Mnative))
 > X11BASE?=               ${LOCALBASE}/${X11ROOT_PREFIX}
 > .endif
 > Due to the repeated checks for X11_TYPE being defined and the indentiation
 > not reflecting the nesting level this is near unreadble.
 > Does the author really expect the value of X11_TYPE to change while evaluating
 > the expression? Or does he need to be told three times?
 I think this code goes back to a bug in the bmake from NetBSD 1.6.2, 
 which had problems when the empty() function was applied to undefined 
 Of course, it would be much clearer to say:
 .if defined(X11_TYPE)
 .  if (${X11_TYPE} == "XFree86" || ${X11_TYPE} == "xorg") \
        && ${X11_TYPE} != "native"
 this would also reveal that there must be a typo in the "native" part. 
 If X11_TYPE is either "XFree86" or "xorg", it can _never_ be "native" at 
 the same time.
 ... except of course if we want it to be a _list_ of desired X11 
 implementations, which I doubt.