NetBSD Problem Report #42047

From kre@munnari.OZ.AU  Fri Sep 11 10:19:25 2009
Return-Path: <kre@munnari.OZ.AU>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 58F8663B877
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 11 Sep 2009 10:19:25 +0000 (UTC)
Message-Id: <200909111019.n8BAJGMF019370@jade.coe.psu.ac.th>
Date: Fri, 11 Sep 2009 17:19:16 +0700 (ICT)
From: kre@munnari.OZ.AU
To: gnats-bugs@gnats.NetBSD.org
Subject: lang/swi-prolog-packages demands X server to install
X-Send-Pr-Version: 3.95

>Number:         42047
>Category:       pkg
>Synopsis:       lang/swi-prolog-packages demands X server to install
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 11 10:20:01 +0000 2009
>Last-Modified:  Thu Sep 17 19:20:02 +0000 2009
>Originator:     Robert Elz
>Release:        NetBSD 4.0 / i386    pkgsrc current 2009-09-10
>Organization:
	Prince of Songkla University
>Environment:
System: NetBSD jade.coe.psu.ac.th 4.0_STABLE NetBSD 4.0_STABLE (JADE-1.696-20080517) #9: Fri May 23 18:55:13 ICT 2008 kre@jade.coe.psu.ac.th:/usr/obj/4/kernels/JADE i386
Architecture: i386
Machine: i386
>Description:
	To install lang/swi-prolog-packages apparently requires
	an existing running and usable X server.   That's absurd,
	any information from any X server cannot possibly be relevant
	or useful after the package is installed, nothing (including
	what resolutions, fonts, extensions, ...) that any X server
	might be able to convey at install time is to be expected to
	be even similar to the X server that would be used by any
	of the (possibly many different) users who use the installed
	package.

>How-To-Repeat:
	Create an environment without DISPLAY set, I use pkg_comp
	to achieve that (even if it had a DISPLAY setting, it would
	not have access to the auth files needed to allow access).

	Attempt to install (after successfully building)
	lang/swi-prolog-packages (swi-prolog-packages-5.6.17nb3)
	with DISPLAY unset.

	Expect to see ...

===> Installing for swi-prolog-packages-5.6.17nb3
=> Generating pre-install file lists
Error: Environment variable DISPLAY must be set
       and point to a connectible X server.
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/lang/swi-prolog-packages

>Fix:

>Audit-Trail:
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/42047: lang/swi-prolog-packages demands X server to install 
Date: Fri, 18 Sep 2009 02:19:25 +0700

     Date:        Fri, 11 Sep 2009 10:20:01 +0000 (UTC)
     From:        kre@munnari.oz.au
     Message-ID:  <20090911102001.558A763BC1D@www.NetBSD.org>

   | 	To install lang/swi-prolog-packages apparently requires
   | 	an existing running and usable X server.

 I have been looking more at this, and it seems as if it is
 purely pkgsrc that cares about that, it doesn't seem that
 an X server is really needed at all (though I'll need to do
 some more experimentation to be certain -- someone who actually
 knows how to use prolog might be needed to test things).

 Now to more idiocy in this package.

 First, the Makefile (pkgsrc/lang/swi-prolog-packages/Makefile)
 contains this gem:

 .if ${X11_TYPE} == "xorg"
 BUILD_DEPENDS+=         xorg-server-[0-9]*:../../x11/xorg-server
 .endif

 As best I can determine, the only (current) known values for
 X11_TYPE are "native" and "modular" - "xorg" is never going to
 be true.

 Now that's a good thing, as there also isn't anythng called
 xorg-server-* (any more) and nor is there a x11/xorg-server
 pkgsrc directory to build it from.

 But this gave me a hint for later...

 We also find:

 pre-install: checkforx

 This is what is insisting on there being an X server
 in order to install of course.

 And next ...

 # Based on misc/openoffice:
 DISPLAY?=       #empty, if unset
 checkforx:
 .if ${DISPLAY} == "" || ${DISPLAY_OK:!${X11BASE}/bin/xdpyinfo >/dev/null 2>&1 &&
  echo YES || echo NO!} == "NO"
 .  if exists(${X11BASE}/bin/Xvfb)
 	-${X11BASE}/bin/Xvfb :2 & \
 	${ECHO} $$! >${WRKDIR}/.Xvfb.pid
 	${ECHO} checkforx: Xvfb-PID: `${CAT} ${WRKDIR}/.Xvfb.pid`
 	sleep 5
 DISPLAY= :2
 .  else
 	/* and here is the error message in the original PR */

 So, it seems as if the package just needs an X server, any random
 X server - if Xvfb works, anything would do, that's clearly never
 going to emulate any real environment, its whole purpose is to
 be able to pretend to be all kinds of fake environments, and see
 how applications perform.

 Why the package doesn't simply unconditionally use it, instead of
 trying to use a real X server if there is one, I have no idea.
 Nor do I know how it manages to assume that DISPLAY=:2 is going
 to work, and isn't already occupied by some other server, but I
 guess that's a bit of a difficult problem.

 To attempt to solve this, I thought I know what it really wants
 here, so I just installed modular-xorg-server (which includes Xvfb)
 and let it run at that.

 That worked  (well the file-check test failed abismally, but that's
 because of when in the sequence of things I installed modular-xorg-server,
 swi-prolog-packages file-check test decided that all modular-xorg-server's
 file should have been in it's PLIST ...).

 At this point you might conclude that we now know a solution, but you're
 probably mistaken there, as there's one more salient fact that I
 haven't explicitly mentioned.

 That is, all I installed was modular-xorg-server - and an X server
 by itself, barren and alone, left to fend for itself without any
 parental guidance, and no safe nurturing environment, just won't
 survive very long.

 And this one didn't - one of the requirements for an X server to
 run (for reasons I never understood, but that's beside the point)
 is that it be able to find a font "fixed".   Notice that nowhere
 above did I say anything about installing an X fonts.   That's
 because I didn't.   Xvfb bitched a lot about all of the entries
 in its font path being invalid, then suicided when unable to find
 anything it could use as font "fixed".

 What's more all that happened while the Makefile fragment above was
 still in its "sleep 5".

 Before the package install actually started, the X server that
 the pkgsrc makefile claims is required (I could see no mention
 of that requirement anywhere in the package itself, but then again,
 I didn't look very hard) was gone, never to be seen again.

 Yet the package install actally seemed to work - there were a lot
 of file-check errors, but they all seemed to be extra files installed,
 and those all looked as if they would have been from the
 modular-xorg-server installation (I did not investigate thoroughly).

 I'm going to play a little more with this, if needed, next time I
 find a free hour or so, but anyone, please feel free to take
 a hatchet to this package and move it from its current state of
 total absurdity, somewhere closer to being real world functional.

 It is entirely possible that with X11_TYPE=native none of these
 errors would be observed, as it would have an Xvfb installed
 already, and almost certainly fonts to use, so the server would
 probably run, and then be killed when finished, and seemingly,
 all for no useful purpose at all.   But quietly...

 kre

 pe: thanks to David Holland for educating me, privately, on some
 plausible (sounding) reasons why an X server might be needed during
 a package build (probably during its configure).   I'm confident
 however that none of those reasons can possibly apply here.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.