On Thu, 1 Jan 2026 04:37:38 GMT, Weijun Wang <[email protected]> wrote:
>> src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixSystem.java
>> line 152:
>>
>>> 150: int out = (int) getpwuid_r.invokeExact(
>>> 151: tmpUid, resbuf, pwd_buf, GETPW_R_SIZE_MAX, pwd);
>>> 152: if (out != 0 || pwd.get(ValueLayout.ADDRESS,
>>> 0).equals(MemorySegment.NULL)) {
>>
>> The additional `|| pwd.get(ValueLayout.ADDRESS,
>> 0).equals(MemorySegment.NULL)` breaks AIX. The included test passes when we
>> remove it and we get the correct username.
>> @JoKern65, @varada1110: Do you know why `getpwuid_r` writes nullptr (or
>> nothing) to `result` on a successful query?
>
> First, thank you so much for the experiments.
>
> Here, I think I follow the C checks in the old `Unix.c`:
>
> if (getpwuid_r(getuid(), &resbuf, pwd_buf, sizeof(pwd_buf), &pwd) == 0 &&
> pwd != NULL) {
>
> How did it run in AIX?
The old C code works on AIX. I haven't figured out what causes different
behavior with the new code. Note that the new code works on linux on ppc64 (big
and little endian).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28931#discussion_r2657691333