Branch: refs/heads/yves/restricted_hash_disallow_alias_or_local
  Home:   https://github.com/Perl/perl5
  Commit: 366592a3c3e89fbc5aa2a3e8a251dc6ce8728725
      
https://github.com/Perl/perl5/commit/366592a3c3e89fbc5aa2a3e8a251dc6ce8728725
  Author: Yves Orton <demer...@gmail.com>
  Date:   2023-03-26 (Sun, 26 Mar 2023)

  Changed paths:
    M dist/Storable/t/downgrade.t
    M embed.fnc
    M embed.h
    M ext/Hash-Util/t/Util.t
    M hv.c
    M pod/perldiag.pod
    M proto.h
    M t/porting/diag.t

  Log Message:
  -----------
  hv.c - hv_notallowed improvements and standardization

Use a standardized wording for restricted hash errors, thus instead
of saying "from a restricted hash" and "in a restricted hash", say
"in restricted hash" consistently. This will be exploited in a
subsequent patch more than it is now.

Modify hv_allowed() to take a new parameter showing the action that
is not allowed. This will be used in a subsequent patch to reduce
the code involved in cases where the action may vary depending on a
parameter.

Use SVf_QUOTEDPREFIX not SVf for the key name. This ensures hidden
characters are displayed, and will prevent super long keys from
saturating STDERR with debug output. This means that single quoted
keys in error messages are replaced in with double quoted keys with
escaped contents.

This also includes changes to t/porting/diag.t to detect hv_notallowed()
error messages and test them properly.


  Commit: 2f01a2c7b033f92e0324a38812e19a95664d62e5
      
https://github.com/Perl/perl5/commit/2f01a2c7b033f92e0324a38812e19a95664d62e5
  Author: Yves Orton <demer...@gmail.com>
  Date:   2023-03-26 (Sun, 26 Mar 2023)

  Changed paths:
    M embed.fnc
    M hv.c
    M hv.h
    M pod/perldiag.pod
    M pp.c
    M pp_hot.c
    M proto.h
    M t/op/lvref.t

  Log Message:
  -----------
  pp.c - forbid localizing and aliasing readonly hash keys in restricted hashes

local $hash{key} and \$hash{key} = \$var are both conceptually modify
operations which are forbidden when the hash is restricted and the value
is readonly. Unfortunately prior to this commit they were still allowed
operations. This patch corrects that oversight.

Adds a bunch of tests to t/op/lvref.t to ensure that it is illegal to
localize or ref-alias a readonly value in a restricted hash.


Compare: https://github.com/Perl/perl5/compare/b571f323d172...2f01a2c7b033

Reply via email to