Make instruction set parsing compatible with file >= v5.46 (#8226)

The identifier for 32-bit Intel ELF files was changed in `file` v5.46:
45702aaa99.
This commit is contained in:
narpfel
2025-10-28 18:01:23 +01:00
committed by GitHub
parent 9a48087a0a
commit 938d0e5d14
2 changed files with 10 additions and 0 deletions

View File

@@ -48,6 +48,9 @@ export class BinaryInfoLinux {
case 'intel 80386': {
return 'x86';
}
case 'intel i386': {
return 'x86';
}
case '80386': {
return 'x86';
}

View File

@@ -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');
});
});