Bug in Cabal?
Duncan Coutts
duncan.coutts at worc.ox.ac.uk
Wed Jan 28 08:13:49 EST 2009
Hia Dominic,
I've looked into this a bit. I think I may now be less confused. :-)
On Wed, 2009-01-21 at 18:01 +0000, Dominic Steinitz wrote:
> > We use System.Directory.copyFile which copies the permissions from the
> > original file to the destination file. Could you confirm that this is
> > working correctly. Are the permissions of the source and destination
> > files exactly the same? Was the source file created read-only?
>
> haskell_packages is empty to start with and the package gets built
> successfully. Attributes are copied over successfully. The actual source files
> *are* read only as they are kept in our source control system which marks them
> this way for unchecked out files. Built files are read / write.
Ok, that's fine. It's as we expect.
> >ls -ltr haskell_packages\doc\zlib-0.5.0.0
> total 2
> -r--r--r-- 1 user group 1327 Jan 21 11:37 LICENSE
Ah! Is that the only file that is read-only? That makes sense since it's
an original source file from your read-only source control system. The
System.Directory.copyFile function does not copy permissions (though it
does try to) but it does (unhelpfully) copy the read-only attribute.
> When I rebuild the package *without* having cleaned out haskell_packages then I
> get the access error. I think this is because cabal (copyFile) doesn't want to
> overwrite a read only file even though the directory permissions should allow
> it to do so.
Yes. The windows MoveFile function does not let us move a file over a
file that has the read-only attribute.
It's an annoying interaction between the semantics of old DOS/FAT
read-only attribute and new windows file permissions (ACLs).
The solution I think, is never to copy the read-only attribute when
installing files. It's thoroughly unhelpful. I've got a patch to do this
which I shall push to Cabal HEAD shortly. If you have a moment to help
me test that it would be much appreciated.
> > This looks like:
> > http://hackage.haskell.org/trac/hackage/ticket/454
> >
> > But for every file not just .exe files. For .exe files Cabal does the
> > permission copying itself. I do not understand why it just started
> > occurring, since ghc-6.8 and 6.10 seem to have the same code for
> > copyFile and copyPermissions.
>
> I don't seem to have the problem for binaries (because cabal builds them afresh
> with read / write permission) so I don't know if it's related or not (but it
> seems unlikely).
I think you're right that it's unrelated. Your problem is caused by
Cabal copying the read-only attribute where as that ticket turns out to
be more related to permissions (ACLs) and users and inherited
permissions etc.
Duncan
More information about the Libraries
mailing list