-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement preventing Sys::Hostname::hostname() from accepting arguments #17019
Comments
From @jkeenanpod/perldeprecation.pod contains this entry for perl-5.32: ##### The function This entry was recorded in the following commit: ##### document hostname(@args) deprecation Passing arguments to Sys::Hostname::hostname() is already Make it so. Thank you very much. |
From @jkeenanSummary of my perl5 (revision 5 version 31 subversion 0) configuration: Characteristics of this binary (from libperl): |
From @jkeenanOn Sat, 25 May 2019 01:56:12 GMT, jkeenan@pobox.com wrote:
Please review patch attached (or smoke-me/jkeenan/rt-134137-hostname branch). Thank you very much. |
From @jkeenan0001-Prevent-hostname-from-accepting-arguments.patchFrom 811314492d0ed875a2622bb1f030f711ac5399bb Mon Sep 17 00:00:00 2001
From: James E Keenan <jkeenan@cpan.org>
Date: Fri, 24 May 2019 22:37:40 -0400
Subject: [PATCH] Prevent hostname() from accepting arguments
Increment $VERSION.
For: RT 134137
---
ext/Sys-Hostname/Hostname.pm | 4 ++--
ext/Sys-Hostname/t/Hostname.t | 17 +++++------------
2 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/ext/Sys-Hostname/Hostname.pm b/ext/Sys-Hostname/Hostname.pm
index 8b5dde1445..ddf98b8d18 100644
--- a/ext/Sys-Hostname/Hostname.pm
+++ b/ext/Sys-Hostname/Hostname.pm
@@ -16,7 +16,7 @@ use warnings ();
our $host;
BEGIN {
- $VERSION = '1.22';
+ $VERSION = '1.23';
{
local $SIG{__DIE__};
eval {
@@ -29,7 +29,7 @@ BEGIN {
sub hostname {
- @_ and warnings::warnif("deprecated", "hostname() doesn't accept any arguments. This will become fatal in Perl 5.32");
+ @_ and die("hostname() no longer accepts arguments");
# method 1 - we already know it
return $host if defined $host;
diff --git a/ext/Sys-Hostname/t/Hostname.t b/ext/Sys-Hostname/t/Hostname.t
index a8c259d7c9..9aaf464339 100644
--- a/ext/Sys-Hostname/t/Hostname.t
+++ b/ext/Sys-Hostname/t/Hostname.t
@@ -10,7 +10,7 @@ BEGIN {
use Sys::Hostname;
-use Test::More tests => 4;
+use Test::More tests => 2;
SKIP:
{
@@ -23,15 +23,8 @@ SKIP:
}
{
- use warnings;
- my $warn;
- local $SIG{__WARN__} = sub { $warn = "@_" };
- eval { hostname("dummy") };
- ok($warn, "warns with an argument");
- like($warn, qr/hostname\(\) doesn't accept any arguments/,
- "appropriate message");
- no warnings "deprecated";
- undef $warn;
- eval { hostname("dummy") };
- is($warn, undef, "no warning when disabled");
+ local $@;
+ eval { hostname("dummy"); };
+ like($@, qr/hostname\(\) no longer accepts arguments/,
+ "hostname no longer accepts arguments");
}
--
2.17.1
|
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Fri, 24 May 2019 19:48:35 -0700, jkeenan wrote:
- @_ and warnings::warnif("deprecated", "hostname() doesn't accept any arguments. This will become fatal in Perl 5.32"); Two issues: - this should probably use croak() instead of die() so the error is produced at the caller - Richard's point about the error message in https://www.nntp.perl.org/group/perl.perl5.porters/2019/05/msg254903.html which didn't make it to the ticket. Tony |
From @jkeenanOn Tue, 04 Jun 2019 23:53:53 GMT, tonyc wrote:
Thanks for the code review. Incorporated suggestions and merged to blead in commit 82b5311. -- |
@jkeenan - Status changed from 'open' to 'pending release' |
Migrated from rt.perl.org#134137 (status was 'pending release')
Searchable as RT134137$
The text was updated successfully, but these errors were encountered: