public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/38966]  New: libiberty make_relative_prefix_1 mistakes directories for executables
@ 2009-01-25 14:55 mmlr at mlotz dot ch
  2009-01-25 14:56 ` [Bug other/38966] " mmlr at mlotz dot ch
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: mmlr at mlotz dot ch @ 2009-01-25 14:55 UTC (permalink / raw)
  To: gcc-bugs

When GCC tries to resolve paths to executables it generates an exec prefix
based on argv[0]. It does that using the make_relative_prefix_1 function in
libiberty (make-relative-prefix.c). If argv[0] doesn't contain a path (i.e. it
only reads "gcc"), make_relative_prefix_1 searches the PATH to find the full
path to the current executable.

When checking candidates however, it only checks the executable bit to
determine whether or not it found the current executable. This means that when
there is a directory with the same name as the executable in the PATH, this
mechanism will produce a wrong prefix.

Attached is a patch that uses stat to determine whether the candidate file is a
regular file at all, hence skipping directories.


-- 
           Summary: libiberty make_relative_prefix_1 mistakes directories
                    for executables
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mmlr at mlotz dot ch
  GCC host triplet: i586-pc-haiku
GCC target triplet: i586-pc-haiku


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


^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <bug-38966-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2012-08-16 13:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-25 14:55 [Bug other/38966] New: libiberty make_relative_prefix_1 mistakes directories for executables mmlr at mlotz dot ch
2009-01-25 14:56 ` [Bug other/38966] " mmlr at mlotz dot ch
2009-01-26 19:24 ` pinskia at gcc dot gnu dot org
2009-01-26 19:47 ` dj at redhat dot com
2009-01-27  1:23 ` mmlr at mlotz dot ch
2009-02-23 18:01 ` pinskia at gcc dot gnu dot org
2009-02-24  1:17 ` howarth at nitro dot med dot uc dot edu
2009-02-24 17:16 ` mmlr at mlotz dot ch
2009-06-25  1:25 ` pinskia at gcc dot gnu dot org
     [not found] <bug-38966-4@http.gcc.gnu.org/bugzilla/>
2012-08-15 21:33 ` ttignor at us dot ibm.com
2012-08-15 21:36 ` ttignor at us dot ibm.com
2012-08-16  6:59 ` jakub at gcc dot gnu.org
2012-08-16 13:00 ` ttignor at us dot ibm.com

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).