Using ghc-7.4.1 (no haskell platform) and cab-0.1.13 in linux debian the command cab -s sandbox list does not list the sandbox contents.
After looking at the source code found that PkgDB.userPkgs is filtering all the packages which don't have a path prefix as "/home/user/." I'm attaching a patch (when I figure out how to do that) that changes the behavior of userPkgs when a sandbox path is specified in the command line (so the sandbox is not required to be under the user home).
As I tests this patch I keep finding nuances. In windows the packages in the sandbox are registered with lowercase drive letters "c:...", but my patched userPkgs expects the drive letter to be in upper case "C:...". In linux, I discovered that when cabal-dev takes a relative path for specifying the sandbox containing ".." when installing packages, causes the paths in the package info to also contain "..".
For the reasons above I have found simpler to just redefine userPkgs to:
userPkgs :: IO (PkgInfo -> Bool)
userPkgs = do
gDB <- getGlobalPkgDB
return$ \pkgi -> isNothing$ lookupInstalledPackageId gDB (installedPackageId pkgi)
getGlobalPkgDB :: IO PkgDB
getGlobalPkgDB = do
(_,pro) <- configure normal Nothing Nothing defaultProgramDb
getInstalledPackages normal [GlobalPackageDB] pro
So now, everything which is not in the global package database is accepted by userPkgs, the above problems are solved, and also the pesky "." at the end of the path in unices.