Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't rely on external commands #1

Closed
piranna opened this issue Jul 12, 2017 · 6 comments
Closed

Don't rely on external commands #1

piranna opened this issue Jul 12, 2017 · 6 comments

Comments

@piranna
Copy link

piranna commented Jul 12, 2017

Allow to detect system libc on systems that don't have getconf or ldd commands, like NodeOS. This would be done by reading the symlink at /lib/libc.so.

@lovell
Copy link
Owner

lovell commented Jul 12, 2017

Hello, are you able to provide a (partial) code sample or worked example to help me understand how the symlink will help determine libc family?

@piranna
Copy link
Author

piranna commented Jul 12, 2017

ls -l /lib/ld-linux.so.2 
lrwxrwxrwx 1 root root 25 jun 16 20:42 /lib/ld-linux.so.2 -> i386-linux-gnu/ld-2.24.so

That's for Ubuntu GNU system, for musl systems the symlink path will by *-musl. In NodeOS code there are some similar checks for this and for the ARM different floating point architectures.

@lovell
Copy link
Owner

lovell commented Jul 12, 2017

Thank you. I fired up a few different Linux VMs and the presence of a /lib/*-linux-gnu directory seems to indicate glibc and the presence of a /lib/libc.musl-* or /lib/ld-musl-* file indicates musl. This should be enough for some filesystem-based checks to determine the libc family (but perhaps not the version) should getconf etc. fail.

@lovell
Copy link
Owner

lovell commented Jul 13, 2017

Here's what I see for NodeOS, which suggests the check for /lib/ld-musl-* will work.

$ docker run --rm -t -i nodeos/nodeos
Starting REPL session
NodeOS-boot-multiuser> fs.readdirSync('/lib')
[ 'ld-musl-x86_64.so.1',
  'libc.so',
  'libfuse.so',
  'libfuse.so.2',
  'libfuse.so.2.9.7',
  'libgcc_s.so.1',
  'libstdc++.so.6',
  'libstdc++.so.6.0.21',
  'node_modules' ]

@piranna
Copy link
Author

piranna commented Jul 13, 2017

Then you have the answer :-)

@lovell
Copy link
Owner

lovell commented Jul 13, 2017

Thanks, support for filesystem-based family detection is now available in v0.2.0.

@lovell lovell closed this as completed Jul 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants