summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2023-03-29 11:51:05 +0200
committerYves Orton <demerphq@gmail.com>2023-04-02 21:29:27 +0800
commitda791ecc4cd01c56b1259293abdbb287dadd5fe2 (patch)
tree798b9ea3254cfd11525b3a9e0a38a4eea156b8a8 /lib
parent0099fe06da2470ae6f7b3feb560b1a116886a531 (diff)
downloadperl-da791ecc4cd01c56b1259293abdbb287dadd5fe2.tar.gz
Config.pm - add taint_disabled and taint_support to %Config
This adds 'taint_disabled' and 'taint_support' to Config.pm and %Config. This way people can use them while we decide what to do about the changes to Configure. We shouldn't need to have Configure changed to export status variables like this in Config.pm See: https://github.com/Perl-Toolchain-Gang/Test-Harness/pull/118 and: https://github.com/Perl/perl5/pull/20972 for related work that is stalled because we have not decided what to do about these variables.
Diffstat (limited to 'lib')
-rw-r--r--lib/Config.t33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/Config.t b/lib/Config.t
index 4a07ff58af..fa505266d1 100644
--- a/lib/Config.t
+++ b/lib/Config.t
@@ -51,6 +51,39 @@ ok( exists $Config{d_fork}, "has d_fork");
ok(!exists $Config{d_bork}, "has no d_bork");
+{
+ # check taint_support and tain_disabled are set up as expected.
+
+ ok( exists $Config{taint_support}, "has taint_support");
+
+ ok( exists $Config{taint_disabled}, "has taint_disabled");
+
+ is( $Config{taint_support}, ($Config{taint_disabled} ? "" : "define"),
+ "taint_support = !taint_disabled");
+
+ ok( ($Config{taint_support} eq "" or $Config{taint_support} eq "define"),
+ "taint_support is a valid value");
+
+ ok( ( $Config{taint_disabled} eq "" or $Config{taint_disabled} eq "silent" or
+ $Config{taint_disabled} eq "define"),
+ "taint_disabled is a valid value");
+
+ my @opts = Config::non_bincompat_options();
+ my @want_taint_disabled = ("", "define", "silent");
+ my @want_taint_support = ("define", "", "");
+ my ($silent_no_taint_support) = grep $_ eq "SILENT_NO_TAINT_SUPPORT", @opts;
+ my ($no_taint_support) = grep $_ eq "NO_TAINT_SUPPORT", @opts;
+ my $no_taint_support_count = 0 + grep /NO_TAINT_SUPPORT/, @opts;
+ my $want_count = $silent_no_taint_support ? 2 : $no_taint_support ? 1 : 0;
+
+ is ($no_taint_support_count, $want_count,
+ "non_bincompat_options info on taint support is as expected");
+ is( $Config{taint_disabled}, $want_taint_disabled[$no_taint_support_count],
+ "taint_disabled is aligned with non_bincompat_options() data");
+ is( $Config{taint_support}, $want_taint_support[$no_taint_support_count],
+ "taint_support is aligned with non_bincompat_options() data");
+}
+
like($Config{ivsize}, qr/^(4|8)$/, "ivsize is 4 or 8 (it is $Config{ivsize})");
# byteorder is virtual, but it has rules.