In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/a26223c9fe9f719139f4223d916e9ed21e354873?hp=c04bead1edb16804f93c1d95979abf8e7477363a>
- Log ----------------------------------------------------------------- commit a26223c9fe9f719139f4223d916e9ed21e354873 Author: Aaron Crane <[email protected]> Date: Fri May 13 13:50:01 2016 +0100 POSIX: test that all subroutines are exported M ext/POSIX/t/export.t commit 1cb852db7b10e30cf24e4510b02cfa3361b07978 Author: Aaron Crane <[email protected]> Date: Fri May 13 13:10:38 2016 +0100 POSIX: delete the L_tmpnam and L_tmpname symbols The history here is relatively complicated. The L_tmpname symbol is neither specified by POSIX or defined by traditional Unix system; it's simply a typo for L_tmpnam, first introduced in Perl 5.0. Commit 33f01dd10fdacfa5ccb83c4f933cacb0f65b707e (part of Perl 5.6) added support for L_tmpnam, treating L_tmpname as a back-compat synonym. However, no version of Perl has ever made L_tmpnam exportable, even at explicit request; using that symbol has always required using its fully-qualified POSIX::L_tmpnam name. During the 5.8 development cycle, an apparently-unintended consequence of various improvements to the way that POSIX.pm generates and exports constants meant that L_tmpname stopped working. It continued to be exportable, but trying to use the constant yielded an exception saying "Your vendor has not defined POSIX macro L_tmpname". (This isn't exactly incorrect, of course: no vendor defines the macro L_tmpname!) At this point, therefore, there seems little benefit in trying to resurrect support for the L_tmpname typo: it's impossible for any program running on 5.8.0 or later to have successfully used it. There's perhaps an argument for making L_tmpnam exportable at this point, since it does work when called by its full-qualified name. One option would be to add it to @EXPORT_OK; but that is explicitly counselled against by the POSIX.pm comments summarising the policy on symbol exports, which recommend adding a new export tag instead. In this case, the obvious tag to use is :stdio_h (which already exists), since the C-level symbol is provided by the <stdio.h> header. However, that doesn't seem worth it to me. The only possible use of L_tmpnam is to create a buffer of a size suitable for passing to the tmpnam() C function (which is presumably why nobody's noticed in the last fifteen years that the symbol isn't actually exported). Furthermore, the POSIX.pm wrapper for tmpnam() itself was deleted by 19fc2965b60669d7bc25548edb32e3cdd86a68de, a few days ago, so merely deleting this additional symbol seems correct. M ext/POSIX/Makefile.PL M ext/POSIX/lib/POSIX.pm M ext/POSIX/lib/POSIX.pod M ext/POSIX/t/export.t M ext/POSIX/t/unimplemented.t commit b40d1aa27dae20c52bea2ec0d36f57aa37503988 Author: Aaron Crane <[email protected]> Date: Fri May 13 12:43:20 2016 +0100 POSIX: add new :sys_socket_h export tag with missing MSG_* symbols These symbols were not previously exported at all, despite having been added in the 5.9 cycle. M ext/POSIX/lib/POSIX.pm M ext/POSIX/t/export.t commit 9a0b3f3632c5377e7b38bf711f1b2c674649eeed Author: Aaron Crane <[email protected]> Date: Fri May 13 12:37:17 2016 +0100 POSIX: add new :netdb_h tag with missing EAI_* symbols These symbols were not previously exported at all, despite having been added in the 5.11 cycle. M ext/POSIX/lib/POSIX.pm M ext/POSIX/t/export.t commit decf70bc4310d8f5fde9eaa759146c3548ab340a Author: Aaron Crane <[email protected]> Date: Fri May 13 11:29:01 2016 +0100 POSIX: add lround() to the :math_h_c99 export tag Closes RT#127821. M ext/POSIX/lib/POSIX.pm M ext/POSIX/t/export.t M ext/POSIX/t/math.t ----------------------------------------------------------------------- Summary of changes: ext/POSIX/Makefile.PL | 4 +--- ext/POSIX/lib/POSIX.pm | 21 ++++++++++++++------- ext/POSIX/lib/POSIX.pod | 2 +- ext/POSIX/t/export.t | 45 +++++++++++++++++++++++++++++++++++++-------- ext/POSIX/t/math.t | 1 - ext/POSIX/t/unimplemented.t | 1 + 6 files changed, 54 insertions(+), 20 deletions(-) diff --git a/ext/POSIX/Makefile.PL b/ext/POSIX/Makefile.PL index 5a65173..a6e870c 100644 --- a/ext/POSIX/Makefile.PL +++ b/ext/POSIX/Makefile.PL @@ -48,7 +48,7 @@ my @names = EUSERS EWOULDBLOCK EXDEV FILENAME_MAX F_OK HUPCL ICANON ICRNL IEXTEN IGNBRK IGNCR IGNPAR INLCR INPCK INT_MAX INT_MIN ISIG ISTRIP IXOFF IXON LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME - LINK_MAX LONG_MAX LONG_MIN L_ctermid L_cuserid L_tmpnam MAX_CANON + LINK_MAX LONG_MAX LONG_MIN L_ctermid L_cuserid MAX_CANON MAX_INPUT MB_LEN_MAX MSG_CTRUNC MSG_DONTROUTE MSG_EOR MSG_OOB MSG_PEEK MSG_TRUNC MSG_WAITALL NAME_MAX NCCS NGROUPS_MAX NOFLSH OPEN_MAX OPOST PARENB PARMRK PARODD PATH_MAX PIPE_BUF RAND_MAX R_OK SCHAR_MAX @@ -74,8 +74,6 @@ my @names = {name=>"SIG_DFL", value=>"PTR2IV(SIG_DFL)", not_constant=>1}, {name=>"SIG_ERR", value=>"PTR2IV(SIG_ERR)", not_constant=>1}, {name=>"SIG_IGN", value=>"PTR2IV(SIG_IGN)", not_constant=>1}, - # L_tmpnam[e] was a typo--retained for compatibility - {name=>"L_tmpname", value=>"L_tmpnam"}, {name=>"NULL", value=>"0"}, {name=>"_POSIX_JOB_CONTROL", type=>"YES", default=>["IV", "0"]}, {name=>"_POSIX_SAVED_IDS", type=>"YES", default=>["IV", "0"]}, diff --git a/ext/POSIX/lib/POSIX.pm b/ext/POSIX/lib/POSIX.pm index fcaf298..6231bcb 100644 --- a/ext/POSIX/lib/POSIX.pm +++ b/ext/POSIX/lib/POSIX.pm @@ -4,7 +4,7 @@ use warnings; our ($AUTOLOAD, %SIGRT); -our $VERSION = '1.68'; +our $VERSION = '1.69'; require XSLoader; @@ -24,6 +24,7 @@ sub usage { croak "Usage: POSIX::$_[0]" } XSLoader::load(); my %replacement = ( + L_tmpnam => undef, atexit => 'END {}', atof => undef, atoi => undef, @@ -337,7 +338,7 @@ my %default_export_tags = ( # cf. exports policy below stddef_h => [qw(NULL offsetof)], stdio_h => [qw(BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid - L_tmpname NULL SEEK_CUR SEEK_END SEEK_SET + NULL SEEK_CUR SEEK_END SEEK_SET STREAM_MAX TMP_MAX stderr stdin stdout clearerr fclose fdopen feof ferror fflush fgetc fgetpos fgets fopen fprintf fputc fputs fread freopen @@ -428,12 +429,21 @@ my %other_export_tags = ( # cf. exports policy below Inf NaN acosh asinh atanh cbrt copysign erf erfc exp2 expm1 fdim fma fmax fmin fpclassify hypot ilogb isfinite isgreater isgreaterequal isinf isless islessequal islessgreater isnan isnormal isunordered j0 j1 - jn lgamma log1p log2 logb lrint nan nearbyint nextafter nexttoward + jn lgamma log1p log2 logb lrint lround nan nearbyint nextafter nexttoward remainder remquo rint round scalbn signbit tgamma trunc y0 y1 yn )], + netdb_h => [qw(EAI_AGAIN EAI_BADFLAGS EAI_FAIL + EAI_FAMILY EAI_MEMORY EAI_NONAME + EAI_OVERFLOW EAI_SERVICE EAI_SOCKTYPE + EAI_SYSTEM)], + stdlib_h_c99 => [ @{$default_export_tags{stdlib_h}}, 'strtold' ], + sys_socket_h => [qw( + MSG_CTRUNC MSG_DONTROUTE MSG_EOR MSG_OOB MSG_PEEK MSG_TRUNC MSG_WAITALL + )], + nan_payload => [ qw(getpayload setpayload setpayloadsig issignaling) ], signal_h_si_code => [qw( @@ -465,10 +475,7 @@ my %other_export_tags = ( # cf. exports policy below # you do not want to add symbols to the following list. add a new tag instead our @EXPORT_OK = (qw(close lchown nice open pipe read sleep times write - printf sprintf lround), - # lround() should really be in the :math_h_c99 tag, but - # we're too far into the 5.24 code freeze for that to be - # done now. This can be revisited in the 5.25.x cycle. + printf sprintf), grep {!exists $export{$_}} keys %reimpl, keys %replacement, keys %export_ok); our %EXPORT_TAGS = ( %default_export_tags, %other_export_tags ); diff --git a/ext/POSIX/lib/POSIX.pod b/ext/POSIX/lib/POSIX.pod index 2993421..4393702 100644 --- a/ext/POSIX/lib/POSIX.pod +++ b/ext/POSIX/lib/POSIX.pod @@ -2593,7 +2593,7 @@ C<EXIT_FAILURE> C<EXIT_SUCCESS> C<MB_CUR_MAX> C<RAND_MAX> =item Constants -C<BUFSIZ> C<EOF> C<FILENAME_MAX> C<L_ctermid> C<L_cuserid> C<L_tmpname> C<TMP_MAX> +C<BUFSIZ> C<EOF> C<FILENAME_MAX> C<L_ctermid> C<L_cuserid> C<TMP_MAX> =back diff --git a/ext/POSIX/t/export.t b/ext/POSIX/t/export.t index 5c37f83..ff852ed 100644 --- a/ext/POSIX/t/export.t +++ b/ext/POSIX/t/export.t @@ -49,7 +49,7 @@ my %expect = ( LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG LDBL_MAX LDBL_MAX_10_EXP LDBL_MAX_EXP LDBL_MIN LDBL_MIN_10_EXP LDBL_MIN_EXP LINK_MAX - LONG_MAX LONG_MIN L_ctermid L_cuserid L_tmpname MAX_CANON + LONG_MAX LONG_MIN L_ctermid L_cuserid MAX_CANON MAX_INPUT MB_CUR_MAX MB_LEN_MAX NAME_MAX NCCS NDEBUG NGROUPS_MAX NOFLSH NULL OPEN_MAX OPOST O_ACCMODE O_APPEND O_CREAT O_EXCL O_NOCTTY O_NONBLOCK O_RDONLY O_RDWR O_TRUNC @@ -130,6 +130,16 @@ my %expect = ( # it is OK to add new constants, but new functions may only go in EXPORT_OK ], EXPORT_OK => [sort + # this stuff was added in 5.9, but not exported until 5.25 + qw( + MSG_CTRUNC MSG_DONTROUTE MSG_EOR MSG_OOB MSG_PEEK + MSG_TRUNC MSG_WAITALL + ), + # this stuff was added in 5.11, but not exported until 5.25 + qw( + EAI_AGAIN EAI_BADFLAGS EAI_FAIL EAI_FAMILY EAI_MEMORY + EAI_NONAME EAI_OVERFLOW EAI_SERVICE EAI_SOCKTYPE EAI_SYSTEM + ), # this stuff was in 5.20.2 qw( abs alarm atan2 chdir chmod chown close closedir cos exit @@ -138,9 +148,12 @@ my %expect = ( localtime log mkdir nice open opendir pipe printf rand read readdir rename rewinddir rmdir sin sleep sprintf sqrt srand stat system time times umask unlink utime wait - waitpid write + waitpid write L_tmpnam ), # this stuff was added in 5.21 + # (though an oversight meant that lround wasn't listed here + # initially; it was added to @EXPORT_OK in 5.23, and to the + # :math_h_c99 tag in 5.25) qw( FE_DOWNWARD FE_TONEAREST FE_TOWARDZERO FE_UPWARD fegetround fesetround @@ -148,7 +161,7 @@ my %expect = ( acosh asinh atanh cbrt copysign erf erfc exp2 expm1 fdim fma fmax fmin fpclassify hypot ilogb isfinite isgreater isgreaterequal isinf isless islessequal islessgreater isnan - isnormal isunordered j0 j1 jn lgamma log1p log2 logb lrint nan + isnormal isunordered j0 j1 jn lgamma log1p log2 logb lrint lround nan nearbyint nextafter nexttoward remainder remquo rint round scalbn signbit tgamma trunc y0 y1 yn strtold ), @@ -166,14 +179,10 @@ my %expect = ( POLL_IN POLL_OUT POLL_MSG POLL_ERR POLL_PRI POLL_HUP SI_USER SI_QUEUE SI_TIMER SI_ASYNCIO SI_MESGQ ), - # this was implemented in 5.21, but not exported; it was added to - # @EXPORT_OK late in 5.23, and will be added to :math_h_c99 tag early - # in 5.25 - qw( lround ), ], ); -plan (tests => 2 * keys %expect); +plan (tests => 2 * keys(%expect) + keys(%POSIX::)); while (my ($var, $expect) = each %expect) { my $have = *{$POSIX::{$var}}{ARRAY}; @@ -181,3 +190,23 @@ while (my ($var, $expect) = each %expect) { "Correct number of entries for \@POSIX::$var"); is_deeply([sort @$have], $expect, "Correct entries for \@POSIX::$var"); } + +my %no_export_needed = map +($_ => 1), + qw(AUTOLOAD bootstrap constant croak import load_imports + unimplemented_message usage); + +my %exported = map +($_ => 1), + (@POSIX::EXPORT, @POSIX::EXPORT_OK, map @$_, values %POSIX::EXPORT_TAGS); + +for my $name (sort keys %POSIX::) { + my $code = do { no strict 'refs'; \&{"POSIX::$name"} }; + if (!defined &$code) { + pass("$name need not be exported as it does not name a subroutine"); + } + elsif ($no_export_needed{$name}) { + pass("$name need not be exported as it is part of the internals"); + } + else { + ok($exported{$name}, "subroutine POSIX::$name is exported somehow"); + } +} diff --git a/ext/POSIX/t/math.t b/ext/POSIX/t/math.t index 54067d1..ea0c0e3 100644 --- a/ext/POSIX/t/math.t +++ b/ext/POSIX/t/math.t @@ -4,7 +4,6 @@ use strict; use POSIX ':math_h_c99'; use POSIX ':nan_payload'; -use POSIX 'lround'; use Test::More; use Config; diff --git a/ext/POSIX/t/unimplemented.t b/ext/POSIX/t/unimplemented.t index 9a03a75..6ee85f6 100644 --- a/ext/POSIX/t/unimplemented.t +++ b/ext/POSIX/t/unimplemented.t @@ -88,6 +88,7 @@ foreach ([atexit => 'C-specific: use END {} instead'], [vfprintf => 'C-specific, stopped'], [vprintf => 'C-specific, stopped'], [vsprintf => 'C-specific, stopped'], + [L_tmpnam => 'C-specific, stopped'], ) { my ($func, $action) = @$_; my $expect = ref $action -- Perl5 Master Repository
