fix test suite failure on windows
This was maybe a real bug too, although I don't know what circumstances it would be a problem. See comment for analysis of this windows drive letter wackyness issue. Sponsored-by: Brock Spratlen on Patreon
This commit is contained in:
parent
6db7079cb0
commit
9595a247ae
3 changed files with 37 additions and 1 deletions
|
@ -187,7 +187,13 @@ relPathDirToFileAbs from to
|
|||
dotdots = replicate (length pfrom - numcommon) ".."
|
||||
numcommon = length common
|
||||
#ifdef mingw32_HOST_OS
|
||||
normdrive = map toLower . takeWhile (/= ':') . fromRawFilePath . takeDrive
|
||||
normdrive = map toLower
|
||||
-- Get just the drive letter, removing any leading
|
||||
-- path separator, which takeDrive leaves on the drive
|
||||
-- letter.
|
||||
. dropWhileEnd (isPathSeparator . fromIntegral . ord)
|
||||
. fromRawFilePath
|
||||
. takeDrive
|
||||
#endif
|
||||
|
||||
{- Checks if a command is available in PATH.
|
||||
|
|
|
@ -49,3 +49,5 @@ Windows version 21H1 (build 19043.1165), 64 bit.
|
|||
Git Annex is great. It works with multi-gigabyte backup files (largest around 180GB) via the BLAKE2B160E backend just dandy :)
|
||||
|
||||
[[!meta author=jkniiv]]
|
||||
|
||||
> [[fixed|done]] --[[Joey]]
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
[[!comment format=mdwn
|
||||
username="joey"
|
||||
subject="""comment 1"""
|
||||
date="2021-09-01T14:54:56Z"
|
||||
content="""
|
||||
Reproduced on Linux using System.FilePath.Windows.
|
||||
|
||||
Minimal case is:
|
||||
|
||||
ghci> let p = "\\\\\DLEJ\STXm{u5;4*\EOTKo1"
|
||||
ghci> relPathDirToFileAbs (p </> "bar") p
|
||||
"\\\\\DLEJ\STXm{u5;4*\EOTKo1"
|
||||
|
||||
Which should be "bar", but the "normdrive" case in
|
||||
relPathDirToFileAbs causes it to not return that.
|
||||
|
||||
Ah, that whole value is treated as a "drive letter" due to starting
|
||||
with "\\\\" and not containing any path separator.
|
||||
|
||||
ghci> takeDrive p
|
||||
"\\\\\DLEJ\STXm{u5;4*\EOTKo1"
|
||||
|
||||
And takeDrive includes the first path separator, which is present in one
|
||||
string and not in another. So, it thinks these paths are on
|
||||
two different drives, when they are not. And that's the root
|
||||
of the problem. normdrive was working around that by taking up until
|
||||
the ':', but there *is* no ':' in this drive letter!
|
||||
"""]]
|
Loading…
Add table
Reference in a new issue