scalacenter/bloop

java.nio.file.NoSuchFileException: /usr/sbin

ornicar opened this issue · 1 comments

bloop: 2.0.0 release
platform: linux x86_64, kernel 6.10.2
java: openjdk version "21.0.3"
OS: NixOs

bloop fails on start with the following exception:

Aug 15 21:52:50 fw bloop[2596718]: Exception in thread "main" java.nio.file.NoSuchFileException: /usr/sbin
Aug 15 21:52:50 fw bloop[2596718]:         at java.base@17.0.5/sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:440)
Aug 15 21:52:50 fw bloop[2596718]:         at java.base@17.0.5/java.nio.file.Files.newDirectoryStream(Files.java:482)
Aug 15 21:52:50 fw bloop[2596718]:         at os.list$stream$$anon$1.generate(ListOps.scala:33)
Aug 15 21:52:50 fw bloop[2596718]:         at geny.Generator.foreach(Generator.scala:49)
Aug 15 21:52:50 fw bloop[2596718]:         at geny.Generator.foreach$(Generator.scala:49)
Aug 15 21:52:50 fw bloop[2596718]:         at os.list$stream$$anon$1.foreach(ListOps.scala:31)
Aug 15 21:52:50 fw bloop[2596718]:         at geny.Generator.toBuffer(Generator.scala:132)
Aug 15 21:52:50 fw bloop[2596718]:         at geny.Generator.toBuffer$(Generator.scala:130)
Aug 15 21:52:50 fw bloop[2596718]:         at os.list$stream$$anon$1.toBuffer(ListOps.scala:31)
Aug 15 21:52:50 fw bloop[2596718]:         at geny.Generator.toArray(Generator.scala:136)
Aug 15 21:52:50 fw bloop[2596718]:         at geny.Generator.toArray$(Generator.scala:136)
Aug 15 21:52:50 fw bloop[2596718]:         at os.list$stream$$anon$1.toArray(ListOps.scala:31)
Aug 15 21:52:50 fw bloop[2596718]:         at os.list$.apply(ListOps.scala:19)
Aug 15 21:52:50 fw bloop[2596718]:         at os.list$.apply(ListOps.scala:23)
Aug 15 21:52:50 fw bloop[2596718]:         at bloop.cli.util.OsLibc$.isMusl$lzycompute(OsLibc.scala:48)
Aug 15 21:52:50 fw bloop[2596718]:         at bloop.cli.util.OsLibc$.isMusl(OsLibc.scala:13)
Aug 15 21:52:50 fw bloop[2596718]:         at bloop.cli.util.OsLibc$.jvmIndexOs$lzycompute(OsLibc.scala:60)
Aug 15 21:52:50 fw bloop[2596718]:         at bloop.cli.util.OsLibc$.jvmIndexOs(OsLibc.scala:58)
Aug 15 21:52:50 fw bloop[2596718]:         at bloop.cli.options.DefaultOptions$.defaultJvmCmd$lzycompute$1(DefaultOptions.scala:143)
Aug 15 21:52:50 fw bloop[2596718]:         at bloop.cli.options.DefaultOptions$.defaultJvmCmd$1(DefaultOptions.scala:142)
Aug 15 21:52:50 fw bloop[2596718]:         at bloop.cli.options.DefaultOptions$.$anonfun$bloopRifleConfig$17(DefaultOptions.scala:153)
Aug 15 21:52:50 fw bloop[2596718]:         at scala.Option.getOrElse(Option.scala:201)
Aug 15 21:52:50 fw bloop[2596718]:         at bloop.cli.options.DefaultOptions$.bloopRifleConfig(DefaultOptions.scala:153)
Aug 15 21:52:50 fw bloop[2596718]:         at bloop.cli.options.DefaultOptions.bloopRifleConfig(DefaultOptions.scala:44)
Aug 15 21:52:50 fw bloop[2596718]:         at bloop.cli.Default$.run(Default.scala:20)
Aug 15 21:52:50 fw bloop[2596718]:         at bloop.cli.Default$.run(Default.scala:13)
Aug 15 21:52:50 fw bloop[2596718]:         at caseapp.core.app.CaseApp.main(CaseApp.scala:161)
Aug 15 21:52:50 fw bloop[2596718]:         at caseapp.core.app.CommandsEntryPoint.main(CommandsEntryPoint.scala:120)
Aug 15 21:52:50 fw bloop[2596718]:         at bloop.cli.Bloop.main(Bloop.scala)

I think it's due to this relatively new code:

val inUsrSbin = os.list(os.Path("/usr/sbin")).map(_.last)

NixOS doesn't have a /usr/sbin directory.

I think it would also break if there is no /lib dir due to

val inLib = os.list(os.Path("/lib")).map(_.last)