Ticket #1835 (closed bug: fixed)

Opened 6 years ago

Last modified 6 years ago

Assertion failure reading a single character from stdin

Reported by: rgrjr Owned by: nwellnhof
Priority: normal Milestone: 2.10
Component: none Version: 2.10.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:


The code below used to work for reading a single character, at least as recently as r45000, but fails miserably in r49633. TIA,

rogers@rgr> cat new-test.pir

.sub test :main
	.local pmc stdin
	stdin = getstdin
	.local string input_string
	.local int len
	input_string = stdin.'read'(1)
	len = length input_string
	print "got len "
	print len
	print "\n"
rogers@rgr> ./parrot new-test.pir
src/gc/string_gc.c:442: failed assertion '!(*Buffer_bufflagsptr(str) & Buffer_shared_FLAG)'
Backtrace - Obtained 21 stack frames (max trace depth is 32).
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(+0x75a42) [0xb754ea42]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(Parrot_confess+0x9a) [0xb754ea0a]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(+0x88568) [0xb7561568]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(+0x846d8) [0xb755d6d8]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(+0x7ee65) [0xb7557e65]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(+0xe8b99) [0xb75c1b99]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(+0xe80d0) [0xb75c10d0]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(+0xe671c) [0xb75bf71c]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(Parrot_io_reads+0x20a) [0xb75bd48a]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(+0x158fb9) [0xb7631fb9]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(+0x168eaf) [0xb7641eaf]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(+0x45622) [0xb751e622]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(+0xd1e31) [0xb75aae31]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(+0xd0eaa) [0xb75a9eaa]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(+0x950ff) [0xb756e0ff]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(Parrot_pcc_invoke_from_sig_object+0x19b) [0xb756873b]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(Parrot_ext_call+0x103) [0xb754f603]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(Parrot_runcode+0x1af) [0xb754c49f]
/alt/usr/src/parrot/blib/lib/libparrot.so.2.9.1(imcc_run_pbc+0x99) [0xb768d719]
./parrot() [0x8049085]
/lib/libc.so.6(__libc_start_main+0xfe) [0xb726ec0e]

Change History

Changed 6 years ago by rgrjr

Binary search shows that this has failed ever since r46353, when the assertion was added, so this is probably something that was missed when immutable strings were implemented.

Changed 6 years ago by nwellnhof

I think it's perfectly safe to reallocate shared strings, so the assertion should be removed.


Changed 6 years ago by rgrjr

I tried removing the assertions, but got a zero-length string, which I suppose is a new bug. (In r46352, it got a string consisting of a single null character, which is wrong in yet another way.)

Changed 6 years ago by nwellnhof

  • owner set to nwellnhof
  • status changed from new to assigned

This should also be fixed by r49646.

Changed 6 years ago by nwellnhof

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.