diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2015-03-18 20:08:08 +0100 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2015-12-24 19:52:22 +0100 |
commit | 48db13d279d592ed3044cbaf3513854bcb0d3dce (patch) | |
tree | fecc90166a269f14b76687a5472fee34ad305c7b /compiler/ghci | |
parent | e33837677fc4d1d9bd6fdad4e9fd8c61a639f52e (diff) | |
download | haskell-48db13d279d592ed3044cbaf3513854bcb0d3dce.tar.gz |
Don't drop last char of file if -osuf contains dot
Given:
* `file = "foo.a.b"`
* `osuf = ".a.b"` -- Note the initial dot.
* `new_osuf = "c"`
Before (bad, the last character of the filename is dropped):
`dropTail (length osuf + 1) file <.> new_osuf == "fo.c"`
After (good):
`stripExtension osuf file <.> new_osuf` == "foo.c"
This regression was introduced in commit c489af73 (#5554). That commit
fixed a similar but different bug, and care has been taken to not
reintroduce it (using the the newly introduced
`System.Filepath.stripExtension`).
Given:
* `file = "foo.a.b"`
* `osuf = "a.b"`
* `new_osuf = "c"`
Before c489af73 (bad, the full suffix should get replaced):
`replaceExtension file new_osuf == "foo.a.c"`
After c489af73 (good):
`dropTail (length osuf + 1) file <.> new_osuf == "foo.c"`
After this commit (still good):
`stripExtension osuf file <.> new_osuf == "foo.c"`
Reviewed by: bgamari
Differential Revision: https://phabricator.haskell.org/D1692
GHC Trac Issues: #9760
Diffstat (limited to 'compiler/ghci')
-rw-r--r-- | compiler/ghci/Linker.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index a95120d906..7e86e1135f 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -683,7 +683,7 @@ getLinkDeps hsc_env hpt pls replace_osuf span mods adjust_ul new_osuf (DotO file) = do MASSERT(osuf `isSuffixOf` file) - let file_base = dropTail (length osuf + 1) file + let file_base = fromJust (stripExtension osuf file) new_file = file_base <.> new_osuf ok <- doesFileExist new_file if (not ok) |