Skip to content

Command error when COURSIER_INSTALL_DIR has nested directories #3117

@allxiao

Description

@allxiao

The cs setup in earlier versions would prompt to customize COURSIER_INSTALL_DIR and COURSIER_CACHE. There were no instructions about the restrictions, so I set them as followed in system environment properties:

COURSIER_INSTALL_DIR=C:\Coursier
COURSIER_CACHE=C:\Coursier\Cache

I thought the COURSIER_INSTALL_DIR points to the root directory of the installation, and was expecting some other directories would be created under this directory (e.g., bin, lib, etc.) like common practice in make install. So I placed the Cache directory in this Install directory.

After this cs list and cs update will raise error and the error message is not easy to understand.

Exception in thread "main" java.io.FileNotFoundException: C:\Coursier\Cache (Access is denied)
        at java.base@17.0.5/java.io.RandomAccessFile.open0(RandomAccessFile.java)
        at java.base@17.0.5/java.io.RandomAccessFile.open(RandomAccessFile.java:344)
        at java.base@17.0.5/java.io.RandomAccessFile.<init>(RandomAccessFile.java:259)
        at java.base@17.0.5/java.io.RandomAccessFile.<init>(RandomAccessFile.java:213)
        at java.base@17.0.5/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1312)
        at java.base@17.0.5/java.util.zip.ZipFile$Source.get(ZipFile.java:1277)
        at java.base@17.0.5/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:709)
        at java.base@17.0.5/java.util.zip.ZipFile.<init>(ZipFile.java:243)
        at java.base@17.0.5/java.util.zip.ZipFile.<init>(ZipFile.java:172)
        at java.base@17.0.5/java.util.zip.ZipFile.<init>(ZipFile.java:186)
        at coursier.install.InfoFile$.isInfoFile(InfoFile.scala:28)
        at coursier.install.InstallDir.$anonfun$list$2(InstallDir.scala:483)
        at coursier.install.InstallDir.$anonfun$list$2$adapted(InstallDir.scala:483)
        at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:515)
        at scala.collection.Iterator$$anon$10.hasNext(Iterator.scala:460)
        at scala.collection.Iterator.foreach(Iterator.scala:943)
        at scala.collection.Iterator.foreach$(Iterator.scala:943)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
        at scala.collection.generic.Growable.$plus$plus$eq(Growable.scala:62)
        at scala.collection.generic.Growable.$plus$plus$eq$(Growable.scala:53)
        at scala.collection.immutable.VectorBuilder.$plus$plus$eq(Vector.scala:668)
        at scala.collection.immutable.VectorBuilder.$plus$plus$eq(Vector.scala:645)
        at scala.collection.TraversableOnce.to(TraversableOnce.scala:366)
        at scala.collection.TraversableOnce.to$(TraversableOnce.scala:364)
        at scala.collection.AbstractIterator.to(Iterator.scala:1431)
        at scala.collection.TraversableOnce.toVector(TraversableOnce.scala:362)
        at scala.collection.TraversableOnce.toVector$(TraversableOnce.scala:362)
        at scala.collection.AbstractIterator.toVector(Iterator.scala:1431)
        at coursier.install.InstallDir.list(InstallDir.scala:484)
        at coursier.cli.install.Update$.run(Update.scala:50)
        at coursier.cli.install.Update$.run(Update.scala:13)
        at caseapp.core.app.CaseApp.main(CaseApp.scala:157)
        at caseapp.core.app.CommandsEntryPoint.main(CommandsEntryPoint.scala:164)
        at coursier.cli.Coursier$.main(Coursier.scala:118)
        at coursier.cli.Coursier.main(Coursier.scala)

It would be great to

  • filter out directories when examine files in cs list or cs update, or
  • prompt for incorrect setup when install dir contains other directory, or
  • have some documentation on how to set the path configuration environment variables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions