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
IO::Seekable + POSIX -> constant subroutines redefined #9330
Comments
From @ntyniThis is a bug report for perl from ntyni@debian.org, As reported in http://bugs.debian.org/479957 : % perl -w -e 'use IO::Seekable; use POSIX' Flags: Site configuration information for perl 5.10.0: Configured by Debian Project at Thu May 8 11:57:24 UTC 2008. Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Locally applied patches: @INC for perl 5.10.0: Environment for perl 5.10.0: |
From @rgs2008/5/14 via RT Niko Tyni <perlbug-followup@perl.org>:
Or : perl -w -e 'use Fcntl "SEEK_SET"; use POSIX' Probably SEEK_* constants should be moved out of POSIX's Makefile.PL |
The RT System itself - Status changed from 'new' to 'open' |
From @nwc10On Thu, May 15, 2008 at 10:42:04AM +0200, Rafael Garcia-Suarez wrote:
It's actually worse than those three: $ ./perl -Ilib -w -e 'use Fcntl; BEGIN {Fcntl->import(@Fcntl::EXPORT_OK)} use POSIX;'Constant subroutine main::SEEK_SET redefined at -e line 1Constant subroutine main::S_IXOTH redefined at -e line 1Subroutine main::S_ISCHR redefined at -e line 1 The "Constant subroutine" warnings were new with 5.10, and I've fixed them The other 5 appear to be have been around rather longer than 5.10 - this $ ~/Reference/5.6.2-g/bin/perl -w -e 'use Fcntl; BEGIN {Fcntl->import(@Fcntl::EXPORT_OK)} use POSIX;' With change 33826 POSIX.pm now imports them from Fcntl.pm, rather than having sub S_IFMT { @_ ? ( $_[0] & _S_IFMT() ) : _S_IFMT() } (where _S_IFMT and S_IFREF are constants defined by XS from the system POSIX.xs had this code in AUTOLOAD, to call into POSIX::int_macro_int if ($NON_CONSTS{$constname}) { It's probably actually slower than the Fcntl approach. Fcntl generates these $ ./perl -Ilib -MPOSIX -MO=Concise,POSIX::S_ISREG -e0POSIX::S_ISREG: whereas the closure POSIX used to create generates these ops: $ ./perl -Ilib -MPOSIX -e 'BEGIN{POSIX::S_ISREG();} use O qw(Concise POSIX::S_ISREG)' Two entersubs for the price of one! (Not the cheapest of ops) Assuming I didn't do anything stupid here, this will be fixed in 5.10.1 Nicholas Clark |
From @nwc10Change 33825 by nicholas@nicholas-bouvard on 2008/05/15 10:10:27 It transpires that POSIX.xs also duplicated several constants defined Affected files ... ... //depot/perl/ext/POSIX/Makefile.PL#32 edit Differences ... ==== //depot/perl/ext/POSIX/Makefile.PL#32 (text) ==== @@ -48,13 +48,11 @@ ==== //depot/perl/ext/POSIX/POSIX.pm#54 (text) ==== @@ -4,7 +4,7 @@ our(@ISA, %EXPORT_TAGS, @EXPORT_OK, @EXPORT, $AUTOLOAD, %SIGRT) = (); -our $VERSION = "1.14"; use AutoLoader; @@ -13,7 +13,9 @@ # Grandfather old foo_h form to new :foo_h form ==== //depot/perl/t/lib/proxy_constant_subs.t#2 (text) ==== @@ -7,20 +7,20 @@ use strict; # GVf_IMPORTED_CV should not be set on the original, but should be set on the |
From @nwc10Change 33826 by nicholas@mouse-mill on 2008/05/15 11:24:43 Remove POSIX's internal implementation of S_ISBLK, S_ISCHR, S_ISDIR, Affected files ... ... //depot/perl/ext/B/t/concise-xs.t#41 edit Differences ... ==== //depot/perl/ext/B/t/concise-xs.t#41 (text) ==== @@ -177,7 +177,10 @@ POSIX => { dflt => 'constant', # all but 252/589 XS => [qw/ write wctomb wcstombs uname tzset tzname ==== //depot/perl/ext/POSIX/POSIX.pm#55 (text) ==== @@ -14,6 +14,7 @@ @@ -34,9 +35,9 @@ XSLoader::load 'POSIX', $VERSION; -my %NON_CONSTS = (map {($_,1)} sub AUTOLOAD { ==== //depot/perl/ext/POSIX/POSIX.xs#151 (text) ==== @@ -404,7 +404,7 @@ my $types = {map {($_, 1)} qw(IV)}; print constant_types(); # macro defs switch (len) { |
From @AbigailOn Thu, May 15, 2008 at 12:40:36PM +0100, Nicholas Clark wrote:
It warns with 5.6.0 and 5.6.1 as well, and doesn't warn with 5.005_04. Abigail |
From maddingue@free.frNicholas Clark wrote:
Isn't this the standard way constant are handled by ExtUtils::Constant? sub AUTOLOAD { and I have a similar one in Net::Pcap. Given Perl constants are pretty fast, wouldn't it be both faster and -- Close the world, txEn eht nepO. |
From @nwc10On Sat, May 17, 2008 at 01:01:23AM +0200, Sbastien Aperghis-Tramoni wrote:
No. It's not a constant function. It's 5 macros that process arguments,
There's similar code in POSIX.pm just after the C<} else {> above for dealing All this originated because POSIX.pm pre 5.8.0 had some really really sick The change that got rid of it was 10541. The diff is really hard to follow
They're not constants, so I don't think that this is valid. Nicholas Clark |
From @nwc10On Sat, May 17, 2008 at 12:10:28AM +0100, Nicholas Clark wrote:
I can't count. It's 6, not 5. Anyway, I removed int_macro_int with change Change 33896 by nicholas@mouse-mill on 2008/05/21 09:18:00 Eliminate POSIX::int_macro_int, and all the complex AUTOLOAD fandango Change 33897 by nicholas@mouse-mill on 2008/05/21 10:31:32 Replaced the WEXITSTATUS, WIFEXITED, WIFSIGNALED, WIFSTOPPED, WSTOPSIG I think I spent a bit more time on my code to measure the memory usage of the Bottom line of the two changes is that comparable memory usage from use POSIX; Only user visible change is that if you call the 6 with too many arguments you Was: Now: Is this fair game to inflict on buggy users of 5.10.0? Nicholas Clark |
From @nwc10Exporter::Heavy::heavy_export 3104 |
From @nwc10Exporter::Heavy::heavy_export 3104 |
From @rgs2008/5/21 Nicholas Clark <nick@ccl4.org>:
I tend to think so. Assuming the buggy call is not widely used on CPAN ? |
From maddingue@free.frRafael Garcia-Suarez <rgarciasuarez@gmail.wrote:
A quick search with Google Code Search seems to indicate that nobody -- Close the world, txEn eht nepO. |
p5p@spam.wizbit.be - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#54186 (status was 'resolved')
Searchable as RT54186$
The text was updated successfully, but these errors were encountered: