From ffbd527bc589df60ea59eeded145c221f7be7f1f Mon Sep 17 00:00:00 2001 From: Gabriel Grubba Date: Wed, 1 Apr 2026 22:02:59 -0300 Subject: [PATCH] DEV: remove travis reference --- packages/webapp/socket_file_tests.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/webapp/socket_file_tests.js b/packages/webapp/socket_file_tests.js index 2dbde1927f..19858bd65f 100644 --- a/packages/webapp/socket_file_tests.js +++ b/packages/webapp/socket_file_tests.js @@ -26,6 +26,20 @@ const isMacOS = () => { return platform() === 'darwin'; }; +// Resolve the current process's primary group name by looking up its GID in +// /etc/group. This is used in tests that chown a socket file: we need a group +// the running user actually belongs to, so the chown doesn't fail with EPERM. +const getCurrentGroupName = () => { + try { + const gid = userInfo().gid; + const lines = readFileSync('/etc/group', 'utf8').split('\n'); + const match = lines.find(line => parseInt(line.split(':')[2], 10) === gid); + return match ? match.split(':')[0] : null; + } catch (_) { + return null; + } +}; + const removeTestSocketFile = () => { try { unlinkSync(testSocketFile); @@ -133,7 +147,7 @@ testAsyncMulti( // use UNIX_SOCKET_PATH and UNIX_SOCKET_GROUP const { httpServer, server } = prepareServer(); - const groupToUse = Boolean(process.env.TRAVIS) && 'travis' || (isMacOS() ? 'staff' : 'root'); + const groupToUse = isMacOS() ? 'staff' : (getCurrentGroupName() || 'root'); process.env.UNIX_SOCKET_PATH = testSocketFile; process.env.UNIX_SOCKET_GROUP = groupToUse; process.env.UNIX_SOCKET_PERMISSIONS = '777';