darcs

Issue 1931 Broken issues tests and writeFileUsingCache on case-insensitive filesystems.

Title Broken issues tests and writeFileUsingCache on case-insensitive filesystems.
Priority Status resolved
Milestone Resolved in
Superseder Nosy List dagit, dmitry.kurochkin
Assigned To
Topics

Created on 2010-08-23.04:56:09 by dagit, last changed 2020-06-21.06:49:24 by bfrk.

Messages
msg12274 (view) Author: dagit Date: 2010-08-23.04:56:07
Currently some of the tests are broken on case insensitive file systems.

* tests/issue1898-set-default-notification.sh
* issue612_repo_not_writeable.sh

Those tests interact poorly, because issue1898 doesn't clean up after itself (it leaves R1 around).  issue612 test 
_incorrectly_ pushes to r1 instead of temp1.

When I fixed both of the above, I discovered a new deeper problem.  The test for issue612 stopped passing.

Digging into the source lead me to writeFileUsingCache, reproduced here:

-- | @writeFileUsingCache cache compression subdir contents@ write the string @contents@ to
-- the directory subdir, except if it is already in the cache, in which case it is a noop.
-- Warning (?) this means that in case of a hash collision, writing using writeFileUsingCache is
-- a noop. The returned value is the filename that was given to the string.
writeFileUsingCache :: Cache -> Compression -> HashedDir -> B.ByteString -> IO String
writeFileUsingCache (Ca cache) compr subdir ps =
    (fetchFileUsingCachePrivate LocalOnly (Ca cache) subdir hash >> return hash) `catchall`
    wfuc cache `catchall`
         debugFail ("Couldn't write `"++hash++"'\nin subdir "++(hashedDir subdir)++" to sources:\n\n"++
                    show (Ca cache))
    where hash = cacheHash ps
          wfuc (c:cs) | not $ writable c = wfuc cs
                      | otherwise = do createCache c subdir
                                       write compr (fn c) ps -- FIXME: create links in caches
                                       return hash
          wfuc [] = debugFail $ "No location to write file `" ++ (hashedDir subdir) ++"/"++hash ++ "'"
          fn c = hashedFilePath c subdir hash

The problem might be with the first line.  When I comment it out (meaning, it bypasses the cache and always tries to write 
the file), the test goes back to working because darcs does fail to write the inventory.

Now, in the case where it fails to write this file, the repository seems to be consistent.  So, I'm not sure what to make of 
all of this.
msg16411 (view) Author: markstos Date: 2012-12-14.15:15:21
Thanks for the report. Maybe we need a "Topic Tag" to group issues 
affecting case-insensitive file systems?
msg22076 (view) Author: bfrk Date: 2020-06-21.06:49:20
Cannot reproduce this any longer
History
Date User Action Args
2010-08-23 04:56:09dagitcreate
2012-12-14 15:15:23markstossetstatus: unknown -> needs-implementation
messages: + msg16411
title: Broken issues tests and writeFileUsingCache -> Broken issues tests and writeFileUsingCache on case-insensitive filesystems.
2020-06-21 06:49:24bfrksetstatus: needs-implementation -> resolved
messages: + msg22076