[GHC] #10424: Build path leaks into ABI hashes

GHC ghc-devs at haskell.org
Sun May 17 21:13:32 UTC 2015


#10424: Build path leaks into ABI hashes
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.8.4
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:  #4012             |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by nomeata):

 Here is a possible fix:
 {{{
 diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs
 index 9a2cd35..180742f 100644
 --- a/compiler/iface/MkIface.hs
 +++ b/compiler/iface/MkIface.hs
 @@ -622,7 +622,7 @@ addFingerprints hsc_env mb_old_fingerprint iface0
 new_decls
     iface_hash <- computeFingerprint putNameLiterally
                        (mod_hash,
                         ann_fn (mkVarOcc "module"),  -- See
 mkIfaceAnnCache
 -                       mi_usages iface0,
 +                       usages,
                         sorted_deps,
                         mi_hpc iface0)

 @@ -655,6 +655,9 @@ addFingerprints hsc_env mb_old_fingerprint iface0
 new_decls
      (non_orph_fis,   orph_fis)   = mkOrphMap ifFamInstOrph (mi_fam_insts
 iface0)
      fix_fn = mi_fix_fn iface0
      ann_fn = mkIfaceAnnCache (mi_anns iface0)
 +    -- Do not allow filenames to affect the interface
 +    usages = [ case u of UsageFile _ fp -> UsageFile "" fp; _ -> u | u <-
 mi_usages iface0 ]
 +

  getOrphanHashes :: HscEnv -> [Module] -> IO [Fingerprint]
  getOrphanHashes hsc_env mods = do
 }}}

 This excludes the actual filename from the hash generation. It seems to
 solve the problem for Debian (so likely we will use it).

 But I also think it is generally fine to have. It would be bad if the hash
 would not change although we should recompile depending modules. But even
 if the actual filenames change for some reason, as long as their content
 was the same (and the file’s hash is part of the module hash), I don’t
 think we have to recompile the depending modules.

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


More information about the ghc-tickets mailing list