Bug 3662

Summary: egcs-1.1.2: gcc seems to use direcory "ld" as linker
Product: [Retired] Red Hat Linux Reporter: schludi
Component: egcsAssignee: Cristian Gafton <gafton>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: caret, schludi
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-08-04 12:46:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description schludi 1999-06-23 09:13:52 UTC
this happens on redhat-6.0 with egcs-1.1.2-12 installed:

$ mkdir foo
$ cd foo
$ echo 'main(){return 0;}' > bar.c
$ /usr/bin/gcc -o bar bar.c
$ mkdir ld
$ /usr/bin/gcc -o bar bar.c
collect2: ld returned 33 exit status

Comment 1 Bill Nottingham 1999-06-23 14:37:59 UTC
Do you have the current directory in your path?

Comment 2 schludi 1999-06-24 05:51:59 UTC
yes, my PATH begins with ":". schludi

Comment 3 schludi 1999-06-24 06:02:59 UTC
Jeffrey A Law <law@cygnus.com> writes:

> Take "." out of your path.  Or at least put it at the end of your
> path.  You're
> a wonderful candidate for a trojan horse right now.
> jeff
I know that if PATH begins with ":", someone evil could do me some
harm. But this is what I want (as non-root user)!
If I say:

$ mkdir man
$ type man
man is /usr/bin/man

this is what I expect. Since the directory "man" is not an "program"
(though it has "x" bits) "type" ignores it. I think this is what gcc
should do when it searches for "ld".


Comment 4 Jim Kingdon 1999-07-24 17:43:59 UTC
One could argue that gcc should behave like "type" and ignore
directories, but I can't say I see a big problem with the
current behavior.

Comment 5 Jim Kingdon 1999-08-04 12:46:59 UTC
The good news is that this has been fixed in the GCC development
version (2.96; Ian Lance Taylor's change of 4 Aug 1999).  The bad
news is that this GCC won't ship with Red Hat Linux for a while,
due to C++ incompatibilities.

Comment 6 Jim Kingdon 1999-10-08 13:37:59 UTC
*** Bug 5647 has been marked as a duplicate of this bug. ***

If there is a directory called "ld" in the current
directory, and your PATH searches the current directory
before other directories, the command "gcc x.c -o x" fails
with: "collect2: ld returned 33 exit status".  The problem
probably exists on all architectures and may occur under
other circumstances.  I have only tested it on RH6.0 x86.
Found while trying to run configure in binutils.