develooper Front page | perl.perl5.changes | Postings from March 2023

[Perl/perl5] b7f3a2: t/test.pl - don't show diff view for shortstrings

From:
Yves Orton via perl5-changes
Date:
March 25, 2023 17:24
Subject:
[Perl/perl5] b7f3a2: t/test.pl - don't show diff view for shortstrings
Message ID:
Perl/perl5/push/refs/heads/yves/restricted_hash_disallow_alias_or_local/41fe7f-c17464@github.com
  Branch: refs/heads/yves/restricted_hash_disallow_alias_or_local
  Home:   https://github.com/Perl/perl5
  Commit: b7f3a25bee283b8eb21e6a7321f4e333def2cc90
      https://github.com/Perl/perl5/commit/b7f3a25bee283b8eb21e6a7321f4e333def2cc90
  Author: Yves Orton <demerphq@gmail.com>
  Date:   2023-03-25 (Sat, 25 Mar 2023)

  Changed paths:
    M t/test.pl

  Log Message:
  -----------
  t/test.pl - don't show diff view for short strings

The diff view is intended for very long strings where it is difficult
to eyeball what changed. Showing it for short strings like stringified
refs is not that helpful, so raise the threshold from 20 chars to 60
chars.


  Commit: c44b02461b688be5d06ba45904ccf9e9dd724470
      https://github.com/Perl/perl5/commit/c44b02461b688be5d06ba45904ccf9e9dd724470
  Author: Yves Orton <demerphq@gmail.com>
  Date:   2023-03-25 (Sat, 25 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: c17464c925c48010193dae0ee058395bbbbcf8c6
      https://github.com/Perl/perl5/commit/c17464c925c48010193dae0ee058395bbbbcf8c6
  Author: Yves Orton <demerphq@gmail.com>
  Date:   2023-03-25 (Sat, 25 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/41fe7f5b418e...c17464c925c4



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About