This is the mail archive of the gcc-patches@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]

Re: Don't try to execute directories


  In message <19990613062219.28286.qmail@daffy.airs.com>you write:
  > If you put `.' early in your PATH, and you run gcc in a binutils
  > object directory, then gcc will attempt to execute the ld directory
  > when doing a link.
  > 
  > This bug is easy to recreate, assuming ld is not in a special
  > directory which gcc searches first.  ld is in a special directory on
  > most Solaris systems, but on many systems, including most GNU/Linux
  > systems, ld is not in a special directory, so this bug will occur.
  > 
  > mkdir ld
  > export PATH=.:$PATH
  > echo 'int main() { }' > foo.c
  > gcc foo.c
  > 
  > It is possible to construct a somewhat different version of this bug
  > using the -B option:
  > 
  > mkdir as
  > echo 'int main() { }' > foo.c
  > gcc -B./ -c foo.c
  > 
  > or
  > 
  > mkdir ld
  > echo 'int main() { }' > foo.c
  > gcc -B./ foo.c
  > 
  > In general, when gcc searches for a file using a list of directories,
  > it will accept a directory as executable, even though it can not
  > actually be executed.  The shell does not make this mistake, and gcc
  > shouldn't either.
  > 
  > This patch fixes this shortcoming.
  > 
  > Ian
  > 
  > 
  > Sun Jun 13 02:09:43 1999  Ian Lance Taylor  <ian@zembu.com>
  > 
  > 	* gcc.c (access_check): New static function.
  > 	(find_a_file): Use it when searching a directory list.
  > 	* collect2.c (find_a_file): Don't accept directories found when
  > 	searching a directory list.
Thanks.  I installed this into the mainline sources.
jeff


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