NetBSD Problem Report #45266

From kre@munnari.OZ.AU  Thu Aug 18 10:12:43 2011
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 BF43B63B89A
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 18 Aug 2011 10:12:43 +0000 (UTC)
Message-Id: <201108181012.p7IACZsU001530@jade.coe.psu.ac.th>
Date: Thu, 18 Aug 2011 17:12:35 +0700 (ICT)
From: kre@munnari.OZ.AU
To: gnats-bugs@gnats.NetBSD.org
Subject: krb5-config causes namespace pollution (NetBSD 5, NetBSD 4, and probably HEAD)
X-Send-Pr-Version: 3.95

>Number:         45266
>Category:       pkg
>Synopsis:       krb5-config causes namespace pollution (NetBSD 5, NetBSD 4, and probably HEAD)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 18 10:15:00 +0000 2011
>Last-Modified:  Wed Nov 13 18:49:32 +0000 2019
>Originator:     Robert Elz
>Release:        NetBSD 5.1  (all current supported releases)
>Organization:
	Prince of Songkla University
>Environment:
System: NetBSD jade.coe.psu.ac.th 5.1 NetBSD 5.1 (JADE-1.12-20101117) #5: Wed Nov 17 05:30:55 ICT 2010 kre@jade.coe.psu.ac.th:/usr/obj/5.1/kernels/i386/JADE i386
Architecture: i386
Machine: i386
>Description:
	First, while I say this affects netBSD current, I don't have a
	build less than a few months old, so it is possible this has
	already been changed there, though I doubt it.

	/usr/bin/krb-config --cflags (on NetBSD 4* and NetBSD 5* and
		NetBSD current at least of last April) generates

		-I/usr/include/krb5

	That causes programs that use it (or more often, have it foist
	upon them) and which do

		#include <file>
	or	#include "file"

	to potentially find /usr/include/krb5/file instead of whatever
	they were intending to find.

	The only rational reason for ever doing -I of a sub-directory
	of /usr/include is when some subsystem wants to override the
	standard include files (for example, while I have no idea if
	it ever needs to, or does, I could imagine threads possibly doing
	that, with a different version of (perhaps) <resolv.h> for use
	by threaded programs),

	Aside from that, any program that wants to include something that
	is installed in a subdir of /usr/include should simply
		#include <subdir/file>

	That's the way it has always been for sys/* net/* netinet/* arpa/*
	and all the rest, and I cannot imagine why the krb5 directory needs
	to be different.  Certainly it doesn't include files that are
	overriding standard files in /usr/include - rather they're just
	polluting the namespace of programs that aren't expecting that
	stuff to exist.

	For an example of how this screwed things, see PR pkg/40198 (skip
	past the early bug report, and go down to the more recent part
	where this issue was the problem).

>How-To-Repeat:
	Run krb5-config --cflags and observe the output.

>Fix:
	Change krb5-config so it omits nothing with the --cflags option
	(the -I is currently the only output, and it is bogus).

	Then fix anything (should there be anything) that has stupidly
	depended upon this behaviour, to include <krb5/file> instead of
	just <file>.

>Release-Note:

>Audit-Trail:
From: "Roland C. Dowdeswell" <elric@imrryr.org>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: lib/45266: krb5-config causes namespace pollution (NetBSD 5,
 NetBSD 4, and probably HEAD)
Date: Wed, 24 Aug 2011 16:49:33 +0100

 On Thu, Aug 18, 2011 at 10:15:01AM +0000, kre@munnari.OZ.AU wrote:
 >

 I agree with the intent of this bug but third party code doesn't
 generally include <krb5/foo.h> because this has been a standard
 mistake in Kerberos distributions for over a decade.  We decided
 to put a number of ancilliary files from Heimdal into /usr/include/krb5
 but by default Heimdal doesn't, it just installs them into the
 include directory directly.

 Now, that said, this is unlikely to be a problem because we do have
 /usr/include/krb5.h and we have modified it and all of the other
 includes to include <krb5/foo.h> and so little would end up breaking
 if we made this change.

 This raises another issue that has bothered me about krb5-config
 which is:

 	$ krb5-config --libs
 	-L/usr/lib -lkrb5 -lhx509 -lcom_err -lcrypto -lasn1 -lwind -lroken <
 	-lcrypt -lpthread

 that it asks applications to directly link against all of the
 Kerberos libraries rather than just -lkrb5.  In a dynamic world,
 libkrb5.so will pull in all of the other libs---asking applications
 to directly link against them unnecessarily makes the names of all
 of the support libraries part of the ABI.

 --
     Roland Dowdeswell                      http://Imrryr.ORG/~elric/

From: christos@zoulas.com (Christos Zoulas)
To: "Roland C. Dowdeswell" <elric@imrryr.org>, gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org, 
	netbsd-bugs@netbsd.org
Subject: Re: lib/45266: krb5-config causes namespace pollution (NetBSD 5, NetBSD 4, and probably HEAD)
Date: Wed, 24 Aug 2011 12:03:38 -0400

 On Aug 24,  4:49pm, elric@imrryr.org ("Roland C. Dowdeswell") wrote:
 -- Subject: Re: lib/45266: krb5-config causes namespace pollution (NetBSD 5, 

 | I agree with the intent of this bug but third party code doesn't
 | generally include <krb5/foo.h> because this has been a standard
 | mistake in Kerberos distributions for over a decade.  We decided
 | to put a number of ancilliary files from Heimdal into /usr/include/krb5
 | but by default Heimdal doesn't, it just installs them into the
 | include directory directly.
 | 
 | Now, that said, this is unlikely to be a problem because we do have
 | /usr/include/krb5.h and we have modified it and all of the other
 | includes to include <krb5/foo.h> and so little would end up breaking
 | if we made this change.

 Yes, and try to make the world a better place by not perpetuating the
 problem. The problematic package can do -I/usr/include/krb5.

 | This raises another issue that has bothered me about krb5-config
 | which is:
 | 
 | 	$ krb5-config --libs
 | 	-L/usr/lib -lkrb5 -lhx509 -lcom_err -lcrypto -lasn1 -lwind -lroken <
 | 	-lcrypt -lpthread
 | 
 | that it asks applications to directly link against all of the
 | Kerberos libraries rather than just -lkrb5.  In a dynamic world,
 | libkrb5.so will pull in all of the other libs---asking applications
 | to directly link against them unnecessarily makes the names of all
 | of the support libraries part of the ABI.

 The whole thing is broken. This only adds a link path and not a run path,
 it adds -lpthread instead of issuing -pthread in CFLAGS. Well, if you wanted
 to make a static binary, you would need all those libs.

 christos

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/45266: krb5-config causes namespace pollution (NetBSD 5,
 NetBSD 4, and probably HEAD)
Date: Sun, 8 Jan 2012 21:51:30 +0000

 On Thu, Aug 18, 2011 at 10:15:01AM +0000, kre@munnari.OZ.AU wrote:
  > 	/usr/bin/krb-config --cflags (on NetBSD 4* and NetBSD 5* and
  > 		NetBSD current at least of last April) generates
  > 
  > 		-I/usr/include/krb5
  > 
  > 	That causes programs that use it (or more often, have it foist
  > 	upon them) and which do
  > 
  > 		#include <file>
  > 	or	#include "file"
  > 
  > 	to potentially find /usr/include/krb5/file instead of whatever
  > 	they were intending to find.

 This is also, it turns out, what's been breaking www/amaya in the bulk
 builds. It is finding krb5/base64.h instead of its own base64.h, so a
 bunch of necessary declarations are mysteriously missing.

 -- 
 David A. Holland
 dholland@netbsd.org

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45266 CVS commit: pkgsrc/www/amaya
Date: Sun, 8 Jan 2012 22:19:03 +0000

 Module Name:	pkgsrc
 Committed By:	dholland
 Date:		Sun Jan  8 22:19:03 UTC 2012

 Added Files:
 	pkgsrc/www/amaya: hacks.mk

 Log Message:
 Add a workaround for PR 45266 (krb5-config issue in NetBSD base):
 clear BUILDLINK_INCDIRS.heimdal. Otherwise -I/usr/include/krb5 appears
 in CFLAGS, which breaks the build because the compiler finds krb5's
 base64.h instead of Amaya's. krb5 is pulled in by curl, which is a
 several-times-indirect dependency, and nothing in this package uses
 it, or apparently anything that needs it, directly.


 To generate a diff of this commit:
 cvs rdiff -u -r0 -r1.1 pkgsrc/www/amaya/hacks.mk

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Steven Drake" <sbd@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45266 CVS commit: [pkgsrc-2011Q4] pkgsrc/www/amaya
Date: Mon, 9 Jan 2012 04:17:31 +0000

 Module Name:	pkgsrc
 Committed By:	sbd
 Date:		Mon Jan  9 04:17:31 UTC 2012

 Modified Files:
 	pkgsrc/www/amaya [pkgsrc-2011Q4]: distinfo
 Added Files:
 	pkgsrc/www/amaya [pkgsrc-2011Q4]: hacks.mk
 	pkgsrc/www/amaya/patches [pkgsrc-2011Q4]: patch-Amaya_amaya_HTMLedit_c
 	    patch-Amaya_thotlib_base_platform_c

 Log Message:
 Pullup ticket #3639 - requested by dholland
 www/amaya build fix

 Revisions pulled up:
 - www/amaya/distinfo                                            1.24
 - www/amaya/hacks.mk                                            1.1
 - www/amaya/patches/patch-Amaya_amaya_HTMLedit_c                1.1
 - www/amaya/patches/patch-Amaya_thotlib_base_platform_c         1.1

 ---
    Module Name:	pkgsrc
    Committed By:	dholland
    Date:		Sun Jan  8 22:15:21 UTC 2012

    Modified Files:
    	pkgsrc/www/amaya: distinfo
    Added Files:
    	pkgsrc/www/amaya/patches: patch-Amaya_amaya_HTMLedit_c
    	    patch-Amaya_thotlib_base_platform_c

    Log Message:
    Fix build problems with gcc 4.5. The code makes no sense so I'm not sure
    what I did is going to work... or that the code that was here previously
    ever worked or actually did what anyone upstream intended. C++ is fun
    that way.

 ---
    Module Name:	pkgsrc
    Committed By:	dholland
    Date:		Sun Jan  8 22:19:03 UTC 2012

    Added Files:
    	pkgsrc/www/amaya: hacks.mk

    Log Message:
    Add a workaround for PR 45266 (krb5-config issue in NetBSD base):
    clear BUILDLINK_INCDIRS.heimdal. Otherwise -I/usr/include/krb5 appears
    in CFLAGS, which breaks the build because the compiler finds krb5's
    base64.h instead of Amaya's. krb5 is pulled in by curl, which is a
    several-times-indirect dependency, and nothing in this package uses
    it, or apparently anything that needs it, directly.


 To generate a diff of this commit:
 cvs rdiff -u -r1.23 -r1.23.4.1 pkgsrc/www/amaya/distinfo
 cvs rdiff -u -r0 -r1.1.2.2 pkgsrc/www/amaya/hacks.mk
 cvs rdiff -u -r0 -r1.1.2.2 \
     pkgsrc/www/amaya/patches/patch-Amaya_amaya_HTMLedit_c \
     pkgsrc/www/amaya/patches/patch-Amaya_thotlib_base_platform_c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: lib-bug-people->pkg-manager
Responsible-Changed-By: maya@NetBSD.org
Responsible-Changed-When: Wed, 13 Nov 2019 18:49:32 +0000
Responsible-Changed-Why:
netbsd no longer ships a krb5-config, presumably deprecated by a pkgconfig file (which we don't ship...). the pkgsrc fake-krb5-config still does this, so moving to the pkg category.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.