Closed Bug 231195 Opened 21 years ago Closed 21 years ago

NSPR_LOG_FILE=WinDebug will crash if PR_LogCleanup is called

Categories

(NSPR :: NSPR, defect)

x86
Windows XP
defect
Not set
critical

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: timeless, Assigned: wtc)

Details

(Keywords: crash)

Attachments

(2 files, 2 obsolete files)

Environment:
NSPR_LOG_FILE=WinDebug
NSPR_LOG_MODULES=all:5

Steps:
build mozilla
fatal step:
running shlibsign.exe
commandline:
r:\______\mozilla\opt-i586-pc-msvc\nss\shlibsign.exe -v -i
r:/______/mozilla/opt-i586-pc-msvc/dist/lib/softokn3.dll

Stack trace:
 	msvcr70.dll!fclose(_iobuf * stream=0xfffffffe)  Line 51 + 0x3	C
>	nspr4.dll!_PR_LogCleanup()  Line 273 + 0x7	C
 	nspr4.dll!PR_Cleanup()  Line 437	C
 	shlibsign.exe!004012ee() 	
 	5b5d5e5f()	

Reason:
closing a special file "Don't do that"
Attached patch (obsolete) — Splinter Review
Attachment #139234 - Flags: review?(wchang0222)
Attachment #139234 - Attachment description: patch against mozilla 1.6 branch → patch against mozilla 1.6 branch - logFile = newLogFile; should be outside the if (...) {} block
Attachment #139234 - Flags: review?(wchang0222)
Attachment #139234 - Attachment is obsolete: true
Attachment #140043 - Flags: review?(wchang0222)
Attachment #139234 - Attachment description: patch against mozilla 1.6 branch - logFile = newLogFile; should be outside the if (...) {} block →
Attachment #139234 - Attachment filename: 231195 →
Comment on attachment 140043 [details] [diff] [review]
patch against mozilla 1.6 branch

r=wtc.	Thanks for the bug report and the patch.

This patch is correct.	I will propose an alternate
patch though (matter of style).

Two minor issues with this patch.

1. In the second chunk of this patch, you have an
if-else statement nested with #ifdef.  That kind of
nesting is hard to understand and should be avoided
if possible.

2. In the second chunk of this patch, with your rewrite,
the statement

    return (PRBool) (newLogFile != 0);

should be changed to

    return PR_TRUE;

because newLogFile is guaranteed to be nonzero at that
point.
Attachment #140043 - Flags: review?(wchang0222) → review+
Attached patch Alternate patch (obsolete) — Splinter Review
Note that I still use #ifdef XP_PC to follow the
original usage.  I like your use of
#ifdef WIN32_DEBUG_FILE though.
Attachment #140089 - Flags: superreview?(darin)
Attachment #140089 - Flags: review?(timeless)
Comment on attachment 140089 [details] [diff] [review]
Alternate patch

OK,  I see why timeless rewrote the PR_SetLogFile
function.  Good catch, timeless.

I will attach a new patch.
Attachment #140089 - Attachment is obsolete: true
Attachment #140089 - Flags: superreview?(darin)
Attachment #140089 - Flags: review?(timeless)
This is timeless's patch, edited to NSPR's (or
rather my personal) style.
Comment on attachment 140098 [details] [diff] [review]
Alternate patch v2

Timeless, please review and test this patch.  Thanks.
Attachment #140098 - Flags: review?(timeless)
Comment on attachment 140098 [details] [diff] [review]
Alternate patch v2

bugzilla's new visual diff shows that this change is fine.
Attachment #140098 - Flags: review?(timeless) → review+
Fix checked in on the NSPR trunk (NSPR 4.5.1) and
NSPRPUB_PRE_4_2_CLIENT_BRANCH (Mozilla 1.7a).
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.5.1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: