Skip to content

Commit

Permalink
Merge pull request #2405 from tgodzik/check-path
Browse files Browse the repository at this point in the history
bugfix: Check is lib and /usr/sbin paths exists before listing
  • Loading branch information
tgodzik authored Aug 19, 2024
2 parents da6b255 + 2aaa786 commit 0d716c7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cli/src/main/scala/bloop/cli/util/OsLibc.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ object OsLibc {
if (foundMusl)
Some(true)
else {
val inLib = os.list(os.Path("/lib")).map(_.last)
val libPath = Seq(os.root / "lib").filter(os.exists)
val inLib = libPath.flatMap(os.list(_)).map(_.last)
if (inLib.exists(_.contains("-linux-gnu"))) Some(false)
else if (inLib.exists(name => name.contains("libc.musl-") || name.contains("ld-musl-")))
Some(true)
else {
val inUsrSbin = os.list(os.Path("/usr/sbin")).map(_.last)
val sbinPath = Seq(os.root / "usr" / "sbin").filter(os.exists)
val inUsrSbin = sbinPath.flatMap(os.list(_)).map(_.last)
if (inUsrSbin.exists(_.contains("glibc"))) Some(false)
else None
}
Expand Down

0 comments on commit 0d716c7

Please sign in to comment.