Autovivify undefined hash reference in list assignment

Fermée
#1,958 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Une pull request liée a déjà été fusionnée.

  • #1960 par @fglock — fusionnée

Évaluation

Difficulté
4/5
Temps estimé
1-2 jours
Accessibilité débutants
55/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
java, perl
Domaine
backend, testing

Piste de recherche

Start by tracing shared list assignment for a hash dereference in the PerlOnJava runtime, then compare how both the JVM and interpreter backends handle an undefined scalar against an initialized hash reference. Add a focused regression for both cases; done means the reproducer passes on both backends, including the existing initialized-reference behavior.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

area:runtime bug

Summary

List assignment into a hash dereference does not autovivify an undefined scalar on either PerlOnJava backend. This breaks pure-Perl code that initializes a hash reference with ($self, %$type) = @_ and then reads it.

Reproducer

my ($self, $type);
($self, %$type) = ('Object::Hybrid', reftype => 'HASH', tieable => 0, mutable => 0, caller => 0);
die "missing hash assignment" unless $type->{reftype} eq 'HASH';

System Perl 5.42.2 passes. PerlOnJava at master b43a65250 leaves $type undefined and the key missing on both the JVM and interpreter backends. Initializing $type to {} before the assignment makes both PerlOnJava backends pass.

CPAN evidence

Object-Hybrid 0.07 passed all 909 tests under system Perl. CPAN run 20261103-123832-91742 failed at t/Object-Hybrid.t line 21 after its first assertion, with No 'reftype' parameter specified; the same failure reproduces on both PerlOnJava backends.

Suspected runtime path

The failure is in shared list assignment to a hash dereference. The assignment replaces the pending autovivification hash before the referenced scalar becomes a hash reference. A focused regression should cover the undefined-scalar case and continue to pass when the hash reference is already initialized.

Langage dominant
Perl
Étoiles
65
Forks
8
Merge moyen
5 h 57 min
PR mergées (30 j)
177

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de fglock/PerlOnJava

Toutes les issues de fglock/PerlOnJava

Issues similaires

Plus d'issues Perl

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.