Ticket #1652 (closed merge: fixed)

Opened 6 years ago

Last modified 6 years ago

System.Directory.copyFile breakage

Reported by: sorear Owned by: igloo
Priority: normal Milestone: 6.8.1
Component: libraries/base Version: 6.7
Keywords: Cc: sorear
Operating System: Linux Architecture: x86
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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"'

... 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)

Change History

Changed 6 years ago by igloo

  • milestone changed from Not GHC to 6.8 branch

Changed 6 years ago by simonmar

  • owner set to simonmar

validating fix

Changed 6 years ago by simonmar

  • owner changed from simonmar to igloo
  • type changed from bug to merge

Fixed, thanks.

In libraries/base:

Thu Oct 18 13:23:45 BST 2007  Simon Marlow <simonmar@microsoft.com>
  * FIX #1652: openTempFile should accept an empty string for the directory

in libraries/directory:

Thu Oct 18 13:01:15 BST 2007  Simon Marlow <simonmar@microsoft.com>
  * Move tests from testsuite/tests/ghc-regress/lib/Directory

Thu Oct 18 13:14:05 BST 2007  Simon Marlow <simonmar@microsoft.com>
  * move copyFile001 from testsuite

Thu Oct 18 13:17:55 BST 2007  Simon Marlow <simonmar@microsoft.com>
  * import System.Directory, not Directory

Thu Oct 18 14:06:23 BST 2007  Simon Marlow <simonmar@microsoft.com>
  * add test for #1652

Changed 6 years ago by igloo

  • status changed from new to closed
  • resolution set to fixed

All merged

Changed 6 years ago by igloo

  • milestone changed from 6.8 branch to 6.8.1
Note: See TracTickets for help on using tickets.