Skip to content

Commit ffe3ac0

Browse files
fglockDevin
andcommitted
Update design doc with local $OurVariable fix
Log::Log4perl compatibility improved from 10/700 to 8/700 failing subtests. t/022Wrap.t now passes - %T stack trace format works correctly. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
1 parent 4737089 commit ffe3ac0

1 file changed

Lines changed: 19 additions & 21 deletions

File tree

dev/design/log4perl-compatibility.md

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@ This document tracks the work needed to make `./jcpan Log::Log4perl` fully pass
1010

1111
```
1212
Files=73, Tests=700
13-
Failed 5/73 test programs
14-
Failed 10/700 subtests
13+
Failed 4/73 test programs
14+
Failed 8/700 subtests
1515
```
1616

17-
**Improvement from previous:** Was 11/700 subtests failing. Fixed eval block name in caller().
17+
**Improvement from previous:** Was 10/700 subtests failing. Fixed `local $OurVariable` bug affecting %T stack trace format.
1818

1919
### Failing Tests Summary
2020

2121
| Test File | Failed/Total | Issue Category |
2222
|-----------|--------------|----------------|
2323
| t/016Export.t | 1/16 | DESTROY message during global destruction |
24-
| t/022Wrap.t | 2/5 | %T (stack trace) format - @CARP_NOT handling |
2524
| t/026FileApp.t | 3/27 | File permissions / chmod |
2625
| t/041SafeEval.t | 3/23 | Safe.pm compartment restrictions |
2726
| t/049Unhide.t | 1/1 | Source filter / ###l4p |
@@ -33,6 +32,7 @@ Failed 10/700 subtests
3332
| t/020Easy.t | 3/21 failed | All pass | local $pkg::var bug fixed, bareword IO handles |
3433
| t/051Extra.t | 2/11 failed | All pass | Line number reporting improvements |
3534
| t/024WarnDieCarp.t | 11/73 failed | All pass | caller() line number fix + eval block name |
35+
| t/022Wrap.t | 2/5 failed | All pass | local $OurVariable fix for %T stack trace |
3636

3737
### Resolved: t/020Easy.t Carp.pm Error
3838

@@ -189,23 +189,22 @@ BEGIN failed--compilation aborted at -e line 1, near ""
189189

190190
**Design Document:** `dev/design/caller_line_number_fix.md`
191191

192-
### Issue 2: Stack Trace Format (%T) - ACTIVE
192+
### Issue 2: Stack Trace Format (%T) - FIXED
193193

194-
**Status:** Working but includes too many frames.
194+
**Status:** FIXED - `local $Carp::CarpLevel` now works correctly inside subroutines.
195195

196-
**Symptom:** t/022Wrap.t tests fail because %T (Carp::longmess) includes internal Log4perl frames.
196+
**Root Cause:** When `local $VarName` was used inside a subroutine where `$VarName` was declared with `our` in an outer scope, the localization didn't work correctly:
197+
1. JVM Backend: `EmitOperatorLocal` checked if variable was in symbol table and used wrong path
198+
2. Interpreter Backend: `BytecodeCompiler` used cached register for `our` variables instead of loading from global table
197199

198-
**Example:**
199-
```
200-
got: 'trace: Log::Log4perl::Layout::PatternLayout::render() called at ... line 306,
201-
Log::Log4perl::Appender::log() called at ... line 1115, ...'
202-
expected: 'trace: at 022Wrap.t line 69'
203-
```
200+
**Fix Applied:**
201+
- `EmitOperatorLocal.java`: Check for `our` variables when handling `local` and use `GlobalRuntimeScalar.makeLocal()` for them
202+
- `BytecodeCompiler.java`: For scalars/arrays/hashes declared with `our`, use `LOAD_GLOBAL_*` instead of cached register
204203

205-
**Root Cause:** PerlOnJava's Carp::longmess includes all stack frames. Perl's version filters out internal frames based on `@CARP_NOT` and caller level adjustments that Log4perl uses.
204+
**Commit:** 4737089da
206205

207-
**Affected Tests:**
208-
- t/022Wrap.t (2 failures: tests 1-2)
206+
**Tests Fixed:**
207+
- t/022Wrap.t (2 tests) - `%T` format now correctly filters internal frames
209208

210209
### Issue 3: DESTROY During Global Destruction
211210

@@ -402,7 +401,7 @@ For chmod/umask:
402401

403402
## Progress Tracking
404403

405-
### Current Status: 10/700 subtests failing (was 11/700)
404+
### Current Status: 8/700 subtests failing (was 10/700)
406405

407406
### Completed
408407
- [x] *{NAME} glob slot accessor (2026-03-18)
@@ -414,18 +413,17 @@ For chmod/umask:
414413
- [x] local $Pkg::Var bug fix (2026-03-19, PR #333)
415414
- [x] caller() line number fix (2026-03-19) - Fixed 7/8 failures
416415
- [x] eval block "(eval)" name in caller() (2026-03-19) - Fixed test 62
416+
- [x] local $OurVariable fix (2026-03-19) - Fixed %T stack trace format
417417

418418
### Active Issues
419-
- [ ] %T stack trace format (2 tests) - needs @CARP_NOT handling
420419
- [ ] DESTROY during global destruction (1 test)
421420
- [ ] chmod/file permissions (3 tests)
422421
- [ ] Safe.pm restrictions (3 tests)
423422
- [ ] Source filters (1 test)
424423

425424
### Next Steps
426-
1. Implement @CARP_NOT handling in Carp.pm for %T format (2 tests)
427-
2. Investigate DESTROY during global destruction
428-
3. Investigate chmod/file permissions issue
425+
1. Investigate DESTROY during global destruction
426+
2. Investigate chmod/file permissions issue
429427

430428
---
431429

0 commit comments

Comments
 (0)