PR_LoadLibrary picks up same named file on SHLIB_PATH even if a pathname is specified.

RESOLVED FIXED in 4.1.1

Status

defect
P2
normal
RESOLVED FIXED
19 years ago
19 years ago

People

(Reporter: wtc, Assigned: wtc)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Assignee

Description

19 years ago
This bug only affects HP-UX.  On HP-UX, PR_LoadLibrary calls
shl_load() with the DYNAMIC_PATH flag.  If an application is
linked with the +s linker option, the DYNAMIC_PATH flag of
shl_load() causes it to search for the shared library in some
search path, such as that specified by the SHLIB_PATH environment
variable.  However, the way shl_load(DYNAMIC_PATH) uses the
search path is very aggressive.  For example, if you have a
libfoo.sl on your SHLIB_PATH, all of the shl_load() calls below
will succeed (assuming none of the specified pathnames refer to
an existing file):
    shl_load("libfoo.sl", DYNAMIC_PATH|BIND_DEFERRED, 0);
    shl_load("./libfoo.sl", DYNAMIC_PATH|BIND_DEFERRED, 0);
    shl_load("../../lib/libfoo.sl", DYNAMIC_PATH|BIND_DEFERRED, 0);
    shl_load("/no/such/dir/libfoo.sl", DYNAMIC_PATH|BIND_DEFERRED, 0);
    shl_load("no/such/dir/libfoo.sl", DYNAMIC_PATH|BIND_DEFERRED, 0);

One would expect that only the first call should succeed, i.e.,
the dynamic library search path should be used only when a
plain file name, containing no directory, is specified.  Indeed,
this is the behavior of dlopen().

We should modify PR_LoadLibrary() to pass DYNAMIC_PATH
to shl_load() only if the specified name is a plain file name,
containing no directory, so that PR_LoadLibrary has the same
behavior across all platforms.
Assignee

Comment 1

19 years ago
Assignee

Updated

19 years ago
Status: NEW → ASSIGNED
Priority: -- → P2
Target Milestone: --- → 4.1.1
Assignee

Comment 2

19 years ago
I checked in the fix on the tip and NSPRPUB_RELEASE_4_1_BRANCH.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Assignee

Comment 3

19 years ago
*** Bug 65787 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.