|Anonymous | Login | Signup for a new account||2016-09-29 13:58 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0006165||OCaml||OCaml windows||public||2013-09-07 19:02||2014-01-22 14:04|
|Target Version||4.01.1+dev||Fixed in Version||4.01.1+dev|
|Summary||0006165: Alterations to handling of \013 in source files breaking other tools|
|Description||PR#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 Reproduce||Attempt to build menhir-20130116 on Windows using the mingw 32-bit port and OCaml 4.01.0+rc2|
|Additional Information||See also https://sympa.inria.fr/sympa/arc/caml-list/2013-08/msg00009.html [^]|
|Attached Files||ocaml-4.01.0-PR6165.patch [^] (426 bytes) 2013-09-07 19:03 [Show Content]|
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.
|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.|
|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.|
|OK - would the intention still be to consider/target this patch for ocaml-next (or whatever the new marker is!), though?|
|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? :)|
|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).|
> The attached patch changes the newline regexp to \r*\n
This is a feature request that I view with a very favourable eye.
> 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.
Patch applied in 4.01 branch (commit 14404) and trunk (commit 14405).
|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|