Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty package: cabal-hash.txt: Does not exist #4130

Closed
23Skidoo opened this issue Nov 24, 2016 · 10 comments
Closed

Empty package: cabal-hash.txt: Does not exist #4130

23Skidoo opened this issue Nov 24, 2016 · 10 comments

Comments

@23Skidoo
Copy link
Member

Got this while trying to build ircbrowse with a recent snapshot of cabal-install HEAD:

$ cabal new-build
[...]
cabal: Failed to build snap-app-0.7.0 (which is required by exe:ircbrowse from
ircbrowse-0.1.0.0). The failure occurred during the final install step. The
exception was:
/home/refold/.cabal/store/ghc-8.0.1/snap-app-0.7.0-e7ebb350f8c439e859941200457b8734ec0e234e736ed19e834da281aa9c8440/cabal-hash.txt:
openBinaryFile: does not exist (No such file or directory)

The /home/refold/.cabal/store/ghc-8.0.1/snap-app-0.7.0-e7ebb350f8c439e859941200457b8734ec0e234e736ed19e834da281aa9c8440/ directory doesn't seem to exist.

@23Skidoo
Copy link
Member Author

23Skidoo commented Nov 24, 2016

snap-app 0.7 is an empty package, and we don't seem to handle that case correctly either:

$ cabal new-build
Resolving dependencies...
In order, the following will be built (use -v for more details):
 - snap-app-0.7.0 (lib) (first run)
Configuring component lib from snap-app-0.7.0
Preprocessing library snap-app-0.7.0...

@23Skidoo
Copy link
Member Author

23Skidoo commented Nov 24, 2016

@hvr showed me an example where a (conditionally) empty library stanza is actually useful: http://hackage.haskell.org/package/nats-1.1.1/nats.cabal

tl;dr: when you want reexported-modules, but want to support old cabal-install versions.

@ezyang
Copy link
Contributor

ezyang commented Nov 25, 2016

Since hashing is only done for packages from a repository, it will be difficult to construct a test case (all our test cases rely on inplace builds); so from a tooling perspective, this is blocking on #4016.

@hvr
Copy link
Member

hvr commented Dec 1, 2016

@23Skidoo here's another canonical one btw: http://hackage.haskell.org/package/fail-4.9.0.0/fail.cabal

@ezyang
Copy link
Contributor

ezyang commented Dec 6, 2016

#4016 is solved so we should be able to make a test case for this.

@hvr
Copy link
Member

hvr commented Nov 22, 2017

Just in case there was any doubt, this is a regression relative to old-build (which handles the weirdo-case snap-app-0.7.0 just fine);

simple repro-case:

cabal-version:       1.12
name:                bug
version:             0
build-type:          Simple
extra-source-files:  ChangeLog.md

library
  build-depends:       snap-app == 0.7.0
  default-language:    Haskell2010

cabal install --dep will succeed, while cabal new-build will run into the cabal-hash.txt-not-found error

@hasufell
Copy link
Member

I have a similar problem, but on cabal new-install test:spec. I have no idea how to mitigate this.

@phadej
Copy link
Collaborator

phadej commented Dec 10, 2018

@hasufell, installing test-suites is something which shouldn't work anyway, should it? (I agree that error should be about that, and not about something internal).

@phadej phadej changed the title cabal-hash.txt: Does not exist Empty package: cabal-hash.txt: Does not exist Nov 27, 2019
@phadej
Copy link
Collaborator

phadej commented Nov 27, 2019

With cabal-install-3.0 it's better, as it doesn't make store broken:

% cabal build --dep
Resolving dependencies...
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
 - snap-app-0.7.0 (lib:snap-app) (requires download & build)
Downloading  snap-app-0.7.0
Downloaded   snap-app-0.7.0
Starting     snap-app-0.7.0 (all, legacy fallback)
Building     snap-app-0.7.0 (all, legacy fallback)
Installing   snap-app-0.7.0 (all, legacy fallback)
cabal: Failed to build snap-app-0.7.0. The failure occurred during the final
install step. The exception was:
/cabal/store/ghc-8.6.5/incoming/new-99767/cabal/store/ghc-8.6.5/snap-app-0.7.0-69381acbcfc33e2f42e1fee72b15c9d7d1d268b1e258f52f29e71a36232fc0bb/cabal-hash.txt:
openBinaryFile: does not exist (No such file or directory)

@phadej
Copy link
Collaborator

phadej commented Nov 28, 2019

Note, this doesn't happen for nats-1.1.1, so it's probably related to legacy fallback.

@phadej phadej self-assigned this Nov 28, 2019
@phadej phadej closed this as completed in 4d6cf38 Nov 28, 2019
phadej added a commit that referenced this issue Nov 28, 2019
Fix #4130: Create incoming directory
phadej added a commit to phadej/cabal that referenced this issue Dec 4, 2019
It's probably silent assumption that `setup Cabal.copyCommand`
would create directory structure. Who said it would do that.
For empty packages, sometimes it doesn't.

It's easier to be defensive here
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Apr 25, 2021
3.4.0.0 Oleg Grenrus <oleg.grenrus@iki.fi> February 2021
	* See https://github.com/haskell/cabal/blob/master/release-notes/cabal-install-3.4.0.0.md

3.2.0.0 Herbert Valerio Riedel <hvr@gnu.org> April 2020
	* `v2-build` (and other `v2-`prefixed commands) now accept the
	  `--benchmark-option(s)` flags, which pass options to benchmark executables
	  (analogous to how `--test-option(s)` works). (#6209)
	* Add solver optimization to skip a version of a package if it does not resolve
	  any conflicts encountered in the last version, controlled by flag
	  '--fine-grained-conflicts'. (#5918)
	* `cabal v2-exec` doesn't fail in clean package (#6479)
	* Show full ABI hash for installed packages in solver log (#5892)
	* Create incoming directory even for empty packages (#4130)
	* Start GHCi with `main-is` module in scope (#6311)
	* Implement `--benchmark-options` for `v2-bench` (#6224)
	* Fix store-dir in ghc env files generated by `cabal install --lib
	  --package-env` (#6298)
	* `cabal v2-run` works with `.lhs` files (#6134)
	* `subdir` in source-repository-package accepts multiple entries (#5472)

3.0.1.0 Herbert Valerio Riedel <hvr@gnu.org> April 2020
	* Create store incoming directory
	  ([#4130](haskell/cabal#4130))
	* `fetchRepoTarball` output is not marked
	  ([#6385](haskell/cabal#6385))
	* Update `setupMinCabalVersionConstraint` for GHC-8.8
	  ([#6217](haskell/cabal#6217))
	* Implement `cabal install --ignore-project`
	  ([#5919](haskell/cabal#5919))
	* `cabal install executable` solver isn't affected by default
	  environment contents
	  ([#6410](haskell/cabal#6410))
	* Use `lukko` for file locking
	  ([#6345](haskell/cabal#6345))
	* Use `hackage-security-0.6`
	  ([#6388](haskell/cabal#6388))
	* Other dependency upgrades
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants