Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004756OCamlOCaml generalpublic2009-03-26 16:222009-04-19 11:10
Reporterrose 
Assigned Toweis 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.10.2 
Target VersionFixed in Version3.11.1+dev 
Summary0004756: closure interpreted as string when using %_ in printf routine
DescriptionThe 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.
TagsNo tags attached.
Attached Files? file icon printf_bug.ml [^] (2,066 bytes) 2009-03-26 16:22 [Show Content]

- Relationships

-  Notes
(0004863)
weis (developer)
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 (developer)
2009-03-30 12:42

I fixed it the simple way: %_s conversion now raises an exception in printf.

- Issue History
Date Modified Username Field Change
2009-03-26 16:22 rose New Issue
2009-03-26 16:22 rose File Added: printf_bug.ml
2009-03-28 12:35 weis Note Added: 0004863
2009-03-28 12:37 weis Assigned To => weis
2009-03-28 12:37 weis Status new => assigned
2009-03-30 12:42 weis Note Added: 0004890
2009-03-30 12:43 weis Resolution open => fixed
2009-03-30 12:44 weis Status assigned => closed
2009-04-19 11:10 xleroy Fixed in Version => 3.11.1+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker