Skip to content

Commit

Permalink
Merge pull request sbt#362 from bratkartoffel/bugfix/lfs64-fixes
Browse files Browse the repository at this point in the history
use regular stat() instead of non-standard __xstat64 abi
  • Loading branch information
eed3si9n authored Dec 13, 2023
2 parents 2cc96a8 + b95a6d4 commit 3212880
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ val io = (project in file("io"))
exclude[MissingClassProblem]("sbt.internal.io.FreeBSD64FileStat"),
exclude[MissingClassProblem]("sbt.internal.io.FreeBSD64Milli"),
exclude[MissingClassProblem]("sbt.internal.io.FreeBSD64Milli$"),
// Replaced non-standard __xstat64() with conformant stat() calls
exclude[DirectMissingMethodProblem]("sbt.internal.io.Linux32.*"),
exclude[ReversedMissingMethodProblem]("sbt.internal.io.Linux32.*"),
exclude[DirectMissingMethodProblem]("sbt.internal.io.Linux64.*"),
exclude[ReversedMissingMethodProblem]("sbt.internal.io.Linux64.*"),
// protected[this]
exclude[DirectMissingMethodProblem]("sbt.io.CopyOptions.copy*"),
// private class
Expand Down
8 changes: 4 additions & 4 deletions io/src/main/scala/sbt/internal/io/Milli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -205,28 +205,28 @@ private abstract class PosixMilliIntUtim[Interface <: Utimensat[Int]: ClassTag]

private class Linux64FileStat extends StatLong(144, 88, 96)
private trait Linux64 extends Library with Utimensat[Long] {
def __xstat64(version: Int, filePath: String, buf: Linux64FileStat): Int
def stat(filePath: String, buf: Linux64FileStat): Int
}
private object Linux64Milli extends PosixMilliLongUtim[Linux64] {
protected final val AT_FDCWD: Int = -100
protected final val UTIME_OMIT: Long = (1L << 30) - 2
protected def getModifiedTimeNative(filePath: String) = {
val stat = new Linux64FileStat
checkedIO(filePath) { libc.__xstat64(1, filePath, stat) }
checkedIO(filePath) { libc.stat(filePath, stat) }
stat.getModifiedTimeNative
}
}

private class Linux32FileStat extends StatInt(88, 64, 68)
private trait Linux32 extends Library with Utimensat[Int] {
def __xstat(version: Int, filePath: String, buf: Linux32FileStat): Int
def stat(filePath: String, buf: Linux32FileStat): Int
}
private object Linux32Milli extends PosixMilliIntUtim[Linux32] {
protected final val AT_FDCWD: Int = -100
protected final val UTIME_OMIT: Int = ((1 << 30) - 2)
protected def getModifiedTimeNative(filePath: String) = {
val stat = new Linux32FileStat
checkedIO(filePath) { libc.__xstat(3, filePath, stat) }
checkedIO(filePath) { libc.stat(filePath, stat) }
stat.getModifiedTimeNative
}
}
Expand Down

0 comments on commit 3212880

Please sign in to comment.