Closed
Bug 416119
Opened 17 years ago
Closed 17 years ago
js-ctypes doesn't open shared library when using Linux
Categories
(Core :: js-ctypes, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: nossralf, Unassigned)
Details
Attachments
(2 files, 1 obsolete file)
801 bytes,
patch
|
Details | Diff | Splinter Review | |
1.13 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b4pre) Gecko/2008020504 Minefield/3.0b4pre
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b3pre) Gecko/2008013122 Minefield/3.0b3pre
When trying to open a shared library using js-ctypes in Linux, the open() method returns/throws NS_ERROR_FAILURE.
Reproducible: Always
Steps to Reproduce:
1.Compile Firefox with js-ctypes as an extension.
2.Try opening a shared library file (in an extension or similar).
Actual Results:
NS_ERROR_FAILURE is returned/thrown.
Expected Results:
The shared library is loaded.
This is due to the way the PRLibSpec struct is filled out in nsNativeTypes::Open. The |libSpec.value.pathname_u = ...| assignment only works under Win32 as can be seen in prlink.c.
Reporter | ||
Comment 1•17 years ago
|
||
This patch fixes the problem for me. It's fairly straight-forward, although since I'm new at this thing (especially the Mozilla string classes) there may be a shorter way of doing it.
Also, I'm not 100% sure that dlopen() groks UTF-8 so it's possible the conversion has to be the lossy one from UTF-16 to ASCII. (From what I've been able to find, it doesn't seem to mind being fed UTF-8.)
Also, the patch isn't -u8p since svn diff kinda sucks.
Reporter | ||
Comment 2•17 years ago
|
||
The copy was most likely completely unnecessary (aName being an in parameter). This works too, and is probably more correct.
Sorry for the bug spam. I still have the training wheels on my bug-fixin' bike.
Attachment #301890 -
Attachment is obsolete: true
Reporter | ||
Comment 3•17 years ago
|
||
I may be breaking the record for most patch revisions for a 6-line addition. I deserve a medal. And cake.
Anyway, this one only uses ns[C]AutoString, and gets rid of the original nsString line, which is bad stack mojo according to the string literature.
I'll shut up now.
Attachment #301909 -
Attachment is obsolete: true
Reporter | ||
Updated•17 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•17 years ago
|
Attachment #301909 -
Attachment is obsolete: false
Comment 4•17 years ago
|
||
Bug 397248 pointed out a problem with not using a local string so I used patch 2 instead of patch 3.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Updated•15 years ago
|
Product: Other Applications → Core
You need to log in
before you can comment on or make changes to this bug.
Description
•