cabal icon indicating copy to clipboard operation
cabal copied to clipboard

Fix regression in local+noindex repository handling

Open andreabedini opened this issue 1 year ago • 7 comments

Template B: This PR does not modify behaviour or interface

This fixes #9891, introduced in #8944, where the index cache is checked even for local+noindex repositories.

Include the following checklist in your PR:

  • [ ] Patches conform to the coding conventions.
  • [ ] Is this a PR that fixes CI? If so, it will need to be backported to older cabal release branches (ask maintainers for directions).

andreabedini avatar Jun 10 '24 12:06 andreabedini

Rebasing on latest master for a CI fix.

ulysses4ever avatar Jun 11 '24 13:06 ulysses4ever

Sorry for the noise, testing a bot to track review requests

geekosaur avatar Jun 15 '24 23:06 geekosaur

I am actually not sure why I had marked this as a draft. Maybe because it's missing a test :thinking:

andreabedini avatar Jun 20 '24 15:06 andreabedini

Should that be backported for release 3.12.2.0? The PR that introduced the problem is old, so it's surely on the 3.12 branch.

Mikolaj avatar Jun 25 '24 07:06 Mikolaj

This doesn't solve the regression, at least on Windows.

The cabal file

➜ cat cabal.project
packages: .
repository local
  url: file+noindex://C:/Users/Javier/code/aa/repo

3.10.2.1

➜ ls repo

➜ cabal build
Resolving dependencies...
Build profile: -w ghc-9.6.5 -O1
In order, the following will be built (use -v for more details):
 - aa-0.1.0.0 (lib) (cannot read state cache)
Configuring library for aa-0.1.0.0..
Preprocessing library for aa-0.1.0.0..
Building library for aa-0.1.0.0..
[1 of 1] Compiling MyLib            ( src\MyLib.hs, C:\Users\Javier\code\aa\dist-newstyle\build\x86_64-windows\ghc-9.6.5\aa-0.1.0.0\build\MyLib.o ) [Flags changed]

➜ ls repo
noindex.cache

surprisingly enough, it prints the paths in verbose mode as missing the C:/ drive letter, but it still creates the file 🧩 :

➜ cabal build -v3 | grep -v environment
...
Reading available packages of local...
Using most recent state (could not read timestamp file)
Updating index cache file /Users/Javier/code/aa/repo\noindex.cache ...
Entries in file+noindex repository local
creating \Users\Javier\code\aa\repo
Index cache updated
index-state(local) =
...

With this branch's cabal

➜ ls repo

➜ $CABAL build
Warning: this is a debug build of cabal-install with assertions enabled.
Warning: Error during construction of local+noindex local repository index:
/Users/Javier/code/aa/repo\noindex.cache: openBinaryFile: does not exist (No
such file or directory)
Resolving dependencies...
Build profile: -w ghc-9.6.5 -O1
In order, the following will be built (use -v for more details):
 - aa-0.1.0.0 (lib) (cannot read state cache)
Warning: this is a debug build of cabal-install with assertions enabled.
Configuring library for aa-0.1.0.0...
Warning: this is a debug build of cabal-install with assertions enabled.
Preprocessing library for aa-0.1.0.0...
Building library for aa-0.1.0.0...
[1 of 1] Compiling MyLib            ( src\MyLib.hs, dist-newstyle\build\x86_64-windows\ghc-9.6.5\aa-0.1.0.0\build\MyLib.o ) [Flags changed]
Warning: this is a debug build of cabal-install with assertions enabled.

➜ ls repo

This one says:

➜ $CABAL build -v3 | grep -v environment
...
Warning: Error during construction of local+noindex local repository index:
/Users/Javier/code/aa/repo\noindex.cache: openBinaryFile: does not exist (No
such file or directory)
index-state(hackage.haskell.org) = 2024-06-20T22:19:34Z
Reading available packages of local...
index-state(local) = Unknown or invalid timestamp
...

jasagredo avatar Jun 25 '24 09:06 jasagredo

Thanks @jasagredo. (if only I had written a test :joy:)

andreabedini avatar Jun 25 '24 09:06 andreabedini

@andreabedini any energy to get back to this? It may be good to manage it before 3.14 release since people start noticing: https://github.com/haskell/cabal/issues/9891#issuecomment-2284299345

ulysses4ever avatar Aug 17 '24 18:08 ulysses4ever

@andreabedini: do you think it's ready for another round of reviews? Any help needed?

Mikolaj avatar Dec 19 '24 18:12 Mikolaj

@andreabedini: ping, ping! :)

Mikolaj avatar Jan 16 '25 18:01 Mikolaj

Superseded by #10730

andreabedini avatar May 16 '25 01:05 andreabedini