diff --git a/lib/detect-libc.js b/lib/detect-libc.js index f2b5608..8e221a1 100644 --- a/lib/detect-libc.js +++ b/lib/detect-libc.js @@ -86,7 +86,7 @@ const getFamilyFromLddContent = (content) => { if (content.includes('musl')) { return MUSL; } - if (content.match(/libc/i)) { + if (content.includes('GNU C Library')) { return GLIBC; } return null; diff --git a/test/unit.js b/test/unit.js index 3c2cdd8..e6268c2 100644 --- a/test/unit.js +++ b/test/unit.js @@ -58,23 +58,7 @@ test('linux - glibc family detected via ldd', async (t) => { isLinux: () => true }, './filesystem': { - readFile: () => Promise.resolve('bunch-of-text GLIBC') - } - }); - - t.is(await libc.family(), libc.GLIBC); - t.false(await libc.isNonGlibcLinux()); -}); - -test('linux - glibc family detected via ldd (libc)', async (t) => { - t.plan(2); - - const libc = proxyquire('../', { - './process': { - isLinux: () => true - }, - './filesystem': { - readFile: () => Promise.resolve('TEXTDOMAIN=libc') + readFile: () => Promise.resolve('# This file is part of the GNU C Library.') } }); @@ -90,23 +74,7 @@ test('linux - glibc familySync detected via ldd', async (t) => { isLinux: () => true }, './filesystem': { - readFileSync: () => 'bunch-of-text GLIBC' - } - }); - - t.is(libc.familySync(), libc.GLIBC); - t.false(libc.isNonGlibcLinuxSync()); -}); - -test('linux - glibc familySync detected via ldd (libc)', async (t) => { - t.plan(2); - - const libc = proxyquire('../', { - './process': { - isLinux: () => true - }, - './filesystem': { - readFileSync: () => 'TEXTDOMAIN=libc' + readFileSync: () => '# The GNU C Library is free software; you can redistribute it and/or' } });