phadej / cabal-extras

A tool suite to aid Haskell development using `cabal-install`
80 stars 18 forks source link

Fails on Mac, and Linux CentOS #30

Open mouse07410 opened 4 years ago

mouse07410 commented 4 years ago

MacOS Catalina 10.15.5, Xcode-11.5, GHC-8.8.3, Cabal-3.2.0.0 (ghcup-installed), clean ~/.cabal/ directory - has only config files. First thing done - installed all of the cabal-extras, then tried cabal-store-check --repair - with disastrous consequences:

$ type cabal-store-check
cabal-store-check is /Users/ur20980/.cabal/bin/cabal-store-check
$ cabal-store-check --repair
[   0.00004] debug: runProcess cwd=/Users/ur20980/.ghc ghc --info
[   0.08210] info: Reading global package db
[   0.10676] info: 33 packages in /Users/ur20980/.ghcup/ghc/8.8.3/lib/ghc-8.8.3/package.conf.d
[   0.10763] info: Reading store package db
[   0.18790] info: 136 packages in /Users/ur20980/.cabal/store/ghc-8.8.3/package.db
[   0.22506] error: lib executable is broken: /Users/ur20980/.cabal/store/ghc-8.8.3/lib/cabal-hash.txt: openBinaryFile: does not exist (No such file or directory)
[   0.22513] info: 0 directly broken library components
[   0.22514] info: 0 transitively broken libraries
[   0.22516] info: 1 broken executable components
[   0.22518] debug: Removing /Users/ur20980/.cabal/store/ghc-8.8.3/lib
[   0.24782] debug: runPeu completed successfully
$ 
$ 
$ cabal-store-check --help
dyld: Library not loaded: @rpath/libHScbl-str-chck-0.1-4f5c15f0-ghc8.8.3.dylib
  Referenced from: /Users/ur20980/.cabal/bin/cabal-store-check
  Reason: image not found
Abort trap: 6

~/.cabal/config:

-- This is the configuration file for the 'cabal' command line tool.
--
-- The available configuration options are listed below.
-- Some of them have default values listed.
--
-- Lines (like this one) beginning with '--' are comments.
-- Be careful with spaces and indentation because they are
-- used to indicate layout for nested sections.
--
-- This config file was generated using the following versions
-- of Cabal and cabal-install:
-- Cabal library version: 3.2.0.0
-- cabal-install version: 3.2.0.0

repository hackage.haskell.org
  url: https://hackage.haskell.org/
  -- secure: True
  -- root-keys:
  -- key-threshold: 3

-- default-user-config:
-- require-sandbox: False
-- ignore-sandbox: False
-- ignore-expiry: False
http-transport: curl
-- nix: False
-- local-no-index-repo:
remote-repo-cache: /Users/ur20980/.cabal/packages
-- local-repo:
-- logs-dir: /Users/ur20980/.cabal/logs
world-file: /Users/ur20980/.cabal/world
-- store-dir:
-- verbose: 1
-- compiler: ghc
-- cabal-file:
-- with-compiler:
-- with-hc-pkg:
-- program-prefix: 
-- program-suffix: 
-- library-vanilla: True
library-profiling: False
shared: True
-- static:
executable-dynamic: True
-- executable-static: False
-- profiling:
-- executable-profiling:
-- profiling-detail:
-- library-profiling-detail:
optimization: True
-- debug-info: False
-- library-for-ghci:
-- split-sections: False
-- split-objs: False
-- executable-stripping:
library-stripping: False
-- configure-option:
-- user-install: True
-- package-db:
-- flags:
extra-include-dirs: /opt/local/include,/usr/local/include
-- deterministic:
-- cid:
extra-lib-dirs: /opt/local/lib/liconv,/opt/local/lib,/usr/local/lib
-- extra-framework-dirs:
extra-prog-path: /Users/ur20980/.cabal/bin
-- instantiate-with:
-- tests: False
-- coverage: False
-- library-coverage:
-- exact-configuration: False
-- benchmarks: False
-- relocatable: False
-- response-files:
-- allow-depending-on-private-libs:
-- cabal-lib-version:
-- constraint:
-- preference:
-- solver: modular
-- allow-older: False
-- allow-newer: False
-- write-ghc-environment-files:
documentation: True
-- doc-index-file: $datadir/doc/$arch-$os-$compiler/index.html
-- target-package-db:
-- max-backjumps: 4000
-- reorder-goals: False
-- count-conflicts: True
-- fine-grained-conflicts: True
-- minimize-conflict-set: False
-- independent-goals: False
-- shadow-installed-packages: False
-- strong-flags: False
-- allow-boot-library-installs: False
-- reject-unconstrained-dependencies: none
-- reinstall: False
-- avoid-reinstalls: False
-- force-reinstalls: False
-- upgrade-dependencies: False
-- index-state:
-- root-cmd:
symlink-bindir: /Users/ur20980/.local/bin
build-summary: /Users/ur20980/.cabal/logs/build.log
-- build-log:
remote-build-reporting: anonymous
-- report-planning-failure: False
-- per-component: True
-- one-shot: False
-- run-tests:
jobs: 20
-- keep-going: False
-- offline: False
-- project-file:
-- lib: False
-- ignore-project: False
-- package-env:
-- overwrite-policy:
-- install-method:
installdir: /Users/ur20980/.cabal/bin
-- username:
-- password:
-- password-command:
-- builddir:

haddock
  -- keep-temp-files: False
  -- hoogle: False
  -- html: False
  -- html-location:
  -- executables: False
  -- tests: False
  -- benchmarks: False
  -- foreign-libraries: False
  -- all:
  -- internal: False
  -- css:
  -- hyperlink-source: False
  -- quickjump: False
  -- hscolour-css:
  -- contents-location:

init
  -- interactive: False
  cabal-version: 2.2
  license: MIT
  -- tests:
  -- test-dir:
  language: Haskell2010
  -- application-dir:
  -- source-dir:

install-dirs user
  -- prefix: /Users/ur20980/.cabal
  -- bindir: $prefix/bin
  -- libdir: $prefix/lib
  -- libsubdir: $abi/$libname
  -- dynlibdir: $libdir/$abi
  -- libexecdir: $prefix/libexec
  -- libexecsubdir: $abi/$pkgid
  -- datadir: $prefix/share
  -- datasubdir: $abi/$pkgid
  -- docdir: $datadir/doc/$abi/$pkgid
  -- htmldir: $docdir/html
  -- haddockdir: $htmldir
  -- sysconfdir: $prefix/etc

install-dirs global
  -- prefix: /usr/local
[ everything else is default - untouched ]
phadej commented 4 years ago

I haven't ever tested cabal-store-check on Mac, so it can do something wrong there.

That's why --repair is not a default action, you have to check first that cabal-store-check identifies proper problems.

mouse07410 commented 4 years ago

I haven't ever tested cabal-store-check on Mac, so it can do something wrong there.

Understood. Though what could be different about Mac...?

That's why --repair is not a default action, you have to check first that cabal-store-check identifies proper problems

Understood.

Speaking of other problems: on a different machine (where I did not do cabal-store-check --repair ;-) cabal-diff-test-colour gives me this:

[ trackload of packages built, etc. etc. ]
   ephemeralPlanJson' (src/Peura/Cabal.hs:96)
 100% ( 13 / 13) in 'Peura'
Warning: Peura.Exports: could not find link destinations for:
    TraceWhen ShortTextLst Token UnpackedUUID LineUpdate Margin Leaf SetM TypedPattern MergeSet structureHash' Tagged SingKind fromSing Sing DemoteRep SingI sing D:R:SingBoola0 STrue SFalse D:R:VectorBool0 V_Bool D:R:MVectorsBool0 CompatPackageKey D:R:VectorChar0 V_Char D:R:UReckCharp0 D:R:MVectorsChar0 D:R:VectorDouble0 V_Double D:R:UReckDoublep0 D:R:MVectorsDouble0 ByteSource /-/ ByteSink D:R:VectorInt0 V_Int D:R:UReckIntp0 Takes4Bytes D:R:MVectorsInt0 RecordFromJSON' recordParseJSON' :* ConName TypeName D:R:SingMaybeb0 SNothing SJust spr UPrintf hspr D:R:VectorWord0 V_Word D:R:UReckWordp0 D:R:MVectorsWord0 SpecLicenseLenient typeRep# Tag Buffer Buffer D:R:VectorInt80 V_Int8 D:R:MVectorsInt80 D:R:VectorInt160 V_Int16 D:R:MVectorsInt160 D:R:VectorInt320 V_Int32 D:R:MVectorsInt320 D:R:VectorInt640 V_Int64 D:R:MVectorsInt640 D:R:VectorWord80 V_Word8 Takes1Byte D:R:MVectorsWord80 D:R:VectorWord160 V_Word16 Takes2Bytes D:R:MVectorsWord160 D:R:VectorWord320 V_Word32 D:R:MVectorsWord320 D:R:VectorWord640 V_Word64 D:R:MVectorsWord640 D:R:MVectorsConst0 D:R:VectorConst0 V_Const D:R:MVectorsIdentity0 D:R:VectorIdentity0 V_Identity
Warning: Peura.Monad: could not find link destinations for:
    Env
Warning: Peura.Paths: could not find link destinations for:
    MakeAbsolute
Documentation created:
/home/ur20980/src/cabal-extras/dist-newstyle/build/x86_64-linux/ghc-8.8.3/peura-0.20200607/doc/html/peura/index.html
Configuring library 'cabal-diff-internal' for cabal-diff-0.1..
Preprocessing library 'cabal-diff-internal' for cabal-diff-0.1..
Building library 'cabal-diff-internal' for cabal-diff-0.1..
[1 of 4] Compiling CabalDiff.Hoogle ( src/CabalDiff/Hoogle.hs, /home/ur20980/src/cabal-extras/dist-newstyle/build/x86_64-linux/ghc-8.8.3/cabal-diff-0.1/l/cabal-diff-internal/build/cabal-diff-internal/CabalDiff/Hoogle.o )
[2 of 4] Compiling CabalDiff.Diff   ( src/CabalDiff/Diff.hs, /home/ur20980/src/cabal-extras/dist-newstyle/build/x86_64-linux/ghc-8.8.3/cabal-diff-0.1/l/cabal-diff-internal/build/cabal-diff-internal/CabalDiff/Diff.o )
[3 of 4] Compiling Paths_cabal_diff ( /home/ur20980/src/cabal-extras/dist-newstyle/build/x86_64-linux/ghc-8.8.3/cabal-diff-0.1/l/cabal-diff-internal/build/cabal-diff-internal/autogen/Paths_cabal_diff.hs, /home/ur20980/src/cabal-extras/dist-newstyle/build/x86_64-linux/ghc-8.8.3/cabal-diff-0.1/l/cabal-diff-internal/build/cabal-diff-internal/Paths_cabal_diff.o )
[4 of 4] Compiling CabalDiff.Main   ( src/CabalDiff/Main.hs, /home/ur20980/src/cabal-extras/dist-newstyle/build/x86_64-linux/ghc-8.8.3/cabal-diff-0.1/l/cabal-diff-internal/build/cabal-diff-internal/CabalDiff/Main.o )
Configuring executable 'cabal-diff' for cabal-diff-0.1..
Preprocessing executable 'cabal-diff' for cabal-diff-0.1..
Building executable 'cabal-diff' for cabal-diff-0.1..
[1 of 1] Compiling Main             ( cli/Main.hs, /home/ur20980/src/cabal-extras/dist-newstyle/build/x86_64-linux/ghc-8.8.3/cabal-diff-0.1/x/cabal-diff/build/cabal-diff/cabal-diff-tmp/Main.dyn_o )
Linking /home/ur20980/src/cabal-extras/dist-newstyle/build/x86_64-linux/ghc-8.8.3/cabal-diff-0.1/x/cabal-diff/build/cabal-diff/cabal-diff ...
[   0.00003] debug: runProcess cwd=/home/ur20980/.ghc ghc --info
[   0.05525] debug: runProcess cwd=/tmp/cabal-diff-5ac980004519694e cabal get colour-2.3.5
[   0.05530] debug: runProcess cwd=/tmp/cabal-diff-3f94d9029f6df50b cabal get colour-2.3.4
[   1.29980] debug: runProcess cwd=/tmp/cabal-diff-5ac980004519694e/colour-2.3.5 cabal v2-build --with-compiler ghc --dependencies-only .
[   4.11449] debug: runProcess cwd=/tmp/cabal-diff-5ac980004519694e/colour-2.3.5 cabal v2-haddock --with-compiler ghc --haddock-hoogle -O0 .
[   5.01120] debug: runProcess cwd=/tmp/cabal-diff-3f94d9029f6df50b/colour-2.3.4 cabal v2-build --with-compiler ghc --dependencies-only .
Resolving dependencies...

cabal: Could not resolve dependencies:
[__0] next goal: colour (user goal)
[__0] rejecting: colour-2.3.5 (constraint from user target requires ==2.3.4)
[__0] trying: colour-2.3.4
[__1] next goal: base (dependency of colour)
[__1] rejecting: base-4.13.0.0/installed-4.13.0.0 (conflict: colour =>
base>=4.9 && <4.13)
[__1] skipping: base-4.14.0.0, base-4.13.0.0 (has the same characteristics
that caused the previous version to fail: excluded by constraint '>=4.9 &&
<4.13' from 'colour')
[__1] rejecting: base-4.12.0.0, base-4.11.1.0, base-4.11.0.0, base-4.10.1.0,
base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0, base-4.8.1.0,
base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1,
base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0,
base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0,
base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from
non-upgradeable package requires installed instance)
[__1] fail (backjumping, conflict set: base, colour)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, colour

[   7.01587] error: ExitFailure 1
[   7.01594] error: stdout
[   7.01597] error: stderr
make: *** [Makefile:10: cabal-diff-test-colour] Error 1

Update

Second attempt:

$ make cabal-diff-test-colour
cabal v2-run cabal-diff:cabal-diff colour 2.3.4 2.3.5
Up to date
[   0.00002] debug: runProcess cwd=/home/ur20980/.ghc ghc --info
[   0.07457] debug: runProcess cwd=/tmp/cabal-diff-cb996cd76f48911a cabal get colour-2.3.5
[   0.07471] debug: runProcess cwd=/tmp/cabal-diff-526b25b35a2cba74 cabal get colour-2.3.4
[   1.25142] debug: runProcess cwd=/tmp/cabal-diff-526b25b35a2cba74/colour-2.3.4 cabal v2-build --with-compiler ghc --dependencies-only .
Resolving dependencies...

cabal: Could not resolve dependencies:
[__0] next goal: colour (user goal)
[__0] rejecting: colour-2.3.5 (constraint from user target requires ==2.3.4)
[__0] trying: colour-2.3.4
[__1] next goal: base (dependency of colour)
[__1] rejecting: base-4.13.0.0/installed-4.13.0.0 (conflict: colour =>
base>=4.9 && <4.13)
[__1] skipping: base-4.14.0.0, base-4.13.0.0 (has the same characteristics
that caused the previous version to fail: excluded by constraint '>=4.9 &&
<4.13' from 'colour')
[__1] rejecting: base-4.12.0.0, base-4.11.1.0, base-4.11.0.0, base-4.10.1.0,
base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0, base-4.8.1.0,
base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1,
base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0,
base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0,
base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from
non-upgradeable package requires installed instance)
[__1] fail (backjumping, conflict set: base, colour)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, colour

[   3.09570] error: ExitFailure 1
[   3.09577] error: stdout
[   3.09579] error: stderr
[   3.09754] debug: runProcess cwd=/tmp/cabal-diff-cb996cd76f48911a/colour-2.3.5 cabal v2-build --with-compiler ghc --dependencies-only .
make: *** [Makefile:10: cabal-diff-test-colour] Error 1
mouse07410 commented 4 years ago

On one Mac machine (where it failed the first time): I re-created ~/.cabal/ from scratch again, re-installed cabal-extras with INSTALL_FLAGS=--disable-shared --disable-executable-dynamic.

$ otool -L ~/.cabal/bin/cabal-store-gc
/Users/ur20980/.cabal/bin/cabal-store-gc:
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
    @rpath/libHScbl-str-gc-0.1-39adb6e6-ghc8.8.3.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libHSbase-4.13.0.0-ghc8.8.3.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libHSghc-prim-0.5.3-ghc8.8.3.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libHSrts_thr-ghc8.8.3.dylib (compatibility version 0.0.0, current version 0.0.0)
$ cabal-store-check
[   0.00004] debug: runProcess cwd=/Users/ur20980/.ghc ghc --info
[   0.08613] info: Reading global package db
[   0.10998] info: 33 packages in /Users/ur20980/.ghcup/ghc/8.8.3/lib/ghc-8.8.3/package.conf.d
[   0.11081] info: Reading store package db
[   0.15160] info: 74 packages in /Users/ur20980/.cabal/store/ghc-8.8.3/package.db
[   0.16989] error: lib executable is broken: /Users/ur20980/.cabal/store/ghc-8.8.3/lib/cabal-hash.txt: openBinaryFile: does not exist (No such file or directory)
[   0.16996] info: 0 directly broken library components
[   0.17001] info: 0 transitively broken libraries
[   0.17004] info: 1 broken executable components
[   0.17006] debug: runPeu completed successfully
$

Besides ignoring the install flags, it somehow considers ~/.cabal/lib/ as an executable?!

On another Mac machine:

$ cabal-store-check
[   0.00006] debug: runProcess cwd=/Users/ur20980/.ghc ghc --info
[   0.12808] info: Reading global package db
[   0.16680] info: 33 packages in /Users/ur20980/.ghcup/ghc/8.8.3/lib/ghc-8.8.3/package.conf.d
[   0.16796] info: Reading store package db
[   1.71985] info: 1776 packages in /Users/ur20980/.cabal/store/ghc-8.8.3/package.db
[   4.14007] error: skylghtng-0.8.3.4-aaa220db interface file for Skylighting.Syntax.Agda is missing
[   4.14732] error: skylghtng-0.8.4-03d09b3c interface file for Skylighting.Syntax.Agda is missing
[   5.07345] error: pndc-2.9.2.1-332993fb is broken transitively
[   5.07353] error: pndc-2.9.2.1-e2b6515e is broken transitively
[   5.07360] error: pndc-2.9.2.1-feb428cc is broken transitively
[   5.08503] error: cbl-nstll-3.2.0.0-2bab2cd8 executable is broken: "No component entry in cabal-hash.txt"
[   5.08593] error: cbl-nstll-3.2.0.0-c632f7b2 executable is broken: "No component entry in cabal-hash.txt"
[   5.13029] error: lhs2tx-1.24-67637e0e executable is broken: "No component entry in cabal-hash.txt"
[   5.13045] error: lib executable is broken: /Users/ur20980/.cabal/store/ghc-8.8.3/lib/cabal-hash.txt: openBinaryFile: does not exist (No such file or directory)
[   5.13504] error: pndc-2.9.2.1-497c2860 executable is broken: "Broken dependency"
[   5.13641] error: pndc-2.9.2.1-529afae6 executable is broken: "Broken dependency"
[   5.13887] error: pndc-2.9.2.1-5dcc3210 executable is broken: "Broken dependency"
[   5.14080] error: shlltstrnnr-1.9-934bd138 executable is broken: "No component entry in cabal-hash.txt"
[   5.14715] info: 2 directly broken library components
[   5.14721] info: 3 transitively broken libraries
[   5.14723] info: 8 broken executable components
[   5.14727] debug: runPeu completed successfully
$ 

On a Linux machine (everything dynamic):

$ cabal-store-check
[   0.00003] debug: runProcess cwd=/home/ur20980/.ghc ghc --info
[   0.12475] info: Reading global package db
[   0.16321] info: 33 packages in /home/ur20980/.ghcup/ghc/8.8.3/lib/ghc-8.8.3/package.conf.d
[   0.16450] info: Reading store package db
[   1.88514] info: 1433 packages in /home/ur20980/.cabal/store/ghc-8.8.3/package.db
[  23.33708] info: 0 directly broken library components
[  23.33721] info: 0 transitively broken libraries
[  23.33726] info: 0 broken executable components
[  23.33730] debug: runPeu completed successfully
$ 

I guess, if one could teach this tool to treat ~/.cabal/lib/ nicer - it could be a useful tool on Mac.

Update

On Linux (CentOS 8):

$ cabal-store-gc --count
[   0.00004] debug: runProcess cwd=/home/ur20980/.ghc ghc --info
[   0.08371] info: Reading global package db
[   0.12963] info: 33 packages in /home/ur20980/.ghcup/ghc/8.8.3/lib/ghc-8.8.3/package.conf.d
[   0.13112] info: Reading store package db
[   1.93502] info: 1433 packages in /home/ur20980/.cabal/store/ghc-8.8.3/package.db
[   2.00770] info: Reading installdir roots
[   2.17710] debug: Found 111 installdir roots from 22 executables
[   2.18142] info: Reading environment roots
[   2.18150] debug: Found 0 environment roots
[   2.18152] info: Reading indirect roots
[   2.18155] error: Exception IOException
/home/ur20980/.cabal/store/roots: getDirectoryContents:openDirStream: does not exist (No such file or directory)
$ 

Update 2

It seems that your tools not only expect presence of certain files, but do not tolerate at all when those files are absent. Example: ~/.cabal/store/roots. Neither my Mac nor my Linux Haskell installations have that file. Its absence causes cabal-store-gc to crash:

22 exeopenat(AT_FDCWD, "/home/ur20980/.ghc/x86_64-linux-8.8.3/environments/default", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 15
futex(0x1fe1498, FUTEX_WAIT_PRIVATE, 2, NULLc) = 0
futex(0x1fe1498, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x2011d18, FUTEX_WAIT_PRIVATE, 0, NULLuta) = 0
blfutex(0x2011d20, FUTEX_WAKE_PRIVATE, 1es
) = 0
fstat(15, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
ioctl(15, TCGETS, 0x7ffd562aa710)       = -1 ENOTTY (Inappropriate ioctl for device)
fstat(15, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
read(15, "", 8192)                      = 0
close(15)                               = 0
openat(AT_FDCWD, "/home/ur20980/.cabal/store/roots", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
futex(0x7f161c000bec, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x7f161c000bf0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x1fe1498, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x2011d1c, FUTEX_WAIT_PRIVATE, 0, NULL[   6.09547] info: Reading environment roots
[   6.09619] debug: Found 0 environment roots
[   6.09622] info: Reading indirect roots
[   6.09631] error: Exception IOException
/home/ur20980/.cabal/store/roots: getDirectoryContents:openDirStream: does not exist (No such file or directory)
mouse07410 commented 4 years ago

@phadej do you know what part of code is responsible for determining whether an object with "execute" permissions is a file or a directory? And where that determination result could get lost/ignored?

It's most unpleasant when cabal-store-check interprets ~/.cabal/lib/ as an executable instead of a directory with permissions "readable" and "searchable"...

mouse07410 commented 4 years ago

@phadej any chance you can fix this for Mac, with me running tests for you?

phadej commented 4 years ago

The ~/.cabal/store/roots issue should be easy to fix, but that's not the original issue. I don't know why cabal-store-check decided to remove /Users/ur20980/.cabal/store/ghc-8.8.3/lib, such directory shouldn't exist in the first place. So I suspect that your setup was broken beyond repair.

If it works now when you create $HOME/.cabal/store/root manually, then please do it before I'll have time to write a patch (to ignore those roots, when directory doesn't exist).

mouse07410 commented 4 years ago

I don't know why cabal-store-check decided to remove /Users/ur20980/.cabal/store/ghc-8.8.3/lib,

Which is why I'm asking you to look into this, as I assume it's your code?

such directory shouldn't exist in the first place.

It should when the system is configured to do dynamic builds. Here's what's stored in that directory:

$ exa -l /Users/ur20980/.cabal/store/ghc-8.10.1/lib
.rwxr-xr-x 1.6M ur20980 13 Jul 21:58 libHSbfnctrs-5.5.7-5c50f76d-ghc8.10.1.dylib
.rwxr-xr-x 1.6M ur20980 13 Jul 22:03 libHSbfnctrs-5.5.7-5d53f676-ghc8.10.1.dylib
.rwxr-xr-x 287k ur20980 13 Jul 22:01 libHSbnry-nstncs-1.0.0.1-44530138-ghc8.10.1.dylib
.rwxr-xr-x 287k ur20980 17 Jul 17:42 libHSbnry-nstncs-1.0.0.1-dbb72788-ghc8.10.1.dylib
.rwxr-xr-x 9.1k ur20980 13 Jul 21:58 libHSbnry-rphns-1.0.1-e9052b83-ghc8.10.1.dylib
.rwxr-xr-x  84k ur20980 13 Jul 21:58 libHSbs-cmpt-0.11.1-266c13b1-ghc8.10.1.dylib
.rwxr-xr-x  84k ur20980 13 Jul 22:02 libHSbs-cmpt-0.11.1-fa655d8b-ghc8.10.1.dylib
.rwxr-xr-x  97k ur20980 13 Jul 22:02 libHSbs-cmpt-bttrs-0.11.1-8d0b0544-ghc8.10.1.dylib
.rwxr-xr-x  97k ur20980 13 Jul 21:58 libHSbs-cmpt-bttrs-0.11.1-26684db9-ghc8.10.1.dylib
.rwxr-xr-x 9.6k ur20980 13 Jul 21:58 libHSbs-rphns-0.8.2-14a7478e-ghc8.10.1.dylib
.rwxr-xr-x 9.6k ur20980 13 Jul 22:02 libHSbs-rphns-0.8.2-277fdc36-ghc8.10.1.dylib
.rwxr-xr-x  37k ur20980 13 Jul 21:58 libHSbs16-bytstrng-0.1.1.7-d942f8ed-ghc8.10.1.dylib
.rwxr-xr-x  37k ur20980 13 Jul 22:02 libHSbs16-bytstrng-0.1.1.7-e0ca7f7b-ghc8.10.1.dylib
.rwxr-xr-x  33M ur20980 13 Jul 22:07 libHSCbl-3.0.2.0-46621065-ghc8.10.1.dylib
.rwxr-xr-x 159k ur20980 13 Jul 21:58 libHScbl-dctst-1.0.8-2b2ca77c-ghc8.10.1.dylib
.rwxr-xr-x 159k ur20980 13 Jul 22:02 libHScbl-dctst-1.0.8-52950e58-ghc8.10.1.dylib
.rwxr-xr-x 2.0M ur20980 13 Jul 22:07 libHScbl-hlpr-1.1.0.0-56f5ca28-ghc8.10.1.dylib
.rwxr-xr-x 1.1M ur20980 13 Jul 22:01 libHScbl-nstll-prsrs-0.3.0.1-4fb451a9-ghc8.10.1.dylib
.rwxr-xr-x 1.1M ur20980 17 Jul 17:42 libHScbl-nstll-prsrs-0.3.0.1-f89028ce-ghc8.10.1.dylib
.rwxr-xr-x 769k ur20980 13 Jul 22:06 libHScbl-pln-0.7.0.0-57fdd036-ghc8.10.1.dylib
.rwxr-xr-x 153k ur20980 13 Jul 22:02 libHSclck-0.8-af64b80e-ghc8.10.1.dylib
. . . . . [and so on]

As you can see, that's where Cabal places the shared libraries it builds.

A specific example to the point:

$ exa ~/.cabal/store/ghc-8.10.1/lns-4.19.2-c7b26c58/lib/
Control  GHC       libHSlns-4.19.2-c7b26c58.a  Paths_lens.dyn_hi  System
Data     Language  Numeric                     Paths_lens.hi      
$ exa ~/.cabal/store/ghc-8.10.1/lib/*lns-4.19.2-c7b26c58*
/Users/ur20980/.cabal/store/ghc-8.10.1/lib/libHSlns-4.19.2-c7b26c58-ghc8.10.1.dylib
$ 

So I suspect that your setup was broken beyond repair.

My setup seems to work reasonably fine until something like Agda or other similar build (often using v1- commands) breaks it. So, if something is broken, I tend to lean towards cabal-store-check that seems unable to distinguish between an executable file and a directory.

mouse07410 commented 4 years ago

@phadej ?

mouse07410 commented 2 years ago

@phadej here's the current problem with cabal-store-check on a "clean" (aka, not corrupted in any way, and not involved with any cabal v1-... operations) Cabal installation:

$ cabal-store-check --trace-process
[   0.00001] ghc.info: ghc
[   0.00041] process.0.start: cwd=/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/ ghc --info
[   0.24686] info: Reading global package db
[   0.24706] ghc.read-package-db: /Users/ur20980/.ghcup/ghc/9.0.1/lib/ghc-9.0.1/package.conf.d
[   0.27836] info: 35 packages in /Users/ur20980/.ghcup/ghc/9.0.1/lib/ghc-9.0.1/package.conf.d
[   0.27958] info: Reading store package db
[   0.27972] ghc.read-package-db: /Users/ur20980/.cabal/store/ghc-9.0.1/package.db
[   0.51703] info: 262 packages in /Users/ur20980/.cabal/store/ghc-9.0.1/package.db
[   0.71755] error: lib executable is broken: /Users/ur20980/.cabal/store/ghc-9.0.1/lib/cabal-hash.txt: openBinaryFile: does not exist (No such file or directory)
[   0.71980] error: shlltstrnnr-1.9-aed0895f executable is broken: "No component entry in cabal-hash.txt"
[   0.72012] info: 0 directly broken library components
[   0.72028] info: 0 transitively broken libraries
[   0.72043] info: 2 broken executable components
[   0.72058] peu.completed: OK
$
$ ll /Users/ur20980/.cabal/store/ghc-9.0.1/shlltstrnnr-1.9-aed0895f
total 8
drwxr-xr-x    5 ur20980  MITLL\Domain Users   160 Oct 10 16:47 ./
drwxr-xr-x  288 ur20980  MITLL\Domain Users  9216 Oct 11 11:44 ../
drwxr-xr-x    3 ur20980  MITLL\Domain Users    96 Oct 10 16:47 bin/
-rw-r--r--    1 ur20980  MITLL\Domain Users   824 Oct 10 16:47 cabal-hash.txt
drwxr-xr-x    3 ur20980  MITLL\Domain Users    96 Oct 10 16:47 share/
$ ll -R /Users/ur20980/.cabal/store/ghc-9.0.1/shlltstrnnr-1.9-aed0895f
total 8
drwxr-xr-x    5 ur20980  MITLL\Domain Users   160 Oct 10 16:47 ./
drwxr-xr-x  288 ur20980  MITLL\Domain Users  9216 Oct 11 11:44 ../
drwxr-xr-x    3 ur20980  MITLL\Domain Users    96 Oct 10 16:47 bin/
-rw-r--r--    1 ur20980  MITLL\Domain Users   824 Oct 10 16:47 cabal-hash.txt
drwxr-xr-x    3 ur20980  MITLL\Domain Users    96 Oct 10 16:47 share/

/Users/ur20980/.cabal/store/ghc-9.0.1/shlltstrnnr-1.9-aed0895f/bin:
total 1400
drwxr-xr-x  3 ur20980  MITLL\Domain Users      96 Oct 10 16:47 ./
drwxr-xr-x  5 ur20980  MITLL\Domain Users     160 Oct 10 16:47 ../
-rwxr-xr-x  1 ur20980  MITLL\Domain Users  715144 Oct 10 16:47 shelltest*

/Users/ur20980/.cabal/store/ghc-9.0.1/shlltstrnnr-1.9-aed0895f/share:
total 0
drwxr-xr-x  3 ur20980  MITLL\Domain Users   96 Oct 10 16:47 ./
drwxr-xr-x  5 ur20980  MITLL\Domain Users  160 Oct 10 16:47 ../
drwxr-xr-x  3 ur20980  MITLL\Domain Users   96 Oct 10 16:47 doc/

/Users/ur20980/.cabal/store/ghc-9.0.1/shlltstrnnr-1.9-aed0895f/share/doc:
total 72
drwxr-xr-x  3 ur20980  MITLL\Domain Users     96 Oct 10 16:47 ./
drwxr-xr-x  3 ur20980  MITLL\Domain Users     96 Oct 10 16:47 ../
-rw-r--r--  1 ur20980  MITLL\Domain Users  35147 Oct 10 16:47 LICENSE
$
$ cat /Users/ur20980/.cabal/store/ghc-9.0.1/shlltstrnnr-1.9-aed0895f/cabal-hash.txt 
pkgid: shelltestrunner-1.9
src: cbc4358d447e32babe4572cda0d530c648cc4c67805f9f88002999c717feb3a8
pkg-config-deps: 
deps: Dff-0.4.0-4436e40e, HUnt-1.6.2.0-cd809ec4, base-4.15.0.0, cmdrgs-0.10.21-7463d78b, directory-1.3.6.1, filepath-1.4.2.1, flmnp-0.3.6.3-0e2ca58a, parsec-3.1.14.0, process-1.6.11.0, prtty-shw-1.10-9a4eee91, rgx-tdf-1.3.1.1-38c53ed4, sf-0.3.19-d3433c56, tf8-strng-1.0.2-4ae5e90d, tst-frmwrk-0.8.2.0-93931f42, tst-frmwrk-hnt-0.3.0.2-49ba0ea2
compilerid: ghc-9.0.1
platform: x86_64-osx
shared-lib: True
dynamic-exe: True
stripped-exe: False
debug-info: 0
extra-lib-dirs: /opt/local/lib/liconv /opt/local/lib /usr/local/lib /usr/lib /opt/local/lib/liconv /opt/local/lib /usr/local/lib /usr/lib
extra-include-dirs: /opt/local/include /usr/local/include /opt/local/include /usr/local/include
documentation: True

I'm pretty sure that /Users/ur20980/.cabal/store/ghc-9.0.1/lib/ directory is legitimately created by Cabal to accommodate dynamic builds. it contains shared libraries of packages Cabal installed from Hackage.

Again, can you help, please? Making cabal-store-check work correctly would be a huge improvement.