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

#8482: Permission denied when copying file to current directory with copyFile -------------------------------------+------------------------------------- Reporter: Henk-Jan | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: | Version: 7.6.3 libraries/directory | Operating System: Windows Keywords: copyFile | Type of failure: Incorrect result permission denied | at runtime Architecture: x86 | Test Case: Difficulty: Unknown | Blocking: Blocked By: | Related Tickets: | -------------------------------------+------------------------------------- While the MS-DOS command {{{ C:\tmp\b>copy c:\tmp\a\x }}} runs successfully, the Haskell equivalent {{{ copyFile "c:\\tmp\\a\\x" "" }}} results in {{{ copyFile.hs: .\.copyFile584.tmp: copyFile: does not exist (Het systeem kan het opgegeven pad niet vinden.) }}} The Dutch explanation says: "The system can not find the specified path" {{{ copyFile "c:\\tmp\\a\\x" "." }}} results in {{{ copyFile.hs: .\.copyFile3960.tmp: copyFile: permission denied (Toegang geweigerd.) }}} The Dutch explanation says: "Access denied" -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8482 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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

#8482: Permission denied when copying file to current directory with copyFile -------------------------------------+------------------------------------- Reporter: Henk-Jan | Owner: gintas 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): * owner: ekmett => gintas -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8482#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8482: Permission denied when copying file to current directory with copyFile -------------------------------------+------------------------------------- Reporter: Henk-Jan | Owner: gintas 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: | -------------------------------------+------------------------------------- Comment (by hvr): If this turns out to be a bug in `directory`, please file an issue at upstream https://github.com/haskell/directory/issues and change this ticket's state to "Upstream" -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8482#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8482: Permission denied when copying file to current directory with copyFile -------------------------------------+------------------------------------- Reporter: Henk-Jan | Owner: gintas Type: bug | Status: closed Priority: normal | Milestone: Component: Core | Version: 7.6.3 Libraries | Keywords: copyFile Resolution: wontfix | 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): * status: new => closed * resolution: => wontfix Comment: Actually, never mind, Posix.rename behaves the same as Win32.moveFileEx, both check themselves that the destination is not a directory. The only problem is that the error message is misleading in some cases ("Access denied" instead of "InappropriateType"). Otherwise, it's all working as intended... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8482#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC