Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 34741 - groff fails to set default papersize correctly
Summary: groff fails to set default papersize correctly
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All All
: High normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-29 22:56 UTC by Brandy Westcott (RETIRED)
Modified: 2004-10-02 23:29 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brandy Westcott (RETIRED) gentoo-dev 2003-11-29 22:56:27 UTC
When installing groff for the very first time it tries to guess the default
paper size. It does this by reading /etc/resolv.conf, or running domainname
and hostname in order to find the top-level domain. From GROFF_PAGE in aclocal.m4:

	# If the top-level domain is two letters and it's not `us' or `ca'
	# then they probably use A4 paper.

This means that many (or most?) users in the US or Canada end up with 'papersize a4'
rather than 'papersize letter' in /usr/share/groff/1.18.1/font/devps/DESC

Perhaps /etc/localtime could be used to determine where we are, then PAGE=a4
or PAGE=letter could be passed to configure? Or at least a pkg_postinst warning issued?
Comment 1 Seemant Kulleen (RETIRED) gentoo-dev 2003-12-11 15:12:11 UTC
eh? are you sure? I would think !us && !ca == a4 from that statement, which makes sense
Comment 2 Aron Griffis (RETIRED) gentoo-dev 2003-12-11 18:20:14 UTC
if (length(top-level) == 2 && top-level != 'us' && top-level != 'ca') {
   papersize = A4
}

That's what the comment says... makes sense to me!  That means that .com, .org, .net and .edu would default to letter.

/etc/localtime might be a better method, but not THAT much better.  Much better would be to have default papersize set in /etc/rc.conf and have packages inherit from there (preferably at run-time)
Comment 3 Brandy Westcott (RETIRED) gentoo-dev 2003-12-11 21:32:00 UTC
Ha! :)

I knew something screwy was going on with groff, but you've both made me look
for the reason why. The configure script *should* always be following the
above logic, but it doesn't always. 

I've noticed that those outside the US or Canada often default to letter
papersize on a first install, whilst those in the US or Canada default to A4
on each subsequent install. :/

When checking for a default papersize, the configure script first checks to
see if we already have a DESC file. Since we don't have this on the first
install, the the configure script then checks /etc/resolv.conf or runs
domainname/hostname in order to find the top-level domain:

	dom=`awk '($1 == "dom" || $1 == "search") { print $2; exit}' \
	    /etc/resolv.conf 2>/dev/null`
	if test -z "$dom"; then
		dom=`(domainname) 2>/dev/null | tr -d '+'`
		if test -z "$dom" \
		  || test "$dom" = '(none)'; then
			dom=`(hostname) 2>/dev/null | grep '\.'`
		fi
	fi

Since the domainname and hostname are set later on in the install process,
only parsing /etc/resolv.conf for occurences of 'dom' or 'search' may actually
produce usuable results.

Finally we check the top-level domain:

	case "$dom" in
	*.[Uu][Ss]|*.[Cc][Aa]) ;;
	*.[A-Za-z][A-Za-z]) PAGE=A4 ;;
	esac

This means the vast majority of people around the world will default to
'letter' papersize.

BUT, whenever we reinstall groff, there will be an DESC file that we can
check for paperlength and papersize: 

	if test -n "$descfile"; then
		if grep '^paperlength[	 ]\+841890' $descfile
		  >/dev/null 2>&1; then
			PAGE=A4
		elif grep '^papersize[	 ]\+[aA]4' $descfile \
		  >/dev/null 2>&1; then
			PAGE=A4
		fi
	fi

I think the missing "\" at the end of "if grep '^paperlength[	 ]\+841890'
$descfile" means everyone will now default to A4. :/
Comment 4 SpanKY gentoo-dev 2004-10-02 23:29:21 UTC
0.19.1 seems to have this fixed ...

     if test -n "$descfile"; then
       if grep '^paperlength[    ]\+841890' $descfile >/dev/null 2>&1; then
     PAGE=A4
       elif grep '^papersize[    ]\+[aA]4' $descfile >/dev/null 2>&1; then
     PAGE=A4
       fi