public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/31035] New: Library search path terminates on relative non-directory name
@ 2023-11-06 12:08 matthew.malcomson at arm dot com
  2023-11-16 14:10 ` [Bug libc/31035] " adhemerval.zanella at linaro dot org
  0 siblings, 1 reply; 2+ messages in thread
From: matthew.malcomson at arm dot com @ 2023-11-06 12:08 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31035

            Bug ID: 31035
           Summary: Library search path terminates on relative
                    non-directory name
           Product: glibc
           Version: 2.40
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: matthew.malcomson at arm dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Created attachment 15212
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15212&action=edit
Shell session demonstrating issue.

The function `open_path` in dl-load.c attempts to open a shared library in each
of the directories in a search path.

It skips any directories which have been found to not exist (updating those
with `unknown` to either `existing` or `nonexisting` as it continues).
If this function fails to open a file with an `errno` of ENOENT or EACCES it
continues, if it fails to open a file in an existing directory with any other
errno it bails.

Entries on a search path which point at a file (instead of a directory) trigger
an `open` fail with errno = ENOTDIR.
With absolute pathnames this is not a problem because the code block updating
whether directories exist checks whether the path is a directory.
With relative pathnames, `fillin_rpath` initialises the status to `existing` in
order to ensure such relative names are always inspected (because the current
directory does not change).

Hence a relative pathname pointing to a file instead of a directory triggers
`open_path` to ignore all successive entries in a search path.

Shell session demonstrating the issue is attached.
I guess one approach would be to add a check against ENOTDIR in the `open_path`
condition that checks against ENOENT and EACCES.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/31035] Library search path terminates on relative non-directory name
  2023-11-06 12:08 [Bug libc/31035] New: Library search path terminates on relative non-directory name matthew.malcomson at arm dot com
@ 2023-11-16 14:10 ` adhemerval.zanella at linaro dot org
  0 siblings, 0 replies; 2+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2023-11-16 14:10 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31035

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |2.39
            Version|2.40                        |2.39
         Resolution|---                         |FIXED
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg
             Status|UNCONFIRMED                 |RESOLVED
           Assignee|unassigned at sourceware dot org   |adhemerval.zanella at linaro dot o
                   |                            |rg

--- Comment #1 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Fixed on 2.39.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2023-11-16 14:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-06 12:08 [Bug libc/31035] New: Library search path terminates on relative non-directory name matthew.malcomson at arm dot com
2023-11-16 14:10 ` [Bug libc/31035] " adhemerval.zanella at linaro 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).