Open nsayer opened 7 years ago
Our code is fairly straightforward:
POSIX posix = POSIXFactory.getPOSIX(); Passwd pwd = posix.getpwnam(user);
That last line is the one that throws the exception.
That's very strange. It is possible that changed Java method dispatch rules in Java 8 are causing to to call a wrong overload? We use getpwnam in JRuby on Java 8 and it works fine.
Bueller?
There isn't really a way to implement this in the pure Java code. Are you disabling the native version for some reason? Or perhaps on your platform it stop loading correctly?
I don't know why we would have broken this on purpose, so I suspect it was never implemented.
We're not doing anything particular to prevent the native code running. The only difference is the JDK version.
We use jnr-posix to relinquish root privileges after opening server sockets (that is, listening sockets < 1024). With java 8, we get
java.lang.IllegalStateException: getpwnam unimplemented is not implemented in jnr-posix at jnr.posix.util.DefaultPOSIXHandler.unimplementedError(DefaultPOSIXHandler.java:28) at jnr.posix.JavaPOSIX.getpwnam(JavaPOSIX.java:176) at jnr.posix.LazyPOSIX.getpwnam(LazyPOSIX.java:198)
This worked fine in previous JREs.