develooper Front page | perl.perl5.porters | Postings from March 2021

Re: Perl 7: Fix string leaks?

Thread Previous | Thread Next
Yuki Kimoto
March 29, 2021 00:12
Re: Perl 7: Fix string leaks?
Message ID:
Does this mean that mkdir can be allowed to pass a string that has UTF8

Currently, I think that the correct behavior of Perl5 is that the bytes are
passed to mkdir.

For example, bytes means cp932 in windows, or UTF-8 in Mac or Linux/UNIX.

2021年3月27日(土) 20:48 Felipe Gasper <>:

> If “gently breaking” changes in Perl 7 are possible, would fixing these
> conspicuous leaks in Perl’s string storage abstraction be possible?
> 1) Change the default XS typemap such that `char *` and `const char *` use
> SvPVbyte_nolen. The status quo here uses SvPV_nolen, which leaks the SV
> internals without giving the XS code any means to “recover” from the leak
> (i.e. to query the SV’s UTF8 bit).
> 2) Change exec, mkdir, et al. to use SvPVbyte_nolen rather than
> SvPV_nolen. This fixes the same problem. It’s what CPAN Sys::Binmode does
> currently; this would apply that change to core instead.
> Both of these will break code that decodes strings without manually
> encoding them for output to a byte layer, so they’re not really workable in
> Perl 5. But they’re also eminent examples of desirable-but-breaking fixes.
> I’m happy to work on these when/if it’s decided that they’re agreeable.
> cheers,
> -Felipe

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About