[GHC] #9760: ghc -c 7.8 drops last char of file name if -osuf contains a dot

GHC ghc-devs at haskell.org
Thu Dec 24 18:52:28 UTC 2015


#9760: ghc -c 7.8 drops last char of file name if -osuf contains a dot
-------------------------------------+-------------------------------------
        Reporter:  nh2               |                Owner:  thomie
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Driver            |              Version:  7.8.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
                                     |  th/TH_spliceE5_prof
      Blocked By:                    |             Blocking:
 Related Tickets:  #5554             |  Differential Rev(s):  Phab:D1692
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Thomas Miedema <thomasmiedema@…>):

 In [changeset:"48db13d279d592ed3044cbaf3513854bcb0d3dce/ghc" 48db13d/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="48db13d279d592ed3044cbaf3513854bcb0d3dce"
 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
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9760#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list