From 938d0e5d14d466156701f2b20e1daa2c3f7f7a06 Mon Sep 17 00:00:00 2001 From: narpfel Date: Tue, 28 Oct 2025 18:01:23 +0100 Subject: [PATCH] Make instruction set parsing compatible with `file` >= v5.46 (#8226) The identifier for 32-bit Intel ELF files was changed in `file` v5.46: https://github.com/file/file/commit/45702aaa99b982af7bf0b7ffd60f8b0a831ff8b5. --- lib/binaries/binary-utils.ts | 3 +++ test/execution-triple-tests.ts | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/lib/binaries/binary-utils.ts b/lib/binaries/binary-utils.ts index a478d3e0b..e6f1cac09 100644 --- a/lib/binaries/binary-utils.ts +++ b/lib/binaries/binary-utils.ts @@ -48,6 +48,9 @@ export class BinaryInfoLinux { case 'intel 80386': { return 'x86'; } + case 'intel i386': { + return 'x86'; + } case '80386': { return 'x86'; } diff --git a/test/execution-triple-tests.ts b/test/execution-triple-tests.ts index 8f7303eca..608e64b14 100644 --- a/test/execution-triple-tests.ts +++ b/test/execution-triple-tests.ts @@ -75,4 +75,11 @@ describe('Execution triple utils', () => { expect(info?.instructionSet).toEqual('avr'); expect(info?.os).toEqual('linux'); }); + it('recognizes 32-bit Intel for file >= v5.46', () => { + const info = BinaryInfoLinux.parseFileInfo( + 'ELF 32-bit LSB executable, Intel i386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=936152b4351a49d381553a593f68286e1069435f, for GNU/Linux 4.4.0, not stripped', + ); + expect(info?.instructionSet).toEqual('x86'); + expect(info?.os).toEqual('linux'); + }); });