Closed Bug 351510 Opened 18 years ago Closed 18 years ago

Remove USE_MOZ_THREAD code from mozilla/security/lib/jar

Categories

(NSS :: Tools, defect, P3)

3.11
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

Details

Attachments

(1 file, 2 obsolete files)

As per bug #337361 comment #3, the usage of USE_MOZ_THREAD preprocessor macro should be removed from mozilla/security/lib/jar.  The code must be tested to make sure the new code works the same as the old code, except for using the "mozilla" thread to run code using the NSS cert DB (see also bug #337361 comment #6.)
Attached patch Remove usage of USE_MOZ_THREAD (obsolete) — Splinter Review
This patch removes usage of USE_MOZ_THREAD from jarver.c and jarsign.c.  It seems that with this patch, the jarevil.h and jarevil.c files won't be necessary any more.  Can someone confirm this, please?  Look at the following (after applying this patch):

akhgari@AKHGARI /cygdrive/e/mozilla
$ grep -rn jarevil *
security/nss/lib/jar/CVS/Entries:7:/jarevil.c/1.8/Sun Apr 25 15:03:11 2004//TNSS_3_11_20060831_TAG
security/nss/lib/jar/CVS/Entries:8:/jarevil.h/1.3/Sun Apr 25 15:03:11 2004//TNSS_3_11_20060831_TAG
security/nss/lib/jar/jarevil.c:52:#include "jarevil.h"
security/nss/lib/jar/jarevil.h:38: *  jarevil.h
security/nss/lib/jar/manifest.mn:49:    jarevil.c \
Attachment #236924 - Flags: superreview?(alexei.volkov.bugs)
Attachment #236924 - Flags: review?(nelson)
Accepting this bug (shouldn't assigning it to myself have changed its status to ASSIGNED?)
Status: NEW → ASSIGNED
Comment on attachment 236924 [details] [diff] [review]
Remove usage of USE_MOZ_THREAD

r=nelsonb
Attachment #236924 - Flags: review?(nelson) → review+
Ehsan,  In answer to your question, yes, this patch obviates jarevil.*
and The patch should also remove any mention of jarevil.h or jarevil.c
from the manifest.mn file.  When this patch is committed, we can "cvs 
remove" the two jarevil files, making libJAR less evil.  :)

I think the next step is to run a memory leak checking tool on signtool
to find any leaks in libJAR.  I expect there are lots.

Thanks for your patch.
(In reply to comment #4)
> Ehsan,  In answer to your question, yes, this patch obviates jarevil.*
> and The patch should also remove any mention of jarevil.h or jarevil.c
> from the manifest.mn file.  When this patch is committed, we can "cvs 
> remove" the two jarevil files, making libJAR less evil.  :)

OK, I'll post a new patch with the corrected manifest.mn file in a moment.

> I think the next step is to run a memory leak checking tool on signtool
> to find any leaks in libJAR.  I expect there are lots.

What tools are used in the Mozilla community for this purpose?
This patch removed jarevil.c reference from manifest.mn.  Other than that, it's identical to the previous one (attachment #236924 [details] [diff] [review]).
Attachment #236924 - Attachment is obsolete: true
Attachment #237303 - Flags: superreview?(alexei.volkov.bugs)
Attachment #237303 - Flags: review?(nelson)
Attachment #236924 - Flags: superreview?(alexei.volkov.bugs)
This patch fixes a number of compilation errors in the previous one (attachment #237303 [details] [diff] [review]).
Attachment #237303 - Attachment is obsolete: true
Attachment #237308 - Flags: superreview?(alexei.volkov.bugs)
Attachment #237308 - Flags: review?(nelson)
Attachment #237303 - Flags: superreview?(alexei.volkov.bugs)
Attachment #237303 - Flags: review?(nelson)
Comment on attachment 237308 [details] [diff] [review]
Remove usage of USE_MOZ_THREAD and correct manifest.mn (revised)

Please tell me how you've tested this.  
Have you used signtool?
If so, what signtool commands have you tested?

As for leak tools, use any you have.  There are many out there.  Some known to me include:
dbx checkleaks command
purify
valgrind
Some malloc libraries have a debug feature which is called at exit and prints a report of leaked blocks.
When leak testing, be sure to set the environment variable NSS_DISABLE_ARENA_FREE_LIST to 1.
Attachment #237308 - Flags: review?(nelson) → review+
(In reply to comment #8)
> (From update of attachment 237308 [details] [diff] [review] [edit])
> Please tell me how you've tested this.  

Well, I've only got Firefox to compile and run successfully.  I'm not sure what I should do in Firefox to test the libJAR code in the NSS module.

> Have you used signtool?
> If so, what signtool commands have you tested?

Nope.  I am not familiar with signtool, and I definitely don't know what commands it accepts and how it should be tested.  I need help in this regard.

> As for leak tools, use any you have.  There are many out there.  Some known to
> me include:
> dbx checkleaks command
> purify
> valgrind
> Some malloc libraries have a debug feature which is called at exit and prints a
> report of leaked blocks.

I have always stuck with VC's memory allocation tracking in debug builds, but I'm not too sure how to control the VC compiler's parameters in a Firefox tree to make sure those are active.  :-(

And I have got used to using smart pointers (from the Boost library) in place of raw pointers, and also use classes which implement the RAII (Resource Allocation Is Initialization) paradigm, so I don't expect a lot of leaks in the codes that I myself write (although from time to time I get some leaks left out.)

> When leak testing, be sure to set the environment variable
> NSS_DISABLE_ARENA_FREE_LIST to 1.  

OK, thanks for the tip.

One of the areas in Firefox that I'm willing to invest some time in is cutting down some memory usage, and fixing leaks can be a big step at this.  I appreciate if you give me some hints in this regard.  (As you've probably figured out already, I'm new to the Mozilla code tree.)
Attachment #237308 - Flags: superreview?(alexei.volkov.bugs) → superreview+
Unifdef USE_MOZ_THREAD (bug 351510) and remove dead code (bug 351443).
Patch contributed by ehsan.akhgari@gmail.com. r=nelson, alexei.volkov
Modified Files: jarint.h jarsign.c jarver.c manifest.mn
Removed Files: jarevil.c jarevil.h

Removing jarevil.c;      new revision: delete; previous revision: 1.8
Removing jarevil.h;      new revision: delete; previous revision: 1.3
Checking in jarint.h;    new revision: 1.5; previous revision: 1.4
Checking in jarsign.c;   new revision: 1.6; previous revision: 1.5
Checking in jarver.c;    new revision: 1.13; previous revision: 1.12
Checking in manifest.mn; new revision: 1.5; previous revision: 1.4
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Priority: -- → P3
Resolution: --- → FIXED
Target Milestone: --- → 3.12
Version: trunk → 3.11
Keywords: qawanted
Keywords: qawanted
Keywords: verifyme
Keywords: verifyme
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: