Skip Menu |

This queue is for tickets about the Socket CPAN distribution.

Report information
The Basics
Id: 104120
Status: resolved
Priority: 0/
Queue: Socket

People
Owner: Nobody in particular
Requestors: ribasushi [...] leporine.io
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.017
Fixed in: 2.020



Subject: Missing symbol on perl < 5.8.8
Subject: SvPVx_nolen.patch.txt
diff --git a/Socket.xs b/Socket.xs index 9595652..50a0f31 100644 --- a/Socket.xs +++ b/Socket.xs @@ -149,6 +149,14 @@ NETINET_DEFINE_CONTEXT # define Newx(v,n,t) New(0,v,n,t) #endif /* !Newx */ +#ifndef SvPVx_nolen +#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) +# define SvPVx_nolen(sv) ({SV *_sv = (sv); SvPV_nolen(_sv); }) +#else /* __GNUC__ */ +# define SvPVx_nolen(sv) ((PL_Sv = (sv)), SvPV_nolen(PL_Sv)) +#endif /* __GNU__ */ +#endif /* !SvPVx_nolen */ + #ifndef croak_sv # define croak_sv(sv) croak(SvPVx_nolen(sv)) #endif
On Thu Apr 30 05:12:03 2015, RIBASUSHI wrote: Show quoted text
> 2.017 introduced the following change to croak_sv: > https://metacpan.org/diff/file?target=PEVANS/Socket- > 2.017/&source=PEVANS/Socket-2.016/#Socket.xs > > For one cpan lists SvPVx as "undocumented": > https://metacpan.org/diff/file?target=GRAY/POSIX-RT-Spawn- > 0.10/&source=GRAY/POSIX-RT-Spawn-0.09/#Changes > and > https://metacpan.org/diff/file?target=SHLOMIF/XML-LibXML- > 1.86/&source=SHLOMIF/XML-LibXML-1.85/#Changes > > Moreover there seems to be very little use of SvPVx_nolen in the wild: > http://grep.cpan.me/?q=%5CbSvPVx_nolen%5Cb > > Nevertheless attached a patch (modeled on > https://metacpan.org/source/MHX/Convert-Binary-C- > 0.76/tests/include/perlinc/sv.h#L1594) > > Tested all the way down to 5.8.1 on linux, with no adverse effects.
SvPVx_nolen is not efficient because of PL_Sv. #ifndef croak_sv -# define croak_sv(sv) croak(SvPV_nolen(sv)) +# define croak_sv(sv) croak(SvPVx_nolen(sv)) #endif why not just write a PERL_STATIC_INLINE Socket_my_croak_sv and assign the sv to a C auto SV * before calling SvPV_nolen?
Sorry, severe lag, can't get on IRC properly a the moment. Regarding your comment: Show quoted text
> <LeoNerd> ribasushi: "this being applied" would suggest there was a ready-formed tested patch that I can just apply > <LeoNerd> I don't think there is
Please reread the last paragraph of https://rt.cpan.org/Ticket/Display.html?id=104120#txn-1492118 Show quoted text
> Nevertheless attached a patch... Tested all the way down to 5.8.1 on linux, with no adverse effects.
On Sun May 03 18:54:02 2015, BULKDD wrote: Show quoted text
> SvPVx_nolen is not efficient because of PL_Sv.
I verymuch doubt the inefficiency of the use of PL_Sv in croak_sv is going to matter; croak_sv is about to throw an exception in a "rare" error case anyway. Nobody minds. Show quoted text
> why not just write a PERL_STATIC_INLINE Socket_my_croak_sv and assign > the sv to a C auto SV * before calling SvPV_nolen?
Because offhand I can't think how the pTHX_/aTHX_ part would affect that, and theabove just seems plain easier. -- Paul Evans
Thanks!