|Anonymous | Login | Signup for a new account||2016-02-13 07:54 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005442||OCaml||for Camlp4 use https://github.com/ocaml/camlp4/issues||public||2011-12-23 14:59||2015-12-11 19:07|
|Target Version||Fixed in Version||3.12.1+dev|
|Summary||0005442: camlp4: quotation issue with strings|
|Description||This was reported on 2011-07-11 by Petter Urkedal on caml-list under the subject "Quotation issue with camlp4 printer".|
The attached program prints out
let x = """;;
when compiled with ocamlc and camlp4 version 3.12.0. As you can see,
the string literal lacks an escape character. I haven't tried version
3.12.1, but I didn't find anything about it in the release notes.
|Steps To Reproduce|| ocamlc.opt -c -I +camlp4 -pp camlp4orf -o quotation_bug.cmo |
ocamlc.opt dynlink.cma -I +camlp4 camlp4lib.cma quotation_bug.cmo
|Additional Information||A tentative fix was done in commit 11119, but it breaks findlib (among others) because it double-escapes everything in string constants when preprocessing normal code with "camlp4 pa_o.cmo pr_o.cmo".|
It looks like the problem is in the parsing of quotations, not in the printing code.
|Tags||No tags attached.|
|Attached Files||quotation_bug.ml [^] (172 bytes) 2011-12-23 14:59 [Show Content]|
Fixed. Commits 11947 and 11948.
The problem was due to the fact that strings are escaped in the camlp4 ast, so they must be escaped again when the ast is meta-expansed, but it was not done.
There is a problem with the fix: it breaks type-conv 2.3.0.
Install type-conv version 2.3.0 (I haven't tried other version) from Jane Street web site.
module Foo = struct end;; module Bar = struct end;;
camlp4o /usr/local/ocaml/3.12/lib/ocaml/site-lib/type-conv/pa_type_conv.cma foo.ml
With text output, you get: Failure: "Cannot print \"\\\\$:i\" this string contains more than one token"
With AST output, you get a compiler error because both identifiers Foo and Bar got replaced by \$:i
I've narrowed it down to your commit. If I replace "String.escaped" with "safe_string_escaped" at line 474 of boot/Camlp4Ast.ml, it seems to fix the problem, but I'll let you decide what to do because I don't really understand camlp4.
It is indeed safe_string_escaped that must be used instead of String.escaped.
Fixed by commits 11983 and 11984.
|2011-12-23 14:59||doligez||New Issue|
|2011-12-23 14:59||doligez||Status||new => assigned|
|2011-12-23 14:59||doligez||Assigned To||=> ertai|
|2011-12-23 14:59||doligez||File Added: quotation_bug.ml|
|2011-12-23 15:29||doligez||Assigned To||ertai =>|
|2011-12-23 15:30||doligez||Assigned To||=> doligez|
|2011-12-23 15:30||doligez||Status||assigned => acknowledged|
|2011-12-23 15:30||doligez||Assigned To||doligez =>|
|2011-12-23 17:33||dim||Note Added: 0006520|
|2011-12-23 17:33||dim||Assigned To||=> dim|
|2011-12-23 17:33||dim||Status||acknowledged => resolved|
|2011-12-23 17:33||dim||Resolution||open => fixed|
|2011-12-23 17:33||dim||Fixed in Version||=> 3.12.1+dev|
|2011-12-30 13:57||doligez||Note Added: 0006560|
|2011-12-30 13:57||doligez||Status||resolved => feedback|
|2011-12-30 13:57||doligez||Resolution||fixed => reopened|
|2011-12-30 13:58||doligez||Status||feedback => acknowledged|
|2011-12-30 21:02||dim||Note Added: 0006573|
|2011-12-30 21:02||dim||Status||acknowledged => resolved|
|2011-12-30 21:02||dim||Resolution||reopened => fixed|
|2012-06-12 17:23||dim||Relationship added||related to 0005646|
|2012-06-19 13:08||garrigue||Relationship added||related to 0005633|
|2015-12-11 19:07||xleroy||Status||resolved => closed|
|2016-02-08 12:49||doligez||Category||Camlp4 => for Camlp4 use https://github.com/ocaml/camlp4/issues/102 [^]|
|2016-02-08 12:50||doligez||Category||for Camlp4 use https://github.com/ocaml/camlp4/issues/102 [^] => for Camlp4 use https://github.com/ocaml/camlp4/issues [^]|
|Copyright © 2000 - 2011 MantisBT Group|