Bug 55387 - [build] [patch] user's LD_LIBRARY_PATH can interfere with buildworld due to a mismatch between base system and ports libraries
Summary: [build] [patch] user's LD_LIBRARY_PATH can interfere with buildworld due to a...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 4.8-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Bryan Drewery
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2003-08-08 17:30 UTC by William D. Colburn
Modified: 2022-10-17 12:35 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description William D. Colburn 2003-08-08 17:30:16 UTC
If I have built/installed openldap from /usr/ports/ and my
LD_LIBRARY_PATH has /usr/local/lib in front, then make buildworld will
die on compiling scp because it cannot find certain encyption symbols.
Sadly, I'm reporting this after-the-fact and I didn't save the errors.

My System at the time was as above, but it was 4.6-STABLE, and a GENERIC
kernel.

Fix: 

Not having /usr/local/lib in your LD_LIBRARY_PATH is one fix, but I
think that the /usr/src/ build tree shouldn't get confused by things in
/usr/local/lib.  It probably shouldn't be using the users
LD_LIBRARY_PATH at all.
How-To-Repeat: 
Go to /usr/ports and install openldap22.  Set LD_LIBRARY_PATH to have
/usr/local/lib in front.  Then go to /usr/src and try "make buildworld".
It will fail on scp.
Comment 1 William D. Colburn 2003-08-26 15:16:14 UTC
It is the first day of classes, and over the weekend our dorms filled up
with computers that had both worms and viruses.  So um, honestly, I
probably can't try this patch out any time soon.  Sorry.

