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

Thread version of input_line #2410

Closed
vicuna opened this issue Mar 30, 2000 · 2 comments
Closed

Thread version of input_line #2410

vicuna opened this issue Mar 30, 2000 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Mar 30, 2000

Original bug ID: 73
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Michael McDougall
Version: 2.01, 2.02, 2.04
OS: Linux (2.01, 2.04) & Solaris 2.02
Submission from: halifax.cis.upenn.edu (158.130.66.10)

The problem:

The version of input_line which gets linked when you use the threads library
will not return the contents of a 1 line file. It returns an EOF exception.
The non-Threads version works fine.

How to reproduce:

  1. create a file 'testfile' that contains 1 line of text (ie. no '\n'
    characters).
    Example:
    (==== signifies start/end of a file)
    ==============================================================
    A one line file!
    ==============================================================

  2. Create an ml file called bugtest.ml:

====================================================
let file = open_in ("testfile") in
let str = input_line file in
print_string (str ^ "\n")

  1. Make 2 executables, one linked with the normal pervasives called "bugtest",
    the other with the thread-safe pervasives called "bugtestthreads".

%ocamlc -c bugtest.ml
%ocamlc -custom unix.cma -cclib -lunix
-o bugtest bugtest.cmo
%ocamlc -thread -custom unix.cma -cclib -lunix threads.cma -cclib
-lthreads
-o bugtestthreads bugtest.cmo

  1. Run the two executables. They should give the same output but the
    thread-safe
    version doesn't read the file.

%./bugtest
jdshlkjshdlkjhsdljaslkjhsk
%./bugtestthreads
Fatal error: uncaught exception End_of_file

@vicuna
Copy link
Author

vicuna commented Apr 3, 2000

Comment author: administrator

The version of input_line which gets linked when you use the threads library
will not return the contents of a 1 line file. It returns an EOF exception.
The non-Threads version works fine.

You're right. I just fixed this. Thanks for the bug report.

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Apr 3, 2000

Comment author: administrator

Fixed on 2000-04-03 by Xavier

@vicuna vicuna closed this as completed Apr 3, 2000
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant