MantisBT - OCaml
View Issue Details
0004756OCaml~DO NOT USE (was: OCaml general)public2009-03-26 16:222009-04-19 11:10
rose 
weis 
normalminoralways
closedfixed 
3.10.2 
3.11.1+dev 
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 'printf_bug.ml' 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.
? printf_bug.ml (2,066) 2009-03-26 16:22
https://caml.inria.fr/mantis/file_download.php?file_id=256&type=bug
Issue History
2009-03-26 16:22roseNew Issue
2009-03-26 16:22roseFile Added: printf_bug.ml
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)

Notes
(0004863)
weis   
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.
(0004890)
weis   
2009-03-30 12:42   
I fixed it the simple way: %_s conversion now raises an exception in printf.