Skip to content
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

sprintf() not threadsafe/reentrant if the format tokens use explicit indices #5261

Open
p6rt opened this issue Apr 23, 2016 · 5 comments
Open

Comments

@p6rt
Copy link

p6rt commented Apr 23, 2016

Migrated from rt.perl.org#127974 (status was 'open')

Searchable as RT127974$

@p6rt
Copy link
Author

p6rt commented Apr 23, 2016

From @smls

The following works fine​:

  say sprintf '%1$s %2$s', 5, 42;

But the following fails​:

  await do for ^100 {
  start {
  say sprintf '%1$s %2$s', 5, 42
  }
  }

  ## Camelia-friendly version​:
  # for (^100).race(batch=>1) { sprintf '%1$s %2$s', 5, 42 }

It prints a few successful iterations, but at some point dies with «Your printf-style directives specify 0 arguments, but 2 arguments were supplied».

The error only occurs if the format directives specify explicit argument indices. If the '%1$s %2$s' format is replaced with '%s %s' in the example above, it completes without error.

@p6rt
Copy link
Author

p6rt commented Jul 9, 2016

From @zoffixznet

Still present in 959cd3

<Zoffix> m​: for (^100).race(batch=>1) { sprintf '%1$s %2$s', 5, 42 }
<camelia> rakudo-moar 959cd3​: OUTPUT«(signal ABRT)*** Error in `/home/camelia/rakudo-m-inst-1/bin/moar'​: double free or corruption (fasttop)​: 0x0000000004383d80 ***␤======= Backtrace​: =========␤/lib64/libc.so.6(+0x730bf)[0x7f2af7fb40bf]␤/lib64/libc.so.6(+0x7892e)[0x7f2af7fb992e]␤/lib6…»
<Zoffix> m​: for (^100).race(batch=>1) { sprintf '%1$s %2$s', 5, 42 }
<camelia> rakudo-moar 959cd3​: OUTPUT«Your printf-style directives specify 0 arguments, but 2 arguments were supplied␤ in any at /home/camelia/rakudo-m-inst-1/share/perl6/runtime/CORE.setting.moarvm line 1␤ in any panic at /home/camelia/rakudo-m-inst-1/share/nqp/lib/NQPHLL.moarvm line 1…»

@p6rt
Copy link
Author

p6rt commented May 28, 2017

From @smls

Still present in

  Rakudo version 2017.05-272-gfa7aa1c36 built on MoarVM version 2017.05-25-g62bc54e9
  implementing Perl 6.c.

@p6rt
Copy link
Author

p6rt commented Mar 11, 2018

From @dogbert17

On Sun, 28 May 2017 02​:34​:13 -0700, smls75@​gmail.com wrote​:

Still present in

Rakudo version 2017.05-272-gfa7aa1c36 built on MoarVM version 2017.05-
25-g62bc54e9
implementing Perl 6.c.

Fixed, probably by one or more of the following commits​:
7c18112c59d20413b82356e5c48b38d8a66fc7ea
c285b489c6629ccdf0c4cb11d2d695b9ef1f890c
7fcab1067de4757bfdf2fdd1c66893ce4ab06e1b
89b9ac7830bdc195cb303f5241641e0dbe0ebbde
683037be698d0bdc21b3c23588085b2d076d7a0a
b5605c2dd6d361b705a59136c8ad641f245a5da5
c50d35a90e66346157b31cd92643c2a64e801c24
de311f46a98f13a5b0211d2585fbd9b17ce1bf2c
340d8ed3bb4b45af85708771bea396cf862a7330
3b98fb9e396d040a8cb2c32d23cee54a5e88f878
596611c8fdc3baf119bc94a8ea30efc0a12cf673
80b49320cf854ac68a17cdd216575ee26e380325
61a77e60a7d936415503d8916fcc7546569e9135

@p6rt
Copy link
Author

p6rt commented Mar 11, 2018

The RT System itself - Status changed from 'new' to 'open'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant