Skip to content

System.Directory.copyFile breakage

Setup: /tmp, with one (executable) file 'x'.

stefan@stefans:/tmp$ rm *
stefan@stefans:/tmp$ > x
stefan@stefans:/tmp$ chmod +x x

copyFile with relative paths does not work:

stefan@stefans:/tmp$ ghc -e 'System.Directory.copyFile "x" "y"'
*** Exception: : copyFile: permission denied (Permission denied)

strace reveals an attempt to access /, possibly from a filepath mixup:

stefan@stefans:/tmp$ strace ghc -e 'System.Directory.copyFile "x" "y"' 2>&1 | grep EACCES
open("/.copyFile.3550tmp", O_RDWR|O_CREAT|O_EXCL|O_NOCTTY|O_NONBLOCK|O_LARGEFILE, 0666) = -1 EACCES (Permission denied)

if absolute paths are used, the operation succeeds:

stefan@stefans:/tmp$ ghc -e 'System.Directory.copyFile "/tmp/x" "/tmp/y"'
  1. .. but does not copy permissions.
stefan@stefans:/tmp$ ls -l
total 0
-rwxr-xr-x 1 stefan stefan 0 2007-08-30 09:37 x
-rw-r--r-- 1 stefan stefan 0 2007-08-30 09:38 y
stefan@stefans:/tmp$ ghc -V
The Glorious Glasgow Haskell Compilation System, version 6.7.20070829

(NB: Cabal 'install' trips over this)

Trac metadata
Trac field Value
Version 6.7
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC sorear
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information