pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/33870: obfuscated code in bsd.prefs.mk regarding X11_TYPE



The following reply was made to PR pkg/33870; it has been noted by GNATS.

From: Roland Illig <rillig%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: pkg/33870: obfuscated code in bsd.prefs.mk regarding X11_TYPE
Date: Fri, 30 Jun 2006 06:57:39 +0200

 bad%bsd.de@localhost 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 
 variables.
 
 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.
 
 Roland
 



Home | Main Index | Thread Index | Old Index