Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,274
    • Issues 4,274
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 412
    • Merge Requests 412
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #3534

Closed
Open
Opened Sep 22, 2009 by judah@trac-judah

hSetBinaryMode fails after some input has been read

For the following program (BadSeek.hs), type a couple characters of input and press return. With ghc-6.10.3, it works fine; with ghc-6.11 it throws an error.

module Main where

import System.IO

main = do   
    getChar >>= print
    hSetBinaryMode stdin True
    getChar >>= print

With ghc-6.10:

$ ./BadSeek 
ab
'a'
'b'

With ghc-6.11:

$ ./BadSeek
ab
'a'
BadSeek: <stdin>: hSetBinaryMode: illegal operation (cannot flush the read buffer of a text-mode handle)

The error goes away if the first 'getChar' is commented out.

For libraries which are not yet using the Unicode I/O layer, having a way to temporarily set stdin to BinaryMode would be useful.

Trac metadata
Trac field Value
Version 6.11
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
6.12.1
Milestone
6.12.1
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#3534