Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

Report compile time and runtime glibc version #76

Closed
wants to merge 3 commits into from

Conversation

richardlau
Copy link
Member

Fixes #74.

Sample output after change:

node-report version: 2.1.1 (built against Node.js v4.8.0, glibc 2.17)

OS version: Linux 3.13.0-98-generic #145-Ubuntu SMP Sat Oct 8 20:13:07 UTC 2016
(glibc: 2.19)

Uses dlsym() to lookup gnu_get_libc_version() in case the runtime is not GNU C Library.

Use dlsym() to lookup gnu_get_libc_version() in case the runtime is
not GNU C Library.
test/common.js Outdated
const libcMatch = libcRE.exec(sysInfoSection);
if (libcMatch != null) {
const libcPath = libcMatch[1];
const child = child_process.spawnSync(libcPath, { encoding: 'utf8' });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're executing libc.so.6 here? That actually works on your system?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works on mine (linux):

% /lib/x86_64-linux-gnu/libc.so.6
GNU C Library (Ubuntu GLIBC 2.24-3ubuntu2) stable release version 2.24, by Roland McGrath et al.
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 6.2.0 20161005.
Available extensions:
        crypt add-on version 2.1 by Michael Glad and others
        GNU Libidn by Simon Josefsson
        Native POSIX Threads Library by Ulrich Drepper et al
        BIND-8.2.3-T5B
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, I see glibc has a __libc_main entry point in its ELF header but that only works when the .so has the executable bit set. I don't know if that is something you can rely on but it is the case on the three Linux systems (Debian, Ubuntu, Fedora) in my household.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The official FAQ says:

If you want to find out about the version from the command line simply run the libc binary. This is probably not possible on all platforms but where it is simply locate the libc shared library and start it as an application.

I've changed the test to use strings.

out << std::endl << "node-report version: " << NODEREPORT_VERSION
<< " (built against Node.js v" << NODE_VERSION_STRING;
#if defined(__GLIBC__)
out << ", glibc "<< __GLIBC__ << "." << __GLIBC_MINOR__;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after "?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@rnchamberlain
Copy link
Contributor

LGTM, landing this shortly

rnchamberlain pushed a commit that referenced this pull request Mar 16, 2017
Use dlsym() to lookup gnu_get_libc_version() in case the runtime is
not GNU C Library.

PR-URL: #76
Reviewed-By: Richard Chamberlain <richard_chamberlain@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@rnchamberlain
Copy link
Contributor

Landed as d44c1c7

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants