Closed
Bug 97646
Opened 24 years ago
Closed 24 years ago
Exit code should be non-0 after compiler errors
Categories
(Core :: JavaScript Engine, defect, P1)
Tracking
()
VERIFIED
FIXED
mozilla0.9.5
People
(Reporter: pschwartau, Assigned: brendan)
Details
(Keywords: js1.5)
Attachments
(3 files, 1 obsolete file)
|
1.25 KB,
patch
|
jband_mozilla
:
review+
shaver
:
superreview+
|
Details | Diff | Splinter Review |
|
1.78 KB,
patch
|
Details | Diff | Splinter Review | |
|
2.29 KB,
patch
|
jband_mozilla
:
review+
shaver
:
superreview+
|
Details | Diff | Splinter Review |
I have two testcases which cause "internal errors" in the JS shell.
Yet both testcases terminate with exit code 0; therefore the test driver
does not know there has been an error. The exit code should be non-0.
As Brendan said in bug 89443,
"...any non-warning error detected by the compiler should cause an abnormal
termination of the shell."
| Reporter | ||
Comment 1•24 years ago
|
||
Testcases added to JS test suite:
mozilla/js/tests/js1_5/Regress/regress-97646-001-n.js
mozilla/js/tests/js1_5/Regress/regress-97646-002-n.js
The '-n' in the name means these testcases will report failure
if they terminate with exit code 0. They expect exit code 3.
If I load them in the JS shell, I see the following "InternalErrors":
[//d/JS_TRUNK/mozilla/js/src/WINNT4.0_DBG.OBJ] ./js
js> load('../../tests/js1_5/shell.js') <--- (UTILITY FUNCTIONS)
js> load('../../tests/js1_5/Regress/regress-97646-001-n.js')
InternalError: else statement too large
js> load('../../tests/js1_5/Regress/regress-97646-002-n.js')
InternalError: block too large
Assignee: rogerl → khanson
| Reporter | ||
Comment 2•24 years ago
|
||
NOTE: if '3' is not the correct exit code to expect, let me know and
I will adjust the testcases accordingly...
| Assignee | ||
Comment 3•24 years ago
|
||
| Assignee | ||
Comment 4•24 years ago
|
||
Taking, please r= and sr= soon -- this is easy, it won't take more than a minute
to review.
/be
Assignee: khanson → brendan
Keywords: js1.5,
mozilla0.9.5
Priority: -- → P1
Target Milestone: --- → mozilla0.9.5
Comment 5•24 years ago
|
||
Comment on attachment 50637 [details] [diff] [review]
proposed fix (the JS_CompileFile* API entry points were failing to js_ReportUncaughtException)
sr=shaver
Attachment #50637 -
Flags: superreview+
Comment 6•24 years ago
|
||
Comment on attachment 50637 [details] [diff] [review]
proposed fix (the JS_CompileFile* API entry points were failing to js_ReportUncaughtException)
r=jband.
The change looks fine. But does it always fix the problem? It seems like
the Process function in js.c might need some love. no?
Attachment #50637 -
Flags: review+
| Assignee | ||
Comment 7•24 years ago
|
||
jband: Process itself should not need to report uncaught exceptions, because non
should go unreported by a JS_Compile/Execute/Evaluate/Call API -- but oops, the
JS_Compile*Script* APIs fail to report. Fixed, thanks. New patch, which I'll
check in momentarily, coming up.
/be
Status: NEW → ASSIGNED
| Assignee | ||
Comment 8•24 years ago
|
||
| Assignee | ||
Comment 9•24 years ago
|
||
Fix checked in.
/be
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
| Assignee | ||
Comment 10•24 years ago
|
||
Oops. eval is busted by reporting uncaught exceptions from
JS_CompileUCScriptForPrincipals. My bad -- patch coming up fast!
/be
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Assignee | ||
Comment 11•24 years ago
|
||
This report-uncaught-exceptions is pretty tricky. I can imagine other native
methods than eval that might want to throw an exception (e.g., SyntaxError) and
not have JS_Compile* or JS_Evaluate* call the API-configured error reporter.
What about setTimeout and setInterval? Cc'ing jst.
In the mean time, my patch fixes things so eval and other "special" (debugger,
too) calls into the compiler do not report uncaught exceptions on the way out of
JS_Compile*.
/be
Status: REOPENED → ASSIGNED
| Assignee | ||
Comment 12•24 years ago
|
||
| Assignee | ||
Updated•24 years ago
|
Attachment #50768 -
Attachment is obsolete: true
| Assignee | ||
Comment 13•24 years ago
|
||
| Assignee | ||
Comment 14•24 years ago
|
||
Ok, please r= and sr= and double-sr= (jband this means you). Rather than
special case eval (and debugger analogues), suppress reporting uncaught
exceptions unless the API entry point is called from apparently-native code
(!cx->fp). If that native caller is itself part of some cloud of native
functions called from a JS native, it's up to the outer JS native to "unreport"
the exception and make it seem to be thrown still.
/be
Comment 15•24 years ago
|
||
Comment on attachment 51031 [details] [diff] [review]
better fix: don't report uncaught exceptions unless unwinding to native code (!cx->fp in API layer)
Now this I like. Simple, easy to understand, consistent. sr=shaver, with a bullet.
Comment 16•24 years ago
|
||
Comment on attachment 51031 [details] [diff] [review]
better fix: don't report uncaught exceptions unless unwinding to native code (!cx->fp in API layer)
Now this I like. Simple, easy to understand, consistent. sr=shaver, with a bullet.
Attachment #51031 -
Flags: superreview+
Comment 17•24 years ago
|
||
Comment on attachment 51031 [details] [diff] [review]
better fix: don't report uncaught exceptions unless unwinding to native code (!cx->fp in API layer)
r=jband.
Sure, I'll take a card. hat's the worst that could happen?
Looks like shaver already double sr'd it :)
Attachment #51031 -
Flags: review+
Comment 18•24 years ago
|
||
s/hat's/What is/
| Assignee | ||
Comment 19•24 years ago
|
||
jband, you're the big winner! (Always double-down on 11.)
Phil, sorry about that. Your testsuite output should be back to 11 failures --
please confirm.
/be
Status: ASSIGNED → RESOLVED
Closed: 24 years ago → 24 years ago
Resolution: --- → FIXED
| Reporter | ||
Comment 20•24 years ago
|
||
Verified Fixed in debug and optimized JS shells on WinNT, Linux.
The testcases
js/tests/js1_5/Regress/regress-97646-001-n.js
js/tests/js1_5/Regress/regress-97646-002-n.js
both pass, since they get the exit code 3 they are expecting.
Additionally, this testcase now errors, because we are now getting
exit code 3 from its too-large script:
js/tests/js1_5/Regress/regress-90445.js
This is all correct behavior with the current jump bytecode limitation.
The first two testcases will have to be modified or deprecated, however,
once the fix for bug 80981 is checked in. At that point the JS Engine
will no longer produce an InternalError on large scripts, thus there
will no longer be a reason for these tests to expect exit code 3.
Additionally, the last test should no longer produce exit code 3.
Status: RESOLVED → VERIFIED
| Reporter | ||
Comment 21•24 years ago
|
||
As promised above, I have CVS-removed
js/tests/js1_5/Regress/regress-97646-001-n.js
js/tests/js1_5/Regress/regress-97646-002-n.js
Both tests contain very large blocks. But because of the fix to bug 80981,
these are no longer large enough to trigger the internal error and exit code 3
that the tests looked for.
Updated•21 years ago
|
Flags: testcase+
You need to log in
before you can comment on or make changes to this bug.
Description
•