Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
    • Insights
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
    • Locked Files
  • Issues 3,616
    • Issues 3,616
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 198
    • Merge Requests 198
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Security & Compliance
    • Security & Compliance
    • Dependency List
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #4968

Closed
Open
Opened Feb 17, 2011 by ganesh@trac-ganesh
  • Report abuse
  • New issue
Report abuse New issue

openTempFile fails on Windows if a directory exists with the file name it tries

The program below works on Linux but fails on Windows with "permission denied" from the second openTempFile.

I think the reason is that findTempName in the openTempFile source doesn't get eEXIST when a directory with the same name exists, so it fails instead of trying again.

The real use case behind this code is making temp directories on multiple threads simultaneously.

import Prelude
import System.IO
import System.Directory

main :: IO ()
main = do
    dir <- getTemporaryDirectory
    (npath1, handle1) <- openTempFile dir "tmp"
    hClose handle1
    removeFile npath1
    createDirectory npath1
    (npath2, handle2) <- openTempFile dir "tmp"
    return ()
Trac metadata
Trac field Value
Version 7.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC ganesh@earth.li
Operating system
Architecture

Related issues

  • Discussion
  • Designs
Assignee
Assign to
7.4.2
Milestone
7.4.2
Assign milestone
Time tracking
None
Due date
None
5
Labels
bug core libraries incorrect runtime result P::high Trac import
Assign labels
  • View project labels
Reference: ghc/ghc#4968