Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005605OCamlOCaml standard librarypublic2012-05-03 04:482013-08-31 12:49
Reporterfuruse 
Assigned Toprotz 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005605: Scanf.scanf works differently around "@" char in 4.01.0+dev2
DescriptionIn OCaml 3.12.1,

# Scanf.scanf "%S %S@\n" (fun x y -> (x,y));;
"hello" "world"
- : string * string = ("hello", "world")
#

In OCaml 4.01.0+dev2_2012-04-17,

# Scanf.scanf "%S %S@\n" (fun x y -> (x,y));;
"hello" "world"
Exception:
Scanf.Scan_failure
 "scanf: bad input at char number 27: ``looking for '@', found '\\n'''".

I do not know it is a bug or not, but this difference causes trouble at ocaml setup.ml -build in OASIS.

An interesting thing is that the following works fine:

# Scanf.scanf "%S %S %s@\n" (fun x y z -> (x,y,z));;
"hello" "world" bye
- : string * string * string = ("hello", "world", "bye")


TagsNo tags attached.
Attached Files

- Relationships
duplicate of 0005380closedweis Strange sscanf input segfault 

-  Notes
(0007404)
ygrek (reporter)
2012-05-03 09:18
edited on: 2012-05-03 09:18

duplicate of 0005380

(0007405)
furuse (reporter)
2012-05-03 09:36

By reading the comment in scanf.mli, I understand the current behaviour is correct wrt it. So, I think it is a bug of OASIS caused by a buggy implementation of the old scanf.ml.

(** Scanning indications appear just after the string conversions [%s]
    and [%[ range ]] to delimit the end of the token. A scanning
    indication is introduced by a [\@] character, followed by some
    plain character [c]. It means that the string token should end
    just before the next matching [c] (which is skipped). If no [c]
    character is encountered, the string token spreads as much as
    possible. For instance, ["%s@\t"] reads a string up to the next
    tab character or to the end of input. If a [\@] character appears
    anywhere else in the format string, it is treated as a plain character.
(0007406)
doligez (administrator)
2012-05-03 13:45

This is a known bug in oasis, and as far as I know, it was fixed a few months ago:

https://forge.ocamlcore.org/tracker/index.php?func=detail&aid=1067&group_id=54&atid=291 [^]

- Issue History
Date Modified Username Field Change
2012-05-03 04:48 furuse New Issue
2012-05-03 09:18 ygrek Note Added: 0007404
2012-05-03 09:18 ygrek Note Edited: 0007404 View Revisions
2012-05-03 09:23 protz Relationship added duplicate of 0005380
2012-05-03 09:23 protz Status new => resolved
2012-05-03 09:23 protz Resolution open => fixed
2012-05-03 09:23 protz Assigned To => protz
2012-05-03 09:36 furuse Note Added: 0007405
2012-05-03 13:45 doligez Note Added: 0007406
2013-08-31 12:49 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker