From jhs@berklix.com  Mon May 17 22:45:33 2010
Return-Path: <jhs@berklix.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 971B91065670
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 17 May 2010 22:45:33 +0000 (UTC)
	(envelope-from jhs@berklix.com)
Received: from tower.berklix.org (tower.berklix.org [83.236.223.114])
	by mx1.freebsd.org (Postfix) with ESMTP id 356708FC1C
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 17 May 2010 22:45:32 +0000 (UTC)
Received: from park.js.berklix.net (p549A45E9.dip.t-dialin.net [84.154.69.233])
	(authenticated bits=0)
	by tower.berklix.org (8.14.2/8.14.2) with ESMTP id o4HMihUR033841;
	Mon, 17 May 2010 22:44:53 GMT
	(envelope-from jhs@berklix.com)
Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41])
	by park.js.berklix.net (8.13.8/8.13.8) with ESMTP id o4HMiIeB024124;
	Tue, 18 May 2010 00:44:35 +0200 (CEST)
	(envelope-from jhs@berklix.com)
Received: from fire.js.berklix.net (localhost [127.0.0.1])
	by fire.js.berklix.net (8.14.3/8.14.3) with ESMTP id o4HMi58h052940;
	Tue, 18 May 2010 00:44:10 +0200 (CEST)
	(envelope-from jhs@fire.js.berklix.net)
Received: (from jhs@localhost)
	by fire.js.berklix.net (8.14.3/8.14.3/Submit) id o4HMhs8V051385;
	Tue, 18 May 2010 00:43:54 +0200 (CEST)
	(envelope-from jhs)
Message-Id: <201005172243.o4HMhs8V051385@fire.js.berklix.net>
Date: Tue, 18 May 2010 00:43:54 +0200 (CEST)
From: "Julian H. Stacey" <jhs@berklix.com>
Reply-To: "Julian H. Stacey" <jhs@berklix.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: jhs@berklix.com
Subject: make clean fails to rm /usr/src/contrib/groff/src/include/defs.h
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         146682
>Category:       gnu
>Synopsis:       [build] make clean fails to rm /usr/src/contrib/groff/src/include/defs.h
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 17 22:50:04 UTC 2010
>Closed-Date:    
>Last-Modified:  Wed Aug 04 03:31:04 UTC 2010
>Originator:     Julian H. Stacey
>Release:        FreeBSD 8.0-RELEASE amd64
>Organization:
http://berklix.com BSD Linux Unix Consultancy, Munich/Muenchen.
>Environment:
System: FreeBSD fire.js.berklix.net 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Wed Apr 21 10:27:18 CEST 2010 jhs@fire.js.berklix.net:/usr1/src/sys/amd64/compile/FIRE64.small2 amd64


	
>Description:
There is a bug in groff. Description & manual fix below.
/usr/src/gnu/usr.bin/groff Makefiles should deal with these issues:
	/usr/src/contrib/groff/src/include/defs.h
	What creates it ?  (ports?)
	Should it be removed by make clean.
	Should it be in /usr/obj not /usr/src
	What about a /usr/src mounted read only.

The Problem: {
  If you accidentally (**) create
	/usr/src/contrib/groff/src/include/defs.h
  A make clean fails to remove defs.h. A make compiles all these executables
    grn grodvi groff grolbp grolj4 grops grotty post-grohtml pre-grohtml troff
  with a non existant font paths in /usr/local (instead of, not as
  well as, base fonts in /usr/share/groff_font ).
  groff fails, so man fails & make world fails.
  Tests if system affected:
    ls -l /usr/src/contrib/groff/src/include/defs.h
    echo hallo > ~/tmp/dummy.rof ; groff ~/tmp/dummy.rof | head -2
	groff: can't find `DESC' file
	groff:fatal error: invalid device `ps'
  To see failing paths:
    A good binary will return nothing on next command:
    strings /usr/bin/groff | grep local | grep -v setlocale
      /usr/local/bin
      /usr/local/share/groff/site-font:\
		/usr/local/share/groff/1.19.2/font:/usr/lib/font
    cd /usr/bin; grep -l share/groff/site-font *
	grn grodvi groff grolbp grolj4 grops grotty post-grohtml
	pre-grohtml troff
    truss groff ~/tmp/dummy.rof
      open("/usr/local/share/groff/site-font/devps/DESC",
	O_RDONLY,0666) ERR#2 'No such file or directory'
      open("/usr/local/share/groff/1.19.2/font/devps/DESC",
	O_RDONLY,0666) ERR#2 'No such file or directory'
      open("/usr/lib/font/devps/DESC",
	O_RDONLY,0666)	       ERR#2 'No such file or directory'
    A good system should just have:
      open("/usr/share/groff_font/devps/DESC",O_RDONLY,0666) = 2 (0x2)
  cd /usr/src/contrib/groff/src/include
  l defs.h	# 541 Apr 27 23:37 defs.h
  grep local defs.h	# See full file at end of mail.
  cd /usr/obj/usr/src ; Grep groff/site-font | sort # Binary file
	gnu/usr.bin/groff/src/devices/grodvi/grodvi
	gnu/usr.bin/groff/src/devices/grohtml/post-grohtml
	gnu/usr.bin/groff/src/devices/grolbp/grolbp
	gnu/usr.bin/groff/src/devices/grolj4/grolj4
	gnu/usr.bin/groff/src/devices/grops/grops
	gnu/usr.bin/groff/src/devices/grotty/grotty
	gnu/usr.bin/groff/src/preproc/grn/grn
	gnu/usr.bin/groff/src/preproc/html/pre-grohtml
	gnu/usr.bin/groff/src/roff/groff/groff
	gnu/usr.bin/groff/src/roff/troff/troff
	gnu/usr.bin/groff/doc/groff.info
  A better /usr/obj has just:
    Grep groff/site-font | sort
	Binary file ./usr/src/gnu/usr.bin/groff/doc/groff.info matches
  }

How The Problem Arose: {
  I'm not sure how defs.h got created on my system
    cd /var/db/pkg ls | wc		# 652	  652	11818
    uname -a
      FreeBSD fire.js.berklix.net 8.0-RELEASE FreeBSD 8.0-RELEASE #0:
      Wed Apr 21 10:27:18 CEST 2010
      jhs@fire.js.berklix.net:/usr1/src/sys/amd64/compile/FIRE64.small2  amd64
  defs.h did not get created when I ran a make world within a chroot.
  }

A Lot Of People Have Been Caught Over Time: {
  Not perhaps a lot of FreeBSD people, though some, but this
  groff path problem & too cryptic error message has catching people
  for years on many architectures, eg paste this into google:
	groff: can't find `DESC' file FreeBSD
  & get this URL:
	http://www.google.de/#hl=de&q=groff%3A+can%27t+find+%60DESC%27+file+FreeBSD&aq=f&aqi=&aql=&oq=&gs_rfai=&fp=d778669e1739683f
  }

The too cryptic errors that give no clue which path fails:
  /usr/src/contrib/groff/src/libs/libgroff/font.cpp	can't find `DESC' file
  /usr/src/contrib/groff/src/roff/groff/groff.cpp	invalid device

A manual work round a broken system might be possible via:
	export GROFF_FONT_PATH=/usr/share/groff_font
	export GROFF_TMAC_PATH=/usr/share/tmac
But to recover I did:
	cd /usr/src/contrib/groff/src/include ; mv defs.h defs.h.MV
	cd /usr/src;make clean;make -k;make -k install;make;make install

>How-To-Repeat:
	Not sure what first accidentally created my
	/usr/src/contrib/groff/src/include/defs.h
	But fill it with this, the run a cd /usr/src; make install ; man man
	--------
#define PROG_PREFIX ""
#define DEVICE "ps"
#define INSTALLPATH "/usr/local"
#define BINPATH "/usr/local/bin"
#define FONTPATH "/usr/local/share/groff/site-font:/usr/local/share/groff/1.19.2/font:/usr/lib/font"
#define MACROPATH "/usr/local/lib/groff/site-tmac:/usr/local/share/groff/site-tmac:/usr/local/share/groff/1.19.2/tmac"
#define INDEX_SUFFIX ".i"
#define COMMON_WORDS_FILE "/usr/local/share/groff/1.19.2/eign"
#define DEFAULT_INDEX_DIR "/usr/dict/papers"
#define DEFAULT_INDEX_NAME "Ind"
#define DEFAULT_INDEX "/usr/dict/papers/Ind"
	--------
>Fix:
I have not written a patch for send-pr as I am about to travel,
I hope others may want to work up a patch to submit via send-pr

Hopefully someone can fix this. If not, in a month maybe I may write
a patch & send-pr it & put a copy here
http://berklix.com/~jhs/src/bsd/fixes/FreeBSD/src/gen/contrib/groff/src/include/defs.h.send-pr
>Release-Note:
>Audit-Trail:
>Unformatted:
