When a Java program is run in a chroot environment on Linux, InetAddress.getLocalHost() returns a broken InetAddress object (broken in the same way as it was in bug 17069).
Test case: import java.net.InetAddress; import java.net.UnknownHostException; public class TestAddr { public static void main (String args []) throws UnknownHostException { InetAddress.getLocalHost ().getAddress (); } } // end of class TestAddr The test case prints this inside the chroot: Exception in thread "main" java.lang.NullPointerException at java.net.InetAddress.getAddress() (/usr/lib/libgcj.so.6.0.0) at TestAddr.main(java.lang.String[]) (Unknown Source) at gnu.java.lang.MainThread.call_main() (/usr/lib/libgcj.so.6.0.0) at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0) and nothing when not in a chroot. By using LD_LIBRARY_PATH I have verified that the brokenness _is_ triggered by the chroot, not by the different versions of libc and libgcj that are dynamically linked against when inside the chroot: bash-3.00$ LD_LIBRARY_PATH=/mnt/rawhide/usr/lib:/mnt/rawhide/lib ldd /mnt/rawhide/home/greenrd/testaddr linux-gate.so.1 => (0xffffe000) libgcc_s.so.1 => /mnt/rawhide/lib/libgcc_s.so.1 (0x00db1000) libgcj.so.6 => /mnt/rawhide/usr/lib/libgcj.so.6 (0x02000000) libm.so.6 => /mnt/rawhide/lib/libm.so.6 (0x00354000) libpthread.so.0 => /mnt/rawhide/lib/libpthread.so.0 (0x00390000) libz.so.1 => /mnt/rawhide/usr/lib/libz.so.1 (0x0037b000) libdl.so.2 => /mnt/rawhide/lib/libdl.so.2 (0x0034e000) libc.so.6 => /mnt/rawhide/lib/libc.so.6 (0xf7ed1000) /lib/ld-linux.so.2 (0x00248000) bash-3.00$ LD_LIBRARY_PATH=/mnt/rawhide/usr/lib:/mnt/rawhide/lib /mnt/rawhide/home/greenrd/testaddr bash-3.00$ The real /dev, /proc and /sys are mounted inside the chroot, and /sbin/ifconfig can see all the network interfaces and their IPs when run as the same user from inside the chroot, so it is not the case that the kernel is hiding this information. -- Summary: InetAddress.getLocalHost() returns broken InetAddress object when run in chroot Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libgcj AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: greenrd at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24583