diff --git a/Utility/Path/Tests.hs b/Utility/Path/Tests.hs index c09151e4cd..94deff9367 100644 --- a/Utility/Path/Tests.hs +++ b/Utility/Path/Tests.hs @@ -1,7 +1,7 @@ {- Tests for Utility.Path. Split into a separate module to avoid it needing - QuickCheck. - - - Copyright 2010-2020 Joey Hess + - Copyright 2010-2021 Joey Hess - - License: BSD-2-clause -} @@ -20,6 +20,7 @@ import System.FilePath.ByteString import qualified Data.ByteString as B import Data.List import Data.Maybe +import Data.Char import Control.Applicative import Prelude @@ -42,10 +43,14 @@ prop_relPathDirToFileAbs_basics pt = and , relPathDirToFileAbs p p == "" ] where - -- Make the input an absolute path, since relPathDirToFileAbs - -- needs absolute paths. - p = pathSeparator `B.cons` dropDrive - (toRawFilePath (fromTestableFilePath pt)) + -- relPathDirToFileAbs needs absolute paths, so make the path + -- absolute by adding a path separator to the front. + p = pathSeparator `B.cons` relf + -- Make the input a relative path. On windows, make sure it does + -- not contain anything that looks like a drive letter. + relf = B.filter (not . skipchar) $ B.dropWhile isPathSeparator $ + toRawFilePath (fromTestableFilePath pt) + skipchar b = b == (fromIntegral (ord ':')) prop_relPathDirToFileAbs_regressionTest :: Bool prop_relPathDirToFileAbs_regressionTest = same_dir_shortcurcuits_at_difference diff --git a/doc/bugs/prop__95__relPathDirToFileAbs__95__basics_fail_on_crippled___126__/comment_3_e8432845460fd0598f8fea5d00c70993._comment b/doc/bugs/prop__95__relPathDirToFileAbs__95__basics_fail_on_crippled___126__/comment_3_e8432845460fd0598f8fea5d00c70993._comment new file mode 100644 index 0000000000..7f8b0c9019 --- /dev/null +++ b/doc/bugs/prop__95__relPathDirToFileAbs__95__basics_fail_on_crippled___126__/comment_3_e8432845460fd0598f8fea5d00c70993._comment @@ -0,0 +1,9 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 3""" + date="2021-01-22T18:06:21Z" + content=""" +Please do not followup to closed bug reports with new problems. + +I've fixed this problem. +"""]]