MantisBT - OCaml
View Issue Details
0004756OCaml~DO NOT USE (was: OCaml general)public2009-03-26 16:222009-04-19 11:10
0004756: closure interpreted as string when using %_ in printf routine
The use of "%_s" e.g. in format specifiers for printf routines is probably not allowed, but the routine cannot check this, because the arguments are counted incorrectly by ocaml. If I write in ocaml the phrase

Printf.sprintf "Hello %s, how %_s you" "Tom";;

the answer is not "Exception ... bad conversion %_ ...", instead a closure is
incorrectly returned as string value:

val s : string = "\212\168\198 ... \000\000"

A detailed description is attached as file '' and a possible
fix (the responsible function) is described there. This is a minor bug, because
it occurs only, if users compile programs with incorrect format specifications.
No tags attached.
? (2,066) 2009-03-26 16:22
Issue History
2009-03-26 16:22roseNew Issue
2009-03-26 16:22roseFile Added:
2009-03-28 12:35weisNote Added: 0004863
2009-03-28 12:37weisAssigned To => weis
2009-03-28 12:37weisStatusnew => assigned
2009-03-30 12:42weisNote Added: 0004890
2009-03-30 12:43weisResolutionopen => fixed
2009-03-30 12:44weisStatusassigned => closed
2009-04-19 11:10xleroyFixed in Version => 3.11.1+dev
2017-02-23 16:36doligezCategoryOCaml general => -OCaml general
2017-03-03 17:55doligezCategory-OCaml general => -(deprecated) general
2017-03-03 18:01doligezCategory-(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04doligezCategory~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

2009-03-28 12:35   
Thank you very much for the detailed bug report. I'm investigating the problem and will let you know the solution I will find.
2009-03-30 12:42   
I fixed it the simple way: %_s conversion now raises an exception in printf.