Hi Petr, Could you review this one? I expect that I'll be gone for the week when you around to it.
I tried to have a look at it, but now I realise I don't have the time to think about the key active ingredient, i.e. the checking if not (null dir), before rushing off. Thanks! On Sat, Mar 28, 2009 at 01:25:18 +0100, [email protected] wrote: > I /hope/ that there are no more cases where this issue can come up. It is > really hard to say, is_relative infects many other functions with its > partiality. In some of them I documented this by adding a clause that calls > 'bug'. This should make it easier to to diagnose the problem if happens again. > > Sat Mar 28 00:18:21 CET 2009 [email protected] > * Resolve issue1162: makeAbsolute is now a total function Resolve issue1162: makeAbsolute is now a total function ------------------------------------------------------- > [email protected]**20090327231821 > Ignore-this: d0eb6f94c88610580daa176e39877bc3 > ] hunk ./src/Darcs/Lock.hs 180 > data WithDirKind = Perm | Temp | Delayed > > withDir :: WithDirKind -> String -> (AbsolutePath -> IO a) -> IO a > +withDir _ "" _ = bug "withDir called with empty directory name" > withDir kind abs_or_relative_name job = do > absolute_name <- if is_relative abs_or_relative_name > then fmap (++ abs_or_relative_name) tempdir_loc > hunk ./src/Darcs/RepoPath.hs 40 > import System.Directory ( doesDirectoryExist ) > import qualified System.FilePath.Posix as FilePath > import qualified Darcs.Patch.FileName as PatchFileName ( FileName, fp2fn, > fn2fp ) > +#include "impossible.h" > > class FilePathOrURL a where > {-# INLINE toPath #-} > hunk ./src/Darcs/RepoPath.hs 97 > else Nothing > > simpleSubPath :: FilePath -> Maybe SubPath > -simpleSubPath x | is_relative x = Just $ SubPath $ FilePath.normalise $ map > cleanup x > +simpleSubPath x | null x = bug "simpleSubPath called with empty path" > + | is_relative x = Just $ SubPath $ FilePath.normalise $ map > cleanup x > | otherwise = Nothing > > -- | Interpret a possibly relative path wrt the current working directory > hunk ./src/Darcs/RepoPath.hs 118 > return $ makeAbsolute abs_dir file > > makeAbsolute :: AbsolutePath -> FilePath -> AbsolutePath > -makeAbsolute a dir = if is_absolute dir > +makeAbsolute a dir = if not (null dir) && is_absolute dir > then AbsolutePath $ > slashes ++ FilePath.normalise cleandir > else ma a $ FilePath.normalise cleandir > hunk ./src/Darcs/URL.hs 63 > is_relative "" = bug "Empty filename in is_relative" > > is_absolute :: String -> Bool > +is_absolute "" = bug "is_absolute called with empty filename" > is_absolute f = is_file f && (not $ is_relative f) > > is_file :: String -> Bool -- Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow> PGP Key ID: 08AC04F9
signature.asc
Description: Digital signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
