Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006165OCamlOCaml windowspublic2013-09-07 19:022014-01-22 14:04
Reporterdra 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version4.01.0+beta/+rc 
Target Version4.01.1+devFixed in Version4.01.1+dev 
Summary0006165: Alterations to handling of \013 in source files breaking other tools
DescriptionPR#5598 alters parsing/lexer.mll so that "\r" is no longer allowed as a line breaking character (removing legacy MacOS 9 and earlier support). Unfortunately, this is also crashing external tools (in particular, menhir) which accidentally generate \r\r\n on Windows (this may happen when \r\n is erroneously passed through a print routine which expects \n on all platforms).
Steps To ReproduceAttempt to build menhir-20130116 on Windows using the mingw 32-bit port and OCaml 4.01.0+rc2
Additional InformationSee also https://sympa.inria.fr/sympa/arc/caml-list/2013-08/msg00009.html [^]
Tagsjunior_job, patch
Attached Filespatch file icon ocaml-4.01.0-PR6165.patch [^] (426 bytes) 2013-09-07 19:03 [Show Content]

- Relationships
related to 0005598resolveddoligez Incompatibility between ocamllex and compiler 

-  Notes
(0010322)
dra (reporter)
2013-09-07 19:05

Getting libraries primarily written with Unix in mind to support Windows is already enough of a faff - would it be acceptable for the OCaml lexer to be slightly more forgiving about stray \r characters while still retiring MacOS 9 support?
The attached patch changes the newline regexp to \r*\n (i.e. Unix line ending of \n definitely supported and a more relaxed Windows version). This is still an improvement on the previous situation where \r\r\n would be interpreted as two newlines.
With this patch, menhir does compile on Windows again.
(0010323)
protz (manager)
2013-09-07 19:54

I'll ask Fran├žois Pottier on Monday if he can easily fix this on the Menhir side, which would save Damien the hassle of issuing a rc3. I still agree that we should be more forgiving about \r's, but if we could postpone this to the next bugfix release, that would save Damien some trouble I think.
(0010332)
protz (manager)
2013-09-09 14:08

Fran├žois and I fixed the problem on the Menhir side. Menhir now compiles just fine on Windows (and generates proper files without extra \r's). A new release will be issued shortly.
(0010335)
dra (reporter)
2013-09-11 15:08

OK - would the intention still be to consider/target this patch for ocaml-next (or whatever the new marker is!), though?
(0010341)
protz (manager)
2013-09-11 22:53

I would be in favor of a warning that's "as-error" by default (you could then override it, but we would be pretty harsh already). Thoughts? :)
(0010345)
dra (reporter)
2013-09-12 13:01

A warning's a good idea - though perhaps as warning, rather than as error? To me, it's part of the "be liberal in input you receive and strict in output you send" mantra. What we're concerned about is that there's a newline which, for the two major OS categories supported means a \n. My other "objection" is that the current regular expression is very strict about an incorrect number of \rs (e.g. \r\r\n) but doesn't care about mixed Windows and Unix linebreaks in the same file (e.g. \r\n used for some lines and \n for the others).
(0010346)
doligez (administrator)
2013-09-12 14:01

> The attached patch changes the newline regexp to \r*\n

This is a feature request that I view with a very favourable eye.
(0010347)
protz (manager)
2013-09-12 14:08

> My other "objection" is that the current regular expression is very strict about an incorrect number of \rs (e.g. \r\r\n) but doesn't care about mixed Windows and Unix linebreaks in the same file (e.g. \r\n used for some lines and \n for the others).

That's a good point, so I'm in favor of reverting to a more forgiving behavior as well.
(0010827)
doligez (administrator)
2014-01-22 14:04

Patch applied in 4.01 branch (commit 14404) and trunk (commit 14405).

- Issue History
Date Modified Username Field Change
2013-09-07 19:02 dra New Issue
2013-09-07 19:03 dra File Added: ocaml-4.01.0-PR6165.patch
2013-09-07 19:05 dra Note Added: 0010322
2013-09-07 19:54 protz Note Added: 0010323
2013-09-08 10:53 gasche Relationship added related to 0005598
2013-09-09 14:08 protz Note Added: 0010332
2013-09-11 15:08 dra Note Added: 0010335
2013-09-11 22:08 doligez Tag Attached: patch
2013-09-11 22:09 doligez Status new => confirmed
2013-09-11 22:09 doligez Target Version => 4.01.1+dev
2013-09-11 22:53 protz Note Added: 0010341
2013-09-12 13:01 dra Note Added: 0010345
2013-09-12 14:01 doligez Note Added: 0010346
2013-09-12 14:01 doligez Tag Attached: junior_job
2013-09-12 14:08 protz Note Added: 0010347
2014-01-22 14:04 doligez Note Added: 0010827
2014-01-22 14:04 doligez Status confirmed => closed
2014-01-22 14:04 doligez Resolution open => fixed
2014-01-22 14:04 doligez Fixed in Version => 4.01.1+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker