From owner-freebsd-bugs@FreeBSD.ORG Wed Jun 18 19:40:17 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 67C0F37B401 for ; Wed, 18 Jun 2003 19:40:17 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5B92143FDD for ; Wed, 18 Jun 2003 19:40:15 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h5J2eFUp011759 for ; Wed, 18 Jun 2003 19:40:15 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h5J2eFGN011758; Wed, 18 Jun 2003 19:40:15 -0700 (PDT) Resent-Date: Wed, 18 Jun 2003 19:40:15 -0700 (PDT) Resent-Message-Id: <200306190240.h5J2eFGN011758@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Geoff Morrison Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EFF2037B401 for ; Wed, 18 Jun 2003 19:31:42 -0700 (PDT) Received: from gm.kur.la (12-233-34-102.client.attbi.com [12.233.34.102]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0A41043FB1 for ; Wed, 18 Jun 2003 19:31:42 -0700 (PDT) (envelope-from gm@gm.kur.la) Received: from lt.dom (localhost [127.0.0.1]) by lt.dom (8.12.9/8.12.9) with ESMTP id h5J2O783024019 for ; Wed, 18 Jun 2003 19:24:08 -0700 (PDT) (envelope-from gm@localhost.dom) Received: (from gm@localhost) by lt.dom (8.12.9/8.12.9/Submit) id h5J2O7UP024018; Wed, 18 Jun 2003 19:24:07 -0700 (PDT) (envelope-from gm) Message-Id: <200306190224.h5J2O7UP024018@lt.dom> Date: Wed, 18 Jun 2003 19:24:07 -0700 (PDT) From: Geoff Morrison To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: gnu/53476: [patch] gcc improperly handles GCC_EXEC_PREFIX (FreeBSD specific) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Geoff Morrison List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jun 2003 02:40:17 -0000 >Number: 53476 >Category: gnu >Synopsis: [patch] gcc improperly handles GCC_EXEC_PREFIX (FreeBSD specific) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jun 18 19:40:14 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Geoff Morrison >Release: FreeBSD 5.1-CURRENT i386 >Organization: >Environment: System: FreeBSD lt.dom 5.1-CURRENT FreeBSD 5.1-CURRENT #5: Tue Jun 17 07:23:48 PDT 2003 root@lt.dom:/usr/obj/usr/src/sys/LAPTOP i386 Sources from June 17 02:00 PDT GCC version 3.2.2 [FreeBSD] 20030205 (release) >Description: gcc allows the user to specify an alternate location to search for its subprograms (cpp, cc1, as, ld, and so on) by using the -B flag to gcc or by setting the GCC_EXEC_PREFIX environment variable. The manpage states that gcc uses the -B argument, then the GCC_EXEC_PREFIX environment variable, then the standard prefixes. Internally, these prefixes are added to exec_prefixes with the add_prefix function, which takes a priority as an argument. For most invocations, this argument is PREFIX_PRIORITY_LAST; for the invocation that uses the -B flag, the priority is PREFIX_PRIORITY_B_OPT. In the FreeBSD specific code that adds PREFIX/bin (normally /usr/bin) to exec_prefixes, this argument is set to 0. This value is (1) bogus, since all other invocations of add_prefix use one of the PREFIX_PRIORITY_* fields (which are defined in enum path_prefix_priority); and (2) wrong, since it causes /usr/bin to be searched before the value specified in GCC_EXEC_PREFIX. The -B flag is handled correctly. >How-To-Repeat: gm@lt ~ % unset GCC_EXEC_PREFIX gm@lt ~ % gcc --print-search-dirs install: /usr/libexec/(null) programs: =/usr/bin/:/usr/libexec/ libraries: =/usr/lib/ gm@lt ~ % GCC_EXEC_PREFIX=/tmp gcc --print-search-dirs install: /usr/libexec/(null) programs: =/usr/bin/:/tmp/:/usr/libexec/ libraries: =/tmp:/usr/lib/ The second invocation should read: programs: =/tmp/:/usr/bin/:/usr/libexec/ >Fix: Index: gcc.c =================================================================== RCS file: /home/ncvs/src/contrib/gcc/gcc.c,v retrieving revision 1.35 diff -u -r1.35 gcc.c --- gcc.c 10 Feb 2003 06:03:16 -0000 1.35 +++ gcc.c 19 Jun 2003 01:05:46 -0000 @@ -3852,7 +3852,7 @@ as well as trying the machine and the version. */ #ifdef FREEBSD_NATIVE add_prefix (&exec_prefixes, PREFIX"/bin/", "BINUTILS", - 0, 0, warn_std_ptr, 0); + PREFIX_PRIORITY_LAST, 0, warn_std_ptr, 0); #endif /* FREEBSD_NATIVE */ #ifndef OS2 add_prefix (&exec_prefixes, standard_exec_prefix, "GCC", >Release-Note: >Audit-Trail: >Unformatted: