From f83c347164398085780429f015a31452fdd229d9 Mon Sep 17 00:00:00 2001 From: dmjio Date: Mon, 21 Sep 2026 13:07:33 -0500 Subject: [PATCH] Run the mhs version probe without the package path flag mhsNameVers asks the compiler for its version by running mhs --numeric-version. That command was built with mhsOut, the helper used for compiler invocations, which prepends -a'PATH' when mcabal was started with -a (a package database other than ~/.mcabal). The probe then became mhs -a'PATH' --numeric-version and mhs only accepts --numeric-version as its sole argument, so it fails with mhs: uncaught exception: error: Unknown flag: --numeric-version mhsNameVers is reached through getMhsDir, which is used when installing a library, so 'mcabal -aPATH install' failed for every package with a library. Using -a is needed e.g. when mhs is installed read-only by a package manager (nix) and packages have to go into a writable database. The package path has no bearing on the compiler version, so run the probe as a plain mhs --numeric-version (through cmdOut with the compiler executable), the same way mhsBackend already does at startup. --- src/MicroCabal/Backend/MHS.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/MicroCabal/Backend/MHS.hs b/src/MicroCabal/Backend/MHS.hs index 1ca6759..26055cd 100644 --- a/src/MicroCabal/Backend/MHS.hs +++ b/src/MicroCabal/Backend/MHS.hs @@ -36,7 +36,8 @@ mhsBackend env = do mhsNameVers :: Env -> IO (String, Version) mhsNameVers env = do - v <- readVersion . takeWhile (/= '\n') <$> mhsOut env "--numeric-version" + -- Without the package path flags: --numeric-version must be the only argument. + v <- readVersion . takeWhile (/= '\n') <$> cmdOut env (compilerExe (backend env) ++ " --numeric-version") return ("mhs", v) getMhsDir :: Env -> IO FilePath