Skip to content

Commit 1cb852d

Browse files
committedMay 16, 2016
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 33f01dd (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 19fc296, a few days ago, so merely deleting this additional symbol seems correct.
1 parent b40d1aa commit 1cb852d

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed
 

‎ext/POSIX/Makefile.PL

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ my @names =
4848
EUSERS EWOULDBLOCK EXDEV FILENAME_MAX F_OK HUPCL ICANON ICRNL IEXTEN
4949
IGNBRK IGNCR IGNPAR INLCR INPCK INT_MAX INT_MIN ISIG ISTRIP IXOFF IXON
5050
LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME
51-
LINK_MAX LONG_MAX LONG_MIN L_ctermid L_cuserid L_tmpnam MAX_CANON
51+
LINK_MAX LONG_MAX LONG_MIN L_ctermid L_cuserid MAX_CANON
5252
MAX_INPUT MB_LEN_MAX MSG_CTRUNC MSG_DONTROUTE MSG_EOR MSG_OOB MSG_PEEK
5353
MSG_TRUNC MSG_WAITALL NAME_MAX NCCS NGROUPS_MAX NOFLSH OPEN_MAX OPOST
5454
PARENB PARMRK PARODD PATH_MAX PIPE_BUF RAND_MAX R_OK SCHAR_MAX
@@ -74,8 +74,6 @@ my @names =
7474
{name=>"SIG_DFL", value=>"PTR2IV(SIG_DFL)", not_constant=>1},
7575
{name=>"SIG_ERR", value=>"PTR2IV(SIG_ERR)", not_constant=>1},
7676
{name=>"SIG_IGN", value=>"PTR2IV(SIG_IGN)", not_constant=>1},
77-
# L_tmpnam[e] was a typo--retained for compatibility
78-
{name=>"L_tmpname", value=>"L_tmpnam"},
7977
{name=>"NULL", value=>"0"},
8078
{name=>"_POSIX_JOB_CONTROL", type=>"YES", default=>["IV", "0"]},
8179
{name=>"_POSIX_SAVED_IDS", type=>"YES", default=>["IV", "0"]},

‎ext/POSIX/lib/POSIX.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use warnings;
44

55
our ($AUTOLOAD, %SIGRT);
66

7-
our $VERSION = '1.68';
7+
our $VERSION = '1.69';
88

99
require XSLoader;
1010

@@ -24,6 +24,7 @@ sub usage { croak "Usage: POSIX::$_[0]" }
2424
XSLoader::load();
2525

2626
my %replacement = (
27+
L_tmpnam => undef,
2728
atexit => 'END {}',
2829
atof => undef,
2930
atoi => undef,
@@ -337,7 +338,7 @@ my %default_export_tags = ( # cf. exports policy below
337338
stddef_h => [qw(NULL offsetof)],
338339

339340
stdio_h => [qw(BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid
340-
L_tmpname NULL SEEK_CUR SEEK_END SEEK_SET
341+
NULL SEEK_CUR SEEK_END SEEK_SET
341342
STREAM_MAX TMP_MAX stderr stdin stdout
342343
clearerr fclose fdopen feof ferror fflush fgetc fgetpos
343344
fgets fopen fprintf fputc fputs fread freopen

‎ext/POSIX/lib/POSIX.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2593,7 +2593,7 @@ C<EXIT_FAILURE> C<EXIT_SUCCESS> C<MB_CUR_MAX> C<RAND_MAX>
25932593

25942594
=item Constants
25952595

2596-
C<BUFSIZ> C<EOF> C<FILENAME_MAX> C<L_ctermid> C<L_cuserid> C<L_tmpname> C<TMP_MAX>
2596+
C<BUFSIZ> C<EOF> C<FILENAME_MAX> C<L_ctermid> C<L_cuserid> C<TMP_MAX>
25972597

25982598
=back
25992599

‎ext/POSIX/t/export.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ my %expect = (
4949
LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LDBL_DIG
5050
LDBL_EPSILON LDBL_MANT_DIG LDBL_MAX LDBL_MAX_10_EXP
5151
LDBL_MAX_EXP LDBL_MIN LDBL_MIN_10_EXP LDBL_MIN_EXP LINK_MAX
52-
LONG_MAX LONG_MIN L_ctermid L_cuserid L_tmpname MAX_CANON
52+
LONG_MAX LONG_MIN L_ctermid L_cuserid MAX_CANON
5353
MAX_INPUT MB_CUR_MAX MB_LEN_MAX NAME_MAX NCCS NDEBUG
5454
NGROUPS_MAX NOFLSH NULL OPEN_MAX OPOST O_ACCMODE O_APPEND
5555
O_CREAT O_EXCL O_NOCTTY O_NONBLOCK O_RDONLY O_RDWR O_TRUNC
@@ -148,7 +148,7 @@ my %expect = (
148148
localtime log mkdir nice open opendir pipe printf rand
149149
read readdir rename rewinddir rmdir sin sleep sprintf sqrt
150150
srand stat system time times umask unlink utime wait
151-
waitpid write
151+
waitpid write L_tmpnam
152152
),
153153
# this stuff was added in 5.21
154154
# (though an oversight meant that lround wasn't listed here

‎ext/POSIX/t/unimplemented.t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ foreach ([atexit => 'C-specific: use END {} instead'],
8888
[vfprintf => 'C-specific, stopped'],
8989
[vprintf => 'C-specific, stopped'],
9090
[vsprintf => 'C-specific, stopped'],
91+
[L_tmpnam => 'C-specific, stopped'],
9192
) {
9293
my ($func, $action) = @$_;
9394
my $expect = ref $action

0 commit comments

Comments
 (0)
Please sign in to comment.