public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/24583]  New: InetAddress.getLocalHost() returns broken InetAddress object when run in chroot
@ 2005-10-30  0:18 greenrd at gcc dot gnu dot org
  2005-10-30  0:21 ` [Bug libgcj/24583] " greenrd at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: greenrd at gcc dot gnu dot org @ 2005-10-30  0:18 UTC (permalink / raw)
  To: java-prs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-01-29 17:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-30  0:18 [Bug libgcj/24583] New: InetAddress.getLocalHost() returns broken InetAddress object when run in chroot greenrd at gcc dot gnu dot org
2005-10-30  0:21 ` [Bug libgcj/24583] " greenrd at gcc dot gnu dot org
2005-10-30 12:00 ` [Bug libgcj/24583] [4.0 only] InetAddress.getLocalHost() returns broken InetAddress object when local hostname cannot be resolved greenrd at gcc dot gnu dot org
2005-10-30 15:14 ` pinskia at gcc dot gnu dot org
2006-01-29 17:46 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).