make clean fails to rm /usr/src/contrib/groff/src/include/defs.h

Julian H. Stacey jhs at berklix.com
Mon May 17 23:21:12 UTC 2010


Hi Hackers,
I just filed a send-pr on a bug, if someone writes a fix, please send-pr to
	http://www.freebsd.org/cgi/query-pr.cgi?pr=146682	
No patch, sorry, about to travel.  Below a vebatim copy of what I sent.  
( It may need some discussion before a fix, hence I did not
CC hackers@ the send-pr mail, to keep send-pr web lean. )
-----------

>From jhs@@@berklix.com Tue May 18 00:46:06 2010
Date: Tue, 18 May 2010 00:43:54 +0200 (CEST)
Message-Id: <201005172243.o4HMhs8V051385@@@fire.js.berklix.net>
To: FreeBSD-gnats-submit@@@freebsd.org
Subject: make clean fails to rm /usr/src/contrib/groff/src/include/defs.h
From: "Julian H. Stacey" <jhs@@@berklix.com>
Reply-To: "Julian H. Stacey" <jhs@@@berklix.com>
Cc: jhs@@@berklix.com
X-send-pr-version: 3.113
X-GNATS-Notify: 


>Submitter-Id:	current-users
>Originator:	Julian H. Stacey
>Organization:	http://berklix.com BSD Linux Unix Consultancy, Munich/Muenchen.
>Confidential:	no 
>Synopsis:	make clean fails to rm /usr/src/contrib/groff/src/include/defs.h
>Severity:	serious 
>Priority:	medium 
>Category:	gnu
>Class:		sw-bug 
>Release:	FreeBSD 8.0-RELEASE amd64
>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
----------------

Cheers,
Julian
--
Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com
Mail plain text,  Not HTML quoted-printable Base64 http://www.asciiribbon.org


More information about the freebsd-hackers mailing list