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
keys are readonly in perl 5.14.2! #12874
Comments
From @demerphqI consider this a serious bug in 5.14 $ perl5.14.2 -MDevel::Peek -le'print $]; my %hash=("A".."D"); @x= keys So why would a COPY of a key be READONLY? In blead: $ ./perl -Ilib -MDevel::Peek -le'print $]; my %hash=("A".."D"); @x= Is anyone familiar with this issue? Should I file a ticket? Yves -- |
From zefram@fysh.orgyves orton wrote:
FAKE+READONLY means it's not actually unwritable, it's copy-on-write. #define SVf_FAKE 0x01000000 /* 0: glob or lexical is just a copy In your case, SvLEN == 0, marking it as a shared hash key. $ perl5.14.2 -MDevel::Peek -le'print $]; my %hash=("A".."D"); @x= keys %hash; Dump($x[0]); $x[0] = "foo"; Dump($x[0])' -zefram |
The RT System itself - Status changed from 'new' to 'open' |
From @demerphqOn 22 March 2013 17:54, Zefram via RT <perlbug-followup@perl.org> wrote:
Ah. I see. So the bug is in HTML::Entities. The actual code that kicked this off was this: $ booking-perl5.14.2 -MDevel::Peek -MHTML::Entities -le'print $]; my Yves -- |
From @LeontOn Fri, Mar 22, 2013 at 5:58 PM, demerphq <demerphq@gmail.com> wrote:
This is a perfect example of one of those reasons why Leon |
From @demerphqOn 22 March 2013 18:01, Leon Timmermans <fawaka@gmail.com> wrote:
So all Gisle has to do is call that? I filed this ticket with the distro: https://rt.cpan.org/Ticket/Display.html?id=84144 Yves -- |
From @nwc10On Fri, Mar 22, 2013 at 06:01:02PM +0100, Leon Timmermans wrote:
It actually dates all the way back to 5.8.0, which made hash keys themselves $ ~/Sandpit/580g/bin/perl5.8.0 -MHTML::Entities -le 'my %hash=("A".."D"); foreach (keys %hash) {decode_entities($_); print $_}' whereas concatenating an empty string on the key: $ ~/Sandpit/580g/bin/perl5.8.0 -MHTML::Entities -le 'my %hash=("A".."D"); foreach (keys %hash) {$_ .= ""; decode_entities($_); print $_}' triggers the copy. Nicholas Clark |
From @demerphqOn 25 March 2013 10:44, Nicholas Clark <nick@ccl4.org> wrote:
Thanks, yeah, I had figured that out already. I tried to fix HTML::Entities but there is a minor issue, see the mail cheers, -- |
From @cpansproutOn Fri Mar 22 10:18:45 2013, demerphq wrote:
That ticket is resolved, so I am resolving this one, too. Please say -- Father Chrysostomos |
@cpansprout - Status changed from 'open' to 'resolved' |
From @demerphqHow is the original problem resolved? I am reopening this ticket as it has no information on why it was Please dont close tickets without an explanation. Thanks, On 4 June 2013 03:26, Father Chrysostomos via RT
-- |
From @demerphqThe point I refer to is that you made read-only keys no longer have This means that old code that tests for read-onlyness will mindlessly How it affected HTML::Entities is just a symptom of a dangerous So, what did you do to address this issue so that this ticket can be closed? On 4 June 2013 07:38, demerphq <demerphq@gmail.com> wrote:
-- |
From @cpansproutOn Mon Jun 03 22:45:16 2013, demerphq wrote:
But that was not the subject of the ticket. :-) If you want this ticket to encompass that, so be it. Reopening.... -- Father Chrysostomos |
@cpansprout - Status changed from 'resolved' to 'open' |
From @cpansproutOn Mon Jun 03 22:45:16 2013, demerphq wrote:
I still disagree with you. I am going to try and persuade you to change In my experience, most XS code simply does not modify string buffers Most of the code I have seen that modifies SvPVX in place is old code I also find it unconvincing that the presence of the SvREADONLY flag is If copy-on-write is to become more prevalent, then under the Anyway, the point I am trying to get to is that there are certain According to the READONLY+FAKE scheme, it is not possible to have a COW That means that $x = "hello" will always copy the buffer. It also means $ time ./perl -Ilib -e '$x = " "x2**31' real 0m32.062s real 0m2.635s Some people lock their objects supposedly for the sake of speed All this can be cleaned up if we allow read-only COWs, which cannot -- Father Chrysostomos |
Migrated from rt.perl.org#117299 (status was 'open')
Searchable as RT117299$
The text was updated successfully, but these errors were encountered: