Improving the Identication of Linux Distributions when Dumping

Dr Andrew John Hughes gnu_andrew at member.fsf.org
Fri Apr 8 17:15:49 PDT 2011


It makes sense to include the distro-pkg-dev list on this discussion
rather than keeping it hidden away on this list that most distro
vendors won't be on.  CCing it.

On 4 April 2011 02:51, Robert Ottenhag <robert.ottenhag at oracle.com> wrote:
>
> I am about to improve the identification of popular Linux distros during dumping, see bug [1] and [2], that states that we should "correctly identify Ubuntu as the operating system in crash report instead of 'Debian'".
>
>
>
> I am somewhat reluctant to directly apply the suggested patch though which only adds to the existing problematic implementation where some distros not are identified at all, or are identified as a different distro.
>
>
>
> The current implementation [4] relies on the fact that most Linux distros have /etc/XXX-release files, where some distros have multiple files (see [3]). It then checks a fixed set of these files in order, and stops at the first matching file, so the order is important.
>
>
>
> (0) the current order is "/etc/mandrake-release", "/etc/sun-release", "/etc/redhat-release", "/etc/SuSE-release", "/etc/turbolinux-release", "/etc/gentoo-release", "/etc/debian_version", "/etc/ltib-release", "/etc/angstrom-version", and the proposed patch is to insert "/etc/lsb-release" right before "/etc/debian_version".
>
>
>
> If we instead of (0) replace it by (1) and (2) below it will be improved in many ways.
>
>
>
> (1) call the "lsb_release" tool, if it exists, which returns distro specific info based on either /etc/lsb_release or /etc/XXX-release, and that also knows which of multiple /etc/XXX-release files to check first, e.g. /etc/enterprise-linux before /etc/redhat-linux.
>

This also won't work if the tool isn't installed.  Most of the time,
it isn't.  We found this when support was added to IcedTea to use its
content in the HotSpot crash dump and added it as a dependency in
distro packages as a result.

>
>
> (2) list all /etc/*-release and /etc/*_version files, headed by the respective file names
>

That would appear to create a lot of empty fields with no information.

>
>
> The problem with (1) is that it calls an external process during a phase with might be very critical on resources, and it might not be available on specific old or embedded distros.  Thus we still need (2) for which we need to verify that directory listing does not violate similar resource contraints.  Regarding (2) the order of listed files should also be considered if it simplifies parsing of the dump output.
>
>
>
> The new solution would look something like
>
>   OS:
>
>     /etc/debian_version
>
>        <content>
>
>     /etc/lsb-release
>
>        <content>
>
>
>
> Fundamentally, instead of having the JVM to try identify the Linux distro, it becomes up to the reader/parser of the dump output, but with the benefit of having all data available.
>

I really don't see why the current solution is such a problem.  This
sounds like it's just going to make the output messy.

>
>
> References:
>
>
>
> [1] https://bugs.openjdk.java.net/show_bug.cgi?id=100137
>
> [2] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6986195
>
> [3] http://linuxmafia.com/faq/Admin/release-files.html
>
> [4] hotspot/src/os/linux/vm/os_linux.cpp:os::print_os_info().
>
>
>
> I appreciate any comments and ideas.
>
>
>
> Thanks
>
>
>
> /Robert
>
>
>
> --
>
> Robert Ottenhag | Senior Member of Technical Staff
> Phone: +46850630961 | | Fax: +46850630911 | | Mobile: +46707106161
> Oracle Oracle Java VM
> ORACLE Sweden | Folkungagatan 122 | SE-116 30 Stockholm
>
> Oracle Svenska AB, Kronborgsgränd 17, S-164 28 KISTA, reg.no. 556254-6746
>
> Oracle is committed to developing practices and products that help protect the environment
>
>


--
Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net

PGP Key: F5862A37 (https://keys.indymedia.org/)
Fingerprint = EA30 D855 D50F 90CD F54D  0698 0713 C3ED F586 2A37


More information about the hotspot-runtime-dev mailing list