This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/40548] New: If a dir on PATH contains a directory named "gcc", badness ensues


I have a directory on my PATH that contains a subdirectory named "gcc".  When I
run "gcc" (not fully-qualified) I get all sorts of very bizarre behavior.  For
example:

$ cat t.c
#include <limits.h>

$ mkdir gcc

$ PATH=.:$PATH gcc -E t.c >/dev/null
In file included from /tmp/t.c:1:
/usr/include/limits.h:125:26: error: no include path in which to search for
limits.h

But, if I don't have a local directory "gcc" then all is fine:

$ rmdir gcc
$ PATH=.:$PATH gcc -E t.c >/dev/null
$

If I use a fully-qualified path for GCC (/usr/bin/gcc) then it also does not
fail.

It looks to me like the test GCC performs when looking for itself through PATH
just checks for executability (if I have a non-executable file in a directory
on PATH this doesn't happen) but doesn't check for directory-ness.  This is
wrong, because the shell's PATH search algorithm DOES check for directory-ness
and skips directories that appear in directories on your PATH.


-- 
           Summary: If a dir on PATH contains a directory named "gcc",
                    badness ensues
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: psmith at gnu dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40548


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]