Closed Bug 253747 Opened 15 years ago Closed 15 years ago

ComponentLoader will try to load incompatible library files if present

Categories

(Core :: XPCOM, defect)

defect
Not set

Tracking

()

RESOLVED WONTFIX

People

(Reporter: alex, Assigned: dougt)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1

In xpcom/components/nsNativeComponentLoader.cpp there is a list of
ValidDllExtensions which includes, .dll, .so etc. If the component directory
contains files which are incompatible with the given platform (like .so files on
Windows), the loader will try to load them anyway and give ugly error
messages/windows. 

Can #ifdef(s) be added checking for build platform and making sure that .so
files are gracefully ignored on Windows, .dll files are ignored on Linux etc?

The problem I am trying to solve is multi-platform extension installation on
Firefox (separate bug #253742 -
http://bugzilla.mozilla.org/show_bug.cgi?id=253742), which would have been
easily solvable if the Loader just ignored non compatible dynamic libraries. The
extension intalls the files for all the platforms, and the browser ignores the
files it cannot use.

Reproducible: Always
Steps to Reproduce:
1. Create an extension (Firfox) with a components directory which includes a .so
file 
2. Install it on Windows.
(*) Alternatively, register this component directory using any other way.
2. Restart the browser
Actual Results:  
The browser tries to load the .so file as .dll, gives "The application or Dll
xxxxx.so is not a valid Windows image" popup error.


Expected Results:  
The browser ignores the .so file, no error messages are displayed (maybe a
warning is logged somewhere). 
The same for Linux with .dll file.
> The extension intalls the files for all the platforms

How exactly do you propose to do this so it works on both Linux/i386 and
Linux/ppc?  Not to mention Solaris, Irix, etc, etc.
(In reply to comment #1)
> > The extension intalls the files for all the platforms
> 
> How exactly do you propose to do this so it works on both Linux/i386 and
> Linux/ppc?  Not to mention Solaris, Irix, etc, etc.

Well, I didn't really mean all platforms. But there are simple scenarios in
which only Windows/i386+Linux/i386 are supported. More complex scenarios with
several different .so versions for different Unix platforms should be handled by
separate extension packages or more complex install scripts.

My point is - as far as I know - there is no case in which .so file should be
loaded as .dll on windows, and .dll file loaded as .so on Unix. So, IMHO, the
loader shouldn't even attempt these (and similar) combinations. 
Also, if it does try to load something illegal (the user installed the wrong
version), it should fail gracefully and not display a "...Bad Image...Please
check this against your installation diskette..." windows dialog that doesn't
give anything useful to the user.



Status: UNCONFIRMED → NEW
Ever confirmed: true
the ugly error dialogs are going away on their own.
This cannot be fixed on the basis of file extensions, and a simplified
Win/Mac/Linux distinction won't bring us forward. The multi-platform extension
scenario is covered by bug 253742.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.