public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/39278]  New: subdirectory named 'gcc' with parent in $PATH, before actual gcc executable in $PATH, is treated as executable
@ 2009-02-23 17:59 dickie at acm dot org
  2009-02-23 18:01 ` [Bug driver/39278] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: dickie at acm dot org @ 2009-02-23 17:59 UTC (permalink / raw)
  To: gcc-bugs

If gcc is invoked without an absolute path, and there is a *directory* named
'gcc' which can be found by searching $PATH before the actual gcc executable,
then that location is taken as a starting point for searching for includes. As
a result, standard include files such as stddef.h cannot be found.

In the following example, an empty directory named /home/gdickie/gcc is
created, and its parent /home/gdickie is placed into the search path. This
results in an automatically-generated option "-iprefix
/home/gdickie/../lib/gcc/i486-linux-gnu/4.3.2/", but this directory does not
actually exist.  

After the failure is a demonstration with /usr/bin added the front of the path,
which fixes the problem. Another way of fixing the problem is to invoke
/usr/bin/gcc with a full path.

src$ mkdir ~/gcc
src$ PATH=~:$PATH
src$ echo '#include <stddef.h>' > test.c
src$ gcc -v -save-temps -c test.c
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release
--build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mtune=generic'
 /usr/lib/gcc/i486-linux-gnu/4.3.2/cc1 -E -quiet -v -iprefix
/home/gdickie/../lib/gcc/i486-linux-gnu/4.3.2/ test.c -D_FORTIFY_SOURCE=2
-mtune=generic -fpch-preprocess -o test.i
ignoring nonexistent directory
"/home/gdickie/../lib/gcc/i486-linux-gnu/4.3.2/include"
ignoring nonexistent directory
"/home/gdickie/../lib/gcc/i486-linux-gnu/4.3.2/include-fixed"
ignoring nonexistent directory
"/home/gdickie/../lib/gcc/i486-linux-gnu/4.3.2/../../../../i486-linux-gnu/include"
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory
"/home/gdickie/../lib/gcc/../../lib/gcc/i486-linux-gnu/4.3.2/include"
ignoring nonexistent directory
"/home/gdickie/../lib/gcc/../../lib/gcc/i486-linux-gnu/4.3.2/include-fixed"
ignoring nonexistent directory
"/home/gdickie/../lib/gcc/../../lib/gcc/i486-linux-gnu/4.3.2/../../../../i486-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/include
End of search list.
test.c:1:20: error: stddef.h: No such file or directory
src$ cat test.i
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test.c"
src$ 

src$ PATH=/usr/bin:$PATH
src$ gcc -v -save-temps -c test.c
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release
--build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mtune=generic'
 /usr/lib/gcc/i486-linux-gnu/4.3.2/cc1 -E -quiet -v test.c -D_FORTIFY_SOURCE=2
-mtune=generic -fpch-preprocess -o test.i
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../i486-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.3.2/include
 /usr/lib/gcc/i486-linux-gnu/4.3.2/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mtune=generic'
 /usr/lib/gcc/i486-linux-gnu/4.3.2/cc1 -fpreprocessed test.i -quiet -dumpbase
test.c -mtune=generic -auxbase test -version -fstack-protector -o test.s
GNU C (Ubuntu 4.3.2-1ubuntu12) version 4.3.2 (i486-linux-gnu)
        compiled by GNU C version 4.3.2, GMP version 4.2.2, MPFR version 2.3.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 9ecd6562c106044a1f3a6d56a4b5859b
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mtune=generic'
 as -V -Qy -o test.o test.s
GNU assembler version 2.18.93 (i486-linux-gnu) using BFD version (GNU Binutils
for Ubuntu) 2.18.93.20081009
COMPILER_PATH=/usr/lib/gcc/i486-linux-gnu/4.3.2/:/usr/lib/gcc/i486-linux-gnu/4.3.2/:/usr/lib/gcc/i486-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.3.2/:/usr/lib/gcc/i486-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.3.2/:/usr/lib/gcc/i486-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/i486-linux-gnu/4.3.2/:/usr/lib/gcc/i486-linux-gnu/4.3.2/:/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mtune=generic'
src$


-- 
           Summary: subdirectory named 'gcc' with parent in $PATH, before
                    actual gcc executable in $PATH, is treated as executable
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dickie at acm dot org
 GCC build triplet: 4.3.2
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug driver/39278] subdirectory named 'gcc' with parent in $PATH, before actual gcc executable in $PATH, is treated as executable
  2009-02-23 17:59 [Bug driver/39278] New: subdirectory named 'gcc' with parent in $PATH, before actual gcc executable in $PATH, is treated as executable dickie at acm dot org
@ 2009-02-23 18:01 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-02-23 18:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2009-02-23 18:01 -------


*** This bug has been marked as a duplicate of 38966 ***

*** This bug has been marked as a duplicate of 38966 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-23 18:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-23 17:59 [Bug driver/39278] New: subdirectory named 'gcc' with parent in $PATH, before actual gcc executable in $PATH, is treated as executable dickie at acm dot org
2009-02-23 18:01 ` [Bug driver/39278] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).