Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Whole-glob aliases follow localized replacements instead of retaining the original GV

Abierto
#1,630 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
perl
Área
compilers

Línea de trabajo

Start with RuntimeGlob.set, RuntimeGlob.dynamicSaveState, and GlobalVariable.setGlobAlias to trace how whole-glob aliases and localized global IO bindings are represented. Add the project-owned regression for alias identity, nested localization, and scope restoration, then run the focused upstream test and the Smart-Comments-Log4perl 1.002 suite on both JVM and interpreter backends.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

area:io area:runtime bug

Summary

Whole-glob aliases incorrectly follow a dynamically localized replacement glob instead of retaining the original glob identity. This breaks code that saves a glob alias and later localizes the original name, including Smart::Comments::Log4perl's saved STDERR handle.

Minimal reproducer

package Capture;
use Tie::Handle;
sub TIEHANDLE { bless {}, shift }
sub TELL { 123 }
sub PRINT { }
package main;
*ORIGINAL = *STDERR;
close *STDERR;
my $buffer = q{};
open *STDERR, '>', \$buffer;
tie *CAPTURE, 'Capture';
{
    local *STDERR = *CAPTURE;
    print STDOUT "saved tell=", tell ORIGINAL, "\n";
}

System Perl prints saved tell=0. PerlOnJava prints saved tell=123 on both JVM and interpreter backends: ORIGINAL has incorrectly started resolving to the newly localized tied glob and dispatches to Capture::TELL.

CPAN evidence

  • Distribution: Smart-Comments-Log4perl 1.002
  • CPAN random tester run: 20261002-182937-4648
  • Upstream system Perl 5.42.2: all 10 test files pass (7 tests).
  • PerlOnJava 5.44.1, Java 24.0.2, macOS arm64: six test programs exit 255 before assertions. The JVM failure includes a StackOverflowError repeatedly entering Smart::Comments::Log4perl::IO::TELL, which delegates tell through its saved L4P_ORIGINAL_STDERR glob. The interpreter also fails the focused upstream test. The isolated glob/tie reproducer exhibits the wrong alias target on both backends.
  • The distribution and its dependencies are pure Perl; no XS or native prerequisite is involved.

Root cause

RuntimeGlob.set(RuntimeGlob) represents whole-glob assignment by recording a name alias through GlobalVariable.setGlobAlias. During local *STDERR, RuntimeGlob.dynamicSaveState installs a fresh RuntimeGlob in the global IO table for main::STDERR. Alias lookup remains name-based, so ORIGINAL resolves through main::STDERR to that new localized glob. Perl keeps the saved alias attached to the outer glob while the localized name refers to a temporary glob.

The alias relationship must preserve the original glob identity across dynamic localization and restore the named binding when the scope exits.

Acceptance criteria

  • Add a project-owned regression covering a whole-glob alias, localized replacement of its source name, and IO-slot access through the saved alias.
  • Match system Perl on both JVM and interpreter backends, including nested localization and scope restoration.
  • Verify the Smart-Comments-Log4perl 1.002 upstream suite passes on both backends.

Related issue

Related tied-filehandle work: #1338. That report covers a different tied-output dispatch failure; this report isolates the typeglob alias/localization defect.

Lenguaje dominante
Perl
Estrellas
64
Forks
7
Merge medio
4 h 56 min
PR fusionados (30 d)
181

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de fglock/PerlOnJava

Todos los issues de fglock/PerlOnJava

Issues similares

Más issues de Perl

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.