Ticket #1791 (closed bug: fixed)

Opened 11 years ago

Last modified 11 years ago

zero-length string loses encoding in .pbc

Reported by: pmichaud Owned by:
Priority: normal Milestone:
Component: core Version: 2.7.0
Severity: medium Keywords:
Cc: chromatic Language:
Patch status: Platform:

Description

A zero-length utf8 string loses its encoding when saved in a .pbc file:

pmichaud@orange:~/parrot/trunk$ ./parrot_config revision
48985
pmichaud@orange:~/parrot/trunk$ cat z.pir
.sub 'main' :main
    $S0 = utf8:unicode:""
    $I0 = encoding $S0
    $S1 = encodingname $I0
    say $S1
.end

pmichaud@orange:~/parrot/trunk$ ./parrot -o z.pbc z.pir
pmichaud@orange:~/parrot/trunk$ ./parrot z.pir
utf8
pmichaud@orange:~/parrot/trunk$ ./parrot z.pbc
ascii
pmichaud@orange:~/parrot/trunk$ 

This makes a difference for functions that make use of string encoding directly; for example, Rakudo passes C<utf8:unicode:""> to the C<get_string_as> method of ByteBuffer to request a unicode string (but is getting an ascii string when invoked from a .pbc).

Pm

Change History

follow-ups: ↓ 2 ↓ 5   Changed 11 years ago by jkeenan

  • component changed from none to core

Patrick, would you characterize this as a newly discovered bug, or as a regression from previously correct behavior?

in reply to: ↑ 1   Changed 11 years ago by plobsing

Replying to jkeenan:

Patrick, would you characterize this as a newly discovered bug, or as a regression from previously correct behavior?

This is a regression introduced in r48969. The CONST_STRING table is ascii-only.

Not sure if we want to revert or ammend.

  Changed 11 years ago by jkeenan

Possibly related ticket: TT #468

  Changed 11 years ago by jkeenan

  • cc chromatic added

cc-ing chromatic, as r48969 was his.

in reply to: ↑ 1   Changed 11 years ago by pmichaud

Replying to jkeenan:

Patrick, would you characterize this as a newly discovered bug, or as a regression from previously correct behavior?

It's definitely a regression -- it worked correctly in previous versions of Parrot. I noticed it today because one of Rakudo's spectests started failing when running against recent Parrot revisions. I didn't have time to search the Parrot history to find the offending commit, but I'm reasonably certain plobsing++ is correct in its identification.

Pm

  Changed 11 years ago by bacek

r48969

-- Bacek

  Changed 11 years ago by plobsing

Added todo'd testcase in r48987.

  Changed 11 years ago by bacek

  • status changed from new to closed
  • resolution set to fixed

Fixed in r48992.

Note: See TracTickets for help on using tickets.