[PATCH] Change 'whenCacheOutOfDate' to use '' again.

2014-07-25 Thread Nikita Karetnikov
As some of you may know, I’m trying to make ‘cabal install’ verify
OpenPGP signatures that come from Hackage.  I modified
‘updatePackageIndexCacheFile’ to ask whether a certain OpenPGP public
key should be trusted, but I later discovered that the mentioned
function is called twice during ‘cabal update’*, which means that all
questions are also asked twice.

I believe this doesn’t affect #1443 anymore.  If so, please apply the
attached patch.

* ‘update’ uses ‘updateRepo’ and ‘checkForSelfUpgrade’.  The former runs
  ‘updatePackageIndexCacheFile’ via ‘updateRepoIndexCache’.  The latter
  calls ‘updatePackageIndexCacheFile’ via a sequence of calls from
  ‘getSourcePackages’ to ‘getSourcePackages’’ to ‘readRepoIndex’ to
  ‘whenCacheOutOfDate’.

From 53f58691303721928cd49baf1396284a8d6340c2 Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov nik...@karetnikov.org
Date: Fri, 25 Jul 2014 15:47:32 +0400
Subject: [PATCH] Change 'whenCacheOutOfDate' to use '' again.

---
 cabal-install/Distribution/Client/IndexUtils.hs |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cabal-install/Distribution/Client/IndexUtils.hs b/cabal-install/Distribution/Client/IndexUtils.hs
index 0fc1927..51cae2e 100644
--- a/cabal-install/Distribution/Client/IndexUtils.hs
+++ b/cabal-install/Distribution/Client/IndexUtils.hs
@@ -242,7 +242,7 @@ whenCacheOutOfDate origFile cacheFile action = do
 else do
   origTime  - getModTime origFile
   cacheTime - getModTime cacheFile
-  when (origTime = cacheTime) action
+  when (origTime  cacheTime) action
 
 
 -- Reading the index file
-- 
1.7.9.5



pgplMHeCRxwAs.pgp
Description: PGP signature
___
cabal-devel mailing list
cabal-devel@haskell.org
http://www.haskell.org/mailman/listinfo/cabal-devel


Re: [PATCH] Change 'whenCacheOutOfDate' to use '' again.

2014-07-25 Thread Mikhail Glushenkov
Hi,

On 25 July 2014 15:44, Nikita Karetnikov nik...@karetnikov.org wrote:

 I believe this doesn’t affect #1443 anymore.

Why? Have you tested this patch ?
___
cabal-devel mailing list
cabal-devel@haskell.org
http://www.haskell.org/mailman/listinfo/cabal-devel


Re: [PATCH] Change 'whenCacheOutOfDate' to use '' again.

2014-07-25 Thread Nikita Karetnikov
(Oops, resending to the list.)

 I believe this doesn’t affect #1443 anymore.

 Why? Have you tested this patch ?

I said “believe” because I had to explicitly install process and
texmath, but I think that’s not relevant.  ‘cabal install --only-dep’
and ‘cabal info pandoc-types-1.12.4’ succeeded after that.

Do you have a better testcase?  Why does ‘whenCacheOutOfDate’ run the
action on ‘=’ in the first place?  If the cache file has the same
modification time as the original, it means that the cache is
up-to-date, no?


pgpXCoTzUJeUi.pgp
Description: PGP signature
___
cabal-devel mailing list
cabal-devel@haskell.org
http://www.haskell.org/mailman/listinfo/cabal-devel


Re: [PATCH] Change 'whenCacheOutOfDate' to use '' again.

2014-07-25 Thread Mikhail Glushenkov
Hi,

On 25 July 2014 19:21, Nikita Karetnikov nik...@karetnikov.org wrote:

 Do you have a better testcase?  Why does ‘whenCacheOutOfDate’ run the
 action on ‘=’ in the first place?  If the cache file has the same
 modification time as the original, it means that the cache is
 up-to-date, no?

OK, I tested your patch and it seems to work. I guess that what
actually fixed that bug was the change from getModificationTime to
getModTime (which has higher resolution).
___
cabal-devel mailing list
cabal-devel@haskell.org
http://www.haskell.org/mailman/listinfo/cabal-devel