On Thu, Aug 28, 2003 at 05:18:10PM +0300, Peter Pentchev wrote:
>Could you try the attached patch?  The first one is for -STABLE (the one
>referencing Makefile.inc1 rev. 1.141.2.63), the second one is for
>-CURRENT (Makefile.inc1 rev. 1.385).
>
>Offhand, I can't think of any reason for actually using the LD_LIBRARY_PATH
>value in the environment.  Of course, once we go down that road, there
>is LD_PRELOAD next, and then lots and lots of other environment variables
>influencing the compiler, the linker, make(1) itself, and whatnot, but
>still, IMHO LD_LIBRARY_PATH is indeed one variable that should be cleared.
>
>G'luck,
>Peter
>
>-- 
>Peter Pentchev	roam@ringlet.net    roam@sbnd.net    roam@FreeBSD.org
>PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
>Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
>I've heard that this sentence is a rumor.
>
>============== cut here for the patch to -STABLE
>
>Index: src/Makefile.inc1
>===================================================================
>RCS file: /home/ncvs/src/Makefile.inc1,v
>retrieving revision 1.141.2.63
>diff -u -r1.141.2.63 Makefile.inc1
>--- src/Makefile.inc1	12 Jul 2003 23:25:29 -0000	1.141.2.63
>+++ src/Makefile.inc1	28 Aug 2003 13:42:59 -0000
>@@ -181,12 +181,14 @@
> 		PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.00503 \
> 		GROFF_BIN_PATH=${WORLDTMP}/usr/bin \
> 		GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \
>-		GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac
>+		GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac \
>+		LD_LIBRARY_PATH=
> 
> # bootstrap-tool stage
> BMAKEENV=	MAKEOBJDIRPREFIX=${WORLDTMP} \
> 		DESTDIR= \
>-		INSTALL="sh ${.CURDIR}/tools/install.sh"
>+		INSTALL="sh ${.CURDIR}/tools/install.sh" \
>+		LD_LIBRARY_PATH=
> BMAKE=		${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
> 		-DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
> 		-DNO_WERROR
>@@ -194,7 +196,8 @@
> # build-tool stage
> TMAKEENV=	MAKEOBJDIRPREFIX=${OBJTREE} \
> 		DESTDIR= \
>-		INSTALL="sh ${.CURDIR}/tools/install.sh"
>+		INSTALL="sh ${.CURDIR}/tools/install.sh" \
>+		LD_LIBRARY_PATH=
> TMAKE=		${TMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING
> 
> # cross-tool stage
>
>====================== end of the patch for -STABLE
>
>====================== cut here for the patch for -CURRENT
>
>Index: src/Makefile.inc1
>===================================================================
>RCS file: /home/ncvs/src/Makefile.inc1,v
>retrieving revision 1.385
>diff -u -r1.385 Makefile.inc1
>--- src/Makefile.inc1	25 Aug 2003 18:30:06 -0000	1.385
>+++ src/Makefile.inc1	28 Aug 2003 13:51:26 -0000
>@@ -202,14 +202,16 @@
> 		CPUTYPE=${TARGET_CPUTYPE} \
> 		GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
> 		GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
>-		GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
>+		GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac \
>+		LD_LIBRARY_PATH=
> 
> # bootstrap-tools stage
> BMAKEENV=	DESTDIR= \
> 		INSTALL="sh ${.CURDIR}/tools/install.sh" \
> 		PATH=${BPATH}:${PATH} \
> 		WORLDTMP=${WORLDTMP} \
>-		MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
>+		MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
>+		LD_LIBRARY_PATH=
> BMAKE=		MAKEOBJDIRPREFIX=${WORLDTMP} \
> 		${BMAKEENV} ${MAKE} -f Makefile.inc1 \
> 		BOOTSTRAPPING=${OSRELDATE} \
>
>=========================== end of the patch for -CURRENT

--
William Colburn, "Sysprog" <wcolburn@nmt.edu>
Computer Center, New Mexico Institute of Mining and Technology
http://www.nmt.edu/tcc/     http://www.nmt.edu/~wcolburn
Comment 2 Peter Pentchev 2003-08-28 15:18:10 UTC
On Fri, Aug 08, 2003 at 10:23:33AM -0600, William D. Colburn (aka Schlake) wrote:
> 
> >Number:         55387
> >Category:       misc
> >Synopsis:       users LD_LIBRARY_PATH can interfere with mail buildworld
> >Arrival-Date:   Fri Aug 08 09:30:16 PDT 2003
> >Originator:     William D. Colburn (aka Schlake)
> >Release:        FreeBSD 4.8-STABLE i386
[snip]
> >Fix:
> 
> Not having /usr/local/lib in your LD_LIBRARY_PATH is one fix, but I
> think that the /usr/src/ build tree shouldn't get confused by things in
> /usr/local/lib.  It probably shouldn't be using the users
> LD_LIBRARY_PATH at all.

Could you try the attached patch?  The first one is for -STABLE (the one
referencing Makefile.inc1 rev. 1.141.2.63), the second one is for
-CURRENT (Makefile.inc1 rev. 1.385).

Offhand, I can't think of any reason for actually using the LD_LIBRARY_PATH
value in the environment.  Of course, once we go down that road, there
is LD_PRELOAD next, and then lots and lots of other environment variables
influencing the compiler, the linker, make(1) itself, and whatnot, but
still, IMHO LD_LIBRARY_PATH is indeed one variable that should be cleared.

G'luck,
Peter

-- 
Peter Pentchev	roam@ringlet.net    roam@sbnd.net    roam@FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
I've heard that this sentence is a rumor.

============== cut here for the patch to -STABLE

Index: src/Makefile.inc1
===================================================================
RCS file: /home/ncvs/src/Makefile.inc1,v
retrieving revision 1.141.2.63
diff -u -r1.141.2.63 Makefile.inc1
--- src/Makefile.inc1	12 Jul 2003 23:25:29 -0000	1.141.2.63
+++ src/Makefile.inc1	28 Aug 2003 13:42:59 -0000
@@ -181,12 +181,14 @@
 		PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.00503 \
 		GROFF_BIN_PATH=${WORLDTMP}/usr/bin \
 		GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \
-		GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac
+		GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac \
+		LD_LIBRARY_PATH=
 
 # bootstrap-tool stage
 BMAKEENV=	MAKEOBJDIRPREFIX=${WORLDTMP} \
 		DESTDIR= \
-		INSTALL="sh ${.CURDIR}/tools/install.sh"
+		INSTALL="sh ${.CURDIR}/tools/install.sh" \
+		LD_LIBRARY_PATH=
 BMAKE=		${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
 		-DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
 		-DNO_WERROR
@@ -194,7 +196,8 @@
 # build-tool stage
 TMAKEENV=	MAKEOBJDIRPREFIX=${OBJTREE} \
 		DESTDIR= \
-		INSTALL="sh ${.CURDIR}/tools/install.sh"
+		INSTALL="sh ${.CURDIR}/tools/install.sh" \
+		LD_LIBRARY_PATH=
 TMAKE=		${TMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING
 
 # cross-tool stage

====================== end of the patch for -STABLE

====================== cut here for the patch for -CURRENT

Index: src/Makefile.inc1
===================================================================
RCS file: /home/ncvs/src/Makefile.inc1,v
retrieving revision 1.385
diff -u -r1.385 Makefile.inc1
--- src/Makefile.inc1	25 Aug 2003 18:30:06 -0000	1.385
+++ src/Makefile.inc1	28 Aug 2003 13:51:26 -0000
@@ -202,14 +202,16 @@
 		CPUTYPE=${TARGET_CPUTYPE} \
 		GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
 		GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
-		GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
+		GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac \
+		LD_LIBRARY_PATH=
 
 # bootstrap-tools stage
 BMAKEENV=	DESTDIR= \
 		INSTALL="sh ${.CURDIR}/tools/install.sh" \
 		PATH=${BPATH}:${PATH} \
 		WORLDTMP=${WORLDTMP} \
-		MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
+		MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
+		LD_LIBRARY_PATH=
 BMAKE=		MAKEOBJDIRPREFIX=${WORLDTMP} \
 		${BMAKEENV} ${MAKE} -f Makefile.inc1 \
 		BOOTSTRAPPING=${OSRELDATE} \

=========================== end of the patch for -CURRENT
Comment 3 Alexander Best freebsd_committer freebsd_triage 2010-11-24 01:39:59 UTC
State Changed
From-To: open->feedback

We need to check whether LD_LIBRARY_PATH (and maybe LD_PRELOAD too) can still 
have an effect on TARGETS in /usr/src.
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2012-11-13 20:50:37 UTC
State Changed
From-To: feedback->open

feedback is the wrong state
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:41:48 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Comment 6 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:35:06 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>