Repository navigation
Stop AIX reporting the current instant as its boot time - #3561
Conversation
An AIX CI run reported "Uptime: 0 days, 00:00:02" and a boot time twenty
seconds in the past, four minutes after the same box had correctly
reported 166 days. The machine had not rebooted: the serial number and
UUID are identical across both readings, and it is at 169 days now.
AixOperatingSystem derived its boot time as currentTimeMillis() minus
Uptime.queryUpTime(). That query returns 0 both when the system just
booted and when the uptime command could not be run, so a transient
failure on a loaded shared box produced a boot time of "now" and an
uptime of zero. Because the value was cached in a static final field
computed at class load, one such failure poisoned the boot time for the
life of the JVM. It also happened at the worst possible moment, during
test startup when the machine is busiest.
resolveBootTimeMillis now treats a zero uptime as unknown rather than as
a valid duration, and the cache stores only a successful reading, so a
failed query is retried on the next call. The cache stays static so the
JNA and FFM backends report an identical boot time rather than each
deriving one from a separately-timed reading of a minute-resolution
source; NativeComparisonTest asserts they are equal.
The uptime command is now preferred over who -b. It reports a duration,
which is unambiguous, where who -b reports a timestamp whose AIX format
may carry no year.
That format is the second half of the problem. who -b on AIX 7.3 prints
. system boot Feb 13 23:31
in both the C and en_US locales, but BOOT_FORMAT_AIX has only ever
matched a four-digit yyyy-MM-dd date, in every revision since the
original 2020 AIX port. The primary source has therefore never parsed on
this box, leaving the uptime command as the only one. Both forms are now
accepted; the year-less one resolves to the most recent occurrence,
which is why it is consulted only after the unambiguous duration.
Resolving a year-less timestamp already existed in the generic UNIX who
reader, which parses the same MMM d HH:mm form, so rather than write a
second copy the logic is hoisted to ParseUtil.parseYearlessDateToEpoch
and both drivers call it. That also fixes a latent bug in the generic
reader, whose default year was captured in a static formatter when the
class loaded and so would have gone stale in a JVM running across a new
year.
Verified against the real gcc119 AIX 7.3.0.0 box over ssh; the fixture
in the test is the exact line it emits, trailing padding included,
captured with who -b | od -c.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (10)
📝 WalkthroughWalkthroughChangesAIX boot-time and date parsing
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant AixOperatingSystem
participant UptimeSource
participant AixWho
AixOperatingSystem->>UptimeSource: read uptime
alt positive uptime-derived boot time
UptimeSource-->>AixOperatingSystem: boot time
else uptime unavailable
AixOperatingSystem->>AixWho: read who -b boot time
AixWho-->>AixOperatingSystem: parsed boot time
end
AixOperatingSystem-->>AixOperatingSystem: cache first successful value
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Line 3: Change the “Bug Fixes and Improvements” heading in CHANGELOG.md from a
fifth-level heading to a second-level heading, using ## to maintain the correct
Markdown heading hierarchy.
In `@oshi-common/src/main/java/oshi/util/ParseUtil.java`:
- Around line 1583-1585: Update the yearless-date resolution around
LocalDateTime.parse so future or invalid current-year candidates are reparsed
with the previous year instead of using minusYears(1), preserving Feb 29 when
valid there. Return 0 if both the current-year and previous-year parses fail,
and add a regression test covering Feb 29 in a non-leap current year.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9ebefd85-83f0-4e8c-90ab-f320b9786fd9
📒 Files selected for processing (9)
AGENTS.mdCHANGELOG.mdoshi-common/src/main/java/oshi/driver/common/unix/aix/Who.javaoshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.javaoshi-common/src/main/java/oshi/util/ParseUtil.javaoshi-common/src/main/java/oshi/util/driver/unix/Who.javaoshi-common/src/test/java/oshi/driver/common/unix/aix/UptimeAndBootTimeTest.javaoshi-common/src/test/java/oshi/software/common/os/unix/aix/AixOperatingSystemTest.javaoshi-common/src/test/java/oshi/util/ParseUtilTest.java
📜 Review details
⏰ Context from checks skipped due to timeout. (10)
- GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
- GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
- GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: Test JDK 26, ubuntu-latest
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: Analyze (java)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{java,xml,md}
📄 CodeRabbit inference engine (AGENTS.md)
Do not commit generated output,
target/, or IDE files.
Files:
AGENTS.mdCHANGELOG.mdoshi-common/src/main/java/oshi/util/ParseUtil.javaoshi-common/src/main/java/oshi/util/driver/unix/Who.javaoshi-common/src/test/java/oshi/util/ParseUtilTest.javaoshi-common/src/test/java/oshi/driver/common/unix/aix/UptimeAndBootTimeTest.javaoshi-common/src/test/java/oshi/software/common/os/unix/aix/AixOperatingSystemTest.javaoshi-common/src/main/java/oshi/driver/common/unix/aix/Who.javaoshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.java
CHANGELOG.md
📄 CodeRabbit inference engine (AGENTS.md)
Add an entry under
Next Releaseonly for user-visible changes; omit pure refactors, deduplication, test-only changes, and CI configuration.
Files:
CHANGELOG.md
oshi-common/**/*.java
📄 CodeRabbit inference engine (AGENTS.md)
oshi-common/**/*.java: Keeposhi-commonpure Java: do not reference JNA, FFM, orSystem.load/loadLibrary; place parsing, conversion, validation, caching, and shared logic there rather than duplicating it in platform implementations.
Use Java 8-compatible language features inoshi-common; do not use modern Java 9+ syntax or APIs.
Files:
oshi-common/src/main/java/oshi/util/ParseUtil.javaoshi-common/src/main/java/oshi/util/driver/unix/Who.javaoshi-common/src/test/java/oshi/util/ParseUtilTest.javaoshi-common/src/test/java/oshi/driver/common/unix/aix/UptimeAndBootTimeTest.javaoshi-common/src/test/java/oshi/software/common/os/unix/aix/AixOperatingSystemTest.javaoshi-common/src/main/java/oshi/driver/common/unix/aix/Who.javaoshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.java
**/*.java
📄 CodeRabbit inference engine (AGENTS.md)
**/*.java: Useoshi.util.ParseUtilparsing helpers instead ofInteger.parseInt,Long.parseLong,Double.parseDouble,Integer.decode, and related banned APIs.
Do not useorg.slf4j.event.**; useoshi.util.LogLevelinstead.
Every public member must have Javadoc, and code and Javadoc—including{@link...}—must use imported simple class names rather than fully qualified names.
New classes should declare an appropriate concurrency annotation fromoshi.annotation.concurrent, matching the modeled class where applicable.
Wrap constant or expensive, slowly changing system values inoshi.util.Memoizer.memoize, usingdefaultExpiration()when refresh is required.
Avoid timing-sensitive assertions comparing live readings such as CPU frequency, tick counters, or uptime.
Files:
oshi-common/src/main/java/oshi/util/ParseUtil.javaoshi-common/src/main/java/oshi/util/driver/unix/Who.javaoshi-common/src/test/java/oshi/util/ParseUtilTest.javaoshi-common/src/test/java/oshi/driver/common/unix/aix/UptimeAndBootTimeTest.javaoshi-common/src/test/java/oshi/software/common/os/unix/aix/AixOperatingSystemTest.javaoshi-common/src/main/java/oshi/driver/common/unix/aix/Who.javaoshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.java
**/src/main/java/**/*.java
📄 CodeRabbit inference engine (AGENTS.md)
Prefer native calls for system information; on Linux prefer
FileUtilfor/procand/sys, while on other platformsExecutingCommandis acceptable when native APIs do not expose the information.
Files:
oshi-common/src/main/java/oshi/util/ParseUtil.javaoshi-common/src/main/java/oshi/util/driver/unix/Who.javaoshi-common/src/main/java/oshi/driver/common/unix/aix/Who.javaoshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.java
**/driver/**/*.java
📄 CodeRabbit inference engine (AGENTS.md)
Put platform-specific acquisition and command matching in drivers, but reuse
ParseUtilfor general parsing primitives instead of creating duplicate parsers.
Files:
oshi-common/src/main/java/oshi/util/driver/unix/Who.javaoshi-common/src/test/java/oshi/driver/common/unix/aix/UptimeAndBootTimeTest.javaoshi-common/src/main/java/oshi/driver/common/unix/aix/Who.java
**/*Test.java
📄 CodeRabbit inference engine (AGENTS.md)
**/*Test.java: Use JUnit 5 and Hamcrest; do not add Mockito. Separate parsing from acquisition so parser methods can be tested with fixtureList<String>orStringinput.
Test invariants such as non-null values, types, ordering, and plausible ranges rather than hardware-specific values; allow zero and empty results.
Files:
oshi-common/src/test/java/oshi/util/ParseUtilTest.javaoshi-common/src/test/java/oshi/driver/common/unix/aix/UptimeAndBootTimeTest.javaoshi-common/src/test/java/oshi/software/common/os/unix/aix/AixOperatingSystemTest.java
🧠 Learnings (3)
📚 Learning: 2026-04-12T19:22:09.716Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:22:09.716Z
Learning: When reviewing OSHI hardware platform code that uses or implements `CentralProcessor`/`PhysicalProcessor.getEfficiency()`, remember the API’s counterintuitive semantics: a *higher* efficiency-class value indicates *greater performance* (lower efficiency). P-cores/“performance cores” should therefore have higher values (e.g., 1) than E-cores/“efficiency cores” (e.g., 0), as documented in the `CentralProcessor` Javadoc. Do not flag code as incorrect solely because ARM_P_CORES or Intel P-cores are assigned higher efficiency values.
Applied to files:
oshi-common/src/main/java/oshi/util/ParseUtil.javaoshi-common/src/main/java/oshi/util/driver/unix/Who.javaoshi-common/src/main/java/oshi/driver/common/unix/aix/Who.javaoshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.java
📚 Learning: 2026-07-06T19:25:59.225Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3432
File: oshi-common/src/main/java/oshi/util/ExceptionUtil.java:26-56
Timestamp: 2026-07-06T19:25:59.225Z
Learning: In this repo’s SLF4J 1.x-compatible logging code, do not flag cases where a logger call uses SLF4J 1.6+ implicit-cause handling—e.g., `log.error("...{}", value, t)` (or similar with a single `{}` placeholder) where `t` is passed as the final/trailing argument. SLF4J will attach `t` as the log event’s cause with the full stack trace; this is equivalent to SLF4J 2.x’s fluent `atLevel(...).setCause(t).log(...)` and is intentionally used to preserve SLF4J 1.x runtime compatibility.
Applied to files:
oshi-common/src/main/java/oshi/util/ParseUtil.javaoshi-common/src/main/java/oshi/util/driver/unix/Who.javaoshi-common/src/main/java/oshi/driver/common/unix/aix/Who.javaoshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.java
📚 Learning: 2026-07-30T00:35:22.638Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3547
File: oshi-common/src/main/java/oshi/hardware/common/platform/unix/BsdFirmware.java:82-82
Timestamp: 2026-07-30T00:35:22.638Z
Learning: In OSHI, treat changes as “API-breaking” only when they affect classes (or relevant API surface) annotated with `PublicAPI`. Public classes/members that are not annotated with `PublicAPI` should be reviewed as internal implementation details, even if they are public (e.g., classes like `oshi.hardware.common.platform.unix.BsdFirmware`). Also, respect intentional visibility decisions used for tests—e.g., methods like `BsdFirmware.parseDmesg(List<String>)` may be intentionally package-private to support tests within the same package; avoid widening visibility or altering signatures unless the related `PublicAPI` contract requires it.
Applied to files:
oshi-common/src/main/java/oshi/util/ParseUtil.javaoshi-common/src/main/java/oshi/util/driver/unix/Who.javaoshi-common/src/main/java/oshi/driver/common/unix/aix/Who.javaoshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.java
🪛 markdownlint-cli2 (0.23.1)
CHANGELOG.md
[warning] 3-3: Heading levels should only increment by one level at a time
Expected: h2; Actual: h5
(MD001, heading-increment)
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3561 +/- ##
============================================
- Coverage 79.36% 79.27% -0.09%
- Complexity 3789 4143 +354
============================================
Files 706 706
Lines 24264 24292 +28
Branches 4057 4063 +6
============================================
+ Hits 19257 19258 +1
- Misses 2820 2846 +26
- Partials 2187 2188 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
CodeRabbit flagged February 29 in parseYearlessDateToEpoch, and the problem is worse than a failed parse. DateTimeFormatter defaults to ResolverStyle.SMART, which silently clamps an out-of-range day rather than rejecting it, so "Feb 29" resolved against a non-leap current year produced February 28 of that year -- a wrong date, quietly, with no exception for the caller to react to. Confirmed against the JDK: SMART gives 2025-02-28, LENIENT gives 2025-03-01, only STRICT throws. The parse is now STRICT, and a candidate that is invalid or lands in the future is reparsed with the previous year rather than having a year subtracted from it. Subtracting would have hit the same clamp from the other direction, turning a valid February 29 into the 28th. A leap day valid in neither candidate year now yields 0 rather than a plausible wrong answer. Reachable in the generic UNIX who reader, where a session that began on February 29 and is read during the following non-leap year would have been reported a day early, and in the AIX who -b path added in this branch. Also fixes the spotless violation in ParseUtilTest that failed lint: the last edit landed after the final spotless:apply. The checkstyle suppression for ParseUtil's legacy lowercase Pattern constants is keyed to line numbers, so the added ResolverStyle import shifted "slash" out of the range and failed ConstantName. Bounds updated and commented to say so.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
oshi-common/src/test/java/oshi/util/ParseUtilTest.java (1)
1019-1036: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd a non-leap invalid-date fixture.
The leap-day cases cover one invalid calendar date. Add a case such as
Apr 31where both candidate years are invalid and the result must be0L. This protects the strict parsing contract from future lenient normalization.Proposed test
+ assertThat("Parse invalid date when neither candidate year is valid", + ParseUtil.parseYearlessDateToEpoch("Apr 31 12:00", "MMM d HH:mm", now), is(0L));🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@oshi-common/src/test/java/oshi/util/ParseUtilTest.java` around lines 1019 - 1036, Add a ParseUtil.parseYearlessDateToEpoch test alongside the existing leap-day cases using an invalid date such as “Apr 31” with a current date whose current and previous candidate years both apply; assert the result is 0L, preserving strict rejection rather than lenient normalization.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@oshi-common/src/test/java/oshi/util/ParseUtilTest.java`:
- Around line 1019-1036: Add a ParseUtil.parseYearlessDateToEpoch test alongside
the existing leap-day cases using an invalid date such as “Apr 31” with a
current date whose current and previous candidate years both apply; assert the
result is 0L, preserving strict rejection rather than lenient normalization.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: da8d5032-0330-48a3-858c-2d7bf01eed5d
📒 Files selected for processing (3)
config/checkstyle-suppressions.xmloshi-common/src/main/java/oshi/util/ParseUtil.javaoshi-common/src/test/java/oshi/util/ParseUtilTest.java
🚧 Files skipped from review as they are similar to previous changes (1)
- oshi-common/src/main/java/oshi/util/ParseUtil.java
📜 Review details
⏰ Context from checks skipped due to timeout. (11)
- GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
- GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
- GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
- GitHub Check: Analyze (java)
- GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
- GitHub Check: Test JDK 21, ubuntu-latest
- GitHub Check: Test JDK 26, ubuntu-latest
- GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
- GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
- GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
- GitHub Check: Codacy Static Code Analysis
🧰 Additional context used
📓 Path-based instructions (3)
**/*
📄 CodeRabbit inference engine (AGENTS.md)
Do not commit generated output,
target/, or IDE files.
Files:
config/checkstyle-suppressions.xmloshi-common/src/test/java/oshi/util/ParseUtilTest.java
oshi-common/**/*.java
📄 CodeRabbit inference engine (AGENTS.md)
oshi-common/**/*.java: Keeposhi-commonpure Java 8: it must not reference JNA, FFM, or native loading APIs; shared parsing, conversion, validation, caching, and string logic belongs here rather than duplicated in platform implementations.
Useoshi.util.ParseUtilparsing helpers instead of banned numeric parsing APIs such asInteger.parseInt,Long.parseLong,Double.parseDouble, andInteger.decode.
Do not importorg.slf4j.event.**; useoshi.util.LogLevelinstead.
Prefer hoisting non-native logic intooshi-commonso JNA and FFM implementations share parsing, conversion, validation, sorting, filtering, caching, and sentinel handling instead of duplicating it.
Add runtime configuration tooshi-common/src/main/resources/oshi.propertiesand access it throughoshi.util.GlobalConfig; do not introduce a separate configuration mechanism.
Files:
oshi-common/src/test/java/oshi/util/ParseUtilTest.java
**/*Test.java
📄 CodeRabbit inference engine (AGENTS.md)
Use JUnit 5 and Hamcrest; do not add Mockito. Extract parsing from acquisition so parsing methods accept fixture data such as
List<String>orStringand acquisition methods remain thin.
Files:
oshi-common/src/test/java/oshi/util/ParseUtilTest.java
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: oshi/oshi
Timestamp: 2026-08-02T16:49:58.420Z
Learning: Before final verification, rebuild from the repository root with the relevant dependency modules included (`clean install` or `-am`) to avoid stale `oshi-common` artifacts from `~/.m2`.
Learnt from: CR
Repo: oshi/oshi
Timestamp: 2026-08-02T16:49:58.420Z
Learning: Before opening a PR, run formatting, Checkstyle, install, forbidden-API checks, and Javadoc generation in that order for touched modules.
Learnt from: CR
Repo: oshi/oshi
Timestamp: 2026-08-02T16:49:58.420Z
Learning: Do not add dependencies without discussion or manually bump dependency versions; Renovate manages dependency updates.
Learnt from: CR
Repo: oshi/oshi
Timestamp: 2026-08-02T16:49:58.420Z
Learning: Branch from `master`, target PRs at `master`, describe what changed and why in commit messages, and do not add sign-off or `Co-Authored-By` trailers unless requested.
🔇 Additional comments (3)
oshi-common/src/test/java/oshi/util/ParseUtilTest.java (2)
998-1017: LGTM!
1037-1041: LGTM!config/checkstyle-suppressions.xml (1)
11-13: LGTM!
CodeRabbit nit: the leap-day cases only cover a date that is valid in some years, so they would still pass if the resolver merely happened to reject February 29. Apr 31 exists in no year, and the default resolver normalizes it to April 30 rather than rejecting it (LENIENT gives May 1; only STRICT throws), so this pins the strict behavior for the general invalid-date case. Test-only.
The line ranges in checkstyle-suppressions.xml broke last week: adding an import to ParseUtil shifted its lowercase Pattern constants out of lines="117-136", and ConstantName failed on a constant the change never touched. Both remaining ranges are gone, and three drift-proof mechanisms are enabled to replace them. SuppressWarningsFilter/SuppressWarningsHolder honor @SuppressWarnings("checkstyle:CheckName") on a declaration. SuppressionCommentFilter gives CHECKSTYLE:OFF/ON around a contiguous region, which is what ParseUtil's six constants and MacOperatingSystem's four protected fields now use -- a region survives edits both above and inside it, where a line count does not. SuppressWithNearbyCommentFilter covers one-offs. Verified by deleting the markers: 10 violations return (6 ConstantName, 4 VisibilityModifier), 0 with them. The Sonar comments had drifted into four spellings: NOSONAR squid:Sxxxx, NOSONAR:squid:S5843 with a stray colon, NOSONAR java:Sxxxx, and a bare NOSONAR with no rule recorded at all. All are now "// NOSONAR java:Sxxxx - why", on the modern prefix (squid: was retired years ago; S00107 also becomes S107). The two bare ones were identified from their code: a hardcoded 0.0.0.0 is S1313, and catch (Throwable) is S1181, matching how the same patterns are already marked elsewhere. Two comments in AdlUtilFFM and BStrFFM described a suppression in prose and so contained the word NOSONAR, which silently suppressed their own line. Reworded to say "the suppression on the next line". AGENTS.md documents both conventions, including two things worth knowing: NOSONAR suppresses every issue on its line regardless of the rule id written after it, which is documentation only and not parsed; and @SuppressWarnings is rule-scoped and preferred where there is something to annotate, but is not honored for S3077. Also fixes the five open Sonar issues, all java:S8694 from #3561's own test using int month literals where ParseUtilTest used Month constants. Left alone: two bare NOSONAR comments on the Addrinfo try-with-resources in MacNetworkParamsJNA and FreeBsdNetworkParamsJNA. The rule is not determinable from the code and Sonar retains no history for either file, so naming one would be a guess. Drop the suppression and read the next scan to resolve them.
An AIX CI run reported
Uptime: 0 days, 00:00:02and a boot time twenty seconds in the past, four minutes after the same box had correctly reported 166 days. The machine had not rebooted — the serial number and UUID are identical across both readings, and it is at 169 days now.The zero-uptime fallback
AixOperatingSystemderived its boot time ascurrentTimeMillis() - Uptime.queryUpTime(). That query returns0both when the system just booted and when theuptimecommand could not be run, so a transient failure on a loaded shared box produced a boot time of "now" and an uptime of zero.Two things made that worse than a one-off bad reading:
static finalfield computed at class load, so a single failure poisoned the boot time for the life of the JVM.resolveBootTimeMillisnow treats a zero uptime as unknown rather than as a valid duration, and the cache stores only a successful reading, so a failed query is retried on the next call. The cache stays static so the JNA and FFM backends report an identical boot time rather than each deriving one from a separately-timed reading of a minute-resolution source —NativeComparisonTestasserts they are equal.The
uptimecommand is now preferred overwho -b: it reports a duration, which is unambiguous, wherewho -breports a timestamp whose AIX format may carry no year.The
who -bformat has never parsed on AIXwho -bon AIX 7.3 prints, in both the C and en_US locales:BOOT_FORMAT_AIXhas only ever matched a four-digityyyy-MM-dddate — in every revision since the original 2020 AIX port, confirmed withgit log -p. So the primary source has never parsed on this box, leaving theuptimecommand as the only one. Both forms are now accepted. The year-less one resolves to the most recent occurrence, which cannot disambiguate a system up more than a year, and is why it is consulted only after the unambiguous duration.Hoisting rather than duplicating
Resolving a year-less timestamp already existed in the generic UNIX
whoreader, which parses the sameMMM d HH:mmform. Rather than write a second copy, the logic is hoisted toParseUtil.parseYearlessDateToEpochand both drivers call it.That also fixes a latent bug in the generic reader: its default year was captured in a
staticformatter when the class loaded, so it would have gone stale in a JVM running across a new year.AGENTS.mdgains a note to checkParseUtilbefore writing a parsing helper — this duplication was easy to miss because the two copies lived in per-platform drivers nobody would read side by side.Verification
Checked against the real
gcc119AIX 7.3.0.0 box over ssh. The test fixture is the exact line it emits, trailing padding included, captured withwho -b | od -c. Locale sensitivity was ruled out by runningwho -bunder bothLC_ALL=CandLC_ALL=en_US.Full gate green on all 8 modules: spotless, checkstyle, install, forbiddenapis, javadoc, and 1504 tests successful / 0 failed.
The AIX-specific paths cannot be exercised by CI on this host; the parse seams are covered by fixture tests, and the cfarm AIX job will exercise the rest.
Summary by CodeRabbit
Bug Fixes
Documentation