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

Broken semantics of %(%) when substituted by a box #6533

Closed
vicuna opened this issue Sep 2, 2014 · 6 comments
Closed

Broken semantics of %(%) when substituted by a box #6533

vicuna opened this issue Sep 2, 2014 · 6 comments
Assignees
Milestone

Comments

@vicuna
Copy link

vicuna commented Sep 2, 2014

Original bug ID: 6533
Reporter: @yakobowski
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2016-12-07T10:34:47Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 4.02.0+beta1 / +rc1
Target version: 4.02.1+dev
Category: standard library
Monitored by: @gasche "Julien Signoles" @hcarty

Bug description

The following code exhibits very different outputs in 4.02

let fmt = Format.std_formatter

let () =
Format.fprintf fmt "@[<v 2>";
Format.fprintf fmt "{@ ";
let pp_elt fmt i = Format.fprintf fmt "%d" i in
Format.fprintf fmt "%(%)%a%(%)" "@[" pp_elt 1 "@]@ ";
pp_elt fmt 5;
Format.fprintf fmt "@;<1 -2>}";
Format.fprintf fmt "@]@.";

The problem is in the interpretation of the first %(%). The '@[' format seems to be ignored.

File attachments

@vicuna
Copy link
Author

vicuna commented Sep 2, 2014

Comment author: bvaugon

Ok, copy/paste error in camlinternalFormat.ml.
Fixed by the attached patch.

@vicuna
Copy link
Author

vicuna commented Sep 9, 2014

Comment author: @yakobowski

Thanks. However, unless I'm mistaken, this is actually a patch for the trunk, not 4.02.0?

@vicuna
Copy link
Author

vicuna commented Sep 9, 2014

Comment author: bvaugon

Normally, this patch is both for 4.02.0 and trunk. To apply it on 4.02.0, the procedure is:

tar zxf ocaml-4.02.0.tar.gz
cd ocaml-4.02.0
patch -p1 < /path/to/fix-subst-open-tag-bug-ocaml-4.02.0.diff
./configure ...
make ...
make install

@vicuna
Copy link
Author

vicuna commented Sep 9, 2014

Comment author: @yakobowski

My apologies, I tried to apply the patch above an Opam 4.02 compilation tree that was not up-to-date wrt. 4.02 itself... Sorry for the noise.

@vicuna
Copy link
Author

vicuna commented Sep 10, 2014

Comment author: @gasche

Meta-comment: I will apply this patch, as well as the other Format fixes lying around, but I'm in holidays this post-ICFP week so it will probably happen next week. If anyone has a good reason to need the fixes earlier, ask for it, I could possibly free some time or delegate to Damien.

@vicuna
Copy link
Author

vicuna commented Sep 18, 2014

Comment author: @gasche

Fixed in 4.02 branch.

@vicuna vicuna closed this as completed Dec 7, 2016
@vicuna vicuna added the stdlib label Mar 14, 2019
@vicuna vicuna added this to the 4.02.1 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
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

2 participants