[GHC] #8482: Permission denied when copying file to current directory with copyFile

GHC ghc-devs at haskell.org
Mon Nov 3 00:16:28 UTC 2014


#8482: Permission denied when copying file to current directory with copyFile
-------------------------------------+-------------------------------------
              Reporter:  Henk-Jan    |            Owner:  ekmett
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:
             Component:  Core        |          Version:  7.6.3
  Libraries                          |         Keywords:  copyFile
            Resolution:              |  permission denied
      Operating System:  Windows     |     Architecture:  x86
       Type of failure:  Incorrect   |       Difficulty:  Unknown
  result at runtime                  |       Blocked By:
             Test Case:              |  Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
Changes (by gintas):

 * cc: core-libraries-committee@… (added)


Comment:

 This seems to be a special case of the issue when the destination path is
 a directory without the filename, not a full path (consider "mv foo.txt
 a/foo.txt" vs "mv foo.txt a/").

 I suspect the difference in behavior is due to Win32.moveFileEx behaving
 differently from Posix.rename in this situation, see

 http://hackage.haskell.org/package/directory-1.2.1.0/docs/src/System-
 Directory.html#renameFile

 The documentation says that the second operand must not be a directory,
 but the code does not check for that. Looks like a bug then.

 There's likely code relying on the buggy behavior, the fix could be a bit
 risky...

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8482#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list